gold/
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2013-04-15 Cary Coutant <ccoutant@google.com>
2
3 * layout.cc (Layout::set_relocatable_section_offsets): Don't
4 allocate space in file for BSS sections.
5
6 2013-04-15 Cary Coutant <ccoutant@google.com>
7
8 * script-sections.cc (Orphan_output_section): Reset address
9 to zero after each orphaned section for relocatable links.
10
11 2013-04-15 Cary Coutant <ccoutant@google.com>
12
13 * symtab.cc (Symbol_table::sized_write_globals): Subtract
14 section starting address for relocatable link.
15 * testsuite/Makefile.am (script_test_11): New test.
16 * testsuite/Makefile.in: Regenerate.
17 * testsuite/script_test_11.c: New source file.
18 * testsuite/script_test_11.t: New linker script.
19
20 2013-04-13 Alan Modra <amodra@gmail.com>
21
22 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
23 owner when sections are not adjacent and exceed group size.
24 (Target_powerpc::group_sections): Handle corner case.
25 (Target_powerpc::Branch_info::make_stub): Handle case where
26 stub table doesn't exist due to branches in non-exec sections.
27 (Target_powerpc::Relocate::relocate): Likewise.
28
29 2013-04-11 Alan Modra <amodra@gmail.com>
30
31 PR gold/15354
32 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
33 .branch_lt to match bfd ld. Adjust comments throughout file.
34
35 2013-04-04 Ian Lance Taylor <iant@google.com>
36
37 GCC PR c++/56840
38 * object.cc (do_layout_deferred_sections): Handle .eh_frame
39 sections before checking whether they are included in the link.
40
41 2013-03-29 Sriraman Tallam <tmsriram@google.com>
42
43 * archive.cc (Archive::get_elf_object_for_member): Create the elf
44 object before calling the plugin claim_file handler. Pass the elf
45 object of the archive to the plugin. Delete the elf object if the
46 plugin claims the file.
47
48 2013-03-21 Alan Modra <amodra@gmail.com>
49
50 * layout.cc (Layout::set_segment_offsets): Accept writable .text
51 segment when omagic.
52
53 2013-03-21 Alan Modra <amodra@gmail.com>
54
55 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
56 comparison warning.
57 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
58 uninitialized" warning.
59
60 2013-03-20 Alan Modra <amodra@gmail.com>
61
62 * symtab.h (Symbol::clear_version): New function.
63 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
64 is_needed by weak references. Clear version for symbols defined
65 in as-needed objects that are not needed.
66
67 2013-03-15 Alan Modra <amodra@gmail.com>
68
69 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
70 static and public. Add report_err param. Return false for data refs.
71 (Target_powerpc::rela_dyn_section): New overloaded function.
72 (Target_powerpc::plt_, iplt_): Elucidate.
73 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
74 (Output_data_plt_powerpc::do_write): Don't write .iplt.
75 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
76 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
77 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
78 push_branch and make_plt_entry for ifunc syms when
79 reloc_needs_plt_for_ifunc.
80 (Target_powerpc::Relocate::relocate): Don't use plt entry value
81 for ifunc unless reloc_needs_plt_for_ifunc.
82
83 2013-03-15 Alan Modra <amodra@gmail.com>
84
85 * gc.h (gc_process_relocs): Don't look through function descriptors.
86 * icf.cc (get_section_contents): Do so here instead.
87
88 2013-03-13 Alan Modra <amodra@gmail.com>
89
90 * powerpc.cc (is_branch_reloc): Forward declare.
91 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
92 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
93 false for 64-bit, true for 32-bit non-branch relocs.
94 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
95 * testsuite/Makefile.am (icf_test): Use linker map file instead of
96 nm output.
97 (icf_safe_test): Generate linker map file as well as nm output.
98 (icf_safe_so_test): Likewise.
99 * testsuite/Makefile.in: Regenerate.
100 * testsuite/icf_test.sh: Parse linker map file to determine
101 section folding.
102 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
103 * testsuite/icf_safe_so_test.sh: Likewise.
104 (X86_32_or_ARM_specific_safe_fold): Merge into..
105 (arch_specific_safe_fold): ..this.
106 (X86_64_specific_safe_fold): Delete unused function.
107
108 2013-03-12 Alan Modra <amodra@gmail.com>
109
110 * gc.h (gc_process_relocs): Look through function descriptors
111 to determine shndx, symvalue and addend used by ICF. Tidy
112 variable duplication.
113
114 2013-03-11 Alan Modra <amodra@gmail.com>
115
116 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
117 * layout.cc (Layout_task_runner::run): ..to here.
118 * symtab.h (struct Symbol_location): Extract from..
119 (class Symbol_table): ..here.
120 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
121 * target.h (class Target): Add function_location and
122 do_function_location functions.
123 (class Sized_target): Add do_function_location.
124 * object.h (class Sized_relobj_file): Move find_shdr..
125 (class Object): ..to here.
126 * object.cc: Likewise. Update to suit. Instantiate.
127 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
128 * powerpc.cc (class Powerpc_dynobj): New.
129 (Target_powerpc::do_function_location): New function.
130 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
131 (Powerpc_dynobj::do_read_symbols): New function.
132 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
133
134 2013-03-08 Ian Lance Taylor <iant@google.com>
135
136 * options.cc (General_options::string_to_object_format): Accept
137 "default".
138
139 2013-03-08 Alan Modra <amodra@gmail.com>
140
141 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
142 pointer to Post_fde.
143 (struct Post_fde): Move definition to here..
144 * ehframe.cc (struct Post_fde): ..from here.
145 (Cie::write): Don't alloc Post_fde.
146 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
147
148 2013-03-07 Alan Modra <amodra@gmail.com>
149
150 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
151 relocation referencing .LC0.
152 * testsuite/discard_locals_test.sh: Remove FIXMEs.
153
154 2013-03-07 Alan Modra <amodra@gmail.com>
155
156 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
157 always_inline. Add assembly for powerpc to avoid GOT.
158
159 2013-03-07 Alan Modra <amodra@gmail.com>
160
161 * testsuite/script_test_10.sh: Don't test .bss section
162 header number.
163
164 2013-03-06 Alan Modra <amodra@gmail.com>
165
166 * powerpc.cc (class Powerpc_relobj): Move some member functions.
167 (Target_powerpc::symval_for_branch): Add symtab param. Update
168 all callers. Handle folded sections.
169 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
170 to Powerpc_relobj.
171 (Global_symbol_visitor_opd::operator()): Likewise.
172
173 2013-03-04 Alan Modra <amodra@gmail.com>
174
175 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
176 * testsuite/Makefile.in: Regenerate.
177
178 2013-03-01 Cary Coutant <ccoutant@google.com>
179
180 Add dwp support for v2 DWARF package file format.
181 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
182 tu_length parameter. Adjust all callers.
183 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
184 * dwp.cc: Include dwarf.h.
185 (Section_bounds): New struct type.
186 (Unit_set): New struct type.
187 (Dwo_file::Dwo_file): Initialize new data member.
188 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
189 Combine and rename to...
190 (Dwo_file::read_unit_index): ...this.
191 (Dwo_file::sized_read_compunit_index)
192 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
193 (Dwo_file::sized_read_unit_index): ...this.
194 (Dwo_file::copy_section): Remove section_name, is_str_offsets
195 parameters; add section_id parameter.
196 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
197 (Dwo_file::add_unit_set): ...this.
198 (Dwo_file::shndx_map_): Remove.
199 (Dwo_file::sect_offsets_): New data member.
200 (Dwp_output_file::Dwp_output_file): Initialize new data members.
201 (Dwp_output_file::add_section): Rename to...
202 (Dwp_output_file::add_contribution): ...this.
203 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
204 (Dwp_output_file::add_tu_set): Likewise.
205 (Dwp_output_file::Contribution): New type.
206 (Dwp_output_file::Section::contributions): New data member.
207 (Dwp_output_file::Cu_or_tu_set): Remove.
208 (Dwp_output_file::Section::Section): New ctor.
209 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
210 (Dwp_output_file::Dwp_index::Section_table): New type.
211 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
212 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
213 parameter.
214 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
215 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
216 (Dwp_output_file::Dwp_index::section_table): New member function.
217 (Dwp_output_file::Dwp_index::section_table_end): New member function.
218 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
219 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
220 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
221 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
222 (Dwp_output_file::Dwp_index::section_table_): New data member.
223 (Dwp_output_file::Dwp_index::section_mask_): New data member.
224 (Dwp_output_file::add_output_section): New member function.
225 (Dwp_output_file::write_new_section): New member function.
226 (Dwp_output_file::write_contributions): New member function.
227 (Dwp_output_file::section_id_map_): New data member.
228 (class Dwo_id_info_reader): Remove.
229 (class Unit_reader): New class.
230 (get_dwarf_section_name): New function.
231 (Dwo_file::read_executable): Adjust initializations of class data.
232 (Dwo_file::read): Add support for v2 package file format.
233 (Dwo_file::read_unit_index): Likewise.
234 (Dwo_file::sized_read_unit_index): Likewise.
235 (Dwo_file::copy_section): Likewise.
236 (Dwo_file::add_unit_set): Likewise.
237 (Dwp_output_file::add_output_section): Likewise.
238 (Dwp_output_file::add_contribution): Likewise.
239 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
240 for empty slot.
241 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
242 file format.
243 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
244 slot.
245 (Dwp_output_file::initialize): Remove unused function.
246 (Dwp_output_file::finalize): Add support for v2 package file format.
247 (Dwp_output_file::write_index): Likewise.
248 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
249 function prototype.
250
251 2013-03-01 Cary Coutant <ccoutant@google.com>
252
253 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
254 function into class definition in header file.
255 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
256 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
257 New function.
258 (Dwarf_info_reader::check_buffer): Move here from .cc file.
259
260 2013-02-28 Alan Modra <amodra@gmail.com>
261
262 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
263 * target.cc (Target::do_plt_fde_location): New function.
264 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
265 accessor function, and constructor param.
266 (struct Post_fde, Post_fdes): Declare.
267 (Cie::write): Add post_fdes param.
268 * ehframe.cc (Fde::write): Use plt_fde_location.
269 (struct Post_fde): Define.
270 (Cie::write): Stash FDEs added post merge mapping.
271 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
272 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
273 (Eh_frame::do_sized_write): Arrange to write post map FDES after
274 other FDEs.
275 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
276 (Target_powerpc::has_glink): New function.
277 (Target_powerpc::do_relax): Add eh_frame info for stubs.
278 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
279 glink_eh_frame_fde_32, default_fde): New data.
280 (Stub_table::eh_frame_added_): New var.
281 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
282 Make const.
283 (Stub_table::add_eh_frame): New function.
284 (Output_data_glink::add_eh_frame): New function.
285 (Target_powerpc::make_glink_section): Call add_eh_frame.
286
287 2013-02-15 Ian Lance Taylor <iant@google.com>
288
289 * options.h (DEFINE_uint64_alias): Define.
290 (class General_options): Add -Ttext-segment as an alias for
291 -Ttext.
292
293 2013-02-15 Alan Modra <amodra@gmail.com>
294
295 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
296 (Stub_table::do_write): ..here, two places.
297 (Stub_table::plt_call_size): Use it here too.
298
299 2013-02-11 Ian Lance Taylor <iant@google.com>
300
301 * descriptors.cc (Descriptors::close_all): New function.
302 * descriptors.h (class Descriptors): Declare close_all.
303 (close_all_descriptors): New inline function.
304 * plugin.cc: Include "descriptors.h".
305 (Plugin_manager::cleanup): Call close_all_descriptors.
306
307 2013-02-06 Alan Modra <amodra@gmail.com>
308
309 * README: Update coding style link.
310
311 2013-01-28 Cary Coutant <ccoutant@google.com>
312
313 * dwp.cc (File_list): New typedef.
314 (Dwo_name_info_reader): New class.
315 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
316 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
317 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
318 (Dwo_file::read_executable): New function.
319 (Dwo_file::read): Move common setup code to ...
320 (Dwo_file::make_object): ... here.
321 (dwp_options): Add --exec/-e.
322 (usage): Likewise.
323 (main): Likewise.
324
325 2013-01-24 Sriraman Tallam <tmsriram@google.com>
326
327 * layout.cc (Layout::layout): Check for option text_reorder.
328 (Layout::make_output_section): Ditto.
329 * options.h (text_reorder): New option.
330 * output.cc (Input_section_sort_compare): Remove special ordering
331 of section names.
332 (Output_section::
333 Input_section_sort_section_name_special_ordering_compare::
334 operator()): New function.
335 (Output_section::sort_attached_input_sections): Use new sort function
336 for .text.
337 * output.h (Input_section_sort_section_name_special_ordering_compare):
338 New struct.
339 * testsuite/Makefile.am (text_section_grouping): Test option
340 --no-text-reorder
341 * testsuite/Makefile.in: Regenerate.
342 * testsuite/text_section_grouping.sh: Check order of functions without
343 default text reordering.
344
345 2013-01-18 Mike Frysinger <vapier@gentoo.org>
346
347 * options.h (General_options): Change default to true for new_dtags.
348
349 2013-01-18 Mike Frysinger <vapier@gentoo.org>
350
351 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
352 when enable_new_dtags is false. Only add DT_RUNPATH when
353 enable_new_dtags is true.
354
355 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
356
357 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
358 used in declaration and definition consistent.
359 (Target_powerpc::symval_for_branch): Ditto.
360
361 2013-01-16 Sriraman Tallam <tmsriram@google.com>
362
363 * testsuite/plugin_final_layout.cc: Fix comment.
364
365 2013-01-16 Sriraman Tallam <tmsriram@google.com>
366
367 * layout.cc (Layout::layout): Do not do default sorting for
368 text sections when section ordering is specified.
369 (make_output_section): Ditto.
370 * testsuite/plugin_final_layout.cc: Name the function sections
371 to catch reordering issues.
372
373 2013-01-15 Alan Modra <amodra@gmail.com>
374
375 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
376 plt-thread-safe.
377
378 2013-01-15 Alan Modra <amodra@gmail.com>
379
380 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
381 * testsuite/Makefile.in: Regenerate.
382
383 2013-01-14 Alan Modra <amodra@gmail.com>
384
385 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
386 * testsuite/Makefile.in: Regenerate.
387
388 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
389
390 PR bfd/14430
391 Fix mingw gold build with plugins enabled
392 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
393 * configure.ac: Export DLOPEN_LIBS and add headers check.
394 * plugin.cc: Handle non-dlfcn case.
395 * Makefile.in: Regenerate.
396 * config.in: Regenerate.
397 * configure: Regenerate.
398 * testsuite/Makefile.in: Regenerate.
399
400 2013-01-09 Sriraman Tallam <tmsriram@google.com>
401
402 * output.h (sort_attached_input_sections): Change to be public.
403 * script-sections.cc
404 (Output_section_definition::set_section_addresses): Sort
405 attached input sections according to section order before linker
406 script assigns section addresses.
407 (Orphan_output_section::set_section_addresses): Sort
408 attached input sections according to section order before linker
409 script assigns section addresses.
410 * Makefile.am (final_layout.sh): Use a simple linker script to
411 check if section ordering still works.
412 * Makefile.in: Regenerate.
413
414 2013-01-09 Ben Cheng <bccheng@google.com>
415
416 * arm.cc (Target_arm::attributes_accept_div): New function.
417 (Target_arm::attributes_forbid_div): New function.
418 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
419 attribute using the same new functions as what bfd/elf32_arm.c
420 does.
421
422 2013-01-07 Cary Coutant <ccoutant@google.com>
423
424 PR gold/14993
425 * output.cc (Output_section::add_input_section): For incremental
426 updates, don't track input sections that are allocated from patch
427 space.
428
429 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
430 Ian Lance Taylor <iant@google.com>
431
432 PR gold/14897
433 * configure.ac (--enable-ld): Removed.
434 (install_as_default): Set to yes only for --enable-gold=default
435 or --disable-ld.
436 * configure: Regenerated.
437
438 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
439
440 * options.h (General_options): Add -fuse-ld= for GCC linker
441 option compatibility.
442
443 2013-01-04 Cary Coutant <ccoutant@google.com>
444
445 * configure.ac: Fix typo restoring CXXFLAGS.
446 * configure: Regenerate.
447
448 2013-01-04 Cary Coutant <ccoutant@google.com>
449
450 * testsuite/Makefile.am (CXXLINK_S): New macro.
451 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
452 * testsuite/Makefile.in: Regenerate.
453
454 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
455
456 * version.cc (print_version): Update copyright year to 2013.
457
458 2012-12-20 Ian Lance Taylor <iant@google.com>
459
460 * layout.cc (Layout::special_ordering_of_input_section): New
461 function.
462 (Layout::layout): If input section requires special ordering, must
463 sort input sections.
464 (Layout::make_output_section): May sort .text input sections.
465 (Layout::is_section_name_prefix_grouped): Remove.
466 * layout.h (class Layout): Declare
467 special_ordering_of_input_section. Don't declare
468 is_section_name_prefix_grouped.
469 * output.cc (Output_section::add_input_section): Revert last
470 change.
471 (Output_section::Input_section_sort::match_file_name): Don't crash
472 if called on output section data.
473 (Output_section::Input_section_sort_compare): Sort based on
474 special ordering.
475 (Output_section::Input_section_sort_section_order_index_compare):
476 Revert last patch.
477 (Output_section::sort_attached_input_sections): Likewise.
478
479 2012-12-18 Sriraman Tallam <tmsriram@google.com>
480
481 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
482 * layout.h (Layout::is_section_name_prefix_grouped): New function.
483 * output.cc (Output_section::add_input_section): Check if section
484 name contains special prefix. Keep input sections to sort such
485 sections.
486 (Output_section::Input_section_sort_section_order_index_compare
487 ::operator()): Group sections according to prefixes.
488 (Output_section::sort_attached_input_sections): Add condition to
489 Input_section_entry constructor call.
490 * testsuite/Makefile.am (text_section_grouping): New test.
491 * testsuite/Makefile.in: Regenerate.
492 * testsuite/text_section_grouping.cc: New file.
493 * testsuite/text_section_grouping.sh: New file.
494
495 2012-12-17 Nick Clifton <nickc@redhat.com>
496
497 * Makefile.am: Add copyright notice.
498 * NEWS: Likewise.
499 * README: Likewise.
500 * configure.ac: Likewise.
501 * ftruncate.c: Likewise.
502 * Makefile.in: Regenerate.
503
504 2012-12-14 Cary Coutant <ccoutant@google.com>
505
506 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
507 --no-as-needed flag.
508 (exception_separate_shared_12_test): Likewise.
509 (incremental_copy_test): Likewise.
510 * testsuite/Makefile.in: Regenerate.
511
512 2012-12-14 Cary Coutant <ccoutant@google.com>
513
514 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
515 (Dwp_output_file::Dwp_index::enter_set): Add assert.
516
517 2012-12-12 Alan Modra <amodra@gmail.com>
518
519 * powerpc.cc (class Track_tls): New.
520 (class Relocate, class Scan): Inherit Track_tls.
521 (Target_powerpc::Scan::local, global): Track tls optimization
522 and avoid creating plt entry for __tls_get_addr if all uses
523 are optimized away.
524 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
525
526 2012-12-12 Alan Modra <amodra@gmail.com>
527
528 * options.h (General_options): Add --toc-sort/--no-toc-sort.
529 Replace no_toc_optimize with toc_optimize.
530 * output.h (Output_section::input_sections): Provide non-const variant.
531 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
532 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
533 accessors.
534 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
535 (class Sort_toc_sections): New.
536 (Target_powerpc::do_finalize_sections): Sort toc sections.
537 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
538
539 2012-12-10 Roland McGrath <mcgrathr@google.com>
540
541 * testsuite/binary_unittest.cc (read_all): New function.
542 (Sized_binary_test): Use it instead of ::read.
543 * fileread.cc (do_read): Don't assume pread always reads the whole
544 amount in a single call.
545
546 2012-12-10 Alan Modra <amodra@gmail.com>
547
548 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
549 Set EM_PPC64 or EM_PPC here.
550 (Target_selector_powerpc::do_recognize): Delete.
551
552 2012-12-10 Alan Modra <amodra@gmail.com>
553
554 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
555 stub_table_.
556 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
557
558 2012-12-07 Roland McGrath <mcgrathr@google.com>
559
560 * testsuite/binary_unittest.cc (Sized_binary_test):
561 Use open_descriptor rather than ::open.
562
563 2012-12-07 Alan Modra <amodra@gmail.com>
564
565 * powerpc.cc (Stub_table::do_write): Delete redundant Address
566 typedef and invalid_address constant.
567 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
568 instantiate constants.
569
570 2012-12-06 Roland McGrath <mcgrathr@google.com>
571
572 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
573 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
574 * aclocal.m4: Regenerate.
575 * configure: Regenerate.
576 * Makefile.in: Regenerate.
577 * testsuite/Makefile.in: Regenerate.
578
579 2012-12-07 Alan Modra <amodra@gmail.com>
580
581 * options.h (General_options): Add no_toc_optimize.
582 * powerpc.cc (ok_lo_toc_insn): New function.
583 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
584
585 2012-12-06 Alan Modra <amodra@gmail.com>
586
587 * options.h (General_options): Add plt_align, plt_static_chain,
588 plt_thread_safe. Update stub_group_size help text.
589 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
590 for new plt_thread_safe_ var.
591 (use_plt_offset): Correct comments.
592 (Target_powerpc::do_relax): Look for thread creation symbols to
593 determine default plt_thread_safe value. Clear plt call stubs
594 as well as branch stubs each iteration.
595 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
596 insn constants.
597 (l, hi, ha, write_insn): Move earlier.
598 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
599 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
600 plt stubs too.
601 (Stub_table::update_size): Adjust.
602 (Stub_table::prev_size, set_prev_size): Delete.
603 (Stub_table::stub_align): Let --plt-align affect result.
604 (Stub_table::plt_call_size): Calculate sizes for various stubs.
605 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
606 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
607 (Stub_table::do_write): Support more stub variants.
608
609 2012-12-04 Alan Modra <amodra@gmail.com>
610
611 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
612 (Target_powerpc::do_define_standard_symbols): New function.
613
614 2012-12-03 Alan Modra <amodra@gmail.com>
615
616 * output.h: Formatting, whitespace.
617
618 2012-12-03 Alan Modra <amodra@gmail.com>
619
620 * layout.h (Layout::get_executable_sections): Declare.
621 * layout.cc (Layout::get_executable_sections): New function.
622 * arm.cc (Target_arm::group_sections): Use it.
623 (Arm_output_section::group_sections): Delete now redundant test.
624 * output.cc (Output_reloc::Output_reloc): Add is_relative.
625 param to handle relative relocs.
626 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
627 (Output_data_reloc::add_absolute): Adjust.
628 (Output_data_reloc::add_relative): New function.
629 (Output_data::reset_data_size): New function.
630 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
631 (Output_section::set_addralign): New function.
632 (Output_section::checkpoint_set_addralign): New function.
633 (Output_section::clear_section_offsets_need_adjustment): New function.
634 (Output_section::input_sections): Make public.
635 * powerpc.cc (class Output_data_brlt_powerpc): New.
636 (class Stub_table, class Stub_control): New.
637 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
638 stub_table_, set_stub_table, stub_table): New vectors and accessor
639 functions.
640 (Target_powerpc::do_may_relax, do_relax, push_branch,
641 new_stub_table, stub_tables, brlt_section, group_sections,
642 add_branch_lookup_table, find_branch_lookup_table,
643 write_branch_lookup_table, make_brlt_section): New functions.
644 (Target_powerpc::struct Sort_sections, class Branch_info): New.
645 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
646 branch_info_): New vars.
647 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
648 make call stubs here.
649 (Output_data_glink): Remove all call stub handling from this class.
650 (Target_powerpc::Scan::local, global): Save interesting branch
651 relocs and relocs for ifunc. Adjust calls to plt entry functions.
652 (Target_powerpc::do_finalize_sections): Only make reg save/restore
653 functions on final link.
654 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
655 Handle long branch destinations too.
656 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
657 do_plt_address_for_local): Adjust lookup of plt call stubs.
658
659 2012-11-30 Alan Modra <amodra@gmail.com>
660
661 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
662 relocs against protected symbols when building 32-bit shared libs.
663
664 2012-11-30 Alan Modra <amodra@gmail.com>
665
666 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
667 param. Call got_section() to make .got. Update all callers
668 and their callers and so on.
669
670 2012-11-30 Alan Modra <amodra@gmail.com>
671
672 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
673 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
674 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
675 value if it already exists.
676
677 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
678
679 PR gold/14858
680 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
681
682 2012-11-14 Roland McGrath <mcgrathr@google.com>
683
684 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
685 than bfc instruction for data sandboxing.
686
687 2012-11-08 Alan Modra <amodra@gmail.com>
688
689 * po/POTFILES.in: Regenerate.
690
691 2012-11-05 Alan Modra <amodra@gmail.com>
692
693 * configure.ac: Apply 2012-09-10 change to config.in here.
694 * configure: Regenerate.
695
696 2012-11-05 Alan Modra <amodra@gmail.com>
697
698 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
699 (struct Opd_ent): Use "Address" rather than "Offset".
700 (Output_data_got_powerpc::got_base_offset): Return Valtype.
701 (Target_powerpc::got_section): Make public.
702 (Target_powerpc::scan_relocs): Move code setting symbols..
703 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
704 Create _SDA_BASE_ only when referenced.
705
706 2012-11-02 Roland McGrath <mcgrathr@google.com>
707
708 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
709 from last change.
710
711 2012-11-01 Roland McGrath <mcgrathr@google.com>
712
713 * target.h (Sized_target::relocate_relocs): Use Elf_Off
714 for offset_in_output_section parameter.
715 (Sized_target::relocate_special_relocatable): Likewise.
716 * arm.cc (Target_arm::relocate_relocs): Likewise.
717 (Target_arm::relocate_special_relocatable): Likewise.
718 * i386.cc (Target_i386::relocate_relocs): Likewise.
719 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
720 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
721 * target-reloc.h (relocate_relocs): Likewise.
722 * testsuite/testfile.cc (Target_test): Likewise.
723 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
724 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
725
726 * system.h: Move inclusion of <clocale> to after <libintl.h> in
727 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
728
729 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
730 parameter, which is unused in the [!F_SETFD] case.
731
732 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
733 SYMNDX to off_t before comparing it to this->data_size().
734 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
735 * incremental.cc (Output_section_incremental_inputs::do_write):
736 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
737
738 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
739
740 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
741
742 * gold.cc (Target_arm::do_adjust_elf_header): Add the
743 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
744 in EABI_VER5.
745
746 2012-10-29 Cary Coutant <ccoutant@google.com>
747
748 * dwp.cc (usage): Add file and exit status parameters;
749 add --help and --version options.
750 (print_version): New function.
751 (main): Add --help and --version options.
752
753 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
754
755 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
756 final_layout_sequence.txt.
757 * testsuite/Makefile.in: Regenerated.
758
759 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
760
761 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
762 COMPILE generated by automake.
763 (LINK1): Likewise.
764 (CXXCOMPILE1): Likewise.
765 (CXXLINK1): Likewise.
766 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
767 (LINK): Likewise.
768 (CXXCOMPILE): Likewise.
769 (CXXLINK): Likewise.
770 * testsuite/Makefile.in: Regenerated.
771
772 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
773
774 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
775 on bad fwrite return.
776
777 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
778
779 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
780 on val.
781
782 2012-10-23 Cary Coutant <ccoutant@google.com>
783
784 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
785 * testsuite/Makefile.in: Regenerate.
786 * testsuite/dwp_test.h: New source file.
787 * testsuite/dwp_test_1.cc: New source file.
788 * testsuite/dwp_test_1.s: New source file.
789 * testsuite/dwp_test_1.sh: New source file.
790 * testsuite/dwp_test_1b.cc: New source file.
791 * testsuite/dwp_test_1b.s: New source file.
792 * testsuite/dwp_test_2.cc: New source file.
793 * testsuite/dwp_test_2.s: New source file.
794 * testsuite/dwp_test_2.sh: New source file.
795 * testsuite/dwp_test_main.cc: New source file.
796 * testsuite/dwp_test_main.s: New source file.
797
798 2012-10-23 Cary Coutant <ccoutant@google.com>
799
800 * dwp.h: New header file.
801 * dwp.cc: New source file.
802 * gold.h: Move shared declarations to system.h.
803 * system.h: New header file.
804 * Makefile.am: Add dwp.
805 * Makefile.in: Regenerate.
806
807 2012-10-23 Cary Coutant <ccoutant@google.com>
808
809 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
810 Dwarf_info_reader::read_from_pointer.
811 (Dwarf_pubnames_table::read_header): Likewise.
812 (Dwarf_pubnames_table::next_name): Likewise.
813 (Dwarf_die::read_attributes): Likewise.
814 (Dwarf_die::skip_attributes): Likewise.
815 (Dwarf_info_reader::read_from_pointer): New function template.
816 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
817 (Dwarf_pubnames_table): Likewise.
818 (Dwarf_info_reader::read_from_pointer): New function template.
819 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
820 Dwarf_pubnames_table ctor.
821
822 2012-10-23 Cary Coutant <ccoutant@google.com>
823
824 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
825 abbrev_shndx.
826 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
827 abbrev_shndx_.
828 (Dwarf_info_reader::set_abbrev_shndx): New method.
829 (Dwarf_info_reader::abbrev_shndx_): New data member.
830
831 2012-10-23 Cary Coutant <ccoutant@google.com>
832
833 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
834 from object, not parameters.
835 (Dwarf_info_reader::parse): Likewise.
836 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
837 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
838 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
839 methods.
840
841 2012-10-23 Cary Coutant <ccoutant@google.com>
842
843 * fileread.cc (Input_file::Input_file): New constructor.
844 * fileread.h (class Input_file): Add new constructor.
845
846 2012-10-18 Alan Modra <amodra@gmail.com>
847
848 PR gold/14727
849 * object.cc (Relobj::is_section_name_included): Also match
850 .sdata personality section.
851
852 2012-10-18 Alan Modra <amodra@gmail.com>
853
854 * target-reloc.h (class Default_comdat_behavior): New, package up..
855 (get_comdat_behaviour): ..this.
856 (relocate_section): Add Relocate_comdat_behavior template arg,
857 adjust code to suit.
858 * arm.cc (Target_arm::relocate_section): Adjust to suit.
859 (Target_arm::scan_reloc_section): Likewise.
860 * i386.cc (Target_i386::relocate_section): Likewise.
861 * sparc.cc (Target_sparc::relocate_section): Likewise.
862 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
863 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
864 * powerpc.cc (class Relocate_comdat_behavior): New.
865 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
866 gold::relocate_section with new template arg.
867
868 2012-10-18 Alan Modra <amodra@gmail.com>
869
870 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
871 dynamic relocs for GOT_TPREL got entries, without symbol if
872 resolving locally.
873 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
874 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
875 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
876
877 2012-10-17 Alan Modra <amodra@gmail.com>
878
879 PR gold/14726
880 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
881
882 2012-10-16 Sriraman Tallam <tmsriram@google.com>
883
884 * layout.cc (Layout::include_section): Keep sections marked
885 SHF_EXCLUDE when doing relocatable links.
886
887 2012-10-16 Alan Modra <amodra@gmail.com>
888
889 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
890 (Target_powerpc::do_finalize_sections): Call it.
891 (Output_data_save_res): New class and supporting functions.
892 (Target_powerpc::symval_for_branch): Only look up .opd entry for
893 normal symbols defined in object files.
894
895 2012-10-12 Alan Modra <amodra@gmail.com>
896
897 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
898 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
899 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
900 section if scan_opd_relocs not yet called.
901 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
902
903 2012-10-12 Alan Modra <amodra@gmail.com>
904
905 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
906 add_local_ifunc_entry): Revert last change.
907 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
908
909 2012-10-05 Alan Modra <amodra@gmail.com>
910
911 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
912 do_plt_address_for_global): New functions.
913 (Output_data_got_powerpc::do_write): Don't segfault when linking
914 statically.
915 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
916 add_local_ifunc_entry): Return true on adding entry..
917 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
918 glink->add_entry call. Remove unused symtab param. Adjust calls.
919 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
920 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
921 set up symbols here.
922 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
923 syms here. Do so even when no .iplt. Don't segfault when linking
924 statically.
925 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
926 new variants without reloc param.
927 (Glink_sym_ent::Glink_sym_ent): Likewise.
928 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
929 reloc when refs will resolve to plt call stub.
930 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
931 R_PPC_PLTREL24 to resolve locally.
932 (Target_powerpc::Scan::global): Correct ifunc handling.
933 (Target_powerpc::Relocate::relocate): Correct local sym glink
934 lookup. Don't destroy "value" when we have a plt call stub,
935 and when checking plt call validity.
936 (Target_powerpc::do_dynsym_value): Simplify.
937
938 2012-10-05 Alan Modra <amodra@gmail.com>
939
940 * i386.cc (Output_data_plt_i386::address_for_global,
941 address_for_local): Add plt offset to returned value. Adjust uses.
942 * sparc.cc (Output_data_plt_sparc::address_for_global,
943 address_for_local): Likewise.
944 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
945 address_for_local): Likewise.
946 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
947 address_for_local): Likewise.
948 * target.h (Target::plt_address_for_global, plt_address_for_local):
949 Update comment.
950 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
951 (Output_data_got::Got_entry::write): Nor here.
952 * output.h: Comment fix.
953
954 2012-10-02 Jiong Wang <jiwang@tilera.com>
955
956 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
957 global_offset_table_ value for larget got.
958 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
959
960 2012-09-29 Alan Modra <amodra@gmail.com>
961
962 * powerpc.cc (Target_powerpc::iplt_): New output section.
963 (Target_powerpc::iplt_section, make_iplt_section,
964 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
965 (Target_powerpc::make_plt_entry): Handle ifunc syms.
966 Target_powerpc::plt_entry_count): Count iplt entries too.
967 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
968 reloc section in constructor. New params.
969 (Target_powerpc::make_plt_section): Create reloc section here instead.
970 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
971 functions.
972 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
973 (Output_data_glink::add_entry, find_entry): New functions to
974 deal with local syms.
975 (Glink_sym_ent): Add support for local syms.
976 (Output_data_glink::do_write): Handle ifunc plt entries.
977 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
978 (Target_powerpc::Scan::local, global): Handle ifunc syms.
979 (Target_powerpc::Relocate::relocate): Likewise.
980 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
981
982 2012-09-25 Alan Modra <amodra@gmail.com>
983
984 * object.h (Sized_relobj_file::adjust_local_symbol,
985 do_adjust_local_symbol): New functions.
986 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
987 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
988 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
989 and irregular opd entry spacing.
990 (Powerpc_relobj::do_read_relocs): Add opd size checks.
991 (Global_symbol_visitor_opd): New functor.
992 (Target_powerpc::do_finalize_sections): Omit global symbols defined
993 on deleted opd entries.
994
995 2012-09-15 Jiong Wang <jiwang@tilera.com>
996
997 * tilegx.cc: New file.
998 * Makefile.am (TARGETSOURCES): Add tilegx.cc
999 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1000 * configure.tgt: Add entries for tilegx*.
1001 * configure.ac: Likewise.
1002 * Makefile.in: Rebuild.
1003 * configure: Likewise.
1004 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1005 tilegx.
1006
1007 2012-09-13 Alan Modra <amodra@gmail.com>
1008
1009 * target-reloc.h (scan_relocs): Call scan.local for relocs
1010 against symbols in discarded sections. Pass is_discarded
1011 param.
1012 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1013 Add is_discarded param.
1014 * powerpc (Target_powerpc::Scan::local): Likewise. Use
1015 is_discarded to flag opd entry as discarded. Don't emit dyn
1016 relocs on such entries.
1017 (Target_powerpc::Scan::global): Similarly detect and handle
1018 such opd entries.
1019 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1020 opd_ent_. Update all uses.
1021 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1022 (Target_powerpc::relocate_section): Zero out discarded opd
1023 entry relocs.
1024
1025 2012-09-12 Ian Lance Taylor <iant@google.com>
1026
1027 PR gold/14570
1028 * output.cc: Rename Output_data_got template parameter from size
1029 to got_size for all functions. Compile all variants of
1030 Output_data_got.
1031 (Output_data_got::Got_entry::write): Correct use of size for
1032 symbol value. Use local_is_tls rather than casting to
1033 Sized_relobj_file.
1034 * object.h (class Object): Add local_is_tls and do_local_is_tls.
1035 (class Sized_relobj_file): Add do_local_is_tls.
1036 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1037
1038 2012-09-11 Alan Modra <amodra@gmail.com>
1039
1040 PR gold/14566
1041 * layout.cc (Layout::set_segment_offsets): When using
1042 common-page-size alignment, ensure we are on a new max-page-size
1043 page.
1044 * output.cc (Output_segment::set_section_addresses): Use
1045 abi_pagesize, not common_pagesize for relro boundary.
1046 (Output_segment::set_offset): Likewise.
1047
1048 2012-09-11 Alan Modra <amodra@gmail.com>
1049
1050 * output.h (Output_data_got::add_global_tls, add_local_tls,
1051 add_local_tls_pair): New functions.
1052 (Output_data_got::add_local_pair_with_rel): Remove second
1053 reloc param. Expand comment.
1054 (Output_data_got::Got_entry): Rename use_plt_offset_ to
1055 use_plt_or_tls_offset_, similarly for constructor param.
1056 (Output_data_got::Got_entry::write): Add got_index param.
1057 * output.cc (Output_data_got::add_global_tls, add_local_tls,
1058 add_local_tls_pair): New functions.
1059 (Output_data_got::Got_entry::write): Handle tls symbols
1060 with use_plt_or_tls_offset_ set specially.
1061 (Output_data_got::add_local_pair_with_rel): Only one reloc.
1062 (Output_data_got::do_write): Replace iterator with index, pass
1063 index to entry write function.
1064 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1065 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1066 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1067 call.
1068 * i386.cc (Target_i386::Scan::local): Likewise.
1069 * sparc.cc (Target_sparc::Scan::local): Likewise.
1070 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1071 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1072 do_tls_offset_for_global): New functions.
1073 (Target_powerpc::Scan::local): Correct TLS relocations and got
1074 entry values.
1075 (Target_powerpc::Scan::global): Don't emit unnecessary
1076 dynamic relocations on TLS GOT entries.
1077
1078 2012-09-10 Matthias Klose <doko@ubuntu.com>
1079
1080 * config.in: Disable sanity check for kfreebsd.
1081
1082 2012-09-10 Sterling Augustine <saugustine@google.com>
1083
1084 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1085 (Gdb_index::pubtypes_read): New parameter.
1086 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1087 to calls.
1088 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1089 pubtypes_object_.
1090
1091 2012-09-09 Alan Modra <amodra@gmail.com>
1092
1093 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1094 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1095 * gc.h (gc_process_relocs): Call target gc_add_reference.
1096 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1097 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1098 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1099 unnecessary cast.
1100 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1101 to cater for when we don't need code offset. Update use.
1102 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1103 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1104 set_opd_valid): New functions.
1105 (Target_powerpc::do_gc_add_reference): New function.
1106 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1107 stashed refs.
1108 (Target_powerpc::do_gc_mark_symbol): New function.
1109
1110 2012-09-06 Cary Coutant <ccoutant@google.com>
1111
1112 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1113 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1114 (Dwarf_die::skip_attributes): Likewise.
1115 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1116 * testsuite/gdb_index_test.cc (inline_func_1): New function.
1117 (main): Call it.
1118 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1119
1120 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
1121
1122 * testsuite/script_test_3.t: Add .got.plt output section
1123 statement.
1124 * testsuite/script_test_4.t: Likewise.
1125
1126 2012-09-05 Alan Modra <amodra@gmail.com>
1127
1128 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1129 update all uses and lose "enum" when using type.
1130
1131 2012-09-05 Alan Modra <amodra@gmail.com>
1132
1133 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1134 * configure: Regenerate.
1135 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1136 (plugin_final_layout.stdout): Likewise.
1137 (memory_test): Set page sizes to 0x1000.
1138 * testsuite/Makefile.in: Regenerate.
1139 * testsuite/discard_locals_test.sh: Add FIXME comment.
1140 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1141 * testsuite/pr14265.t: Add .got output section statement.
1142 * testsuite/script_test_2.t: Likewise.
1143 * testsuite/script_test_3.t: Likewise.
1144 * testsuite/script_test_4.t: Likewise.
1145 * testsuite/script_test_5.t: Likewise.
1146 * testsuite/script_test_6.t: Likewise.
1147 * testsuite/script_test_7.t: Likewise.
1148 * testsuite/script_test_9.t: Likewise.
1149
1150 2012-09-05 Alan Modra <amodra@gmail.com>
1151
1152 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1153 (Powerpc_relocate_functions::Status): New typedef.
1154 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1155 (Target_powerpc::Scan::local): Handle REL64.
1156 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1157 for REL32 and REL64.
1158 (Target_powerpc::symval_for_branch): New function, extracted from..
1159 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
1160 checks. Report overflow errors.
1161
1162 2012-09-05 Alan Modra <amodra@gmail.com>
1163
1164 * object.h (Sized_relobj_file::emit_relocs): Delete.
1165 (Sized_relobj_file::emit_relocs_reltype): Delete.
1166 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1167 relocate_relocs for --emit-relocs.
1168 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1169 * output.h: Update comment.
1170 (Output_segment::first_section): New function.
1171 (Output_segment::first_section_load_address): Use first_section.
1172 * output.cc (Output_segment::first_section): New function extracted..
1173 (Output_segment::first_section_load_address): ..from here. Delete.
1174 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1175 * target.h (Sized_target::relocate_for_relocatable): Likewise.
1176 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1177 adjust call to target.h function.
1178 * i386.cc (Target_i386): Likewise.
1179 * sparc.cc (Target_sparc): Likewise.
1180 * x86_64.cc (Target_x86_64): Likewise.
1181 * powerpc.cc (Target_powerpc): Likewise.
1182 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
1183 first tls section has section symbol for optimised local dynamic
1184 output relocs.
1185 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1186 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1187 optimised tls code.
1188 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1189 Rename to relocate_relocs. Update error message.
1190
1191 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
1192
1193 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1194 --just-symbols.
1195
1196 2012-08-31 Alan Modra <amodra@gmail.com>
1197
1198 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1199 (Powerpc_relobj::toc_base_offset): New stub function.
1200 (Target_powerpc): Add tp_offset, dtp_offset. Rename
1201 got_mod_index_offset to tlsld_got_offset. Update all refs.
1202 (Target_powerpc::Relocate::enum skip_tls): New.
1203 (Target_powerpc::call_tls_get_addr_): New var.
1204 (Target_powerpc::is_branch_reloc): Move to file scope.
1205 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1206 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1207 New functions.
1208 (Target_powerpc::enum Got_type): Delete old values, add new ones.
1209 (powerpc_info): Correct common_pagesize for ppc64.
1210 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1211 (Powerpc_relocate_functions): Add overflow check enums and functions.
1212 Add non-shift version of rela, rela_ua. Delete all rel public
1213 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
1214 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1215 addr16_ha3, addr14 functions.
1216 (Output_data_got_powerpc::add_constant_pair): New function.
1217 (Output_data_got_powerpc::got_base_offset): Likewise.
1218 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1219 (instruction constants): Sort, add some more.
1220 (Output_data_glink::do_write): Add and use Address typedef. Use
1221 object->toc_base_offset() stub for 64-bit.
1222 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1223 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1224 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1225 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
1226 Always treat .opd relocs as against locally defined symbol.
1227 Correct condition for RELATIVE relocs.
1228 (Target_powerpc::do_finalize_sections): Test for NULL sections.
1229 (Target_powerpc::Relocate::relocate): Use plt call stub as value
1230 for 32-bit syms with a plt entry. Correct ppc64 toc base
1231 calculations. Handle TLS relocs, and more. Add overflow
1232 checking and adjust for Powerpc_relocate_functions changes.
1233 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1234 Reinstate --emit-relocs code with FIXME.
1235
1236 2012-08-30 Alan Modra <amodra@gmail.com>
1237
1238 * layout.cc (Layout::set_segment_offsets): Set p_align to
1239 abi_pagesize, not common_pagesize.
1240 (Layout::relaxation_loop_body): Similarly use abi_pagesize
1241 to determine whether file header can go in segment.
1242
1243 2012-08-30 Alan Modra <amodra@gmail.com>
1244
1245 * output.h (Output_reloc::Output_reloc <output section>): Add
1246 is_relative param. Adjust calls.
1247 (Output_reloc::add_output_section_relative): New functions.
1248 * output.cc (Output_reloc::Output_reloc <output section>): Handle
1249 is_relative.
1250 (Output_reloc::symbol_value): Handle SECTION_CODE.
1251
1252 2012-08-24 Sriraman Tallam <tmsriram@google.com>
1253
1254 * gold.cc (queue_middle_tasks): Call layout again when unique
1255 segments for sections is desired.
1256 * layout.cc (Layout::Layout): Initialize new members.
1257 (Layout::get_output_section_flags): New function.
1258 (Layout::choose_output_section): Call get_output_section_flags.
1259 (Layout::layout): Make output section for mapping to a unique segment.
1260 (Layout::insert_section_segment_map): New function.
1261 (Layout::attach_allocated_section_to_segment): Make unique segment for
1262 output sections marked so.
1263 (Layout::segment_precedes): Check for unique segments when sorting.
1264 * layout.h (Layout::Unique_segment_info): New struct.
1265 (Layout::Section_segment_map): New typedef.
1266 (Layout::insert_section_segment_map): New function.
1267 (Layout::get_output_section_flags): New function.
1268 (Layout::is_unique_segment_for_sections_specified): New function.
1269 (Layout::set_unique_segment_for_sections_specified): New function.
1270 (Layout::unique_segment_for_sections_specified_): New member.
1271 (Layout::section_segment_map_): New member.
1272 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1273 Rename is_gc_pass_one to is_pass_one.
1274 Rename is_gc_pass_two to is_pass_two.
1275 Rename is_gc_or_icf to is_two_pass.
1276 Check for which pass based on whether symbols data is present.
1277 Make it two pass when unique segments for sections is desired.
1278 * output.cc (Output_section::Output_section): Initialize new
1279 members.
1280 * output.h (Output_section::is_unique_segment): New function.
1281 (Output_section::set_is_unique_segment): New function.
1282 (Output_section::is_unique_segment_): New member.
1283 (Output_section::extra_segment_flags): New function.
1284 (Output_section::set_extra_segment_flags): New function.
1285 (Output_section::extra_segment_flags_): New member.
1286 (Output_section::segment_alignment): New function.
1287 (Output_section::set_segment_alignment): New function.
1288 (Output_section::segment_alignment_): New member.
1289 (Output_segment::Output_segment): Initialize is_unique_segment_.
1290 (Output_segment::is_unique_segment): New function.
1291 (Output_segment::set_is_unique_segment): New function.
1292 (Output_segment::is_unique_segment_): New member.
1293 * plugin.cc (allow_unique_segment_for_sections): New function.
1294 (unique_segment_for_sections): New function.
1295 (Plugin::load): Add new functions to transfer vector.
1296 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1297 * Makefile.in: Regenerate.
1298 * testsuite/plugin_final_layout.sh: Check if unique segment
1299 functionality works.
1300 * testsuite/plugin_section_order.c (onload): Check if new interfaces
1301 are available.
1302 (allow_unique_segment_for_sections): New global.
1303 (unique_segment_for_sections): New global.
1304 (claim_file_hook): Call allow_unique_segment_for_sections.
1305 (all_symbols_read_hook): Call unique_segment_for_sections.
1306
1307 2012-08-22 Cary Coutant <ccoutant@google.com>
1308
1309 * layout.cc (Layout::include_section): Don't assert on GROUP
1310 sections with --emit-relocs.
1311
1312 2012-08-21 Cary Coutant <ccoutant@google.com>
1313
1314 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1315 if --export-dynamic-symbol names an undef symbol.
1316
1317 2012-08-18 Alan Modra <amodra@gmail.com>
1318
1319 * powerpc.cc: Formatting and white space.
1320 (Powerpc_relobj): Rename got2_section_ to special_.
1321 Add opd_ent_shndx_ and opd_ent_off_ vectors.
1322 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1323 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1324 (Target_powerpc): Add Address typedef and invalid_address. Use
1325 throughout.
1326 (Target_powerpc::is_branch_reloc): New function.
1327 (Powerpc_relocate_functions): Add Address typedef, use throughout.
1328 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1329 for dst_mask, value and addend.
1330 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1331 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1332 (Output_data_glink::do_write): Correct toc base. Don't try to use
1333 uint16_t for 24-bit offset. Use get_output_section_offset and
1334 check return.
1335 (Target_powerpc::Scan::local): Handle more relocs.
1336 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1337 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1338 Plug in toc restoring insn after plt calls. Translate branches
1339 to function descriptor symbols to corresponding entry point.
1340 (Target_powerpc::relocate_for_relocatable): Check return from
1341 get_output_section_offset.
1342 * symtab.h: Comment typo.
1343
1344 2012-08-14 Ian Lance Taylor <iant@google.com>
1345
1346 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1347 unsupported_relocal_local to call unsupported_reloc_global.
1348
1349 2012-08-14 Nick Clifton <nickc@redhat.com>
1350
1351 PR ld/14265
1352 * script-sections.cc (Sections_element::output_section_name): Add
1353 keep return parameter.
1354 (Output_section_element::match_name): Add keep return parameter.
1355 Return the value of the keep_ member.
1356 * script-sections.h (class Output_section): Update
1357 output_section_name prototype.
1358 * layout.cc (Layout::keep_input_section): New public member
1359 function.
1360 (Layout::choose_output_section): Pass keep parameter to
1361 output_section_name.
1362 * layout.h (class Layout): Add keep_input_section.
1363 * object.cc (Sized_relobj_file::do_layout): Check for kept input
1364 sections.
1365 * testsuite/Makefile.am: Add a test.
1366 * testsuite/Makefile.in: Regenerate.
1367 * testsuite/pr14265.c: Source file for the test.
1368 * testsuite/pr14265.t: Linker script for the test.
1369 * testsuite/pr14265.sh: Shell script for the test.
1370
1371 2012-08-14 Alan Modra <amodra@gmail.com>
1372
1373 * target.h (Target::output_section_name): New function.
1374 (Target::do_output_section_name): New function.
1375 * layout.cc (Layout::choose_output_section): Call the above.
1376 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1377
1378 2012-08-14 Alan Modra <amodra@gmail.com>
1379
1380 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1381 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1382 for replace_constant call.
1383 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1384 (Output_data_glink::do_print_to_mapfile): New function.
1385 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1386 (Target_powerpc::Relocate::relocate): Likewise.
1387
1388 2012-08-14 Alan Modra <amodra@gmail.com>
1389
1390 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1391 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1392 (Output_data_glink::add_entry,find_entry): Remove shndx param.
1393 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
1394 all references to shndx_. Handle special case for R_PPC_PLTREL24
1395 here.
1396 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1397 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1398 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1399 here.
1400 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1401 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1402
1403 2012-08-12 Alan Modra <amodra@gmail.com>
1404
1405 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
1406 (glink insn constants): Use uint32_t.
1407 (Output_data_glink::add_entry): Use insert, not [] operator.
1408
1409 2012-08-11 Alan Modra <amodra@gmail.com>
1410
1411 * object.h (Sized_relobj_file::find_shdr): New function.
1412 (Sized_relobj_file::find_special_sections): New function.
1413 * object.cc (Sized_relobj_file::find_shdr): New function.
1414 (Sized_relobj_file::find_eh_frame): Use find_shdr.
1415 (Sized_relobj_file::find_special_sections): New function, split out..
1416 (Sized_relobj_file::do_read_symbols): ..from here.
1417 * output.h (Output_data_got::replace_constant): New function.
1418 (Output_data_got::num_entries): New function.
1419 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1420 (Output_data_got::got_offset): Protected rather than private.
1421 (Output_data_got::replace_got_entry): New function.
1422 * output.cc (Output_data_got::replace_got_entry): New function.
1423 * powerpc.cc (class Powerpc_relobj): New.
1424 (class Powerpc_relocate_functions): Delete all psymval variants or
1425 convert to value,addend type. Delete pcrela, pcrela_unaligned.
1426 Implement _ha functions using corresponding _hi function.
1427 (Powerpc_relobj::find_special_sections): New function.
1428 (Target_powerpc::do_make_elf_object): New function.
1429 (class Output_data_got_powerpc): New.
1430 (class Output_data_glink): New.
1431 (class Powerpc_scan_relocatable_reloc): New.
1432 Many more changes througout file.
1433
1434 2012-08-09 Nick Clifton <nickc@redhat.com>
1435
1436 * po/vi.po: Updated Vietnamese translation.
1437
1438 2012-08-07 Ian Lance Taylor <iant@google.com>
1439
1440 * layout.cc (Layout::add_target_dynamic_tags): If
1441 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1442 plt_rel.
1443
1444 2012-07-30 Nick Clifton <nickc@redhat.com>
1445
1446 * po/gold.pot: Updated template.
1447 * po/es.po: Updated Spanish translation.
1448
1449 2012-07-18 Cary Coutant <ccoutant@google.com>
1450
1451 PR gold/14344
1452 * configure.ac: Add check for -gpubnames support.
1453 * configure: Regenerate.
1454 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1455 support; force -gno-pubnames.
1456 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1457 support.
1458 (gdb_index_test_4): New test.
1459 * testsuite/Makefile.in: Regenerate.
1460 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1461 * testsuite/gdb_index_test_2.sh: Likewise.
1462 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1463 * testsuite/gdb_index_test_4.sh: New script.
1464 * testsuite/gdb_index_test_comm.sh: New script with common code;
1465 don't look for space after colon.
1466
1467 2012-07-16 Sriraman Tallam <tmsriram@google.com>
1468
1469 * gold.cc (queue_middle_tasks): Update function order only after
1470 deferred objects due to plugins are processed.
1471
1472 2012-07-11 Ian Lance Taylor <iant@google.com>
1473
1474 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1475 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1476 (Target_arm::scan_reloc_for_stub): Likewise.
1477 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1478 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1479 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1480 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1481 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1482
1483 2012-07-10 Dodji Seketeli <dodji@redhat.com>
1484 Ian Lance Taylor <iant@google.com>
1485
1486 PR gold/14309
1487 * configure.ac: Test whether std::tr1::hash<off_t> works.
1488 * gold.h: Add a specialization for std::tr1::hash<off_t> if
1489 needed.
1490 * output.h (class Output_fill): Add virtual destructor.
1491 * configure, config.in: Rebuild.
1492
1493 2012-06-22 Roland McGrath <mcgrathr@google.com>
1494
1495 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1496
1497 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
1498
1499 * plugin.cc (Plugin::load): Handle position independent executables.
1500
1501 2012-06-06 Cary Coutant <ccoutant@google.com>
1502
1503 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1504 add .debug_macro.
1505 (lines_only_debug_sections): Likewise.
1506 (gdb_fast_lookup_sections): New static array.
1507 (is_gdb_debug_section): Rename formal parameter.
1508 (is_lines_only_debug_section): Likewise.
1509 (is_gdb_fast_lookup_section): New function.
1510 (Layout::include_section): Check for ".zdebug_" prefix; pass
1511 section name suffix to is_gdb_debug_section, et al.; check for
1512 fast-lookup sections when building .gdb_index.
1513 * options.h (--strip-debug-gdb): Update GDB version number.
1514
1515 2012-06-06 Cary Coutant <ccoutant@google.com>
1516
1517 * configure.ac: Add check for fallocate.
1518 * configure: Regenerate.
1519 * config.in: Regenerate.
1520
1521 * options.h (class General_options): Add --mmap-output-file and
1522 --posix-fallocate options.
1523 * output.cc: (posix_fallocate): Remove; replace with...
1524 (gold_fallocate): New function.
1525 (Output_file::map_no_anonymous): Call gold_fallocate.
1526 (Output_file::map): Check --mmap-output-file option.
1527
1528 2012-06-05 Jing Yu <jingyu@google.com>
1529
1530 * gold.h (textdomain): Add do {} to empty while(0).
1531 (bindtextdomain): Likewise.
1532
1533 2012-06-04 Cary Coutant <ccoutant@google.com>
1534
1535 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1536 has_dynsym_index.
1537
1538 2012-05-25 Sriraman Tallam <tmsriram@google.com>
1539
1540 * symtab.cc (Symbol_table::define_special_symbol):
1541 Initialize *poldsym to prevent uninitialized variable errors.
1542
1543 2012-05-23 Cary Coutant <ccoutant@google.com>
1544
1545 * layout.cc (Layout::section_name_mapping): Add rules to handle
1546 exact match on .data.rel.ro.local or .data.rel.ro.
1547 (Layout::output_section_name): Check for exact matches.
1548
1549 2012-05-23 Cary Coutant <ccoutant@google.com>
1550
1551 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1552 more carefully.
1553
1554 2012-05-22 Cary Coutant <ccoutant@google.com>
1555
1556 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1557 object before exporting symbol.
1558
1559 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
1560
1561 * testsuite/tls_test.cc: Include "config.h" first.
1562 * testsuite/tls_test_c.c: Likewise.
1563
1564 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
1565 Nick Clifton <nickc@redhat.com>
1566
1567 PR 14072
1568 * configure.in: Add check that sysdep.h has been included before
1569 any system header files.
1570 * configure: Regenerate.
1571 * config.in: Regenerate.
1572
1573 2012-05-14 Cary Coutant <ccoutant@google.com>
1574
1575 * layout.cc (Layout::make_output_section): Mark .tdata section
1576 as RELRO.
1577 * testsuite/relro_test.cc: Add a TLS variable.
1578
1579 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
1580
1581 PR gold/14091
1582 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1583 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1584 R_X86_64_64.
1585
1586 2012-05-08 Cary Coutant <ccoutant@google.com>
1587
1588 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1589 (lines_only_debug_sections): Likewise.
1590
1591 2012-05-02 Roland McGrath <mcgrathr@google.com>
1592
1593 * nacl.cc: New file.
1594 * nacl.h: New file.
1595 * Makefile.am (CCFILES, HFILES): Add them.
1596 * Makefile.in: Regenerate.
1597 * i386.cc (Output_data_plt_i386_nacl): New class.
1598 (Output_data_plt_i386_nacl_exec): New class.
1599 (Output_data_plt_i386_nacl_dyn): New class.
1600 (Target_i386_nacl): New class.
1601 (Target_selector_i386_nacl): New class.
1602 (target_selector_i386): Use it instead of Target_selector_i386.
1603 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1604 (Target_x86_64_nacl): New class.
1605 (Target_selector_x86_64_nacl): New class.
1606 (target_selector_x86_64, target_selector_x32): Use it instead of
1607 Target_selector_x86_64.
1608 * arm.cc (Output_data_plt_arm_nacl): New class.
1609 (Target_arm_nacl): New class.
1610 (Target_selector_arm_nacl): New class.
1611 (target_selector_arm, target_selector_armbe): Use it instead of
1612 Target_selector_arm.
1613
1614 * target-select.cc (select_target): Take new Input_file* and off_t
1615 arguments, pass them on to recognize method of selector.
1616 * object.cc (make_elf_sized_object): Update caller.
1617 * parameters.cc (parameters_force_valid_target): Likewise.
1618 * incremental.cc (make_sized_incremental_binary): Likewise.
1619 * target-select.h: Update decl.
1620 (Target_selector::recognize): Take new Input_file* argument,
1621 pass it on to do_recognize.
1622 (Target_selector::do_recognize): Take new Input_file* argument.
1623 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1624 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1625 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1626 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1627
1628 * target.h (Target::Target_info): New members isolate_execinstr
1629 and rosegment_gap.
1630 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1631 * arm.cc (Target_arm::arm_info): Update initializer.
1632 * i386.cc (Target_i386::i386_info): Likewise.
1633 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1634 * sparc.cc (Target_sparc::sparc_info): Likewise.
1635 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1636 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1637 * layout.cc (Layout::attach_allocated_section_to_segment):
1638 Take new const Target* argument. If target->isolate_execinstr(), act
1639 like --rosegment.
1640 (Layout::find_first_load_seg): Take new const Target* argument;
1641 if target->isolate_execinstr(), reject PF_X segments.
1642 (Layout::relaxation_loop_body): Update caller.
1643 (Layout::set_segment_offsets): If target->isolate_execinstr(),
1644 reset file offset to zero when we hit LOAD_SEG, and then do a second
1645 loop over the segments before LOAD_SEG to reassign offsets after
1646 addresses have been determined. Handle target->rosegment_gap().
1647 (Layout::attach_section_to_segment): Take new const Target* argument;
1648 pass it to attach_allocated_section_to_segment.
1649 (Layout::make_output_section): Update caller.
1650 (Layout::attach_sections_to_segments): Take new const Target* argument;
1651 pass it to attach_section_to_segment.
1652 * gold.cc (queue_middle_tasks): Update caller.
1653 * layout.h (Layout): Update method decls with new arguments.
1654
1655 * arm.cc (Target_arm::Target_arm): Take optional argument for the
1656 Target_info pointer to use.
1657 (Target_arm::do_make_data_plt): New virtual method.
1658 (Target_arm::make_data_plt): New method that calls it.
1659 (Target_arm::make_plt_entry): Use it.
1660 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1661 for the section alignment.
1662 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1663 method.
1664 (Output_data_plt_arm::first_plt_entry_offset): Call it.
1665 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1666 method.
1667 (Output_data_plt_arm::get_plt_entry_size): Call it.
1668 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1669 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1670 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1671 method.
1672 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1673 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1674 method instead of sizeof(plt_entry).
1675 (Output_data_plt_arm::add_entry): Likewise.
1676 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1677 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1678 than static method.
1679 (Target_arm::plt_entry_size): Likewise.
1680 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1681 Move to ...
1682 (Output_data_plt_arm_standard): ... here, new class.
1683 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1684 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1685 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1686
1687 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1688 Take additional argument for the PLT entry size.
1689 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1690 Use get_plt_entry_size method rather than plt_entry_size variable.
1691 (Output_data_plt_x86_64::reserve_slot): Likewise.
1692 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1693 (Output_data_plt_x86_64::add_entry): Likewise.
1694 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1695 (Output_data_plt_x86_64::address_for_global): Likewise.
1696 (Output_data_plt_x86_64::address_for_local): Likewise.
1697 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1698 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1699 Make method non-static.
1700 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1701 method.
1702 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1703 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1704 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1705 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1706 virtual method.
1707 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1708 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1709 virtual method.
1710 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1711 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1712 virtual method.
1713 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1714 (Output_data_plt_x86_64::plt_entry_size)
1715 (Output_data_plt_x86_64::first_plt_entry)
1716 (Output_data_plt_x86_64::plt_entry)
1717 (Output_data_plt_x86_64::tlsdesc_plt_entry)
1718 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1719 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1720 (Output_data_plt_x86_64_standard): ... here, new class.
1721 (Target_x86_64::Target_x86_64): Take optional argument for the
1722 Target_info pointer to use.
1723 (Target_x86_64::do_make_data_plt): New virtual method.
1724 (Target_x86_64::make_data_plt): New method to call it.
1725 (Target_x86_64::init_got_plt_for_update): Use that.
1726 Call this->plt_->add_eh_frame method here.
1727 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1728 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1729 rather than static method.
1730 (Target_x86_64::plt_entry_size): Likewise.
1731 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1732 rather than plt_entry_size variable. Move guts of PLT filling to...
1733 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1734 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1735 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1736
1737 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1738 additional argument for the section alignment.
1739 Don't do add_eh_frame_for_plt here.
1740 (Output_data_plt_i386::first_plt_entry_offset): Make the method
1741 non-static. Use get_plt_entry_size method rather than plt_entry_size
1742 variable.
1743 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1744 method.
1745 (Output_data_plt_i386::get_plt_entry_size): Call it.
1746 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1747 (Output_data_plt_i386::add_eh_frame): New method to call it.
1748 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1749 method.
1750 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1751 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1752 method.
1753 (Output_data_plt_i386::fill_plt_entry): New method to call it.
1754 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1755 method instead of plt_entry_size.
1756 (Output_data_plt_i386::plt_entry_size)
1757 (Output_data_plt_i386::plt_eh_frame_fde_size)
1758 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1759 (Output_data_plt_i386_standard): ... here, new class.
1760 (Output_data_plt_i386_exec): New class.
1761 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1762 (Output_data_plt_i386_exec::first_plt_entry): ... here.
1763 (Output_data_plt_i386::exec_plt_entry): Move to ...
1764 (Output_data_plt_i386_exec::plt_entry): ... here.
1765 (Output_data_plt_i386_dyn): New class.
1766 (Output_data_plt_i386::first_plt_entry): Move to ...
1767 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1768 (Output_data_plt_i386::dyn_plt_entry): Move to ...
1769 (Output_data_plt_i386_dyn::plt_entry): ... here.
1770 (Target_i386::Target_i386): Take optional argument for the Target_info
1771 pointer to use.
1772 (Target_i386::do_make_data_plt): New virtual method.
1773 (Target_i386::make_data_plt): New method to call it.
1774 (Target_i386::make_plt_section): Use that.
1775 Call this->plt_->add_eh_frame method here.
1776 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1777 rather than plt_entry_size variable.
1778 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1779 (Output_data_plt_i386::address_for_local): Likewise.
1780 (Output_data_plt_i386::do_write): Likewise.
1781 Move guts of PLT filling to...
1782 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1783 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1784 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1785 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1786
1787 2012-05-01 Cary Coutant <ccoutant@google.com>
1788
1789 * dwarf_reader.cc (Dwarf_die::read_attributes)
1790 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1791 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1792 * reduced_debug_output.cc
1793 (Output_reduced_debug_info_section::get_die_end): Remove
1794 DW_FORM_GNU_ref_index. Add default case.
1795
1796 2012-04-26 Mark Wielaard <mjw@redhat.com>
1797
1798 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1799 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1800 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1801 DW_AT_high_pc as offset from DW_AT_low_pc.
1802
1803 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1804 * testsuite/Makefile.in: Regenerate.
1805 * testsuite/gdb_index_test_3.c: New test source file.
1806 * testsuite/gdb_index_test_3.sh: New test source file.
1807
1808 2012-04-25 Ian Lance Taylor <iant@google.com>
1809
1810 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1811 pointer.
1812 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1813 as a class, not a struct.
1814 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1815 (Target_arm::apply_cortex_a8_workaround): Likewise.
1816 * gc.h: Declare Reloc_types as a struct, not a class.
1817 * object.h: Declare Symbols_data as a struct.
1818 * reloc.h: Declare Read_relocs_data as a struct.
1819 * target.h: Declare Relocate_info as a struct.
1820
1821 2012-04-24 David S. Miller <davem@davemloft.net>
1822
1823 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1824 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1825 and R_SPARC_WPLT30.
1826
1827 2012-04-24 Cary Coutant <ccoutant@google.com>
1828
1829 * incremental-dump.cc (find_input_containing_global): Replace
1830 magic number with symbolic constant.
1831 (dump_incremental_inputs): Update version number.
1832 * incremental.cc (Output_section_incremental_inputs): Update version
1833 number; import symbolic constants from Incremental_inputs_reader.
1834 (Incremental_inputs::create_data_sections): Align relocations
1835 section correctly for 64-bit targets.
1836 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1837 constants; add padding.
1838 (Output_section_incremental_inputs::write_header): Add assert for
1839 header_size.
1840 (Output_section_incremental_inputs::write_input_files): Add assert
1841 for input_entry_size.
1842 (Output_section_incremental_inputs::write_info_blocks): Add padding;
1843 add assert for object_info_size, input_section_entry_size,
1844 global_sym_entry_size.
1845 * incremental.h (Incremental_inputs_reader): Add symbolic constants
1846 for data structure sizes; use them.
1847 (Incremental_input_entry_reader): Import symbolic constants from
1848 Incremental_inputs_reader; use them.
1849
1850 2012-04-23 David S. Miller <davem@davemloft.net>
1851
1852 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1853 and elf_flags_set_.
1854 (Target_sparc::Target_sparc): Initialize new fields.
1855 (Target_sparc::do_make_elf_object): New function.
1856 (Target_sparc::do_adjust_elf_header): New function.
1857
1858 2012-04-23 Cary Coutant <ccoutant@google.com>
1859
1860 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1861 CU range table of gdb index.
1862
1863 2012-04-20 David S. Miller <davem@davemloft.net>
1864
1865 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1866 instead of false.
1867
1868 2012-04-16 David S. Miller <davem@davemloft.net>
1869
1870 * sparc.cc (Target_sparc::got_address): New function.
1871 (Sparc_relocate_functions::gdop_hix22): New function.
1872 (Sparc_relocate_functions::gdop_lox10): New function.
1873 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1874 relocs.
1875 (Target_sparc::Scan::local): Likewise if the global symbol is not
1876 preemptible and is not IFUNC.
1877 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1878 transformations for local and non-preemptible non-IFUNC global
1879 symbols.
1880
1881 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1882 writing out 64-bit part of ranges.
1883
1884 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1885 -fpic and -fpie respectively.
1886 * Makefile.in: Regenerate.
1887
1888 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1889 (Target_sparc::Target_sparc): Initialize new field.
1890 (Target_sparc::do_plt_section_for_global): New function.
1891 (Target_sparc::do_plt_section_for_local): New function.
1892 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1893 (Target_sparc::make_plt_section): New function, broken out of
1894 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1895 (Target_sparc::make_plt_entry): Call make_plt_section.
1896 (Target_sparc::make_local_ifunc_plt_entry): New function.
1897 (Target_sparc::rela_ifunc_section): New function.
1898 (Target_sparc::plt_section): Remove const.
1899 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1900 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1901 and ifunc_count_ fields.
1902 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1903 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1904 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1905 (Output_data_plt_sparc::rela_ifunc): New function.
1906 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1907 (Output_data_plt_sparc::has_ifunc_section): New function.
1908 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1909 (Output_data_plt_sparc::address_for_global): New function.
1910 (Output_data_plt_sparc::address_for_local): New function.
1911 (Output_data_plt_sparc::plt_index_to_offset): New function.
1912 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1913 and entry_count.
1914 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1915 entry_count.
1916 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1917 R_SPARC_JMP_IREL to switch.
1918 (Target_sparc::Scan::check_non_pic): Likewise.
1919 (Target_sparc::Scan::local): Handle IFUNC symbols.
1920 (Target_sparc::Scan::local): Likewise.
1921 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1922 and plt_address_for_local.
1923 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1924 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1925
1926 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1927 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1928 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1929 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1930 global relocs too.
1931 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1932 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1933 calls.
1934 * sparc.cc (Target_sparc::Scan::global): Likewise.
1935 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1936
1937 2012-04-16 Cary Coutant <ccoutant@google.com>
1938
1939 * archive.cc (Library_base::should_include_member): Check for
1940 --export-dynamic-symbol.
1941 * options.h (class General_options): Add --export-dynamic-symbol.
1942 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1943 --export-dynamic-symbol.
1944 (Symbol_table::gc_mark_undef_symbols): Likewise.
1945 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1946
1947 2012-04-12 David S. Miller <davem@davemloft.net>
1948
1949 * sparc.cc (Reloc::wdisp10): New relocation method.
1950 (Reloc::h34): Likewise.
1951 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1952 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1953 R_SPARC_WDISP10.
1954 (Target_sparc::Scan::local): Likewise.
1955 (Target_sparc::Scan::global): Likewise.
1956 (Target_sparc::Relocate::relocate): Likewise.
1957
1958 2012-04-09 Cary Coutant <ccoutant@google.com>
1959
1960 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1961 low_pc == 0.
1962
1963 2012-04-06 Ian Lance Taylor <iant@google.com>
1964
1965 * timer.cc: #include <unistd.h>.
1966
1967 2012-04-06 Roland McGrath <mcgrathr@google.com>
1968
1969 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1970 * config.in: Regenerate.
1971 * configure: Regenerate.
1972
1973 2012-04-05 Nick Clifton <nickc@redhat.com>
1974
1975 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1976 (AM_LC_MESSAGES): Add.
1977 * aclocal.m4: Regenerate.
1978 * config.in: Regenerate.
1979 * configure: Regenerate.
1980
1981 2012-03-21 Cary Coutant <ccoutant@google.com>
1982
1983 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1984 * Makefile.in: Regenerate.
1985 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1986 (Sized_elf_reloc_mapper::symbol_section): New function.
1987 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1988 (make_elf_reloc_mapper): New function.
1989 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1990 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1991 (Dwarf_abbrev_table::do_get_abbrev): New function.
1992 (Dwarf_ranges_table::read_ranges_table): New function.
1993 (Dwarf_ranges_table::read_range_list): New function.
1994 (Dwarf_pubnames_table::read_section): New function.
1995 (Dwarf_pubnames_table::read_header): New function.
1996 (Dwarf_pubnames_table::next_name): New function.
1997 (Dwarf_die::Dwarf_die): New function.
1998 (Dwarf_die::read_attributes): New function.
1999 (Dwarf_die::skip_attributes): New function.
2000 (Dwarf_die::set_name): New function.
2001 (Dwarf_die::set_linkage_name): New function.
2002 (Dwarf_die::attribute): New function.
2003 (Dwarf_die::string_attribute): New function.
2004 (Dwarf_die::int_attribute): New function.
2005 (Dwarf_die::uint_attribute): New function.
2006 (Dwarf_die::ref_attribute): New function.
2007 (Dwarf_die::child_offset): New function.
2008 (Dwarf_die::sibling_offset): New function.
2009 (Dwarf_info_reader::check_buffer): New function.
2010 (Dwarf_info_reader::parse): New function.
2011 (Dwarf_info_reader::do_parse): New function.
2012 (Dwarf_info_reader::do_read_string_table): New function.
2013 (Dwarf_info_reader::lookup_reloc): New function.
2014 (Dwarf_info_reader::get_string): New function.
2015 (Dwarf_info_reader::visit_compilation_unit): New function.
2016 (Dwarf_info_reader::visit_type_unit): New function.
2017 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2018 Sized_elf_reloc_mapper.
2019 (Sized_dwarf_line_info::symbol_section): Remove function.
2020 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2021 (Sized_dwarf_line_info::read_line_mappings): Remove object
2022 parameter, adjust callers.
2023 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2024 * dwarf_reader.h: Include <sys/types.h>.
2025 (class Track_relocs): Remove forward declaration.
2026 (class Elf_reloc_mapper): New class.
2027 (class Sized_elf_reloc_mapper): New class.
2028 (class Dwarf_abbrev_table): New class.
2029 (class Dwarf_range_list): New class.
2030 (class Dwarf_ranges_table): New class.
2031 (class Dwarf_pubnames_table): New class.
2032 (class Dwarf_die): New class.
2033 (class Dwarf_info_reader): New class.
2034 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2035 (Sized_dwarf_line_info::symbol_section): Remove member function.
2036 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2037 base class.
2038 * gdb-index.cc: New source file.
2039 * gdb-index.h: New source file.
2040 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2041 and .debug_types sections, call Layout::add_to_gdb_index.
2042 (Sized_relobj_incr::do_section_name): Implement.
2043 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2044 return type; Implement.
2045 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2046 return type.
2047 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2048 parameter list and return type.
2049 (Sized_incr_dynobj::do_section_contents): Likewise.
2050 * layout.cc: Include gdb-index.h.
2051 (Layout::Layout): Initialize gdb_index_data_.
2052 (Layout::init_fixed_output_section): Check for .gdb_index section.
2053 (Layout::add_to_gdb_index): New function. Instantiate.
2054 * layout.h: Add forward declaration for class Gdb_index.
2055 (Layout::add_to_gdb_index): New member function.
2056 (Layout::gdb_index_data_): New data member.
2057 * main.cc: Include gdb-index.h.
2058 (main): Print statistics for gdb index.
2059 * object.cc (Object::section_contents): Move code into
2060 do_section_contents.
2061 (need_decompressed_section): Check for sections needed when building
2062 gdb index.
2063 (build_compressed_section_map): Likewise.
2064 (Sized_relobj_file::do_read_symbols): Need local symbols when building
2065 gdb index.
2066 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2067 sections; call Layout::add_to_gdb_index.
2068 (Sized_relobj_file::do_decompressed_section_contents): Call
2069 do_section_contents directly.
2070 * object.h (Object::do_section_contents): Adjust parameter list and
2071 return type.
2072 (Object::do_decompressed_section_contents): Call do_section_contents
2073 directly.
2074 (Sized_relobj_file::do_section_contents): Adjust parameter list and
2075 return type.
2076 * options.h (class General_options): Add --gdb-index option.
2077 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2078 list and return type.
2079 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2080 * reloc.h (Track_relocs::checkpoint): New function.
2081 (Track_relocs::reset): New function.
2082
2083 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2084 New test cases.
2085 * testsuite/Makefile.in: Regenerate.
2086 * testsuite/gdb_index_test.cc: New test source file.
2087 * testsuite/gdb_index_test_1.sh: New test source file.
2088 * testsuite/gdb_index_test_2.sh: New test source file.
2089
2090 2012-03-19 Doug Kwan <dougkwan@google.com>
2091
2092 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2093 (Target_arm::do_finalize_sections): Remove code which defines
2094 __exidx_start and __exidx_end. Make symbol table parameter
2095 anonymous as it is not used.
2096 * gold.cc (queue_middle_tasks): Call target hook to define any
2097 target-specific symbols.
2098 * target.h (Target::define_standard_symbols): New method.
2099 (Target::do_define_standard_symbols): Same.
2100 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2101 * testsuite/Makefile.in: Regenerate.
2102 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2103 and __exidx_end.
2104 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2105 relocations are generated for __exidx_start and __exidx_end.
2106
2107 2012-03-16 Doug Kwan <dougkwan@google.com>
2108
2109 * testsuite/Makefile.am: Disable test initpri3b.
2110 * testsuite/Makefile.in: Regenerate.
2111
2112 2012-03-15 Doug Kwan <dougkwan@google.com>
2113
2114 * arm.cc (Target_arm::got_section): Make .got section read-only
2115 if -z now is given.
2116
2117 2012-03-15 Ian Lance Taylor <iant@google.com>
2118
2119 PR gold/13850
2120 * layout.cc (Layout::make_output_section): Correctly mark
2121 SHT_INIT_ARRAY, et. al., as relro.
2122
2123 2012-03-14 Doug Kwan <dougkwan@google.com>
2124
2125 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2126 dynamic relocations for protected symbols in shared objects.
2127
2128 2012-03-13 Ian Lance Taylor <iant@google.com>
2129
2130 * resolve.cc (Symbol_table::resolve): When merging common symbols,
2131 keep the larger alignment.
2132
2133 2012-03-12 Cary Coutant <ccoutant@google.com>
2134
2135 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2136 handling of DW_LNE_define_file.
2137
2138 2012-03-12 Cary Coutant <ccoutant@google.com>
2139
2140 * reduced_debug_output.cc
2141 (Output_reduced_debug_info_section::get_die_end): Add new FORM
2142 codes to switch.
2143
2144 2012-02-29 Cary Coutant <ccoutant@google.com>
2145
2146 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2147
2148 2012-02-29 Cary Coutant <ccoutant@google.com>
2149
2150 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2151 Call Object::decompressed_section_contents.
2152 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2153 New dtor.
2154 (Sized_dwarf_line_info::buffer_start_): New data member.
2155 * merge.cc (Output_merge_data::do_add_input_section): Call
2156 Object::decompressed_section_contents.
2157 (Output_merge_string::do_add_input_section): Likewise.
2158 * object.cc (need_decompressed_section): New function.
2159 (build_compressed_section_map): Decompress sections needed later.
2160 (Sized_relobj_file::do_decompressed_section_contents): New function.
2161 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2162 * object.h (Object::decompressed_section_contents): New function.
2163 (Object::discard_decompressed_sections): New function.
2164 (Object::do_decompressed_section_contents): New function.
2165 (Object::do_discard_decompressed_sections): New function.
2166 (Compressed_section_info): New type.
2167 (Compressed_section_map): Include decompressed section contents.
2168 (Sized_relobj_file::do_decompressed_section_contents): New function.
2169 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2170
2171 2012-02-16 Cary Coutant <ccoutant@google.com>
2172
2173 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2174 * testsuite/Makefile.in: Regenerate.
2175
2176 2012-02-14 Cary Coutant <ccoutant@google.com>
2177
2178 * options.cc (General_options::finalize): Disallow -pie and -static.
2179
2180 2012-02-03 Doug Kwan <dougkwan@google.com>
2181
2182 * arm.cc (Arm_relocate_functions::abs8,
2183 Arm_relocate_functions::abs16): Use
2184 Bits::has_signed_unsigned_overflow32.
2185 (Arm_relocate_functions::thm_abs8): Correct range of
2186 overflow check.
2187 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2188 in assertions.
2189
2190 2012-02-02 Doug Kwan <dougkwan@google.com>
2191
2192 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2193 position independent outputs, not just shared objects.
2194
2195 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
2196
2197 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2198 * configure: Regenerated.
2199
2200 2012-01-27 Ian Lance Taylor <iant@google.com>
2201
2202 * reloc.h (Bits): New class with static functions, copied from
2203 namespace utils in arm.cc.
2204 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
2205 instead.
2206
2207 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2208
2209 * incremental.cc (write_info_blocks): Correct relocation offset.
2210
2211 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2212
2213 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2214 (Relocate::tls_gd_to_le): Likewise.
2215
2216 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2217
2218 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2219
2220 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2221
2222 * configure.ac: Check if -mcmodel=medium works.
2223 * configure: Regenerated.
2224
2225 2012-01-24 Cary Coutant <ccoutant@google.com>
2226
2227 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2228 definition and ...
2229 (read_unsigned_LEB_128_x): ... this new function.
2230 (read_signed_LEB_128): Replaced with inline definition and ...
2231 (read_signed_LEB_128_x): ... this new function.
2232 * int_encoding.h (read_unsigned_LEB_128_x): New function.
2233 (read_unsigned_LEB_128): Add inline definition.
2234 (read_signed_LEB_128_x): New function.
2235 (read_signed_LEB_128): Add inline definition.
2236 * testsuite/Makefile.am (leb128_unittest): New unit test.
2237 * testsuite/Makefile.in: Regenerate.
2238 * testsuite/leb128_unittest.cc: New unit test.
2239
2240 2012-01-23 Ian Lance Taylor <iant@google.com>
2241
2242 PR gold/13617
2243 * i386.cc (Target_i386::do_code_fill): When using a jmp
2244 instruction, pad with nop instructions.
2245 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2246
2247 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
2248
2249 * x86_64.cc (gc_process_relocs): Add typename on types used in
2250 template.
2251 (scan_relocs): Likewise.
2252 (relocate_section): Likewise.
2253 (apply_relocation): Likewise.
2254
2255 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
2256
2257 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2258 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2259 under x32.
2260
2261 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
2262
2263 * x86_64.cc: Initial support for x32.
2264
2265 2012-01-03 Cary Coutant <ccoutant@google.com>
2266
2267 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2268 Use abstract base class for GOT.
2269 * gold/output.h (class Output_data_got_base): New abstract base class.
2270 (class Output_data_got): Derive from new base class, adjust ctors.
2271 (Output_data_got::reserve_slot): Make virtual; rename to
2272 do_reserve_slot; Adjust callers.
2273 * gold/target.h (Sized_target::init_got_plt_for_update): Return
2274 pointer to abstract base class.
2275 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2276
2277 2011-12-18 Ian Lance Taylor <iant@google.com>
2278
2279 * object.h (Relobj::local_symbol_value): New function.
2280 (Relobj::local_plt_offset): New function.
2281 (Relobj::local_has_got_offset): New function.
2282 (Relobj::local_got_offset): New function.
2283 (Relobj::set_local_got_offset): New function.
2284 (Relobj::do_local_symbol_value): New pure virtual function.
2285 (Relobj::do_local_plt_offset): Likewise.
2286 (Relobj::do_local_has_got_offset): Likewise.
2287 (Relobj::do_local_got_offset): Likewise.
2288 (Relobj::do_set_local_got_offset): Likewise.
2289 (Sized_relobj::do_local_has_got_offset): Rename from
2290 local_has_got_offset.
2291 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2292 (Sized_relobj::do_set_local_got_offset): Rename from
2293 set_local_got_offset.
2294 (Sized_relobj_file::do_local_plt_offset): Rename from
2295 local_plt_offset.
2296 (Sized_relobj_file::do_local_symbol_value): New function.
2297 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2298 local_plt_offset.
2299 * output.cc (Output_data_got::Got_entry::write): Change object to
2300 Relobj. Use local_symbol_value.
2301 (Output_data_got::add_global_with_rel): Change rel_dyn to
2302 Output_data_reloc_generic*. Use add_global_generic.
2303 (Output_data_got::add_global_with_rela): Remove. Change all
2304 callers to use add_global_with_rel.
2305 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2306 Output_data_reloc_generic*. Use add_global_generic.
2307 (Output_data_got::add_global_pair_with_rela): Remove. Change all
2308 callers to use add_global_pair_with_rel.
2309 (Output_data_got::add_local): Change object to Relobj*.
2310 (Output_data_got::add_local_plt): Likewise.
2311 (Output_data_got::add_local_with_rel): Change object to Relobj*,
2312 change rel_dyn to Output_data_reloc_generic*. Use
2313 add_local_generic.
2314 (Output_data_got::add_local_with_rela): Remove. Change all
2315 callers to use all_local_with_rel.
2316 (Output_data_got::add_local_pair_with_rel): Change object to
2317 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
2318 add_output_section_generic.
2319 (Output_data_got::add_local_pair_with_rela): Remove. Change all
2320 callers to use add_local_pair_with_rel.
2321 (Output_data_got::reserve_local): Change object to Relobj*.
2322 * output.h: (class Output_data_reloc_generic): Add pure virtual
2323 declarations for add_global_generic, add_local_generic,
2324 add_output_section_generic.
2325 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2326 functions for Output_data_reloc_generic. Update declarations for
2327 changes listed in output.cc.
2328 (class Output_data_got): Change template parameter to got_size.
2329 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
2330 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2331 function.
2332 (Sized_relobj_incr::do_local_plt_offset): New function.
2333 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2334 add_global_generic.
2335
2336 2011-12-17 Cary Coutant <ccoutant@google.com>
2337
2338 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2339 * resolve.cc (Symbol_table::resolve): Likewise.
2340 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2341 arrays.
2342 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2343
2344 2011-12-16 Ian Lance Taylor <iant@google.com>
2345
2346 * output.h (Output_data_reloc_generic::add): Only call
2347 add_dynamic_reloc if this is a dynamic reloc section.
2348
2349 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
2350
2351 PR gold/13505
2352 * target-reloc.h (apply_relocation): Replace <64, false> with
2353 <size, big_endian>.
2354
2355 2011-11-25 Nick Clifton <nickc@redhat.com>
2356
2357 * po/it.po: New Italian translation.
2358
2359 2011-11-17 Sterling Augustine <saugustine@google.com>
2360
2361 * script.cc (script_include_directive): Implement.
2362 (read_script_file): New local variables name and search_path. Update
2363 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2364 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2365 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2366
2367 2011-11-11 Sterling Augustine <saugustine@google.com>
2368
2369 * yyscript.y (section_cmd): Add support for INCLUDE directive.
2370 (file_or_sections_cmd): Likewise.
2371
2372 2011-11-11 Doug Kwan <dougkwan@google.com>
2373
2374 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2375 if --just-symbols is given.
2376
2377 2011-11-10 Doug Kwan <dougkwan@google.com>
2378
2379 PR gold/13362
2380 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2381 when processing data relocs.
2382 * reloc.h (Relocate_functions::rel_unaligned): New method.
2383 (Relocate_functions::pcrel_unaligned): Ditto.
2384 (Relocate_functions::rel32_unaligned): Ditto.
2385 (Relocate_functions::pcrel32_unaligned): Ditto.
2386
2387 2011-11-09 Doug Kwan <dougkwan@google.com>
2388
2389 PR gold/13362
2390 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2391 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2392 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2393 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2394 (Relocate_functions::rel_unaligned): New.
2395 (Relocate_functions::rel32_unaligned): New.
2396 * target-reloc.h (relocate_for_relocatable): Add code to handle
2397 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2398 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2399 arm_unaligned_reloc_r): New targets.
2400 * testsuite/Makefile.in: Regenerate.
2401 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2402 linking.
2403
2404 2011-11-02 Ian Lance Taylor <iant@google.com>
2405
2406 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
2407 NATIVE_LINKER.
2408 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2409 * options.cc (General_options::finalize): Use library search path
2410 from configure script if specified. If not native and no sysroot,
2411 only search TOOLLIBDIR.
2412 * options.h (Search_directory::Search_directory): Change name to
2413 const std::string&.
2414 (General_options::add_to_library_path_with_sysroot): Change arg to
2415 const std::string&.
2416 * configure, Makefile.in, config.in: Rebuild.
2417
2418 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2419
2420 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2421 we are working around the ARM1176 Erratum.
2422 * options.h (General_options::fix_arm1176): Add option.
2423 * testsuite/Makefile.am: Add testcases, and keep current ones
2424 working.
2425 * testsuite/Makefile.in: Regenerate.
2426 * testsuite/arm_fix_1176.s: New file.
2427 * testsuite/arm_fix_1176.sh: Likewise.
2428
2429 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2430
2431 * arm.cc (Target_arm::Target_arm): Remove initialisation of
2432 may_use_blx_.
2433 (Target_arm::may_use_blx): Remove method.
2434 (Target_arm::set_may_use_blx): Likewise.
2435 (Target_arm::may_use_v4t_interworking): New method.
2436 (Target_arm::may_use_v5t_interworking): Likewise.
2437 (Target_arm::may_use_blx_): Remove member variable.
2438 (Arm_relocate_functions::arm_branch_common): Check for v5T
2439 interworking.
2440 (Arm_relocate_functions::thumb_branch_common): Likewise.
2441 (Reloc_stub::stub_type_for_reloc): Likewise.
2442 (Target_arm::do_finalize_sections): Correct interworking checks.
2443 * testsuite/Makefile.am: Add new tests.
2444 * testsuite/Makefile.in: Regenerate.
2445 * testsuite/arm_farcall_arm_arm.s: New test.
2446 * testsuite/arm_farcall_arm_arm.sh: Likewise.
2447 * testsuite/arm_farcall_arm_thumb.s: Likewise.
2448 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2449 * testsuite/arm_farcall_thumb_arm.s: Likewise.
2450 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2451 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2452 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2453
2454 2011-10-31 Cary Coutant <ccoutant@google.com>
2455
2456 PR gold/13023
2457 * expression.cc (Expression::eval_with_dot): Add
2458 is_section_dot_assignment parameter.
2459 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
2460 absolute and assigning to dot within a section.
2461 * script-sections.cc
2462 (Output_section_element_assignment::set_section_addresses): Pass
2463 dot_section to set_if_absolute.
2464 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2465 as is_section_dot_assignment flag to eval_with_dot.
2466 (Output_section_element_dot_assignment::set_section_addresses):
2467 Likewise.
2468 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2469 parameter. Also set value if relative to dot_section; set the
2470 symbol's output_section.
2471 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2472 parameter. Adjust all callers.
2473 (Expression::eval_maybe_dot): Likewise.
2474 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2475 Adjust all callers.
2476 * testsuite/script_test_2.t: Test assignment of an absolute value
2477 to dot within an output section element.
2478
2479 2011-10-31 Cary Coutant <ccoutant@google.com>
2480
2481 * options.h (class General_options): Add --[no-]gnu-unique options.
2482 * symtab.cc (Symbol_table::sized_write_globals): Convert
2483 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2484
2485 2011-10-31 Cary Coutant <ccoutant@google.com>
2486
2487 PR gold/13359
2488 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2489 unnecessary assertion.
2490 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2491
2492 2011-10-31 Sriraman Tallam <tmsriram@google.com>
2493
2494 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2495 gc_mark_symbol.
2496 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2497 gc_mark_symbol.
2498 Change to just keep the section associated with symbol.
2499 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2500 they are externally visible and --export-dynamic is turned on.
2501 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2502
2503 2011-10-19 Ian Lance Taylor <iant@google.com>
2504
2505 PR gold/13163
2506 * script-sections.cc
2507 (Output_section_element_dot_assignment::needs_output_section): New
2508 function.
2509
2510 2011-10-19 Ian Lance Taylor <iant@google.com>
2511
2512 PR gold/13204
2513 * layout.cc (Layout::segment_precedes): Don't assert failure if a
2514 --section-start option was seen.
2515 * options.h (General_options::any_section_start): New function.
2516
2517 2011-10-18 David S. Miller <davem@davemloft.net>
2518
2519 PR binutils/13301
2520 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2521 member to track relocation locations that have moved during TLS
2522 reloc optimizations.
2523 (Target_sparc::Relocate::Relocate): Initialize to NULL.
2524 (Target_sparc::Relocate::relocate): Adjust view down by 4
2525 bytes if it matches reloc_adjust_addr_.
2526 (Target_sparc::Relocate::relocate_tls): Always move the
2527 __tls_get_addr call delay slot instruction forward 4 bytes when
2528 performing relaxation.
2529
2530 2011-10-18 Cary Coutant <ccoutant@google.com>
2531
2532 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2533 (Output_file::map_no_anonymous): Check for non-zero
2534 return code from posix_fallocate.
2535
2536 2011-10-17 Cary Coutant <ccoutant@google.com>
2537
2538 PR gold/13245
2539 * plugin.cc (is_visible_from_outside): Check for symbols
2540 referenced from dynamic objects.
2541 * resolve.cc (Symbol_table::resolve): Don't count references
2542 from dynamic objects as references from real ELF files.
2543 * testsuite/plugin_test_2.sh: Adjust expected result.
2544
2545 2011-10-17 Cary Coutant <ccoutant@google.com>
2546
2547 * gold.cc: Include timer.h.
2548 (queue_middle_tasks): Stamp time.
2549 (queue_final_tasks): Likewise.
2550 * main.cc (main): Store timer in parameters. Print timers
2551 for each pass.
2552 * parameters.cc (Parameters::Parameters): Initialize timer_.
2553 (Parameters::set_timer): New function.
2554 (set_parameters_timer): New function.
2555 * parameters.h (Parameters::set_timer): New function.
2556 (Parameters::timer): New function.
2557 (Parameters::timer_): New data member.
2558 (set_parameters_timer): New function.
2559 * timer.cc (Timer::stamp): New function.
2560 (Timer::get_pass_time): New function.
2561 * timer.h (Timer::stamp): New function.
2562 (Timer::get_pass_time): New function.
2563 (Timer::pass_times_): New data member.
2564
2565 2011-10-17 Cary Coutant <ccoutant@google.com>
2566
2567 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2568 task for members of lib groups.
2569
2570 2011-10-17 Cary Coutant <ccoutant@google.com>
2571
2572 PR gold/13288
2573 * fileread.cc (File_read::find_view): Add assert.
2574 (File_read::make_view): Move bounds check (replace with assert)...
2575 (File_read::find_or_make_view): ... to here.
2576
2577 2011-10-12 Cary Coutant <ccoutant@google.com>
2578
2579 * output.cc (Output_file::open_base_file): Handle case where
2580 ::read returns less than requested size.
2581
2582 2011-10-10 Cary Coutant <ccoutant@google.com>
2583
2584 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2585 Initialize defined_count_.
2586 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2587 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2588 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2589 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2590 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2591 * incremental.h (Sized_relobj_incr::defined_count_): New data
2592 member.
2593 (Sized_incr_dynobj::defined_count_): New data member.
2594 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2595 Return zeroes instead of internal error.
2596
2597 2011-10-10 Cary Coutant <ccoutant@google.com>
2598
2599 PR gold/13249
2600 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2601 (Output_reloc::symbol_value): Return PLT offset if flag is set.
2602 * output.h (class Output_reloc): Add use_plt_offset flag.
2603 (Output_reloc::type_): Adjust size of bit field.
2604 (Output_reloc::use_plt_offset_): New bit field.
2605 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2606 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2607 flag. Adjust all callers.
2608 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2609 creating RELATIVE relocations.
2610
2611 2011-10-10 Nick Clifton <nickc@redhat.com>
2612
2613 * po/es.po: Updated Spanish translation.
2614 * po/fi.po: Updated Finnish translation.
2615
2616 2011-10-03 Diego Novillo <dnovillo@google.com>
2617
2618 * options.cc (parse_uint): Fix dereference of RETVAL.
2619
2620 2011-09-29 Sriraman Tallam <tmsriram@google.com>
2621
2622 * layout.h (section_order_map_): New member.
2623 (get_section_order_map): New member function.
2624 * output.cc (Output_section::add_input_section): Check for patterns
2625 only when --section-ordering-file is specified.
2626 * gold.cc (queue_middle_tasks): Delay updating order of sections till
2627 output_sections have been formed.
2628 * layout.cc (Layout_Layout): Initialize section_order_map_.
2629 * plugin.cc (update_section_order): Store order in order_map. Do not
2630 update the order.
2631 * testsuite/Makefile.am: Add test case for plugin_final_layout.
2632 * testsuite/Makefile.in: Regenerate.
2633 * testsuite/plugin_section_order.c: New file.
2634 * testsuite/plugin_final_layout.cc: New file.
2635 * testsuite/plugin_final_layout.sh: New file.
2636
2637 2011-09-29 Cary Coutant <ccoutant@google.com>
2638
2639 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2640 Check for NULL.
2641 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2642 symbols during incremental update.
2643 (Symbol_table::add_from_dynobj): Likewise.
2644
2645 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2646 Ian Lance Taylor <iant@google.com>
2647
2648 * symtab.cc (Symbol_table::define_special_symbol): Always
2649 canonicalize version string.
2650
2651 2011-09-26 Cary Coutant <ccoutant@google.com>
2652
2653 * gold.cc (queue_initial_tasks): Move option checks ...
2654 * options.cc (General_options::finalize): ... to here. Disable
2655 some options; make others fatal.
2656
2657 2011-09-26 Cary Coutant <ccoutant@google.com>
2658
2659 gcc PR lto/47247
2660 * plugin.cc (get_symbols_v2): New function.
2661 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2662 (is_referenced_from_outside): New function.
2663 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2664 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2665 (get_symbols): Pass version parameter.
2666 (get_symbols_v2): New function.
2667 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2668 parameter.
2669 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2670 (onload): Add LDPT_GET_SYMBOLS_V2.
2671 (all_symbols_read_hook): Use get_symbols_v2; check for
2672 LDPR_PREVAILING_DEF_IRONLY_EXP.
2673 * testsuite/plugin_test_3.sh: Update expected results.
2674
2675 2011-09-23 Simon Baldwin <simonb@google.com>
2676
2677 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2678 configuration options.
2679 * configure: Regenerate.
2680 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2681 * Makefile.in: Regenerate.
2682 * testsuite/Makefile.in: Regenerate.
2683
2684 2011-09-19 Sriraman Tallam <tmsriram@google.com>
2685
2686 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2687
2688 2011-09-19 Cary Coutant <ccoutant@google.com>
2689
2690 * incremental.cc (can_incremental_update): Fix typo in comment.
2691 * incremental.h (can_incremental_update): Likewise.
2692
2693 2011-09-18 Cary Coutant <ccoutant@google.com>
2694
2695 * incremental.cc (can_incremental_update): New function.
2696 * incremental.h (can_incremental_update): New function.
2697 * layout.cc (Layout::init_fixed_output_section): Call it.
2698 (Layout::make_output_section): Don't allow patch space in .eh_frame.
2699 * object.cc (Sized_relobj_file::do_layout): Call
2700 can_incremental_update.
2701
2702 2011-09-13 Cary Coutant <ccoutant@google.com>
2703
2704 * configure.ac: Check for glibc support for gnu_indirect_function
2705 support with static linking, setting automake conditional
2706 IFUNC_STATIC.
2707 * Makefile.in: Regenerate.
2708 * configure: Regenerate.
2709
2710 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2711 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2712 for IFUNC_STATIC.
2713 * testsuite/Makefile.in: Regenerate.
2714
2715 2011-09-13 Cary Coutant <ccoutant@google.com>
2716
2717 * incremental.cc (Sized_relobj_incr::do_layout): Call
2718 report_comdat_group for kept comdat sections.
2719 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2720 * testsuite/Makefile.in: Regenerate.
2721 * testsuite/incr_comdat_test_1.cc: New source file.
2722 * testsuite/incr_comdat_test_2_v1.cc: New source file.
2723 * testsuite/incr_comdat_test_2_v2.cc: New source file.
2724 * testsuite/incr_comdat_test_2_v3.cc: New source file.
2725
2726 2011-09-13 Ian Lance Taylor <iant@google.com>
2727
2728 * object.cc (Sized_relobj_file::do_layout): Remove unused local
2729 variable external_symbols_offset.
2730
2731 2011-09-12 Ian Lance Taylor <iant@google.com>
2732
2733 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2734 triggered if object has no symbols.
2735
2736 2011-09-09 David S. Miller <davem@davemloft.net>
2737
2738 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2739 (Output_fill_debug_line::do_write): Likewise.
2740
2741 2011-08-29 Cary Coutant <ccoutant@google.com>
2742
2743 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2744 casts to match formatting specs.
2745 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2746
2747 2011-08-26 Cary Coutant <ccoutant@google.com>
2748
2749 * layout.cc (Free_list::allocate): Provide guarantee of minimum
2750 remaining hole size when allocating.
2751 (Layout::make_output_section): Set fill methods for debug sections.
2752 * layout.h (Free_list::Free_list_node): Move from private to
2753 public.
2754 (Free_list::set_min_hole_size): New function.
2755 (Free_list::begin, Free_list::end): New functions.
2756 (Free_list::min_hole_): New data member.
2757 * output.cc: Include dwarf.h.
2758 (Output_fill_debug_info::do_minimum_hole_size): New function.
2759 (Output_fill_debug_info::do_write): New function.
2760 (Output_fill_debug_line::do_minimum_hole_size): New function.
2761 (Output_fill_debug_line::do_write): New function.
2762 (Output_section::Output_section): Initialize new data member.
2763 (Output_section::set_final_data_size): Ensure patch space is larger
2764 than minimum hole size.
2765 (Output_section::do_write): Fill holes in debug sections.
2766 * output.h (Output_fill): New class.
2767 (Output_fill_debug_info): New class.
2768 (Output_fill_debug_line): New class.
2769 (Output_section::set_free_space_fill): New function.
2770 (Output_section::free_space_fill_): New data member.
2771 * testsuite/Makefile.am (incremental_test_3): Add
2772 --incremental-patch option.
2773 (incremental_test_4): Likewise.
2774 (incremental_test_5): Likewise.
2775 (incremental_test_6): Likewise.
2776 (incremental_copy_test): Likewise.
2777 (incremental_common_test_1): Likewise.
2778 * testsuite/Makefile.in: Regenerate.
2779
2780 2011-08-26 Nick Clifton <nickc@redhat.com>
2781
2782 * po/es.po: Updated Spanish translation.
2783
2784 2011-08-01 Cary Coutant <ccoutant@google.com>
2785
2786 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2787 * gold/testsuite/Makefile.in: Regenerate.
2788 * gold/testsuite/justsyms_exec.c: New source file.
2789 * gold/testsuite/justsyms_lib.c: New source file.
2790
2791 2011-08-01 Cary Coutant <ccoutant@google.com>
2792
2793 * layout.cc (Layout::set_segment_offsets): Don't realign text
2794 segment if -Ttext was specified.
2795 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2796 file type.
2797 * object.h (Sized_relobj_file::e_type): New function.
2798 (Sized_relobj_file::e_type_): New data member.
2799 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2800 base address for ET_EXEC files.
2801 * target.cc (Target::do_make_elf_object_implementation): Allow
2802 ET_EXEC files with --just-symbols option.
2803
2804 2011-07-28 Cary Coutant <ccoutant@google.com>
2805
2806 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2807 Add thread_number parameter.
2808 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2809 * workqueue-threads.cc
2810 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2811 current thread if its thread number is greater than desired thread
2812 count.
2813 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2814 Add thread_number parameter.
2815 (Workqueue::should_cancel_thread): Likewise.
2816 (Workqueue::find_runnable_or_wait): Pass thread_number to
2817 should_cancel_thread.
2818 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2819 parameter.
2820
2821 2011-07-22 Sriraman Tallam <tmsriram@google.com>
2822
2823 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2824 only after checking if it cannot be forced local.
2825 * symtab.h (is_externally_visible): Check if the symbol is not forced
2826 local.
2827
2828 2011-07-15 Ian Lance Taylor <iant@google.com>
2829
2830 * options.h (class General_options): Add --print-output-format.
2831 Move -EL next to -EB, for better --help output.
2832 * target-select.cc: Include <cstdio>, "options.h", and
2833 "parameters.h".
2834 (Target_selector::do_target_bfd_name): New function.
2835 (print_output_format): New function.
2836 * target-select.h (class Target_selector): Update declarations.
2837 (Target_selector::target_bfd_name): New function.
2838 (print_output_format): Declare.
2839 * main.cc: Include "target-select.h".
2840 (main): Handle --print-output-format.
2841 * gold.cc: Include "target-select.h".
2842 (queue_initial_tasks): Handle --print-output-format when there are
2843 no input files.
2844 * parameters.cc (parameters_force_valid_target): Give a better
2845 error message if -EB/-EL does not match target.
2846 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2847 function.
2848
2849 2011-07-15 Ian Lance Taylor <iant@google.com>
2850
2851 * i386.cc (class Output_data_plt_i386): Add layout_ field.
2852 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2853 (Output_data_plt_i386::do_write): Write address of .dynamic
2854 section to first entry in .got.plt section.
2855 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2856 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2857 Initialize layout_.
2858 (Output_data_plt_x86_64::do_write): Write address of .dynamic
2859 section to first entry in .got.plt section.
2860 * layout.h (Layout::dynamic_section): New function.
2861
2862 2011-07-13 Sriraman Tallam <tmsriram@google.com>
2863
2864 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2865 to claim_file call.
2866 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2867 input_section_position_, and input_section_glob_.
2868 (read_layout_from_file): Call function section_ordering_specified.
2869 * layout.h (is_section_ordering_specified): New function.
2870 (section_ordering_specified): New function.
2871 (section_ordering_specified_): New boolean member.
2872 * main.cc(main): Call load_plugins after layout object is defined.
2873 * output.cc (Output_section::add_input_section): Use
2874 function section_ordering_specified to check if section ordering is
2875 needed.
2876 * output.cc (Output_section::add_relaxed_input_section): Use
2877 function section_ordering_specified to check if section ordering is
2878 needed.
2879 (Output_section::update_section_layout): New function.
2880 (Output_section::sort_attached_input_sections): Check if input section
2881 must be reordered.
2882 * output.h (Output_section::update_section_layout): New function.
2883 * plugin.cc (get_section_count): New function.
2884 (get_section_type): New function.
2885 (get_section_name): New function.
2886 (get_section_contents): New function.
2887 (update_section_order): New function.
2888 (allow_section_ordering): New function.
2889 (Plugin::load): Add the new interfaces to the transfer vector.
2890 (Plugin_manager::load_plugins): New parameter.
2891 (Plugin_manager::all_symbols_read): New parameter.
2892 (Plugin_manager::claim_file): New parameter. Save the elf object for
2893 unclaimed objects.
2894 (Plugin_manager::get_elf_object): New function.
2895 (Plugin_manager::get_view): Change to directly use the bool to check
2896 if get_view is called from claim_file_hook.
2897 * plugin.h (input_objects): New function
2898 (Plugin__manager::load_plugins): New parameter.
2899 (Plugin_manager::claim_file): New parameter.
2900 (Plugin_manager::get_elf_object): New function.
2901 (Plugin_manager::in_claim_file_handler): New function.
2902 (Plugin_manager::in_claim_file_handler_): New member.
2903 (layout): New function.
2904 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2905 handler with an extra parameter. Make the elf object before calling
2906 claim_file handler.
2907 * testsuite/plugin_test.c (get_section_count): New function pointer.
2908 (get_section_type): New function pointer.
2909 (get_section_name): New function pointer.
2910 (get_section_contents): New function pointer.
2911 (update_section_order): New function pointer.
2912 (allow_section_ordering): New function pointer.
2913 (onload): Check if the new interfaces exist.
2914
2915 2011-07-13 Ian Lance Taylor <iant@google.com>
2916
2917 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2918 relro section.
2919 * x86_64.cc (Target_x86_64::got_section): Likewise.
2920 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2921 (relro_now_test_SOURCES): New variable.
2922 (relro_now_test_DEPENDENCIES): New variable.
2923 (relro_now_test_LDFLAGS): New variable.
2924 (relro_now_test_LDADD): New variable.
2925 (relro_now_test.so): New target.
2926 * testsuite/Makefile.in: Rebuild.
2927
2928 2011-07-12 Ian Lance Taylor <iant@google.com>
2929
2930 PR gold/12980
2931 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2932 GLOB_DAT relocation rather than a RELATIVE relocation for a
2933 protected symbol when creating a shared library.
2934 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2935 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2936 * testsuite/protected_main_1.cc (main): Test that protected
2937 function has same address.
2938
2939 2011-07-11 Ian Lance Taylor <iant@google.com>
2940
2941 PR gold/12979
2942 * options.h (class General_options): Add -Bgroup.
2943 * options.cc (General_options::finalize): If -Bgroup is set,
2944 default to --unresolved-symbols=report-all.
2945 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2946 * target-reloc.h (issue_undefined_symbol_error): Handle
2947 --unresolved-symbols=report-all.
2948
2949 2011-07-08 Ian Lance Taylor <iant@google.com>
2950
2951 PR gold/11985
2952 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2953 if linker script discards key sections.
2954 (Layout::create_dynamic_symtab): Likewise.
2955 (Layout::assign_local_dynsym_offsets): Likewise.
2956 (Layout::sized_create_version_sections): Likewise.
2957 (Layout::create_interp): Likewise.
2958 (Layout::finish_dynamic_section): Likewise.
2959 (Layout::set_dynamic_symbol_size): Likewise.
2960
2961 2011-07-08 Ian Lance Taylor <iant@google.com>
2962
2963 PR gold/12386
2964 * options.h (class General_options): Add --unresolved-symbols.
2965 * target-reloc.h (issue_undefined_symbol_error): Check
2966 --unresolved-symbols. Add comments.
2967
2968 2011-07-08 Ian Lance Taylor <iant@google.com>
2969
2970 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2971 expression more complex.
2972
2973 2011-07-08 Ian Lance Taylor <iant@google.com>
2974
2975 PR gold/11317
2976 * target-reloc.h (issue_undefined_symbol_error): New inline
2977 function, broken out of relocate_section.
2978 (relocate_section): Call issue_undefined_symbol_error.
2979 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2980 there is no TLS segment if we are about to issue an undefined
2981 symbol error.
2982 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2983
2984 2011-07-08 Ian Lance Taylor <iant@google.com>
2985
2986 PR gold/12279
2987 * resolve.cc (Symbol_table::should_override): Add fromtype
2988 parameter. Change all callers. Give error when linking together
2989 TLS and non-TLS symbol.
2990 (Symbol_table::should_override_with_special): Add fromtype
2991 parameter. Change all callers.
2992 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2993 there is no TLS segment if we have reported some errors.
2994 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2995
2996 2011-07-08 Ian Lance Taylor <iant@google.com>
2997
2998 PR gold/12372
2999 * target.h (Target::plt_address_for_global): New function.
3000 (Target::plt_address_for_local): New function.
3001 (Target::plt_section_for_global): Remove.
3002 (Target::plt_section_for_local): Remove.
3003 (Target::do_plt_address_for_global): New virtual function.
3004 (Target::do_plt_address_for_local): New virtual function.
3005 (Target::do_plt_section_for_global): Remove.
3006 (Target::do_plt_section_for_local): Remove.
3007 (Target::register_global_plt_entry): Add Symbol_table and Layout
3008 parameters.
3009 * output.cc (Output_data_got::Got_entry::write): Use
3010 plt_address_for_global and plt_address_for_local.
3011 * layout.cc (Layout::add_target_dynamic_tags): Use size and
3012 address of output section.
3013 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3014 got_irelative_, and irelative_count_ fields. Update
3015 declarations.
3016 (Output_data_plt_i386::has_irelative_section): New function.
3017 (Output_data_plt_i386::entry_count): Add irelative_count_.
3018 (Output_data_plt_i386::set_final_data_size): Likewise.
3019 (class Target_i386): Add got_irelative_ and rel_irelative_
3020 fields. Update declarations.
3021 (Target_i386::Target_i386): Initialize new fields.
3022 (Target_i386::do_plt_address_for_global): New function replacing
3023 do_plt_section_for_global.
3024 (Target_i386::do_plt_address_for_local): New function replacing
3025 do_plt_section_for_local.
3026 (Target_i386::got_section): Create got_irelative_.
3027 (Target_i386::rel_irelative_section): New function.
3028 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3029 fields. Don't define __rel_iplt_{start,end}.
3030 (Output_data_plt_i386::add_entry): Add symtab and layout
3031 parameters. Change all callers. Use different PLT and GOT for
3032 IFUNC symbols.
3033 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3034 layout parameters. Change all callers. Use different PLT and
3035 GOT.
3036 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3037 (Output_data_plt_i386::rel_irelative): New function.
3038 (Output_data_plt_i386::address_for_global): New function.
3039 (Output_data_plt_i386::address_for_local): New function.
3040 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
3041 IRELATIVE GOT when changing IFUNC GOT entries.
3042 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3043 reloc.
3044 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3045 if we didn't create an IRELATIVE GOT.
3046 (Target_i386::Relocate::relocate): Use plt_address_for_global and
3047 plt_address_for_local.
3048 (Target_i386::do_dynsym_value): Use plt_address_for_global.
3049 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3050 got_irelative_, and irelative_count_ fields. Update
3051 declarations.
3052 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3053 Initialize new fields. Remove symtab parameter. Change all
3054 callers.
3055 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3056 irelative_count_.
3057 (Output_data_plt_x86_64::has_irelative_section): New function.
3058 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3059 (class Target_x86_64): Add got_irelative_ and rel_irelative_
3060 fields. Update declarations.
3061 (Target_x86_64::Target_x86_64): Initialize new fields.
3062 (Target_x86_64::do_plt_address_for_global): New function replacing
3063 do_plt_section_for_global.
3064 (Target_x86_64::do_plt_address_for_local): New function replacing
3065 do_plt_section_for_local.
3066 (Target_x86_64::got_section): Create got_irelative_.
3067 (Target_x86_64::rela_irelative_section): New function.
3068 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
3069 all callers. Don't create __rel_iplt_{start,end}.
3070 (Output_data_plt_x86_64::add_entry): Add symtab and layout
3071 parameters. Change all callers. Use different PLT and GOT for
3072 IFUNC symbols.
3073 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3074 layout parameters. Change all callers. Use different PLT and
3075 GOT.
3076 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3077 parameters. Change all callers. Use different PLT and GOT for
3078 IFUNC symbols.
3079 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3080 (Output_data_plt_x86_64::rela_irelative): New function.
3081 (Output_data_plt_x86_64::address_for_global): New function.
3082 (Output_data_plt_x86_64::address_for_local): New function.
3083 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3084 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3085 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3086 (Target_x86_64::register_global_plt_entry): Add symtab and layout
3087 parameters.
3088 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3089 reloc.
3090 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3091 symbols if we didn't create an IRELATIVE GOT.
3092 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3093 plt_address_for_local.
3094 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3095 * testsuite/ifuncvar1.c: New test file.
3096 * testsuite/ifuncvar2.c: New test file.
3097 * testsuite/ifuncvar3.c: New test file.
3098 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3099 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3100 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3101 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3102 * testsuite/Makefile.in: Rebuild.
3103
3104 2011-07-07 Cary Coutant <ccoutant@google.com>
3105
3106 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3107 (two_file_test_1_ndebug.o): Likewise.
3108 (two_file_test_1b_ndebug.o): Likewise.
3109 (two_file_test_2_ndebug.o): Likewise.
3110 (two_file_test_main_ndebug.o): Likewise.
3111 (incremental_test_2): Link with no-debug versions.
3112
3113 2011-07-06 Cary Coutant <ccoutant@google.com>
3114
3115 * gold/incremental.cc
3116 (Output_section_incremental_inputs::write_info_blocks): Check for
3117 hidden and internal symbols.
3118
3119 2011-07-06 Cary Coutant <ccoutant@google.com>
3120
3121 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3122 Check disposition for startup file.
3123 (Incremental_inputs::report_command_line): Ignore
3124 --incremental-startup-unchanged option.
3125 * options.cc (General_options::parse_incremental_startup_unchanged):
3126 New function.
3127 (General_options::General_options): Initialize new data member.
3128 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3129 (General_options): Add --incremental-startup-unchanged option.
3130 (General_options::incremental_startup_disposition): New function.
3131 (General_options::incremental_startup_disposition_): New data member.
3132
3133 2011-07-06 Cary Coutant <ccoutant@google.com>
3134
3135 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3136 input file index to Script_info ctor.
3137 (Sized_incremental_binary::do_file_has_changed): Find the
3138 command-line argument for files named in scripts.
3139 * incremental.h (Script_info::Script_info): New ctor
3140 with input file index.
3141 (Script_info::input_file_index): New function.
3142 (Script_info::input_file_index_): New data member.
3143 (Incremental_binary::get_library): Add const.
3144 (Incremental_binary::get_script_info): Add const.
3145 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3146 * testsuite/Makefile.am (incremental_test_5): New test case.
3147 (incremental_test_6): New test case.
3148 * testsuite/Makefile.in: Regenerate.
3149
3150 2011-07-06 Cary Coutant <ccoutant@google.com>
3151
3152 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3153 debug output when command lines differ.
3154
3155 2011-07-06 Cary Coutant <ccoutant@google.com>
3156
3157 * incremental.cc (Incremental_inputs::report_command_line): Ignore
3158 --incremental-patch option.
3159 * layout.cc (Free_list::allocate): Extend allocation beyond original
3160 end if enabled.
3161 (Layout::make_output_section): Mark sections that should get
3162 patch space.
3163 * options.cc (parse_percent): New function.
3164 * options.h (parse_percent): New function.
3165 (DEFINE_percent): New macro.
3166 (General_options): Add --incremental-patch option.
3167 * output.cc (Output_section::Output_section): Initialize new data
3168 members.
3169 (Output_section::add_input_section): Print section name when out
3170 of patch space.
3171 (Output_section::add_output_section_data): Likewise.
3172 (Output_section::set_final_data_size): Add patch space when
3173 doing --incremental-full.
3174 (Output_section::do_reset_address_and_file_offset): Remove patch
3175 space.
3176 (Output_segment::set_section_list_addresses): Print debug output
3177 only if --incremental-update.
3178 * output.h (Output_section::set_is_patch_space_allowed): New function.
3179 (Output_section::is_patch_space_allowed_): New data member.
3180 (Output_section::patch_space_): New data member.
3181 * parameters.cc (Parameters::incremental_full): New function.
3182 * parameters.h (Parameters::incremental_full): New function
3183 * testsuite/Makefile.am (incremental_test_2): Add test for
3184 --incremental-patch option.
3185 * testsuite/Makefile.in: Regenerate.
3186 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3187 (t18): Remove function body.
3188
3189 2011-07-05 Doug Kwan <dougkwan@google.com>
3190
3191 PR gold/12771
3192 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3193 Arm_Address type for relocation result.
3194 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
3195 overflow check.
3196 (Arm_relocate_functions::abs32): Use unaligned access.
3197 (Arm_relocate_functions::rel32): Ditto.
3198 (Arm_relocate_functions::prel31): Ditto.
3199 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3200 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3201 static data relocations.
3202 * testsuite/Makefile.in: Regnerate.
3203 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3204
3205 2011-07-05 Ian Lance Taylor <iant@google.com>
3206
3207 PR gold/12392
3208 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3209 symbols if necessary.
3210 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3211
3212 2011-07-05 Ian Lance Taylor <iant@google.com>
3213
3214 PR gold/12952
3215 * resolve.cc (Symbol::override_base_with_special): Simply override
3216 version with special symbol version, ignoring previous version.
3217
3218 2011-07-05 Ian Lance Taylor <iant@google.com>
3219
3220 * object.cc (Sized_relobj_file::include_section_group): Add
3221 information to comment about signature location.
3222
3223 2011-07-02 Ian Lance Taylor <iant@google.com>
3224
3225 PR gold/12957
3226 * options.h (class General_options): Add -f and -F.
3227 * options.cc (General_options::finalize): Fatal error if -f/-F
3228 are used without -shared.
3229 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3230
3231 2011-07-02 Ian Lance Taylor <iant@google.com>
3232
3233 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3234
3235 2011-07-01 Ian Lance Taylor <iant@google.com>
3236
3237 PR gold/12525
3238 PR gold/12952
3239 * resolve.cc (Symbol::override_base_with_special): Don't override
3240 the version if the overriding symbol has a different name.
3241 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
3242 all callers. If we give an error about an undefined version,
3243 define the base version if necessary.
3244 * dynobj.h (class Versions): Update declaration.
3245 * testsuite/weak_alias_test_5.cc: New file.
3246 * testsuite/weak_alias_test.script: New file.
3247 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3248 and versioned_alias have the right value, and call t2.
3249 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3250 weak_alias_test_5.so.
3251 (weak_alias_test_LDADD): Likewise.
3252 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3253 * testsuite/Makefile.in: Rebuild.
3254
3255 2011-07-01 Ian Lance Taylor <iant@google.com>
3256
3257 PR gold/12525
3258 * options.h (class General_options): Support -z notext.
3259 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3260 -Wl,-z,notext.
3261 (two_file_shared_nonpic.so): Likewise.
3262 (two_file_shared_mixed.so): Likewise.
3263 (two_file_shared_mixed_1.so): Likewise.
3264 (weak_undef_lib_nonpic.so): Likewise.
3265 (alt/weak_undef_lib_nonpic.so): Likewise.
3266 (tls_test_shared_nonpic.so): Likewise.
3267 * testsuite/Makefile.in: Rebuild.
3268
3269 2011-07-01 Ian Lance Taylor <iant@google.com>
3270
3271 PR gold/12525
3272 * configure.ac: Test whether static linking works, setting
3273 the automake conditional HAVE_STATIC.
3274 * testsuite/Makefile.am: Disable tests using -static if
3275 HAVE_STATIC is not true.
3276 * configure, testsuite/Makefile.in: Rebuild.
3277
3278 2011-07-01 Ian Lance Taylor <iant@google.com>
3279
3280 PR gold/12525
3281 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3282 Assert if we see DW_EH_PE_indirect.
3283 * target.h (Target::ehframe_datarel_base): New function.
3284 (Target::do_ehframe_datarel_base): New target function.
3285 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3286 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3287 function.
3288
3289 2011-07-01 Ian Lance Taylor <iant@google.com>
3290
3291 PR gold/12571
3292 * options.h (class General_options): Add
3293 --ld-generated-unwind-info.
3294 * ehframe.cc (Fde::write): Add address parameter. Change all
3295 callers. If associated with PLT, fill in address and size.
3296 (Cie::set_output_offset): Only add merge mapping if there is an
3297 object.
3298 (Cie::write): Add address parameter. Change all callers.
3299 (Eh_frame::add_ehframe_for_plt): New function.
3300 * ehframe.h (class Fde): Update declarations. Move shndx_ and
3301 input_offset_ fields into union u_, with new plt field.
3302 (Fde::Fde): Adjust for new union field.
3303 (Fde::Fde) [Output_data version]: New constructor.
3304 (Fde::add_mapping): Only add merge mapping if there is an object.
3305 (class Cie): Update declarations.
3306 (class Eh_frame): Declare add_ehframe_for_plt.
3307 * layout.cc (Layout::layout_eh_frame): Break out code into
3308 make_eh_frame_section, and call it.
3309 (Layout::make_eh_frame_section): New function.
3310 (Layout::add_eh_frame_for_plt): New function.
3311 * layout.h (class Layout): Update declarations.
3312 * merge.cc (Merge_map::add_mapping): Add assertion.
3313 * i386.cc: Include "dwarf.h".
3314 (class Output_data_plt_i386): Make first_plt_entry,
3315 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
3316 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3317 and plt_eh_frame_fde.
3318 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3319 boundary. Call add_eh_frame_for_plt if appropriate.
3320 * x86_64.cc: Include "dwarf.h".
3321 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
3322 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
3323 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3324 and plt_eh_frame_fde.
3325 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3326 appropriate.
3327
3328 2011-06-29 Ian Lance Taylor <iant@google.com>
3329
3330 PR gold/12629
3331 * object.cc (Sized_relobj_file::layout_section): Change shdr
3332 parameter to be const.
3333 (Sized_relobj_file::layout_eh_frame_section): New function, broken
3334 out of do_layout.
3335 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3336 appropriate. Call layout_eh_frame_section.
3337 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3338 sections.
3339 * object.h (class Sized_relobj_file): Update declarations.
3340
3341 2011-06-29 Ian Lance Taylor <iant@google.com>
3342
3343 PR gold/12652
3344 * script.cc (Token::integer_value): Accept trailing M/m/K/k
3345 modifier.
3346 (Lex::gather_token): Accept trailing M/m/K/k for integers.
3347
3348 2011-06-29 Ian Lance Taylor <iant@google.com>
3349
3350 PR gold/12675
3351 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3352 SHT_X86_64_UNWIND.
3353 * layout.cc (Layout::layout_eh_frame): Likewise.
3354
3355 2011-06-29 Ian Lance Taylor <iant@google.com>
3356
3357 PR gold/12695
3358 * layout.cc (Layout::symtab_section_shndx): New function.
3359 * layout.h (class Layout): Declare symtab_section_shndx.
3360 * output.cc (Output_section::write_header): Call it.
3361
3362 2011-06-29 Ian Lance Taylor <iant@google.com>
3363
3364 PR gold/12818
3365 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3366 symbols which are not used in a relocation.
3367
3368 2011-06-28 Ian Lance Taylor <iant@google.com>
3369
3370 PR gold/12898
3371 * layout.cc (Layout::segment_precedes): Don't crash if a linker
3372 script create indistinguishable segments.
3373 (Layout::set_segment_offsets): Use stable_sort when sorting
3374 segments. Pass this to Compare_segments constructor.
3375 * layout.h (class Layout): Make segment_precedes non-static.
3376 (class Compare_segments): Change from struct to class. Add
3377 layout_ field. Add constructor.
3378 * script-sections.cc
3379 (Script_sections::attach_sections_using_phdrs_clause): Rename
3380 local orphan to is_orphan. Don't report failure to put empty
3381 section in segment. On attachment failure, report name of
3382 section, and attach to first PT_LOAD segment.
3383
3384 2011-06-28 Ian Lance Taylor <iant@google.com>
3385
3386 PR gold/12934
3387 * target-select.cc (Target_selector::Target_selector): Add
3388 emulation parameter. Change all callers.
3389 (select_target_by_bfd_name): Rename from select_target_by_name.
3390 Change all callers.
3391 (select_target_by_emulation): New function.
3392 (supported_emulation_names): New function.
3393 * target-select.h (class Target_selector): Add emulation_ field.
3394 Update declarations.
3395 (Target_selector::recognize_by_bfd_name): Rename from
3396 recognize_by_name. Change all callers.
3397 (Target_selector::supported_bfd_names): Rename from
3398 supported_names. Change all callers.
3399 (Target_selector::recognize_by_emulation): New function.
3400 (Target_selector::supported_emulations): New function.
3401 (Target_selector::emulation): New function.
3402 (Target_selector::do_recognize_by_bfd_name): Rename from
3403 do_recognize_by_name. Change all callers.
3404 (Target_selector::do_supported_bfd_names): Rename from
3405 do_supported_names. Change all callers.
3406 (Target_selector::do_recognize_by_emulation): New function.
3407 (Target_selector::do_supported_emulations): New function.
3408 (select_target_by_bfd_name): Change name in declaration.
3409 (select_target_by_emulation): Declare.
3410 (supported_emulation_names): Declare.
3411 * parameters.cc (parameters_force_valid_target): Try to find
3412 target based on emulation from -m option.
3413 * options.h (class General_options): Change doc string for -m.
3414 * options.cc (help): Print emulations.
3415 (General_options::parse_V): Likewise.
3416 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3417 Add emulation parameter. Change all callers.
3418
3419 2011-06-28 Ian Lance Taylor <iant@google.com>
3420
3421 * target.h (class Target): Add osabi_ field.
3422 (Target::osabi): New function.
3423 (Target::set_osabi): New function.
3424 (Target::Target): Initialize osabi_.
3425 (Target::do_adjust_elf_header): Make pure virtual.
3426 (Sized_target::do_adjust_elf_header): Declare.
3427 * target.cc (Sized_target::do_adjust_elf_header): New function.
3428 (class Sized_target): Instantiate all versions.
3429 * freebsd.h (class Target_freebsd): Remove.
3430 (Target_selector_freebsd::do_recognize): Call set_osabi on
3431 Target.
3432 (Target_selector_freebsd::do_recognize_by_name): Likewise.
3433 (Target_selector_freebsd::set_osabi): Remove.
3434 * i386.cc (class Target_i386): Inherit from Sized_target rather
3435 than Target_freebsd.
3436 * x86_64.cc (class Target_x86_64): Likewise.
3437
3438 2011-06-28 Ian Lance Taylor <iant@google.com>
3439
3440 * target.h (Target::can_check_for_function_pointers): Rewrite.
3441 Make non-virtual.
3442 (Target::can_icf_inline_merge_sections): Likewise.
3443 (Target::section_may_have_icf_unsafe_poineters): Likewise.
3444 (Target::Target_info): Add can_icf_inline_merge_sections field.
3445 (Target::do_can_check_for_function_pointers): New virtual
3446 function.
3447 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3448 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3449 from can_check_for_function_pointers, move in file.
3450 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3451 section_may_have_icf_unsafe_poineters, move in file.
3452 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3453 * i386.cc (Target_i386::do_can_check_for_function_pointers):
3454 Rename from can_check_for_function_pointers, move in file.
3455 (Target_i386::can_icf_inline_merge_sections): Remove.
3456 (Target_i386::i386_info): Initialize
3457 can_icf_inline_merge_sections.
3458 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3459 Initialize can_icf_inline_merge_sections.
3460 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3461 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3462 Rename from can_check_for_function_pointers, move in file.
3463 (Target_x86_64::can_icf_inline_merge_sections): Remove.
3464 (Target_x86_64::x86_64_info): Initialize
3465 can_icf_inline_merge_sections.
3466 * testsuite/testfile.cc (Target_test::test_target_info):
3467 Likewise.
3468 * icf.cc (get_section_contents): Correct formatting.
3469
3470 2011-06-27 Ian Lance Taylor <iant@google.com>
3471
3472 * symtab.cc (Symbol::versioned_name): New function.
3473 (Symbol_table::add_to_final_symtab): Use versioned_name when
3474 appropriate.
3475 (Symbol_table::sized_write_symbol): Likewise.
3476 * symtab.h (class Symbol): Declare versioned_name.
3477 * stringpool.h (class Stringpool_template): Add variant of add
3478 which takes a std::basic_string.
3479 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3480 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3481 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3482 (ver_test_12.o): New target.
3483 * testsuite/Makefile.in: Rebuild.
3484
3485 2011-06-27 Doug Kwan <dougkwan@google.com>
3486
3487 * arm.cc (Arm_relocate_functions::thm_jump8,
3488 Arm_relocate_functions::thm_jump11): Use a wider signed
3489 type to compute offset.
3490 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3491 arm_thm_jump8.
3492 * testsuite/Makefile.in: Regenerate.
3493 * testsuite/arm_branch_in_range.sh: Check test results of
3494 arm_thm_jump11 and arm_thm_jump8.
3495 * testsuite/arm_thm_jump11.s: New test source file.
3496 * testsuite/arm_thm_jump11.t: New linker script.
3497 * testsuite/arm_thm_jump8.s: New test source file.
3498 * testsuite/arm_thm_jump8.t: New linker script.
3499
3500 2011-06-24 Ian Lance Taylor <iant@google.com>
3501
3502 * layout.cc: Include "object.h".
3503 (ctors_sections_in_init_array): New static variable.
3504 (Layout::is_ctors_in_init_array): New function.
3505 (Layout::layout): Add entry to ctors_sections_in_init_array if
3506 appropriate.
3507 * layout.h (class Layout): Declare is_ctors_in_init_array.
3508 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3509 is_ctors_reverse_view is set.
3510 (Sized_relobj_file::write_sections): Add layout parameter. Change
3511 all callers. Set is_ctors_reverse_view field of View_size.
3512 (Sized_relobj_file::reverse_words): New function.
3513 * object.h (Sized_relobj_file::View_size): Add
3514 is_ctors_reverse_view field.
3515 (class Sized_relobj_file): Update declarations.
3516 * testsuite/initpri3.c: New test.
3517 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3518 initpri3b.
3519 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3520 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3521 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3522 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3523 * testsuite/Makefile.in: Rebuild.
3524
3525 2011-06-24 Cary Coutant <ccoutant@google.com>
3526
3527 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3528 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3529 (debug_msg_cdebug.err): New targets.
3530 * testsuite/Makefile.in: Regenerate.
3531 * testsuite/debug_msg.sh: Check output of link with compressed debug.
3532 Fix checks for link with shared library.
3533
3534 2011-06-24 Doug Kwan <dougkwan@google.com>
3535
3536 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3537 skip empty text sections.
3538 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3539
3540 2011-06-22 Ian Lance Taylor <iant@google.com>
3541
3542 PR gold/12910
3543 * options.h (class General_options): Add --ctors-in-init-array.
3544 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3545 friends as SHT_PROGBITS for merging sections.
3546 (Layout::layout): Remove special handling of .init_array and
3547 friends. Don't sort if doing relocatable link. Sort for .ctors
3548 and .dtors if ctors_in_init_array.
3549 (Layout::make_output_section): Force correct section types for
3550 .init_array and friends. Don't sort if doing relocatable link,
3551 Don't sort .ctors and .dtors if ctors_in_init_array.
3552 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3553 (Layout::output_section_name): Add relobj parameter. Change all
3554 callers. Handle .ctors. and .dtors. in code rather than table.
3555 Handle .ctors and .dtors if ctors_in_init_array.
3556 (Layout::match_file_name): New function, moved from output.cc.
3557 * layout.h (class Layout): Update declarations.
3558 * output.cc: Include "layout.h".
3559 (Input_section_sort_entry::get_priority): New function.
3560 (Input_section_sort_entry::match_file_name): Just call
3561 Layout::match_file_name.
3562 (Output_section::Input_section_sort_init_fini_compare::operator()):
3563 Handle .ctors and .dtors. Sort by explicit priority rather than
3564 by name.
3565 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3566 * testsuite/initpri2.c: New test.
3567 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3568 (check_PROGRAMS): Add initpri2.
3569 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3570 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3571 * configure, testsuite/Makefile.in: Rebuild.
3572
3573 2011-06-19 Ian Lance Taylor <iant@google.com>
3574
3575 PR gold/12880
3576 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3577 .interp section to a PT_INTERP segment even if we have seen a
3578 --dynamic-linker option. Don't do it if we have seen a PHDRS
3579 clause in a linker script.
3580 (Layout::finalize): Don't create a .interp section if we've
3581 already create a PT_INTERP segment.
3582 (Layout::create_interp): Always call choose_output_section (revert
3583 patch of 2011-06-17). Don't create PT_INTERP segment.
3584 * script-sections.cc
3585 (Script_sections::create_note_and_tls_segments): Add a .interp
3586 section to a PT_INTERP segment even if we have seen a
3587 --dynamic-linker option.
3588
3589 2011-06-18 Ian Lance Taylor <iant@google.com>
3590
3591 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3592 merely because a non-PT_LOAD segment has a dynamic reloc.
3593
3594 2011-06-18 Ian Lance Taylor <iant@google.com>
3595
3596 * layout.cc (Layout::finish_dynamic_section): Don't create
3597 DT_FLAGS entry if not needed.
3598
3599 2011-06-18 Ian Lance Taylor <iant@google.com>
3600
3601 PR gold/12745
3602 * layout.cc (Layout::layout_eh_frame): Correct handling of
3603 writable .eh_frame section.
3604
3605 2011-06-17 Ian Lance Taylor <iant@google.com>
3606
3607 PR gold/12893
3608 * resolve.cc (Symbol_table::resolve): Don't give an error if a
3609 symbol is redefined with the exact same object and value.
3610
3611 2011-06-17 Ian Lance Taylor <iant@google.com>
3612
3613 PR gold/12880
3614 * layout.h (class Layout): Add interp_segment_ field.
3615 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3616 (Layout::attach_allocated_section_to_segment): If making shared
3617 library, put .interp section in PT_INTERP segment.
3618 (Layout::finalize): Also call create_interp if -dynamic-linker
3619 option was used.
3620 (Layout::create_interp): Assert that there is no PT_INTERP
3621 segment. If not using a SECTIONS clause, use make_output_section.
3622 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3623 * script-sections.cc
3624 (Script_sections::create_note_and_tls_segments): If making shared
3625 library, put .interp section in PT_INTERP segment.
3626
3627 2011-06-17 Ian Lance Taylor <iant@google.com>
3628
3629 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3630 when making a shared library.
3631
3632 2011-06-17 Ian Lance Taylor <iant@google.com>
3633
3634 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3635 parameter. Change all callers. Don't issue warning about PC32
3636 against locally defined symbol.
3637
3638 2011-06-16 Ian Lance Taylor <iant@google.com>
3639
3640 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3641 occurs in same object.
3642
3643 2011-06-14 Alan Modra <amodra@gmail.com>
3644
3645 * po/POTFILES.in: Regenerate.
3646
3647 2011-06-09 Ian Lance Taylor <iant@google.com>
3648
3649 * script-sections.cc
3650 (Orphan_output_section::set_section_addresses): For a relocatable
3651 link set address to 0.
3652
3653 2011-06-09 Cary Coutant <ccoutant@google.com>
3654
3655 PR gold/12804
3656 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3657 used with --compress-debug-sections.
3658 * gold/object.cc (Sized_relobj_file::do_layout): Report
3659 uncompressed size of compressed input sections.
3660
3661 2011-06-08 Cary Coutant <ccoutant@google.com>
3662
3663 PR gold/12804
3664 * testsuite/two_file_test_2_v1.cc: Change initialization of
3665 v2 to keep it in .data.
3666
3667 2011-06-07 Cary Coutant <ccoutant@google.com>
3668
3669 * common.cc (Symbol_table::do_allocate_commons_list): Call
3670 gold_fallback.
3671 * errors.cc (Errors::fatal): Adjust call to gold_exit.
3672 (Errors::fallback): New function.
3673 (gold_fallback): New function.
3674 * errors.h (Errors::fallback): New function.
3675 * gold.cc (gold_exit): Change status parameter to enum; adjust
3676 all callers.
3677 (queue_initial_tasks): Call gold_fallback.
3678 * gold.h: Include cstdlib.
3679 (Exit_status): New enum type.
3680 (gold_exit): Change status parameter to enum.
3681 (gold_fallback): New function.
3682 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3683 (Layout::create_symtab_sections): Likewise.
3684 (Layout::create_shdrs): Likewise.
3685 * main.cc (main): Adjust call to gold_exit.
3686 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3687 (Output_data_got::add_got_entry_pair): Likewise.
3688 (Output_section::add_input_section): Likewise.
3689 (Output_section::add_output_section_data): Likewise.
3690 (Output_segment::set_section_list_addresses): Likewise.
3691 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3692
3693 2011-06-07 Cary Coutant <ccoutant@google.com>
3694
3695 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3696 for incremental links.
3697 * output.cc (Output_segment::set_section_list_addresses): Remove
3698 FIXME and test for TLS or BSS.
3699
3700 2011-06-07 Cary Coutant <ccoutant@google.com>
3701
3702 * testsuite/Makefile.am: Add incremental_copy_test,
3703 incremental_common_test_1.
3704 * testsuite/Makefile.in: Regenerate.
3705 * testsuite/common_test_1_v1.c: New source file.
3706 * testsuite/common_test_1_v2.c: New source file.
3707 * testsuite/copy_test_v1.cc: New source file.
3708
3709 2011-06-07 Cary Coutant <ccoutant@google.com>
3710
3711 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3712 update, allocate common from bss section's free list.
3713 * incremental-dump.cc (dump_incremental_inputs): Print flag for
3714 linker-defined symbols.
3715 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3716 Skip GOT and PLT entries that are no longer referenced.
3717 (Output_section_incremental_inputs::write_info_blocks): Mark
3718 linker-defined symbols.
3719 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3720 * output.cc (Output_section::allocate): New function.
3721 * output.h (Output_section::allocate): New function.
3722 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3723 linker-defined symbols.
3724 (Symbol::override_base_with_special): Copy is_predefined_ flag.
3725 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3726 (Symbol::init_base_output_data): Likewise.
3727 (Symbol::init_base_output_segment): Likewise.
3728 (Symbol::init_base_constant): Likewise.
3729 (Sized_symbol::init_output_data): Likewise.
3730 (Sized_symbol::init_output_segment): Likewise.
3731 (Sized_symbol::init_constant): Likewise.
3732 (Symbol_table::do_define_in_output_data): Likewise.
3733 (Symbol_table::do_define_in_output_segment): Likewise.
3734 (Symbol_table::do_define_as_constant): Likewise.
3735 * symtab.h (Symbol::is_predefined): New function.
3736 (Symbol::init_base_output_data): Add is_predefined parameter.
3737 (Symbol::init_base_output_segment): Likewise.
3738 (Symbol::init_base_constant): Likewise.
3739 (Symbol::is_predefined_): New data member.
3740 (Sized_symbol::init_output_data): Add is_predefined parameter.
3741 (Sized_symbol::init_output_segment): Likewise.
3742 (Sized_symbol::init_constant): Likewise.
3743 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3744
3745 2011-06-07 Cary Coutant <ccoutant@google.com>
3746
3747 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3748 instead of emit_copy_reloc.
3749 (Copy_relocs::emit_copy_reloc): Refactor.
3750 (Copy_relocs::make_copy_reloc): New function.
3751 (Copy_relocs::add_copy_reloc): Remove.
3752 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3753 section.
3754 (Copy_relocs::make_copy_reloc): New function.
3755 (Copy_relocs::add_copy_reloc): Remove.
3756 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3757 unchanged input files.
3758 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3759 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3760 Reserve BSS space for COPY relocations.
3761 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3762 (Output_section_incremental_inputs::write_info_blocks): Record
3763 whether a symbol is copied from a shared object.
3764 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3765 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3766 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3767 (Incremental_input_entry_reader::get_output_symbol_index): Add
3768 is_copy parameter.
3769 (Incremental_binary::emit_copy_relocs): New function.
3770 (Incremental_binary::do_emit_copy_relocs): New function.
3771 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3772 new data member.
3773 (Sized_incremental_binary::add_copy_reloc): New function.
3774 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3775 (Sized_incremental_binary::Copy_reloc): New struct.
3776 (Sized_incremental_binary::Copy_relocs): New typedef.
3777 (Sized_incremental_binary::copy_relocs_): New data member.
3778 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3779 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3780 * target.h (Sized_target::emit_copy_reloc): New function.
3781 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3782
3783 2011-06-02 Cary Coutant <ccoutant@google.com>
3784
3785 PR gold/12163
3786 * gold/archive.cc (Archive::Archive): Initialize new data member.
3787 (Archive::include_all_members): Return if archive has already been
3788 included.
3789 * gold/archive.h (Archive::include_all_members_): New data member.
3790
3791 2011-06-02 Nick Clifton <nickc@redhat.com>
3792
3793 * dynobj.h: Fix spelling mistake in comment.
3794 * output.cc: Likewise.
3795
3796 2011-05-31 Doug Kwan <dougkwan@google.com>
3797 Asier Llano
3798
3799 PR gold/12826
3800 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3801 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3802 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
3803 redundant arm_exidx_test.so.
3804 * testsuite/Makefile.in: Regenerate.
3805 (check_SCRIPTS): Add pr12826.sh
3806 (check_DATA): Add pr12826.stdout
3807 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3808 * testsuite/pr12826.sh: New file.
3809 * testsuite/pr12826_1.s: Ditto.
3810 * testsuite/pr12826_1.s: Ditto.
3811
3812 2011-05-30 Ian Lance Taylor <iant@google.com>
3813
3814 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3815 sections.
3816
3817 2011-05-29 Ian Lance Taylor <iant@google.com>
3818
3819 PR gold/12804
3820 * testsuite/Makefile.am: Use different file name for two_file_test
3821 temporary file for each incremental test.
3822 * testsuite/Makefile.in: Rebuild.
3823
3824 2011-05-29 Ian Lance Taylor <iant@google.com>
3825
3826 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3827 binary input file is empty.
3828
3829 2011-05-27 Ian Lance Taylor <iant@google.com>
3830
3831 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3832 (ver_test_9.so): Likewise.
3833 * testsuite/Makefile.in: Rebuild.
3834
3835 2011-05-26 Cary Coutant <ccoutant@google.com>
3836
3837 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3838 * incremental.cc (Incremental_inputs::report_input_section): Fix
3839 comment, indentation.
3840 (Incremental_inputs::report_comdat_group): New function.
3841 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3842 of data for incremental input file entry.
3843 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3844 group count, COMDAT group signatures.
3845 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3846 an unchanged input file.
3847 * incremental.h (Incremental_object_entry::Incremental_object_entry):
3848 Initialize new data member.
3849 (Incremental_object_entry::add_comdat_group): New function.
3850 (Incremental_object_entry::get_comdat_group_count): New function.
3851 (Incremental_object_entry::get_comdat_signature_key): New function.
3852 (Incremental_object_entry::groups_): New data member.
3853 (Incremental_inputs::report_comdat_group): New function.
3854 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3855 data for incremental input file entry.
3856 (Incremental_input_entry_reader::get_comdat_group_count): New function.
3857 (Incremental_input_entry_reader::get_input_section): Adjust size of
3858 data for incremental input file entry.
3859 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3860 (Incremental_input_entry_reader::get_comdat_group_signature): New
3861 function.
3862 * object.cc (Sized_relobj::include_section_group): Report kept
3863 COMDAT groups for incremental links.
3864
3865 2011-05-24 David Meyer <pdox@google.com>
3866
3867 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3868 with name parameter. Add found_name parameter.
3869 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3870 * dirsearch.h (class Dirsearch): Update declaration.
3871
3872 2011-05-24 Ian Lance Taylor <iant@google.com>
3873
3874 * archive.cc (Library_base::should_include_member): Pull in object
3875 from archive if it defines the entry symbol.
3876 * parameters.cc (Parameters::entry): New function.
3877 * parameters.h (class Parameters): Declare entry.
3878 * output.h (class Output_file_header): Remove entry_ field.
3879 * output.cc (Output_file_header::Output_file_header): Remove entry
3880 parameter. Change all callers.
3881 (Output_file_header::entry): Use parameters->entry.
3882 * gold.cc (queue_middle_tasks): Likewise.
3883 * plugin.cc (Plugin_hook::run): Likewise.
3884
3885 2011-05-24 Cary Coutant <ccoutant@google.com>
3886
3887 * gold.cc (queue_initial_tasks): Pass incremental base filename
3888 to Output_file::open_base_file; don't print error message.
3889 * incremental-dump.cc (main): Adjust call to
3890 Output_file::open_for_modification.
3891 * incremental-dump.cc (main): Likewise.
3892 * incremental.cc (Incremental_inputs::report_command_line):
3893 Ignore --incremental-base option when comparing command lines.
3894 Ignore parameter when given as separate argument.
3895 * options.h (class General_options): Add --incremental-base.
3896 * output.cc (Output_file::Output_file):
3897 (Output_file::open_base_file): Add base_name and writable parameters;
3898 read base file into new file; print error message here.
3899 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3900 callers.
3901 * output.h (Output_file::open_for_modification): Rename to...
3902 (Output_file::open_base_file): ...this; add base_name and
3903 writable parameters; adjust all callers.
3904 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3905 callers.
3906 * testsuite/Makefile.am (incremental_test_4): Test
3907 --incremental-base.
3908 * testsuite/Makefile.in: Regenerate.
3909
3910 2011-05-24 Cary Coutant <ccoutant@google.com>
3911
3912 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3913 incremental_test_4.
3914 * testsuite/Makefile.in: Regenerate.
3915 * testsuite/two_file_test_1_v1.cc: New test source file.
3916 * testsuite/two_file_test_1b_v1.cc: New test source file.
3917 * testsuite/two_file_test_2_v1.cc: New test source file.
3918
3919 2011-05-24 Cary Coutant <ccoutant@google.com>
3920
3921 * dynobj.h (Dynobj::do_dynobj): New function.
3922 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3923 flag and soname for shared objects.
3924 * incremental.cc (Incremental_inputs::report_object): Make
3925 either Incremental_object_entry or Incremental_dynobj_entry; add
3926 soname to string table.
3927 (Incremental_inputs::report_input_section): Add assertion.
3928 (Output_section_incremental_inputs::set_final_data_size): Adjust
3929 type of input file entry for shared libraries; adjust size of
3930 shared library info entry.
3931 (Output_section_incremental_inputs::write_input_files): Write
3932 as_needed flag for shared libraries.
3933 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3934 of input file entry for shared libraries; write soname.
3935 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3936 soname from incremental info.
3937 * incremental.h (enum Incremental_input_flags): Add
3938 INCREMENTAL_INPUT_AS_NEEDED.
3939 (Incremental_input_entry::Incremental_input_entry): Initialize new
3940 data member.
3941 (Incremental_input_entry::set_as_needed): New function.
3942 (Incremental_input_entry::as_needed): New function.
3943 (Incremental_input_entry::do_dynobj_entry): New function.
3944 (Incremental_input_entry::as_needed_): New data member.
3945 (Incremental_object_entry::Incremental_object_entry): Don't check
3946 for shared library.
3947 (Incremental_object_entry::do_type): Likewise.
3948 (class Incremental_dynobj_entry): New class.
3949 (Incremental_input_entry_reader::as_needed): New function.
3950 (Incremental_input_entry_reader::get_soname): New function.
3951 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3952 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3953 size of shared library info entry.
3954 * layout.cc (Layout::finish_dynamic_section): Don't test for
3955 incremental link when adding DT_NEEDED entries.
3956 * object.h (Object::Object): Initialize new data member.
3957 (Object::dynobj): New function.
3958 (Object::set_as_needed): New function.
3959 (Object::as_needed): New function.
3960 (Object::do_dynobj): New function.
3961 (Object::as_needed_): New data member.
3962
3963 2011-05-24 Cary Coutant <ccoutant@google.com>
3964
3965 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3966 info; adjust display of GOT entries.
3967 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3968 vector of input objects; remove file_status_.
3969 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3970 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3971 got_plt reader; call target hooks to reserve GOT entries.
3972 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3973 of input file info header and GOT info entry.
3974 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3975 relocation info.
3976 (Got_plt_view_info::got_descriptor): Remove.
3977 (Got_plt_view_info::sym_index): New data member.
3978 (Got_plt_view_info::input_index): New data member.
3979 (Local_got_offset_visitor::visit): Write input file index.
3980 (Global_got_offset_visitor::visit): Write 0 for input file index.
3981 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3982 with sym_index and input_index.
3983 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3984 incremental info GOT entry; replace got_descriptor with input_index.
3985 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3986 map from input file index to object.
3987 (Sized_relobj_incr::do_layout): Replace direct data member reference
3988 with accessor function.
3989 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3990 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3991 Adjust size of input file info header.
3992 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3993 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3994 (Incremental_input_entry_reader::get_input_section): Adjust size of
3995 input file info header.
3996 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3997 of incremental info GOT entry.
3998 (Incremental_got_plt_reader::get_got_desc): Remove.
3999 (Incremental_got_plt_reader::get_got_symndx): New function.
4000 (Incremental_got_plt_reader::get_got_input_index): New function.
4001 (Sized_incremental_binary::Sized_incremental_binary): Remove
4002 file_status_; add input_objects_.
4003 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4004 (Sized_incremental_binary::set_file_is_unchanged): Remove.
4005 (Sized_incremental_binary::file_is_unchanged): Remove.
4006 (Sized_incremental_binary::set_input_object): New function.
4007 (Sized_incremental_binary::input_object): New function.
4008 (Sized_incremental_binary::file_status_): Remove.
4009 (Sized_incremental_binary::input_objects_): New data member.
4010 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4011 references.
4012 (Sized_relobj_incr::invalid_address): Move to base class.
4013 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4014 class.
4015 (Sized_relobj_incr::do_output_section_offset): Likewise.
4016 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4017 (Sized_relobj_incr::section_offsets_): Likewise.
4018 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4019 function.
4020 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4021 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4022 with accessor function.
4023 (Sized_relobj_file::do_layout): Likewise.
4024 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4025 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4026 (Sized_relobj_file::compute_final_local_value): Replace refs to
4027 section_offsets_ with accessor function.
4028 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4029 * object.h (Relobj::Relobj): Initialize new data members.
4030 (Relobj::add_dyn_reloc): New function.
4031 (Relobj::first_dyn_reloc): New function.
4032 (Relobj::dyn_reloc_count): New function.
4033 (Relobj::first_dyn_reloc_): New data member.
4034 (Relobj::dyn_reloc_count_): New data member.
4035 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4036 references.
4037 (Sized_relobj::Address): New typedef.
4038 (Sized_relobj::invalid_address): Move here from child class.
4039 (Sized_relobj::Sized_relobj): Initialize new data members.
4040 (Sized_relobj::sized_relobj): New function.
4041 (Sized_relobj::is_output_section_offset_invalid): Move here from
4042 child class.
4043 (Sized_relobj::get_output_section_offset): Likewise.
4044 (Sized_relobj::local_has_got_offset): Likewise.
4045 (Sized_relobj::local_got_offset): Likewise.
4046 (Sized_relobj::set_local_got_offset): Likewise.
4047 (Sized_relobj::do_for_all_local_got_entries): Likewise.
4048 (Sized_relobj::clear_got_offsets): New function.
4049 (Sized_relobj::section_offsets): Move here from child class.
4050 (Sized_relobj::do_output_section_offset): Likewise.
4051 (Sized_relobj::do_set_section_offset): Likewise.
4052 (Sized_relobj::Local_got_offsets): Likewise.
4053 (Sized_relobj::local_got_offsets_): Likewise.
4054 (Sized_relobj::section_offsets_): Likewise.
4055 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4056 references.
4057 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4058 class.
4059 (Sized_relobj_file::sized_relobj): New function
4060 (Sized_relobj_file::local_has_got_offset): Move to base class.
4061 (Sized_relobj_file::local_got_offset): Likewise.
4062 (Sized_relobj_file::set_local_got_offset): Likewise.
4063 (Sized_relobj_file::get_output_section_offset): Likewise.
4064 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4065 (Sized_relobj_file::do_output_section_offset): Likewise.
4066 (Sized_relobj_file::do_set_section_offset): Likewise.
4067 (Sized_relobj_file::Local_got_offsets): Likewise.
4068 (Sized_relobj_file::local_got_offsets_): Likewise.
4069 (Sized_relobj_file::section_offsets_): Likewise.
4070 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4071 (all constructors).
4072 (set_needs_dynsym_index): Convert relobj to derived class pointer.
4073 (Output_reloc::get_symbol_index): Likewise.
4074 (Output_reloc::local_section_offset): Likewise.
4075 (Output_reloc::get_address): Likewise.
4076 (Output_reloc::symbol_value): Likewise.
4077 (Output_data_got::reserve_slot): Move to class definition.
4078 (Output_data_got::reserve_local): New function.
4079 (Output_data_got::reserve_slot_for_global): Remove.
4080 (Output_data_got::reserve_global): New function.
4081 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4082 (all constructors, two instantiations).
4083 (Output_reloc::get_relobj): New function (two instantiations).
4084 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4085 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4086 (Output_data_reloc::add_global): Adjust type of relobj.
4087 (Output_data_reloc::add_global_relative): Likewise.
4088 (Output_data_reloc::add_symbolless_global_addend): Likewise.
4089 (Output_data_reloc::add_local): Likewise.
4090 (Output_data_reloc::add_local_relative): Likewise.
4091 (Output_data_reloc::add_symbolless_local_addend): Likewise.
4092 (Output_data_reloc::add_local_section): Likewise.
4093 (Output_data_reloc::add_output_section): Likewise.
4094 (Output_data_reloc::add_absolute): Likewise.
4095 (Output_data_reloc::add_target_specific): Likewise.
4096 (Output_data_got::reserve_slot): Move definition here.
4097 (Output_data_got::reserve_local): New function.
4098 (Output_data_got::reserve_global): New function.
4099 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4100 section_offsets_ with accessor function.
4101 (Sized_relobj_file::write_sections): Likewise.
4102 (Sized_relobj_file::do_relocate_sections): Likewise.
4103 * target.h (Sized_target::reserve_local_got_entry): New function.
4104 (Sized_target::reserve_global_got_entry): New function.
4105 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4106 (Target_x86_64::reserve_global_got_entry): New function.
4107 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4108
4109 2011-05-23 Cary Coutant <ccoutant@google.com>
4110
4111 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4112 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4113 bit when checking got_type.
4114 * incremental.cc (Sized_incremental_binary::setup_readers):
4115 Store symbol table and string table locations; initialize bit vector
4116 of file status flags.
4117 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4118 unchanged files.
4119 (Sized_incremental_binary::do_process_got_plt): New function.
4120 (Sized_incremental_binary::get_symtab_view): Use stored locations.
4121 (Output_section_incremental_inputs::set_final_data_size): Record
4122 file index for each input file.
4123 (Output_section_incremental_inputs::write_got_plt): Store file index
4124 instead of input entry offset for each GOT entry.
4125 * incremental.h
4126 (Incremental_input_entry::Incremental_input_entry): Initialize new
4127 data member.
4128 (Incremental_input_entry::set_offset): Store file index.
4129 (Incremental_input_entry::get_file_index): New function.
4130 (Incremental_input_entry::file_index_): New data member.
4131 (Incremental_binary::process_got_plt): New function.
4132 (Incremental_binary::do_process_got_plt): New function.
4133 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4134 data members.
4135 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4136 (Sized_incremental_binary::set_file_is_unchanged): New function.
4137 (Sized_incremental_binary::file_is_unchanged): New function.
4138 (Sized_incremental_binary::do_process_got_plt): New function.
4139 (Sized_incremental_binary::file_status_): New data member.
4140 (Sized_incremental_binary::main_symtab_loc_): New data member.
4141 (Sized_incremental_binary::main_strtab_loc_): New data member.
4142 * output.cc (Output_data_got::Got_entry::write): Add case
4143 RESERVED_CODE.
4144 (Output_data_got::add_global): Call add_got_entry.
4145 (Output_data_got::add_global_plt): Likewise.
4146 (Output_data_got::add_global_with_rel): Likewise.
4147 (Output_data_got::add_global_with_rela): Likewise.
4148 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4149 (Output_data_got::add_global_pair_with_rela): Likewise.
4150 (Output_data_got::add_local): Call add_got_entry.
4151 (Output_data_got::add_local_plt): Likewise.
4152 (Output_data_got::add_local_with_rel): Likewise.
4153 (Output_data_got::add_local_with_rela): Likewise.
4154 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4155 (Output_data_got::add_local_pair_with_rela): Likewise.
4156 (Output_data_got::reserve_slot): New function.
4157 (Output_data_got::reserve_slot_for_global): New function.
4158 (Output_data_got::add_got_entry): New function.
4159 (Output_data_got::add_got_entry_pair): New function.
4160 (Output_section::add_output_section_data): Edit FIXME.
4161 * output.h
4162 (Output_section_data_build::Output_section_data_build): New
4163 constructor with size parameter.
4164 (Output_data_space::Output_data_space): Likewise.
4165 (Output_data_got::Output_data_got): Initialize new data member; new
4166 constructor with size parameter.
4167 (Output_data_got::add_constant): Call add_got_entry.
4168 (Output_data_got::reserve_slot): New function.
4169 (Output_data_got::reserve_slot_for_global): New function.
4170 (class Output_data_got::Got_entry): Add RESERVED_CODE.
4171 (Output_data_got::add_got_entry): New function.
4172 (Output_data_got::add_got_entry_pair): New function.
4173 (Output_data_got::free_list_): New data member.
4174 * target.h (Sized_target::init_got_plt_for_update): New function.
4175 (Sized_target::register_global_plt_entry): New function.
4176 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4177 Initialize new data member; call init; add constructor with PLT count.
4178 (Output_data_plt_x86_64::init): New function.
4179 (Output_data_plt_x86_64::add_relocation): New function.
4180 (Output_data_plt_x86_64::reserve_slot): New function.
4181 (Output_data_plt_x86_64::free_list_): New data member.
4182 (Target_x86_64::init_got_plt_for_update): New function.
4183 (Target_x86_64::register_global_plt_entry): New function.
4184 (Output_data_plt_x86_64::add_entry): Allocate from free list for
4185 incremental updates.
4186 (Output_data_plt_x86_64::add_relocation): New function.
4187 * testsuite/object_unittest.cc (Object_test): Set default options.
4188
4189 2011-05-16 Ian Lance Taylor <iant@google.com>
4190
4191 * options.h (class General_options): Make -i a synonym for -r.
4192
4193 2011-05-16 Ian Lance Taylor <iant@google.com>
4194
4195 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4196
4197 2011-05-10 Cary Coutant <ccoutant@google.com>
4198
4199 * object.cc (Sized_relobj::do_count_local_symbols): Check for
4200 strip_all (-s).
4201
4202 2011-05-06 Ian Lance Taylor <iant@google.com>
4203
4204 * layout.cc (Layout::layout): If the output section flags change,
4205 update the ordering.
4206
4207 2011-04-25 Cary Coutant <ccoutant@google.com>
4208
4209 * incremental-dump.cc (dump_incremental_inputs): Print local
4210 symbol info for each input file.
4211 * incremental.cc
4212 (Output_section_incremental_inputs::set_final_data_size): Add local
4213 symbol info to input file entries in incremental info.
4214 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4215 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4216 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4217 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4218 implementation.
4219 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4220 (Sized_incr_relobj::do_relocate): Write the local symbols.
4221 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4222 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4223 Adjust size of input file header.
4224 (Incremental_inputs_reader::get_local_symbol_offset): New function.
4225 (Incremental_inputs_reader::get_local_symbol_count): New function.
4226 (Incremental_inputs_reader::get_input_section): Adjust size of input
4227 file header.
4228 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4229 (Sized_incr_relobj::This): New typedef.
4230 (Sized_incr_relobj::sym_size): New const data member.
4231 (Sized_incr_relobj::Local_symbol): New struct.
4232 (Sized_incr_relobj::do_output_local_symbol_count): New function.
4233 (Sized_incr_relobj::do_local_symbol_offset): New function.
4234 (Sized_incr_relobj::local_symbol_count_): New data member.
4235 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4236 (Sized_incr_relobj::local_symbol_index_): New data member.
4237 (Sized_incr_relobj::local_symbol_offset_): New data member.
4238 (Sized_incr_relobj::local_dynsym_offset_): New data member.
4239 (Sized_incr_relobj::local_symbols_): New data member.
4240 * object.h (Relobj::output_local_symbol_count): New function.
4241 (Relobj::local_symbol_offset): New function.
4242 (Relobj::do_output_local_symbol_count): New function.
4243 (Relobj::do_local_symbol_offset): New function.
4244 (Sized_relobj::do_output_local_symbol_count): New function.
4245 (Sized_relobj::do_local_symbol_offset): New function.
4246
4247 2011-04-22 Vladimir Simonov <sv@sw.ru>
4248
4249 * descriptors.cc (set_close_on_exec): New function.
4250 (Descriptors::open): Use set_close_on_exec.
4251 * output.cc (S_ISLNK): Define if not defined.
4252
4253 2011-04-22 Cary Coutant <ccoutant@google.com>
4254
4255 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4256 global symbol map.
4257 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4258 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4259 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4260 relocations.
4261 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4262 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4263 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4264 * incremental.h
4265 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4266 function.
4267 (Incremental_binary::apply_incremental_relocs): New function.
4268 (Incremental_binary::do_apply_incremental_relocs): New function.
4269 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4270 data member.
4271 (Sized_incremental_binary::add_global_symbol): New function.
4272 (Sized_incremental_binary::global_symbol): New function.
4273 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4274 (Sized_incremental_binary::symbol_map_): New data member.
4275 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4276 * target.h (Sized_target::apply_relocation): New function.
4277 * target-reloc.h (apply_relocation): New function.
4278 * x86_64.cc (Target_x86_64::apply_relocation): New function.
4279
4280 2011-04-22 Doug Kwan <dougkwan@google.com>
4281
4282 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4283 flag of a SHT_ARM_EXIDX section.
4284 * testsuite/Makefile.am (arm_exidx_test): New test rules.
4285 * testsuite/Makefile.in: Regenerate.
4286 * testsuite/arm_exidx_test.s: New file.
4287 * testsuite/arm_exidx_test.sh: Same.
4288
4289 2011-04-20 Cary Coutant <ccoutant@google.com>
4290
4291 PR gold/12689
4292 * archive.h (Incremental_archive_entry::Archive_member):
4293 Initialize arg_serial_ (second constructor).
4294
4295 2011-04-17 Ian Lance Taylor <iant@google.com>
4296
4297 * object.cc (Relocate_info::location): Simplify location string.
4298 * errors.cc (Errors::error_at_location): Don't print program
4299 name.
4300 (Errors::warning_at_location): Likewise.
4301 (Errors::undefined_symbol): Likewise.
4302 * testsuite/debug_msg.sh: Update accordingly.
4303
4304 2011-04-14 Cary Coutant <ccoutant@google.com>
4305
4306 * gold/layout.cc (Layout::symtab_section_offset): New function.
4307 * gold/layout.h (Layout::symtab_section_offset): New function.
4308 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4309
4310 2011-04-12 Ian Lance Taylor <iant@google.com>
4311
4312 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
4313 with MREMAP_MAYMOVE.
4314 * output.h (class Output_file): Add map_is_allocated_ field.
4315 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
4316 not available, provide stubs. If mremap is not available, #define
4317 it to gold_mremap.
4318 (MREMAP_MAYMOVE): Define if not defined.
4319 (Output_file::Output_file): Initialize map_is_allocated_.
4320 (Output_file::resize): Check map_is_allocated_.
4321 (Output_file::map_anonymous): If mmap fails, use malloc.
4322 (Output_file::unmap): Don't do anything for an anonymous map.
4323 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
4324 is not available, provide stubs.
4325 (File_read::View::~View): Use free rather than delete[].
4326 (File_read::make_view): Use malloc rather than new[]. If mmap
4327 fails, use malloc.
4328 (File_read::find_or_make_view): Use malloc rather than new[].
4329 * gold.h: Remove HAVE_REMAP code.
4330 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
4331 exists. Rename mremap to gold_mremap. If mmap is not available
4332 don't do anything.
4333 * configure, config.in: Rebuild.
4334
4335 2011-04-11 Ian Lance Taylor <iant@google.com>
4336
4337 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4338 initialize local variable v.
4339
4340 2011-04-11 Cary Coutant <ccoutant@google.com>
4341
4342 * archive.cc (Archive::include_member): Adjust call to
4343 report_object.
4344 (Add_archive_symbols::run): Track argument serial numbers.
4345 (Lib_group::include_member): Likewise.
4346 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4347 * archive.h (Incremental_archive_entry::Archive_member):
4348 Initialize arg_serial_.
4349 (Archive_member::arg_serial_): New data member.
4350 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4351 (Sized_dynobj::do_add_symbols): Track symbols when doing an
4352 incremental link.
4353 (Sized_dynobj::do_for_all_local_got_entries): New function.
4354 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4355 function.
4356 * fileread.cc (get_mtime): New function.
4357 * fileread.h (get_mtime): New function.
4358 * gold.cc (queue_initial_tasks): Check for incremental update.
4359 (process_incremental_input): New function.
4360 (queue_middle_tasks): Don't force valid target for incremental
4361 update.
4362 * incremental-dump.cc (find_input_containing_global): Adjust
4363 size of symbol info entry.
4364 (dump_incremental_inputs): Dump argument serial number and
4365 in_system_directory flag; bias shndx by 1; print symbol names
4366 when dumping per-file symbol lists; use new symbol info readers.
4367 * incremental.cc
4368 (Output_section_incremental_inputs:update_data_size): New function.
4369 (Sized_incremental_binary::setup_readers): Setup input readers
4370 for each input file; build maps for files added from libraries
4371 and scripts.
4372 (Sized_incremental_binary::check_input_args): New function.
4373 (Sized_incremental_binary::do_check_inputs): Build map of argument
4374 serial numbers to input arguments.
4375 (Sized_incremental_binary::do_file_has_changed): Rename
4376 do_file_is_unchanged to this; compare file modification times.
4377 (Sized_incremental_binary::do_init_layout): New function.
4378 (Sized_incremental_binary::do_reserve_layout): New function.
4379 (Sized_incremental_binary::do_get_input_reader): Remove.
4380 (Sized_incremental_binary::get_symtab_view): New function.
4381 (Incremental_checker::can_incrementally_link_output_file): Remove.
4382 (Incremental_inputs::report_command_line): Exclude --debug options.
4383 (Incremental_inputs::report_archive_begin): Add parameter; track
4384 argument serial numbers; don't put input file entry for archive
4385 before archive members.
4386 (Incremental_inputs::report_archive_end): Put input file entry
4387 for archive after archive members.
4388 (Incremental_inputs::report_object): Add parameter; track argument
4389 serial numbers and in_system_directory flag.
4390 (Incremental_inputs::report_script): Add parameter; track argument
4391 serial numbers.
4392 (Output_section_incremental_inputs::set_final_data_size): Adjust
4393 size of symbol info entry; check for forwarding symbols.
4394 (Output_section_incremental_inputs::write_input_files): Write
4395 in_system_directory flag and argument serial number.
4396 (Output_section_incremental_inputs::write_info_blocks): Map section
4397 indices between incremental info and original input file; store
4398 input section index for each symbol.
4399 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4400 change operator() to visit().
4401 (class Global_got_offset_visitor): Likewise.
4402 (class Global_symbol_visitor_got_plt):
4403 (Output_section_incremental_inputs::write_got_plt): Use new visitor
4404 classes.
4405 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4406 (Sized_incr_relobj::do_read_symbols): New function.
4407 (Sized_incr_relobj::do_layout): New function.
4408 (Sized_incr_relobj::do_layout_deferred_sections): New function.
4409 (Sized_incr_relobj::do_add_symbols): New function.
4410 (Sized_incr_relobj::do_should_include_member): New function.
4411 (Sized_incr_relobj::do_for_all_global_symbols): New function.
4412 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4413 (Sized_incr_relobj::do_section_size): New function.
4414 (Sized_incr_relobj::do_section_name): New function.
4415 (Sized_incr_relobj::do_section_contents): New function.
4416 (Sized_incr_relobj::do_section_flags): New function.
4417 (Sized_incr_relobj::do_section_entsize): New function.
4418 (Sized_incr_relobj::do_section_address): New function.
4419 (Sized_incr_relobj::do_section_type): New function.
4420 (Sized_incr_relobj::do_section_link): New function.
4421 (Sized_incr_relobj::do_section_info): New function.
4422 (Sized_incr_relobj::do_section_addralign): New function.
4423 (Sized_incr_relobj::do_initialize_xindex): New function.
4424 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4425 (Sized_incr_relobj::do_read_relocs): New function.
4426 (Sized_incr_relobj::do_gc_process_relocs): New function.
4427 (Sized_incr_relobj::do_scan_relocs): New function.
4428 (Sized_incr_relobj::do_count_local_symbols): New function.
4429 (Sized_incr_relobj::do_finalize_local_symbols): New function.
4430 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4431 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4432 (Sized_incr_relobj::do_relocate): New function.
4433 (Sized_incr_relobj::do_set_section_offset): New function.
4434 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4435 (Sized_incr_dynobj::do_read_symbols): New function.
4436 (Sized_incr_dynobj::do_layout): New function.
4437 (Sized_incr_dynobj::do_add_symbols): New function.
4438 (Sized_incr_dynobj::do_should_include_member): New function.
4439 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4440 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4441 (Sized_incr_dynobj::do_section_size): New function.
4442 (Sized_incr_dynobj::do_section_name): New function.
4443 (Sized_incr_dynobj::do_section_contents): New function.
4444 (Sized_incr_dynobj::do_section_flags): New function.
4445 (Sized_incr_dynobj::do_section_entsize): New function.
4446 (Sized_incr_dynobj::do_section_address): New function.
4447 (Sized_incr_dynobj::do_section_type): New function.
4448 (Sized_incr_dynobj::do_section_link): New function.
4449 (Sized_incr_dynobj::do_section_info): New function.
4450 (Sized_incr_dynobj::do_section_addralign): New function.
4451 (Sized_incr_dynobj::do_initialize_xindex): New function.
4452 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4453 (make_sized_incremental_object): New function.
4454 (Incremental_library::copy_unused_symbols): New function.
4455 (Incremental_library::do_for_all_unused_symbols): New function.
4456 * incremental.h (enum Incremental_input_flags): New type.
4457 (class Incremental_checker): Remove.
4458 (Incremental_input_entry::Incremental_input_entry): Add argument
4459 serial number.
4460 (Incremental_input_entry::arg_serial): New function.
4461 (Incremental_input_entry::set_is_in_system_directory): New function.
4462 (Incremental_input_entry::is_in_system_directory): New function.
4463 (Incremental_input_entry::arg_serial_): New data member.
4464 (Incremental_input_entry::is_in_system_directory_): New data member.
4465 (class Script_info): Move here from script.h.
4466 (Script_info::Script_info): Add filename parameter.
4467 (Script_info::filename): New function.
4468 (Script_info::filename_): New data member.
4469 (Incremental_script_entry::Incremental_script_entry): Add argument
4470 serial number.
4471 (Incremental_object_entry::Incremental_object_entry): Likewise.
4472 (Incremental_object_entry::add_input_section): Build list of input
4473 sections with map to original shndx.
4474 (Incremental_object_entry::get_input_section_index): New function.
4475 (Incremental_object_entry::shndx_): New data member.
4476 (Incremental_object_entry::name_key_): Rename; adjust all refs.
4477 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4478 (Incremental_archive_entry::Incremental_archive_entry): Add argument
4479 serial number.
4480 (Incremental_inputs::report_archive_begin): Likewise.
4481 (Incremental_inputs::report_object): Likewise.
4482 (Incremental_inputs::report_script): Likewise.
4483 (class Incremental_global_symbol_reader): New class.
4484 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4485 and store flags and input file type.
4486 (Incremental_input_entry_reader::arg_serial): New function.
4487 (Incremental_input_entry_reader::type): Extract type from flags.
4488 (Incremental_input_entry_reader::is_in_system_directory): New function.
4489 (Incremental_input_entry_reader::get_input_section_count): Call
4490 accessor function for type.
4491 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4492 function for type; adjust size of global symbol entry.
4493 (Incremental_input_entry_reader::get_global_symbol_count): Call
4494 accessor function for type.
4495 (Incremental_input_entry_reader::get_object_count): Likewise.
4496 (Incremental_input_entry_reader::get_object_offset): Likewise.
4497 (Incremental_input_entry_reader::get_member_count): Likewise.
4498 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4499 (Incremental_input_entry_reader::get_member_offset): Likewise.
4500 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4501 (Incremental_input_entry_reader::Global_symbol_info): Remove.
4502 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4503 (Incremental_input_entry_reader::get_global_symbol_reader): New
4504 function.
4505 (Incremental_input_entry_reader::get_output_symbol_index): New
4506 function.
4507 (Incremental_input_entry_reader::type_): Remove.
4508 (Incremental_input_entry_reader::flags_): New data member.
4509 (Incremental_inputs_reader::input_file_offset): New function.
4510 (Incremental_inputs_reader::input_file_index): New function.
4511 (Incremental_inputs_reader::input_file): Call input_file_offset.
4512 (Incremental_inputs_reader::input_file_at_offset): New function.
4513 (Incremental_relocs_reader::get_r_type): Reformat.
4514 (Incremental_relocs_reader::get_r_shndx): Reformat.
4515 (Incremental_relocs_reader::get_r_offset): Reformat.
4516 (Incremental_relocs_reader::data): New function.
4517 (Incremental_binary::Incremental_binary): Initialize new data members.
4518 (Incremental_binary::check_inputs): Add cmdline parameter.
4519 (Incremental_binary::file_is_unchanged): Remove.
4520 (Input_reader::arg_serial): New function.
4521 (Input_reader::get_unused_symbol_count): New function.
4522 (Input_reader::get_unused_symbol): New function.
4523 (Input_reader::do_arg_serial): New function.
4524 (Input_reader::do_get_unused_symbol_count): New function.
4525 (Input_reader::do_get_unused_symbol): New function.
4526 (Incremental_binary::input_file_count): New function.
4527 (Incremental_binary::get_input_reader): Change signature to use
4528 index instead of filename.
4529 (Incremental_binary::file_has_changed): New function.
4530 (Incremental_binary::get_input_argument): New function.
4531 (Incremental_binary::get_library): New function.
4532 (Incremental_binary::get_script_info): New function.
4533 (Incremental_binary::init_layout): New function.
4534 (Incremental_binary::reserve_layout): New function.
4535 (Incremental_binary::output_file): New function.
4536 (Incremental_binary::do_check_inputs): New function.
4537 (Incremental_binary::do_file_is_unchanged): Remove.
4538 (Incremental_binary::do_file_has_changed): New function.
4539 (Incremental_binary::do_init_layout): New function.
4540 (Incremental_binary::do_reserve_layout): New function.
4541 (Incremental_binary::do_input_file_count): New function.
4542 (Incremental_binary::do_get_input_reader): Change signature.
4543 (Incremental_binary::input_args_map_): New data member.
4544 (Incremental_binary::library_map_): New data member.
4545 (Incremental_binary::script_map_): New data member.
4546 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4547 new data members.
4548 (Sized_incremental_binary::output_section): New function.
4549 (Sized_incremental_binary::inputs_reader): Add const.
4550 (Sized_incremental_binary::symtab_reader): Add const.
4551 (Sized_incremental_binary::relocs_reader): Add const.
4552 (Sized_incremental_binary::got_plt_reader): Add const.
4553 (Sized_incremental_binary::get_symtab_view): New function.
4554 (Sized_incremental_binary::Inputs_reader): New typedef.
4555 (Sized_incremental_binary::Input_entry_reader): New typedef.
4556 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4557 (Sized_incremental_binary::do_file_is_unchanged): Remove.
4558 (Sized_incremental_binary::do_file_has_changed): New function.
4559 (Sized_incremental_binary::do_init_layout): New function.
4560 (Sized_incremental_binary::do_reserve_layout): New function.
4561 (Sized_input_reader::Inputs_reader): Remove.
4562 (Sized_input_reader::Input_entry_reader): Remove.
4563 (Sized_input_reader::do_arg_serial): New function.
4564 (Sized_input_reader::do_get_unused_symbol_count): New function.
4565 (Sized_input_reader::do_get_unused_symbol): New function.
4566 (Sized_incremental_binary::do_input_file_count): New function.
4567 (Sized_incremental_binary::do_get_input_reader): Change signature;
4568 use index instead of filename.
4569 (Sized_incremental_binary::section_map_): New data member.
4570 (Sized_incremental_binary::input_entry_readers_): New data member.
4571 (class Sized_incr_relobj): New class.
4572 (class Sized_incr_dynobj): New class.
4573 (make_sized_incremental_object): New function.
4574 (class Incremental_library): New class.
4575 * layout.cc (Free_list::num_lists): New static data member.
4576 (Free_list::num_nodes): New static data member.
4577 (Free_list::num_removes): New static data member.
4578 (Free_list::num_remove_visits): New static data member.
4579 (Free_list::num_allocates): New static data member.
4580 (Free_list::num_allocate_visits): New static data member.
4581 (Free_list::init): New function.
4582 (Free_list::remove): New function.
4583 (Free_list::allocate): New function.
4584 (Free_list::dump): New function.
4585 (Free_list::print_stats): New function.
4586 (Layout_task_runner::run): Resize output file for incremental updates.
4587 (Layout::Layout): Initialize new data members.
4588 (Layout::set_incremental_base): New function.
4589 (Layout::init_fixed_output_section): New function.
4590 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4591 incremental updates.
4592 (Layout::create_gold_note): Do not create gold note section for
4593 incremental updates.
4594 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4595 for incremental updates.
4596 (Layout::set_section_offsets): For incremental updates, allocate space
4597 from free list.
4598 (Layout::create_symtab_sections): Layout with offsets relative to
4599 start of section; for incremental updates, allocate space from free
4600 list.
4601 (Layout::create_shdrs): For incremental updates, allocate space from
4602 free list.
4603 (Layout::finish_dynamic_section): For incremental updates, do not
4604 check --as-needed (fixed in subsequent patch).
4605 * layout.h (class Free_list): New class.
4606 (Layout::set_incremental_base): New function.
4607 (Layout::incremental_base): New function.
4608 (Layout::init_fixed_output_section): New function.
4609 (Layout::allocate): New function.
4610 (Layout::incremental_base_): New data member.
4611 (Layout::free_list_): New data member.
4612 * main.cc (main): Print Free_list statistics.
4613 * object.cc (Relobj::finalize_incremental_relocs): Add
4614 clear_counts parameter; clear counts only when clear_counts is set.
4615 (Sized_relobj::Sized_relobj): Initialize new base class.
4616 (Sized_relobj::do_layout): Don't report special sections.
4617 (Sized_relobj::do_for_all_local_got_entries): New function.
4618 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4619 symtab_off to all symbol table offsets.
4620 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4621 * object.h (class Got_offset_list): Move to top of file.
4622 (Object::Object): Allow case where input_file == NULL.
4623 (Object::~Object): Likewise.
4624 (Object::input_file): Assert that input_file != NULL.
4625 (Object::lock): Allow case where input_file == NULL.
4626 (Object::unlock): Likewise.
4627 (Object::is_locked): Likewise.
4628 (Object::token): Likewise.
4629 (Object::release): Likewise.
4630 (Object::is_incremental): New function.
4631 (Object::get_mtime): New function.
4632 (Object::for_all_local_got_entries): New function.
4633 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4634 (Object::set_is_in_system_directory): New function.
4635 (Object::is_in_system_directory): New function.
4636 (Object::do_is_incremental): New function.
4637 (Object::do_get_mtime): New function.
4638 (Object::do_for_all_local_got_entries): New function.
4639 (Object::is_in_system_directory_): New data member.
4640 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4641 (class Sized_relobj_base): New class.
4642 (class Sized_relobj): Derive from Sized_relobj_base.
4643 (class Sized_relobj::Symbols): Redeclare from base class.
4644 (class Sized_relobj::local_got_offset_list): Remove.
4645 (class Sized_relobj::Output_sections): Redeclare from base class.
4646 (class Sized_relobj::do_for_all_local_got_entries): New function.
4647 (class Sized_relobj::write_local_symbols): Add offset parameter.
4648 (class Sized_relobj::local_symbol_offset_): Update comment.
4649 (class Sized_relobj::local_dynsym_offset_): Update comment.
4650 * options.cc (Input_arguments::add_file): Remove const.
4651 * options.h (Input_file_argument::Input_file_argument):
4652 Initialize arg_serial_ (all constructors).
4653 (Input_file_argument::set_arg_serial): New function.
4654 (Input_file_argument::arg_serial): New function.
4655 (Input_file_argument::arg_serial_): New data member.
4656 (Input_arguments::Input_arguments): Initialize file_count_.
4657 (Input_arguments::add_file): Remove const.
4658 (Input_arguments::number_of_input_files): New function.
4659 (Input_arguments::file_count_): New data member.
4660 (Command_line::number_of_input_files): Call
4661 Input_arguments::number_of_input_files.
4662 * output.cc (Output_segment_headers::Output_segment_headers):
4663 Set current size.
4664 (Output_section::Input_section::current_data_size): New function.
4665 (Output_section::Output_section): Initialize new data members.
4666 (Output_section::add_input_section): Don't do merge sections for
4667 an incremental link; allocate space from free list for an
4668 incremental update.
4669 (Output_section::add_output_section_data): Allocate space from
4670 free list for an incremental update.
4671 (Output_section::update_data_size): New function.
4672 (Output_section::set_fixed_layout): New function.
4673 (Output_section::reserve): New function.
4674 (Output_segment::set_section_addresses): Remove const.
4675 (Output_segment::set_section_list_addresses): Remove const; allocate
4676 space from free list for an incremental update.
4677 (Output_segment::set_offset): Adjust size of RELRO segment for an
4678 incremental update.
4679 * output.h (Output_data::current_data_size): Move here from
4680 child classes.
4681 (Output_data::pre_finalize_data_size): New function.
4682 (Output_data::update_data_size): New function.
4683 (Output_section_headers::update_data_size): new function.
4684 (Output_section_data_build::current_data_size): Move to Output_data.
4685 (Output_data_strtab::update_data_size): New function.
4686 (Output_section::current_data_size): Move to Output_data.
4687 (Output_section::set_fixed_layout): New function.
4688 (Output_section::has_fixed_layout): New function.
4689 (Output_section::reserve): New function.
4690 (Output_section::update_data_size): New function.
4691 (Output_section::has_fixed_layout_): New data member.
4692 (Output_section::free_list_): New data member.
4693 (Output_segment::set_section_addresses): Remove const.
4694 (Output_segment::set_section_list_addresses): Remove const.
4695 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4696 New function.
4697 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4698 New function.
4699 * readsyms.cc (Read_symbols::do_read_symbols): Add library
4700 parameter when calling Add_symbols constructor; store argument
4701 serial number for members of a lib group.
4702 (Add_symbols::locks): Allow case where token == NULL.
4703 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4704 (Read_member::~Read_member): New function.
4705 (Read_member::is_runnable): New function.
4706 (Read_member::locks): New function.
4707 (Read_member::run): New function.
4708 (Check_script::~Check_script): New function.
4709 (Check_script::is_runnable): New function.
4710 (Check_script::locks): New function.
4711 (Check_script::run): New function.
4712 (Check_library::~Check_library): New function.
4713 (Check_library::is_runnable): New function.
4714 (Check_library::locks): New function.
4715 (Check_library::run): New function.
4716 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4717 (Add_symbols::library_): New data member.
4718 (class Read_member): New class.
4719 (class Check_script): New class.
4720 (class Check_library): New class.
4721 * reloc.cc (Read_relocs::is_runnable): Allow case where
4722 token == NULL.
4723 (Read_relocs::locks): Likewise.
4724 (Scan_relocs::locks): Likewise.
4725 (Relocate_task::locks): Likewise.
4726 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4727 to clear counters.
4728 (Sized_relobj::incremental_relocs_scan): Fix comment.
4729 (Sized_relobj::do_relocate): Pass output file offset to
4730 write_local_symbols.
4731 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4732 from class declaration.
4733 * script.cc (read_input_script): Allocate Script_info; pass
4734 argument serial number to report_script.
4735 * script.h (class Script_info): Move to incremental.h.
4736 * symtab.cc (Symbol_table::add_from_incrobj): New function.
4737 * symtab.h (Symbol_table::add_from_incrobj): New function.
4738 (Symbol_table::set_file_offset): New function.
4739
4740 2011-04-05 Cary Coutant <ccoutant@google.com>
4741
4742 * incremental-dump.cc (dump_incremental_inputs): Change signature
4743 to take a Sized_incremental_binary; change caller. Use readers
4744 in Sized_incremental_binary.
4745 * incremental.cc
4746 (Sized_incremental_binary::find_incremental_inputs_sections):
4747 Rename do_find_incremental_inputs_sections to this.
4748 (Sized_incremental_binary::setup_readers): New function.
4749 (Sized_incremental_binary::do_check_inputs): Check
4750 has_incremental_info_ flag; move setup code to setup_readers;
4751 use input readers.
4752 (Sized_incremental_binary::do_file_is_unchanged): New function.
4753 (Sized_incremental_binary::do_get_input_reader): New function.
4754 * incremental.h (class Incremental_binary): Move to end of file.
4755 (Incremental_binary::file_is_unchanged): New function.
4756 (Incremental_binary::do_file_is_unchanged): New function.
4757 (Incremental_binary::Input_reader): New class.
4758 (Incremental_binary::get_input_reader): New function.
4759 (class Sized_incremental_binary): Move to end of file.
4760 (Sized_incremental_binary::Sized_incremental_binary): Setup the
4761 input section reader classes.
4762 (Sized_incremental_binary::has_incremental_info): New function.
4763 (Sized_incremental_binary::inputs_reader): New function.
4764 (Sized_incremental_binary::symtab_reader): New function.
4765 (Sized_incremental_binary::relocs_reader): New function.
4766 (Sized_incremental_binary::got_plt_reader): New function.
4767 (Sized_incremental_binary::do_file_is_unchanged): New function.
4768 (Sized_incremental_binary::Sized_input_reader): New class.
4769 (Sized_incremental_binary::get_input_reader): New function.
4770 (Sized_incremental_binary::find_incremental_inputs_sections):
4771 Rename do_find_incremental_inputs_sections to this.
4772 (Sized_incremental_binary::setup_readers): New function.
4773 (Sized_incremental_binary::has_incremental_info_): New data member.
4774 (Sized_incremental_binary::inputs_reader_): New data member.
4775 (Sized_incremental_binary::symtab_reader_): New data member.
4776 (Sized_incremental_binary::relocs_reader_): New data member.
4777 (Sized_incremental_binary::got_plt_reader_): New data member.
4778 (Sized_incremental_binary::current_input_file_): New data member.
4779
4780 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
4781
4782 PR gold/12640
4783 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4784 violation.
4785
4786 2011-03-30 Cary Coutant <ccoutant@google.com>
4787
4788 * archive.cc (Archive::include_member): Adjust call to report_object.
4789 (Add_archive_symbols::run): Add script_info to call to
4790 report_archive_begin.
4791 (Lib_group::include_member): Adjust call to report_object.
4792 (Add_lib_group_symbols::run): Adjust call to report_object.
4793 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4794 blocks. Add object count for script input files.
4795 * incremental.cc (Incremental_inputs::report_archive_begin): Add
4796 script_info parameter; change all callers.
4797 (Incremental_inputs::report_object): Add script_info parameter;
4798 change all callers.
4799 (Incremental_inputs::report_script): Store backpointer to
4800 incremental info entry.
4801 (Output_section_incremental_inputs::set_final_data_size): Record
4802 additional information for scripts.
4803 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4804 * incremental.h (Incremental_script_entry::add_object): New function.
4805 (Incremental_script_entry::get_object_count): New function.
4806 (Incremental_script_entry::get_object): New function.
4807 (Incremental_script_entry::objects_): New data member; adjust
4808 constructor.
4809 (Incremental_inputs::report_archive_begin): Add script_info parameter.
4810 (Incremental_inputs::report_object): Add script_info parameter.
4811 (Incremental_inputs_reader::get_object_count): New function.
4812 (Incremental_inputs_reader::get_object_offset): New function.
4813 * options.cc (Input_arguments::add_file): Return reference to
4814 new input argument.
4815 * options.h (Input_argument::set_script_info): New function.
4816 (Input_argument::script_info): New function.
4817 (Input_argument::script_info_): New data member; adjust all
4818 constructors.
4819 (Input_file_group::add_file): Return reference to new input argument.
4820 (Input_file_lib::add_file): Likewise.
4821 (Input_arguments::add_file): Likewise.
4822 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4823 * script.cc (Parser_closure::Parser_closure): Add script_info
4824 parameter; adjust all callers.
4825 (Parser_closure::script_info): New function.
4826 (Parser_closure::script_info_): New data member.
4827 (read_input_script): Report scripts earlier to incremental info.
4828 (script_add_file): Set script_info in Input_argument.
4829 (script_add_library): Likewise.
4830 * script.h (Script_options::Script_info): Rewrite class.
4831
4832 2011-03-29 Cary Coutant <ccoutant@google.com>
4833
4834 * archive.cc (Library_base::should_include_member): Move
4835 method here from class Archive.
4836 (Archive::Archive): Initialize base class.
4837 (Archive::should_include_member): Move to base class.
4838 (Archive::do_for_all_unused_symbols): New function.
4839 (Add_archive_symbols::run): Remove redundant access to
4840 incremental_inputs.
4841 (Lib_group::Lib_group): Initialize base class.
4842 (Lib_group::do_filename): New function.
4843 (Lib_group::include_member): Pass pointer to Lib_group to
4844 report_object.
4845 (Lib_group::do_for_all_unused_symbols): New function.
4846 (Add_lib_group_symbols::run): Report archive information for
4847 incremental links.
4848 * archive.h (class Library_base): New base class.
4849 (class Archive): Derive from Library_base.
4850 (Archive::filename): Move to base class.
4851 (Archive::set_incremental_info): Likewise.
4852 (Archive::incremental_info): Likewise.
4853 (Archive::Should_include): Likewise.
4854 (Archive::should_include_member): Likewise.
4855 (Archive::Armap_entry): Remove.
4856 (Archive::Unused_symbol_iterator): Remove.
4857 (Archive::unused_symbols_begin): Remove.
4858 (Archive::unused_symbols_end): Remove.
4859 (Archive::do_filename): New function.
4860 (Archive::do_get_mtime): New function.
4861 (Archive::do_for_all_unused_symbols): New function.
4862 (Archive::task_): Move to base class.
4863 (Archive::incremental_info_): Likewise.
4864 (class Lib_group): Derive from Library_base.
4865 (Lib_group::do_filename): New function.
4866 (Lib_group::do_get_mtime): New function.
4867 (Lib_group::do_for_all_unused_symbols): New function.
4868 (Lib_group::task_): Move to base class.
4869 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4870 function.
4871 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4872 function.
4873 * incremental.cc (Incremental_inputs::report_archive_begin):
4874 Use Library_base; call library's get_mtime; add incremental inputs
4875 entry before members.
4876 (class Unused_symbol_visitor): New class.
4877 (Incremental_inputs::report_archive_end): Use Library_base; use
4878 visitor class to record unused symbols; don't add incremental inputs
4879 entry after members.
4880 (Incremental_inputs::report_object): Use Library_base.
4881 * incremental.h
4882 (Incremental_archive_entry::Incremental_archive_entry): Remove
4883 unused Archive parameter.
4884 (Incremental_inputs::report_archive_begin): Use Library_base.
4885 (Incremental_inputs::report_archive_end): Likewise.
4886 (Incremental_inputs::report_object): Likewise.
4887 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4888 function.
4889 * object.h (Object::for_all_global_symbols): New function.
4890 (Object::do_for_all_global_symbols): New function.
4891 (Sized_relobj::do_for_all_global_symbols): New function.
4892 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4893 function.
4894 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4895 function.
4896
4897 2011-03-27 Ian Lance Taylor <iant@google.com>
4898
4899 * archive.cc (Archive::interpret_header): Return -1 if something
4900 goes wrong. Change callers accordingly.
4901
4902 2011-03-25 Cary Coutant <ccoutant@google.com>
4903
4904 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4905 * testsuite/Makefile.in: Regenerate.
4906
4907 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4908
4909 * plugin.cc (get_view): New.
4910 (Plugin::load): Pass get_view to the plugin.
4911 (Plugin_manager::get_view): New.
4912
4913 2011-03-21 Ian Lance Taylor <iant@google.com>
4914
4915 * testsuite/final_layout.sh: Rewrite to not use dc.
4916 * testsuite/relro_test.sh: Fail if dc is not present.
4917
4918 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4919
4920 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4921 Change == to -eq.
4922 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4923 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4924 Change == to -eq.
4925 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4926 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4927
4928 2011-03-14 Ian Lance Taylor <iant@google.com>
4929
4930 * script-sections.cc (Sort_output_sections::script_compare):
4931 Rename from is_before, change return type.
4932 (Sort_output_sections::operator()): Adjust accordingly.
4933
4934 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4935
4936 PR gold/12572
4937 * testsuite/odr_violation2.cc: Add comment to make all error line
4938 numbers double digits.
4939 * testsuite/debug_msg.sh: Adjust expected errors.
4940
4941 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4942
4943 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4944 but mark earlier ones as non-canonical
4945 (offset_to_iterator): Update search target and example
4946 (do_addr2line): Return extra lines in a vector*
4947 (format_file_lineno): Extract from do_addr2line
4948 (one_addr2line): Add vector* out-param
4949 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4950 when a lineno entry appeared last for its instruction
4951 (Dwarf_line_info): Add vector* out-param
4952 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4953 * symtab.cc (Odr_violation_compare): Include the lineno in the
4954 comparison again.
4955 (linenos_from_loc): New. Combine the canonical line for an
4956 address with its other lines.
4957 (True_if_intersect): New. Helper functor to make
4958 std::set_intersection a query.
4959 (detect_odr_violations): Compare sets of lines instead of just
4960 one line for each function. This became less deterministic, but
4961 has fewer false positives.
4962 * symtab.h: Declarations.
4963 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4964 mix an optimized and non-optimized object in the same binary
4965 (odr_violation2.so): Same.
4966 * testsuite/Makefile.in: Regenerate from Makefile.am.
4967 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4968 * testsuite/debug_msg.sh: Update line numbers and add
4969 assertions.
4970 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4971 non-optimized context.
4972 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4973 isn't inlined, and use OdrDerived in an optimized context.
4974 * testsuite/odr_header1.h: Defines OdrDerived, where
4975 optimization will change the
4976 first-instruction-in-the-destructor's file and line number.
4977 * testsuite/odr_header2.h: Defines OdrBase.
4978
4979 2011-03-09 Ian Lance Taylor <iant@google.com>
4980
4981 * fileread.cc (File_read::clear_views): Don't delete the whole
4982 file view.
4983
4984 2011-03-08 Ian Lance Taylor <iant@google.com>
4985
4986 PR gold/12525
4987 * fileread.cc: #include <climits>.
4988 (GOLD_IOV_MAX): Define.
4989 (File_read::read_multiple): Limit number of entries by iov_max.
4990 * fileread.h (class File_read): Always set max_readv_entries to
4991 128.
4992
4993 2011-03-07 Ian Lance Taylor <iant@google.com>
4994
4995 PR gold/12525
4996 * options.h (class General_options): Add -dy and -dn.
4997
4998 2011-03-02 Cary Coutant <ccoutant@google.com>
4999
5000 * testsuite/script_test_9.t: Add TLS segment.
5001
5002 2011-03-02 Simon Baldwin <simonb@google.com>
5003
5004 * configure.ac: Add check for gnu_indirect_function support in
5005 the toolchain building binutils.
5006 * configure: Rebuild.
5007
5008 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
5009
5010 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5011 plugin only symbols.
5012 (Symbol_table::sized_finalize_symbol) Mark symbol only present
5013 in plugin files as not needed in the symbol table.
5014
5015 2011-02-11 Sriraman Tallam <tmsriram@google.com>
5016
5017 * output.cc (Output_section::add_input_section): Delay fill
5018 generation for section ordering.
5019
5020 2011-02-09 Ian Lance Taylor <iant@google.com>
5021
5022 PR gold/12316
5023 * object.h (class Sized_relobj): Remove clear_local_symbols.
5024 * reloc.cc (Sized_relobj::do_relocate): Don't call
5025 clear_local_symbols.
5026
5027 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
5028
5029 * plugin.cc (is_visible_from_outside): Return true for symbols
5030 in the -u option.
5031
5032 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
5033
5034 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5035 filename.
5036
5037 2011-02-02 Sriraman Tallam <tmsriram@google.com>
5038
5039 * icf.h (is_section_foldable_candidate): Change type of parameter
5040 to std::string.
5041 * icf.cc (Icf::find_identical_sections): Change type of local variable
5042 section_name to be std::string.
5043 (is_function_ctor_or_dtor): Change type of parameter to std::string.
5044
5045 2011-01-25 Ian Lance Taylor <iant@google.com>
5046
5047 * script.cc (script_add_extern): Rewrite to use
5048 add_symbol_reference.
5049
5050 2011-01-25 Doug Kwan <dougkwan@google.com>
5051
5052 * icf.cc (get_section_contents): Always lock section's object.
5053
5054 2011-01-24 Ian Lance Taylor <iant@google.com>
5055
5056 * options.h (class General_options): Accept
5057 --no-detect-odr-violations.
5058
5059 2011-01-24 Ian Lance Taylor <iant@google.com>
5060
5061 * version.cc (version_string): Bump to 1.11.
5062
5063 2011-01-24 Ian Lance Taylor <iant@google.com>
5064
5065 * plugin.cc (class Plugin_rescan): Define new class.
5066 (Plugin_manager::claim_file): Set any_claimed_.
5067 (Plugin_manager::save_archive): New function.
5068 (Plugin_manager::save_input_group): New function.
5069 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5070 necessary.
5071 (Plugin_manager::new_undefined_symbol): New function.
5072 (Plugin_manager::rescan): New function.
5073 (Plugin_manager::rescannable_defines): New function.
5074 (Plugin_manager::add_input_file): Set any_added_.
5075 * plugin.h (class Plugin_manager): define new fields rescannable_,
5076 undefined_symbols_, any_claimed_, and any_added_. Declare
5077 Plugin_rescan as friend. Declare new functions.
5078 (Plugin_manager::Rescannable): Define type.
5079 (Plugin_manager::Rescannable_list): Define type.
5080 (Plugin_manager::Undefined_symbol_list): Define type.
5081 (Plugin_manager::Plugin_manager): Initialize new fields.
5082 * archive.cc (Archive::defines_symbol): New function.
5083 (Add_archive_symbols::run): Pass archive to plugins if any.
5084 * archive.h (class Archive): Declare defines_symbol.
5085 * readsyms.cc (Input_group::~Input_group): New function.
5086 (Finish_group::run): Pass input_group to plugins if any.
5087 * readsyms.h (class Input_group): Declare destructor.
5088 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5089 any.
5090
5091 2011-01-10 Ian Lance Taylor <iant@google.com>
5092
5093 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5094 section as relro.
5095 (Layout::set_segment_offsets): Reset increase_relro before calling
5096 set_section_addresses a second time.
5097
5098 2011-01-04 Cary Coutant <ccoutant@google.com>
5099
5100 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5101 sections before NOBITS sections.
5102
5103 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
5104
5105 * version.cc (print_version): Update copyright to 2011.
5106
5107 2010-12-23 Cary Coutant <ccoutant@google.com>
5108
5109 * output.h (Output_data_reloc::add_output_section): Pass OD instead
5110 of OS to this->add. Add OD parameter to second form of the function.
5111
5112 2010-12-20 Ian Lance Taylor <iant@google.com>
5113
5114 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5115 second of two consecutive entries with same offset.
5116
5117 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5118
5119 * testsuite/Makefile.am (ifuncmain2static_LDADD)
5120 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5121 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5122 to avoid unneeded links against $(LDADD).
5123 * testsuite/Makefile.in: Regenerate.
5124
5125 2010-12-15 Ian Lance Taylor <iant@google.com>
5126
5127 PR gold/12324
5128 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5129 for R_X86_64_32 and R_X86_64_PC32.
5130 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5131 ver_matching_def_pic.o.
5132 (ver_matching_def_pic.o): New target.
5133
5134 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5135
5136 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5137 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5138 Move definition before File_read::View member definitions.
5139 (File_read::View::~View): Initialize and hold lock before
5140 updating current_mapped_bytes.
5141
5142 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5143
5144 * dwarf_reader.cc: Remove outdated comment.
5145 * gold-threads.cc: Fix typo in error message.
5146 * archive.cc: Fix typos in comments.
5147 * archive.h: Likewise.
5148 * arm-reloc-property.cc: Likewise.
5149 * arm-reloc-property.h: Likewise.
5150 * arm-reloc.def: Likewise.
5151 * arm.cc: Likewise.
5152 * attributes.h: Likewise.
5153 * cref.cc: Likewise.
5154 * ehframe.cc: Likewise.
5155 * fileread.h: Likewise.
5156 * gold.h: Likewise.
5157 * i386.cc: Likewise.
5158 * icf.cc: Likewise.
5159 * incremental.h: Likewise.
5160 * int_encoding.cc: Likewise.
5161 * layout.h: Likewise.
5162 * main.cc: Likewise.
5163 * merge.h: Likewise.
5164 * object.cc: Likewise.
5165 * object.h: Likewise.
5166 * options.cc: Likewise.
5167 * readsyms.cc: Likewise.
5168 * reduced_debug_output.cc: Likewise.
5169 * reloc.cc: Likewise.
5170 * script-sections.cc: Likewise.
5171 * sparc.cc: Likewise.
5172 * symtab.h: Likewise.
5173 * target-reloc.h: Likewise.
5174 * target.cc: Likewise.
5175 * target.h: Likewise.
5176 * timer.cc: Likewise.
5177 * timer.h: Likewise.
5178 * x86_64.cc: Likewise.
5179
5180 2010-12-09 Cary Coutant <ccoutant@google.com>
5181
5182 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5183 stack.
5184 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5185 parameter; change all callers.
5186 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5187 * options.h (warn_execstack): New option.
5188
5189 2010-12-07 Doug Kwan <dougkwan@google.com>
5190
5191 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5192 like function call relocations.
5193
5194 2010-12-07 Ian Lance Taylor <iant@google.com>
5195
5196 * archive.cc (Archive::get_elf_object_for_member): Permit
5197 punconfigured to be NULL.
5198 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5199 (Archive::include_member): Pass NULL to get_elf_object_for_member
5200 if we searched for the archive and this is the first included
5201 object.
5202
5203 2010-12-01 Ian Lance Taylor <iant@google.com>
5204
5205 * dwarf_reader.h (class Sized_dwarf_line_info): Add
5206 track_relocs_type_ field.
5207 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5208 Set track_relocs_type_.
5209 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5210 contents when using RELA relocs.
5211 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5212 reloc_map_.
5213 * reloc.cc (Track_relocs::next_addend): New function.
5214 * reloc.h (class Track_relocs): Declare next_addend.
5215
5216 2010-12-01 Ian Lance Taylor <iant@google.com>
5217
5218 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5219 virtual destructor.
5220
5221 2010-12-01 Ian Lance Taylor <iant@google.com>
5222
5223 * README: Update compilers known to work and fail.
5224
5225 2010-11-23 Matthias Klose <doko@ubuntu.com>
5226
5227 * configure.in: For --enable-gold, handle value `default' instead of
5228 `both*'. Always install ld as ld.bfd, install as ld if gold is
5229 not the default.
5230 * configure: Regenerate.
5231
5232 2010-11-18 Doug Kwan <dougkwan@google.com>
5233
5234 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5235 and right_alignment to be zero. Store result alignment only if it is
5236 greater than existing alignment.
5237
5238 2010-11-16 Cary Coutant <ccoutant@google.com>
5239
5240 PR gold/12220
5241 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5242 Check for ".zdebug_line".
5243
5244 2010-11-16 Doug Kwan <dougkwan@google.com>
5245 Cary Coutant <ccoutant@google.com>
5246
5247 * output.h (Output_segment::set_section_addresses): Pass increase_relro
5248 by reference; adjust all callers.
5249 * output.cc (Output_segment::set_section_addresses): Adjust references
5250 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5251 list is empty.
5252 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5253 end at page boundary.
5254
5255 2010-11-16 Cary Coutant <ccoutant@google.com>
5256
5257 PR gold/12220
5258 * layout.cc (Layout::choose_output_section): Transform names of
5259 compressed sections even when using a script with a SECTIONS clause.
5260 (Layout::output_section_name): Remove code to transform
5261 compressed debug section names.
5262 * output.cc (Output_section::add_input_section): Use uncompressed
5263 section size when tracking input sections.
5264
5265 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
5266
5267 * symtab.h (Symbol::NON_PIC_REF): Remove.
5268 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5269 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
5270 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5271 (Symbol::use_plt_offset): Take a flags argument and pass it
5272 directly to needs_dynamic_reloc. Restrict check for undefined
5273 weak symbols to function calls.
5274 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5275 (Target_arm::Scan::global): Use it.
5276 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5277 (Target_arm::Relocate::relocate): Likewise.
5278 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5279 parameter with an r_type parameter. Use get_reference_flags
5280 to get the flags.
5281 (Target_arm::Relocate::relocate): Update accordingly.
5282 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5283 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5284 (Target_i386::Scan::global): Likewise.
5285 (Target_i386::Relocate::relocate): Likewise.
5286 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5287 parameter with an r_type parameter. Use get_reference_flags
5288 to get the flags.
5289 (Target_i386::Relocate::relocate): Update accordingly.
5290 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5291 (Target_powerpc::Scan::global): Use it.
5292 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5293 (Target_powerpc::Relocate::relocate): Likewise.
5294 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5295 (Target_sparc::Scan::global): Use it.
5296 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5297 (Target_sparc::Relocate::relocate): Likewise.
5298 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5299 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5300 (Target_x86_64::Scan::global): Likewise.
5301 (Target_x86_64::Relocate::relocate): Likewise.
5302
5303 2010-11-08 Doug Kwan <dougkwan@google.com>
5304 Cary Coutant <ccoutant@google.com>
5305
5306 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5307 (Arm_exidx_merge_section::section_contents_): New data member.
5308 (Arm_input_section::Arm_input_section): Initialize original_contents_.
5309 (Arm_input_section::~Arm_input_section): De-allocate memory.
5310 (Arm_input_section::original_contents_): New data member.
5311 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5312 in parameters instead of calling Object::section_contents without
5313 locking.
5314 (Arm_output_section::group_section): New parameter TASK. Pass it
5315 to callees that need locking objects.
5316 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
5317 to lock EXIDX input sections. Fix a formatting issue. Call
5318 Arm_exidx_merged_section::build_contents to create merged section
5319 contents.
5320 (Arm_output_section::create_stub_group): New parameter TASK. Use it
5321 to lock object of stub table owner.
5322 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5323 TEXT_SIZE to initialize data member TEXT_SIZE_.
5324 (Arm_exidx_input_section::addralign): Fix typo in comment.
5325 (Arm_exidx_input_section::text_size): New method.
5326 (Target_arm::do_relax): New parameter TASK. Pass it to callees
5327 that require locking objects. Lock objects before scanning for stubs
5328 and updating local symbols.
5329 (Arm_input_section<big_endian>::init): Copy contents of original
5330 input section.
5331 (Arm_input_section<big_endian>::do_write): Use saved contents of
5332 original input section instead of calling Object::section_contents
5333 without locking.
5334 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5335 size without calling Object::section_size().
5336 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5337 for size. Allocate a buffer for merged EXIDX entries.
5338 (Arm_exidx_merged_section::build_contents): New method.
5339 (Arm_exidx_merged_section::do_write): Move merge section contents
5340 building code to Arm_exidx_merged_section::build_contetns. Write
5341 out contetns in buffer instead of building it on the fly.
5342 (Arm_relobj::make_exidx_input_section): Also pass text section size
5343 to Arm_exidx_input_section constructor.
5344 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
5345 (Arm_dynobj::do_read_symbols): Fix memory leak.
5346 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5347 * target.h: (class Task): Add forward declaration.
5348 (Target::relax): Add new parameter TASK and pass it to
5349 Target::do_relax().
5350 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
5351
5352 2010-11-05 Cary Coutant <ccoutant@google.com>
5353
5354 PR gold/10708
5355 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5356 object when reading from the file.
5357 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5358 second layout pass.
5359 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5360 when reading section contents.
5361 (get_section_contents): Likewise.
5362 (icf::find_identical_sections): Likewise.
5363 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5364 object when reading from the file.
5365 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5366 the object when doing deferred section layout.
5367
5368 2010-11-03 Nick Clifton <nickc@redhat.com>
5369
5370 PR gold/12001
5371 * script.h (class Symbol_assignment: name): New member. Returns
5372 the name of the symbol.
5373 * scrfipt.cc (Script_options::is_pending_assignment): New member.
5374 Returns true if the given symbol name is on the list of
5375 assignments wating to be processed.
5376 * archive.cc (should_incldue_member): If the symbol is undefined,
5377 check to see if it is on the list of symbols pending assignment.
5378
5379 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
5380
5381 * script-sections.cc (Script_sections::find_memory_region): Check
5382 for a NULL output section pointer.
5383
5384 2010-10-29 Doug Kwan <dougkwan@google.com>
5385
5386 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5387 Output_section::add_relaxed_input_section.
5388 * output.cc (Output_section::add_relaxed_input_section): Add new
5389 arguments LAYOUT and NAME. Set section order index.
5390 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5391 Copy section order index.
5392 * output.h (Output_section::add_relaxed_input_section): Add new
5393 arguments LAYOUT and NAME.
5394
5395 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5396
5397 * testsuite/Makefile.am: Move gcctestdir/ld rule to
5398 NATIVE_OR_CROSS_LINKER.
5399 * testsuite/Makefile.in: Regenerate.
5400
5401 2010-10-20 Doug Kwan <dougkwan@google.com>
5402
5403 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5404 without SHF_LINK_ORDER flags.
5405 * layout.cc (Layout::choose_output_section): Do not filter
5406 SHF_LINK_ORDER flag in a relocatable link.
5407
5408 2010-10-17 Cary Coutant <ccoutant@google.com>
5409
5410 * output.h (Output_segment::set_section_addresses): Change function
5411 signature. Update all callers.
5412 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5413 sections.
5414 (Output_segment::set_section_addresses): Align after last TLS
5415 section. Add padding before last relro section instead of after.
5416
5417 2010-10-17 Doug Kwan <dougkwan@google.com>
5418
5419 * gold/arm.cc (Target_arm::got_section): Use correct order and set
5420 GOT output section to be writable.
5421
5422 2010-10-14 Cary Coutant <ccoutant@google.com>
5423
5424 * debug.h (DEBUG_INCREMENTAL): New flag.
5425 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5426 * gold.cc (queue_initial_tasks): Check parameters for incremental link
5427 mode.
5428 * incremental.cc (report_command_line): Ignore all forms of
5429 --incremental.
5430 * layout.cc (Layout::Layout): Check parameters for incremental link
5431 mode.
5432 * options.cc (General_options::parse_incremental): New function.
5433 (General_options::parse_no_incremental): New function.
5434 (General_options::parse_incremental_full): New function.
5435 (General_options::parse_incremental_update): New function.
5436 (General_options::incremental_mode_): New data member.
5437 (General_options::finalize): Check incremental_mode_.
5438 * options.h (General_options): Update help text for --incremental.
5439 Add --no-incremental, --incremental-full, --incremental-update.
5440 (General_options::Incremental_mode): New enum type.
5441 (General_options::incremental_mode): New function.
5442 (General_options::incremental_mode_): New data member.
5443 * parameters.cc (Parameters::incremental_mode_): New data member.
5444 (Parameters::set_options): Set incremental_mode_.
5445 (Parameters::set_incremental_full): New function.
5446 (Parameters::incremental): New function.
5447 (Parameters::incremental_update): New function.
5448 (set_parameters_incremental_full): New function.
5449 * parameters.h (Parameters::set_incremental_full): New function.
5450 (Parameters::incremental): New function.
5451 (Parameters::incremental_update): New function.
5452 (Parameters::incremental_mode_): New data member.
5453 (set_parameters_incremental_full): New function.
5454 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5455 incremental link mode.
5456 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5457 (Sized_relobj::do_relocate_sections): Likewise.
5458 * testsuite/Makefile.am (incremental_test): Use --incremental-full
5459 option.
5460 * testsuite/Makefile.in: Regenerate.
5461 * testsuite/incremental_test.sh: Filter all forms of --incremental.
5462
5463 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5464
5465 * script-sections.h (class Script_sections): Make
5466 Sections_elements typedef public.
5467 * script-sections.cc (class Sort_output_sections): Add elements_
5468 field. Add constructor which sets it; change all callers.
5469 (Sort_output_sections::is_before): New function.
5470 (Sort_output_sections::operator()): Call is_before.
5471 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5472 conditional.
5473 * testsuite/script_test_10.sh: New test. Test script section
5474 order.
5475 * testsuite/script_test_10.t: Likewise.
5476 * testsuite/script_test_10.s: Likewise.
5477 * testsuite/Makefile.am: Wrap the cross linker tests and the
5478 common tests into NATIVE_OR_CROSS_LINKER.
5479 (check_SCRIPTS): Add script_test_10.sh.
5480 (check_DATA): Add script_test_10.stdout.
5481 (script_test_10.o, script_test_10): New targets.
5482 (script_test_10.stdout): New target.
5483 * configure, testsuite/Makefile.in: Regenerate.
5484
5485 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5486
5487 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5488 error for the deprecated relocations.
5489 (Target_arm::Scan::global): Likewise.
5490 (Target_arm::Relocate::relocate): Likewise.
5491
5492 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
5493
5494 * fileread.cc (Input_file::find_file): Initialize *found_name
5495 and *namep when using the fallback search for case 4.
5496
5497 2010-10-11 Cary Coutant <ccoutant@google.com>
5498
5499 * options.h (class General_options): Redefine -z lazy as an alias for
5500 the negation of -z now.
5501
5502 2010-10-11 Ian Lance Taylor <iant@google.com>
5503
5504 * resolve.cc (symbol_to_bits): Report the value of the unsupported
5505 binding.
5506
5507 2010-10-06 Nick Clifton <nickc@redhat.com>
5508
5509 * script-sections.cc(class Memory_region): Remove
5510 current_lma_offset_ field. Rename current_vma_offset_ to
5511 current_offset_. Add last_section_ field.
5512 (Memory_region::get_current_vma_address): Rename to
5513 get_current_address.
5514 (Memory_region::get_current_lma_address): Delete.
5515 (Memory_region::increment_vma_offset): Rename to
5516 increment_offset.
5517 (Memory_region::increment_lma_offset): Delete.
5518 (Memory_region::attributes_compatible): New method. Returns
5519 true if the provided section is compatible with the region.
5520 (Memory_region::get_last_section): New method. Returns the last
5521 section to use the region.
5522 (Memory_region::set_last_section): New method. Stores the last
5523 section to use the region.
5524 (Script_sections::block_in_region): New method. Returns true if
5525 a block of memory is contained within a region.
5526 (Script_sections::find_memory_region): New method. Locates a
5527 memory region to be used to set a VMA or LMA address.
5528 (Output_section_definition::set_section_addresses): Add code to
5529 check for addresses set by memory regions.
5530 (Output_segment::set_section_addresses): Remove memory region
5531 walking code.
5532 (Script_sections::create_segment): Add a warning if a header
5533 segment is created outside of any region.
5534 * script-sections.h (class Script_sections): Add prototypes for
5535 find_memory_region and block_in_region methods.
5536 * testsuite/memory_test.s: Use .long instead of .word.
5537 * testsuite/memory_test.t: Add some more output sections.
5538 * testsuite/memory_test.sh: Update expected output.
5539
5540 2010-10-02 Doug Kwan <dougkwan@google.com>
5541
5542 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5543 defintion to symtab.h
5544 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5545 declaration to defintion.
5546
5547 2010-10-01 Nick Clifton <nickc@redhat.com>
5548
5549 * expression.cc (eval): Replace dummy argument with NULL.
5550 (eval_maybe_dot): Check for a NULL result section pointer.
5551 (Symbol_expression::value): Likewise.
5552 (Dot_expression::value): Likewise.
5553 (BINARY_EXPRESSION): Likewise.
5554 (Max_expression::value): Likewise.
5555 (Min_expression::value): Likewise.
5556 (Absolute_expression::value): Likewise.
5557 (Addr_expression::value_from_output_section): Likewise.
5558 (Loaddddr_expression::value_from_output_section): Likewise.
5559 (Segment_start_expression::value): Likewise.
5560 * script-sections.cc
5561 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5562 argument with NULL.
5563 (Sections_elememt_dot_assignment::set_section_addresses):
5564 Likewise.
5565 (Output_data_expression::do_write_to_buffer): Likewise.
5566 (Output_section_definition::finalize_symbols): Likewise.
5567 (Output_section_definition::set_section_addresses): Likewise.
5568
5569 2010-09-30 Doug Kwan <dougkwan@google.com>
5570
5571 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5572
5573 2010-09-28 Sriraman Tallam <tmsriram@google.com>
5574
5575 * target.h (Target::can_icf_inline_merge_sections): New virtual
5576 function.
5577 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5578 virtual function.
5579 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5580 virtual function.
5581 * icf.cc (get_section_contents): Inline merge sections only when
5582 target allows it.
5583
5584 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5585
5586 * configure: Regenerate.
5587
5588 2010-09-17 Ian Lance Taylor <iant@google.com>
5589
5590 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5591 * testsuite/Makefile.am (memory_test.o): New target.
5592 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5593 memory_test.t.
5594 * testsuite/Makefile.in: Rebuild.
5595
5596 2010-09-17 Doug Kwan <dougkwan@google.com>
5597
5598 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5599 defintion if relocation uses GOT entries of the symbol.
5600 * testsuite/icf_safe_test.sh: Fix test.
5601 * testsuite/icf_safe_so_test.sh: Fix test.
5602
5603 2010-09-16 Cary Coutant <ccoutant@google.com>
5604
5605 * script_sections.cc (class Memory_region): Remove "NULL" from
5606 vector initializations.
5607
5608 2010-09-15 Cary Coutant <ccoutant@google.com>
5609
5610 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5611 Resolve forwarding symbols.
5612
5613 2010-09-15 Doug Kwan <dougkwan@google.com>
5614
5615 * gold/testsuite/script_test_3.t: Add ARM special sections.
5616 * gold/testsuite/script_test_4.t: Same.
5617 * gold/testsuite/script_test_5.t: Same.
5618 * gold/testsuite/script_test_6.t: Same.
5619 * gold/testsuite/script_test_7.t: Same.
5620 * gold/testsuite/script_test_7.t: Same.
5621 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5622
5623 2010-09-14 Cary Coutant <ccoutant@google.com>
5624
5625 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5626 (Target_x86_64::Relocate::relocate_tls): Replace check for
5627 saw_tls_block_reloc_ with test for executable section.
5628
5629 2010-09-12 Cary Coutant <ccoutant@google.com>
5630
5631 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5632 position-independent executables to shared libraries need dynamic
5633 relocations.
5634 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5635 position-independent executables.
5636 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5637 * testsuite/Makefile.in: Regenerate.
5638
5639 2010-09-10 Nick Clifton <nickc@redhat.com>
5640
5641 PR gold/11997
5642 * testsuite/memory_test.t: Discard any sections that are not
5643 needed.
5644
5645 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
5646
5647 PR gold/11996
5648 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5649 "This::" to work around a bug in gcc 4.2.
5650
5651 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5652
5653 2010-09-09 Rafael Espindola <espindola@google.com>
5654
5655 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5656 sections with different PF_X flags in the same segment.
5657 (Layout::find_first_load_seg): Search all segments to find the first
5658 one.
5659 * options.h (rosegment): New.
5660
5661 2010-09-08 Rafael Espindola <espindola@google.com>
5662
5663 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5664
5665 2010-09-08 Doug Kwan <dougkwan@google.com>
5666
5667 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5668 (Arm_relobj::do_relocate_sections): Add new parameter for output
5669 file to match the parent.
5670 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5671 of local symbols instead of input values. Update code to track
5672 changes in gold::relocate_section.
5673 * object.cc (Sized_relobj::compute_final_local_value): New methods.
5674 (Sized_relobj::compute_final_local_value_internal): New methods.
5675 (Sized_relobj::do_finalize_local_symbols): Move code from loop
5676 body into private version of Sized_relobj::compute_final_local_value.
5677 Call the inline method.
5678 * object.h (Symbol_value::Symbol_value): Define destructor. Free
5679 merged symbol value if there is one.
5680 (Symbol_value::has_output_value): New method defintiion.
5681 (Sized_relobj::Compute_final_local_value_status): New enum type.
5682 (Sized_relobj::compute_final_local_value): New methods.
5683 (Sized_relobj::compute_final_local_value_internal): New methods.
5684 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5685 and arm_cortex_a8.sh.
5686 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5687 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5688 New tests.
5689 * Makefile.in: Regenerate.
5690 * testsuite/arm_bl_out_of_range.s: Update test.
5691 * testsuite/thumb_bl_out_of_range.s: Ditto.
5692 * testsuite/thumb_blx_out_of_range.s: Ditto.
5693 * testsuite/arm_branch_out_of_range.sh: New file.
5694 * testsuite/arm_cortex_a8.sh: Ditto.
5695 * testsuite/arm_cortex_a8_b.s: Ditto.
5696 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5697 * testsuite/arm_cortex_a8_b_local.s: Ditto.
5698 * testsuite/arm_cortex_a8_bl.s: Ditto.
5699 * testsuite/arm_cortex_a8_blx.s: Ditto.
5700 * testsuite/arm_cortex_a8_local.s: Ditto.
5701 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5702 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5703
5704 2010-09-08 Rafael Espindola <espindola@google.com>
5705
5706 * Makefile.am (memory_test.stdout): Run readelf with -W.
5707 * Makefile.in: Regenerate.
5708 * testsuite/memory_test.sh: Make the regexps accept both 32 and
5709 64 bit output.
5710
5711 2010-09-08 Rafael Espindola <espindola@google.com>
5712
5713 * script-sections.cc (Script_sections::add_memory_region): Convert
5714 field precision to int.
5715 * script.cc (script_set_section_region, script_set_section_region):
5716 Convert field precision to int.
5717
5718 2010-09-08 Rafael Espindola <espindola@google.com>
5719
5720 * arm.cc (do_finalize_sections): Create the __exidx_start and
5721 __exdix_end symbols even when the section is missing.
5722
5723 2010-09-08 Nick Clifton <nickc@redhat.com>
5724
5725 * README: Remove claim that MEMORY is not supported.
5726 * expression.cc (script_exp_function_origin)
5727 (script_exp_function_length): Move from here to ...
5728 * script.cc: ... here.
5729 (script_set_section_region, script_add_memory)
5730 (script_parse_memory_attr, script_include_directive): New
5731 functions.
5732 * script-sections.cc
5733 (class Memory_region): New class.
5734 (class Output_section_definition): Add set_memory_region,
5735 set_section_vma, set_section_lma and get_section_name methods.
5736 (class Script_Sections): Add add_memory_region,
5737 find_memory_region, find_memory_region_origin,
5738 find_memory_region_length and set_memory_region methods.
5739 Have set_section_addresses method walk the list of set memory
5740 regions.
5741 Extend the print methos to display memory regions.
5742 * script-sections.h: Add prototypes for new methods.
5743 Add enum for MEMORY region attributes.
5744 * yyscript.y: Add support for parsing MEMORY regions.
5745 * script-c.h: Add prototypes for new functions.
5746 * testsuite/Makefile.am: Add test of MEMORY region functionality.
5747 * testsuite/Makefile.in: Regenerate.
5748 * testsuite/memory_test.sh: New script.
5749 * testsuite/memory_test.s: New assembler source file.
5750 * testsuite/memory_test.t: New linker script.
5751
5752 2010-08-27 Doug Kwan <dougkwan@google.com>
5753
5754 * gold/resolve.cc (Symbol_table::should_override): Let a weak
5755 reference override an existing dynamic weak reference.
5756 * testsuite/Makefile.am: Add new test dyn_weak_ref.
5757 * testsuite/Makefile.in: Regenerate.
5758 * testsuite/dyn_weak_ref.sh: New file.
5759 * testsuite/dyn_weak_ref_1.c: Ditto.
5760 * testsuite/dyn_weak_ref_2.c: Ditto.
5761
5762 2010-08-27 Ian Lance Taylor <iant@google.com>
5763
5764 * incremental.h (class Incremental_input_entry): Add virtual
5765 destructor.
5766
5767 2010-08-27 Ian Lance Taylor <iant@google.com>
5768
5769 * testsuite/start_lib_test_3.c: Mark t3 as used.
5770
5771 2010-08-27 Nick Clifton <nickc@redhat.com>
5772
5773 * options.cc (version_script): Fix small typo in previous
5774 whitespace tidyup.
5775
5776 2010-08-25 Nick Clifton <nickc@redhat.com>
5777
5778 * archive.cc: Formatting fixes: Remove whitespace between
5779 typename and following asterisk. Remove whitespace between
5780 function name and opening parenthesis.
5781 * archive.h: Likewise.
5782 * arm.cc: Likewise.
5783 * attributes.cc: Likewise.
5784 * attributes.h: Likewise.
5785 * common.cc: Likewise.
5786 * copy-relocs.cc: Likewise.
5787 * dirsearch.h: Likewise.
5788 * dynobj.cc: Likewise.
5789 * ehframe.cc: Likewise.
5790 * ehframe.h: Likewise.
5791 * expression.cc: Likewise.
5792 * fileread.cc: Likewise.
5793 * fileread.h: Likewise.
5794 * gc.h: Likewise.
5795 * gold-threads.cc: Likewise.
5796 * gold.cc: Likewise.
5797 * i386.cc: Likewise.
5798 * icf.h: Likewise.
5799 * incremental-dump.cc: Likewise.
5800 * incremental.cc: Likewise.
5801 * layout.cc: Likewise.
5802 * layout.h: Likewise.
5803 * main.cc: Likewise.
5804 * merge.cc: Likewise.
5805 * merge.h: Likewise.
5806 * object.cc: Likewise.
5807 * object.h: Likewise.
5808 * options.cc: Likewise.
5809 * options.h: Likewise.
5810 * output.cc: Likewise.
5811 * output.h: Likewise.
5812 * plugin.cc: Likewise.
5813 * plugin.h: Likewise.
5814 * powerpc.cc: Likewise.
5815 * reloc.cc: Likewise.
5816 * script-c.h: Likewise.
5817 * script-sections.cc: Likewise.
5818 * script.cc: Likewise.
5819 * stringpool.cc: Likewise.
5820 * symtab.cc: Likewise.
5821 * symtab.h: Likewise.
5822 * target.cc: Likewise.
5823 * timer.cc: Likewise.
5824 * timer.h: Likewise.
5825 * version.cc: Likewise.
5826 * x86_64.cc: Likewise.
5827
5828 2010-08-24 Nick Clifton <nickc@redhat.com>
5829
5830 PR 11899
5831 * layout.cc (segment_precedes): Sort segments by their physical
5832 addresses, if they have been set.
5833
5834 2010-08-23 Cary Coutant <ccoutant@google.com>
5835
5836 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5837 symbols data.
5838 (Lib_group::include_member): Unlock object after deleting its
5839 symbols data.
5840 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5841 the bug fixed here.
5842
5843 2010-08-19 Neil Vachharajani <nvachhar@google.com>
5844 Cary Coutant <ccoutant@google.com>
5845
5846 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5847 constructor, and set_blocker.
5848 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5849 readsyms_blocker_.
5850 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5851 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5852 * testsuite/Makefile.am (start_lib_test): New test case.
5853 * testsuite/Makefile.in: Regenerate.
5854 * testsuite/start_lib_test_main.c: New file.
5855 * testsuite/start_lib_test_1.c: New file.
5856 * testsuite/start_lib_test_2.c: New file.
5857 * testsuite/start_lib_test_3.c: New file.
5858
5859 2010-08-19 Ian Lance Taylor <iant@google.com>
5860
5861 * Makefile.in: Rebuild with automake 1.11.1.
5862 * aclocal.m4: Likewise.
5863 * testsuite/Makefile.in: Likewise.
5864
5865 2010-08-19 Ian Lance Taylor <iant@google.com>
5866
5867 PR 10893
5868 * i386.cc (class Output_data_plt_i386): Update declarations.
5869 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5870 local_ifuncs_ fields.
5871 (Target_i386::do_plt_section_for_global): New function.
5872 (Target_i386::do_plt_section_for_local): New function.
5873 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5874 parameter; change all callers. Initialize global_ifuncs_ and
5875 local_ifuncs_. If doing a static link define __rel_iplt_start and
5876 __rel_iplt_end.
5877 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5878 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5879 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5880 symbols.
5881 (Target_i386::make_plt_section): New function, broken out of
5882 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5883 (Target_i386::make_plt_entry): Call make_plt_section.
5884 (Target_i386::make_local_ifunc_plt_entry): New function.
5885 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5886 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5887 R_386_IRELATIVE to switch.
5888 (Target_i386::Scan::global): Likewise.
5889 (Target_i386::Relocate::relocate): Likewise.
5890 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5891 switch.
5892 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5893 (Target_x86_64::do_plt_section_for_global): New function.
5894 (Target_x86_64::do_plt_section_for_local): New function.
5895 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5896 parameter; change all callers. If doing a static link define
5897 __rela_iplt_start and __rela_iplt_end.
5898 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5899 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5900 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5901 to point to .plt.
5902 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5903 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5904 switch.
5905 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5906 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5907 R_X86_64_IRELATIVE to switch.
5908 (Target_x86_64::Scan::global): Likewise.
5909 (Target_x86_64::Relocate::relocate): Likewise.
5910 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5911 switch.
5912 * target.h (class Target): Add plt_section_for_global and
5913 plt_section_for_local functions. Add do_plt_section_for_global
5914 and do_plt_section_for_local virtual functions.
5915 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5916 clarifying comments.
5917 (Symbol::use_plt_offset): Handle IFUNC symbol.
5918 * object.cc (Sized_relobj::Sized_relobj): Initialize
5919 local_plt_offsets_.
5920 (Sized_relobj::local_has_plt_offset): New function.
5921 (Sized_relobj::local_plt_offset): New function.
5922 (Sized_relobj::set_local_plt_offset): New function.
5923 (Sized_relobj::do_count): Handle IFUNC symbol.
5924 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5925 a bit away from input_shndx_ field. Add set_is_func_symbol and
5926 is_ifunc_symbol functions.
5927 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5928 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5929 local_plt_offsets_ field.
5930 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5931 * output.h (class Output_section_data): Add non-const
5932 output_section function.
5933 (class Output_data_got): Update declarations.
5934 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5935 Add use_plt_offset parameter to global and local constructors.
5936 Change all callers. Change local_sym_index_ field to 31 bits.
5937 Change GSYM_CODE and CONSTANT_CODE accordingly.
5938 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5939 doing a static link don't set sh_link field.
5940 (Output_data_got::Got_entry::write): Use PLT offset if
5941 appropriate.
5942 (Output_data_got::add_global_plt): New function.
5943 (Output_data_got::add_local_plt): New function.
5944 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5945 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5946 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5947 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5948 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5949 IFUNC conditional.
5950 * testsuite/ifunc-sel.h: New file.
5951 * testsuite/ifuncmain1.c: New file.
5952 * testsuite/ifuncmain1vis.c: New file.
5953 * testsuite/ifuncmod1.c: New file.
5954 * testsuite/ifuncdep2.c: New file.
5955 * testsuite/ifuncmain2.c: New file.
5956 * testsuite/ifuncmain3.c: New file.
5957 * testsuite/ifuncmod3.c: New file.
5958 * testsuite/ifuncmain4.c: New file.
5959 * testsuite/ifuncmain5.c: New file.
5960 * testsuite/ifuncmod5.c: New file.
5961 * testsuite/ifuncmain6pie.c: New file.
5962 * testsuite/ifuncmod6.c: New file.
5963 * testsuite/ifuncmain7.c: New file.
5964 * configure, testsuite/Makefile.in: Rebuild.
5965
5966 2010-08-18 Ian Lance Taylor <iant@google.com>
5967
5968 * incremental.cc
5969 (Output_section_incremental_inputs::write_input_files): Add cast
5970 to avoid signed/unsigned comparison warning.
5971 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5972
5973 2010-08-12 Cary Coutant <ccoutant@google.com>
5974
5975 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5976
5977 2010-08-13 Ian Lance Taylor <iant@google.com>
5978
5979 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5980
5981 2010-08-12 Cary Coutant <ccoutant@google.com>
5982 Doug Kwan <dougkwan@google.com>
5983
5984 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5985 defintion overrides non-weak undef, remember that the original undef
5986 is not weak.
5987 * symtab.cc (Symbol_table::sized_write_global): For undef without
5988 an original weak binding, set binding to global in output.
5989 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5990 * testsuite/Makefile.in: Regenerate.
5991 * testsuite/strong_ref_weak_def.sh: New file.
5992 * testsuite/strong_ref_weak_def_1.c: Ditto.
5993 * testsuite/strong_ref_weak_def_2.c: Ditto.
5994
5995 2010-08-12 Cary Coutant <ccoutant@google.com>
5996
5997 * testsuite/incremental_test.sh: Rewrite.
5998 * testsuite/incremental_test_1.c: Rewrite.
5999 * testsuite/incremental_test_2.c: Rewrite.
6000
6001 2010-08-12 Cary Coutant <ccoutant@google.com>
6002
6003 * arm.cc (Target_arm::got_size): Add const.
6004 (Target_arm::got_entry_count): New function.
6005 (Target_arm::plt_entry_count): New function.
6006 (Target_arm::first_plt_entry_offset): New function.
6007 (Target_arm::plt_entry_size): New function.
6008 (Output_data_plt_arm::entry_count): New function.
6009 (Output_data_plt_arm::first_plt_entry_offset): New function.
6010 (Output_data_plt_arm::get_plt_entry_size): New function.
6011 * i386.cc (Target_i386::got_size): Add const.
6012 (Target_i386::got_entry_count): New function.
6013 (Target_i386::plt_entry_count): New function.
6014 (Target_i386::first_plt_entry_offset): New function.
6015 (Target_i386::plt_entry_size): New function.
6016 (Output_data_plt_i386::entry_count): New function.
6017 (Output_data_plt_i386::first_plt_entry_offset): New function.
6018 (Output_data_plt_i386::get_plt_entry_size): New function.
6019 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6020 find_incremental_inputs_sections. Dump incremental_got_plt section.
6021 * incremental.cc: Include target.h.
6022 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6023 parameter. Adjust all callers. Find incremental_got_plt section.
6024 (Incremental_inputs::create_data_sections): Create incremental_got_plt
6025 section.
6026 (Output_section_incremental_inputs::set_final_data_size): Calculate
6027 size of incremental_got_plt section.
6028 (Output_section_incremental_inputs::do_write): Write the
6029 incremental_got_plt section.
6030 (Got_plt_view_info): New struct.
6031 (Local_got_offset_visitor): New class.
6032 (Global_got_offset_visitor): New class.
6033 (Global_symbol_visitor_got_plt): New class.
6034 (Output_section_incremental_inputs::write_got_plt): New function.
6035 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6036 Add parameter. Adjust all callers.
6037 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6038 (Incremental_inputs::got_plt_section): New function.
6039 (Incremental_inputs::got_plt_section_): New data member.
6040 (Incremental_got_plt_reader): New class.
6041 * layout.cc (Layout::create_incremental_info_sections): Add the
6042 incremental_got_plt section.
6043 * object.h (Got_offset_list::get_list): New function.
6044 (Got offset_list::for_all_got_offsets): New function.
6045 (Sized_relobj::local_got_offset_list): New function.
6046 * powerpc.cc (Target_powerpc::got_size): Add const.
6047 (Target_powerpc::got_entry_count): New function.
6048 (Target_powerpc::plt_entry_count): New function.
6049 (Target_powerpc::first_plt_entry_offset): New function.
6050 (Target_powerpc::plt_entry_size): New function.
6051 (Output_data_plt_powerpc::entry_count): New function.
6052 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6053 (Output_data_plt_powerpc::get_plt_entry_size): New function.
6054 * sparc.cc (Target_sparc::got_size): Add const.
6055 (Target_sparc::got_entry_count): New function.
6056 (Target_sparc::plt_entry_count): New function.
6057 (Target_sparc::first_plt_entry_offset): New function.
6058 (Target_sparc::plt_entry_size): New function.
6059 (Output_data_plt_sparc::entry_count): New function.
6060 (Output_data_plt_sparc::first_plt_entry_offset): New function.
6061 (Output_data_plt_sparc::get_plt_entry_size): New function.
6062 * symtab.h (Symbol::got_offset_list): New function.
6063 (Symbol_table::for_all_symbols): New function.
6064 * target.h (Sized_target::got_entry_count): New function.
6065 (Sized_target::plt_entry_count): New function.
6066 (Sized_target::plt_entry_size): New function.
6067 * x86_64.cc (Target_x86_64::got_size): Add const.
6068 (Target_x86_64::got_entry_count): New function.
6069 (Target_x86_64::plt_entry_count): New function.
6070 (Target_x86_64::first_plt_entry_offset): New function.
6071 (Target_x86_64::plt_entry_size): New function.
6072 (Output_data_plt_x86_64::entry_count): New function.
6073 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6074 (Output_data_plt_x86_64::get_plt_entry_size): New function.
6075
6076 2010-08-12 Cary Coutant <ccoutant@google.com>
6077
6078 * archive.cc: Include incremental.h.
6079 (Archive::Archive): Initialize incremental_info_.
6080 (Archive::include_member): Record archive members in incremental info.
6081 (Add_archive_symbols::run): Record begin and end of an archive in
6082 incremental info.
6083 (Lib_group::include_member): Record objects in incremental info.
6084 * archive.h (Incremental_archive_entry): Forward declaration.
6085 (Archive::set_incremental_info): New member function.
6086 (Archive::incremental_info): New member function.
6087 (Archive::Unused_symbol_iterator): New class.
6088 (Archive::unused_symbols_begin): New member function.
6089 (Archive::unused_symbols_end): New member function.
6090 (Archive::incremental_info_): New data member.
6091 * incremental-dump.cc (find_input_containing_global): New function.
6092 (dump_incremental_inputs): Dump new incremental info sections.
6093 * incremental.cc: Include symtab.h.
6094 (Output_section_incremental_inputs): New class.
6095 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6096 new incremental info sections.
6097 (Sized_incremental_binary::do_check_inputs): Likewise.
6098 (Incremental_inputs::report_archive): Remove.
6099 (Incremental_inputs::report_archive_begin): New function.
6100 (Incremental_inputs::report_archive_end): New function.
6101 (Incremental_inputs::report_object): New function.
6102 (Incremental_inputs::finalize_inputs): Remove.
6103 (Incremental_inputs::report_input_section): New function.
6104 (Incremental_inputs::report_script): Rewrite.
6105 (Incremental_inputs::finalize): Do nothing but finalize string table.
6106 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6107 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6108 (Incremental_inputs::create_data_sections): New function.
6109 (Incremental_inputs::relocs_entsize): New function.
6110 (Output_section_incremental_inputs::set_final_data_size): New function.
6111 (Output_section_incremental_inputs::do_write): New function.
6112 (Output_section_incremental_inputs::write_header): New function.
6113 (Output_section_incremental_inputs::write_input_files): New function.
6114 (Output_section_incremental_inputs::write_info_blocks): New function.
6115 (Output_section_incremental_inputs::write_symtab): New function.
6116 * incremental.h (Incremental_script_entry): Forward declaration.
6117 (Incremental_object_entry): Forward declaration.
6118 (Incremental_archive_entry): Forward declaration.
6119 (Incremental_inputs): Forward declaration.
6120 (Incremental_inputs_header_data): Remove.
6121 (Incremental_inputs_header): Remove.
6122 (Incremental_inputs_header_write): Remove.
6123 (Incremental_inputs_entry_data): Remove.
6124 (Incremental_inputs_entry): Remove.
6125 (Incremental_inputs_entry_write): Remove.
6126 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6127 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6128 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6129 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6130 Likewise.
6131 (Incremental_input_entry): New class.
6132 (Incremental_script_entry): New class.
6133 (Incremental_object_entry): New class.
6134 (Incremental_archive_entry): New class.
6135 (Incremental_inputs::Incremental_inputs): Initialize new data members.
6136 (Incremental_inputs::report_inputs): Remove.
6137 (Incremental_inputs::report_archive): Remove.
6138 (Incremental_inputs::report_archive_begin): New function.
6139 (Incremental_inputs::report_archive_end): New function.
6140 (Incremental_inputs::report_object): Change prototype.
6141 (Incremental_inputs::report_input_section): New function.
6142 (Incremental_inputs::report_script): Change prototype.
6143 (Incremental_inputs::get_reloc_count): New function.
6144 (Incremental_inputs::set_reloc_count): New function.
6145 (Incremental_inputs::create_data_sections): New function.
6146 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6147 (Incremental_inputs::inputs_section): New function.
6148 (Incremental_inputs::symtab_section): New function.
6149 (Incremental_inputs::relocs_section): New function.
6150 (Incremental_inputs::get_stringpool): Add const.
6151 (Incremental_inputs::command_line): Add const.
6152 (Incremental_inputs::inputs): Remove.
6153 (Incremental_inputs::command_line_key): New function.
6154 (Incremental_inputs::input_file_count): New function.
6155 (Incremental_inputs::input_files): New function.
6156 (Incremental_inputs::relocs_entsize): New function.
6157 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6158 (Incremental_inputs::finalize_inputs): Remove.
6159 (Incremental_inputs::Input_info): Remove.
6160 (Incremental_inputs::lock_): Remove.
6161 (Incremental_inputs::inputs_): Change type.
6162 (Incremental_inputs::inputs_map_): Remove.
6163 (Incremental_inputs::current_object_entry_): New data member.
6164 (Incremental_inputs::inputs_section_): New data member.
6165 (Incremental_inputs::symtab_section_): New data member.
6166 (Incremental_inputs::relocs_section_): New data member.
6167 (Incremental_inputs::reloc_count_): New data member.
6168 (Incremental_inputs_reader): New class.
6169 (Incremental_symtab_reader): New class.
6170 (Incremental_relocs_reader): New class.
6171 * layout.cc (Layout::finalize): Move finalization of incremental info
6172 and creation of incremental info sections to follow finalization of
6173 symbol table. Set offsets for postprocessing sections.
6174 (Layout::create_incremental_info_sections): Call
6175 Incremental_inputs::create_data_sections. Add incremental symtab
6176 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
6177 sections to layout after input sections.
6178 * layout.h (struct Timespec): Forward declaration.
6179 (Layout::incremental_inputs): Add const.
6180 (Layout::create_incremental_info_sections): Add parameter.
6181 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6182 * object.cc: Include incremental.h.
6183 (Relobj::finalize_incremental_relocs): New function.
6184 (Sized_relobj::do_layout): Record input sections in incremental info.
6185 * object.h (Object::output_section): New function.
6186 (Object::output_section_offset): Moved from Relobj.
6187 (Object::get_incremental_reloc_base): New function.
6188 (Object::get_incremental_reloc_count): New function.
6189 (Object::do_output_section): New function.
6190 (Object::do_output_section_offset): Moved from Relobj.
6191 (Object::do_get_incremental_reloc_base): New function.
6192 (Object::do_get_incremental_reloc_count): New function.
6193 (Object::Object): Initialize new data members.
6194 (Relobj::output_section): Renamed do_output_section and moved to
6195 protected.
6196 (Relobj::output_section_offset): Moved to Object.
6197 (Relobj::do_get_incremental_reloc_base): New function.
6198 (Relobj::do_get_incremental_reloc_count): New function.
6199 (Relobj::allocate_incremental_reloc_counts): New function.
6200 (Relobj::count_incremental_reloc): New function.
6201 (Relobj::finalize_incremental_relocs): New function.
6202 (Relobj::next_incremental_reloc_index): New function.
6203 (Relobj::reloc_counts_): New data member.
6204 (Relobj::reloc_bases_): New data member.
6205 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
6206 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
6207 (Sized_relobj::incremental_relocs_scan): New function.
6208 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6209 (Sized_relobj::incremental_relocs_write): New function.
6210 (Sized_relobj::incremental_relocs_write_reltype): New function.
6211 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6212 incremental link.
6213 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6214 archives and object files elsewhere.
6215 (Add_symbols::run): Report object files here.
6216 (Finish_group::run): Report end of archive at end of group.
6217 * reloc.cc: Include layout.h, incremental.h.
6218 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6219 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6220 (Sized_relobj::incremental_relocs_scan): New function.
6221 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6222 (Sized_relobj::do_relocate_sections): Write incremental relocations.
6223 (Sized_relobj::incremental_relocs_write): New function.
6224 (Sized_relobj::incremental_relocs_write_reltype): New function.
6225 * script.cc (read_input_script): Rewrite test for incremental link.
6226 Change call to Incremental_inputs::report_script.
6227 * symtab.h (Symbol_table::first_global_index): New function.
6228 (Symbol_table::output_count): New function.
6229
6230 2010-08-12 Doug Kwan <dougkwan@google.com>
6231
6232 * arm.cc (Target_arm::merge_object_attributes): Check command line
6233 options --no-wchar-size-warning and --no-enum-size-warning.
6234 * options.h (General_options): Add ld-compatible options
6235 --no-enum-size-warning and --no-wchar-size-warning.
6236
6237 2010-08-04 Ian Lance Taylor <iant@google.com>
6238
6239 * x86_64.cc (Target_x86_64::Scan::local): Use
6240 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6241 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6242 (Target_x86_64::Scan::global): Likewise.
6243 (Target_x86_64::Relocate::relocate): Likewise.
6244 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6245 Likewise.
6246
6247 2010-08-03 Cary Coutant <ccoutant@google.com>
6248
6249 * merge.cc (Output_merge_string::do_add_input_section): Count strings
6250 to reserve space in merged_strings vector. Keep total input size
6251 for stats.
6252 (Output_merge_string::do_print_merge_stats): Print total input size.
6253 * merge.h (Output_merge_string): Add input_size_ field.
6254 * stringpool.cc (Stringpool_template::string_length): Move
6255 implementations out of Stringpool_template class and place in
6256 stringpool.h.
6257 * stringpool.h (string_length): Move out of Stringpool_template.
6258
6259 2010-08-03 Ian Lance Taylor <iant@google.com>
6260
6261 PR 11712
6262 * layout.cc (relaxation_loop_body): If address of load segment is
6263 set, adjust address to include headers if possible.
6264
6265 2010-08-03 Ian Lance Taylor <iant@google.com>
6266
6267 * version.cc (version_string): Bump to 1.10.
6268
6269 2010-08-03 Ian Lance Taylor <iant@google.com>
6270
6271 PR 11805
6272 * layout.h (enum Output_section_order): Define.
6273 (class Layout): Update declarations.
6274 * layout.cc (Layout::get_output_section): Add order parameter.
6275 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6276 is_first_non_relro parameters. Change all callers.
6277 (Layout::choose_output_section): Likewise.
6278 (Layout::add_output_section_data): Likewise.
6279 (Layout::make_output_section): Likewise. Set order.
6280 (Layout::default_section_order): New function.
6281 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6282 * output.cc (Output_section::Output_section): Initialize order_.
6283 Don't initialize deleted fields.
6284 (Output_segment::Output_segment): Don't initialize deleted
6285 fields.
6286 (Output_segment::add_output_section_to_load): New function
6287 replacing add_output_section. Change all callers to call this or
6288 add_output_section_to_nonload.
6289 (Output_segment::add_output_section_to_nonload): New function.
6290 (Output_segment::remove_output_section): Rewrite.
6291 (Output_segment::add_initial_output_data): Likewise.
6292 (Output_segment::has_any_data_sections): Likewise.
6293 (Output_segment::is_first_section_relro): Likewise.
6294 (Output_segment::maximum_alignment): Likewise.
6295 (Output_segment::has_dynamic_reloc): New function replacing
6296 dynamic_reloc_count. Change all callers.
6297 (Output_segment::has_dynamic_reloc_list): New function replacing
6298 dynamic_reloc_count_list. Change all callers.
6299 (Output_segment::set_section_addresses): Rewrite.
6300 (Output_segment::set_offset): Rewrite.
6301 (Output_segment::find_first_and_last_list): Remove.
6302 (Output_segment::set_tls_offsets): Rewrite.
6303 (Output_segment::first_section_load_address): Likewise.
6304 (Output_segment::output_section_count): Likewise.
6305 (Output_segment::section_with_lowest_load_address): Likewise.
6306 (Output_segment::write_section_headers): Likewise.
6307 (Output_segment::print_sections_to_map): Likewise.
6308 * output.h (class Output_data): Remove dynamic_reloc_count_
6309 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
6310 (Output_data::add_dynamic_reloc): Rewrite.
6311 (Output_data::has_dynamic_reloc): New function.
6312 (Output_data::dynamic_reloc_count): Remove.
6313 (class Output_section): Add order_ field. Remvoe is_relro_local_,
6314 is_last_relro_, is_first_non_relro_, is_interp_,
6315 is_dynamic_linker_section_ fields. Add order and set_order
6316 functions. Remove is_relro_local, set_is_relro_local,
6317 is_last_relro, set_is_last_relro, is_first_non_relro,
6318 set_is_first_non_relro functions, is_interp, set_is_interp,
6319 is_dynamic_linker_section, and set_is_dynamic_linker_section
6320 functions.
6321 (class Output_segment): Change Output_data_list from std::list to
6322 std:;vector. Add output_lists_ field. Remove output_data_ and
6323 output_bss_ fields. Update declarations.
6324
6325 2010-08-02 Ian Lance Taylor <iant@google.com>
6326
6327 * arm.cc (Target_arm::gc_process_relocs): Use typename.
6328 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6329 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6330
6331 2010-08-02 Ian Lance Taylor <iant@google.com>
6332
6333 PR 11855
6334 * script.cc (Script_options::Script_options): Initialize
6335 symbol_definitions_ and symbol_references_.
6336 (Script_options::add_symbol_assignment): Update
6337 symbol_definitions_ and symbol_references_.
6338 (Script_options::add_symbol_reference): New function.
6339 (script_symbol): New function.
6340 * script.h (class Script_options): Add symbol_definitions_ and
6341 symbol_references_ fields.
6342 (Script_options::referenced_const_iterator): New type.
6343 (Script_options::referenced_begin): New function.
6344 (Script_options::referenced_end): New function.
6345 (Script_options::is_referenced): New function.
6346 (Script_options::any_unreferenced): New function.
6347 * script-c.h (script_symbol): Declare.
6348 * yyscript.y (exp): Call script_symbol.
6349 * symtab.cc: Include "script.h".
6350 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6351 Change all callers. Check symbols referenced by scripts.
6352 (Symbol_table::add_undefined_symbols_from_command_line): Add
6353 layout parameter. Change all callers.
6354 (Symbol_table::do_add_undefined_symbols_from_command_line):
6355 Likewise. Break out loop body. Check symbols referenced by
6356 scripts.
6357 (Symbol_table::add_undefined_symbol_from_command_line): New
6358 function broken out of
6359 do_add_undefined_symbols_from_command_line.
6360 * symtab.h (class Symbol_table): Update declarations.
6361 * archive.cc: Include "layout.h".
6362 (Archive::should_include_member): Add layout parameter. Change
6363 all callers. Check for symbol mentioned in expression.
6364 * archive.h (class Archive): Update declaration.
6365 * object.cc (Sized_relobj::do_should_include_member): Add layout
6366 parameter.
6367 * object.h (Object::should_include_member): Add layout parameter.
6368 Change all callers.
6369 (Object::do_should_include_member): Add layout parameter.
6370 (class Sized_relobj): Update declaration.
6371 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6372 parameter.
6373 * dynobj.h (class Sized_dynobj): Update declaration.
6374 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6375 layout parameter.
6376 * plugin.h (class Sized_pluginobj): Update declaration.
6377
6378 2010-08-02 Ian Lance Taylor <iant@google.com>
6379
6380 PR 11866
6381 * output.cc (Output_segment::set_offset): Search for the first and
6382 last sections rather than assuming that the list is in order.
6383 (Output_segment::find_first_and_last_list): New function.
6384 * output.h (class Output_segment): Update declarations.
6385 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6386 (relro_strip_test_SOURCES): New variable.
6387 (relro_strip_test_DEPENDENCIES): New variable.
6388 (relro_strip_test_LDFLAGS): New variable.
6389 (relro_strip_test_LDADD): New variable.
6390 (relro_strip_test.so): New target.
6391
6392 2010-08-02 Ian Lance Taylor <iant@google.com>
6393
6394 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6395 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6396 (Target_i386::got_tlsdesc_section): New function.
6397 (Target_i386::got_section): Create space for GOT entries for
6398 TLSDESC relocations.
6399 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6400 R_386_TLS_GOTDESC.
6401 (Target_i386::Scan::global): Likewise.
6402 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6403 using TLSDESC GOT.
6404 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6405 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6406 (Target_x86_64::got_tlsdesc_section): New function.
6407 (Target_x86_64::got_section): Create space for GOT entries for
6408 TLSDESC relocations.
6409 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6410 R_386_TLS_GOTDESC.
6411 (Target_x86_64::Scan::global): Likewise.
6412 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6413 using TLSDESC GOT.
6414
6415 2010-08-02 Ian Lance Taylor <iant@google.com>
6416
6417 * testsuite/final_layout.sh: Use dc to convert from hex to
6418 decimal.
6419
6420 2010-07-29 Sriraman Tallam <tmsriram@google.com>
6421
6422 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6423 paramter to the call to gold::gc_process_relocs.
6424 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6425 paramter to the call to gold::gc_process_relocs.
6426 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6427 parameter to the call to gold::gc_process_relocs.
6428 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6429 template parameter to the call to gold::gc_process_relocs.
6430 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6431 paramter to the call to gold::gc_process_relocs.
6432 * gc.h (get_embedded_addend_size): New function.
6433 (gc_process_relocs): Save the size of the reloc for use by ICF.
6434 * icf.cc (get_section_contents): Get the addend from the text section
6435 for SHT_REL relocation sections.
6436 * icf.h (Icf::Reloc_addend_size_info): New typedef.
6437 (Icf::Reloc_info): Add new member reloc_addend_size_info.
6438 * int_encoding.h (read_from_pointer): New overloaded function.
6439 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6440 * testsuite/icf_sht_rel_addend_test.sh: New file.
6441 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6442 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6443
6444 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6445
6446 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6447 * Makefile.in: Regenerate.
6448 * testsuite/Makefile.in: Regenerate.
6449
6450 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
6451
6452 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6453 * gold/testsuite/debug_msg.cc: Likewise.
6454 * gold/testsuite/odr_violation1.cc
6455 * gold/testsuite/odr_violation2.cc
6456
6457 2010-07-21 Cary Coutant <ccoutant@google.com>
6458
6459 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6460 string, and length fields.
6461 (Output_merge_string::Merged_strings_list): New type.
6462 (Output_merge_string::Merged_strings_lists): New typedef.
6463 (Output_merge_string): Replace merged_strings_ with
6464 merged_strings_lists_.
6465 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6466 Merged_strings_list per input object and section. Don't store pointer
6467 to the string. Don't store length with each merged string entry.
6468 (Output_merge_string::finalize_merged_data): Loop over list of merged
6469 strings lists. Recompute length of each merged string.
6470
6471 2010-07-15 Cary Coutant <ccoutant@google.com>
6472
6473 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6474 here.
6475
6476 2010-07-14 Ian Lance Taylor <iant@google.com>
6477
6478 * descriptors.cc (Descriptors::open): Report correct name in error
6479 message.
6480
6481 2010-07-13 Doug Kwan <dougkwan@google.com>
6482
6483 * arm.cc (Arm_input_section::Arm_input_section): For a
6484 SHT_ARM_EXIDX section, always keeps the input sections.
6485 (Arm_input_section::set_exidx_section_link): New method.
6486 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6487 has_errors_ to false.
6488 (Arm_exidx_input_section::has_errors,
6489 Arm_exidx_input_section::set_has_errors): New methods.
6490 (Arm_exidx_input_section::has_errors_): New data member.
6491 (Arm_relobj::get_exidx_shndx_list): New method.
6492 (Arm_output_section::append_text_sections_to_list): Do not skip
6493 section without SHF_EXECINSTR.
6494 (Arm_output_section::fix_exidx_coverage): Skip input sections with
6495 errors.
6496 (Arm_relobj::make_exidx_input_section): Add new parameter for text
6497 section header. Make error messages more verbose. Check for
6498 a non-executable section linked to an EXIDX section.
6499 (Arm_relobj::do_read_symbols): Remove error checking, which has been
6500 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
6501 check that there is no deferred EXIDX section if we exit early.
6502 Instead of not making an EXIDX section in case of an error, make one
6503 and set the has_errors flag of it.
6504 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6505 in a relocatable link.
6506 (Target_arm::do_relax): Look for the EXIDX output section instead of
6507 assuming that it is called .ARM.exidx.
6508 (Target_arm::fix_exidx_coverage): Add a new parameter for input
6509 section list. Do not check for SHF_EXECINSTR section flags but
6510 skip any input section with errors.
6511 * output.cc (Output_section::Output_section): Initialize
6512 always_keeps_input_sections_ to false.
6513 (Output_section::add_input_section): Check for
6514 always_keeps_input_sections_.
6515 * output.h (Output_section::always_keeps_input_sections,
6516 Output_section::set_always_keeps_input_sections): New methods.
6517 (Output_section::always_keeps_input_sections): New data member.
6518
6519 2010-07-13 Rafael Espindola <espindola@google.com>
6520
6521 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6522 * fileread.h (Input_file): Add try_extra_search_path and find_file.
6523
6524 2010-07-13 Philip Herron <herron.philip@googlemail.com>
6525 Ian Lance Taylor <iant@google.com>
6526
6527 * output.h (Output_section_lookup_maps::add_merge_section):
6528 Correct check of whether value was inserted.
6529 (Output_section_lookup_maps::add_merge_input_section): Likewise.
6530 (Output_section_lookup_maps::add_relaxed_input_section):
6531 Likewise.
6532 * arm.cc (Target_arm::got_section): Remove used local os.
6533 * i386.cc (Target_i386::got_section): Likewise.
6534 * x86_64.cc (Target_x86_64::got_section): Likewise.
6535 * sparc.cc (Target_sparc::got_section): Likewise.
6536 (Target_sparc::relocate): Remove unused local have_got_offset.
6537 * powerpc.cc (Target_powerpc::relocate): Likewise.
6538
6539 2010-07-13 Ian Lance Taylor <iant@google.com>
6540
6541 * compressed_output.cc (zlib_decompress): Fix signature in
6542 !HAVE_ZLIB_H case.
6543
6544 * archive.cc (Archive::include_member): Unlock an external member
6545 of a thin archive. Don't bother to delete an object we know is
6546 NULL.
6547
6548 2010-07-12 Cary Coutant <ccoutant@google.com>
6549
6550 * compressed_output.cc (zlib_decompress): New function.
6551 (get_uncompressed_size): New function.
6552 (decompress_input_section): New function.
6553 * compressed_output.h (get_uncompressed_size): New function.
6554 (decompress_input_section): New function.
6555 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6556 Handle compressed debug sections.
6557 * layout.cc (is_compressed_debug_section): New function.
6558 (Layout::output_section_name): Map compressed section names to
6559 canonical names.
6560 * layout.h (is_compressed_debug_section): New function.
6561 (is_debug_info_section): Recognize compressed debug sections.
6562 * merge.cc: Include compressed_output.h.
6563 (Output_merge_data::do_add_input_section): Handle compressed
6564 debug sections.
6565 (Output_merge_string::do_add_input_section): Handle compressed
6566 debug sections.
6567 * object.cc: Include compressed_output.h.
6568 (Sized_relobj::Sized_relobj): Initialize new data members.
6569 (build_compressed_section_map): New function.
6570 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6571 * object.h (Object::section_is_compressed): New method.
6572 (Object::do_section_is_compressed): New method.
6573 (Sized_relobj::Compressed_section_map): New type.
6574 (Sized_relobj::do_section_is_compressed): New method.
6575 (Sized_relobj::compressed_sections_): New data member.
6576 * output.cc (Output_section::add_input_section): Handle compressed
6577 debug sections.
6578 * reloc.cc: Include compressed_output.h.
6579 (Sized_relobj::write_sections): Handle compressed debug sections.
6580
6581 2010-07-08 Cary Coutant <ccoutant@google.com>
6582
6583 * resolve.cc (Symbol_table::resolve): Remember whether undef was
6584 weak when resolving to a dynamic def.
6585 (Symbol_table::should_override): Add adjust_dyndef flag; set it
6586 for weak undef/dynamic def cases. Adjust callers.
6587 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6588 undef_binding_weak_.
6589 (Symbol_table::sized_write_globals): Adjust symbol binding.
6590 (Symbol_table::sized_write_symbol): Add binding parameter.
6591 * symtab.h (Symbol::set_undef_binding): New method.
6592 (Symbol::is_undef_binding_weak): New method.
6593 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6594 (Symbol_table::should_override): Add new parameter.
6595 (Symbol_table::sized_write_symbol): Add new parameter.
6596
6597 * testsuite/weak_undef_file1.cc: Add new test case.
6598 * testsuite/weak_undef_file2.cc: Fix header comment.
6599 * testsuite/weak_undef_test.cc: Add new test case.
6600
6601 2010-06-29 Doug Kwan <dougkwan@google.com>
6602
6603 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6604 Initialize USE_SYMBOL_.
6605 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6606 definition.
6607 (Arm_reloc_property::uses_symbol_): New data member declaration.
6608 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6609 uses symbol value and symbol is undefined but not weakly undefined.
6610
6611 2010-06-28 Rafael Espindola <espindola@google.com>
6612
6613 * plugin.cc (Plugin::load): Use dlerror.
6614
6615 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
6616
6617 * symtab.cc (detect_odr_violations): When reporting an ODR
6618 violation, report an object where the symbol is defined.
6619
6620 2010-06-25 Doug Kwan <dougkwan@google.com>
6621
6622 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6623 (Target_arm::section_may_have_icf_unsafe_pointers): New method
6624 definition.
6625 (Target_arm::Scan::local_reloc_may_be_function_pointer,
6626 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6627 target hook to detect function points.
6628 (Target_arm::Scan::possible_function_pointer_reloc): New method.
6629 * icf.h (Icf::check_section_for_function_pointers): Change type of
6630 parameter SECTION_NAME to const reference to std::string. Use
6631 target hook to determine if section may have unsafe pointers.
6632 * target.h (Target::section_may_have_icf_unsafe_pointers): New
6633 method definition.
6634
6635 2010-06-21 Rafael Espindola <espindola@google.com>
6636
6637 * fileread.cc (Input_file::find_fie): New
6638 (Input_file::open): Use Input_file::find_fie.
6639 * fileread.h (Input_file::find_fie): New
6640 * plugin.cc (set_extra_library_path): New.
6641 (Plugin::load): Add set_extra_library_path to the transfer vector.
6642 (Plugin_manager::set_extra_library_path): New.
6643 (Plugin_manager::add_input_file): Use the extra search path if set.
6644 (set_extra_library_path(): New.
6645 * plugin.h (Plugin_manager): Add set_extra_library_path and
6646 extra_search_path_.
6647
6648 2010-06-19 Cary Coutant <ccoutant@google.com>
6649
6650 * layout.cc (gdb_sections): Add .debug_types.
6651 (lines_only_debug_sections): Likewise.
6652
6653 2010-06-18 Rafael Espindola <espindola@google.com>
6654
6655 * plugin.cc (add_input_file,add_input_library)
6656 (Plugin_manager::add_input_file): Make filename arguments const.
6657 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6658 const.
6659
6660 2010-06-16 Doug Kwan <dougkwan@google.com>
6661
6662 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6663 .ARM.attributes section if we have not merged any input
6664 attributes sections.
6665
6666 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6667
6668 * arm.cc: Allow combining objects with no EABI version
6669 information.
6670
6671 2010-06-15 Rafael Espindola <espindola@google.com>
6672
6673 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6674
6675 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6676
6677 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6678 (struct iovec): Correct !HAVE_READV definition.
6679
6680 2010-06-10 Cary Coutant <ccoutant@google.com>
6681
6682 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6683 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6684 reloc sections.
6685 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6686
6687 PR 11683
6688 * symtab.h (Symbol::is_placeholder): New member function.
6689 * target-reloc.h (relocate_section): Check for placeholder symbols.
6690
6691 * testsuite/Makefile.am (plugin_test_8): New test.
6692 (plugin_test_9): New test.
6693 * testsuite/Makefile.in: Regenerate.
6694
6695 2010-06-09 Nick Clifton <nickc@redhat.com>
6696
6697 * yyscript.y (input_list_element): Allow strings prefixed with
6698 the '-' character. Treat these as libraries.
6699 * script.cc (script_add_library): New function. Adds a library
6700 specified by "-l<name>" found in an input script.
6701 * script-c.h: Add prototype for script_add_library.
6702
6703 2010-06-07 Doug Kwan <dougkwan@google.com>
6704
6705 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6706 Restrict stub-group size to be within long conditional branch
6707 range when working around cortex-A8 erratum.
6708
6709 2010-06-07 Damien Diederen <dd@crosstwine.com>
6710
6711 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6712 #ifdef typo.
6713
6714 2010-06-03 Sriraman Tallam <tmsriram@google.com>
6715
6716 PR gold/11658
6717 * output.cc
6718 (Output_section::Input_section_sort_entry::compare_section_ordering):
6719 Change to return non-zero correctly.
6720 (Output_section::Input_section_sort_section_order_index_compare
6721 ::operator()): Change to fix ambiguity in comparisons.
6722
6723 2010-06-01 Sriraman Tallam <tmsriram@google.com>
6724
6725 * gold.h (is_wildcard_string): New function.
6726 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6727 (Layout::layout_eh_frame): Ditto.
6728 (Layout::find_section_order_index): New method.
6729 (Layout::read_layout_from_file): New method.
6730 * layout.h (Layout::find_section_order_index): New method.
6731 (Layout::read_layout_from_file): New method.
6732 (Layout::input_section_position_): New private member.
6733 (Layout::input_section_glob_): New private member.
6734 * main.cc (main): Call read_layout_from_file here.
6735 * options.h (--section-ordering-file): New option.
6736 * output.cc (Output_section::input_section_order_specified_): New
6737 member.
6738 (Output_section::Output_section): Initialize new member.
6739 (Output_section::add_input_section): Add new parameter.
6740 Keep input sections when --section-ordering-file is used.
6741 (Output_section::set_final_data_size): Sort input sections when
6742 section ordering file is specified.
6743 (Output_section::Input_section_sort_entry): Add new parameter.
6744 Check sorting type.
6745 (Output_section::Input_section_sort_entry::compare_section_ordering):
6746 New method.
6747 (Output_section::Input_section_sort_compare::operator()): Change to
6748 consider section_order_index.
6749 (Output_section::Input_section_sort_init_fini_compare::operator()):
6750 Change to consider section_order_index.
6751 (Output_section::Input_section_sort_section_order_index_compare
6752 ::operator()): New method.
6753 (Output_section::sort_attached_input_sections): Change to sort
6754 according to section order when specified.
6755 (Output_section::add_input_section<32, true>): Add new parameter.
6756 (Output_section::add_input_section<64, true>): Add new parameter.
6757 (Output_section::add_input_section<32, false>): Add new parameter.
6758 (Output_section::add_input_section<64, false>): Add new parameter.
6759 * output.h (Output_section::add_input_section): Add new parameter.
6760 (Output_section::input_section_order_specified): New
6761 method.
6762 (Output_section::set_input_section_order_specified): New method.
6763 (Input_section::Input_section): Initialize section_order_index_.
6764 (Input_section::section_order_index): New method.
6765 (Input_section::set_section_order_index): New method.
6766 (Input_section::section_order_index_): New member.
6767 (Input_section::Input_section_sort_section_order_index_compare): New
6768 struct.
6769 (Output_section::input_section_order_specified_): New member.
6770 * script-sections.cc (is_wildcard_string): Delete and move modified
6771 method to gold.h.
6772 (Output_section_element_input::Output_section_element_input): Modify
6773 call to is_wildcard_string.
6774 (Output_section_element_input::Input_section_pattern
6775 ::Input_section_pattern): Ditto.
6776 (Output_section_element_input::Output_section_element_input): Ditto.
6777 * testsuite/Makefile.am (final_layout): New test case.
6778 * testsuite/Makefile.in: Regenerate.
6779 * testsuite/final_layout.cc: New file.
6780 * testsuite/final_layout.sh: New file.
6781
6782 2010-06-01 Rafael Espindola <espindola@google.com>
6783
6784 * plugin.cc (Plugin::load): Pass the output name to the plugin.
6785
6786 2010-06-01 Rafael Espindola <espindola@google.com>
6787
6788 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6789 visibility of symbols.
6790
6791 2010-05-27 Doug Kwan <dougkwan@google.com>
6792
6793 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6794 from start of output section instead of address for a local symbol
6795 in a merged or relaxed section when doing a relocatable link.
6796
6797 2010-05-26 Rafael Espindola <espindola@google.com>
6798
6799 PR 11604
6800 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6801 adding sections the garbage collector removed.
6802 * gold/testsuite/Makefile.am: Add test.
6803 * gold/testsuite/Makefile.in: Regenerate.
6804 * gold/testsuite/plugin_test_7.sh: New.
6805 * gold/testsuite/plugin_test_7_1.c: New.
6806 * gold/testsuite/plugin_test_7_2.c: New.
6807
6808 2010-05-26 Rafael Espindola <espindola@google.com>
6809
6810 * script-sections.cc (Output_section_definition::set_section_addresses):
6811 Check for --section-start.
6812
6813 2010-05-26 Doug Kwan <dougkwan@google.com>
6814
6815 * arm.cc (Arm_scan_relocatable_relocs): New class.
6816 (Target_arm::relocate_special_relocatable): New method.
6817 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6818 (Arm_relocate_functions::thumb_branch_common): Same.
6819 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6820 instead of Default_scan_relocatable_relocs.
6821 * target-reloc.h (relocate_for_relocatable): Let target handle
6822 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6823 * target.h (Sized_target::relocate_special_relocatable): New method.
6824
6825 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6826
6827 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6828
6829 2010-05-23 Doug Kwan <dougkwan@google.com>
6830
6831 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6832 instead of a cast.
6833 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6834 with a direct branch, not a conditional branch, to a stub.
6835 * merge.cc (Output_merge_base::record_input_section): New method
6836 defintion.
6837 (Output_merge_data::do_add_input_section): Record input section if
6838 keeps-input-sections flag is set.
6839 (Output_merge_string::do_add_input_section): Ditto.
6840 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6841 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6842 INPUT_SECTIONS_.
6843 (Output_merge_base::keeps_input_sections,
6844 Output_merge_base::set_keeps_input_sections,
6845 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6846 method definitions.
6847 (Output_merge_base::Input_sections): New type declaration.
6848 (Output_merge_base::input_sections_begin,
6849 Output_merge_base::input_sections_end,
6850 Output_merge_base::do_set_keeps_input_sections): New method definitions.
6851 (Output_merge_base::bool keeps_input_sections_,
6852 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6853 Output_merge_base::input_sections_): New data members.
6854 (Output_merge_data::do_set_keeps_input_sections): New method
6855 defintion.
6856 (Output_merge_string::do_set_keeps_input_sections): Ditto.
6857 * output.cc (Output_section::Input_section::relobj): Move method
6858 defintion from class declaration to here and handle merge sections.
6859 (Output_section::Input_section::shndx): Ditto.
6860 (Output_section::Output_section): Remove initializations of removed
6861 data members and initialize new data member LOOKUP_MAPS_.
6862 (Output_section::add_input_section): Set keeps-input-sections flag
6863 for a newly created merge output section as appropriate. Adjust code
6864 to use Output_section_lookup_maps class.
6865 (Output_section::add_relaxed_input_section): Adjst code for lookup
6866 maps code refactoring.
6867 (Output_section::add_merge_input_section): Add a new parameter
6868 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6869 class. If adding input section to a newly created merge output
6870 section fails, remove the new merge section.
6871 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6872 Adjust code for use of the Output_section_lookup_maps class.
6873 (Output_section::find_merge_section): Ditto.
6874 (Output_section::build_lookup_maps): New method defintion.
6875 (Output_section::find_relaxed_input_section): Adjust code to use
6876 Output_section_lookup_maps class.
6877 (Output_section::get_input_sections): Export merge sections. Adjust
6878 code to use Output_section_lookup_maps class.
6879 (Output_section:::add_script_input_section): Adjust code to use
6880 Output_section_lookup_maps class. Update lookup maps for merge
6881 sections also.
6882 (Output_section::discard_states): Use Output_section_lookup_maps.
6883 (Output_section::restore_states): Same.
6884 * output.h (Merge_section_properties): Move class defintion out of
6885 Output_section.
6886 (Output_section_lookup_maps): New class.
6887 (Output_section::Input_section::is_merge_section): New method
6888 defintion.
6889 (Output_section::Input_section::relobj): Move defintion out of class
6890 defintion. Declare method only.
6891 (Output_section::Input_section::shndx): Ditto.
6892 (Output_section::Input_section::output_merge_base): New method defintion.
6893 (Output_section::Input_section::u2_.pomb): New union field.
6894 (Output_section::Merge_section_by_properties_map,
6895 Output_section::Output_section_data_by_input_section_map,
6896 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6897 Remove types.
6898 (Output_section::add_merge_input_section): Add new parameter
6899 KEEPS_INPUT_SECTIONS.
6900 (Output_section::build_lookup_maps): New method declaration.
6901 (Output_section::merge_section_map_,
6902 Output_section::merge_section_by_properties_map_,
6903 Output_section::relaxed_input_section_map_,
6904 Output_section::is_relaxed_input_section_map_valid_): Remove data
6905 members.
6906 (Output_section::lookup_maps_): New data member.
6907
6908 2010-05-21 Doug Kwan <dougkwan@google.com>
6909
6910 PR gold/11619
6911 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6912 avoid a compilation error.
6913
6914 2010-05-19 Rafael Espindola <espindola@google.com>
6915
6916 * script-sections.cc (Output_section_definition::allocate_to_segment):
6917 Update the phdrs_list even when the output section is NULL.
6918 * testsuite/Makefile.am: Add test.
6919 * testsuite/Makefile.in: Regenerate.
6920 * testsuite/script_test_9.cc: New.
6921 * testsuite/script_test_9.sh: New.
6922 * testsuite/script_test_9.t: New.
6923
6924 2010-05-19 Doug Kwan <dougkwan@google.com>
6925
6926 * arm.cc (Arm_input_section::original_size): New method.
6927 (Arm_input_section::do_addralign): Add a cast.
6928 (Arm_input_section::do_output_offset): Remove static cast.
6929 (Arm_input_section::original_addralign,
6930 Arm_input_section::original_size_): Change type to uint32_t.
6931 (Arm_input_section::init): Add safe casts for section alignment
6932 and size.
6933 (Arm_input_section::set_final_data_size): Do not set address and
6934 offset of stub table.
6935 (Arm_output_section::fix_exidx_coverage): Change use of of
6936 Output_section::Simple_input_section to that of
6937 Output_section::Input_section.
6938 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6939 except for the first pass.
6940 * output.cc (Output_section::get_input_sections): Change type of
6941 input_sections to std::list<Input_section>.
6942 (Output_section::add_script_input_section): Rename from
6943 Output_section::add_simple_input_section. Change type of SIS
6944 parameter from Simple_input_section to Input_section.
6945 * output.h (Output_section::Simple_input_section): Remove class.
6946 (Output_section::Input_section): Change class visibility to public.
6947 (Output_section::Input_section::addralign): Use stored alignments
6948 for special input sections if set.
6949 (Output_section::Input_section::set_addralign): New method.
6950 (Output_section::get_input_sections): Change parameter type from
6951 list of Simple_input_section to list of Input_section.
6952 (Output_section::add_script_input_section): Rename from
6953 Output_section::add_simple_input_section. Change first parameter's
6954 type from Simple_input_section to Input_section and remove the
6955 second and third parameters.
6956 * script-sections.cc (Input_section::Input_section_list): Change
6957 type to list of Output_section::Input_section/
6958 (Input_section_info::Input_section_info): Change parameter type of
6959 INPUT_SECTION to Output_section::Input_section.
6960 (Input_section_info::input_section): Change return type.
6961 (Input_section_info::input_section_): Change type to
6962 Output_section::Input_section.
6963 (Output_section_element_input::set_section_addresses): Adjust code
6964 to use Output_section::Input_section instead of
6965 Output_section::Simple_input_section. Adjust code for renaming
6966 of Output_section::add_simple_input_section.
6967 (Orphan_output_section::set_section_addresses): Ditto.
6968
6969 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6970
6971 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6972 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6973
6974 2010-05-18 Rafael Espindola <espindola@google.com>
6975
6976 * options.cc (General_options::finalize): Handle -nostdlib.
6977 * options.h (nostdlib): New option.
6978 * script.cc (script_add_search_dir): Handle -nostdlib.
6979
6980 2010-05-12 Doug Kwan <dougkwan@google.com>
6981
6982 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6983 attributes section only if there no attributes section after merging.
6984 (Target_arm::merge_object_attributes): Move value of
6985 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6986 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6987 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6988 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6989 and arm_attr_merge_7.stdout.
6990 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6991 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6992 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6993 arm_attr_merge_7b.o): New rules.
6994 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6995 arm_attr_merge_7
6996 * testsuite/Makefile.in: Regenerate.
6997 * testsuite/arm_attr_merge.sh: New file.
6998 * testsuite/arm_attr_merge_[67][ab].s: Same.
6999
7000 2010-05-05 Nick Clifton <nickc@redhat.com>
7001
7002 * po/es.po: Updated Spanish translation.
7003
7004 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7005
7006 * Makefile.am (install-exec-local): Properly install gold as
7007 default cross linker.
7008 * Makefile.in: Regenerated.
7009
7010 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7011 Nick Clifton <nickc@redhat.com>
7012
7013 * configure.ac (install_as_default): Define and set to false
7014 unless --enable-gold or --enable-gold=both/gold has been
7015 specified.
7016 * configure: Regenerate.
7017
7018 * Makefile.am (install-exec-local): Install the executable as
7019 'ld.gold'. If install_as_default is true then also install it as
7020 'ld'.
7021 * Makefile.in: Regenerated.
7022
7023 2010-04-24 Ian Lance Taylor <iant@google.com>
7024
7025 * layout.cc (Layout::layout_reloc): In relocatable link don't
7026 combine reloc sections for grouped sections.
7027
7028 2010-04-23 Sriraman Tallam <tmsriram@google.com>
7029
7030 * gc.h (gc_process_relocs): Pass information on relocs pointing to
7031 sections that are not ordinary to icf.
7032 * icf.cc (get_section_contents): Handle relocation pointing to section
7033 with no object or shndx information.
7034 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7035 * testsuite/Makefile.in: Regenerate.
7036 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7037 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7038
7039 2010-04-22 Ian Lance Taylor <iant@google.com>
7040
7041 * expression.cc (Expression::Expression_eval_info): Add
7042 result_alignment_pointer field.
7043 (Expression::eval_with_dot): Add result_alignment_pointer
7044 parameter. Change all callers.
7045 (Expression::eval_maybe_dot): Likewise.
7046 (class Binary_expression): Add alignment_pointer parameter to
7047 left_value and right_value. Change all callers.
7048 (BINARY_EXPRESSION): Set result alignment.
7049 (class Trinary_expression): Add alignment_pointer parameter to
7050 arg2_value and arg3_value. Change all callers.
7051 (Trinary_cond::value): Set result alignment.
7052 (Max_expression::value, Min_expression::value): Likewise.
7053 (Align_expression::value): Likewise.
7054 * script-sections.cc (class Sections_element): Add dot_alignment
7055 parameter to set_section_addresses virtual function. Update
7056 instantiations.
7057 (class Output_section_element): Likewise.
7058 (Script_sections::create_segments): Add dot_alignment parameter.
7059 Change all callers.
7060 (Script_sections::create_segments_from_phdrs_clause): Likewise.
7061 (Script_sections::set_phdrs_clause_addresses): Likewise.
7062 * script-sections.h: Update declarations.
7063 * script.h: Update declarations.
7064 * output.h (Output_segment::set_minimum_p_align): Don't decrease
7065 min_p_align.
7066 * testsuite/script_test_3.t: Set large alignment.
7067 * testsuite/script_test_3.sh: Make sure that at least one LOAD
7068 segment has expected alignment.
7069
7070 2010-04-22 Nick Clifton <nickc@redhat.com>
7071
7072 * po/gold.pot: Updated by the Translation project.
7073 * po/vi.po: Updated Vietnamese translation.
7074
7075 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
7076
7077 * testsuite/Makefile.am (check_PROGRAMS): Add
7078 icf_virtual_function_folding_test.
7079 * testsuite/Makefile.in: Regenerated.
7080
7081 2010-04-15 Andrew Haley <aph@redhat.com>
7082
7083 * options.h (merge_exidx_entries): New option.
7084 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7085 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7086 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7087 (Target_arm::merge_exidx_entries): New function.
7088 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7089 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7090 to Arm_exidx_fixup constructor.
7091 Add new arg, merge_exidx_entries.
7092 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7093 Arm_output_section::fix_exidx_coverage.
7094
7095 2010-04-18 Sriraman Tallam <tmsriram@google.com>
7096
7097 * icf.cc (get_section_contents): Check for preemptible functions.
7098 Ignore addend when appropriate.
7099 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
7100 section folded.
7101 (add_from_relobj): Check for section folded.
7102 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7103 * symtab.h (should_add_dynsym_entry): Add new parameter.
7104 * target-reloc.h (scan_relocs): Check for section folded.
7105 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7106 Check reloc types for function pointers in shared objects.
7107 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7108 case.
7109 (icf_preemptible_functions_test): New test case.
7110 (icf_string_merge_test): New test case.
7111 * testsuite.Makefile.in: Regenerate.
7112 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7113 bar_glob. Refactor code.
7114 * testsuite/icf_preemptible_functions_test.cc: New file.
7115 * testsuite/icf_preemptible_functions_test.sh: New file.
7116 * testsuite/icf_string_merge_test.cc: New file.
7117 * testsuite/icf_string_merge_test.sh: New file.
7118 * testsuite/icf_virtual_function_folding_test.cc: New file.
7119 * testsuite/icf_virtual_function_folding_test.sh: New file.
7120
7121 2010-04-14 Doug Kwan <dougkwan@google.com>
7122
7123 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7124 for local symbol recounting if we remove a section due to ICF.
7125 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7126 there are no regular objects in input.
7127
7128 2010-04-13 Doug Kwan <dougkwan@google.com>
7129
7130 * arm.cc (Arm_input_section::set_final_data_size): Compute
7131 accurate final data size instead of using current data size.
7132
7133 2010-04-09 Doug Kwan <dougkwan@google.com>
7134
7135 * layout.cc (Layout::choose_output_section): Handle script section
7136 types.
7137 (Layout::make_output_section_for_script): Add section type parameter.
7138 Handle script section types.
7139 * layout.h (Layout::make_output_section_for_script): Add section
7140 type parameter.
7141 * output.cc (Output_section::Output_section): Initialize data member
7142 is_noload_.
7143 (Output_section::do_reset_address_and_file_offset): Do not set address
7144 to 0 if section is a NOLOAD section.
7145 * output.h (Output_section::is_noload): New method.
7146 (Output_section::set_is_noload): Ditto.
7147 (Output_section::is_noload_): New data member.
7148 * script-c.h (Script_section_type): New enum type.
7149 (struct Parser_output_section_header): Add new file section_type.
7150 * script-sections.cc (Sections_element::output_section_name): Add
7151 parameter for returning script section type.
7152 (Output_section_definition::output_section_name): Ditto.
7153 (Output_section_definition::section_type)P; New method.
7154 (Output_section_definiton::script_section_type_name): Ditto.
7155 (Output_section_definition::script_section_type_): New data member.
7156 (Output_section_definition::Output_section_definition): Initialize
7157 data member Output_section_definition::script_section_type_.
7158 (Output_section_definition::create_sections): Pass script section type
7159 to Layout::make_output_section_for_script.
7160 (Output_section_definition::output_section_name): Return script
7161 section type to caller.
7162 (Output_section_definition::set_section_address): Do not advance
7163 dot value and load address if section type is NOLOAD. Set address
7164 of NOLOAD sections regardless of section flags.
7165 (Output_section_definition::print): Print section type if it is
7166 not SCRIPT_SECTION_TYPE_NONE.
7167 (Output_section_definition::section_type): New method.
7168 (Output_section_definition::script_section_type_name): Ditto.
7169 (Script_sections::output_section_name): Add new parameter
7170 PSECTION_TYPE for returning script section type. Pass it to
7171 section elements. Handle discard sections.
7172 (Sort_output_sections::operator()): Handle NOLOAD sections.
7173 * script-sections.h (Script_sections::Section_type): New enum type.
7174 (Script_sections::output_section_name): Add a new parameter for
7175 returning script section type.
7176 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7177 INFO and NOLOAD.
7178 * yyscript.y (union): Add new field SECTION_TYPE.
7179 (COPY, DSECT, INFO, NOLOAD): New tokens.
7180 (opt_address_and_section_type): Change type to output_section_header.
7181 (section_type): New non-terminal
7182 (section_header): Handle section type.
7183 (opt_address_and_section_type): Return section type value.
7184
7185 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
7186
7187 * testsuite/plugin_common_test_1.c (foo): Add prototype.
7188 * testsuite/plugin_common_test_2.c (foo): Likewise.
7189
7190 2010-04-08 Doug Kwan <dougkwan@google.com>
7191
7192 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7193 Output_merge_data.
7194 * output.cc (Output_section::add_merge_input_section): Simplify
7195 code and return status of Output_merge_base::add_input_section.
7196 Update merge section map only if Output_merge_base::add_input_section
7197 returns true.
7198
7199 2010-04-07 Doug Kwan <dougkwan@google.com>
7200
7201 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7202 if section is marked as containing instructions but has no mapping
7203 symbols.
7204 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7205 correct section index.
7206 (Arm_relobj::find_linked_text_section): Ditto.
7207
7208 2010-04-07 Cary Coutant <ccoutant@google.com>
7209
7210 * archive.cc (include_member): Destroy Read_symbols_data object before
7211 releasing file.
7212 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7213 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7214 (Read_symbols_data::~Read_symbols_data) New destructor.
7215 (Section_relocs::Section_relocs) New constructor.
7216 (Section_relocs::~Section_relocs) New destructor.
7217 (Read_relocs_data::Read_relocs_data) New constructor.
7218 (Read_relocs_data::~Read_relocs_data) New destructor.
7219 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7220 pointers to NULL after deleting.
7221
7222 2010-04-07 Doug Kwan <dougkwan@google.com>
7223
7224 * arm.cc: Replace "endianity" with "endianness" in comments.
7225 (Arm_exidx_cantunwind): Ditto.
7226 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7227 (Arm_relobj::merge_flags_and_attributes): New method.
7228 (Arm_relobj::merge_flags_and_attributes_): New data member.
7229 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7230 (Arm_relobj::scan_sections_for_stubs): Ditto.
7231 (Arm_relobj::do_read_symbols): Check to see if we really want to
7232 merge processor-specific flags and attributes. Exit early if
7233 an object is empty except for section names and the undefined symbol.
7234 (Target_arm::do_finalize_sections): Move check for ELF format to
7235 Arm_relobj::do_read_symbols. Merge processor specific flags and
7236 attributes from a regular object only when we have determined that
7237 it is aapropriate. Do not create an .ARM.attributes section in
7238 output if there is no regular input object.
7239 (Target_arm::merge_processor_specific_flags): Check
7240 --warn-mismatch before printing any error.
7241 (Target_arm::merge_object_attributes): Ditto.
7242 * gold.cc (queue_middle_tasks): Handle the case in which there is
7243 no regular object in input.
7244 * options.cc (General_options::parse_EB): New method.
7245 (General_options::parse_EL): Same.
7246 (General_options::General_options): Initialize endianness_.
7247 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7248 New options.
7249 (General_options::Endianness): New enum.
7250 (General_options::endianness): New method.
7251 (General_options::endianness_): New data member.
7252 * parameters.cc (Parameters::set_options): Check target endianness.
7253 (Parameters::set_target_once): Ditto.
7254 (Parameters::check_target_endianness): New method.
7255 (parameters_force_valid_target): If either -EL or -EB is specified,
7256 use it to define endianness of default target.
7257 * parameters.h (Parameters::check_target_endianness): New method
7258 declaration.
7259 * target.h (class Target): Change "endianity" to "endianness"
7260 in comments.
7261
7262 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7263
7264 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7265 * configure: Regenerate.
7266 * Makefile.in: Regenerate.
7267 * testsuite/Makefile.in: Regenerate.
7268
7269 2010-04-06 Cary Coutant <ccoutant@google.com>
7270
7271 gcc PR lto/42757
7272 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7273 prevailing definitions of common symbols.
7274 * testsuite/plugin_test_6.sh: New test case.
7275 * testsuite/plugin_common_test_1.c: New test case.
7276 * testsuite/plugin_common_test_2.c: New test case.
7277 * testsuite/Makefile.am (plugin_test_6): New test case.
7278 * testsuite/Makefile.in: Regenerate.
7279
7280 2010-04-06 Nick Clifton <nickc@redhat.com>
7281
7282 * po/vi.po: New Vietnamese translation.
7283
7284 2010-03-30 Doug Kwan <dougkwan@google.com>
7285
7286 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7287
7288 2010-03-25 Doug Kwan <dougkwan@google.com>
7289
7290 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7291 to avoid a conversion warning on a 32-bit host.
7292
7293 2010-03-24 Ian Lance Taylor <iant@google.com>
7294
7295 * testsuite/script_test_3.t: Add a TLS segment.
7296 * testsuite/Makefile.am (check_PROGRAMS): Add
7297 tls_phdrs_script_test.
7298 (tls_phdrs_script_test_SOURCES): Define.
7299 (tls_phdrs_script_test_DEPENDENCIES): Define.
7300 (tls_phdrs_script_test_LDFLAGS): Define.
7301 (tls_phdrs_script_test_LDADD): Define.
7302 * testsuite/Makefile.in: Rebuild.
7303
7304 2010-03-23 Cary Coutant <ccoutant@google.com>
7305
7306 * fileread.cc (find_or_make_view): Fix comment.
7307
7308 2010-03-23 Ian Lance Taylor <iant@google.com>
7309
7310 * script-sections.cc (class Orphan_section_placement): Define
7311 PLACE_TLS and PLACE_TLS_BSS.
7312 (Orphan_section_placement::Orphan_section_placement): Initialize
7313 new places.
7314 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7315 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7316 (tls_script_test_SOURCES): Define.
7317 (tls_script_test_DEPENDENCIES): Define.
7318 (tls_script_test_LDFLAGS): Define.
7319 (tls_script_test_LDADD): Define.
7320 * testsuite/Makefile.in: Rebuild.
7321
7322 2010-03-22 Doug Kwan <dougkwan@google.com>
7323
7324 * arm.cc (Arm_relocate_functions::abs8,
7325 Arm_relocate_functions::abs16): Use correct check for overflow
7326 specified in the ARM ELF specs.
7327 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
7328 target of a BLX instruction specially.
7329 (Reloc_stub::stub_type_for_reloc): Ditto.
7330 (Relocate::relocate): Use symbolic names instead of numeric relocation
7331 codes to report error.
7332 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7333 workaround.
7334 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7335 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7336 thumb2_blx_out_of_range.stdout
7337 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7338 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7339 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7340 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7341 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7342 thumb2_blx_in_range, thumb2_blx_in_range.o,
7343 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7344 thumb2_blx_out_of_range.o): New rules.
7345 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7346 thumb2_blx_in_range and thumb2_blx_out_of_range.
7347 * testsuite/Makefile.in: Regenerate.
7348 * arm_branch_in_range.sh: Add tests for THUMB BLX.
7349 * testsuite/thumb_blx_in_range.s: New file.
7350 * testsuite/thumb_blx_out_of_range.s: New file.
7351
7352 2010-03-22 Rafael Espindola <espindola@google.com>
7353
7354 * archive.cc (Should_include): Move to archive.h.
7355 (should_include_member): Make it a member of Archive.
7356 (Lib_group): New.
7357 (Add_lib_group_symbols): New.
7358 * archive.h: Include options.h.
7359 (Archive_member): Moved from Archive.
7360 (Should_include): Moved from archive.cc.
7361 (Lib_group): New.
7362 (Add_lib_group_symbols): New.
7363 * dynobj.cc (do_should_include_member): New.
7364 * dynobj.h (do_should_include_member): New.
7365 * gold.cc (queue_initial_tasks): Update call to queue.
7366 * main.cc (main): Print lib group stats.
7367 * object.cc (do_should_include_member): New.
7368 * object.h: Include archive.h.
7369 (Object::should_include_member): New.
7370 (Object::do_should_include_member): New.
7371 (Sized_relobj::do_should_include_member): New.
7372 * options.cc (General_options::parse_start_lib): New.
7373 (General_options::parse_end_lib): New.
7374 (Input_arguments::add_file): Handle lib groups.
7375 (Input_arguments::start_group): Check we are not in a lib.
7376 (Input_arguments::start_lib): New.
7377 (Input_arguments::end_lib): New.
7378 * options.h (General_options): Add start_lib and end_lib.
7379 (Input_argument::lib_): New.
7380 (Input_argument::lib): New.
7381 (Input_argument::is_lib): New.
7382 (Input_file_lib): New.
7383 (Input_arguments::in_lib_): New.
7384 (Input_arguments::in_lib): New.
7385 (Input_arguments::start_lib): New.
7386 (Input_arguments::end_lib_): New.
7387 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7388 in unused members as preempted.
7389 (Sized_pluginobj::do_should_include_member): New.
7390 * plugin.h (Sized_pluginobj::do_should_include_member): New.
7391 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7392 return the blocker.
7393 (Read_symbols::do_whole_lib_group): New.
7394 (Read_symbols::do_lib_group): New.
7395 (Read_symbols::do_read_symbols): Handle lib groups.
7396 (Read_symbols::get_name): Handle lib groups.
7397 * readsyms.h (Read_symbols): Add an archive member pointer.
7398 (Read_symbols::do_whole_lib_group): New.
7399 (Read_symbols::do_lib_group): New.
7400 (Read_symbols::member_): New.
7401 * script.cc (read_input_script): Update call to queue_soon.
7402
7403 2010-03-19 Doug Kwan <dougkwan@google.com>
7404
7405 * arm.cc (Stub_table::Stub_table): Initialize new data members
7406 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7407 (Stub_table::add_reloc_stub): Assign stub offset and update
7408 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7409 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7410 New data members.
7411 (Stub_table::update_data_size_and_addralign): Use
7412 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7413 instead of going over all reloc stubs.
7414 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7415 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7416 Stringpool_template::offset_ to size of Stringpool_char.
7417 (Stringpool_template::new_key_offset): Remove code to initialize
7418 Stringpool_template::offset_.
7419 * stringpool.h (Stringpool_template::set_no_zero_null): Set
7420 Stringpool_template::offset_ to zero.
7421
7422 2010-03-15 Doug Kwan <dougkwan@google.com>
7423
7424 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7425 offset_.
7426 (Stringpool_template::new_key_offset): New method.
7427 (Stringpool_template::add_string): Assign offsets when adding new
7428 strings.
7429 (Stringpool_template::set_string_offsets): Do not set string offsets
7430 when not optimizing.
7431 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7432 member size_.
7433 (Chunked_vector::clear): Clear size_.
7434 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7435 (Chunked_vector::size): Return size_.
7436 (Chunked_vector::push_back): Use size_ to find insert position.
7437 (Chunked_vector::size_): New data member.
7438 (Stringpool_template::set_no_zero_null): Assert string set is empty.
7439 (Stringpool_template::new_key_offset): New method declaration.
7440 (Stringpool_template::offset_): New data member.
7441
7442 2010-03-15 Rafael Espindola <espindola@google.com>
7443
7444 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7445 Add_symbols' constructor.
7446 * readsyms.h (Add_symbols): Remove the input_group member.
7447
7448 2010-03-10 Ian Lance Taylor <iant@google.com>
7449
7450 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7451 target to ask whether a reference to a symbol requires a stack
7452 split.
7453 * target.h (Target::is_call_to_non_split): New function.
7454 (Target::do_is_call_to_non_split): Declare virtual function.
7455 * target.cc: Include "symtab.h".
7456 (Target::do_is_call_to_non_split): New function.
7457 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7458
7459 2010-03-10 Cary Coutant <ccoutant@google.com>
7460
7461 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7462 (File_read::open[1]): Remove initial mapping of whole_file_view_.
7463 (File_read::open[2]): Add whole_file_view_ to list of views.
7464 (File_read::make_view): Remove test of whole_file_view_.
7465 (File_read::find_or_make_view): Create whole_file_view_ if
7466 necessary.
7467 (File_read::clear_views): Replace bool parameter with enum;
7468 adjust all callers. Don't delete views with permanent data;
7469 do delete cached views and views from archives if
7470 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
7471 if clearing the corresponding view.
7472 * fileread.h (File_read::Clear_views_mode): New enum.
7473 (File_read::View::is_permanent_view): New method.
7474 (File_read::clear_views): Replace bool parameter
7475 with enum; adjust all callers.
7476 * options.h (General_options): Change keep_files_mapped option;
7477 add map_whole_files.
7478 * readsyms.cc (Add_symbols::run): Delete sd_ object before
7479 releasing the file.
7480 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7481 the file.
7482
7483 2010-03-10 David S. Miller <davem@davemloft.net>
7484
7485 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7486
7487 2010-03-09 Sriraman Tallam <tmsriram@google.com>
7488
7489 * icf.cc (get_section_contents): Add '@' marker after processing the
7490 merge reloc.
7491
7492 2010-03-08 Doug Kwan <dougkwan@google.com>
7493
7494 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7495 due to a conversion warning.
7496 (Arm_relobj::update_output_local_symbol_count): Check for local
7497 symbol with unset output index.
7498
7499 2010-03-05 Ian Lance Taylor <iant@google.com>
7500
7501 * options.h (class General_options): Add --spare-dynamic-tags.
7502 * output.cc (Output_data_dynamic::set_final_data_size): Implement
7503 --spare-dynamic-tags.
7504
7505 2010-03-05 Ian Lance Taylor <iant@google.com>
7506
7507 * incremental.cc: Include "libiberty.h".
7508
7509 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
7510
7511 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7512 function, is_info_ member.
7513 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7514 (Versions::Versions): Update caller.
7515 (Versions::define_base_version): Likewise.
7516 (Versions::add_def): Likewise.
7517
7518 2010-03-03 Sriraman Tallam <tmsriram@google.com>
7519
7520 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7521 (Scan::possible_function_pointer_reloc): New function.
7522 (Scan::local_reloc_may_be_function_pointer): Change to call
7523 possible_function_pointer_reloc.
7524 (Scan::global_reloc_may_be_function_pointer): Ditto.
7525 * icf.h (Icf::check_section_for_function_pointers): Change to reject
7526 relocations in ".data.rel.ro._ZTV" section.
7527 * testsuite/icf_safe_so_test.sh: Change to pass i386.
7528 * testsuite/icf_safe_so_test.cc: Ditto.
7529 * testsuite/icf_safe_test.cc: Ditto.
7530 * testsuite/icf_safe_test.sh: Ditto.
7531
7532 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7533 Ian Lance Taylor <iant@google.com>
7534
7535 * target-reloc.h (relocate_section): Check the symbol table index
7536 for -1U before setting the local symbol index.
7537 (scan_relocatable_relocs): If copying the relocation, record that
7538 the local symbol is required.
7539 * object.h (Symbol_value::is_output_symtab_index_set): New
7540 function.
7541 (Symbol_value::may_be_discarded_from_output_symtab): New
7542 function.
7543 (Symbol_value::has_output_symtab_entry): New function.
7544 (Symbol_value::needs_output_symtab_entry): Remove.
7545 (Symbol_value::output_symtab_index): Make sure the symbol index is
7546 set.
7547 (Symbol_value::set_output_symtab_index): Make sure the symbol
7548 index is not set. Make sure the new index is valid.
7549 (Symbol_value::set_must_have_output_symtab_entry): New function.
7550 (Symbol_value::has_output_dynsym_entry): New function.
7551 (Symbol_value::set_output_dynsym_index): Make sure the new index
7552 is valid.
7553 (Sized_relobj::set_must_have_output_symtab_entry): New function.
7554 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7555 local symbol if permitted.
7556 (Sized_relobj::do_finalize_local_symbols): Call
7557 is_output_symtab_index_set rather than needs_output_symtab_entry.
7558 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7559 rather than needs_output_symtab_entry. Call
7560 has_output_dynsym_entry rather than needs_output_dynsym_entry.
7561 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7562 is_output_symtab_index_set rather than needs_output_symtab_entry.
7563 * testsuite/discard_locals_relocatable_test.c: New file.
7564 * testsuite/discard_locals_test.sh: Test -r.
7565 * testsuite/Makefile.am (check_DATA): Add
7566 discard_locals_relocatable_test1.syms,
7567 discard_local_relocatable_test2.syms.
7568 (MOSTLYCLEANFILES): Likewise. Also add
7569 discard_locals_relocatable_test1.lout and
7570 discard_locals_relocatable_test2.out.
7571 (discard_locals_relocatable_test1.syms): New target.
7572 (discard_locals_relocatable_test.o): New target.
7573 (discard_locals_relocatable_test1.out): New target.
7574 (discard_locals_relocatable_test2.syms): New target.
7575 (discard_locals_relocatable_test2.out): New target.
7576 (various): Add missing ../ld-new dependencies.
7577 * testsuite/Makefile.in: Rebuild.
7578
7579 2010-03-03 Nick Clifton <nickc@redhat.com>
7580
7581 * po/fi.po: New Finnish translation.
7582
7583 2010-03-01 Doug Kwan <dougkwan@google.com>
7584
7585 * layout.cc (Layout::Layout): Force section types of .init_array*,
7586 .preinit_array* and .fini_array* sections.
7587 * output.cc (Output_section::Input_section_sort_entry::has_priority):
7588 Fix check of return value of std::string::find.().
7589 (Output_section::Input_section_sort_compare::operator()): Remove
7590 comment about .init_array.
7591 (Output_section::Input_section_sort_init_fini_compare::operator()):
7592 New method.
7593 (Output_section::sort_attached_input_sections): Handle .init_array
7594 and .fini_array specially.
7595 * output.h (Output_section::Inut_section_sort_compare): Update
7596 comment.
7597 (Output_section::Input_section_sort_init_fini_compare): New struct.
7598
7599 2010-02-26 Doug Kwan <dougkwan@google.com>
7600
7601 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7602 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7603 * testsuite/debug_msg.sh: Avoid matching source line number for
7604 use of global variable undef_int.
7605
7606 2010-02-26 Doug Kwan <dougkwan@google.com>
7607
7608 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7609 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7610 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7611 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7612 * options.cc (General_options::General_options): Initialize member
7613 fix_v4bx_.
7614 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7615 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7616 and rm_no_fix_v4bx.stdout
7617 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7618 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7619 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7620 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7621 and arm_no_fix_v4bx.
7622 * Makefile.in: Regenerate.
7623 * testsuite/arm_fix_v4bx.s: New file.
7624 * testsuite/arm_fix_v4bx.sh: Ditto.
7625
7626 2010-02-24 Doug Kwan <dougkwan@google.com>
7627
7628 * arm.cc (Target_arm::got_section): Make the .got section the first
7629 non RELRO section in the data segment.
7630 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7631 suffixes of section names.
7632
7633 2010-02-24 Doug Kwan <dougkwan@google.com>
7634
7635 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7636 flags and attributes merging if an input file is a binary file.
7637 * fileread.cc (Input_file::open): Record format of original file.
7638 * fileread.h (Input_file::Format): New enum type.
7639 (Input_file::Input_file): Initialize data member format_.
7640 (Input_file::format): New method definition.
7641 (Input_file::format_):: New data member.
7642
7643 2010-02-24 Doug Kwan <dougkwan@google.com>
7644
7645 * arm.cc (Arm_output_data_got): New class.
7646 (ARM_TCB_SIZE): New constant
7647 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7648 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7649 If user uses a script with a SECTIONS clause, issue only a warning
7650 for a misplaced EXIDX input section. Otherwise, issue an error.
7651 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7652 garbage collection.
7653 (Target_arm::got_mode_index_entry): Handle static linking.
7654 (Target_arm::Scan::local): Ditto.
7655 (Target_arm::Scan::global): Ditto.
7656 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
7657 all incorrectly implemented relocations.
7658 (Target_arm::fix_exidx_coverage): Pass layout to
7659 Arm_output_section::fix_exidx_coverage.
7660 * layout.cc (Layout::section_name_mapping): Remove trailing dots
7661 from ".ARM.exidx." and ".ARM.extab.".
7662
7663 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7664
7665 * arm.cc (Target_arm::do_finalize_sections): Create attribute
7666 section if it does not already exist.
7667 * attributes.cc (Attributes_section_data::Attributes_section_data):
7668 Don't crash if size is zero.
7669
7670 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7671 Ian Lance Taylor <iant@google.com>
7672
7673 * gold.cc (queue_middle_tasks): If no input files were opened,
7674 exit.
7675 * workqueue.h (Task_function::Task_function): Assert that there is
7676 a blocker.
7677
7678 2010-02-22 Doug Kwan <dougkwan@google.com>
7679
7680 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7681 * icf.cc (get_section_contents): Cast snprintf arguments to long long
7682 types to avoid warnings due to different uint64_t implementations
7683 on different hosts.
7684
7685 2010-02-21 Doug Kwan <dougkwan@google.com>
7686
7687 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7688 handling of the maximum backward branch offset.
7689 (Arm_relocate_functions::thumb_branch_common): Ditto.
7690 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7691 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7692 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7693 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7694 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7695 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7696 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7697 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7698 thumb_bl_out_of_range thumb_bl_out_of_range.o,
7699 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7700 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7701 thumb2_bl_out_of_range.o): New rules.
7702 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7703 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7704 thumb2_bl_out_of_range
7705 * testsuite/Makefile.in: Regenerate.
7706 * testsuite/arm_bl_in_range.s: New file.
7707 * testsuite/arm_bl_out_of_range.s: Ditto.
7708 * testsuite/arm_branch_in_range.sh: Ditto.
7709 * testsuite/arm_branch_range.t: Ditto.
7710 * testsuite/thumb2_branch_range.t: Ditto.
7711 * testsuite/thumb_bl_in_range.s: Ditto.
7712 * testsuite/thumb_bl_out_of_range.s: Ditto.
7713 * testsuite/thumb_branch_range.t: Ditto.
7714
7715 2010-02-20 Sriraman Tallam <tmsriram@google.com>
7716
7717 * gc.h (gc_process_relocs): Change vectors to point to the new list.
7718 Add reloc offset information.
7719 * icf.cc (get_section_contents): Change iterators to point to the new
7720 vectors. Add reloc offset information to the contents.
7721 * icf.h (Icf::Sections_reachable_info): New typedef.
7722 (Icf::Sections_reachable_list): New typedef.
7723 (Icf::Offset_info): New typedef.
7724 (Icf::Reloc_info): New struct typedef.
7725 (Icf::Reloc_info_list): New typedef.
7726 (Icf::symbol_reloc_list): Delete method.
7727 (Icf::addend_reloc_list): Delete method.
7728 (Icf::section_reloc_list): Delete method.
7729 (Icf::reloc_info_list): New method.
7730 (Icf::reloc_info_list_): New member.
7731
7732 2010-02-19 Doug Kwan <dougkwan@google.com>
7733
7734 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7735 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7736 * arm.cc (Arm_relocation_functions): New forward declaration.
7737 (Target_arm::Target_arm): Initialize new data members
7738 got_mod_index_offset_ and tls_base_symbol_defined_.
7739 (Target_arm::Relocate::relocate_tls): New method.
7740 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7741 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7742 New methods.
7743 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7744 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7745 (Target_arm::got_mod_index_offset_,
7746 Target_arm::tls_base_symbol_defined_): New data members.
7747 (Target_arm::Scan::local, Target::Scan::global,
7748 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7749 relocations.
7750
7751 2010-02-18 Doug Kwan <dougkwan@google.com>
7752
7753 * arm.cc (Arm_relobj::find_linked_text_section): New method.
7754 (Arm_relobj::make_exidx_input_section): Pass section index of linked
7755 text section as a parameter becuase some broken tools may not set
7756 the link in section header.
7757 (Target_arm::has_got_section): New method.
7758 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7759 without any mapping symbol as data only. Remove warning.
7760 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7761 link in its section header, try to discover the link by inspecting the
7762 REL31 relocation at the beginning of the section.
7763 (Target_arm::Scan::check_non_pic): Report name of offending relocation
7764 in error message.
7765 (Target_arm::Scan::global): Treat any reference to the symbol
7766 _GLOBAL_OFFSET_TABLE_ as a GOT access.
7767
7768 2010-02-12 Sriraman Tallam <tmsriram@google.com>
7769
7770 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7771 (Scan::global_reloc_may_be_function_pointer): New function.
7772 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7773 (Scan::global_reloc_may_be_function_pointer): New function.
7774 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7775 (Scan::global_reloc_may_be_function_pointer): New function.
7776 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7777 (Scan::global_reloc_may_be_function_pointer): New function.
7778 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7779 (Scan::global_reloc_may_be_function_pointer): New function.
7780 (Scan::possible_function_pointer_reloc): New function.
7781 (Target_x86_64::can_check_for_function_pointers): New function.
7782 * gc.h (gc_process_relocs): Scan relocation types to determine if
7783 function pointers were taken for targets that support it.
7784 * icf.cc (Icf::find_identical_sections): Include functions for
7785 folding in safe ICF whose pointer is not taken.
7786 * icf.h (Secn_fptr_taken_set): New typedef.
7787 (fptr_section_id_): New member.
7788 (section_has_function_pointers): New function.
7789 (set_section_has_function_pointers): New function.
7790 (check_section_for_function_pointers): New function.
7791 * options.h: Fix comment for safe ICF option.
7792 * target.h (can_check_for_function_pointers): New function.
7793 * testsuite/Makefile.am: Add icf_safe_so_test test case.
7794 Modify icf_safe_test for X86-64.
7795 * testsuite/Makefile.in: Regenerate.
7796 * testsuite/icf_safe_so_test.cc: New file.
7797 * testsuite/icf_safe_so_test.sh: New file.
7798 * testsuite/icf_safe_test.cc (kept_func_3): New function.
7799 (main): Change to take pointer to function kept_func_3.
7800 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7801 folding is done correctly for X86-64.
7802
7803 2010-02-12 David S. Miller <davem@davemloft.net>
7804
7805 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7806 is_symbolless parameter.
7807 (Output_reloc<SHT_REL>::is_symbolless): New.
7808 (Output_reloc<SHT_REL>::is_symbolless_): New.
7809 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7810 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7811 (Output_reloc<SHT_RELA>::is_symbolless): New.
7812 (Output_data_reloc::add_global): Handle is_symbolless.
7813 (Output_data_reloc::add_global_relative): Likewise.
7814 (Output_data_reloc::add_local): Likewise.
7815 (Output_data_reloc::add_local_relative): Likewise.
7816 (Output_data_reloc::add_symbolless_global_addend): New.
7817 (Output_data_reloc::add_symbolless_local_addend): New.
7818 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7819 is_symbolless.
7820 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7821 instead of ->is_relative_
7822 (Output_reloc::write): Likewise.
7823 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7824 (Output_reloc::write_rel): Simplify.
7825
7826 * sparc.cc (Target_sparc::Scan::local): Use
7827 ->add_symbolless_local_addend as needed.
7828 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7829 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
7830 based upon relocation offset.
7831
7832 2010-02-11 Doug Kwan <dougkwan@google.com>
7833
7834 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7835 (Target_arm::Scan::global): Ditto. Also remove a comment before the
7836 beginning of function.
7837 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7838 and MOVT_ABS relocations. Those are non issued in scanning. Fix
7839 parameter is_32bit in calls to should_apply_static_reloc.
7840 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7841 (check_DATA): Add arm_abs_global.stdout.
7842 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7843 arm_abs_global.stdout): New rules.
7844 (MOSTLLYCLEANFILES): Add arm_abs_global
7845 * Makefile.in: Regenerate.
7846 * testsuite/arm_abs_global.s: New file.
7847 * testsuite/arm_abs_global.sh: Ditto.
7848 * testsuite/arm_abs_lib.s: Ditto.
7849
7850 2010-02-11 Ian Lance Taylor <iant@google.com>
7851
7852 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7853 Read_relocs task.
7854 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
7855 Allocate_commons_task first.
7856 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7857 task, rather than symtab_lock_.
7858 (Gc_process_relocs::~Gc_process_relocs): New function.
7859 (Gc_process_relocs::is_runnable): Check this_blocker_.
7860 (Gc_process_relocs::locks): Use next_blocker_ rather than
7861 blocker_.
7862 (Scan_relocs::~Scan_relocs): New function.
7863 (Scan_relocs::is_runnable): Check this_blocker_ rather than
7864 symtab_lock_.
7865 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7866 next_blocker_.
7867 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7868 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7869 constructor accordingly.
7870 (class Gc_process_relocs): Likewise.
7871 (class Scan_relocs): Likewise.
7872 * common.h (class Allocate_commons_task): Remove symtab_lock_
7873 field, and corresponding constructor parameter.
7874 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7875 symtab_lock_.
7876 (Allocate_commons_task::locks): Likewise.
7877
7878 2010-02-11 Ian Lance Taylor <iant@google.com>
7879
7880 * gold-threads.h (class Once): Define.
7881 (class Initialize_lock): Rewrite as child of Once.
7882 * gold-threads.cc (class Once_initialize): Define.
7883 (once_pointer_control): New static variable.
7884 (once_pointer, once_arg): New static variables.
7885 (c_run_once): New static function.
7886 (Once::Once, Once::run_once, Once::internal_run): New functions.
7887 (class Initialize_lock_once): Remove.
7888 (initialize_lock_control): Remove.
7889 (initialize_lock_pointer): Remove.
7890 (initialize_lock_once): Remove.
7891 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7892 (Initialize_lock::initialize): Rewrite.
7893 (Initialize_lock::do_run_once): New function.
7894 * archive.cc (Archive::interpret_header): Only clear name if it is
7895 not already empty.
7896 * fileread.cc: Include "gold-threads.h"
7897 (file_counts_lock): New static variable.
7898 (file_counts_initialize_lock): Likewise.
7899 (File_read::release): Only increment counts when using --stats.
7900 Use a lock around the increment.
7901 * parameters.cc (class Set_parameters_target_once): Define.
7902 (set_parameters_target_once): New static variable.
7903 (Parameters::Parameters): Move here from parameters.h.
7904 (Parameters::set_target): Rewrite.
7905 (Parameters::set_target_once): New function.
7906 (Parameters::clear_target): Move here and rewrite.
7907 * parameters.h (class Parameters): Update declarations. Add
7908 set_parameters_target_once_ field.
7909 (Parameters::Parameters): Move to parameters.cc.
7910 (Parameters::clear_target): Likewise.
7911 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7912 task.
7913 (Start_group::~Start_group): New function.
7914 (Start_group::is_runnable): New function.
7915 (Start_group::locks, Start_group::run): New functions.
7916 (Finish_group::run): Change saw_undefined to size_t.
7917 * readsyms.h (class Start_group): Define.
7918 (class Finish_group): Change saw_undefined_ field to size_t.
7919 (Finish_group::Finish_group): Remove saw_undefined and
7920 this_blocker parameters. Change all callers.
7921 (Finish_group::set_saw_undefined): New function.
7922 (Finish_group::set_blocker): New function.
7923 * symtab.h (class Symbol_table): Change saw_undefined to return
7924 size_t. Change saw_undefined_ field to size_t.
7925 * target-select.cc (Set_target_once::do_run_once): New function.
7926 (Target_selector::Target_selector): Initialize set_target_once_
7927 field. Don't initialize lock_ and initialize_lock_ fields.
7928 (Target_selector::instantiate_target): Rewrite.
7929 (Target_selector::set_target): New function.
7930 * target-select.h (class Set_target_once): Define.
7931 (class Target_selector): Update declarations. Make
7932 Set_target_once a friend. Remove lock_ and initialize_lock_
7933 fields. Add set_target_once_ field.
7934
7935 2010-02-10 Ian Lance Taylor <iant@google.com>
7936
7937 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7938 queueing any tasks.
7939 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7940 (queue_middle_tasks): Add all blockers before queueing any tasks.
7941 (queue_final_tasks): Likewise.
7942 * token.h (Task_token::add_blockers): New function.
7943 * object.h (Input_objects::number_of_relobjs): New function.
7944
7945 2010-02-10 Ian Lance Taylor <iant@google.com>
7946
7947 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7948 shared, not if not position independent.
7949 * x86_64.cc (Relocate::relocate_tls): Likewise.
7950 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7951 (tls_pie_pic_test): New target.
7952 * testsuite/Makefile.in: Rebuild.
7953
7954 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7955 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7956 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7957 * testsuite/Makefile.in: Rebuild.
7958
7959 2010-02-09 David S. Miller <davem@davemloft.net>
7960
7961 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7962 R_SPARC_RELATIVE using ->add_local_relative().
7963 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7964
7965 * output.h (Output_data_dynamic::add_section_size): New method
7966 that takes two Output_data objects.
7967 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7968 entry param. Handle it in initializers.
7969 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7970 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7971 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7972 arg.
7973 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7974 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7975 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7976 for dynrel_includes_plt.
7977 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7978 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7979 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7980 before .rela.plt
7981 (Target_sparc::do_finalize_sections): Update to pass true for
7982 dynrel_includes_plt.
7983 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7984 output before .rela.plt
7985 (Target_powerpc::do_finalize_sections): Update to pass true for
7986 dynrel_includes_plt when 32-bit.
7987
7988 2010-02-08 Doug Kwan <dougkwan@google.com>
7989
7990 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7991 method.
7992 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7993 Arm_relobj::scan_section_for_cortex_a8_stubs,
7994 Arm_relobj::do_relocation_section): Instead of calling
7995 Output_section::output_address, use faster
7996 Arm_relobj::simple_input_section_output_address.
7997
7998 2010-02-08 David S. Miller <davem@davemloft.net>
7999
8000 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8001 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8002 relocation helper function.
8003
8004 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8005 just like R_SPARC_GOT{10,13,22}.
8006 (Target_sparc::Scan::local): Likewise.
8007 (Target_sparc::Relocate:relocate): Likewise.
8008
8009 2010-02-06 Ian Lance Taylor <iant@google.com>
8010
8011 * configure.ac: Rewrite targetobjs duplicate removal code to use
8012 only shell constructs.
8013 * configure: Rebuild.
8014
8015 2010-02-05 Doug Kwan <dougkwan@google.com>
8016
8017 PR 11247
8018 * arm.cc (Arm_relobj::section_is_scannable): New method.
8019 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8020 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8021
8022 2010-02-04 Doug Kwan <dougkwan@google.com>
8023
8024 PR 11247
8025 * arm-reloc-property.cc (cstdio): Include.
8026 * configure.ac (targetobjs): Remove duplicates.
8027 * configure: Regenerate.
8028 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8029 big and little endian version for a given address size.
8030
8031 2010-02-03 Doug Kwan <dougkwan@google.com>
8032
8033 * arm-reloc-property.cc
8034 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8035 definition.
8036 * arm-reloc-property.h
8037 (Arm_reloc_property_table::get_implemented_static_reloc_property):
8038 New method definition.
8039 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8040 declaration.
8041 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8042 overflow to N.
8043 (GOT_PREL): Change implemented to Y.
8044 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8045 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8046 (Arm_relocate_functions::movw_abs_nc): Remove method.
8047 (Arm_relocate_functions::movt_abs): Ditto.
8048 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8049 (Arm_relocate_functions::thm_movt_abs): Ditto.
8050 (Arm_relocate_functions::movw_rel_nc): Ditto.
8051 (Arm_relocate_functions::movw_rel): Ditto.
8052 (Arm_relocate_functions::movt_rel): Ditto.
8053 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8054 (Arm_relocate_functions:thm_movw_rel): Ditto.
8055 (Arm_relocate_functions:thm_movt_rel): Ditto.
8056 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8057 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8058 New method definitions.
8059 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8060 (Arm_relocation_functions::arm_grp_ldr): Ditto.
8061 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8062 (Arm_relocation_functions::arm_grp_ldc): Ditto.
8063 (Target_arm::Relocate::relocate): Check for non-static or
8064 unimplemented relocation code and exit early. Change calls to
8065 Target_arm::reloc_uses_thumb_bit and
8066 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8067 instead. Refactor code to handle similar relocations to increase
8068 code sharing. Remove check for unsupported relocation code in switch
8069 statement.
8070 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8071 relocation property table to find out size. Change error message to
8072 print out the name of a relocation code instead of the numeric value.
8073 (Target_arm::scan_reloc_for_stub): Use relocation property table
8074 instead of calling Target_arm::reloc_uses_thumb_bit().
8075
8076 2010-02-02 Doug Kwan <dougkwan@google.com>
8077
8078 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8079 types of relaxed input section.
8080
8081 2010-02-02 Doug Kwan <dougkwan@google.com>
8082
8083 * Makefile.am (HFILES): Add arm-reloc-property.h.
8084 (DEFFILES): New.
8085 (TARGETSOURCES): Add arm-reloc-property.cc
8086 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8087 (libgold_a_SOURCES): $(DEFFILES)
8088 * Makefile.in: Regenerate.
8089 * arm-reloc-property.cc: New file.
8090 * arm-reloc-property.h: New file.
8091 * arm-reloc.def: New file.
8092 * arm.cc: Update comments.
8093 (arm-reloc-property.h): New included header.
8094 (arm_reloc_property_table): New global variable.
8095 (Target_arm::do_select_as_default_target): New method definition.
8096 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8097 arm-reloc-property to targ_extra_obj.
8098 * parameters.cc (set_parameters_target): Call
8099 Target::select_as_default_target().
8100 * target.h (Target::select_as_default_target): New method definition.
8101 (Target::do_select_as_default_target): Same.
8102
8103 2010-02-01 Doug Kwan <dougkwan@google.com>
8104
8105 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8106 first_output_text_section_.
8107 (Arm_exidx_fixup::first_output_text_section): New method definition.
8108 (Arm_exidx_fixup::first_output_text_section_): New data member.
8109 (Arm_exidx_fixup::process_exidx_section): Record the first text
8110 output section seen.
8111 (Arm_output_section::fix_exidx_coverage): Set correct linked section
8112 and entsize in output section header.
8113
8114 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8115
8116 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8117 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8118 (Arm_relocate_functions::thm_alu11): New Method.
8119 (Arm_relocate_functions::thm_pc8): New Method.
8120 (Arm_relocate_functions::thm_pc12): New Method.
8121 (Target_arm::Scan::local): Handle the relocations.
8122 (Target_arm::Scan::global): Likewise.
8123 (Target_arm::Relocate::relocate): Likewise.
8124 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8125
8126 2010-01-29 Doug Kwan <dougkwan@google.com>
8127
8128 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8129 of relocation types as ld.
8130
8131 2010-01-29 Doug Kwan <dougkwan@google.com>
8132
8133 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8134 to public.
8135 (Arm_relocate_functions::thumb_branch_common): Ditto.
8136 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8137 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8138 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8139 Arm_relocate_functions::jump24): Remove.
8140 (Target_arm::Relocate::relocate): Adjust code to call
8141 Arm_relocation_functions::arm_branch_common and
8142 Arm_relocation_functions::thumb_branch_common instead of their removed
8143 wrappers. Merge switch-cases together to reduce source code size.
8144
8145 2010-01-29 Doug Kwan <dougkwan@google.com>
8146
8147 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8148 output_local_symbol_count_needs_update_.
8149 (Arm_relobj::output_local_symbol_count_needs_update,
8150 Arm_relobj::set_output_local_symbol_count_needs_update,
8151 Arm_relobj::update_output_local_symbol_count): New methods.
8152 (Arm_relobj::output_local_symbol_count_needs_update_): New data
8153 member.
8154 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8155 of pointed function as in a R_ARM_PREL31 relocation.
8156 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8157 for output local symbol count updating.
8158 (Target_arm::do_relax): Update output local symbol counts in objects
8159 if necessary.
8160 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8161
8162 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8163
8164 * arm.cc: Added support for the ARM relocations:
8165 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8166 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8167 (Arm_relocate_functions::movw_rel_nc): Renamed (was
8168 movw_prel_nc).
8169 (Arm_relocate_functions::movw_rel): New method.
8170 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8171 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8172 thm_movw_prel_nc).
8173 (Arm_relocate_functions::thm_movw_rel): New method.
8174 (Arm_relocate_functions::thm_movt_rel): Renamed (was
8175 thm_movt_prel).
8176 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8177 relocations.
8178 (Target_arm::Scan::global): Likewise.
8179 (Target_arm::Relocate::relocate): Likewise.
8180 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8181 Likewise.
8182
8183 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8184
8185 * arm.cc: Added support for ARM group relocations.
8186 (Target_arm::reloc_needs_sym_origin): New method.
8187 (Arm_relocate_functions::calc_grp_kn): New method.
8188 (Arm_relocate_functions::calc_grp_residual): New method.
8189 (Arm_relocate_functions::calc_grp_gn): New method.
8190 (Arm_relocate_functions::arm_grp_alu): New Method.
8191 (Arm_relocate_functions::arm_grp_ldr): New Method.
8192 (Arm_relocate_functions::arm_grp_ldrs): New Method.
8193 (Arm_relocate_functions::arm_grp_ldc): New Method.
8194 (Target_arm::Scan::local): Handle the ARM group relocations.
8195 (Target_arm::Scan::global): Likewise.
8196 (Target_arm::Relocate::relocate): Likewise.
8197 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8198 Likewise.
8199
8200 2010-01-26 Doug Kwan <dougkwan@google.com>
8201
8202 * arm.cc (set): Include.
8203 (class Arm_exidx_fixup): Change type of last_input_section_ to const
8204 pointer type.
8205 (Arm_output_section::Text_section_list): New type.
8206 (Arm_output_section::append_text_sections_to_list): New method.
8207 (Arm_output_section::fix_exidx_coverage): Ditto.
8208 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8209 (Arm_relobj::convert_input_section_to_relaxed_section): Use
8210 Relobj::set_section_offset() instead of
8211 Sized_relobj::invalidate_section_offset().
8212 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8213 parameter for section headers. Ignore relocation sections for
8214 unallocated sections and EXIDX sections.
8215 (Target_arm::fix_exidx_coverage): New method.
8216 (Target_arm::output_section_address_less_than): New type.
8217 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8218 linked text section instead of the EXIDX section.
8219 (Arm_output_section::create_stub_group): Add an assertion to check
8220 that this is not an EXIDX output section.
8221 (Arm_output_section::append_text_sections_to_list): New method.
8222 (Arm_output_section::fix_exidx_coverage): Ditto.
8223 (Arm_relobj::scan_sections_for_stubs): Adjust call to
8224 Arm_relobj::section_needs_reloc_stub_scanning.
8225 (Target_arm::do_relax): Fix EXIDX output section coverage in the
8226 first pass.
8227 (Target_arm::fix_exidx_coverage): New method.
8228 * object.h (Relobj::set_output_section): New method.
8229 (Sized_relobj::invalidate_section_offset): Remove method.
8230 (Sized_relobj::do_invalidate_section_offset): Remove method.
8231 (Sized_relobj::do_set_section_offset): Handle offset value -1.
8232
8233 2010-01-25 Doug Kwan <dougkwan@google.com>
8234
8235 * arm.cc (Arm_exidx_merged_section::do_output_offset):
8236 Fix warning due to signed and unsigned comparison on a 32-bit host.
8237
8238 2010-01-22 Doug Kwan <dougkwan@google.com>
8239
8240 * arm.cc (Target_arm::do_relax): Record an output section for section
8241 offset adjustment it contains any stub table that has changed.
8242 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8243 offsets in an output section if necessary.
8244 * output.cc (Output_section::Output_section): Initialize
8245 section_offsets_need_adjustments_.
8246 (Output_section::add_input_section_for_script): Renamed to
8247 Output_section::add_simple_input_section.
8248 (Output_section::save_states): Add a comment.
8249 (Output_section::discard_states): New method defintion.
8250 (Output_section::adjust_section_offsets): Same.
8251 * output.h (Output_section::add_input_section_for_script): Renamed to
8252 Output_section::add_simple_input_section.
8253 (Output_section::discard_states): New method declaration.
8254 (Output_section::adjust_section_offsets): Same.
8255 (Output_section::section_offsets_need_adjustment,
8256 Output_section::set_section_offsets_need_adjustment): New method
8257 definitions.
8258 (Output_section::section_offsets_need_adjustment_): New data member.
8259 * script-sections.cc
8260 (Output_section_element_input::set_section_address): Adjust code for
8261 renaming of Output_section::add_input_section_for_script.
8262 (Orphan_output_section::set_section_address): Same.
8263
8264 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8265
8266 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8267 Fix_v4bx enum values .
8268 * gold/options.h (General_options): New option definitions.
8269 (General_options::fix_v4bx): New method.
8270 (General_options::Fix_v4bx): New enum.
8271 * gold/options.cc (General_options::parse_fix_v4bx): New method.
8272 (General_options::parse_fix_v4bx_interworking): New method.
8273
8274 2010-01-22 Doug Kwan <dougkwan@google.com>
8275
8276 * arm.cc (Arm_exidx_fixup): New class.
8277
8278 2010-01-21 Doug Kwan <dougkwan@google.com>
8279
8280 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8281 classes.
8282 (Arm_exidx_section_offset_map): New type.
8283
8284 2010-01-21 Doug Kwan <dougkwan@google.com>
8285
8286 * arm.cc (Arm_exidx_input_section): New class.
8287 (Arm_relobj::exidx_input_section_by_link,
8288 Arm_relobj::exidx_input_section_by_shndx,
8289 Arm_relobj::make_exidx_input_section): New methods.
8290 (read_arm_attributes_section): Remove.
8291 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8292 information about them.
8293 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8294 to here.
8295
8296 2010-01-20 Doug Kwan <dougkwan@google.com>
8297
8298 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8299 Input_section_specifier to Section_id.
8300 (Target_arm::new_arm_input_section: Adjust code for change of key
8301 type.
8302 (Target_arm::find_arm_input_section): Ditto.
8303 * gc.h (object.h): Include for Section_id nand Section_id_hash.
8304 (Section_id): Remove.
8305 (Garbage_collection::Section_id_hash): Remove.
8306 * icf.h (object.h): Include for Section_id nand Section_id_hash.
8307 (Section_id): Remove.
8308 (Icf::Section_id_hash): Remove.
8309 * object.h (Section_id, Const_section_id, Section_id_hash,
8310 Const_section_id_hash): New type definitions.
8311 * output.cc (Output_section::add_relaxed_input_section): Change to
8312 use Const_section_id instead of Input_section_specifier as key type.
8313 (Output_section::add_merge_input_section): Ditto.
8314 (Output_section::build_relaxation_map): Change to use Section_id
8315 instead of Input_section_specifier as key type.
8316 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8317 Ditto.
8318 (Output_section::convert_input_sections_to_relaxed_sections): Change
8319 to use Const_section_id instead of Input_section_specifier as key type.
8320 (Output_section::find_merge_section): Ditto.
8321 (Output_section::find_relaxed_input_section): Ditto.
8322 * output.h (Input_section_specifier): Remove class.
8323 (Output_section::Output_section_data_by_input_section_map): Change
8324 key type to Const_section_id.
8325 (Output_section::Output_relaxed_input_section_by_input_section_map):
8326 Ditto.
8327 (Output_section::Relaxation_map): Change key type to Section_id.
8328
8329 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8330
8331 * gold/arm.cc: Added support for R_ARM_V4BX relocation
8332 (class Arm_v4bx_stub): New class.
8333 (DEF_STUBS): Updated definition to support v4_veneer_bx.
8334 (Stub_factory::make_arm_v4bx_stub): New method.
8335 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8336 (Stub_table::empty): Handle v4bx stubs.
8337 (Stub_table::add_arm_v4bx_stub): New method.
8338 (Stub_table::find_arm_v4bx_stub): New method.
8339 (Arm_relocate_functions::v4bx): New method.
8340 (Target_arm::fix_v4bx): New method.
8341 (Target_arm::Target_arm): Handle R_ARM_V4BX.
8342 (Stub_table::relocate_stubs): Likewise.
8343 (Stub_table::do_write): Likewise.
8344 (Stub_table::update_data_size_and_addralign): Likewise.
8345 (Stub_table::finalize_stubs): Likewise.
8346 (Target_arm::Scan::local): Likewise.
8347 (Target_arm::Scan::global): Likewise.
8348 (Target_arm::do_finalize_sections): Likewise.
8349 (Target_arm::Relocate::relocate): Likewise.
8350 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8351 Likewise.
8352 (Target_arm::scan_reloc_for_stub): Likewise.
8353 (Target_arm::scan_reloc_section_for_stubs): Likewise.
8354
8355 2010-01-19 Ian Lance Taylor <iant@google.com>
8356
8357 * output.cc (Output_section_headers::do_sized_write): Write large
8358 segment count to sh_info field.
8359 (Output_file_header::do_sized_write): For large segment count,
8360 write PN_XNUM to e_phnum field.
8361
8362 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8363
8364 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8365 (Arm_relocate_functions::thm_jump8): New function.
8366 (Arm_relocate_functions::thm_jump11): New function.
8367 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8368 R_ARM_THM_JUMP11.
8369 (Target_arm::Scan::global): Likewise.
8370 (Target_arm::Relocate::relocate): Likewise.
8371 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8372 Likewise.
8373
8374 2010-01-14 Doug Kwan <dougkwan@google.com>
8375
8376 * arm.cc (map, utility): Include headers.
8377 (Target_arm::apply_cortex_a8_workaround): New method.
8378 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8379 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8380 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8381 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8382 the --[no-]fix-cortex-a8 command line options.
8383 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8384 (Target_arm::relocate_stub): Use addend in instruction template.
8385 * options.h (DEFINE_bool): Set the user-set flag.
8386 (General_options): Add --[no-]-fix-cortex options.
8387 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8388 : Update fast look-up map after conversion.
8389
8390 2010-01-14 Sriraman Tallam <tmsriram@google.com>
8391
8392 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8393 in the first pass of do_layout.
8394
8395 2010-01-13 Doug Kwan <dougkwan@google.com>
8396
8397 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8398 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8399 apparent compiler problem of not folding static constant integral
8400 data members of elfcpp::Elf_sizes<32>.
8401
8402 2010-01-13 Doug Kwan <dougkwan@google.com>
8403
8404 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8405 Arm_relobj::section_needs_cortex_a8_stub_scanning,
8406 Arm_relobj::scan_section_for_cortex_a8_erratum,
8407 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8408 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8409 sections to scan for relocation stubs into a new method
8410 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
8411 relocation and Cortex-A8 stub scanning.
8412 (Target_arm::do_relax): Force stubs to be after stubbed sections
8413 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
8414 the beginning of a new relaxation pass. Update a comment.
8415 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8416
8417 2010-01-12 Ian Lance Taylor <iant@google.com>
8418
8419 * target-reloc.h (visibility_error): New inline function.
8420 (relocate_section): Call visibility_error.
8421 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8422 (MOSTLYCLEANFILES): Likewise.
8423 (protected_4_pic.o, protected_3.err): New targets.
8424 * testsuite/protected_4.cc: New file.
8425
8426 2010-01-12 Doug Kwan <dougkwan@google.com>
8427
8428 * arm.cc (Cortex_a8_reloc): New class.
8429 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8430 and cortex_a8_relocs_info_.
8431 (Target_arm::fix_cortex_a8): New method definition.
8432 (Target_arm::Cortex_a8_relocs_info): New type.
8433 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8434 New data member declarations.
8435 (Target_arm::scan_reloc_for_stub): Record information about
8436 relocations for THUMB branches that might be exempted from the
8437 Cortex-A8 workaround.
8438 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8439 at the beginning of a relaxation pass.
8440
8441 2010-01-12 Doug Kwan <dougkwan@google.com>
8442
8443 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8444 (Arm_relobj::Mapping_symbol_position,
8445 Arm_reloj::Mapping_symbol_position_less,
8446 Arm_relobj::Mapping_symbols_info): New types.
8447 (Target_arm::is_mapping_symbol_name): New method definition.
8448 (Arm_relobj::do_count_local_symbols): Save information about mapping
8449 symbols.
8450
8451 2010-01-11 Doug Kwan <dougkwan@google.com>
8452
8453 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8454 Arm_relocate_functions::thumb32_branch_upper,
8455 Arm_relocate_functions::thumb32_branch_lower,
8456 Arm_relocate_functions::thumb32_cond_branch_offset,
8457 Arm_relocate_functions::thumb32_cond_branch_upper,
8458 Arm_relocate_functions::thumb32_cond_branch_lower,
8459 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8460 branch offset encoding.
8461 (Arm_relocate_functions::thumb_branch_common): Use new branch
8462 offset encoding methods to avoid code duplication.
8463 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8464 (Stub_addend_reader::operator()): Use new branch encoding method
8465 to avoid code duplication.
8466
8467 2010-01-11 Doug Kwan <dougkwan@google.com>
8468
8469 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8470 (Target_arm::do_finalize_sections): Define special EXIDX section
8471 symbols only if referenced.
8472 * gc.h (Garbage_collection::add_reference): New method.
8473 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8474 code duplication.
8475
8476 2010-01-11 Ian Lance Taylor <iant@google.com>
8477
8478 * script.cc (Version_script_info::build_expression_list_lookup):
8479 Change complaing about duplicate wildcard match from error to
8480 warning.
8481
8482 * script.cc (class Lazy_demangler): Recreate--revert part of patch
8483 of 2009-12-30.
8484 (Version_script_info::Version_script_info): Initialize globs_,
8485 default_version_, default_is_global_, and exact_. Don't
8486 initialize globals_ or locals_.
8487 (Version_script_info::build_lookup_tables): Build local symbols
8488 first.
8489 (Version_script_info::unquote): New function.
8490 (Version_script_info::add_exact_match): New function.
8491 (Version_script_info::build_expression_list_lookup): Remove lookup
8492 parameter. Add is_global parameter. Change all callers. Handle
8493 wildcard pattern specially. Unquote pattern. Call
8494 add_exact_match.
8495 (Version_script_info::get_name_to_match): New function.
8496 (Version_script_info::get_symbol_version): New function.
8497 (Version_script_info::get_symbol_version_helper): Remove.
8498 (Version_script_info::check_unmatched_names): Call unquote.
8499 * script.h (class Version_script_info): Change get_symbol_version
8500 to be non-inline and add is_global parameter; change all callers.
8501 Rewrite symbol_is_local. Update declarations. Define struct
8502 Version_tree_match, Exact, Globs. Don't define struct Lookup.
8503 Remove globals_ and locals_ members. Add exact_, globs_,
8504 default_version_, is_global_.
8505 (Version_script_info::Glob): Remove pattern, add expression and
8506 is_global. Update constructor. Change all callers.
8507 * dynobj.cc (Versions::finalize): Mark the version symbol as the
8508 default version.
8509 (Versions::symbol_section_contents): If a symbol is undefined, or
8510 defined in a dynamic object, set the version index to
8511 VER_NDX_LOCAL.
8512 * symtab.cc (Symbol_table::add_from_relobj): Don't call
8513 symbol_is_local.
8514 (Symbol_table::add_from_pluginobj): Likewise.
8515 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8516
8517 2010-01-11 Doug Kwan <dougkwan@google.com>
8518
8519 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8520 (incremental_dump_LDADD): Add linking option for libintl.
8521 * Makefile.in: Regenerate.
8522
8523 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
8524
8525 PR gold/11144
8526 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8527 instead of -Ds.
8528 * testsuite/Makefile.in: Regenerated.
8529
8530 2010-01-10 Doug Kwan <dougkwan@google.com>
8531
8532 * options.h (DEFINE_var): Use parentheses around argument varname__
8533 in macro body to avoid any unintended subsequent substitutions.
8534
8535 2010-01-10 Ian Lance Taylor <iant@google.com>
8536
8537 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8538 candidates before doing symbol resolution.
8539
8540 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8541 ODR candidates if only one is weak.
8542
8543 2010-01-08 Ian Lance Taylor <iant@google.com>
8544
8545 * script.cc (Version_script_info::build_expression_list_lookup):
8546 Don't warn about ambiguous version, just record the ambiguity.
8547 (Version_script_info::get_symbol_version_helper): Give error if
8548 version is ambiguous.
8549
8550 2010-01-08 Doug Kwan <dougkwan@google.com>
8551
8552 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8553 prev_data_size_ and prev_addralign_. Remove initializer for
8554 deleted data member has_been_changed_.
8555 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8556 to determine if the table is empty.
8557 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8558 Remove.
8559 (Stub_table::add_reloc_stub): Define method in class definition
8560 instead of just declaring it there.
8561 (Stub_table::add_cortex_a8_stub): New method definition.
8562 (Stub_table::update_data_size_and_addralign): Ditto.
8563 (Stub_table::finalize_stubs): Ditto.
8564 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8565 (Stub_table::do_addralign_): Return address alignment in the
8566 (Stub_table::do_reset_address_and_file_offset): Define method in
8567 class definition instead of declaring it there. Set current data
8568 size to be the data size of the previous pass.
8569 (Stub_table::set_final_data_size): Use current data size as the
8570 final data size.
8571 (Stub_table::relocate_stub): Change parameter type of stub from
8572 Reloc_stub pointer to Stub pointer.
8573 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8574 (Stub_table::Cortex_a8_stub_list): New typedef.
8575 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8576 Stub_table::prev_addralign_): New data member.
8577 (Arm_relobj::Arm_relobj): Initialize data member
8578 section_has_cortex_a8_workaround_.
8579 (Arm_relobj::section_has_cortex_a8_workaround,
8580 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8581 definitions.
8582 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8583 declarations.
8584 (Target_arm::relocate_stub): Change parameter type of stub from
8585 Reloc_stub pointer to Stub pointer.
8586 (Insn_template::size, Insn_template::alignment): Handle
8587 THUMB16_SPECIAL_TYPE.
8588 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8589 Stub_table::update_data_size_and_addralign,
8590 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8591 definitions.
8592 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8593 (Stub_table::do_write): Ditto.
8594 (Target_arm::do_relax): Adjust code for changes in Stub_table.
8595
8596 2010-01-08 Ian Lance Taylor <iant@google.com>
8597
8598 PR 11108
8599 * symtab.h (class Symbol): Remove fields is_target_special_ and
8600 has_plt_offset_. Add field is_defined_in_discarded_section_.
8601 (Symbol::is_defined_in_discarded_section): New function.
8602 (Symbol::set_is_defined_in_discarded_section): New function.
8603 (Symbol::has_plt_offset): Rewrite.
8604 (Symbol::set_plt_offset): Verify that new offset is not -1U.
8605 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8606 Don't initialize is_target_special_ or has_plt_offset_.
8607 Initialize is_defined_in_discarded_section_.
8608 (Symbol_table::add_from_relobj): If appropriate, set
8609 is_defined_in_discarded_section.
8610 * resolve.cc (Symbol::override_base_with_special): Don't test
8611 is_target_special_. Change has_plt_offset_ to has_plt_offset().
8612 * target-reloc.h (relocate_section): Do special handling for
8613 symbols defined in discarded sections for global symbols as well
8614 as local symbols.
8615
8616 2010-01-08 Ian Lance Taylor <iant@google.com>
8617
8618 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8619 the SHT_SYMTAB case.
8620
8621 2010-01-08 Ian Lance Taylor <iant@google.com>
8622
8623 * object.cc (Sized_relobj::do_layout): Don't get confused if
8624 layout_eh_frame returns NULL.
8625
8626 2010-01-08 Ian Lance Taylor <iant@google.com>
8627
8628 PR 11084
8629 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8630 dynamic symbol table, use the normal symbol table.
8631 (Sized_dynobj::do_read_symbols): Remove assertion about type of
8632 symbol table.
8633
8634 2010-01-08 Ian Lance Taylor <iant@google.com>
8635
8636 PR 11072
8637 * layout.cc (Layout::include_section): Remove .gnu_debuglink
8638 sections.
8639
8640 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
8641
8642 * version.cc (print_version): Change to "Copyright 2010".
8643
8644 2010-01-08 Ian Lance Taylor <iant@google.com>
8645
8646 PR 10287
8647 PR 11063
8648 * i386.cc (class Target_i386): Change return type of plt_section
8649 to be non-const.
8650 (class Output_data_plt_i386): Add tls_desc_rel_ field.
8651 (Output_data_plt_i386::Output_data_plt_i386): Initialize
8652 tls_desc_rel_ field.
8653 (Output_data_plt_i386::rel_tls_desc): New function.
8654 (Target_i386::rel_tls_desc_section): New function.
8655 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8656 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8657 R_386_TLS_DESC reloc in rel_tls_desc_section.
8658 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8659 Define struct Tlsdesc_info.
8660 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8661 (Target_x86_64::do_reloc_symbol_index): New function.
8662 (Target_x86_64::add_tlsdesc_info): New function.
8663 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8664 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8665 tlsdesc_rel_ field.
8666 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
8667 all callers.
8668 (Output_data_plt_x86_64::rela_tlsdesc): New function.
8669 (Target_x86_64::rela_tlsdesc_section): New function.
8670 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8671 handling.
8672 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8673 (Target_x86_64::do_reloc_addend): New function.
8674 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8675 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8676 declarations. Define TARGET_CODE. Add arg field to u1_ union.
8677 (Output_reloc::type): New function.
8678 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8679 (Output_reloc::is_target_specific): New function.
8680 (Output_reloc::target_arg): New function.
8681 (class Output_reloc) [SHT_RELA]: Add four new constructors for
8682 absolute relocs and target specific relocs.
8683 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8684 add_target_specific.
8685 (class Output_data_reloc) [SHT_RELA]: Likewise.
8686 * output.cc (Output_reloc::Output_reloc): Add four new versions
8687 for absolute relocs and target specific relocs.
8688 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8689 (Output_reloc::get_symbol_index): Likewise.
8690 (Output_reloc::local_section_offset): Check that local_sym_index_
8691 is not TARGET_CODE or 0.
8692 (Output_reloc::symbol_value): Likewise.
8693 (Output_reloc::write) [SHT_RELA]: Call target for target specific
8694 reloc.
8695 * target.h (class Target): Add reloc_symbol_index and reloc_addend
8696 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
8697 functions.
8698 * layout.cc (add_target_dynamic_tags): Use output section for
8699 DT_PLTRELSZ and DT_JMPREL.
8700
8701 2010-01-07 Ian Lance Taylor <iant@google.com>
8702
8703 PR 11061
8704 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8705 function.
8706 (class Output_data_reloc_generic): Define.
8707 (class Output_data_reloc_base): Change base class to
8708 Output_data_reloc_generic. Change add() method to call
8709 bump_relative_reloc_count for a relative reloc. Remove
8710 sort_relocs_ field.
8711 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8712 to sort_relocs().
8713 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8714 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
8715 appropriate.
8716 * layout.h (class Layout): Update declaration.
8717
8718 2010-01-07 Ian Lance Taylor <iant@google.com>
8719
8720 * output.h (class Output_data): Add const version of
8721 output_section and do_output_section.
8722 (class Output_section_data): Add const version of
8723 do_output_section.
8724 (class Output_section): Likewise.
8725 * layout.cc (Layout::add_target_dynamic_tags): New function.
8726 * layout.h (class Layout): Update declarations.
8727 * arm.cc (Target_arm::do_finalize_sections): Use
8728 add_target_dynamic_tags.
8729 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8730 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8731 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8732 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8733
8734 2010-01-07 Ian Lance Taylor <iant@google.com>
8735
8736 PR 11042
8737 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8738 object as needed.
8739
8740 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
8741 Ian Lance Taylor <iant@google.com>
8742
8743 PR 11019
8744 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8745 Xindex::read_symtab_xindex.
8746
8747 2010-01-07 Doug Kwan <dougkwan@google.com>
8748
8749 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8750 (Insn_template::thumb16_bcond_insn): New method declaration.
8751 (Insn_template): Fix spelling.
8752 (Stub::thumb16_special): New method declaration.
8753 (Stub::do_write): Define virtual method which was previously pure
8754 virtual.
8755 (Stub::do_thumb16_special): New method declaration.
8756 (Stub::do_fixed_endian_write): New template member.
8757 (Reloc_stub::do_write): Remove.
8758 (Reloc_stub::do_fixed_endian_write): Remove.
8759 (Cortex_a8_stub): New class definition.
8760 (Stub_factory::make_cortex_a8_stub): New method definition.
8761 (Stub_factory::Stub_factory): Add missing static storage class
8762 qualifier for elf32_arm_stub_a8_veneer_blx.
8763
8764 2010-01-07 Ian Lance Taylor <iant@google.com>
8765
8766 PR 10980
8767 * options.h (class General_options): Add --warn-unresolved-symbols
8768 and --error-unresolved-symbols.
8769 * errors.cc (Errors::undefined_symbol): Implement
8770 --warn-unresolved-symbols.
8771
8772 * options.h (class General_options): Add -z text and -z textoff.
8773 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8774
8775 2010-01-06 Sriraman Tallam <tmsriram@google.com>
8776
8777 * gc.h (Garbage_collection::Cident_section_map): New typedef.
8778 (Garbage_collection::cident_sections): New function.
8779 (Garbage_collection::add_cident_section): New function.
8780 (Garbage_collection::cident_sections_): New member.
8781 (gc_process_relocs): Add references to sections whose names are C
8782 identifiers.
8783 * gold.h (cident_section_start_prefix): New constant.
8784 (cident_section_stop_prefix): New constant.
8785 (is_cident): New function.
8786 * layout.cc (Layout::define_section_symbols): Replace string constants
8787 with the newly defined constants.
8788 * object.cc (Sized_relobj::do_layout): Track sections whose names are
8789 C identifiers.
8790 * testsuite/Makefile.am: Add gc_orphan_section_test.
8791 * testsuite/Makefile.in: Regenerate.
8792 * testsuite/gc_orphan_section_test.cc: New file.
8793 * testsuite/gc_orphan_section_test.sh: New file.
8794
8795 2010-01-06 Ian Lance Taylor <iant@google.com>
8796
8797 PR 10980
8798 * options.h (class General_options): Add --warn-shared-textrel.
8799 * layout.cc (Layout::finish_dynamic_section): Implement
8800 --warn-shared-textrel.
8801
8802 PR 10980
8803 * options.h (class General_options): Add --warn-multiple-gp.
8804
8805 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8806
8807 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8808 $(THREADSLIB) and $(LIBDL).
8809 * Makefile.in: Rebuild.
8810
8811 2010-01-06 Ian Lance Taylor <iant@google.com>
8812
8813 PR 10980
8814 * options.cc (General_options::parse_section_start): New function.
8815 (General_options::section_start): New function.
8816 (General_options::General_options): Initialize all members.
8817 * options.h: Include <map>
8818 (class General_options): Add --section-start. Add section_starts_
8819 member.
8820 * layout.cc (Layout::attach_allocated_section_to_segment): If
8821 --section-start was used, set the address of the segment. Remove
8822 local sort_sections.
8823 (Layout::relaxation_loop_body): If the address of the load segment
8824 has been set by --section-start, don't use it.
8825 * output.h (Output_segment::update_flags_for_output_section): New
8826 function.
8827 * output.cc (Output_segment::add_output_section): Call
8828 update_flags_for_output_section.
8829
8830 2010-01-05 Ian Lance Taylor <iant@google.com>
8831
8832 PR 10980
8833 * options.h (class General_options): Add --undefined-version.
8834 * script.cc (struct Version_expression): Add was_matched_by_symbol
8835 field.
8836 (Version_script_info::matched_symbol): New function.
8837 (Version_script_info::get_symbol_version_helper): Call
8838 matched_symbol.
8839 (Version_script_info::check_unmatched_names): New function.
8840 * script.h (class Version_script_info): Update declarations.
8841 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8842
8843 * options.h (class General_options): Use DEFINE_bool_alias for
8844 allow_multiple_definition.
8845 * resolve.cc (Symbol_table::should_override): Don't test
8846 allow_multiple_definition.
8847
8848 PR 10980
8849 * options.h (class General_options): Add --cref.
8850 * main.cc (main): Print cref table if --cref. Don't close mapfile
8851 until after printing cref table.
8852 * cref.cc: Include "symtab.h".
8853 (class Cref_inputs): Define Cref_table_compare and Cref_table.
8854 (Cref_table_compare::operator()): New function.
8855 (Cref_inputs::gather_cref): New function.
8856 (filecol): New static const.
8857 (Cref_inputs::print_cref): New function.
8858 (Cref::print_cref): New function.
8859 * cref.h: Include <cstdio>.
8860 (class Cref): Update declarations.
8861 * mapfile.h (Mapfile::file): New function.
8862 * object.h (class Object): Define Symbols. Declare virtual
8863 do_get_global_symbols.
8864 (Object::get_global_symbols): New function.
8865 * object.cc (Input_objects::add_object): Pass object to cref_ if
8866 --cref.
8867 (Input_objects::archive_start): Likewise.
8868 (Input_objects::archive_stop): Likewise.
8869 (Input_objects::print_cref): New function.
8870 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8871 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8872 --cref.
8873 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8874 function.
8875 * plugin.h (class Sized_pluginobj): Update declarations.
8876
8877 2010-01-05 Ian Lance Taylor <iant@google.com>
8878
8879 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8880 to is_default_version. Rename insdef to insdefault.
8881 (Symbol_table::add_from_relobj): Rename def to is_default_version
8882 and local to is_forced_local.
8883 (Symbol_table::add_from_pluginobj): Likewise.
8884 (Symbol_table::add_from_dynobj): Likewise.
8885 (Symbol_table::define_special_symbol): Rename insdef to
8886 insdefault.
8887
8888 2010-01-04 Ian Lance Taylor <iant@google.com>
8889
8890 PR 10980
8891 * options.h (class General_options): Add
8892 --allow-multiple-definition and -z muldefs.
8893 * resolve.cc (Symbol_table::should_override): Don't warn about a
8894 multiple symbol definition if --allow-multiple-definition or -z
8895 muldefs.
8896
8897 PR 10980
8898 * options.h (class General_options): Add --add-needed and
8899 --copy-dt-needed-entries. Tweak --as-needed help entry.
8900 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8901 error if --copy-dt-needed-entries aka --add-needed is used and
8902 would cause a change in behaviour.
8903
8904 PR 10980
8905 * options.h (class General_options): Add -G as a short version of
8906 --shared. Add no-op options -assert, -g, and -i.
8907
8908 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8909
8910 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8911 check for .text or .gnu.linkonce.t sections.
8912 * icf.cc (Icf::find_identical_sections): Ditto.
8913 Change the detection for mangled function name within the section
8914 name.
8915 * icf.h (is_section_foldable_candidate): New function.
8916
8917 2009-12-30 Ian Lance Taylor <iant@google.com>
8918
8919 PR 10980
8920 * options.h (class General_options): Permit two dashes with
8921 --retain-symbols-file.
8922
8923 2009-12-30 Ian Lance Taylor <iant@google.com>
8924
8925 PR 10979
8926 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8927 don't put the file header and segment headers in the text
8928 segment.
8929
8930 PR 10979
8931 * common.cc (Sort_commons::operator()): Stabilize sort when both
8932 entries are NULL.
8933 (Symbol_table::do_allocate_commons_list): When allocating common
8934 symbols, skip a symbol which is no longer common.
8935 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8936 an object before checking its type.
8937 * testsuite/common_test_2.c: New file.
8938 * testsuite/common_test_3.c: New file.
8939 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8940 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8941 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8942 (common_test_2_pic.o, common_test_2.so): New targets.
8943 (common_test_3_pic.o, common_test_3.so): New targets.
8944 * testsuite/Makefile.in: Rebuild.
8945
8946 PR 10979
8947 * script.cc (read_input_script): If we see a new SECTIONS clause,
8948 and we have added an input section, give an error.
8949 * layout.h (class Layout): Add have_added_input_section function.
8950 Add have_added_input_section_ field.
8951 * layout.cc (Layout::Layout): Initialize
8952 have_added_input_section_.
8953 (Layout::layout): Set have_added_input_section_.
8954 (Layout::layout_eh_frame): Likewise.
8955
8956 2009-12-30 Ian Lance Taylor <iant@google.com>
8957
8958 PR 10931
8959 * options.h (class General_options): Add --sort-common option.
8960 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8961 * common.cc (Sort_common): Add sort_order parameter to
8962 constructor. Add sort_order_ field.
8963 (Sort_commons::operator): Check sort_order_.
8964 (Symbol_table::allocate_commons): Determine the sort order.
8965 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8966 Change all callers.
8967 (Symbol_table::do_allocate_commons_list): Likewise.
8968
8969 2009-12-30 Ian Lance Taylor <iant@google.com>
8970
8971 PR 10916
8972 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8973 symbols from this object, don't change the visibility of an
8974 undefined symbol.
8975 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8976
8977 2009-12-30 Ian Lance Taylor <iant@google.com>
8978
8979 PR 10861
8980 * script.h (class Version_script_info): Define Language enum.
8981 Update declarations. Define Glob, Exact, and Lookup types. Add
8982 new fields globals_, locals_, and is_finalized_.
8983 * script.cc: Various formatting fixes.
8984 (class Parser_closure): Change language_stack_ from a vector of
8985 std::string to one of Version_script_info::Language. Adjust all
8986 uses accordingly.
8987 (class Lazy_demangler): Remove.
8988 (struct Version_expression): Change language from std::string to
8989 Version_script_info::Language.
8990 (Version_script_info::Version_script_info): New function.
8991 (Version_script_info::~Version_script_info): Don't call clear.
8992 (Version_script_info::finalize): New function.
8993 (Version_script_info::build_lookup_tables): New function.
8994 (Version_script_info::build_expression_list_lookup): New
8995 function.
8996 (Version_script_info::get_symbol_version_helper): Rewrite to use
8997 lookup tables.
8998 (Version_script_info::print_expression_list): Adjust to use
8999 Version_script_info::Language.
9000 (script_push_lex_into_version_mode): Check that the version script
9001 has not been finalized.
9002 (version_script_push_lang): Change language string to
9003 Version_script_info::Language.
9004 * options.cc (Command_line::version_script): New function.
9005 * options.h (class General_options): Add finalize_dynamic_list
9006 function. Change version_script from declaration to definition.
9007 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9008 * testsuite/version_script.map: Remove duplicate def of foo.
9009 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9010 version_script.map.
9011 * testsuite/Makefile.in: Rebuild.
9012
9013 2009-12-30 Ian Lance Taylor <iant@google.com>
9014
9015 PR 10843
9016 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9017 if the input symbol index is 0, make the output symbol index 0.
9018
9019 2009-12-30 Ian Lance Taylor <iant@google.com>
9020
9021 PR 10670
9022 * options.h (class General_options): Add -x/--discard-all.
9023 * object.cc (Sized_relobj::do_count_local_symbols): Handle
9024 --discard-all. If the local symbol needs a dynamic entry, check
9025 that before handling --discard-locals.
9026
9027 2009-12-30 Ian Lance Taylor <iant@google.com>
9028
9029 PR 10450
9030 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9031 flags to PF_R.
9032 (Output_segment::add_output_section): Don't change the flags if
9033 the type is PT_TLS.
9034
9035 PR 10450
9036 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9037 GNU hash table if they need a dynamic value. Otherwise, don't add
9038 them if they are defined in a dynamic object or are forced local.
9039
9040 2009-12-29 Ian Lance Taylor <iant@google.com>
9041
9042 PR 10450
9043 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9044 .gnu.hash table for a 32-bit target.
9045
9046 PR 10450
9047 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9048 regular and a dynamic object only needs a dynamic symbol table
9049 entry if it is externally visible.
9050
9051 PR 10450
9052 * i386.cc (class Target_i386): Initialize global_offset_table_ in
9053 constructor. Add global_offset_table_ field.
9054 (Target_i386::got_section): Set global_offset_table_.
9055 (Target_i386::do_finalize_sections): Set global_offset_table_
9056 size.
9057 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9058 in constructor. Add global_offset_table_ field.
9059 (Target_x86_64::got_section): Set global_offset_table_.
9060 (Target_x86_64::do_finalize_sections): Set global_offset_table_
9061 size.
9062
9063 * layout.cc (Layout::Layout): Initialize increase_relro_.
9064 (Layout::get_output_section): Add is_relro, is_last_relro, and
9065 is_first_non_relro parameters. Change all callers.
9066 (Layout::choose_output_section): Likewise.
9067 (Layout::add_output_section_data): Likewise.
9068 (Layout::make_output_section): Likewise.
9069 (Layout::set_segment_offsets): Clear increase_relro when using a
9070 linker script.
9071 * layout.h (class Layout): Add increase_relro method. Add
9072 increase_relro_ field. Update declarations.
9073 * output.cc (Output_section::Output_section): Initialize
9074 is_last_relro_ and is_first_non_relro_.
9075 (Output_segment::add_output_section): Group relro sections is
9076 do_sort is true. Handle is_last_relro and is_first_non_relro.
9077 (Output_segment::maximum_alignment): Remove relro handling.
9078 (Output_segment::set_section_addresses): Add increase_relro
9079 parameter. Change all callers. Add initial alignment to align
9080 relro sections on separate page. Remove old relro handling.
9081 (Output_segment::set_section_list_addresses): Remove in_relro
9082 parameter. Change all callers.
9083 (Output_segment::set_offset): Add increase parameter. Change all
9084 callers. Remove old relro handling.
9085 * output.h (class Output_section): Add new methods: is_last_relro,
9086 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9087 Add is_last_relro_ and is_first_non_relro_ fields.
9088 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9089 Create separate .got.plt section. Call increase_relro.
9090 * x86_64.cc (Target_x86_64::got_section): Likewise.
9091 * testsuite/relro_script_test.t: Add .got.plt.
9092
9093 PR 10450
9094 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9095 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9096 (Layout::finalize): Call set_dynamic_symbol_size.
9097 (Layout::set_dynamic_symbol_size): New function.
9098 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
9099 set_dynamic_symbol_size.
9100
9101 PR 10450
9102 * output.h (class Output_section): Add is_entsize_zero_ field.
9103 * output.cc (Output_section::Output_section): Initialize
9104 is_entsize_zero_.
9105 (Output_section::set_entsize): If two different entsizes are
9106 requested, force it to zero.
9107 (Output_section::add_input_section): Set flags for .debug_str
9108 before updating section flags. Set entsize.
9109 (Output_section::update_flags_for_input_section): Set SHF_MERGE
9110 and SHF_STRING if all input sections have those flags.
9111
9112 2009-12-29 Rafael Espindola <espindola@google.com>
9113
9114 * main.cc (main): Fix the sys time reporting.
9115 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9116 reporting.
9117
9118 2009-12-29 Sriraman Tallam <tmsriram@google.com>
9119
9120 * options.cc (General_options::parse_version): Allow -v to exit
9121 without an error if there is nothing to link.
9122
9123 2009-12-29 Ian Lance Taylor <iant@google.com>
9124
9125 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9126 using a version of gcc before 4.1.
9127 * configure: Rebuild.
9128
9129 2009-12-28 Chris Demetriou <cgd@google.com>
9130
9131 * attributes.cc (Output_attributes_section_data::do_write): Use
9132 std::vector::front rather than std::vector::data.
9133
9134 2009-12-28 Ian Lance Taylor <iant@google.com>
9135
9136 * symtab.h (class Symbol_table): Add enum Defined.
9137 * resolve.cc (Symbol_table::should_override): Add defined
9138 parameter. Change all callers. Test whether object is NULL
9139 before calling a method on it.
9140 (Symbol_table::report_resolve_problem): Add defined parameter.
9141 Change all callers.
9142 (Symbol_table::should_override_with_special): Likewise.
9143 * symtab.cc (Symbol_table::define_in_output_data): Add defined
9144 parameter. Change all callers.
9145 (Symbol_table::do_define_in_output_data): Likewise.
9146 (Symbol_table::define_in_output_segment): Likewise.
9147 (Symbol_table::do_define_in_output_segment): Likewise.
9148 (Symbol_table::define_as_constant): Likewise.
9149 (Symbol_table::do_define_as_constant): Likewise.
9150 * script.h (class Symbol_assignment): Add is_defsym parameter to
9151 constructor; change all callers.
9152 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9153 parameter. Change all callers. Add is_defsym_ field.
9154 (class Parser_closure): Add parsing_defsym parameter to
9155 constructor; change all callers. Add parsing_defsym accessor
9156 function. Add parsing_defsym_ field.
9157
9158 2009-12-28 Ian Lance Taylor <iant@google.com>
9159
9160 * gold.cc (queue_middle_tasks): Fix formatting.
9161 * object.cc (Relobj::is_section_name_included): Likewise.
9162
9163 2009-12-23 Ian Lance Taylor <iant@google.com>
9164
9165 * i386.cc (Target_i386::do_calls_non_split): Recognize
9166 -fsplit-stack prologue for a function with a static chain.
9167 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9168 -fsplit-stack prologue when using %r11.
9169
9170 2009-12-21 Sriraman Tallam <tmsriram@google.com>
9171
9172 * options.cc (General_options::parse_version): Make -v continue and do
9173 the link like GNU ld does.
9174
9175 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
9176
9177 * Makefile.am (CCFILES): Add timer.cc.
9178 (HFILES): Add timer.h.
9179 * configure.ac: Check for sysconf and times.
9180 * main.cc: include timer.h.
9181 (main): Use Timer instead of get_run_time.
9182 * timer.cc: New.
9183 * timer.h: New.
9184 * workqueue.cc: include timer.h.
9185 (Workqueue::find_and_run_task):
9186 Report user, sys and wall time.
9187 * Makefile.in: Regenerate.
9188 * config.in: Regenerate.
9189 * configure: Regenerate.
9190
9191 2009-12-16 Doug Kwan <dougkwan@google.com>
9192
9193 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9194 sections.
9195 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9196 relaxed input sections.
9197 * output.cc (Output_section::find_relaxed_input_section): Change
9198 return type to Output_relaxed_input_section pointer. Adjust code
9199 for new type of relaxed_input_section_map_.
9200 * output.h (Output_section::find_relaxed_input_section): Change
9201 return type to Output_relaxed_input_section pointer.
9202 (Output_section::Output_relaxed_input_section_by_input_section_map):
9203 New type.
9204 (Output_section::relaxed_input_section_map_): Change type to
9205 Output_section::Output_relaxed_input_section_by_input_section_map.
9206 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9207 input section.
9208
9209 2009-12-15 Ian Lance Taylor <iant@google.com>
9210
9211 * layout.cc (Layout::create_shstrtab): Only write out after input
9212 sections if we are compressing debug sections.
9213
9214 2009-12-15 Ian Lance Taylor <iant@google.com>
9215
9216 * archive.cc (Archive::add_symbols): Only look up a symbol without
9217 a version if there is, in fact, a version.
9218
9219 2009-12-14 Ian Lance Taylor <iant@google.com>
9220
9221 Revert -Wshadow changes, all changes from:
9222 2009-12-11 Doug Kwan <dougkwan@google.com>
9223 2009-12-11 Nick Clifton <nickc@redhat.com>
9224 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9225
9226 2009-12-11 Doug Kwan <dougkwan@google.com>
9227
9228 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9229 due to -Wshadow.
9230 * attributes.cc (Object_attribute::size): Ditto.
9231 (Attributes_section_data::size): Ditto.
9232 (Attributes_section_data::Attributes_section_data): Ditto.
9233 (Output_attributes_section_data::do_write): Ditto.
9234 * attributes.h (Object_attribute::set_type): Ditto.
9235 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9236
9237 2009-12-11 Nick Clifton <nickc@redhat.com>
9238
9239 * archive.cc: Fix shadowed variable warnings.
9240 * arm.cc: Likewise.
9241 * compressed_output.cc: Likewise.
9242 * compressed_output.h: Likewise.
9243 * configure: Likewise.
9244 * dwarf_reader.cc: Likewise.
9245 * dynobj.cc: Likewise.
9246 * dynobj.h: Likewise.
9247 * ehframe.cc: Likewise.
9248 * ehframe.h: Likewise.
9249 * errors.cc: Likewise.
9250 * expression.cc: Likewise.
9251 * fileread.cc: Likewise.
9252 * fileread.h: Likewise.
9253 * freebsd.h: Likewise.
9254 * i386.cc: Likewise.
9255 * icf.cc: Likewise.
9256 * incremental.h: Likewise.
9257 * layout.cc: Likewise.
9258 * layout.h: Likewise.
9259 * mapfile.cc: Likewise.
9260 * merge.cc: Likewise.
9261 * merge.h: Likewise.
9262 * object.cc: Likewise.
9263 * object.h: Likewise.
9264 * options.h: Likewise.
9265 * output.cc: Likewise.
9266 * output.h: Likewise.
9267 * parameters.cc: Likewise.
9268 * plugin.cc: Likewise.
9269 * powerpc.cc: Likewise.
9270 * reduced_debug_output.cc: Likewise.
9271 * reduced_debug_output.h: Likewise.
9272 * reloc.cc: Likewise.
9273 * reloc.h: Likewise.
9274 * resolve.cc: Likewise.
9275 * script-sections.cc: Likewise.
9276 * script.cc: Likewise.
9277 * script.h: Likewise.
9278 * sparc.cc: Likewise.
9279 * symtab.cc: Likewise.
9280 * symtab.h: Likewise.
9281 * target-select.cc: Likewise.
9282 * target-select.h: Likewise.
9283 * token.h: Likewise.
9284 * workqueue.cc: Likewise.
9285 * workqueue.h: Likewise.
9286 * x86_64.cc: Likewise.
9287
9288 2009-12-10 Doug Kwan <dougkwan@google.com>
9289
9290 * arm.cc (attributes.h): New include.
9291 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9292 (Arm_relobj::~Arm_relobj): Delete object pointed by
9293 attributes_section_data_.
9294 (Arm_relobj::attributes_section_data): New method definition.
9295 (Arm_relobj::attributes_section_data_): New data member declaration.
9296 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9297 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9298 attributes_section_data_.
9299 (Arm_dynobj::attributes_section_data): New method definition.
9300 (Arm_dynobj::attributes_section_data_): New data member declaration.
9301 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
9302 initialization value of may_use_blx_ to false.
9303 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9304 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9305 object attributes to compute results instead of hard-coding.
9306 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9307 Target_arm::get_secondary_compatible_arch,
9308 Target_arm::set_secondary_compatible_arch
9309 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9310 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9311 New method declarations.
9312 (Target_arm::get_aeabi_object_attribute): New method definition.
9313 (Target_arm::attributes_section_data_): New data member declaration.
9314 (read_arm_attributes_section): New template definition.
9315 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9316 (Arm_dynobj::do_read_symbols): Ditto.
9317 (Target_arm::do_finalize_sections): Merge attributes sections from
9318 input. Check for BLX use after attributes section merging.
9319 Fix __exidx_start and __exidx_end visibility. Create an
9320 .ARM.attributes section if necessary.
9321 (Target_arm::get_secondary_compatible_arch,
9322 Target_arm::set_secondary_compatible_arch,
9323 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9324 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9325 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9326 New method definitions.
9327
9328 2009-12-09 Ian Lance Taylor <iant@google.com>
9329
9330 * plugin.cc (Plugin::load): Don't cast from void* to a function
9331 pointer.
9332
9333 2009-12-09 Ian Lance Taylor <iant@google.com>
9334
9335 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9336 information fields.
9337
9338 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
9339
9340 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9341 Replace two_file_shared_1.so with two_file_shared_2.so.
9342 * testsuite/Makefile.in: Regenerated.
9343
9344 2009-12-08 Doug Kwan <dougkwan@google.com>
9345
9346 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9347 (HFILES): Add attributes.h and int_encoding.h.
9348 * Makefile.in: Regenerate.
9349 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9350 function definitions to int_encoding.cc
9351 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9352 prototypes to int_encoding.h
9353 * reduced_debug_output.cc (int_encoding.h): New include.
9354 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9355 function definitions to int_encoding.cc
9356 (insert_into_vector, read_from_pointer): Move template definitions to
9357 int_encoding.h
9358 * attributes.cc: New file.
9359 * attributes.h: New file.
9360 * int_encoding.cc: New file.
9361 * int_encoding.h: New file.
9362
9363 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
9364
9365 PR gold/11055
9366 * incremental-dump.cc (dump_incremental_inputs): New.
9367 (main): Use dump_incremental_inputs.
9368
9369 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
9370
9371 PR gold/10893
9372 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9373 checking elfcpp::STT_FUNC.
9374 (Target_i386::Relocate::relocate): Likewise.
9375 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9376
9377 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9378 symbols from shared libraries into normal FUNC symbols.
9379
9380 * symtab.h (Symbol): Add is_func and use it.
9381
9382 2009-12-05 Doug Kwan <dougkwan@google.com>
9383
9384 * arm.cc (Target_arm::arm_info): Initialize new fields
9385 attributes_section and attributes_vendor.
9386 * i386.cc (Target_i386::i386_info): Same.
9387 * object.cc (Sized_relobj::do_layout): Skip attribute section.
9388 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9389 fields attributes_section and attributes_vendor.
9390 * sparc.cc (Target_sparc::sparc_info): Same.
9391 * target.h (Target::attributes_section, Target::attributes_vendor,
9392 Target::is_attributes_section, Target::attribute_arg_type,
9393 Target::attributes_order): New method definitions.
9394 (Target::Target_info::attributes_section,
9395 Target::Target_info::attributes_vendor): New fields.
9396 (Target::do_attribute_arg_type, Target::do_attributes_order): New
9397 virtual method definitions.
9398 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9399 attributes_section and attributes_vendor.
9400 * testsuite/testfile.cc (Target_test::test_target_info): Same.
9401
9402 2009-12-05 Doug Kwan <dougkwan@google.com>
9403
9404 * arm.cc: Update comments about interworking and stub generation.
9405 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9406 considered as non-PIC.
9407 (Arm_relocate_functions::base_abs): Fix formatting.
9408 (Arm_relocate_functions::got_prel): Fix comment. Change interface
9409 of function to use GOT entry address instead of offset.
9410 (Target_arm::Scan::global): Issue an error if a symbol would need a
9411 PLT does not get one because it is untyped. Remove code to create
9412 dynamic symbols for relative branches.
9413 (Target_arm::Relocate::relocate: Use 0 instead of false since function
9414 takes unsigned integer instead of boolean.
9415
9416 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
9417
9418 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9419 (two_file_test_LDADD): Likewise.
9420 (common_test_1_LDADD): Likewise.
9421 (exception_test_LDADD) Likewise.
9422 (weak_test_LDADD): Likewise.
9423 (many_sections_test_LDADD): Likewise.
9424 (initpri1_LDADD): Likewise.
9425 (script_test_1_LDADD): Likewise.
9426 (script_test_2_LDADD): Likewise.
9427 (justsyms_LDADD): Likewise.
9428 (binary_test_LDADD): Likewise.
9429 (large_LDADD): Likewise.
9430 * testsuite/Makefile.in: Regenerated.
9431
9432 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
9433
9434 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9435 (Symbol_table::override_with_special): Likewise.
9436 (Symbol_table::add_from_object): Likewise.
9437
9438 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9439
9440 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9441 Don't set the data_offset twice.
9442
9443 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9444
9445 * testsuite/Makefile.in: Regenerate.
9446
9447 2009-12-03 Doug Kwan <dougkwan@google.com>
9448
9449 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9450 (Target_arm::do_finalize_sections): Add parameter for symbol table
9451 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
9452 * i386.cc (Target_i386::do_finalize_sections): Add an additional
9453 parameter for symbol table pointer.
9454 * layout.cc (Layout::finalize): Call Target::finalize_sections with
9455 an additional parameter for a pointer to symbol table.
9456 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9457 parameter for a symbol table pointer.
9458 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9459 * target.h (Target::finalize_sections, Target::do_finalize_sections):
9460 Ditto.
9461 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9462 parameter for a symbol table pointer.
9463
9464 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
9465
9466 * incremental.cc (Incremental_inputs_header)
9467 (Incremental_inputs_header_write, Incremental_inputs_entry)
9468 (Incremental_inputs_entry_write): Move ...
9469 * incremental.h (Incremental_inputs_header)
9470 (Incremental_inputs_header_write, Incremental_inputs_entry)
9471 (Incremental_inputs_entry_write): here.
9472
9473 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9474
9475 * incremental.cc (make_sized_incremental_binary): Set the target.
9476 Error if it is incompatible.
9477 * output.h (Output_file): Add filename method.
9478
9479 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9480
9481 * incremental.cc (Incremental_inputs_entry): Remove unused argument
9482 from the get_* methods.
9483
9484 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9485
9486 * incremental-dump.cc (main): Check that the offeset of a script is 0.
9487 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9488 Write 0 for the data_offset of scripts.
9489
9490 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9491
9492 * testsuite/Makefile.am: Add the incremental_test.sh test.
9493 * testsuite/incremental_test.sh: New.
9494 * testsuite/incremental_test_1.c: New.
9495 * testsuite/incremental_test_2.c: New.
9496
9497 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
9498
9499 * incremental-dump.cc (main): Fix typos.
9500
9501 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
9502
9503 PR gold/11025
9504 * incremental-dump.cc (main): Use llu to print 64 bit values.
9505
9506 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
9507 H.J. Lu <hongjiu.lu@intel.com>
9508
9509 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9510 $(LIBDL).
9511 (incremental_dump_LDADD): Likewise.
9512 * Makefile.in: Regenerated.
9513
9514 2009-11-25 Doug Kwan <dougkwan@google.com>
9515
9516 Revert:
9517
9518 2009-11-25 Doug Kwan <dougkwan@google.com>
9519
9520 * arm.cc (Target_arm::Target_arm): Move method definition
9521 outside of class definition. Add code to handle
9522 --target1-rel, --target1-abs and --target2= options.
9523 (Target_arm::get_reloc_reloc_type): Change method to be
9524 non-static and const.
9525 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9526 New data member declaration.
9527 (Target_arm::Scan::local, Target_arm::Scan::global,
9528 Target_arm::Relocate::relocate,
9529 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9530 Adjust call to Target_arm::get_real_reloc_type.
9531 (Target_arm::get_real_reloc_type): Use command line options
9532 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9533 * options.h (--target1-rel, --target1-abs, --target2): New
9534 ARM-only options.
9535
9536 2009-11-25 Doug Kwan <dougkwan@google.com>
9537
9538 * arm.cc (Target_arm::Target_arm): Move method definition outside of
9539 class definition. Add code to handle --target1-rel, --target1-abs
9540 and --target2= options.
9541 (Target_arm::get_reloc_reloc_type): Change method to be non-static
9542 and const.
9543 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9544 member declaration.
9545 (Target_arm::Scan::local, Target_arm::Scan::global,
9546 Target_arm::Relocate::relocate,
9547 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9548 call to Target_arm::get_real_reloc_type.
9549 (Target_arm::get_real_reloc_type): Use command line options to
9550 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9551 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9552 options.
9553
9554 2009-11-25 Doug Kwan <dougkwan@google.com>
9555
9556 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9557 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9558 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9559 formatting.
9560 (Arm_relocate_functions::thm_call): Replace body with a call to
9561 Arm_relocate_functions::thumb_branch_common.
9562 (Arm_relocate_functions::thm_jump24,
9563 Arm_relocate_functions::thm_xpc22): New method definitions.
9564 (Arm_relocate_functions::thumb_branch_common): New method definition.
9565 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9566 operator.
9567 (Target_arm::Relocate::relocate): Adjust call to thm_call.
9568 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9569
9570 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9571
9572 * Makefile.am: Build incremental-dump
9573 * Makefile.in: Regenerate.
9574 * incremental-dump.cc: New.
9575 * incremental.cc (Incremental_inputs_header_data,
9576 Incremental_inputs_entry_data): Move to incremental.h
9577 * incremental.h: (Incremental_inputs_header_data,
9578 Incremental_inputs_entry_data): Move from incremental.cc
9579
9580 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9581
9582 * incremental.cc (Incremental_inputs_header,
9583 Incremental_inputs_header_write, Incremental_inputs_entry,
9584 Incremental_inputs_entry_write): Add a typedef with the data type.
9585
9586 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9587
9588 * incremental.cc (Incremental_inputs_header,
9589 Incremental_inputs_header_write, Incremental_inputs_entry,
9590 Incremental_inputs_entry_write): Update comment about which
9591 type has the filed descriptions.
9592
9593 2009-11-15 Doug Kwan <dougkwan@google.com>
9594
9595 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9596 (Arm_relocate_functions::arm_branch_common): Change method defintion
9597 in class definition to a method declaration and update list of formal
9598 parameters.
9599 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9600 Arm_relocation_functions::jump24): Adjust call to
9601 Arm_relocate_functions::arm_branch_common. Update list of formal
9602 parameters.
9603 (Arm_relocate_functions::xpc25): New method definition.
9604 (Arm_relocate_functions::arm_branch_common): Move method defintion
9605 out from class definition. Use stubs for mode-switching and extending
9606 branch ranges.
9607 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9608 specially. Change code to enable use of stubs in ARM branches.
9609
9610 2009-11-10 Doug Kwan <dougkwan@google.com>
9611
9612 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9613 in method declaration.
9614 (Target_arm::relocate_stub): New method declaration.
9615 (Target_arm::default_target): Change to return a pointer instead of
9616 a const reference.
9617 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9618 Target_arm::default_target.
9619 (Arm_Relobj::do_relocate_sections): Remove options paramater in
9620 method definition.
9621 (Target_arm::relocate_section): Adjust view.
9622 (Target_arm::relocate_stub): New method definition.
9623
9624 2009-11-10 Doug Kwan <dougkwan@google.com>
9625
9626 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9627 a format warning.
9628 * incremental.cc (open_incremental_binary): Initialized local
9629 variables to avoid warnings.
9630 * object.cc (make_elf_object): Ditto.
9631 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9632 a format warning.
9633
9634 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
9635
9636 PR gold/10930
9637 * testsuite/plugin_test.c: Include "config.h".
9638
9639 2009-11-09 Doug Kwan <dougkwan@google.com>
9640
9641 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9642 (arm_symbol_value): Remove.
9643 (Arm_relocate_functions::arm_branch_common,
9644 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9645 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9646 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9647 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9648 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9649 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9650 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9651 Arm_relocate_functions::thm_mobw_abs_nc,
9652 Arm_relocate_functions::thm_mov_abs,
9653 Arm_relocate_functions::movw_prel_nc,
9654 Arm_relocate_functions::thm_movt_abs,
9655 Arm_relocate_functions::movt_prel,
9656 Arm_relocate_functions::thm_movw_prel_nc,
9657 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9658 (Target_arm::Relocate::relocate): Only decompose address into two
9659 parts if relocation type uses the thumb-bit and pass the actual
9660 bit instead of a flag indicating that the thumb-bit is used. Adjust
9661 calls to methods in Arm_relocate_functions for this change.
9662
9663 2009-11-08 Ian Lance Taylor <iant@google.com>
9664
9665 PR 10925
9666 * reloc.cc: Instantiate
9667 Sized_relobj::initialize_input_to_output_maps and
9668 Sized_relobj:free_input_to_output_maps.
9669
9670 2009-11-06 Ian Lance Taylor <iant@google.com>
9671
9672 PR 10876
9673 * defstd.cc (in_segment): Set only_if_ref true for "end".
9674
9675 2009-11-06 Doug Kwan <dougkwan@google.com>
9676
9677 * arm.cc (class Reloc_stub): Correct a comment.
9678 (Target_arm::Target_arm): Initialize arm_input_section_map_.
9679 (Target_arm::scan_section_for_stubs): New method declaration.
9680 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9681 Change methods from private to protected.
9682 (Target_arm::do_may_relax): New method definition.
9683 (Target_arm::do_relax, Target_arm::group_sections,
9684 Target_arm::scan_reloc_for_stub,
9685 Target_arm::scan_reloc_section_for_stubs): New method declarations.
9686 (Target_arm::arm_input_section_map_): New data member declaration.
9687 (Target_arm::scan_reloc_for_stub,
9688 Target_arm::scan_reloc_section_for_stubs,
9689 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9690 Target_arm::do_relax): New method definitions.
9691
9692 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
9693
9694 * configure.ac: Check for (struct stat)::st_mtim
9695 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9696 * config.in: Regenerate.
9697 * configure: Regenerate.
9698
9699 2009-11-05 Ian Lance Taylor <iant@google.com>
9700
9701 PR 10910
9702 * output.cc (Output_segment::add_output_section): Add missing
9703 return statement.
9704
9705 2009-11-04 Ian Lance Taylor <iant@google.com>
9706
9707 PR 10880
9708 * object.h (class Object): Add is_needed and set_is_needed
9709 methods. Add is_needed_ field. Make bool fields into bitfields.
9710 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9711 defined in a dynamic object and referenced by a regular object,
9712 set is_needed for the dynamic object.
9713 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9714 if the file is marked with as_needed and it is not needed.
9715
9716 2009-11-04 Ian Lance Taylor <iant@google.com>
9717
9718 PR 10887
9719 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9720 tags if data is discarded by linker script.
9721 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9722 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9723 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9724 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9725
9726 2009-11-04 Ian Lance Taylor <iant@google.com>
9727
9728 * layout.cc (Layout::get_output_section): Add is_interp and
9729 is_dynamic_linker_section parameters. Change all callers.
9730 (Layout::choose_output_section): Likewise.
9731 (Layout::make_output_section): Likewise.
9732 (Layout::add_output_section_data): Add is_dynamic_linker_section
9733 parameter. Change all callers.
9734 * layout.h (class Layout): Update declarations.
9735 * output.h (class Output_section): Add is_interp, set_is_interp,
9736 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9737 Add is_interp_, is_dynamic_linker_section_ fields. Change
9738 generate_code_fills_at_write_ to a bitfield.
9739 * output.cc (Output_section::Output_sections): Initialize new
9740 fields.
9741 (Output_segment::add_output_section): Add do_sort parameter.
9742 Change all callers.
9743
9744 2009-11-03 Ian Lance Taylor <iant@google.com>
9745
9746 PR 10860
9747 * options.h (class General_options): Add --warn-common.
9748 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9749 merging two common symbols.
9750 (Symbol_table::should_override): Handle --warn-common when merging
9751 a common symbol with a defined symbol. Use report_resolve_problem
9752 for multiple definitions.
9753 (Symbol_table::report_resolve_problem): New function.
9754 * symtab.h (class Symbol_table): Declare report_resolve_problem.
9755
9756 2009-11-03 Doug Kwan <dougkwan@google.com>
9757
9758 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9759 stub_factory_.
9760 (Target_arm::stub_factory): New method definition.
9761 (Target_arm::new_arm_input_section,
9762 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9763 Target_arm::reloc_uses_thumb_bit): New method declarations.
9764 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9765 New type definitions.
9766 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9767 member declarations.
9768 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9769 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9770 New method definitions.
9771
9772 2009-11-03 Ian Lance Taylor <iant@google.com>
9773
9774 * options.h (class General_options): Add --warn_constructors.
9775
9776 2009-11-03 Ian Lance Taylor <iant@google.com>
9777
9778 PR 10893
9779 * defstd.cc (in_section): Add entries for __rel_iplt_start,
9780 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9781
9782 2009-11-03 Ian Lance Taylor <iant@google.com>
9783
9784 PR 10895
9785 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9786 --msgid-bugs-address.
9787 (install-pdf): New target.
9788 (install-data_yes): Look up one directory to find mkinstalldirs.
9789
9790 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
9791
9792 * po/Make-in (.po.gmo): Don't generate .gmo files in source
9793 tree.
9794
9795 2009-10-30 Doug Kwan <dougkwan@google.com>
9796
9797 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9798
9799 2009-10-30 Doug Kwan <dougkwan@google.com>
9800
9801 * arm.cc (Stub_addend_reader): New struct template definition
9802 and partial specializations.
9803 (Stub_addend_reader::operator()): New method definition for a
9804 partially specialized template.
9805
9806 2009-10-30 Doug Kwan <dougkwan@google.com>
9807
9808 * arm.cc (Arm_relobj::processor_specific_flags): New method
9809 definition.
9810 (Arm_relobj::do_read_symbols): New method declaration.
9811 (Arm_relobj::processor_specific_flags_): New data member declaration.
9812 (Arm_dynobj): New class definition.
9813 (Target_arm::do_finalize_sections): Add input_objects parameter.
9814 (Target_arm::do_adjust_elf_header): New method declaration.
9815 (Target_arm::are_eabi_versions_compatible,
9816 (Target_arm::merge_processor_specific_flags): New method declaration.
9817 (Target_arm::do_make_elf_object): New overloaded method definitions
9818 and declaration.
9819 (Arm_relobj::do_read_symbols): New method definition.
9820 (Arm_dynobj::do_read_symbols): Ditto.
9821 (Target_arm::do_finalize_sections): Add input_objects parameters.
9822 Merge processor-specific flags from all input objects.
9823 (Target_arm::are_eabi_versions_compatible,
9824 Target_arm::merge_processor_specific_flags,
9825 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9826 New method definitions.
9827 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9828 Input_objects pointer type parameter.
9829 * layout.cc (Layout::finalize): Pass input objects to target's.
9830 finalize_sections function.
9831 * output.cc (Output_file_header::do_sized_write): Set ELF file
9832 header's processor-specific flags.
9833 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9834 Input_objects pointer type parameter.
9835 * sparc.cc (Target_sparc::do_finalize_sections): Same.
9836 * target.h (Input_objects): New forward class declaration.
9837 (Target::processor_specific_flags,
9838 Target::are_processor_specific_flags_sect): New method definitions.
9839 (Target::finalize_sections): Add input_objects parameter.
9840 (Target::Target): Initialize processor_specific_flags_ and
9841 are_processor_specific_flags_set_.
9842 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9843 parameter.
9844 (Target::set_processor_specific_flags): New method definition.
9845 (Target::processor_specific_flags_,
9846 Target::are_processor_specific_flags_set_): New data member
9847 declarations.
9848 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9849 Input_objects pointer type parameter.
9850
9851 2009-10-30 Doug Kwan <dougkwan@google.com>
9852
9853 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9854
9855 2009-10-28 Ian Lance Taylor <iant@google.com>
9856
9857 * object.h (class Relobj): Drop options parameter from
9858 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9859 do_scan_relocs, do_relocate. Change all callers.
9860 (class Sized_relobj): Drop options parameters from
9861 do_gc_process_relocs, do_scan_relocs, do_relocate,
9862 do_relocate_sections, relocate_sections, emit_relocs_scan,
9863 emit_relocs_scan_reltype. Change all callers.
9864 (struct Relocate_info): Remove options field and all references to
9865 it.
9866 * reloc.h (class Read_relocs): Remove options constructor
9867 parameter and options_ field. Change all callers.
9868 (class Gc_process_relocs, class Scan_relocs): Likewise.
9869 (class Relocate_task): Likewise.
9870 * target-reloc.h (scan_relocs): Remove options parameter. Change
9871 all callers.
9872 (scan_relocatable_relocs): Likewise.
9873 * target.h (class Sized_target): Remove options parameter from
9874 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9875 all callers.
9876 * gc.h (gc_process_relocs): Remove options parameter. Change all
9877 callers.
9878 * arm.cc: Update functions to remove options parameters.
9879 * i386.cc: Likewise.
9880 * powerpc.cc: Likewise.
9881 * sparc.cc: Likewise.
9882 * x86_64.cc: Likewise.
9883 * testsuite/testfile.cc: Likewise.
9884
9885 2009-10-28 Doug Kwan <dougkwan@google.com>
9886
9887 * arm.cc (Arm_relobj): New class definition.
9888 (Arm_relobj::scan_sections_for_stubs,
9889 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9890 New method definitions.
9891
9892 2009-10-28 Cary Coutant <ccoutant@google.com>
9893
9894 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9895 (Plugin::cleanup_done_): New member.
9896 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9897 (Plugin_manager::cleanup_done_): Remove.
9898 (Plugin_manager::add_input_file): Edit error message.
9899 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9900 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9901
9902 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9903
9904 * fileread.cc: (File_read::View::~View): Use the new
9905 data_ownership_ filed.
9906 (File_read::~File_read): Dispose the new whole_file_view_.
9907 (File_read::open): Mmap the whole file if needed.
9908 (File_read::open): Use whole_file_view_ instead of contents_.
9909 (File_read::find_view): Use whole_file_view_ if applicable.
9910 (File_read::do_read): Use whole_file_view_ instead of contents_.
9911 (File_read::make_view): Use whole_file_view_ instead of contents_,
9912 update File_read::View::View call.
9913 (File_read::find_or_make_view): Update File_read::View::View
9914 call.
9915 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9916 remove contents_
9917 (File_read::View::Data_ownership): New enum.
9918 (File_read::View::View): Replace bool mapped_ with Data_ownership
9919 argument.
9920 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9921 (File_read::View::data_ownership_): New field.
9922 (File_read::contents_): Remove (replaced by whole_file_view_).
9923 (File_read::whole_file_view_): New field.
9924 * options.h (class General_options): Add --keep-files-mapped.
9925
9926 2009-10-27 Cary Coutant <ccoutant@google.com>
9927
9928 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9929 * testsuite/Makefile.am (plugin_test_5): New test case.
9930 * testsuite/Makefile.in: Regenerate.
9931
9932 2009-10-25 Doug Kwan <dougkwan@google.com>
9933
9934 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9935 from private to protected to allow access by child class.
9936 (Sized_relobj::do_relocate_sections): New method declaration.
9937 (Sized_relobj::relocate_sections): Virtualize.
9938 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9939 Sized_relobj::relocate_sections. Instantiate template explicitly
9940 for different target sizes and endianity.
9941
9942 2009-10-24 Doug Kwan <dougkwan@google.com>
9943
9944 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9945 (Arm_input_section::as_arm_input_section): New method.
9946 (Arm_output_section): New class definition.
9947 (Arm_output_section::create_stub_group,
9948 Arm_output_section::group_sections): New method definitions.
9949
9950 2009-10-22 Doug Kwan <dougkwan@google.com>
9951
9952 * arm.cc (Arm_input_section): New class definition.
9953 (Arm_input_section::init, Arm_input_section:do_write,
9954 Arm_input_section::set_final_data_size,
9955 Arm_input_section::do_reset_address_and_file_offset): New method
9956 definitions.
9957
9958 2009-10-21 Doug Kwan <dougkwan@google.com>
9959
9960 * arm.cc (Stub_table, Arm_input_section): New forward class
9961 declarations.
9962 (Stub_table): New class defintion.
9963 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9964 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9965 New method definition.
9966
9967 2009-10-21 Doug Kwan <dougkwan@google.com>
9968
9969 * arm.cc: Update copyright comments.
9970 (Target_arm): New forward class template declaration.
9971 (Arm_address): New type.
9972 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9973 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9974 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9975 constants.
9976 (Insn_template): Same.
9977 (DEF_STUBS): New macro.
9978 (Stub_type): New enum type.
9979 (Stub_template): New class definition.
9980 (Stub): Same.
9981 (Reloc_stub): Same.
9982 (Stub_factory): Same.
9983 (Target_arm::Target_arm): Initialize may_use_blx_ and
9984 should_force_pic_veneer_.
9985 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9986 Target_arm::should_force_pic_veneer,
9987 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9988 Target_arm::using_thumb_only, Target_arm:;default_target): New
9989 method defintions.
9990 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9991 New data member declarations.
9992 (Insn_template::size, Insn_template::alignment): New method defintions.
9993 (Stub_template::Stub_template): New method definition.
9994 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9995 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9996 (Stub_factory::Stub_factory): New method definition.
9997 * gold.h (string_hash): New template.
9998 * output.h (Input_section_specifier::hash_value): Use
9999 gold::string_hash.
10000 (Input_section_specifier::string_hash): Remove.
10001 * stringpool.cc (Stringpool_template::string_hash): Use
10002 gold::string_hash.
10003
10004 2009-10-20 Doug Kwan <dougkwan@google.com>
10005
10006 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10007 symbols of relaxed input sections.
10008 * output.h (Output_section::find_relaxed_input_section): Make
10009 method public.
10010
10011 2009-10-16 Doug Kwan <dougkwan@google.com>
10012
10013 * dynobj.cc (Versions::Versions): Initialize version_script_.
10014 Only insert base version symbol definition for a shared object
10015 if version script defines any version versions.
10016 (Versions::define_base_version): New method definition.
10017 (Versions::add_def): Check that base version is not needed.
10018 (Versions::add_need): Define base version lazily.
10019 * dynobj.h (Versions::define_base_version): New method declaration.
10020 (Versions::needs_base_version_): New data member declaration.
10021 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10022 (check_DATA): Add no_version_test.stdout.
10023 (libno_version_test.so, no_version_test.o no_version_test.stdout):
10024 New make rules.
10025 * testsuite/Makefile.in: Regenerate.
10026 * testsuite/no_version_test.c: New file.
10027 * testsuite/no_version_test.sh: Ditto.
10028
10029 2009-10-16 Doug Kwan <dougkwan@google.com>
10030
10031 * expression.cc (class Segment_start_expression): New class definition.
10032 (Segment_start_expression::value): New method definition.
10033 (script_exp_function_segment_start): Return a new
10034 Segment_start_expression.
10035 * gold/script-c.h (script_saw_segment_start_expression): New function
10036 prototype.
10037 * script-sections.cc (Script_sections::Script_sections): Initialize
10038 SAW_SEGMENT_START_EXPRESSION_ to false.
10039 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10040 and -Tbbs options to specify section addresses if given in
10041 command line and no SEGMENT_START expression is seen in a script.
10042 * script-sections.h (Script_sections::saw_segment_start_expression,
10043 Script_sections::set_saw_segment_start_expression): New method
10044 definition.
10045 (Script_sections::saw_segment_start_expression_): New data member
10046 declaration.
10047 * script.cc (script_saw_segment_start_expression): New function.
10048 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10049 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10050 script_test_7.sh and script_test_8.sh.
10051 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10052 script_test_8.stdout.
10053 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10054 (script_test_6, script_test_6.stdout, script_test_7,
10055 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10056 * Makefile.in: Regenerate.
10057 * testsuite/script_test_6.sh: New file.
10058 * testsuite/script_test_6.t: Same.
10059 * testsuite/script_test_7.sh: Same.
10060 * testsuite/script_test_7.t: Same.
10061 * testsuite/script_test_8.sh: Same.
10062
10063 2009-10-16 Doug Kwan <dougkwan@google.com>
10064
10065 * output.cc (Output_segment::set_section_list_address): Cast
10066 expressions to unsigned long long type to avoid format warnings.
10067
10068 2009-10-15 Ian Lance Taylor <iant@google.com>
10069
10070 * script.cc (Script_options::add_symbol_assignment): Always add a
10071 dot assignment to script_sections_.
10072 * script-sections.cc (Script_sections::add_dot_assignment):
10073 Initialize if necessary.
10074
10075 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10076 program headers with no load segment if there is a linker script.
10077
10078 * layout.cc (Layout::set_segment_offsets): Align the file offset
10079 to the segment aligment for -N or -n with no load segment.
10080 * output.cc (Output_segment::add_output_section): Don't crash if
10081 the first section is a TLS section.
10082 (Output_segment::set_section_list_addresses): Print an error
10083 message if the address moves backward in a linker script.
10084 * script-sections.cc
10085 (Output_section_element_input::set_section_addresses): Don't
10086 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10087 (Orphan_output_section::set_section_addresses): Likewise.
10088
10089 2009-10-15 Doug Kwan <dougkwan@google.com>
10090
10091 * layout.cc (Layout::finish_dynamic_section): Generate tags
10092 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10093 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10094 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10095
10096 2009-10-14 Ian Lance Taylor <iant@google.com>
10097
10098 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10099 fields.
10100 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10101 data_shdr fields of relinfo.
10102 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10103 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
10104 R_386_TLS_LDO_32, adjust based on section flags.
10105 (Target_i386::Relocate::fix_up_ldo): Remove.
10106
10107 2009-10-13 Ian Lance Taylor <iant@google.com>
10108
10109 Add support for -pie.
10110 * options.h (class General_options): Add -pie and
10111 --pic-executable.
10112 (General_options::output_is_position_independent): Test -pie.
10113 (General_options::output_is_executable): Return true if not shared
10114 and not relocatable.
10115 (General_options::output_is_pie): Remove.
10116 * options.cc (General_options::finalize): Reject incompatible uses
10117 of -pie.
10118 * gold.cc (queue_middle_tasks): A -pie link is not static.
10119 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10120 * symtab.cc (Symbol::final_value_is_known): Return false if
10121 output_is_position_independent.
10122 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10123 output_is_position_independent.
10124 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10125 output_is_position_independent.
10126 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10127 output_is_position_independent.
10128 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10129 two_file_pie_test.
10130 (basic_pie_test.o, basic_pie_test): New targets.
10131 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10132 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10133 (two_file_pie_test): New target.
10134 * testsuite/Makefile.in: Rebuild.
10135 * README: Remove note saying that -pie is not supported.
10136
10137 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
10138
10139 * options.h (class General_options): Add -init and -fini.
10140 * layout.cc (Layout::finish_dynamic_section): Emit
10141 given init and fini functions.
10142
10143 2009-10-13 Sriraman Tallam <tmsriram@google.com>
10144
10145 * gc.h (gc_process_relocs): Check if icf is enabled using new
10146 function.
10147 * gold.cc (queue_initial_tasks): Likewise.
10148 (queue_middle_tasks): Likewise.
10149 * object.cc (do_layout): Likewise.
10150 * symtab.cc (is_section_folded): Likewise.
10151 * main.cc (main): Likewise.
10152 * reloc.cc (Read_relocs::run): Likewise.
10153 (Sized_relobj::do_scan_relocs): Likewise.
10154 * icf.cc (is_function_ctor_or_dtor): New function.
10155 (Icf::find_identical_sections): Check if function is ctor or dtor when
10156 safe icf is chosen.
10157 * options.h (General_options::icf): Change option to be an enum.
10158 (Icf_status): New enum.
10159 (icf_enabled): New method.
10160 (icf_safe_folding): New method.
10161 (set_icf_status): New method.
10162 (icf_status_): New variable.
10163 * (options.cc) (General_options::finalize): Set icf_status_.
10164 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10165 icf_test and icf_keep_unique_test to use the --icf enum flag.
10166 * testsuite/icf_safe_test.sh: New file.
10167 * testsuite/icf_safe_test.cc: New file.
10168
10169 2009-10-12 Sriraman Tallam <tmsriram@google.com>
10170
10171 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10172 includes to gc.h and icf.h.
10173 * arm.cc: Include gc.h.
10174 * gold.cc: Likewise.
10175 * i386.cc: Likewise.
10176 * powerpc.cc: Likewise.
10177 * sparc.cc: Likewise.
10178 * x86_64.cc: Likewise.
10179 * gc.h: Include icf.h.
10180
10181 2009-10-11 Ian Lance Taylor <iant@google.com>
10182
10183 * plugin.cc: Include "gold.h" before other header files.
10184
10185 2009-10-10 Chris Demetriou <cgd@google.com>
10186
10187 * options.h (Input_file_argument::Input_file_type): New enum.
10188 (Input_file_argument::is_lib_): Replace with...
10189 (Input_file_argument::type_): New member.
10190 (Input_file_argument::Input_file_argument): Take Input_file_type
10191 'type' rather than boolean 'is_lib' as second argument.
10192 (Input_file_argument::is_lib): Use type_.
10193 (Input_file_argument::is_searched_file): New function.
10194 (Input_file_argument::may_need_search): Handle is_searched_file.
10195 * options.cc (General_options::parse_library): Support -l:filename.
10196 (General_options::parse_just_symbols): Update for Input_file_argument
10197 changes.
10198 (Command_line::process): Likewise.
10199 * archive.cc (Archive::get_file_and_offset): Likewise.
10200 * plugin.cc (Plugin_manager::release_input_file): Likewise.
10201 * script.cc (read_script_file, script_add_file): Likewise.
10202 * fileread.cc (Input_file::Input_file): Likewise.
10203 (Input_file::will_search_for): Handle is_searched_file.
10204 (Input_file::open): Likewise.
10205 * readsyms.cc (Read_symbols::get_name): Likewise.
10206 * testsuite/Makefile.am (searched_file_test): New test.
10207 * testsuite/Makefile.in: Regenerate.
10208 * testsuite/searched_file_test.cc: New file.
10209 * testsuite/searched_file_test_lib.cc: New file.
10210
10211 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10212 Ian Lance Taylor <iant@google.com>
10213
10214 * descriptor.cc: Include <cstdio> and "binary-io.h".
10215 (Descriptors::open): Open the files in binary mode always.
10216 * script.cc (Lex::get_token): Treat \r as whitespace.
10217
10218 2009-10-09 Ian Lance Taylor <iant@google.com>
10219
10220 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10221
10222 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10223 Ian Lance Taylor <iant@google.com>
10224
10225 * configure.ac: Check for readv function also.
10226 * fileread.cc (readv): Define if not HAVE_READV.
10227 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10228 does not exist.
10229 * config.in: Regenerate.
10230 * configure: Regenerate.
10231
10232 2009-10-09 Doug Kwan <dougkwan@google.com>
10233
10234 * layout.cc (Layout::make_output_section): Call target hook to make
10235 ordinary output section.
10236 (Layout::finalize): Adjust parameter list of call the
10237 Target::may_relax().
10238 * layout.h (class Layout::section_list): New method.
10239 * merge.h (Output_merge_base::entsize): Change visibility to public.
10240 (Output_merge_base::is_string, Output_merge_base::do_is_string):
10241 New methods.
10242 (Output_merge_string::do_is_string): New method.
10243 * object.cc (Sized_relobj::do_setup): renamed from
10244 Sized_relobj::set_up.
10245 * object.h (Sized_relobj::adjust_shndx,
10246 Sized_relobj::initializ_input_to_output_maps,
10247 Sized_relobj::free_input_to_output_maps): Change visibilities to
10248 protected.
10249 (Sized_relobj::setup): Virtualize.
10250 (Sized_relobj::do_setup): New method declaration.
10251 (Sized_relobj::invalidate_section_offset,
10252 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10253 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10254 * options.cc (parse_int): New function.
10255 * options.h (parse_int): New declaration.
10256 (DEFINE_int): New macro.
10257 (stub_group_size): New option.
10258 * output.cc (Output_section::Output_section): Initialize memebers
10259 merge_section_map_, merge_section_by_properties_map_,
10260 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10261 (Output_section::add_input_section): Handled deferred code-fill
10262 generation and remove an old comment.
10263 (Output_section::add_relaxed_input_section): New method definition.
10264 (Output_section::add_merge_input_section): Use merge section by
10265 properties map to speed to search. Update merge section maps
10266 as appropriate.
10267 (Output_section::build_relaxation_map): New method definition.
10268 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10269 Same.
10270 (Output_section::relax_input_section): Renamed to
10271 Output_section::convert_input_sections_to_relaxed_sections and change
10272 interface to take a vector of pointers to relaxed sections.
10273 (Output_section::find_merge_section,
10274 Output_section::find_relaxed_input_section): New method definitions.
10275 (Output_section::is_input_address_mapped,
10276 Output_section::output_offset, Output_section::output_address):
10277 Use output section data maps to speed up searching.
10278 (Output_section::find_starting_output_address): Add comments.
10279 (Output_section::do_write,
10280 Output_section::write_to_postprocessing_buffer): Do code-fill
10281 generation as appropriate.
10282 (Output_section::get_input_sections): Invalidate relaxed input section
10283 map.
10284 (Output_section::restore_states): Adjust type of checkpoint .
10285 Invalidate relaxed input section map.
10286 * output.h (Output_merge_base): New class declaration.
10287 (Input_section_specifier): New class defintion.
10288 (class Output_relaxed_input_section) Change base class to
10289 Output_section_data_build.
10290 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10291 base class initializer.
10292 (Output_section::add_relaxed_input_section): New method declaration.
10293 (Output_section::Input_section): Change visibility to protected.
10294 (Output_section::Input_section::relobj,
10295 Output_section::Input_section::shndx): Handle relaxed input sections.
10296 Output_section::input_sections) Change visibility to protected. Also
10297 define overload to return a non-const pointer.
10298 (Output_section::Merge_section_properties): New class defintion.
10299 (Output_section::Merge_section_by_properties_map,
10300 Output_section::Output_section_data_by_input_section_map,
10301 Output_section::Relaxation_map): New types.
10302 (Output_section::relax_input_section): Rename method to
10303 Output_section::convert_input_sections_to_relaxed_sections and change
10304 interface to take a vector of relaxed section pointers.
10305 (Output_section::find_merge_section,
10306 Output_section::find_relaxed_input_section,
10307 Output_section::build_relaxation_map,
10308 Output_section::convert_input_sections_in_list_to_relaxed_sections):
10309 New method declarations.
10310 (Output_section::merge_section_map_
10311 Output_section::merge_section_by_properties_map_,
10312 Output_section::relaxed_input_section_map_,
10313 Output_section::is_relaxed_input_section_map_valid_,
10314 Output_section::generate_code_fills_at_write_): New data members.
10315 * script-sections.cc
10316 (Output_section_element_input::set_section_addresses): Call
10317 current_data_size and addralign methods of relaxed input sections.
10318 (Orphan_output_section::set_section_addresses): Call current_data_size
10319 and addralign methods of relaxed input sections.
10320 * symtab.cc (Symbol_table::compute_final_value): Extract template
10321 from the body of Symbol_table::sized_finalize_symbol.
10322 (Symbol_table::sized_finalized_symbol): Call
10323 Symbol_table::compute_final_value.
10324 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10325 (Symbol_table::compute_final_value): New templated method declaration.
10326 * target.cc (Target::do_make_output_section): New method defintion.
10327 * target.h (Target::make_output_section): New method declaration.
10328 (Target::relax): Add more parameters for input objects, symbol table
10329 and layout. Adjust call to do_relax.
10330 (Target::do_make_output_section): New method declaration.
10331 (Target::do_relax): Add parameters for input objects, symbol table
10332 and layout.
10333
10334 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10335
10336 * pread.c: Include stdio.h.
10337
10338 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10339
10340 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10341 defined.
10342
10343 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10344
10345 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10346 Change read_shndx type to unsigned int.
10347 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10348 int.
10349 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10350 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10351 Change read_shndx type to unsigned int.
10352 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10353 int.
10354 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10355 * layout.cc (Layout::create_symtab_sections): Cast the result of
10356 local_symcount * symsize to off_t in the gold_assert.
10357
10358 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10359
10360 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10361 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10362 R_ARM_BASE_ABS.
10363 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10364 (Arm_relocate_functions::thm_abs5): New function.
10365 (Arm_relocate_functions::abs12): New function.
10366 (Arm_relocate_functions::abs16): New function.
10367 (Arm_relocate_functions::base_abs): New function.
10368 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10369 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
10370 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10371 R_ARM_BASE_ABS.
10372 (Scan::global): Likewise.
10373 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10374 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10375 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10376 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10377 R_ARM_BASE_ABS.
10378
10379 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10380
10381 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10382 (Arm_relocate_functions::movt_prel): New function.
10383 (Arm_relocate_functions::thm_movw_prel_nc): New function.
10384 (Arm_relocate_functions::thm_movt_prel): New function.
10385 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10386 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10387 (Scan::global, Relocate::relocate): Likewise.
10388 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10389
10390 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10391
10392 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10393 Incremental_checker.
10394 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10395 unsigned int.
10396 (class Incremental_inputs_header): New class.
10397 (Incremental_inputs_header_writer): Edit comment.
10398 (Incremental_inputs_entry): New class.
10399 (Incremental_inputs_entry_writer): Edit comment.
10400 (Sized_incremental_binary::do_find_incremental_inputs_section):
10401 Add *strtab_shndx parameter, fill it.
10402 (Sized_incremental_binary::do_check_inputs): New method.
10403 (Incremental_checker::can_incrementally_link_output_file): Use
10404 Sized_incremental_binary::check_inputs.
10405 (Incremental_inputs::report_command_line): Save command line in
10406 command_line_.
10407 * incremental.h:
10408 (Incremental_binary::find_incremental_inputs_section): New
10409 method.
10410 (Incremental_binary::do_find_incremental_inputs_section): Add
10411 strtab_shndx parameter.
10412 (Incremental_binary::do_check_inputs): New pure virtual method.
10413 (Sized_incremental_binary::do_check_inputs): Declare.
10414 (Incremental_checker::Incremental_checker): Add incremental_inputs
10415 parameter, use it to initialize incremental_inputs_.
10416 (Incremental_checker::incremental_inputs_): New field.
10417 (Incremental_checker::command_line): New method.
10418 (Incremental_checker::inputs): New method.
10419 (Incremental_checker::command_line_): New field.
10420
10421 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10422
10423 * incremental.cc: Include <cstdarg> and "target-select.h".
10424 (vexplain_no_incremental): New function.
10425 (explain_no_incremental): New function.
10426 (Incremental_binary::error): New method.
10427 (Sized_incremental_binary::do_find_incremental_inputs_section): New
10428 method.
10429 (make_sized_incremental_binary): New function.
10430 (open_incremental_binary): New function.
10431 (can_incrementally_link_file): Add checks if output is ELF and has
10432 inputs section.
10433 * incremental.h: Include "elfcpp_file.h" and "output.h".
10434 (Incremental_binary): New class.
10435 (Sized_incremental_binary): New class.
10436 (open_incremental_binary): Declare.
10437 * object.cc (is_elf_object): Use
10438 elfcpp::Elf_recognizer::is_elf_file.
10439 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10440 * output.h (Output_file::filesize): New method.
10441
10442 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10443
10444 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10445 New function.
10446 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10447 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10448 function.
10449 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10450 function.
10451 (Arm_relocate_functions::movw_abs_nc): New function.
10452 (Arm_relocate_functions::movt_abs): New function.
10453 (Arm_relocate_functions::thm_movw_abs_nc): New function.
10454 (Arm_relocate_functions::thm_movt_abs): New function.
10455 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10456 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10457 (Scan::global): Likewise.
10458 (Relocate::relocate): Likewise.
10459 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10460
10461 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10462
10463 * arm.cc (Arm_relocate_functions::got_prel) New function.
10464 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10465 (Relocate::relocate): Likewise.
10466 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10467
10468 2009-10-06 Ian Lance Taylor <iant@google.com>
10469
10470 * options.h (class General_options): Define
10471 split_stack_adjust_size parameter.
10472 * object.h (class Object): Add uses_split_stack_ and
10473 has_no_split_stack_ fields. Add uses_split_stack and
10474 has_no_split_stack accessor functions. Declare
10475 handle_split_stack_section.
10476 (class Reloc_symbol_changes): Define.
10477 (class Sized_relobj): Define Function_offsets. Declare
10478 split_stack_adjust, split_stack_adjust_reltype, and
10479 find_functions.
10480 * object.cc (Object::handle_split_stack_section): New function.
10481 (Sized_relobj::do_layout): Call handle_split_stack_section.
10482 * dynobj.cc (Sized_dynobj::do_layout): Call
10483 handle_split_stack_section.
10484 * reloc.cc (Sized_relobj::relocate_sections): Call
10485 split_stack_adjust for executable sections in split_stack
10486 objects. Pass reloc_map to relocate_section.
10487 (Sized_relobj::split_stack_adjust): New function.
10488 (Sized_relobj::split_stack_adjust_reltype): New function.
10489 (Sized_relobj::find_functions): New function.
10490 * target-reloc.h: Include "object.h".
10491 (relocate_section): Add reloc_symbol_changes parameter. Change
10492 all callers.
10493 * target.h (class Target): Add calls_non_split method. Declare
10494 do_calls_non_split virtual method. Declare match_view and
10495 set_view_to_nop.
10496 * target.cc: Include "elfcpp.h".
10497 (Target::do_calls_non_split): New function.
10498 (Target::match_view): New function.
10499 (Target::set_view_to_nop): New function.
10500 * gold.cc (queue_middle_tasks): Give an error if mixing
10501 split-stack and non-split-stack objects with -r.
10502 * i386.cc (Target_i386::relocate_section): Add
10503 reloc_symbol_changes parameter.
10504 (Target_i386::do_calls_non_split): New function.
10505 * x86_64.cc (Target_x86_64::relocate_section): Add
10506 reloc_symbol_changes parameter.
10507 (Target_x86_64::do_calls_non_split): New function.
10508 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10509 parameter.
10510 * powerpc.cc (Target_powerpc::relocate_section): Add
10511 reloc_symbol_changes parameter.
10512 * sparc.cc (Target_sparc::relocate_section): Add
10513 reloc_symbol_changes parameter.
10514 * configure.ac: Call AM_CONDITIONAL for the default target.
10515 * configure: Rebuild.
10516 * testsuite/Makefile.am (TEST_AS): New variable.
10517 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10518 (check_DATA): Add split_i386 and split_x86_64 files.
10519 (SPLIT_DEFSYMS): Define.
10520 (split_i386_[1234n].o): New targets.
10521 (split_i386_[124]): New targets.
10522 (split_i386_[1234r].stdout): New targets.
10523 (split_x86_64_[1234n].o): New targets.
10524 (split_x86_64_[124]): New targets.
10525 (split_x86_64_[1234r].stdout): New targets.
10526 (MOSTLYCLEANFILES): Add new executables.
10527 * testsuite/split_i386.sh: New file.
10528 * testsuite/split_x86_64.sh: New file.
10529 * testsuite/split_i386_1.s: New file.
10530 * testsuite/split_i386_2.s: New file.
10531 * testsuite/split_i386_3.s: New file.
10532 * testsuite/split_i386_4.s: New file.
10533 * testsuite/split_i386_n.s: New file.
10534 * testsuite/split_x86_64_1.s: New file.
10535 * testsuite/split_x86_64_2.s: New file.
10536 * testsuite/split_x86_64_3.s: New file.
10537 * testsuite/split_x86_64_4.s: New file.
10538 * testsuite/split_x86_64_n.s: New file.
10539 * testsuite/testfile.cc (Target_test): Update relocation_section
10540 function.
10541 * testsuite/Makefile.in: Rebuild.
10542
10543 2009-10-06 Ian Lance Taylor <iant@google.com>
10544
10545 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10546 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10547 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
10548 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10549 the address on ldo_addrs_.
10550 (Target_i386::Relocate::fix_up_ldo): New function.
10551
10552 2009-10-06 Rafael Espindola <espindola@google.com>
10553
10554 * plugin.cc (add_input_library): New.
10555 (Plugin::load): Add add_input_library to tv.
10556 (Plugin_manager::add_input_file): Add the is_lib argument.
10557 (add_input_file): Update call to Plugin_manager::add_input_file.
10558 (add_input_library): New.
10559 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10560
10561 2009-09-30 Doug Kwan <dougkwan@google.com>
10562
10563 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10564 symbol and call Symbol::may_need_copy_reloc to determine if
10565 a copy reloc is needed.
10566 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10567 nocopyreloc is given in command line.
10568 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10569 given in command line.
10570 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10571 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10572 of the removed Target_i386::may_need_copy_reloc.
10573 * options.h (copyreloc): New option with default value false.
10574 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10575 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10576 instead of the removed Target_powerpc::may_need_copy_reloc.
10577 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10578 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10579 instead of the removed Target_sparc::may_need_copy_reloc.
10580 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10581 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10582 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10583 instead of the removed Target_x86_64::may_need_copy_reloc.
10584
10585 2009-09-30 Ian Lance Taylor <iant@google.com>
10586
10587 * object.h (class Object): Remove target_ field, and target,
10588 sized_target, and set_target methods.
10589 (Object::sized_target): Remove.
10590 (class Sized_relobj): Update declarations. Remove sized_target.
10591 * object.cc (Sized_relobj::setup): Remove target parameter.
10592 Change all callers.
10593 (Input_objects::add_object): Don't do anything with the target.
10594 (make_elf_sized_object): Add punconfigured parameter. Change all
10595 callers. Set or test parameter target.
10596 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10597 Change all callers.
10598 * parameters.cc (Parameters::set_target): Change parameter type to
10599 be non-const.
10600 (Parameters::default_target): Remove.
10601 (set_parameters_target): Change parameter type to be non-const.
10602 (parameters_force_valid_target): New function.
10603 (parameters_clear_target): New function.
10604 * parameters.h (class Parameters): Update declarations. Remove
10605 default_target method. Add sized_target and clear_target
10606 methods. Change target_ to be non-const.
10607 (set_parameters_target): Update declaration.
10608 (parameters_force_valid_target): Declare.
10609 (parameters_clear_target): Declare.
10610 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10611 as NULL if we aren't searching.
10612 (Add_symbols::run): Don't check for compatible target.
10613 * fileread.cc (Input_file::open_binary): Call
10614 parameters_force_valid_target.
10615 * gold.cc (queue_middle_tasks): Likewise.
10616 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
10617 set_target on object.
10618 * dynobj.h (class Sized_dynobj): Update declarations.
10619 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10620 make_elf_object returns NULL.
10621 (Archive::include_member): Don't check whether object target is
10622 compatible.
10623 * output.cc (Output_section::add_input_section): Get target from
10624 parameters.
10625 (Output_section::relax_input_section): Likewise.
10626 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10627 parameters.
10628 (Sized_relobj::do_scan_relocs): Likewise.
10629 (Sized_relobj::relocate_sections): Likewise.
10630 * resolve.cc (Symbol_table::resolve): Likewise.
10631 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
10632 parameter. Change all callers.
10633 (Symbol_table::add_from_object): Get target from parameters.
10634 (Symbol_table::add_from_relobj): Don't check object target.
10635 (Symbol_table::add_from_dynobj): Likewise.
10636 (Symbol_table::define_special_symbol): Get target from
10637 parameters.
10638 * symtab.h (class Symbol_table): Update declaration.
10639 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10640 parameter. Change all callers. Clear parameter target.
10641 (Binary_test): Test target here.
10642 * testsuite/object_unittest.cc (gold_testsuite): Remove
10643 target_test_pointer parameter. Change all callers.
10644 (Object_test): Test target here.
10645
10646 2009-09-26 Ian Lance Taylor <iant@google.com>
10647
10648 * testsuite/initpri1.c: Don't try to use constructor priorities if
10649 compiling with gcc before 4.3.
10650
10651 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
10652
10653 * testsuite/retain_symbols_file_test.sh (check_present): Change
10654 output file name to retain_symbols_file_test.stdout.
10655 (check_absent): Likewise.
10656
10657 2009-09-18 Craig Silverstein <csilvers@google.com>
10658
10659 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10660 * options.cc: Include <cerrno> and <fstream>.
10661 (General_options::finalize): Parse -retain-symbols-file tag.
10662 * options.h: New flag.
10663 (General_options): New method should_retain_symbol, new
10664 variable symbols_to_retain.
10665 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10666 should_retain_symbol map.
10667 * testsuite/Makefile.am (retain_symbols_file_test): New test.
10668 * testsuite/Makefile.in: Regenerate.
10669 * testsuite/retain_symbols_file_test.sh: New file.
10670
10671 2009-09-18 Nick Clifton <nickc@redhat.com>
10672
10673 * po/es.po: Updated Spanish translation.
10674
10675 2009-09-17 Doug Kwan <dougkwan@google.com>
10676
10677 * debug.h (DEBUG_RELAXATION): New constant.
10678 (DEBUG_ALL): Add DEBUG_RELAXATION.
10679 (debug_string_to_enum): Add relaxation debug option.
10680 * layout.cc
10681 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10682 Layout::Relaxation_debug_check::read_sections,
10683 Layout::Relaxation_debug_check::read_sections): New method definitions.
10684 (Layout::Layout): Initialize data members
10685 record_output_section_data_from_scrips_,
10686 script_output_section_data_list_ and relaxation_debug_check_.
10687 (Layout::save_segments, Layout::restore_segments,
10688 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10689 Layout::relaxation_loop_body): New method definitions.
10690 (Layout::finalize): Support relaxation. Move section layout code to
10691 Layout::relaxation_loop_body.
10692 (Layout::set_asection_address_from_script): Move code for orphan
10693 section placement out.
10694 (Layout::place_orphan_sections_in_script): New method definition.
10695 * layout.h (Output_segment_headers, Output_file_header):
10696 New forward class declarations.
10697 (Layout::~Layout): Define.
10698 (Layout::new_output_section_data_from_script): New method definition.
10699 (Layout::place_orphan_sections_in_script): New method declaration.
10700 (Layout::Segment_states): New type declaration.
10701 (Layout::save_segments, Layout::restore_segments,
10702 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10703 Layout::relaxation_loop_body): New method declarations.
10704 (Layout::Output_section_data_list): New type declaration.
10705 (Layout::Relaxation_debug_check): New class definition.
10706 (Layout::record_output_section_data_from_script_,
10707 Layout::script_output_section_data_list_, Layout::segment_states_,
10708 Layout::relaxation_debug_check_): New data members.
10709 * output.cc: (Output_section_headers::do_size): New method definition.
10710 (Output_section_headers::Output_section_headers): Move size
10711 computation to Output_section_headers::do_size.
10712 (Output_segment_headers::do_size): New method definition.
10713 (Output_file_header::Output_file_header): Move size computation to
10714 Output_file_header::do_size and call it.
10715 (Output_file_header::do_size): New method definition.
10716 (Output_data_group::Output_data_group): Adjust call to
10717 Output_section_data.
10718 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10719 (Output_symtab_xindex::do_write): Add array bound check.
10720 (Output_section::Input_section::print_to_mapfile): Handle
10721 RELAXED_INPUT_SECTION_CODE.
10722 (Output_section::Output_section): Initialize data member checkpoint_.
10723 (Output_section::~Output_section): Delete checkpoint object pointed
10724 by checkpoint_.
10725 (Output_section::add_input_section): Always add an Input_section if
10726 relaxing.
10727 (Output_section::add_merge_input_section): Add assert.
10728 (Output_section::relax_input_section): New method definition.
10729 (Output_section::set_final_data_size): Set load address to zero for
10730 an unallocated section.
10731 (Output_section::do_address_and_file_offset_have_reset_values):
10732 New method definition.
10733 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10734 Handle relaxed input section.
10735 (Output_section::sort_attached_input_sections): Checkpoint input
10736 section list lazily.
10737 (Output_section::get_input_sections): Change type of input_sections to
10738 list of Simple_input_section pointers. Checkpoint input section list
10739 lazily. Also handle relaxed input sections.
10740 (Output_section::add_input_section_for_script): Take a reference to
10741 a Simple_input_section object instead of Relobj pointer and section
10742 index as parameter. Handle relaxed input sections.
10743 (Output_section::save_states, Output_section::restore_states): New
10744 method definitions.
10745 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10746 (Output_data::is_data_size_fixed): New method definition.
10747 (Output_data::reset_addresss_and_file_offset): Do not reset data size
10748 if it is fixed.
10749 (Output_data::address_and_file_offset_have_reset_values): New method
10750 definition.
10751 (Output_data::do_address_and_file_offset_have_reset_values): New method
10752 definition.
10753 (Output_data::set_data_size): Check that data size is not fixed.
10754 (Output_data::fix_data_size): New method definition.
10755 (Output_data::is_data_size_fixed_): New data member.
10756 (Output_section_headers::set_final_data_size): New method definition.
10757 (Output_section_headers::do_size): New method declaration.
10758 (Output_segment_headers::set_final_data_size): New method definition.
10759 (Output_segment_headers::do_size): New method declaration.
10760 (Output_file_header::set_final_data_size)::New method definition.
10761 (Output_file_header::do_size)::New method declaration.
10762 (Output_section_data::Output_section_data): Add new parameter
10763 is_data_size_fixed and use it to fix data size.
10764 (Output_data_const::Output_data_const): Adjust call to base class
10765 constructor and fix data size.
10766 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10767 base class constructor and fix data size.
10768 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10769 base class constructor and fix data size.
10770 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10771 class constructor and fix data size.
10772 (Output_data_group::set_final_data_size): New method definition.
10773 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10774 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10775 class constructor and fix data size.
10776 (Output_relaxed_input_section): New class definition.
10777 (Output_section::Simple_input_section): New class definition.
10778 (Output_section::get_input_sections): Adjust parameter list.
10779 (Output_section::add_input_section_for_script): Same.
10780 (Output_section::save_states, Output_section::restore_states,
10781 Output_section::do_address_and_file_offset_have_reset_values,
10782 (Output_section::Input_section::Input_section): Handle
10783 RELAXED_INPUT_SECTION_CODE. Add new overload for
10784 Output_relaxed_input_section.
10785 (Output_section::Input_section::is_input_section,
10786 Output_section::Input_section::set_output_section): Handle relaxed
10787 input section.
10788 (Output_section::Input_section::is_relaxed_input_section,
10789 Output_section::Input_section::output_section_data,
10790 Output_section::Input_section::relaxed_input_section): New method
10791 definitions.
10792 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10793 value.
10794 (Output_section::Input_section::u1_): Update comments.
10795 (Output_section::Input_section::u2_): Add new union member poris.
10796 (Output_section::Checkpoint_output_section): New classs definition.
10797 (Output_section::relax_input_section): New method declaration.
10798 (Output_section::checkpoint_): New data member.
10799 (Output_segment): Update comments.
10800 (Output_segment::Output_segment): Un-privatize copy constructor.
10801 (Output_segment::operator=): Un-privatize.
10802 * script-sections.cc (Output_section_element::Input_section_list):
10803 Change element type to Output_section::Simple_input_section.
10804 (Output_section_element_dot_assignment::set_section_addresses):
10805 Register output section data for relaxation clean up.
10806 (Output_data_exression::Output_data_expression): Adjust call to base
10807 constructor to fix data size.
10808 (Output_section_element_data::set_section_addresses): Register
10809 Output_data_expression object for relaxation clean up.
10810 (struct Input_section_info): Replace Relobj pointer and section index
10811 pair with Output_section::Simple_input_section and Convert struct to a
10812 class.
10813 (Input_section_sorter::operator()): Adjust access to
10814 Input_section_info data member to use accessors.
10815 (Output_section_element_input::set_section_addresses): Use layout
10816 parameter. Adjust code to use Output_section::Simple_input_section
10817 and Input_secction_info classes. Register filler for relaxation
10818 clean up.
10819 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10820 and section index pair with Output_section::Simple_input_section
10821 class. Adjust code accordingly.
10822 (Phdrs_element::release_segment): New method definition.
10823 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10824 segment list.
10825 (Script_sections::release_segments): New method definition.
10826 * gold/script-sections.h (Script_sections::release_segments): New
10827 method declaration.
10828 * gold/target.h (Target::may_relax, Target::relax,
10829 Target::do_may_relax, Target::do_relax): New method definitions.
10830
10831 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10832
10833 * arm.cc (has_signed_unsigned_overflow): New function.
10834 (Arm_relocate_functions::abs8): New function.
10835 (Target_arm::Scan::local): Handle R_ARM_ABS8.
10836 (Target_arm::Scan::global): Likewise.
10837 (Target_arm::relocate::relocate): Likewise.
10838 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10839 Likewise.
10840
10841 2009-09-16 Cary Coutant <ccoutant@google.com>
10842
10843 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10844 * testsuite/Makefile.in: Regenerate.
10845
10846 2009-09-11 Nick Clifton <nickc@redhat.com>
10847
10848 * po/gold.pot: Updated by the Translation project.
10849
10850 2009-09-08 Cary Coutant <ccoutant@google.com>
10851
10852 * output.cc (Output_file::open): Add execute permission to empty file.
10853 * testsuite/Makefile.am (permission_test): New test.
10854 * testsuite/Makefile.in: Regenerate.
10855
10856 2009-09-02 Ian Lance Taylor <iant@google.com>
10857
10858 * output.cc (Output_file::resize): Call map_no_anonymous rather
10859 than map.
10860
10861 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
10862
10863 * gold.cc: Include "incremental.h".
10864 (queue_initial_tasks): Call Incremental_checker methods.
10865 * incremental.cc: Include "output.h".
10866 (Incremental_checker::can_incrementally_link_output_file): New
10867 method.
10868 * incremental.h (Incremental_checker): New class.
10869
10870 * output.cc (Output_file::open_for_modification): New method.
10871 (Output_file::map_anonymous): Changed return type to bool. Record
10872 map in base_ field.
10873 (Output_file::map_no_anonymous): New method, broken out of map.
10874 (Output_file::map): Use map_no_anonymous and map_anonymous.
10875 * output.h (class Output_file): Update declarations.
10876
10877 2009-08-24 Cary Coutant <ccoutant@google.com>
10878
10879 * options.h (Command_line::Pre_options): New class.
10880 (Command_line::pre_options): New member.
10881 * options.cc (gold::options::ready_to_register): New variable.
10882 (One_option::register_option): Do nothing if not registering options.
10883 Assert if same short option registered twice.
10884 (General_options::General_options): Turn off option registration when
10885 done constructing.
10886 (Command_line::Pre_options::Pre_options): New constructor.
10887
10888 2009-08-24 Cary Coutant <ccoutant@google.com>
10889
10890 * options.h (General_options::no_keep_memory): Remove incorrect
10891 short option.
10892
10893 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10894
10895 * Makefile.am (am__skiplex, am__skipyacc): New.
10896 * Makefile.in: Regenerate.
10897
10898 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10899
10900 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10901 (INCLUDES): ... this.
10902 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10903 (AM_CPPFLAGS): Renamed from ...
10904 (INCLUDE): ... this.
10905 * Makefile.in, testsuite/Makefile.in: Regenerate.
10906
10907 * Makefile.in: Regenerate.
10908 * aclocal.m4: Likewise.
10909 * config.in: Likewise.
10910 * configure: Likewise.
10911 * testsuite/Makefile.in: Likewise.
10912
10913 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10914 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10915 * Makefile.in: Regenerate.
10916 * testsuite/Makefile.in: Regenerate.
10917
10918 2009-08-19 Cary Coutant <ccoutant@google.com>
10919
10920 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10921 symbols in shared libraries overridden by hidden or internal symbols
10922 in the main program.
10923
10924 2009-08-19 Chris Demetriou <cgd@google.com>
10925
10926 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10927 checking source file names in error messages.
10928
10929 2009-08-18 Doug Kwan <dougkwan@google.com>
10930
10931 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10932 an elcpp::Ehdr as parameter. Adjust call to set_target.
10933 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10934 an elfcpp::Ehdr as parameter.
10935 * object.cc (Object::set_target): Remove the version that looks up
10936 a target and sets it.
10937 (Sized_relobj::setup): Take a Target object instead of
10938 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10939 (make_elf_sized_object): Find target and ask target to
10940 make an ELF object.
10941 * object.h: (Object::set_target): Remove the version that looks up
10942 a target and sets it.
10943 (Sized_relobj::setup): Take a Target object instead of
10944 an elfcpp:Ehdr as parameter.
10945 * target.cc: Include dynobj.h.
10946 (Target::do_make_elf_object_implementation): New.
10947 (Target::do_make_elf_object): New.
10948 * target.h (Target::make_elf_object): New template declaration.
10949 (Target::do_make_elf_object): New method declarations.
10950 (Target::do_make_elf_object_implementation): New template declaration.
10951
10952 2009-08-14 Ian Lance Taylor <iant@google.com>
10953
10954 * gold.h (FUNCTION_NAME): Define.
10955 (gold_unreachable): Use FUNCTION_NAME.
10956
10957 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10958
10959 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10960 symbol in the --keep-unique list is not found.
10961
10962 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10963
10964 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10965 been maked as --keep-unique.
10966 (Icf::unfold_section): New function.
10967 * icf.h (Icf::unfold_section): New function.
10968 * options.h (General_options::keep_unique): New option.
10969 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10970 * testsuite/Makefile.in: Regenerate.
10971 * testsuite/icf_keep_unique_test.sh: New file.
10972 * testsuite/icf_keep_unique_test.cc: New file.
10973
10974 2009-08-12 Cary Coutant <ccoutant@google.com>
10975
10976 PR 10471
10977 * resolve.cc (Symbol_table::resolve): Check for references from
10978 dynamic objects to hidden and internal symbols.
10979 * testsuite/Makefile.am (hidden_test.sh): New test.
10980 * testsuite/Makefile.in: Regenerate.
10981 * testsuite/hidden_test.sh: New script.
10982 * testsuite/hidden_test_1.c: New test source.
10983 * testsuite/hidden_test_main.c: New test source.
10984
10985 2009-08-11 Doug Kwan <dougkwan@google.com>
10986
10987 * arm.cc: Update comments.
10988 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10989 segment to locate the .ARM.exidx section if present.
10990
10991 2009-08-09 Doug Kwan <dougkwan@google.com>
10992
10993 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10994 patch.
10995
10996 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10997 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10998 compiler warnings.
10999
11000 2009-08-06 Sriraman Tallam <tmsriram@google.com>
11001
11002 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11003 valid tls_segment only for non-debug-section relocations.
11004 * testsuite/Makefile.am: Add gc_tls_test.
11005 * testsuite/Makefile.in: Regenerate.
11006 * testsuite/gc_tls_test.cc: New file.
11007 * testsuite/gc_tls_test.sh: New file.
11008
11009 2009-08-05 Sriraman Tallam <tmsriram@google.com>
11010
11011 * icf.cc: New file.
11012 * icf.h: New file.
11013 * Makefile.am (CCFILES): Add icf.cc.
11014 (HFILES): Add icf.h
11015 * Makefile.in: Regenerate.
11016 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11017 * gc.h (gc_process_relocs): Populate lists used by icf to contain
11018 section, symbol and addend information for the relocs.
11019 * gold.cc (queue_middle_tasks): Call identical code folding.
11020 * gold.h: Add defines for multimap.
11021 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11022 to the call of finalize_local_symbols.
11023 * main.cc (main): Create object of class Icf.
11024 * object.cc (Sized_relobj::do_layout): Allow this function to be
11025 called twice during icf.
11026 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11027 to sections marked as identical by icf.
11028 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11029 when available.
11030 (Sized_relobj::do_section_entsize): New function.
11031 * object.h (Object::section_entsize): New function.
11032 (Object::do_section_entsize): New pure virtual function.
11033 (Relobj::finalize_local_symbols): Add new parameter.
11034 (Relobj::do_section_entsize): New function.
11035 * options.h (General_options::icf): New option.
11036 (General_options::icf_iterations): New option.
11037 (General_options::print_icf_sections): New option.
11038 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11039 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11040 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11041 icf.
11042 * symtab.cc (Symbol_table::is_section_folded): New function.
11043 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
11044 to sections marked as identical by icf.
11045 * symtab.h (Symbol_table::set_icf): New function.
11046 (Symbol_table::icf): New function.
11047 (Symbol_table::is_section_folded): New function.
11048 (Symbol_table::icf_): New data member.
11049 * target-reloc.h (relocate_section): Ignore sections folded by icf.
11050 * testsuite/Makefile.am: Add commands to build icf_test.
11051 * testsuite/Makefile.in: Regenerate.
11052 * testsuite/icf_test.sh: New file.
11053 * testsuite/icf_test.cc: New file.
11054
11055 2009-07-24 Chris Demetriou <cgd@google.com>
11056
11057 * layout.cc (is_compressible_debug_section): Fix incorrect
11058 comment about compressed section names.
11059
11060 2009-07-20 Ian Lance Taylor <ian@airs.com>
11061
11062 PR 10419
11063 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11064
11065 2009-07-16 Ian Lance Taylor <iant@google.com>
11066
11067 PR 10400
11068 * layout.h: #include <map>.
11069 (class Kept_section): Change from struct to class. Add accessors
11070 and setters. Add section size to Comdat_group mapping. Change
11071 Comdat_group to std::map. Add is_comdat_ field. Add
11072 linkonce_size field in union.
11073 (class Layout): Update declaration of find_or_add_kept_section.
11074 Don't declare find_kept_object.
11075 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11076 parameter. Add object, shndx, is_comdat, and is_group_name
11077 parameters. Change all callers. Adjust for new Kept_section.
11078 (Layout::find_kept_object): Remove.
11079 * object.cc (Sized_relobj::include_section_group): Update use of
11080 Kept_section. Rename secnum to shndx. Only record
11081 Kept_comdat_section if sections are the same size.
11082 (Sized_relobj::include_linkonce_section): Update use of
11083 Kept_section. Only record Kept_comdat_section if sections are the
11084 same size. Set size of linkonce section.
11085 (Sized_relobj::map_to_kept_section): Update call to
11086 get_kept_comdat_section.
11087 * object.h (class Sized_relobj): Rename fields in
11088 Kept_comdat_section to drop trailing underscores; change object
11089 field to Relobj*. Change Kept_comdat_section_table to store
11090 struct rather than pointer.
11091 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11092 Add kept_object and kept_shndx parameters. Change all callers.
11093 (Sized_relobj::get_kept_comdat_section): Change return type to
11094 bool. Add kept_object and kept_shndx parameters. Change all
11095 callers.
11096 * plugin.cc (Pluginobj::include_comdat_group): Update call to
11097 Layout::find_or_add_kept_section.
11098
11099 2009-07-09 Ian Lance Taylor <iant@google.com>
11100
11101 * merge.cc (Object_merge_map::initialize_input_to_output_map):
11102 Reserve space in the hash table.
11103
11104 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
11105
11106 * fileread.cc (File_read::get_mtime): New method.
11107 * fileread.h (Timespec): New structure.
11108 (File_read::get_mtime): New method.
11109 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11110 Renamed from timestamp_nsec.
11111 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11112 Elf_Xword.
11113 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11114 timestamp_nsec.
11115 (Incremental_inputs::report_archive): Save mtime; style fix.
11116 (Incremental_inputs::report_obejct): Save mtime; style fix.
11117 (Incremental_inputs::report_script): Save mtime; style fix.
11118 (Incremental_inputs::finalize_inputs): Style fix.
11119 (Incremental_inputs::finalize): Style fix.
11120 (Incremental_inputs::create_input_section_data): Store inputs
11121 mtime.
11122 * incremental.h (Incremental_inputs::report_script): Add mtime
11123 argument.
11124 (Incremental_inputs::Input_info::Input_info): Intialize only one
11125 union member.
11126 (Incremental_inputs::Input_info::archive): Move to nameless
11127 union.
11128 (Incremental_inputs::Input_info::obejct): Move to nameless union.
11129 (Incremental_inputs::Input_info::script): Move to nameless union.
11130 (Incremental_inputs::mtime): New field.
11131 * script.cc (read_input_script): Pass file mtime to
11132 Incremental_input.
11133 * script.h (Script_info::inputs): Style fix.
11134
11135 2009-07-01 Ian Lance Taylor <ian@airs.com>
11136
11137 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11138 instead of 32.
11139
11140 2009-06-24 Ian Lance Taylor <iant@google.com>
11141
11142 PR 10156
11143 * layout.cc (Layout::choose_output_section): If we find an
11144 existing section, update the flags.
11145 (Layout::create_notes): New function, broken out of
11146 Layout::finalize.
11147 (Layout::finalize): Don't create note sections.
11148 (Layout::create_note): Don't crash if linker script discards
11149 section.
11150 (Layout::create_gold_note): Likewise.
11151 (Layout::create_build_id): Likewise. Don't set
11152 after_input_sections on the section.
11153 (Layout::create_executable_stack_info): Remove target parameter.
11154 Change caller.
11155 * layout.h (class Layout): Declare create_notes. Update
11156 declaration of create_executable_stack_info.
11157 * gold.cc (queue_middle_tasks): Call create_notes.
11158 * output.cc (Output_section::update_flags_for_input_section): Move
11159 here from output.h. If SHF_ALLOC flag is newly set, mark address
11160 invalid.
11161 * output.h (Output_data::mark_address_invalid): New function.
11162 (class Output_section): Only declare, not define,
11163 update_flags_for_input_section. Remove set_flags.
11164
11165 2009-06-24 Ian Lance Taylor <iant@google.com>
11166
11167 * script-sections.cc (Output_section_definition::
11168 set_section_addresses): Rename shadowing local load_address to
11169 laddr.
11170
11171 2009-06-24 Ian Lance Taylor <iant@google.com>
11172
11173 PR 10244
11174 * reloc.cc (relocate_sections): Skip empty relocation sections.
11175
11176 2009-06-23 Ian Lance Taylor <iant@google.com>
11177
11178 PR 10156
11179 * layout.cc (Layout::create_note): Use choose_output_section
11180 rather than make_output_section.
11181
11182 2009-06-23 Ian Lance Taylor <iant@google.com>
11183
11184 PR 10237
11185 * options.cc (General_options::parse_V): Set printed_version_.
11186 (General_options::General_options): Initialize printed_version_.
11187 * options.h (class General_options): Add printed_version_ field.
11188 * gold.cc (queue_initial_tasks): If there are no input files,
11189 don't give a fatal error if we printed the version information.
11190 (queue_middle_tasks): If using -r with a shared object, give a
11191 fatal error rather than an ordinary error.
11192
11193 2009-06-23 Ian Lance Taylor <iant@google.com>
11194
11195 PR 10219
11196 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11197 (Layout::make_output_section): Set have_stabstr_section_ if we see
11198 a .stab*str section.
11199 (Layout::finalize): Call link_stabs_sections.
11200 (Layout::link_stabs_sections): New file.
11201 * layout.h (class Layout): Add have_stabstr_section_ field.
11202 Declare link_stabs_sections.
11203
11204 2009-06-23 Doug Kwan <dougkwan@google.com>
11205
11206 * Makefile.am (libgold_a_LIBADD): New.
11207 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11208 * Makefile.in: Regenerate.
11209 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11210 * configure: Regenerate.
11211 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11212 * fileread.cc: Include sys/state.h
11213 * gold.h: Declare memmem and strndup if found missing.
11214 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11215
11216 2009-06-23 Ian Lance Taylor <iant@google.com>
11217
11218 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11219 * configure: Rebuild.
11220
11221 2009-06-23 Ian Lance Taylor <iant@google.com>
11222
11223 PR 10147
11224 * object.cc (Object::section_contents): Don't try to get a view if
11225 the section has length zero.
11226 (Object::handle_gnu_warning_section): If the section is empty, use
11227 the name of the section as the warning.
11228
11229 2009-06-23 Ian Lance Taylor <iant@google.com>
11230
11231 PR 10133
11232 * stringpool.h (class Stringpool_template): Add optimize_ field.
11233 (Stringpool_template::set_optimize): New function.
11234 * stringpool.cc (Stringpool_template::Stringpool_template):
11235 Initialize optimize_ field.
11236 (Stringpool_template::set_string_offsets): Test local optimize
11237 fild rather than parameter.
11238 * layout.cc (Layout::Layout): Call set_optimize on the section
11239 name stringpool.
11240
11241 2009-06-22 Ian Lance Taylor <iant@google.com>
11242
11243 PR 10030
11244 * yyscript.y: Parse TARGET.
11245 * script.cc (script_set_target): New function.
11246 * script-c.h (script_set_target): Declare.
11247 * options.cc (General_options::string_to_object_format): Rename
11248 from string_to_object_format in anonymous namespace. Change
11249 callers.
11250 * options.h (class General_options): Declare
11251 string_to_object_format.
11252
11253 2009-06-22 Ian Lance Taylor <iant@google.com>
11254
11255 * script-sections.cc (Script_sections::create_segments): Don't put
11256 program headers in a PT_LOAD segment if -n or -N.
11257
11258 2009-06-22 Ian Lance Taylor <iant@google.com>
11259
11260 PR 10141
11261 * options.h (class General_options): Add -z lazy and -z now. Sort
11262 -z options into alphabetical order.
11263 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11264
11265 2009-06-21 Ian Lance Taylor <iant@google.com>
11266
11267 * layout.cc (Layout::make_output_section): Call
11268 Target::new_output_section.
11269 (Layout::attach_allocated_section_to_segment): Put large section
11270 sections in a separate load segment with the large segment flag
11271 set.
11272 (Layout::segment_precedes): Sort large data segments after other
11273 load segments.
11274 (align_file_offset): New static function.
11275 (Layout::set_segment_offsets): Use align_file_offset.
11276 * output.h (class Output_section): Add is_small_section_ and
11277 is_large_section_ fields.
11278 (Output_section::is_small_section): New function.
11279 (Output_section::set_is_small_section): New function.
11280 (Output_section::is_large_section): New function.
11281 (Output_section::set_is_large_section): New function.
11282 (Output_section::is_large_data_section): New function.
11283 (class Output_segment): Add is_large_data_segment_ field.
11284 (Output_segment::is_large_data_segment): New function.
11285 (Output_segment::set_is_large_data_segment): New function.
11286 * output.cc (Output_section::Output_section): Initialize new
11287 fields.
11288 (Output_segment::Output_segment): Likewise.
11289 (Output_segment::add_output_section): Add assertion that large
11290 data sections always go in large data segments. Force small data
11291 sections to the end of the list of data sections. Force small BSS
11292 sections to the start of the list of BSS sections. For large BSS
11293 sections to the end of the list of BSS sections.
11294 * symtab.h (class Symbol): Declare is_common_shndx.
11295 (Symbol::is_defined): Check Symbol::is_common_shndx.
11296 (Symbol::is_common): Likewise.
11297 (class Symbol_table): Define enum Commons_section_type. Update
11298 declarations. Add small_commons_ and large_commons_ fields.
11299 * symtab.cc (Symbol::is_common_shndx): New function.
11300 (Symbol_table::Symbol_table): Initialize new fields.
11301 (Symbol_table::add_from_object): Put small and large common
11302 symbols in the right list.
11303 (Symbol_table::sized_finalized_symbol): Check
11304 Symbol::is_common_shndx.
11305 (Symbol_table::sized_write_globals): Likewise.
11306 * common.cc (Symbol_table::do_allocate_commons): Allocate new
11307 common symbol lists. Don't call do_allocate_commons_list if the
11308 list is empty.
11309 (Symbol_table::do_allocate_commons_list): Remove is_tls
11310 parameter. Add comons_section_type parameter. Change all
11311 callers. Handle small and large common symbols.
11312 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11313 Symbol::is_common_shndx.
11314 * resolve.cc (symbol_to_bits): Likewise.
11315 * target.h (Target::small_common_shndx): New function.
11316 (Target::small_common_section_flags): New function.
11317 (Target::large_common_shndx): New function.
11318 (Target::large_common_section_flags): New function.
11319 (Target::new_output_section): New function.
11320 (Target::Target_info): Add small_common_shndx, large_common_shndx,
11321 small_common_section_flags, and large_common_section_flags
11322 fields.
11323 (Target::do_new_output_section): New virtual function.
11324 * arm.cc (Target_arm::arm_info): Initialize new fields.
11325 * i386.cc (Target_i386::i386_info): Likewise.
11326 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11327 Likewise.
11328 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11329 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11330 (Target_x86_64::do_new_output_section): New function.
11331 * configure.ac: Define conditional MCMODEL_MEDIUM.
11332 * testsuite/Makefile.am (check_PROGRAMS): Add large.
11333 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11334 (large_LDFLAGS): Define.
11335 * testsuite/large.c: New file.
11336 * testsuite/testfile.cc (Target_test::test_target_info):
11337 Initialize new fields.
11338 * configure, testsuite/Makefile.in: Rebuild.
11339
11340 2009-06-05 Doug Kwan <dougkwan@google.com>
11341
11342 * Makefile.am (CCFILES): Add target.cc.
11343 * Makefile.in: Regenerate.
11344 * i386.cc (class Target_i386): Define new virtual method to
11345 override do_is_local_label_name in parent.
11346 * object.cc (Sized_relobj::do_count_local_symbols): Discard
11347 local symbols if --discard-locals or -X is given.
11348 * options.h (class General_options): Declare new options
11349 '--discard-locals' and '-X' for discarding locals.
11350 * target.h (class Target): Define new methods is_local_label_name.
11351 Declare new virtual method do_is_local_label_name.
11352 * target.cc: New file.
11353 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11354 (check_SCRIPTS): Add discard_locals_test.sh.
11355 (check_DATA): Add discard_local_tests.syms.
11356 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11357 (discard_local_tests.syms, discard_locals_test.o): New make rules.
11358 * testsuite/Makefile.in: Regenerate.
11359 * testsuite/discard_locals_test.c: New file.
11360 * testsuite/discard_locals_test.sh: Same.
11361
11362 2009-06-05 Doug Kwan <dougkwan@google.com>
11363
11364 * object.cc (Sized_relobj::Sized_relobj): Initialize
11365 discarded_eh_frame_shndx_ to -1U.
11366 (Sized_relobj::do_layout): Record index of a discard .eh_frame
11367 section.
11368 (Sized_relobj::do_count_local_symbols): Skip local symbols in
11369 a discarded .eh_frame section.
11370 (Sized_relobj::do_finalize_local_symbols): Ditto.
11371 * object.h (class Sized_relobj): Declare new member
11372 discarded_eh_frame_shndx_.
11373 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11374 (local_labels_test.o, local_labels_test): New rules.
11375 * testsuite/Makefile.in: Regenerate.
11376
11377 2009-06-04 Doug Kwan <dougkwan@google.com>
11378
11379 * layout.cc (Layout::section_name_mapping): Add mapping for
11380 special ARM sections.
11381
11382 2009-06-03 Doug Kwan <dougkwan@google.com>
11383
11384 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11385 (utils::has_overflow): Same.
11386
11387 2009-06-03 Ian Lance Taylor <iant@google.com>
11388
11389 * layout.cc (Layout::section_name_mapping): New array, replacing
11390 Layout::linkonce_mapping.
11391 (Layout::section_name_mapping_count): New variable, replacing
11392 Layout::linkonce_mapping_count.
11393 (Layout::linkonce_output_name): Remove.
11394 (Layout::output_section_name): Rewrite.
11395 * layout.h (class Layout): Rename Linkonce_mapping to
11396 Section_name_mapping, linkonce_mapping to section_name_mapping,
11397 linkonce_mapping_count to section_name_mapping_count. Don't
11398 declare linkonce_output_name.
11399
11400 2009-06-03 Doug Kwan <dougkwan@google.com>
11401
11402 * gold/arm.cc (namespace utils): New.
11403 (Target_arm::reloc_is_non_pic): Define new method.
11404 (class Arm_relocate_functions): New.
11405 (Target_arm::Relocate::relocate): Handle relocation types used by
11406 Android.
11407
11408 2009-06-03 Ian Lance Taylor <iant@google.com>
11409
11410 * arm.cc (Target_arm::scan::global): Use || instead of |.
11411
11412 2009-06-02 Doug Kwan <dougkwan@google.com>
11413
11414 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
11415 issued_non_pic_error_.
11416 (class Target_arm::Scan): Declare new method check_non_pic.
11417 Define new method symbol_needs_plt_entry.
11418 Declare new data member issued_non_pic_error_.
11419 (class Target_arm::Relocate): Declare new method
11420 should_apply_static_reloc.
11421 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11422 (Target_arm::Scan::check_non_pic): Define new method.
11423 (Target_arm::Scan::local): Handle a small subset of reloc types used
11424 by Android.
11425 (Target_arm::Scan::local): Same.
11426 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11427
11428 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
11429
11430 * incremental.cc (Incremental_inputs::report_command_line): Filter
11431 out --incremental-* options.
11432
11433 2009-05-29 Doug Kwan <dougkwan@google.com>
11434
11435 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11436 template class.
11437 (class Target_arm): Update comment.
11438 (Target_arm::Target_arm): Initialize new data members GOT_,
11439 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11440 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11441 and Target_arm::rel_dyn_section.
11442 Declare new_enum Target_arm::Got_type.
11443 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11444 and DYNBSS_.
11445 Update commments for member do_dynsym_value.
11446 (Target_arm::got_size, Target_arm::plt_section,
11447 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11448 new methods inside class defintion.
11449 (Target_arm::got_section): Define new method.
11450 (Target_arm::rel_dyn_section): Same.
11451 (Output_data_plt_arm): New template class.
11452 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11453 (Output_data_plt_arm:do_adjust_output_section): Define new method.
11454 (Output_data_plt_arm::add_entry): Same.
11455 (Output_data_plt_arm::first_plt_entry): Define new
11456 static data member for PLT instruction template.
11457 (Output_data_plt_arm::plt_entry): Same.
11458 (Output_data_plt_arm::do_write): Define new method.
11459 (Target_arm::make_plt_entry): Same.
11460 (Target_arm::do_finalize_sections): Same.
11461 (Target_arm::do_dynsym_value): Same.
11462
11463 2009-05-28 Doug Kwan <dougkwan@google.com>
11464
11465 * Makefile.am (TARGETSOURCES): Add arm.cc.
11466 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11467 * Makefile.in: Regenerate.
11468 * arm.cc: New file.
11469 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11470
11471 2009-05-26 Doug Kwan <dougkwan@google.com>
11472
11473 * options.cc (General_options::parse_exclude_libs). Fix a comment.
11474 (General_options::check_excluded_libs): Strip off directories in
11475 archive name before matching like GNU ld does.
11476 * testsuite/Makefile.am (MOSTLYCLEANFILES,
11477 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11478 (exclude_libs_test_LDFLAGS): Add linker option
11479 -Wl,--exclude-libs,libexclude_libs_test_3
11480 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11481 an explicit archive without using -l.
11482 (alt/libexclude_libs_test_3.a): New make rule.
11483 * testsuite/Makefile.in: Regenerate.
11484 * testsuite/exclude_libs_test.c : Declare lib3_default().
11485 (main): Call it.
11486 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11487 * exclude_libs_test_3.c: New file.
11488
11489 2009-05-26 Nick Clifton <nickc@redhat.com>
11490
11491 * po/id.po: New Indonesian translation.
11492 * po/gold.pot: Updated template file.
11493
11494 2009-05-22 Sriraman Tallam <tmsriram@google.com>
11495
11496 * testsuite/Makefile.am: Add -ffunction-sections to compile
11497 gc_comdat_test files. Add -Wl,--gc-sections to build
11498 gc_comdat_test.
11499 * testsuite/Makefile.in: Regenerate.
11500 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11501
11502 2009-05-21 Sriraman Tallam <tmsriram@google.com>
11503
11504 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11505 kept comdat section was garbage collected.
11506 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11507 * testsuite/Makefile.in: Regenerate.
11508 * testsuite/gc_comdat_test.sh: New file.
11509 * testsuite/gc_comdat_test_1.cc: New file.
11510 * testsuite/gc_comdat_test_2.cc: New file.
11511
11512 2009-05-19 Doug Kwan <dougkwan@google.com>
11513
11514 * archive.cc (Archive::Archive): Move constructor from archive.h
11515 to here. Initialize no_export_.
11516 (Archive::get_elf_object_for_member): Set no_export flag of object.
11517 * archive.h (Archive::Archive): Move constructor body to
11518 archive.cc.
11519 (Archive::no_export): New method.
11520 (Archive::no_export_): New field.
11521 * object.h (Object::Object): Initialize no_export_ to false.
11522 (Object::no_export, Object::set_no_export): New methods.
11523 (Object::no_export_): New field.
11524 * options.cc (General_options::parse_exclude_libs): New method.
11525 (General_options::check_excluded_libs) Same.
11526 * options.h (exclude_libs): New option.
11527 (General_options::check_excluded_libs): New method declaration.
11528 (General_options::excluded_libs_): New field.
11529 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11530 default or protected visibility if an object has no-export flag set.
11531 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11532 (check_SCRIPTS): Add exclude_libs_test.sh.
11533 (check_DATA): Add exclude_libs_test.syms.
11534 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11535 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11536 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11537 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11538 (exclude_libs_test.syms, libexclude_libs_test_1.a,
11539 libexclude_libs_test_2.a): New rules.
11540 * testsuite/Makefile.in: Regenerate.
11541 * testsuite/exclude_libs_test.c: New file.
11542 * testsuite/exclude_libs_test.sh: Ditto.
11543 * testsuite/exclude_libs_test_1.c: Ditto.
11544 * testsuite/exclude_libs_test_2.c: Ditto.
11545
11546 2009-05-15 Ian Lance Taylor <iant@google.com>
11547
11548 * configure.ac: Check for declarations for cases where libiberty.h
11549 checks HAVE_DECL_xxx.
11550 * configure, config.in: Rebuild.
11551
11552 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
11553
11554 * gold.h (Incremental_argument_list): Remove (invalid) forward
11555 declaration.
11556 * incremental.cc (Incremental_inputs::report_achive): New method.
11557 (Incremental_inputs::report_object): New method.
11558 (Incremental_inputs::report_script): New method.
11559 (Incremental_inputs::finalize_inputs): New method.
11560 (Incremental_inputs::finalize): Call finalize_inputs().
11561 (Incremental_inputs::sized_create_incremental_inputs_section_data):
11562 Create inputs entries.
11563 * incremental.h (Incremental_input_type): New enum.
11564 (Incremental_inputs::Incremental_input): Initialize new fields.
11565 (Incremental_inputs::report_inputs): New method.
11566 (Incremental_inputs::report_achive): New method.
11567 (Incremental_inputs::report_object): New method.
11568 (Incremental_inputs::report_script): New method.
11569 (Incremental_inputs::finalize_inputs): New method.
11570 (Incremental_inputs::Input_info): New struct.
11571 (Incremental_inputs::Input_info_map): New typedef.
11572 (Incremental_inputs::lock_): New field.
11573 (Incremental_inputs::Inputs_): New field.
11574 (Incremental_inputs::Inputs_map): New field.
11575 * main.cc (main): Call Incremental_input::report_inputs.
11576 * options.h (Input_argument_list): Typedef moved from
11577 Input_arguments.
11578 (Input_file_group::Files): Remove, use ::Input_argument_list.
11579 (Input_file_group::Input_argument_list): Remove, use
11580 ::Input_argument_list.
11581 * plugin.cc (Plugin_manager::add_input_file): Add error in
11582 incremental build.
11583 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11584 functions.
11585 * script.cc (read_input_script): Call
11586 Incremental_input::report_script.
11587 * script.h (Script_info): New class.
11588
11589 2009-04-27 Ian Lance Taylor <iant@google.com>
11590
11591 * x86_64.cc (do_adjust_output_section): Set entsize to
11592 plt_entry_size.
11593
11594 2009-04-23 Elliott Hughes <enh@google.com>
11595
11596 * output.cc (Output_file::close): After short writes, continue
11597 writing from the correct offset in the buffer being written.
11598
11599 2009-04-23 Chris Demetriou <cgd@google.com>
11600
11601 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11602 * configure: Regenerate.
11603 * config.in: Regenerate.
11604 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11605 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11606
11607 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
11608
11609 * incremental.cc (Incremental_inputs_header_data): Renamed from
11610 Incremental_input_header_data.
11611 (Incremental_inputs_header_data::data_size): New field.
11612 (Incremental_inputs_header_data::put_input_file_count): Renamed
11613 from input_file_count.
11614 (Incremental_inputs_header_data::put_command_line_offset): Renamed
11615 from command_line_offset.
11616 (Incremental_inputs_header_data::put_reserved): Renamed from
11617 put_reserved.
11618 (Incremental_inputs_entry_data): Renamed from
11619 Incremental_input_entry_data.
11620 (Incremental_inputs_entry_data::data_size): New field.
11621 (Incremental_inputs::report_command_line): New method.
11622 (Incremental_inputs::finalize): New method.
11623 (Incremental_inputs::create_incremental_inputs_data): New method.
11624 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11625 * incremental.h: New file.
11626 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11627 (Layout::finalize): Create incremental inputs section in
11628 incremental builds.
11629 (Layout::create_incremental_info_sections): New method.
11630 * layout.h (Layout::incremental_inputs): New method.
11631 (Layout::create_incremental_info_sections): New method.
11632 (Layout::incremental_inputs_): New field.
11633 * main.cc (main): Notify Incremental_input of the command line.
11634
11635 2009-04-01 Ian Lance Taylor <iant@google.com>
11636 Mikolaj Zalewski <mikolajz@google.com>
11637
11638 * gold.h (reserve_unordered_map): Define, three versions, one for
11639 each version of Unordered_map.
11640 * layout.cc (Layout::Layout): Remove options parameter. Add
11641 number_of_input_files parameter. Don't initialize options_.
11642 Initialize number_of_input_files_ and resized_signatures_. Move
11643 sections_are_attached_.
11644 (Layout::layout_group): Reserve space for group_signatures_.
11645 (Layout::find_or_add_kept_section): Change name parameter to be a
11646 reference. Resize signatures_ map when it gets large enough.
11647 (Layout::layout_eh_frame): Use parameters->options() instead of
11648 this->options_.
11649 (Layout::make_output_section): Likewise.
11650 (Layout::attach_allocated_section_to_segment): Likewise.
11651 (Layout::finalize, Layout::create_executable_stack): Likewise.
11652 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11653 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11654 * layout.h (class Layout): Update declarations. Remove options_
11655 field. Add number_of_input_files_ and resized_signatures_
11656 fields. Move sections_are_attached_ field.
11657 * main.cc (main): Pass number of input files to Layout
11658 constructor. Don't pass options.
11659
11660 2009-03-30 Ian Lance Taylor <iant@google.com>
11661
11662 * ffsll.c (ffsll): Correct implementation.
11663
11664 2009-03-27 Ian Lance Taylor <iant@google.com>
11665
11666 * ffsll.c: New file.
11667 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11668 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11669 * ftruncate.c (ftruncate): Declare before definition.
11670 * mremap.c (mremap): Likewise.
11671 * pread.c (pread): Likewise.
11672 * configure, Makefile.in, config.in: Rebuild.
11673
11674 * mremap.c: New file.
11675 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11676 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11677 (mremap): Declare if HAVE_MREMAP is not defined.
11678 * configure, Makefile.in, config.in: Rebuild.
11679
11680 2009-03-27 Cary Coutant <ccoutant@google.com>
11681
11682 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11683 position independent.
11684 * sparc.cc (Target_sparc::check_non_pic): Likewise.
11685 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11686
11687 2009-03-24 Cary Coutant <ccoutant@google.com>
11688
11689 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11690 an executable.
11691 (needs_dynamic_reloc): Likewise.
11692
11693 2009-03-24 Ian Lance Taylor <iant@google.com>
11694
11695 * yyscript.y (file_cmd): Recognize EXTERN.
11696 (extern_name_list, extern_name_list_body): New nonterminals.
11697 * script.cc (script_add_extern): Define.
11698 * script-c.h (script_add_extern): Declare.
11699
11700 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
11701
11702 * object.cc (is_elf_object): Define.
11703 * object.h (is_elf_object): Declare.
11704 * archive.cc (Archive::get_elf_object_for_member): Call
11705 is_elf_object.
11706 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11707
11708 2009-03-24 Elliott Hughes <enh@google.com>
11709
11710 * output.cc (Output_file::map_anonymous): Define.
11711 (Output_file::map): Use map_anonymous. If the regular mmap fails,
11712 try an anonymous one. Report the size if the mmap fails.
11713 * output.h (class Output_file): Declare map_anonymous.
11714
11715 2009-03-24 Ian Lance Taylor <iant@google.com>
11716
11717 * target-select.cc (instantiate_target): Don't acquire the lock if
11718 the instantiated_target_ field has already been set.
11719
11720 2009-03-23 Ian Lance Taylor <iant@google.com>
11721
11722 * gold-threads.h (class Initialize_lock): Define.
11723 * gold-threads.cc (class Initialize_lock_once): Define.
11724 (initialize_lock_control): New static variable.
11725 (initialize_lock_pointer): New static variable.
11726 (initialize_lock_once): New static function.
11727 (Initialize_lock::Initialize_lock): Define.
11728 (Initialize_lock::initialize): Define.
11729 * target-select.h: Include "gold-threads.h".
11730 (class Target_selector): Add lock_ and initialize_lock_ fields.
11731 Don't define instantiate_target, just declare it.
11732 * target-select.cc (Target_selector::Target_selector): Initialize
11733 new fields.
11734 (Target_selector::instantiate_target): Define.
11735 * descriptors.h: Include "gold-threads.h".
11736 (class Descriptors): Add initialize_lock_ field.
11737 * descriptors.cc (Descriptors::Descriptors): Initialize new
11738 field.
11739 (Descriptors::open): Use initialize_lock_ field
11740 * errors.h (class Errors): Add initialize_lock_ field.
11741 * errors.cc (Errors::Errors): Initialize new field.
11742 (Errors::initialize_lock): Use initialize_lock_ field.
11743 * powerpc.cc (class Target_selector_powerpc): Remove
11744 instantiated_target_ field. In do_recognize call
11745 instantiate_target rather than do_instantiate_target. In
11746 do_instantiate_target just allocate a new target.
11747 * sparc.cc (class Target_selector_sparc): Likewise.
11748
11749 * freebsd.h: New file.
11750 * i386.cc: Include "freebsd.h".
11751 (Target_i386): Derive from Target_freebsd rather than
11752 Sized_target.
11753 (Target_selector_i386): Derive from Target_selector_freebsd rather
11754 than Target_selector.
11755 * x86_64.cc: Include "freebsd.h".
11756 (Target_x86_64): Derive from Target_freebsd rather than
11757 Sized_target.
11758 (Target_selector_x86_64): Derive from Target_selector_freebsd
11759 rather than Target_selector.
11760 * target.h (class Target): Add adjust_elf_header and
11761 do_adjust_elf_header.
11762 * output.cc (Output_file_header:: do_sized_write): Call target
11763 adjust_elf_header routine.
11764 * configure.tgt: Set targ_osabi.
11765 * configure.ac: Define GOLD_DEFAULT_OSABI.
11766 * parameters.cc (Parameters::default_target): Pass
11767 GOLD_DEFAULT_OSABI to select_target.
11768 * target-select.h (class Target_selector): Make instantiate_target
11769 protected rather than private.
11770 * Makefile.am (HFILES): Add freebsd.h.
11771 * configure, Makefile.in, config.in: Rebuild.
11772
11773 * merge.cc (do_add_input_section): Correct pend value. Change
11774 message about last entry not being null terminated from error to
11775 warning.
11776
11777 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
11778
11779 * incremental.cc: New file.
11780 * Makefile.am (CCFILES): Add incremental.cc.
11781 * Makefile.in: Rebuild.
11782
11783 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
11784
11785 * layout.cc (Layout::output_section_name): Preserve names
11786 of '.note.' sections.
11787
11788 2009-03-19 Ian Lance Taylor <iant@google.com>
11789
11790 * descriptors.cc (Descriptors::open): Check that the options are
11791 valid before using them.
11792
11793 2009-03-18 Ian Lance Taylor <iant@google.com>
11794
11795 * script-sections.h: Include <list>.
11796 (class Script_sections): Change Sections_elements from std::vector
11797 to std::list. Typedef public Elements_iterator. Add
11798 orphan_section_placement_, data_segment_align_start_, and
11799 saw_data_segment_align_ fields. Remove data_segment_align_index_
11800 field.
11801 * script-sections.cc (class Orphan_section_placement): New class.
11802 (class Sections_element): Add virtual functions is_relro and
11803 orphan_section_init. Remove virtual function place_orphan_here.
11804 (class Output_section_definition): Add is_relro and
11805 orphan_section_init. Remove place_orphan_here.
11806 (class Orphan_output_section): Likewise.
11807 (Script_sections::Script_sections): Update for field changes.
11808 (Script_sections::data_segment_align): Set saw_data_segment_align_
11809 and data_segment_align_start_, not data_segment_align_index.
11810 (Script_sections::data_segment_relro_end): Check
11811 saw_data_segment_align_. Use data_segment_align_start_ rather
11812 than data_segment_align_index_.
11813 (Script_sections::place_orphan): Rewrite to use
11814 Orphan_section_placement.
11815
11816 2009-03-17 Ian Lance Taylor <iant@google.com>
11817
11818 * archive.cc (Archive::add_symbols): Check for a version attached
11819 to the symbol name in the archive map.
11820 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11821 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11822 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11823 (ver_test_11.a): New target.
11824 * testsuite/Makefile.in: Rebuild.
11825
11826 * configure.ac: Check for chsize and posix_fallocate. Replace
11827 ftruncate.
11828 * ftruncate.c: New file, from gnulib.
11829 * output.cc (posix_fallocate): Define dummy version if not
11830 HAVE_POSIX_FALLOCATE.
11831 (Output_file::map): Call posix_fallocate rather than lseek and
11832 write.
11833 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11834 * configure, Makefile.in, config.in: Rebuild.
11835
11836 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
11837
11838 * layout.h (Layout::create_note): Add section_name parameter.
11839 * layout.cc (Layout::create_note): Likewise.
11840 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11841
11842 2009-03-17 Ian Lance Taylor <iant@google.com>
11843
11844 * descriptors.cc: Include "options.h".
11845 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11846 (Descriptors::open): Always use O_CLOEXEC when opening a new
11847 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
11848 then set FD_CLOEXEC.
11849
11850 * sparc.cc (class Target_sparc): Add has_got_section.
11851 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11852 make sure we have a GOT section.
11853
11854 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11855 (Target_sparc::Scan::local): Likewise.
11856 (Target_sparc::Scan::global): Likewise.
11857 (Target_sparc::Relocate::relocate): Likewise.
11858 (Target_sparc::Relocate::relocate_tls): Likewise.
11859
11860 * symtab.cc (Symbol_table::define_default_version): New function,
11861 broken out of add_from_object.
11862 (Symbol_table::add_from_object): Call define_default_version.
11863 (Symbol_table::define_special_symbol): Add resolve_oldsym
11864 parameter. Change all callers. If the version for a symbol comes
11865 from a version script, resolve it with the symbol with the same
11866 name with no version. Also add the symbol without a version if
11867 appropriate.
11868 (do_define_in_output_data): If resolving with oldsym, don't delete
11869 sym.
11870 (do_define_in_output_segment): Likewise.
11871 (do_define_as_constant): Likewise.
11872 * symtab.h (class Symbol_table): Update declarations.
11873
11874 2009-03-13 Ian Lance Taylor <iant@google.com>
11875
11876 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11877 (Read_symbols::requeue): New function.
11878 (Read_symbols::do_read_symbols): If make_elf_object fails because
11879 the target type is not configured, and the file was searched for,
11880 issue a warning and retry with the next directory.
11881 (Add_symbols::run): If the file has an incompatible format, and
11882 it was searched for, requeue the Read_symbols task. On error,
11883 release the object.
11884 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11885 dirindex parameter to constructor. Change all callers. Declare
11886 incompatible_warning and requeue.
11887 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11888 input_argument_ and input_group_ fields. Add them to
11889 constructor. Change all callers.
11890 (class Read_script): Add dirindex_ field. Add it to constructor.
11891 Change all callers.
11892 * archive.cc (Archive::setup): Remove input_objects parameter.
11893 Change all callers.
11894 (Archive::get_file_and_offset): Likewise.
11895 (Archive::read_all_symbols): Likewise.
11896 (Archive::read_symbols): Likewise.
11897 (Archive::get_elf_object_for_member): Remove input_objects
11898 parameter. Add punconfigured parameter. Change all callers.
11899 (Archive::add_symbols): Change return type to bool. Check return
11900 value of include_member.
11901 (Archive::include_all_members): Likewise.
11902 (Archive::include_member): Change return type to bool. Return
11903 false if first included object has incompatible target. Set
11904 included_member_ field.
11905 (Add_archive_symbols::run): If add_symbols returns false, requeue
11906 Read_symbols task.
11907 * archive.h (class Archive): Add included_member_ field.
11908 Initialize it in constructor. Add input_file and searched_for
11909 methods. Update declarations.
11910 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11911 input_argument_ fields. Add them to constructor. Change all
11912 callers.
11913 * script.cc: Include "target-select.h".
11914 (class Parser_closure): Add skip_on_incompatible_target_ and
11915 found_incompatible_target_ fields. Add
11916 skip_on_incompatible_target parameter to constructor. Change all
11917 callers. Add methods skip_on_incompatible_target,
11918 clear_skip_on_incompatible_target, found_incompatible_target, and
11919 set_found_incompatible_target.
11920 (read_input_script): Add dirindex parameter. Change all callers.
11921 If parser finds an incompatible target, requeue Read_symbols
11922 task.
11923 (script_set_symbol): Clear skip_on_incompatible_target in
11924 closure.
11925 (script_add_assertion, script_parse_option): Likewise.
11926 (script_start_sections, script_add_phdr): Likewise.
11927 (script_check_output_format): New function.
11928 * script.h (read_input_script): Update declaration.
11929 * script-c.h (script_check_output_format): Declare.
11930 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11931 (ignore_cmd): Remove OUTPUT_FORMAT.
11932 * fileread.cc (Input_file::Input_file): Add explicit this.
11933 (Input_file::will_search_for): New function.
11934 (Input_file::open): Add pindex parameter. Change all callers.
11935 * fileread.h (class Input_file): Add input_file_argument method.
11936 Declare will_search_for. Update declarations.
11937 * object.cc (make_elf_object): Add punconfigured parameter.
11938 Change all callers.
11939 * object.h (class Object): Make input_file public. Add
11940 searched_for method.
11941 (make_elf_object): Update declaration.
11942 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11943 restart search.
11944 * dirsearch.h (class Dirsearch): Update declaration.
11945 * options.h (class General_options): Add --warn-search-mismatch.
11946 * parameters.cc (Parameters::is_compatible_target): New function.
11947 * parameters.h (class Parameters): Declare is_compatible_target.
11948 * workqueue.cc (Workqueue::add_blocker): New function.
11949 * workqueue.h (class Workqueue): Declare add_blocker.
11950
11951 * fileread.cc (Input_file::open): Remove options parameter.
11952 Change all callers.
11953 (Input_file::open_binary): Likewise.
11954 * script.cc (read_input_script): Likewise.
11955 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11956 options parameter from constructor. Change all callers.
11957 (class Read_script): Likewise.
11958 * fileread.h (class Input_file): Update declarations.
11959 * script.h (read_input_script): Update declaration.
11960
11961 2009-03-10 Nick Clifton <nickc@redhat.com>
11962
11963 * po/es.po: New Spanish translation.
11964
11965 2009-03-06 Cary Coutant <ccoutant@google.com>
11966
11967 * options.cc (parse_short_option): Keep dash_z from registering itself.
11968
11969 2009-03-03 Ian Lance Taylor <iant@google.com>
11970
11971 PR 9918
11972 * target-reloc.h (relocate_section): Pass output_section to
11973 relocate.
11974 * i386.cc (Target_i386::should_apply_static_reloc): Add
11975 output_section parameter. Change all callers.
11976 (Target_i386::Relocate::relocate): Add output_section parameter.
11977 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11978 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11979 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11980 * testsuite/two_file_shared.sh: New script.
11981 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11982 (check_DATA): Add two_file_shared.dbg.
11983 (two_file_shared.dbg): New target.
11984 * testsuite/Makefile.in: Rebuild.
11985
11986 2009-03-01 Ian Lance Taylor <iant@google.com>
11987
11988 * configure.ac: Check for byteswap.h.
11989 * configure: Rebuild.
11990 * config.in: Rebuild.
11991
11992 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11993
11994 * layout.cc (Layout::find_or_add_kept_section): New function.
11995 (Layout::add_comdat): Removed.
11996 * layout.h (struct Kept_section): Move out of class Layout.
11997 Remove trailing underscores from field names. Add group_sections
11998 field. Rename group_ field to is_group. Change all uses.
11999 (class Layout): Declare find_or_add_kept_section, not add_comdat.
12000 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12001 comdat_groups_ field.
12002 (Sized_relobj::include_section_group): Use
12003 find_or_add_kept_section and Kept_section::group_sections.
12004 (Sized_relobj::include_linkonce_section): Likewise.
12005 * object.cc (class Sized_relobj): Don't define Comdat_group or
12006 Comdat_group_table. Remove find_comdat_group and
12007 add_comdat_group. Remove comdat_groups_ field.
12008 * plugin.cc (include_comdat_group): Use
12009 Layout::find_or_add_kept_section.
12010
12011 2009-02-28 Ian Lance Taylor <iant@google.com>
12012
12013 * README: --gc-sections and map files are now supported. Document
12014 some build requirements.
12015
12016 PR 6992
12017 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12018 relocatable link set the value of the section symbol to zero.
12019 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12020 relocatable link don't include the section address in the local
12021 symbol value.
12022
12023 2009-02-27 Ian Lance Taylor <iant@google.com>
12024
12025 PR 6811
12026 * options.h (class Search_directory): Add is_system_directory.
12027 (class General_options): Declare is_in_system_directory.
12028 * options.cc (get_relative_sysroot): Make static.
12029 (get_default_sysroot): Make static.
12030 (General_optoins::is_in_system_directory): New function.
12031 * fileread.cc (Input_file::is_in_system_directory): New function.
12032 * fileread.h (class Input_file): Declare is_in_system_directory.
12033 * object.h (class Object): Add is_in_system_directory.
12034 (class Input_objects): Remove system_library_directory_ field.
12035 * object.cc (Input_objects::add_object): Don't set
12036 system_library_directory_.
12037 (input_objects::found_in_system_library_directory): Remove.
12038 * symtab.cc (Symbol_table::write_globals): Remove input_objects
12039 parameter. Change all callers.
12040 (Symbol_table::sized_write_globals): Likewise.
12041 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12042 Call Object::is_in_system_directory.
12043 * symtab.h (class Symbol_table): Update declarations.
12044
12045 PR 5990
12046 * descriptors.h (Open_descriptor): Add is_on_stack field.
12047 * descriptors.cc (Descriptors::open): If the descriptor is on the
12048 top of the stack, remove it. Initialize is_on_stack field.
12049 (Descriptors::release): Only add pod to stack if it is not on the
12050 stack already.
12051 (Descriptors::close_some_descriptor): Clear stack_next and
12052 is_on_stack fields.
12053
12054 PR 7091
12055 * output.cc (Output_section::find_starting_output_address): Rename
12056 from starting_output_address; add PADDR parameter; change return
12057 type.
12058 * output.h (class Output_section): Declare
12059 find_starting_output_address instead of starting_output_address.
12060 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12061 section symbol for which we can't find a merge section.
12062
12063 PR 9836
12064 * symtab.cc (Symbol_table::add_from_object): If the visibility is
12065 hidden or internal, force the symbol to be local.
12066 * resolve.cc (Symbol::override_visibility): Define.
12067 (Symbol::override_base): Use override_visibility.
12068 (Symbol_table::resolve): Likewise.
12069 (Symbol::override_base_with_special): Likewise.
12070 (Symbol_table::override_with_special): If the visibility is hidden
12071 or internal, force the symbol to be local.
12072 * symtab.h (class Symbol): Add set_visibility and
12073 override_visibility.
12074 * testsuite/ver_test_1.sh: New file.
12075 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12076 (check_DATA): Add ver_test_1.syms.
12077 (ver_test_1.syms): New target.
12078 * testsuite/Makefile.in: Rebuild.
12079
12080 2009-02-25 Cary Coutant <ccoutant@google.com>
12081
12082 * layout.cc (Layout::choose_output_section): Don't rename sections
12083 when using a linker script that has a SECTIONS clause.
12084 * Makefile.in: Regenerate.
12085
12086 * testsuite/Makefile.am (script_test_5.sh): New test case.
12087 * testsuite/Makefile.in: Regenerate.
12088 * testsuite/script_test_5.cc: New file.
12089 * testsuite/script_test_5.sh: New file.
12090 * testsuite/script_test_5.t: New file.
12091
12092 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
12093
12094 * archive.cc (Archive::include_member): Update calls to add_symbols.
12095 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12096 the Layout argument.
12097 * dynobj.h (do_add_symbols): Add the Layout argument.
12098 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12099 Layout argument.
12100 * object.h (Object::add_symbols): Add the Layout argument.
12101 (Object::do_add_symbols): Add the Layout argument.
12102 (Sized_relobj::do_add_symbols): Add the Layout argument.
12103 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12104 Unify the two versions.
12105 (Add_plugin_symbols): Remove.
12106 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12107 (Sized_pluginobj::do_add_symbols): Unify the two versions.
12108 (Add_plugin_symbols): Remove.
12109 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12110 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12111 (Add_symbols::run): Make it work with Pulginobj.
12112
12113 2009-02-06 Ian Lance Taylor <iant@google.com>
12114
12115 * object.cc (Sized_relobj::do_layout): Make info message start
12116 with lower case letter.
12117
12118 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
12119
12120 * binary.cc: Fix file comment.
12121
12122 * options.h (enum Incremental_disposition): Define.
12123 (class General_options): Add new options: --incremental,
12124 --incremental_changed, --incremental_unchanged,
12125 --incremental_unknown. Add incremental_disposition_ and
12126 implicit_incremental_ fields.
12127 (General_options::incremental_disposition): New function.
12128 (class Position_dependent_options): Add incremental_disposition
12129 option.
12130 (Position_dependent_options::copy_from_options): Set incremental
12131 dispositions.
12132 * options.cc (General_options::parse_incremental_changed): New
12133 function.
12134 (General_options::parse_incremental_unchanged): New function.
12135 (General_options::parse_incremental_unknown): New function.
12136 (General_options::General_options): Initialize new fields
12137 incremental_disposition_ and implicit_incremental_.
12138 (General_options::finalize): Check for uasge of --incremental-*
12139 without --incremental.
12140
12141 2009-02-06 Chris Demetriou <cgd@google.com>
12142
12143 * gold.h (gold_undefined_symbol): Change to take only a Symbol
12144 pointer and to report location as the file name associated with
12145 the symbol.
12146 (gold_undefined_symbol_at_location): New function to replace the
12147 old gold_undefined_symbol functionality.
12148 * target-reloc.h (relocate_section): Update to use
12149 gold_undefined_symbol_at_location.
12150 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12151 Call gold_undefined_symbol function rather than gold_error.
12152 * errors.h (Errors::undefined_symbol): Take location as a
12153 string, rather than calculating it from a relocation.
12154 * errors.cc (Errors::fatal): Print "fatal error:" before the
12155 formatted message.
12156 (Errors::error, Errors::error_at_location): Print "error: "
12157 before the formatted message.
12158 (Errors::undefined_symbol): Take location as a string, rather
12159 than calculating it from a relocation.
12160 (gold_undefined_symbol_at_location): New function akin to
12161 old gold_undefined_symbol, calculates location from relocation.
12162 (gold_undefined_symbol): Change to take only a Symbol pointer
12163 and to report location as the file name associated with the symbol.
12164 * testsuite/debug_msg.sh: Update for changed error messages.
12165 * testsuite/undef_symbol.sh: Likewise.
12166
12167 2009-02-04 Duncan Sands <baldrick@free.fr>
12168
12169 PR 9812
12170 * reduced_debug_output.h
12171 (Output_reduced_debug_abbrev_section::failed): Use format for
12172 gold_warning.
12173 (Output_reduced_debug_info_section::faild): Likewise.
12174
12175 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
12176
12177 * script.cc (Lazy_demangler): New class.
12178 (Version_script_info::get_symbol_version_helper): Demangle a
12179 symbol only once.
12180
12181 2009-01-29 Cary Coutant <ccoutant@google.com>
12182
12183 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12184 to __tls_get_addr.
12185 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12186
12187 2009-01-28 Ian Lance Taylor <iant@google.com>
12188
12189 * version.cc (version_string): Bump to 1.9.
12190
12191 * gold.h: Include <cstring> and <stdint.h>.
12192 * version.cc: Include <cstdio>.
12193 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12194 warning.
12195 * reduced_debug_output.cc (insert_into_vector): Rename from
12196 Insert_into_vector; change all callers. Use Swap_unaligned to
12197 avoid aliasing issue; remove union since it is unnecessary.
12198
12199 2009-01-27 Sriraman Tallam <tmsriram@google.com>
12200
12201 * Makefile.am (CCFILES): Add gc.cc.
12202 (HFILES): Add gc.h.
12203 * Makefile.in: Regenerate.
12204 * gold.cc (Gc_runner): New class.
12205 (queue_initial_tasks): Call garbage collection related tasks
12206 when corresponding options are invoked.
12207 (queue_middle_gc_tasks): New function.
12208 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12209 processed early before laying out sections during garbage collection.
12210 * gold.h (queue_middle_gc_tasks): New function.
12211 (is_prefix_of): Move from "layout.cc".
12212 * i386.cc (Target_i386::gc_process_relocs): New function.
12213 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12214 * main.cc (main): Create object of class "Garbage_collection".
12215 * object.cc (Relobj::copy_symbols_data): New function.
12216 (Relobj::is_section_name_included): New function.
12217 (Sized_relobj::do_layout): Allow this function to be called twice
12218 during garbage collection and defer layout of section during the
12219 first call.
12220 * object.h (Relobj::get_symbols_data): New function.
12221 (Relobj::is_section_name_included): New function.
12222 (Relobj::copy_symbols_data): New function.
12223 (Relobj::set_symbols_data): New function.
12224 (Relobj::get_relocs_data): New function.
12225 (Relobj::set_relocs_data): New function.
12226 (Relobj::is_output_section_offset_invalid): New pure virtual function.
12227 (Relobj::gc_process_relocs): New function.
12228 (Relobj::do_gc_process_relocs): New pure virtual function.
12229 (Relobj::sd_): New data member.
12230 (Sized_relobj::is_output_section_offset_invalid): New function.
12231 (Sized_relobj::do_gc_process_relocs): New function.
12232 * options.h (General_options::gc_sections): Modify to not be a no-op.
12233 (General_options::print_gc_sections): New option.
12234 * plugin.cc (Plugin_finish::run): Remove function call to
12235 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
12236 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12237 * reloc.cc (Read_relocs::run): Add task to process relocs and
12238 determine unreferenced sections when doing garbage collection.
12239 (Gc_process_relocs): New class.
12240 (Sized_relobj::do_gc_process_relocs): New function.
12241 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12242 sections that are garbage collected.
12243 * reloc.h (Gc_process_relocs): New class.
12244 * sparc.cc (Target_sparc::gc_process_relocs): New function.
12245 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12246 symbols whose corresponding sections are garbage collected.
12247 (Symbol_table::Symbol_table): Add new parameter for the garbage
12248 collection object.
12249 (Symbol_table::gc_mark_undef_symbols): New function.
12250 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12251 (Symbol_table::gc_mark_dyn_syms): New function.
12252 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12253 as garbage.
12254 (Symbol_table::add_from_object): Likewise.
12255 (Symbol_table::add_from_relobj): When building shared objects, do not
12256 treat externally visible symbols as garbage.
12257 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12258 table information for static and relocatable links.
12259 * symtab.h (Symbol_table::set_gc): New function.
12260 (Symbol_table::gc): New function.
12261 (Symbol_table::gc_mark_undef_symbols): New function.
12262 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12263 (Symbol_table::gc_mark_dyn_syms): New function.
12264 (Symbol_table::gc_): New data member.
12265 * target.h (Sized_target::gc_process_relocs): New pure virtual
12266 function.
12267 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12268 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12269
12270 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
12271
12272 * options.h (General_options::gc_sections): Define as a no-op for now.
12273 (General_options::no_keep_memory): Ditto.
12274 (General_options::Bshareable): Define.
12275 * options.cc (General_options::finalize): Honor -Bshareable.
12276
12277 2009-01-20 Andreas Schwab <schwab@suse.de>
12278
12279 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12280 read the value in the contents, since we don't use it. Use the
12281 template endianness when writing.
12282 (Relocate::relocate): Use it for R_PPC_REL16_HA.
12283
12284 2009-01-19 Andreas Schwab <schwab@suse.de>
12285
12286 * configure.tgt (powerpc64-*): Fix targ_obj.
12287
12288 2009-01-15 Ian Lance Taylor <iant@google.com>
12289
12290 * object.cc (Sized_relobj::write_local_symbols): Don't write out
12291 local symbols when stripping all symbols.
12292
12293 2009-01-14 Cary Coutant <ccoutant@google.com>
12294
12295 * output.cc (Output_reloc): Add explicit instantiations.
12296
12297 2009-01-14 Cary Coutant <ccoutant@google.com>
12298
12299 * archive.cc (Archive::get_elf_object_for_member): Remove call
12300 to File_read::claim_for_plugin.
12301 * descriptors.cc (Descriptors::open): Remove reference to
12302 is_claimed.
12303 (Descriptors::claim_for_plugin): Remove.
12304 * descriptors.h (Descriptors::claim_for_plugin): Remove.
12305 (Descriptors::is_claimed): Remove.
12306 (claim_descriptor_for_plugin): Remove.
12307 * fileread.cc (File_read::claim_for_plugin): Remove.
12308 * fileread.h (File_read::claim_for_plugin): Remove.
12309 (File_read::descriptor): Reopen descriptor if necessary.
12310 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
12311 (Plugin_manager::all_symbols_read): Add task parameter. Change
12312 all callers.
12313 (Plugin_manager::get_input_file): New function.
12314 (Plugin_manager::release_input_file): New function.
12315 (Pluginobj::Pluginobj): Add filesize parameter and initialize
12316 corresponding data member.
12317 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12318 and pass to base constructor. Change all callers.
12319 (get_input_file, release_input_file): New functions.
12320 (make_sized_plugin_object): Add filesize parameter. Change all callers.
12321 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12322 (Plugin_manager::all_symbols_read): Add task parameter.
12323 (Plugin_manager::get_input_file): New function.
12324 (Plugin_manager::release_input_file): New function.
12325 (Plugin_manager::task_): New data member.
12326 (Pluginobj::Pluginobj): Add filesize parameter.
12327 (Pluginobj::filename): New function.
12328 (Pluginobj::descriptor): New function.
12329 (Pluginobj::filesize): New function.
12330 (Pluginobj::filesize_): New data member.
12331 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12332 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12333 File_read::claim_for_plugin; use Object::unlock to unlock the file.
12334
12335 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12336 with archive libraries.
12337 * testsuite/Makefile.in: Regenerate.
12338 * testsuite/plugin_test.c (struct sym_info): New type.
12339 (get_input_file, release_input_file): New static variables.
12340 (onload): Capture new transfer vector entries.
12341 (claim_file_hook): Stop reading at end of file according to filesize.
12342 Factor out parsing of readelf output into separate function.
12343 (all_symbols_read_hook): Exercise get_input_file and release_input_file
12344 APIs and get the source file name from the symbol table. Convert
12345 source file name to corresponding object file name. Print info
12346 message when adding new input files.
12347 (parse_readelf_line): New function.
12348 * testsuite/plugin_test_1.sh: Add checks for new info messages.
12349 * testsuite/plugin_test_2.sh: Likewise.
12350 * testsuite/plugin_test_3.sh: Likewise.
12351 * testsuite/plugin_test_4.sh: New test case.
12352
12353 2009-01-07 Ian Lance Taylor <iant@google.com>
12354
12355 * version.cc (version_string): Bump to 1.8.
12356
12357 2008-12-23 Cary Coutant <ccoutant@google.com>
12358
12359 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12360 * plugin.cc (Plugin_manager::finish): Rename as
12361 layout_deferred_objects. Move cleanup to separate function.
12362 (Plugin_manager::cleanup): New function.
12363 (Plugin_finish::run): Call layout_deferred_objects and cleanup
12364 separately.
12365 * plugin.h (Plugin_manager::finish): Rename as
12366 layout_deferred_objects.
12367 (Plugin_manager::cleanup): New function.
12368 (Plugin_manager::cleanup_done): New field.
12369
12370 2008-12-23 Cary Coutant <ccoutant@google.com>
12371
12372 * plugin.cc (is_visible_from_outside): New function.
12373 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12374 so we don't return "IR only" status for exported symbols or -r links.
12375
12376 * testsuite/Makefile.am (plugin_test_3): New test case.
12377 * testsuite/Makefile.in: Regenerate.
12378 * testsuite/plugin_test_3.sh: New file.
12379
12380 2008-12-22 Cary Coutant <ccoutant@google.com>
12381
12382 * object.cc (Sized_relobj::layout_section): New function.
12383 (Sized_relobj::do_layout): Defer layout of input sections until after
12384 plugin has provided replacement files.
12385 (Sized_relobj::do_layout_deferred_sections): New function.
12386 * object.h (Relobj::set_section_offset): Remove virtual keyword.
12387 (Relobj::layout_deferred_sections): New function.
12388 (Relobj::do_layout_deferred_sections): New function.
12389 (Sized_relobj::do_layout_deferred_sections): New function.
12390 (Sized_relobj::layout_section): New function.
12391 (Sized_relobj::Deferred_layout): New structure.
12392 (Sized_relobj::deferred_layout_): New field.
12393 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12394 Change all callers. Layout deferred sections.
12395 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
12396 references.
12397 (Plugin_hook::run): Move code from do_plugin_hook inline.
12398 (Plugin_hook::do_plugin_hook): Remove.
12399 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12400 (Plugin_manager::finish): Renamed, was cleanup.
12401 (Plugin_manager::should_defer_layout): New function.
12402 (Plugin_manager::add_deferred_layout_object): New function.
12403 (Plugin_manager::Deferred_layout_list): New type.
12404 (Plugin_manager::deferred_layout_objects_): New field.
12405 (Plugin_hook::do_plugin_hook): Remove.
12406
12407 2008-12-17 Ian Lance Taylor <iant@google.com>
12408
12409 * options.h (class General_options): Add --no case for
12410 --export-dynamic.
12411
12412 2008-12-16 Cary Coutant <ccoutant@google.com>
12413
12414 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12415 vector.
12416 (Plugin_manager::claim_file): Create plugin object even if
12417 plugin did not call the add_symbols callback.
12418 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12419 asking for more symbols than were added.
12420 * testsuite/Makefile.am (plugin_test_1): Add test case with
12421 no global symbols.
12422 (empty.syms): New target.
12423 * testsuite/Makefile.in: Regenerate.
12424 * testsuite/plugin_test.c (claim_file_hook): Add new debug
12425 message. Don't call add_symbols if no globals.
12426 (all_symbols_read_hook): Don't provide replacement for empty
12427 claimed file.
12428
12429 2008-12-12 Ian Lance Taylor <iant@google.com>
12430
12431 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12432 r_type == 0 for a local symbol with r_sym == 0.
12433 (scan_relocatable_relocs): Pass r_sym to
12434 local_non_section_strategy.
12435 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12436 r_sym parameter.
12437
12438 * configure.ac: Update test for TLS descriptors: they are
12439 supported as of glibc 2.9.
12440 * configure: Rebuild.
12441
12442 2008-12-11 Ian Lance Taylor <iant@google.com>
12443
12444 PR 7091
12445 * target-reloc.h (Default_scan_relocatable_relocs): For each
12446 function, map r_type == 0 to RELOC_DISCARD.
12447
12448 2008-12-10 Cary Coutant <ccoutant@google.com>
12449
12450 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12451 object to override a kept COMDAT group from a plugin object.
12452
12453 2008-12-09 Ian Lance Taylor <iant@google.com>
12454
12455 PR 7088
12456 * yyscript.y (file_cmd): Handle INPUT.
12457
12458 * testsuite/initpri1.c: Change all declarations to be full
12459 prototypes by adding void, to avoid compiler warnings.
12460
12461 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
12462
12463 * options.cc (General_options::parse_plugin_opt): New.
12464 (General_options::add_plugin): The argument now is just the filename.
12465 (General_options::add_plugin_option): New.
12466 * options.h (plugin_opt): New.
12467 (add_plugin): Change argument name.
12468 (add_plugin_option): New.
12469 * plugin.cc (Plugin::load): Don't parse the plugin option.
12470 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12471 (Plugin::add_option): New.
12472 (Plugin::args_): Change type.
12473 (Plugin::filename_): New.
12474 (Plugin_manager::add_plugin_option): New.
12475 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12476 * testsuite/Makefile.in: Regenerate.
12477
12478 2008-12-05 Cary Coutant <ccoutant@google.com>
12479
12480 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12481 Handle --strip-lto-sections option.
12482 * options.h (strip_lto_sections): New option.
12483
12484 2008-12-01 Cary Coutant <ccoutant@google.com>
12485
12486 * plugin.cc (ld_plugin_message): Change format parameter to const.
12487 Fix mismatch between new[] and delete.
12488
12489 2008-11-14 Cary Coutant <ccoutant@google.com>
12490
12491 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12492 instead of -1U.
12493
12494 2008-11-05 Craig Silverstein <csilvers@google.com>
12495
12496 * options.cc (General_options::parse_dynamic_list): New function.
12497 * options.h (General_options): New flags dynamic_list,
12498 dynamic_list_data, dynamic_list_cpp_new, and
12499 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
12500 (General_options::in_dynamic_list): New function.
12501 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12502 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12503 (Lex::can_continue_name): Likewise.
12504 (yylex): Likewise.
12505 (read_script_file): New parameter script_options.
12506 (read_dynamic_list): New function.
12507 (Script_options::define_dynamic_list): New function.
12508 (dynamic_list_keyword_parsecodes): New variable.
12509 (dynamic_list_keywords): New variable.
12510 * script.h (Script_options::define_dynamic_list): New function
12511 prototype.
12512 (read_dynamic_list): New function prototype.
12513 * symtab.cc (strprefix): New macro.
12514 (Symbol::should_add_dynsym_entry): Support dynamic_list,
12515 dynamic_list_data, dynamic_list_cpp_new, and
12516 dynamic_list_cpp_typeinfo.
12517 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12518 (dynamic_list_expr): New rule.
12519 (dynamic_list_nodes): Likewise.
12520 (dynamic_list_node): Likewise.
12521 * testsuite/Makefile.am (dynamic_list): New test.
12522 * testsuite/Makefile.in: Regenerated.
12523 * testsuite/dynamic_list.t: New file.
12524 * testsuite/dynamic_list.sh: New file.
12525
12526 2008-11-05 Craig Silverstein <csilvers@google.com>
12527
12528 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12529 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12530 (t11_last): Likewise.
12531 * testsuite/ver_test_6.c (main): Likewise.
12532
12533 2008-10-07 Cary Coutant <ccoutant@google.com>
12534
12535 * options.c (General_options::finalize): Add check for -static and
12536 -shared.
12537 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12538 is not empty.
12539
12540 2008-10-02 Cary Coutant <ccoutant@google.com>
12541
12542 * plugin.cc (make_sized_plugin_object): Fix conditional
12543 compilation to work when not all targets are enabled.
12544
12545 2008-09-29 Cary Coutant <ccoutant@google.com>
12546
12547 * archive.cc (Archive::get_file_and_offset): Use filename instead
12548 of name to get library path.
12549 (Archive::include_member): Unlock external member of a thin archive.
12550
12551 * testsuite/Makefile.am (TEST_AR): New variable.
12552 (thin_archive_test_1): New test.
12553 (thin_archive_test_2): New test.
12554 * testsuite/Makefile.in: Regenerate.
12555 * testsuite/thin_archive_main.cc: New file.
12556 * testsuite/thin_archive_test_1.cc: New file.
12557 * testsuite/thin_archive_test_2.cc: New file.
12558 * testsuite/thin_archive_test_3.cc: New file.
12559 * testsuite/thin_archive_test_4.cc: New file.
12560
12561 2008-09-29 Cary Coutant <ccoutant@google.com>
12562
12563 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12564 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12565 instead of -1U.
12566 (Sized_relobj::do_finalize_local_symbols): Likewise.
12567 (Sized_relobj::map_to_kept_section): Likewise.
12568 * object.h (Sized_relobj::invalid_address): New constant.
12569 (Sized_relobj::do_output_section_offset): Check for invalid_address
12570 and return -1ULL.
12571 * output.cc (Output_reloc::local_section_offset): Use constant
12572 invalid_address instead of -1U.
12573 (Output_reloc::get_address): Likewise.
12574 (Output_section::output_address): Change -1U to -1ULL.
12575 * output.h (Output_reloc::invalid_address): New constant.
12576 * reloc.cc (Sized_relobj::write_sections): Use constant
12577 invalid_address instead of -1U.
12578 (Sized_relobj::relocate_sections): Likewise.
12579 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12580 values for merge sections.
12581 * target-reloc.h (relocate_for_relocatable): Use constant
12582 invalid_address instead of -1U.
12583
12584 2008-09-19 Cary Coutant <ccoutant@google.com>
12585
12586 Add plugin functionality for link-time optimization (LTO).
12587 * configure.ac (plugins): Add --enable-plugins option.
12588 * configure: Regenerate.
12589 * config.in: Regenerate.
12590 * Makefile.am (LIBDL): New variable.
12591 (CCFILES): Add plugin.cc.
12592 (HFILES): Add plugin.h.
12593 (ldadd_var): Add LIBDL.
12594 * Makefile.in: Regenerate.
12595
12596 * archive.cc: Include "plugin.h".
12597 (Archive::setup): Don't preread archive symbols when using a plugin.
12598 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
12599 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12600 files.
12601 (Archive::include_member): Add symbols from plugin objects.
12602 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12603 * descriptors.cc (Descriptors::open): Check for file descriptors
12604 abandoned by plugins.
12605 (Descriptors::claim_for_plugin): New function.
12606 * descriptors.h (Descriptors::claim_for_plugin): New function.
12607 (Open_descriptor::is_claimed): New field.
12608 (claim_descriptor_for_plugin): New function.
12609 * fileread.cc (File_read::claim_for_plugin): New function.
12610 * fileread.h (File_read::claim_for_plugin): New function.
12611 (File_read::descriptor): New function.
12612 * gold.cc: Include "plugin.h".
12613 (queue_initial_tasks): Add task to call plugin hooks for generating
12614 new object files.
12615 * main.cc: Include "plugin.h".
12616 (main): Load plugin libraries.
12617 * object.h (Pluginobj): Declare.
12618 (Object::pluginobj): New function.
12619 (Object::do_pluginobj): New function.
12620 (Object::set_target): New function.
12621 * options.cc: Include "plugin.h".
12622 (General_options::parse_plugin): New function.
12623 (General_options::General_options): Initialize plugins_ field.
12624 (General_options::add_plugin): New function.
12625 * options.h (Plugin_manager): Declare.
12626 (General_options): Add --plugin option.
12627 (General_options::has_plugins): New function.
12628 (General_options::plugins): New function.
12629 (General_options::add_plugin): New function.
12630 (General_options::plugins_): New field.
12631 * plugin.cc: New file.
12632 * plugin.h: New file.
12633 * readsyms.cc: Include "plugin.h".
12634 (Read_symbols::do_read_symbols): Check for archive before checking
12635 for ELF file. Call plugin hooks to claim files.
12636 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12637 from a real object file; force override when processing replacement
12638 files.
12639 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12640 (Symbol::init_base_object): Likewise.
12641 (Symbol::init_base_output_data): Likewise.
12642 (Symbol::init_base_output_segment): Likewise.
12643 (Symbol::init_base_constant): Likewise.
12644 (Symbol::init_base_undefined): Likewise.
12645 (Symbol::output_section): Assert that object is not a plugin.
12646 (Symbol_table::add_from_pluginobj): New function.
12647 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12648 undefined.
12649 (Symbol_table::sized_write_globals): Likewise.
12650 (Symbol_table::add_from_pluginobj): Instantiate template.
12651 * symtab.h (Sized_pluginobj): Declare.
12652 (Symbol::in_real_elf): New function.
12653 (Symbol::set_in_real_elf): New function.
12654 (Symbol::in_real_elf_): New field.
12655 (Symbol_table::add_from_pluginobj): New function.
12656
12657 * testsuite/Makefile.am (AM_CFLAGS): New variable.
12658 (LIBDL): New variable.
12659 (LDADD): Add LIBDL.
12660 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12661 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12662 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12663 (MOSTLYCLEANFILES): Likewise.
12664 * testsuite/Makefile.in: Regenerate.
12665 * testsuite/plugin_test.c: New file.
12666 * testsuite/plugin_test_1.sh: New file.
12667 * testsuite/plugin_test_2.sh: New file.
12668
12669 2008-09-16 Ian Lance Taylor <iant@google.com>
12670
12671 * target-reloc.h (relocate_section): Check whether a symbol is
12672 defined by the ABI before reporting an undefined symbol error.
12673 * target.h (Target::is_defined_by_abi): Make parameter const.
12674 (Target::do_is_defined_by_abi): Likewise.
12675 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12676 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12677 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12678 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12679 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12680 * testsuite/Makefile.in: Rebuild.
12681
12682 * fileread.cc (make_view): Add casts to avoid warning.
12683
12684 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12685
12686 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12687 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12688
12689 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12690
12691 * options.h (General_options::output_is_executable): New.
12692 (General_options::output_is_pie): New.
12693 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12694 for shared libraries.
12695 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12696
12697 2008-09-11 Chris Demetriou <cgd@google.com>
12698
12699 * options.h (origin): New -z option.
12700 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12701 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12702 in DT_FLAGS_1.
12703
12704 2008-09-05 Cary Coutant <ccoutant@google.com>
12705
12706 * fileread.cc (File_read::make_view): Add check for attempt to map
12707 beyond end of file.
12708
12709 2008-09-05 Cary Coutant <ccoutant@google.com>
12710
12711 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12712 explicit instantiations.
12713
12714 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
12715
12716 PR gold/6858
12717 * options.cc (General_options::finalize): Allow undefined symbols
12718 in shlibs if linking -shared.
12719
12720 PR gold/6859
12721 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12722 symbols as not needing a dynsym entry.
12723
12724 2008-08-20 Craig Silverstein <csilvers@google.com>
12725
12726 * fileread.cc (File_read::open): Do not lock the file unless it
12727 was successfully opened.
12728
12729 2008-08-14 Cary Coutant <ccoutant@google.com>
12730
12731 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12732 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12733 * testsuite/tls_test.cc (struct int128): 128-bit struct
12734 for testing TLS relocs with non-zero addend.
12735 (v12): New TLS variable.
12736 (t12): New test.
12737 (t_last): Add check for v12.
12738 * testsuite/tls_test.h (t12): New function.
12739 * testsuite/tls_test_main.cc (thread_routine): Call new test.
12740
12741 2008-08-13 Ian Lance Taylor <iant@google.com>
12742
12743 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12744 set tls_segment_ or relro_segment_.
12745 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12746 when appropriate.
12747 * output.h (Output_section::clear_is_relro): New function.
12748 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12749 sections specially even when output_data_ is empty.
12750 (Output_segment::maximum_alignment): When first section is relro,
12751 only force alignment for PT_LOAD segments.
12752 * script.cc (script_data_segment_align): New function.
12753 (script_data_segment_relro_end): New function.
12754 * script-c.h (script_data_segment_align): Declare.
12755 (script_data_segment_relro_end): Declare.
12756 * script-sections.h (class Script_sections): Declare
12757 data_segment_align and data_segment_relro_end. Add fields
12758 segment_align_index_ and saw_relro_end_.
12759 * script-sections.cc (class Sections_element): Add set_is_relro
12760 virtual function. Add new bool* parameter to place_orphan_here.
12761 Add get_output_section virtual function.
12762 (class Output_section_definition): Add set_is_relro. Add new
12763 bool* parameter to place_orphan_here. Add get_output_section.
12764 Add is_relro_ field.
12765 (Output_section_definition::Output_section_definition): Initialize
12766 evaluated_address_, evaluated_load_address, evaluated_addralign_,
12767 and is_relro_ fields.
12768 (Output_section_definition::place_orphan_here): Add is_relro
12769 parameter.
12770 (Output_section_definition::set_section_addresses): Set relro for
12771 output section.
12772 (Output_section_definition::alternate_constraint): Likewise.
12773 (class Orphan_output_section): Add new bool* parameter to
12774 place_orphan_here. Add get_output_section.
12775 (Orphan_output_section::place_orphan_here): Add is_relro
12776 parameter.
12777 (Script_sections::Script_sections): Initialize
12778 data_segment_align_index_ and saw_relro_end_.
12779 (Script_sections::data_segment_align): New function.
12780 (Script_sections::data_segment_relro_end): New function.
12781 (Script_sections::place_orphan): Set or clear is_relro.
12782 (Script_sections::set_section_addresses): Force alignment of first
12783 TLS section.
12784 * yyscript.y (exp): Call script_data_segment_align and
12785 script_data_segment_relro_end.
12786 * testsuite/relro_script_test.t: New file.
12787 * testsuite/relro_test.cc (using_script): Declare.
12788 (t1, t2): Test using_script.
12789 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12790 (relro_script_test_SOURCES): Define.
12791 (relro_script_test_DEPENDENCIES): Define.
12792 (relro_script_test_LDFLAGS): Define.
12793 (relro_script_test_LDADD): Define.
12794 (relro_script_test.so): New target.
12795 * testsuite/Makefile.in: Rebuild.
12796
12797 2008-08-06 Cary Coutant <ccoutant@google.com>
12798
12799 * archive.cc (Archive::total_archives, Archive::total_members)
12800 (Archive::total_members_loaded): New variables.
12801 (Archive::setup): Add parameter. Add option to preread
12802 archive symbols.
12803 (Archive::read_armap): Add counter.
12804 (Archive::get_file_and_offset): New function.
12805 (Archive::get_elf_object_for_member): New function.
12806 (Archive::read_all_symbols): New function.
12807 (Archive::read_symbols): New function.
12808 (Archive::add_symbols): Add counters.
12809 (Archive::include_all_members): Use armap to find members if it's
12810 already built.
12811 (Archive::include_member): Skip reading symbols if already read.
12812 Factored code into Archive::get_file_and_offset and
12813 Archive::get_elf_object_for_member. Changed call to
12814 Mapfile::report_include_archive_member.
12815 (Archive::print_stats): New function.
12816 * archive.h: Declare Object and Read_symbols_data classes.
12817 (Archive::Archive): Add initializers for new members.
12818 (Archive::setup): Add parameter.
12819 (Archive::print_stats): New function.
12820 (Archive::total_archives, Archive::total_members)
12821 (Archive::total_members_loaded): New variables.
12822 (Archive::get_file_and_offset): New function.
12823 (Archive::get_elf_object_for_member): New function.
12824 (Archive::read_all_symbols): New function.
12825 (Archive::read_symbols): New function.
12826 (Archive::Archive_member): New class.
12827 (Archive::members_): New member.
12828 (Archive::num_members_): New member.
12829 * main.cc: Include archive.h.
12830 (main): Call Archive::print_stats.
12831 * mapfile.cc (Mapfile::report_include_archive_member): Delete
12832 archive parameter; member_name is now the fully-decorated name.
12833 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12834 * options.h: (General_options): Add --preread-archive-symbols option.
12835 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12836 Archive::setup.
12837
12838 2008-08-04 Ian Lance Taylor <iant@google.com>
12839
12840 * symtab.h (Symbol::use_plt_offset): New function.
12841 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12842 * powerpc.cc (Relocate::relocate): Likewise.
12843 * sparc.cc (Relocate::relocate): Likewise.
12844 * x86_64.cc (Relocate::relocate): Likewise.
12845 * testsuite/weak_plt.sh: New test.
12846 * testsuite/weak_plt_main.cc: New test.
12847 * testsuite/weak_plt_shared.cc: New test.
12848 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12849 (check_PROGRAMS): Add weak_plt.
12850 (check_DATA): Add weak_plt_shared.so.
12851 (weak_plt_main_pic.o, weak_plt): New targets.
12852 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12853 * testsuite/Makefile.in: Rebuild.
12854
12855 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12856 gcctestdir/ld.
12857 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12858 * testsuite/Makefile.in: Rebuild.
12859
12860 2008-08-04 Alan Modra <amodra@bigpond.net.au>
12861
12862 * Makefile.am (POTFILES.in): Set LC_ALL=C.
12863 * Makefile.in: Regenerate.
12864 * po/POTFILES.in: Regenerate.
12865
12866 2008-07-29 Ian Lance Taylor <iant@google.com>
12867
12868 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12869 symbols before other symbols.
12870 * testsuite/script_test_2.cc (test_addr): Declare.
12871 (test_addr_alias): Declare.
12872 (main): Check that test_addr and test_addr_alias have the right
12873 values.
12874 * testsuite/script_test_2.t: Define test_addr_alias and
12875 test_addr.
12876
12877 2008-07-24 Ian Lance Taylor <iant@google.com>
12878
12879 PR 5990
12880 * descriptors.cc: New file.
12881 * descriptors.h: New file.
12882 * gold-threads.h (class Hold_optional_lock): New class.
12883 * fileread.cc: Include "descriptors.h".
12884 (File_read::~File_read): Release descriptor rather than closing
12885 it.
12886 (File_read::open) [file]: Call open_descriptor rather than open.
12887 Set is_descriptor_opened_.
12888 (File_read::open) [memory]: Assert that descriptor is not open.
12889 (File_read::reopen_descriptor): New function.
12890 (File_read::release): Release descriptor.
12891 (File_read::do_read): Make non-const. Reopen descriptor.
12892 (File_read::read): Make non-const.
12893 (File_read::make_view): Reopen descriptor.
12894 (File_read::do_readv): Likewise.
12895 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12896 Update declarations.
12897 * layout.cc: Include "descriptors.h".
12898 (Layout::create_build_id): Use open_descriptor rather than open.
12899 * output.cc: Include "descriptors.h".
12900 (Output_file::open): Use open_descriptor rather than open.
12901 * archive.cc (Archive::const_iterator): Change Archive to be
12902 non-const.
12903 (Archive::begin, Archive::end): Make non-const.
12904 (Archive::count_members): Likewise.
12905 * archive.h (class Archive): Update declarations.
12906 * object.h (Object::read): Make non-const.
12907 * Makefile.am (CCFILES): Add descriptors.cc.
12908 (HFILES): Add descriptors.h.
12909 * Makefile.in: Rebuild.
12910
12911 PR 6716
12912 * gold.h: Always include <clocale>. Add Solaris workarounds
12913 following code in binutils/sysdep.h.
12914
12915 PR 6048
12916 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12917 this->eh_frame_hdr_ is NULL before using it.
12918
12919 * dynobj.cc (Versions::Versions): Update comment.
12920
12921 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12922 the base version name.
12923
12924 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12925 array size plus one.
12926 (Stringpool_template::set_string_offsets): Subtract one from key
12927 before using it as an array index.
12928 (Stringpool_template::get_offset_with_length): Likewise.
12929 (Stringpool_template::write_to_buffer): Likewise.
12930 * stringpool.h (Stringpool_template::get_offset_from_key):
12931 Likewise.
12932
12933 2008-07-23 Ian Lance Taylor <iant@google.com>
12934
12935 PR 6658
12936 * object.h (Merged_symbol_value::value): Do our best to handle a
12937 negative addend.
12938
12939 PR 6647
12940 * script.cc (Version_script_info::get_versions): Don't add empty
12941 version tag to return value.
12942 (Version_script_info::get_symbol_version_helper): Change return
12943 type to bool. Add pversion parameter. Change all callers.
12944 (script_register_vers_node): Don't require a non-NULL tag.
12945 * script.h (class Version_script_info): Update declarations.
12946 (Version_script_info::get_symbol_version): Change return type to
12947 bool. Add version parameter. Change all callers.
12948 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12949 handling. Handle an empty version from a version script.
12950 (Symbol_table::define_special_symbol): Likewise.
12951 * testsuite/ver_test_10.script: New file.
12952 * testsuite/ver_test_10.sh: New file.
12953 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12954 (check_DATA): Add ver_test_10.syms.
12955 (ver_test_10.syms, ver_test_10.so): New target.
12956 * testsuite/Makefile.in: Rebuild.
12957
12958 2008-07-23 Simon Baldwin <simonb@google.com>
12959
12960 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12961 to zero for undefined symbols from dynamic libraries.
12962
12963 2008-07-23 Ian Lance Taylor <iant@google.com>
12964
12965 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12966 Change all callers.
12967 * symtab.h (class Symbol_table): Update declaration.
12968 * testsuite/ver_test_9.cc: New file.
12969 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12970 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12971 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12972 (ver_test_9.so, ver_test_9.o): New targets.
12973 * testsuite/Makefile.in: Rebuild.
12974
12975 2008-07-22 Ian Lance Taylor <iant@google.com>
12976
12977 * options.h (class General_options): Define --check-sections.
12978 * layout.cc (Layout::set_segment_offsets): Handle
12979 --check-sections.
12980
12981 * options.h (class General_options): Define -n/--nmagic and
12982 -N/--omagic.
12983 * options.cc (General_options::finalize): For -n/--nmagic or
12984 -N/--omagic, set -static.
12985 * layout.cc (Layout::attach_allocated_section_to_segment): If
12986 -N/--omagic, don't put read-only and read-write sections in
12987 different segments.
12988 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12989 finding a read-only segment.
12990 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12991 don't set the minimum segment alignment to the common page size,
12992 and don't set the file offset to the address modulo the page size.
12993 * script-sections.cc (Script_sections::create_segments): If
12994 -n/--omagic, don't put read-only and read-write sections in
12995 different segments.
12996
12997 * cref.cc: New file.
12998 * cref.h: New file.
12999 * options.h (class General_options): Add --print-symbol-counts.
13000 * main.cc (main): Issue defined symbol report if requested.
13001 * archive.cc (Archive::interpret_header): Make into a const member
13002 function.
13003 (Archive::add_symbols): Call Input_objects::archive_start and
13004 archive_stop.
13005 (Archive::const_iterator): Define new class.
13006 (Archive::begin, Archive::end): New functions.
13007 (Archive::include_all_members): Rewrite to use iterator.
13008 (Archive::count_members): New function.
13009 * archive.h (class Archive): Update declarations.
13010 (Archive::filename): New function.
13011 * object.cc: Include "cref.h".
13012 (Sized_relobj::Sized_relobj): Initialize defined_count_.
13013 (Sized_relobj::do_get_global_symbol_counts): New function.
13014 (Input_objects::add_object): Add object to cross-referencer.
13015 (Input_objects::archive_start): New function.
13016 (Input_objects::archive_stop): New function.
13017 (Input_objects::print_symbol_counts): New function.
13018 * object.h: Declare Cref and Archive.
13019 (Object::get_global_symbol_counts): New function.
13020 (Object::do_get_global_symbol_counts): New pure virtual function.
13021 (class Sized_relobj): Add defined_count_ field. Update
13022 declarations.
13023 (class Input_objects): Add cref_ field. Update constructor.
13024 Update declarations.
13025 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13026 defined_count_.
13027 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13028 symbol counts.
13029 (Sized_dynobj::do_get_global_symbol_counts): New function.
13030 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13031 defined_count_. Update declarations. Define Symbols typedef.
13032 * symtab.cc (Symbol_table::add_from_relobj): Add defined
13033 parameter. Change all callers.
13034 (Symbol_table::add_from_dynobj): Add sympointers and defined
13035 parameters. Change all callers.
13036 * symtab.h (class Symbol_table): Update declarations.
13037 * Makefile.am (CCFILES): Add cref.cc.
13038 (HFILES): Add cref.h.
13039 * Makefile.in: Rebuild.
13040
13041 2008-07-22 Simon Baldwin <simonb@google.com>
13042
13043 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13044 to zero when writing undefined symbols.
13045
13046 2008-07-22 Ian Lance Taylor <iant@google.com>
13047
13048 * output.cc (Output_section::add_input_section): Don't try to
13049 merge empty merge sections.
13050
13051 2008-07-21 Craig Silverstein <csilvers@google.com>
13052
13053 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13054 Include symbol version in error message.
13055
13056 2008-07-20 Chris Demetriou <cgd@google.com>
13057
13058 * configure.ac (gold_cv_c_random_seed): New configured variable.
13059 (RANDOM_SEED_CFLAGS): New substituted variable.
13060 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13061 * configure: Rebuild.
13062 * Makefile.in: Likewise.
13063 * testsuite/Makefile.in: Likewise.
13064
13065 2008-07-18 Ian Lance Taylor <iant@google.com>
13066
13067 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13068 where we see NAME/NULL and NAME/VERSION as separate symbols.
13069 * testsuite/ver_test_main.cc (main): Call t4.
13070 (t4, t4_2a): Define.
13071 * testsuite/ver_test_2.cc (t4_2): Define.
13072 * testsuite/ver_test_2.script: Put t4_2a in VER2.
13073 * testsuite/ver_test_4.cc (t4_2a): Define.
13074 * testsuite/ver_test_4.script: Put t4_2a in VER2.
13075 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13076
13077 2008-07-17 Ian Lance Taylor <iant@google.com>
13078
13079 * dynobj.cc (Versions::add_def): If we give an error about a
13080 missing version, go ahead and create the version anyhow.
13081
13082 2008-07-10 Ian Lance Taylor <iant@google.com>
13083
13084 Handle output sections with more than 0x7fffffff bytes.
13085 * object.h (class Relobj): Change map_to_output_ to
13086 output_sections_, and just keep a section pointer. Change all
13087 uses. Move comdat group support to Sized_relobj.
13088 (Relobj::is_section_specially_mapped): Remove.
13089 (Relobj::output_section): Remove poff parameter. Change all
13090 callers.
13091 (Relobj::output_section_offset): New function.
13092 (Relobj::set_section_offset): Rewrite.
13093 (Relobj::map_to_output): Remove.
13094 (Relobj::output_sections): New function.
13095 (Relobj::do_output_section_offset): New pure virtual function.
13096 (Relobj::do_set_section_offset): Likewise.
13097 (class Sized_relobj): Add section_offsets_ field. Add comdat
13098 group support from Relobj. Update declarations.
13099 (Sized_relobj::get_output_section_offset): New function.
13100 (Sized_relobj::do_output_section_offset): New function.
13101 (Sized_relobj::do_set_section_offset): New function.
13102 * object.cc (Relobj::output_section_address): Remove.
13103 (Sized_relobj::Sized_relobj): Initialize new fields.
13104 (Sized_relobj::include_section_group): Cast find_kept_object to
13105 Sized_relobj.
13106 (Sized_relobj::include_linkonce_section): Likewise.
13107 (Sized_relobj::do_layout): Use separate arrays for output section
13108 and output offset.
13109 (Sized_relobj::do_count_local_symbols): Change map_to_output to
13110 output_sections.
13111 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13112 output_sections and section_offsets.
13113 (Sized_relobj::write_local_symbols): Likewise.
13114 (map_to_kept_section): Compute output address directly.
13115 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13116 output_sections and section_offsets.
13117 (Sized_relobj::write_sections): Likewise.
13118 (Sized_relobj::relocate_sections): Likewise.
13119 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13120 * output.h (class Output_reloc): Update declarations. Change
13121 u2_.relobj to Sized_relobj*.
13122 (class Output_data_reloc): Change add functions to use
13123 Sized_relobj*.
13124 * output.cc (Output_reloc::Output_reloc): Change relobj to
13125 Sized_relobj*.
13126 (Output_reloc::local_section_offset): Change return type to
13127 Elf_Addr. Use get_output_section_offset.
13128 (Output_reloc::get_address): Likewise.
13129 (Output_section::is_input_address_mapped): Don't call
13130 is_section_specially_mapped.
13131 (Output_section::output_offset): Likewise.
13132 (Output_section::output_address): Likewise.
13133 (Output_section::starting_output_address): Likewise.
13134 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13135 parameter to Sized_relobj*.
13136 (Copy_relocs::need_copy_reloc): Likewise.
13137 (Copy_relocs::save): Likewise.
13138 * copy-relocs.h (class Copy_relocs): Update declarations.
13139 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13140 Sized_relobj*. Change relobj_ field to Sized_relobj*.
13141 * target-reloc.h (relocate_for_relocatable): Change
13142 offset_in_output_section type to Elf_Addr. Change code that uses
13143 it as well.
13144 * layout.cc (Layout::layout): Always set *off.
13145 * mapfile.cc (Mapfile::print_input_section): Use
13146 output_section_offset.
13147 * i386.cc (Target_i386::copy_reloc): Change object parameter to
13148 Sized_relobj*.
13149 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13150 * sparc.cc (Target_sparc::copy_reloc): Likewise.
13151 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13152
13153 2008-07-03 Ian Lance Taylor <iant@google.com>
13154
13155 * layout.cc (Layout::include_section): Do not discard unrecognized
13156 SHT_STRTAB sections.
13157
13158 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
13159
13160 * script.cc (Lex::can_continue_name): Make '?' allowable in
13161 version-script names.
13162 * testsuite/version_script.map: Change glob pattern to use '?'
13163
13164 2008-06-30 Manish Singh <yosh@gimp.org>
13165
13166 PR 6585
13167 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13168 Correct typo.
13169
13170 2008-06-30 Ian Lance Taylor <iant@google.com>
13171
13172 PR 6660
13173 PR 6682
13174 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13175 versions]: Don't try to read the value in the contents, since we
13176 don't use it. Use the template endianness when writing.
13177
13178 2008-06-25 Cary Coutant <ccoutant@google.com>
13179
13180 * fileread.cc (File_read::make_view): Assert on zero-length view.
13181 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13182 symbol table when there are no symbols to read.
13183
13184 2008-06-23 Craig Silverstein <csilvers@google.com>
13185
13186 * version.cc (version_string): Bump to 1.7
13187
13188 2008-06-18 Craig Silverstein <csilvers@google.com>
13189
13190 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13191 constant 0xFFFF to type Valtype.
13192 (Powerpc_relocate_functions::rel16_ha): Likewise.
13193
13194 2008-06-17 Ian Lance Taylor <iant@google.com>
13195
13196 * output.h (Output_section::Input_section): Initialize p2align_ to
13197 zero for Output_section_data constructors.
13198 (Output_section::Input_section::addralign): If not an input
13199 section, return the alignment of the Output_section_data.
13200 * testsuite/copy_test.cc: New file.
13201 * testsuite/copy_test_1.cc: New file.
13202 * testsuite/copy_test_2.cc: New file.
13203 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13204 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13205 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13206 (copy_test_1_pic.o, copy_test_1.so): New targets.
13207 (copy_test_2_pic.o, copy_test_2.so): New targets.
13208 * testsuite/Makefile.in: Rebuild.
13209
13210 * script-sections.cc (Script_sections::place_orphan): Initialize
13211 local variable exact.
13212
13213 2008-06-13 David Edelsohn <edelsohn@gnu.org>
13214
13215 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13216
13217 2008-06-12 David Edelsohn <edelsohn@gnu.org>
13218 David S. Miller <davem@davemloft.net>
13219
13220 * powerpc.cc: New file.
13221 * Makefile.am (TARGETSOURCES): Add powerpc.cc
13222 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13223 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13224 * Makefile.in: Rebuild.
13225
13226 2008-06-09 Ian Lance Taylor <iant@google.com>
13227
13228 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13229 <exception>.
13230 (throwing, orig_terminate): New static variables.
13231 (terminate_handler): New static function.
13232 (t2): Set terminate handler.
13233
13234 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
13235
13236 PR 6584
13237 * binary.cc (Binary_to_elf::sized_convert): Fix .data
13238 alignment.
13239
13240 2008-05-30 Cary Coutant <ccoutant@google.com>
13241
13242 * archive.cc (Archive::include_all_members) Correct to step
13243 over symbol table and extended name table in thin archives.
13244
13245 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
13246
13247 PR 6407
13248 * target-reloc.h (relocate_for_relocatable): Fix new_offset
13249 calculation.
13250
13251 2008-05-28 Caleb Howe <cshowe@google.com>
13252
13253 * reduced_debug_output.cc: New file.
13254 * reduced_debug_output.h: New file.
13255 * options.h (class General_options): Add --strip-debug-non-line.
13256 * options.cc (General_options::finalize): Add strip_debug_non_line
13257 to the strip heirarchy.
13258 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13259 fields.
13260 * layout.cc: Include "reduced_debug_output.h".
13261 (Layout::Layout): Initialize new fields.
13262 (line_only_debug_sections): New static array.
13263 (is_lines_only_debug_sections): New static inline function.
13264 (Layout::include_section): Handle --strip-debug-non-line.
13265 (Layout::make_output_section): If --strip-debug-non-line, build
13266 new output sections for .debug_abbrev and .debug_info.
13267 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13268 gold. Warn about possible overflow.
13269 (read_signed_LEB_128): Likewise.
13270 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13271 (read_signed_LEB_128): Declare.
13272 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13273 (HFILES): Add reduced_debug_output.h.
13274 * Makefile.in: Rebuild.
13275
13276 2008-05-21 Ian Lance Taylor <iant@google.com>
13277
13278 * mapfile.cc: New file.
13279 * mapfile.h: New file.
13280 * options.h (class General_options): Add -M/--print-map and -Map.
13281 * options.cc (General_options::finalize): Make -M equivalent to
13282 -Map -.
13283 * main.cc: Include <cstdio> and "mapfile.h".
13284 (main): Open mapfile if requested.
13285 * gold.cc (class Middle_runner): Add mapfile_ field. Update
13286 constructor. Change caller.
13287 (queue_initial_tasks): Add mapfile parameter. Change caller.
13288 (queue_middle_tasks): Likewise.
13289 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13290 declarations.
13291 * archive.cc: Include "mapfile.h".
13292 (Archive::add_symbols): Add mapfile parameter. Change all
13293 callers. Pass mapfile, symbol, and reason to include_member.
13294 (Archive::include_all_members): Add mapfile parameter. Change all
13295 callers.
13296 (Archive::include_member): Add mapfile, sym, and why parameters.
13297 Change all callers. Report inclusion to map file.
13298 * archive.h: Include "fileread.h".
13299 (class Archive): Update declarations.
13300 (Archive::file): New const method.
13301 (class Add_archive_symbols): Add mapfile_ field. Update
13302 constructor. Change all callers.
13303 * readsyms.h (class Read_symbols): Likewise.
13304 (class Finish_group): Likewise.
13305 (class Read_script): Likewise.
13306 * common.cc: Include "mapfile.h".
13307 (Symbol_table::allocate_commons): Add mapfile parameter. Change
13308 all callers.
13309 (Symbol_table::do_allocate_commons): Likewise.
13310 (Symbol_table::do_allocate_commons_list): Likewise. Report common
13311 symbol allocation to mapfile.
13312 * common.h (class Allocate_commons_task): Add mapfile_ field.
13313 Update constructor. Change all callers.
13314 * symtab.h (class Symbol_table): Update declarations.
13315 * layout.cc: Include "mapfile.h".
13316 (Layout_task_runner::run): Print information to mapfile.
13317 (Layout::create_gold_note): Change Output_data_fixed_space to
13318 Output_data_zero_fill.
13319 (Layout::create_build_id): Likewise.
13320 (Layout::print_to_mapfile): New function.
13321 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
13322 constructor. Change caller.
13323 (class Layout): Declare print_to_mapfile.
13324 * output.cc (Output_section::Input_section::print_to_mapfile): New
13325 function.
13326 (Output_section::add_input_section): If producing a map, always
13327 add to input_sections_ list.
13328 (Output_section::do_print_to_mapfile): New function.
13329 (Output_segment::print_sections_to_mapfile): New function.
13330 (Output_segment::print_section_list_to_mapfile): New function.
13331 * output.h: Include "mapfile.h".
13332 (Output_data::print_to_mapfile): New function.
13333 (Output_data::do_print_to_mapfile): New virtual function.
13334 (Output_segment_headers::do_print_to_mapfile): New function.
13335 (Output_file_header::do_print_to_mapfile): New function.
13336 (Output_data_const::do_print_to_mapfile): New function.
13337 (class Output_data_const_buffer): Add map_name_ field. Update
13338 constructor. Change all callers. Add do_print_to_mapfile
13339 function.
13340 (class Output_data_fixed_space): Likewise.
13341 (class Output_data_space): Likewise.
13342 (class Output_data_zero_fill): New class.
13343 (Output_data_strtab::do_print_to_mapfile): New function.
13344 (Output_data_reloc_base::do_print_to_mapfile): New function.
13345 (Output_relocatable_relocs::do_print_to_mapfile): New function.
13346 (Output_data_group::do_print_to_mapfile): New function.
13347 (Output_data_got::do_print_to_mapfile): New function.
13348 (Output_data_dynamic::do_print_to_mapfile): New function.
13349 (Output_symtab_xindex::do_print_to_mapfile): New function.
13350 (class Output_section): Declare do_print_to_mapflie. Declare
13351 print_to_mapfile in Input_section.
13352 (class Output_segment): Declare new functions.
13353 * object.h (Sized_relobj::symbol_count): New function.
13354 * script-sections.cc
13355 (Output_section_element_dot_assignment::set_section_addresses):
13356 Change Output_data_fixed_space to Output_data_zero_fill.
13357 (Output_data_expression::do_print_to_mapfile): New function.
13358 * script.cc (read_input_script): Add mapfile parameter. Change
13359 all callers.
13360 * script.h (read_input_script): Update declaration.
13361 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13362 (Eh_frame::do_print_to_mapfile): New function.
13363 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13364 (Output_merge_string::do_print_to_mapfile): New function.
13365 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13366 function.
13367 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13368 function.
13369 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13370 function.
13371 * Makefile.am (CCFILES): Add mapfile.cc.
13372 (HFILES): Add mapfile.h.
13373 * Makefile.in: Rebuild.
13374
13375 2008-05-19 Ian Lance Taylor <iant@google.com>
13376
13377 * options.h (class General_options): Add -z relro.
13378 * layout.cc (Layout::Layout): Initialize relro_segment_.
13379 (Layout::add_output_section_data): Return the output section.
13380 (Layout::make_output_section): Rcognize relro sections and mark
13381 them appropriately.
13382 (Layout::attach_allocated_section_to_segment): Put relro sections
13383 in a PT_GNU_RELRO segment.
13384 (Layout::create_initial_dynamic_sections): Mark the .dynamic
13385 section as relro.
13386 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13387 PT_TLS segments.
13388 (Layout::linkonce_mapping): Map d.rel.ro.local to
13389 .data.rel.ro.local.
13390 (Layout::output_section_name): Us .data.rel.ro.local for any
13391 section which begins with that.
13392 * layout.h (class Layout): Update add_output_section_data
13393 declaration. Add relro_segment_ field.
13394 * output.cc (Output_section::Output_section): Initialize is_relro_
13395 and is_relro_local_ fields.
13396 (Output_segment::add_output_section): Group relro sections.
13397 (Output_segment::is_first_section_relro): New function.
13398 (Output_segment::maximum_alignment): If there is a relro section,
13399 align the segment to the common page size.
13400 (Output_segment::set_section_addresses): Track whether we are
13401 looking at relro sections. If the last section is a relro
13402 section, align to the common page size.
13403 (Output_segment::set_section_list_addresses): Add in_relro
13404 parameter. Change all callers. Align to the page size when
13405 moving from relro to non-relro section.
13406 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13407 segment.
13408 * output.h (class Output_section): Add is_relro_ and
13409 is_relro_local_ fields.
13410 (Output_section::is_relro): New function.
13411 (Output_section::set_is_relro): New function.
13412 (Output_section::is_relro_local): New function.
13413 (Output_section::set_is_relro_local): New function.
13414 (class Output_segment): Update declarations.
13415 * i386.cc (Target_i386::got_section): Mark .got section as relro.
13416 * sparc.cc (Target_sparc::got_section): Likewise.
13417 * x86_64.cc (Target_x86_64::got_section): Likewise.
13418 * testsuite/relro_test_main.cc: New file.
13419 * testsuite/relro_test.cc: New file.
13420 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13421 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13422 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13423 (relro_test.so, relro_test_pic.o): New targets.
13424 * testsuite/Makefile.in: Rebuild.
13425
13426 2008-05-16 Ian Lance Taylor <iant@google.com>
13427
13428 * output.cc (Output_segment::add_output_section): Remove front
13429 parameter.
13430 * output.h (class Output_segment): Remove
13431 add_initial_output_section and overloaded add_output_section.
13432 Update declaration of remaining add_output_section.
13433 * layout.cc (Layout::create_interp): Call add_output_section
13434 rather than add_initial_output_section.
13435 (Layout::finish_dynamic_section): Likewise.
13436
13437 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13438 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
13439 know the dynamic type.
13440 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13441 field. Initialize it in constructor.
13442 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13443 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13444 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13445 reloc.
13446
13447 * output.cc (Output_reloc::get_address): Change return type to
13448 Elf_Addr.
13449 * output.h (class Output_reloc): Update get_address declaration.
13450 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13451 for section addresses.
13452
13453 2008-05-09 Ian Lance Taylor <iant@google.com>
13454
13455 PR 6493
13456 * gold.cc (gold_nomem): Use return value of write.
13457
13458 2008-05-08 Ian Lance Taylor <iant@google.com>
13459
13460 * symtab.c (Symbol::init_base_output_data): Add version
13461 parameter. Change all callers.
13462 (Symbol::init_base_output_segment): Likewise.
13463 (Symbol::init_base_constant): Likewise.
13464 (Symbol::init_base_undefined): Likewise.
13465 (Sized_symbol::init_output_data): Likewise.
13466 (Sized_symbol::init_output_segment): Likewise.
13467 (Sized_symbol::init_constant): Likewise.
13468 (Sized_symbol::init_undefined): Likewise.
13469 (Symbol_table::do_define_in_output_data): If the new symbol has a
13470 version, mark it as the default.
13471 (Symbol_table::do_define_in_output_segment): Likewise.
13472 (Symbol_table::do_define_as_constant): Likewise.
13473 * symtab.h (class Symbol): Update declarations.
13474 (class Sized_symbol): Likewise.
13475 * resolve.cc (Symbol::override_version): New function.
13476 (Symbol::override_base): Call override_version.
13477 (Symbol::override_base_with_special): Likewise.
13478 * testsuite/ver_script_8.script: New file.
13479 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13480 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13481 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13482 (ver_test_8_1.so, ver_test_8_2.so): New targets.
13483
13484 2008-05-06 Ian Lance Taylor <iant@google.com>
13485
13486 PR 6049
13487 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13488 functions.
13489 (class General_options): Remove existing --undefined, and add
13490 --no-undefined instead. Add new --undefined as synonym for -u.
13491 * archive.cc (Archive::add_symbols): Check whether symbol was
13492 named with -u.
13493 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13494 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13495 all uses. Add IS_UNDEFINED. Update declarations to split
13496 different versions of init_base. Declare init_base_undefined.
13497 (Symbol::is_defined): Handle IS_UNDEFINED.
13498 (Symbol::is_undefined): Likewise.
13499 (Symbol::is_weak_undefined): Call is_undefined.
13500 (Symbol::is_absolute): Handle IS_CONSTANT.
13501 (class Sized_symbol): Update declarations to split different
13502 versions of init. Declare init_undefined.
13503 (class Symbol_table): Declare new functions.
13504 * symtab.cc (Symbol::init_base_object): Rename from init_base.
13505 Change all callers.
13506 (Symbol::init_base_output_data): Likewise.
13507 (Symbol::init_base_output_segment): Likewise.
13508 (Symbol::init_base_constant): Likewise.
13509 (Symbol::init_base_undefined): New function.
13510 (Sized_symbol::init_object): Rename from init. Change all
13511 callers.
13512 (Sized_symbol::init_output_data): Likewise.
13513 (Sized_symbol::init_output_segment): Likewise.
13514 (Sized_symbol::init_constant): Likewise.
13515 (Sized_symbol::init_undefined): New function.
13516 (Symbol_table::add_undefined_symbols_from_command_line): New
13517 function.
13518 (Symbol_table::do_add_undefined_symbols_from_command_line): New
13519 function.
13520 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13521 (Symbol::output_section): Likewise.
13522 (Symbol::set_output_section): Likewise.
13523 (Symbol_table::sized_finalize_symbol): Likewise.
13524 (Symbol_table::sized_write_globals): Likewise.
13525 * resolve.cc (Symbol_table::should_override): Likewise.
13526 (Symbol::override_base_with_special): Likewise.
13527
13528 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13529 symbol, change it to have default visibility.
13530 * testsuite/protected_1.cc: New file.
13531 * testsuite/protected_2.cc: New file.
13532 * testsuite/protected_3.cc: New file.
13533 * testsuite/protected_main_1.cc: New file.
13534 * testsuite/protected_main_2.cc: New file.
13535 * testsuite/protected_main_3.cc: New file.
13536 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13537 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13538 (protected_1_LDFLAGS, protected_1_LDADD): Define.
13539 (protected_1.so): New target.
13540 (protected_1_pic.o, protected_2_pic.o): New targets.
13541 (protected_3_pic.o): New target.
13542 (check_PROGRAMS): Add protected_2.
13543 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13544 (protected_2_LDFLAGS, protected_2_LDADD): Define.
13545 * testsuite/Makefile.in: Rebuild.
13546
13547 * options.h (DEFINE_var): Add set_user_set_##varname__.
13548 (DEFINE_bool_alias): New macro.
13549 (class General_options): Define -Bstatic using DEFINE_bool_alias
13550 rather than DEFINE_special. Add --undefined as an alias for -z
13551 defs.
13552 * options.cc (General_options::parse_Bstatic): Remove.
13553
13554 * options.h (class General_options): Add --fatal-warnings.
13555 * main.cc (main): Implement --fatal-warnings.
13556 * errors.h (Errors::warning_count): New function.
13557
13558 * options.h (class General_options): Add -Bsymbolic-functions.
13559 * symtab.h (Symbol::is_preemptible): Check for
13560 -Bsymbolic-functions.
13561
13562 2008-05-05 Ian Lance Taylor <iant@google.com>
13563
13564 * options.h (DEFINE_bool): For DASH_Z, create the negative option
13565 as noVARNAME rather than no-VARNAME.
13566 (class General_options): Add option -z combreloc.
13567 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13568 get_address.
13569 (Output_reloc::sort_before) [SHT_REL]: New function.
13570 (Output_reloc::sort_before) [SHT_RELA]: New function.
13571 (class Output_data_reloc_base): Add sort_relocs_ field. Define
13572 Sort_relocs_comparison.
13573 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13574 parameter. Change all callers.
13575 (Output_data_reloc::Output_data_reloc) [both versions]: Add
13576 sort_relocs parameter. Change all callers.
13577 * output.cc (Output_reloc::get_address): New function, broken out
13578 of write_rel.
13579 (Output_reloc::write_rel): Call it.
13580 (Output_reloc::compare): New function.
13581 (Output_data_reloc_base::do_write): Optionally sort relocs.
13582
13583 * configure.ac: If targ_extra_obj is set, link it in.
13584 * configure.tgt: Initialize all variables.
13585 (x86_64*): Set targ_extra_obj and targ_extra_size.
13586 * configure: Rebuild.
13587
13588 * object.cc (Sized_relobj::include_section_group): Adjust section
13589 indexes read from group data. Build vector to pass to
13590 layout_group.
13591 * layout.cc (Layout::layout_group): Add flags and shndxes
13592 parameters. Remove contents parameter. Change caller. Update
13593 explicit instantiations.
13594 * layout.h (class Layout): Update layout_group declaration.
13595 * output.cc (Output_data_group::Output_data_group): Add flags and
13596 input_shndxes parameters. Remove contents parameter. Change
13597 caller.
13598 (Output_data_group::do_write): Change input_sections_ to
13599 input_shndxes_.
13600 * output.h (class Output_data_group): Update constructor
13601 declaration. Rename input_sections_ to input_shndxes_.
13602 * testsuite/many_sections_test.cc: Add template.
13603
13604 2008-04-30 Cary Coutant <ccoutant@google.com>
13605
13606 * target-reloc.h (relocate_section): Fix dead-pointer bug.
13607
13608 * layout.cc (Layout::include_section): Refactored check for debug
13609 info section.
13610 (Layout::add_comdat): Add new parameters. Change type
13611 of signature parameter. Add object and shndx to signatures table.
13612 (Layout::find_kept_object): New function.
13613 * layout.h: Include <cstring>.
13614 (Layout::is_debug_info_section): New function.
13615 (Layout::add_comdat): Add new parameters.
13616 (Layout::find_kept_object): New function.
13617 (Layout::Kept_section): New struct.
13618 (Layout::Signatures): Change type of map range.
13619 * object.cc (Relobj::output_section_address): New function.
13620 (Sized_relobj::include_section_group): Add new parameters. Change
13621 calls to Layout::add_comdat. Change to build table of kept comdat
13622 groups and table mapping discarded sections to kept sections.
13623 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
13624 (Sized_relobj::do_layout): Change calls to include_section_group and
13625 include_linkonce_section.
13626 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13627 value to zero when section is discarded.
13628 (Sized_relobj::map_to_kept_section): New function.
13629 * object.h (Relobj::output_section_address): New function.
13630 (Relobj::Comdat_group): New type.
13631 (Relobj::find_comdat_group): New function.
13632 (Relobj::Comdat_group_table): New type.
13633 (Relobj::Kept_comdat_section): New type.
13634 (Relobj::Kept_comdat_section_table): New type.
13635 (Relobj::add_comdat_group): New function.
13636 (Relobj::set_kept_comdat_section): New function.
13637 (Relobj::get_kept_comdat_section): New function.
13638 (Relobj::comdat_groups_): New field.
13639 (Relobj::kept_comdat_sections_): New field.
13640 (Symbol_value::input_value): Update comment.
13641 (Sized_relobj::map_to_kept_section) New function.
13642 (Sized_relobj::include_linkonce_section): Add new parameter.
13643 * target-reloc.h (Comdat_behavior): New type.
13644 (get_comdat_behavior): New function.
13645 (relocate_section): Add code to map a discarded section to the
13646 corresponding kept section when applying a relocation.
13647
13648 2008-04-30 Craig Silverstein <csilvers@google.com>
13649
13650 * dwarf_reader.cc (next_generation_count): New static var.
13651 (Addr2line_cache_entry): New struct.
13652 (addr2line_cache): New static var.
13653 (Dwarf_line_info::one_addr2line): Added caching.
13654 (Dwarf_line_info::clear_addr2line_cache): New function.
13655 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13656 cache-size parameter.
13657 (Dwarf_line_info::one_addr2line_cache): New function.
13658 * symtab.cc (Symbol_table::detect_odr_violations): Pass
13659 new cache-size argument to one_addr2line(), and clear cache.
13660
13661 2008-04-28 Cary Coutant <ccoutant@google.com>
13662
13663 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13664 R_386_PC8 relocations.
13665
13666 2008-04-23 Ian Lance Taylor <iant@google.com>
13667
13668 * object.cc (Sized_relobj::include_section_group): Check for
13669 invalid section group.
13670
13671 * object.cc (make_elf_object): Correct test for 64-bit ELF file
13672 header size.
13673
13674 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13675 than read for file header.
13676 * archive.cc (Archive::include_member): Likewise.
13677
13678 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
13679
13680 * aclocal.m4: Regenerate.
13681 * configure: Regenerate.
13682
13683 2008-04-19 Ian Lance Taylor <iant@google.com>
13684
13685 * version.cc (version_string): Bump to 1.6.
13686
13687 * testsuite/Makefile.am (many_sections_r_test): New target.
13688 (many_sections_r_test_SOURCES): Remove.
13689 (many_sections_r_test_DEPENDENCIES): Remove.
13690 (many_sections_r_test_LDFLAGS): Remove.
13691 (many_sections_r_test_LDADD): Remove.
13692
13693 * object.cc (Sized_relobj::do_add_symbols): Always pass
13694 local_symbol_count_ to add_from_relobj.
13695
13696 * testsuite/Makefile.am (many_sections_check.h): Only check one in
13697 every thousand variables.
13698 * testsuite/Makefile.in: Rebuild.
13699
13700 * object.cc (Xindex::initialize_symtab_xindex): New function.
13701 (Xindex::read_symtab_xindex): New function.
13702 (Xindex::sym_xindex_to_shndx): New function.
13703 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13704 available.
13705 (Sized_relobj::do_initialize_xindex): New function.
13706 (Sized_relobj::do_read_symbols): Adjust section links.
13707 (Sized_relobj::symbol_section_and_value): Add is_ordinary
13708 parameter. Change all callers.
13709 (Sized_relobj::include_section_group): Adjust section links and
13710 symbol section indexes.
13711 (Sized_relobj::do_layout): Adjust section links.
13712 (Sized_relobj::do_count_local_symbols): Adjust section links and
13713 symbol section indexes.
13714 (Sized_relobj::do_finalize_local_symbols): Distinguish between
13715 ordinary and special symbols.
13716 (Sized_relobj::write_local_symbols): Add symtab_xindex and
13717 dynsym_xindex parameters. Change all callers. Adjust section
13718 links. Use SHN_XINDEX when needed.
13719 (Sized_relobj::get_symbol_location_info): Adjust section links.
13720 Don't get fooled by special symbols.
13721 * object.h (class Xindex): Define.
13722 (class Object): Add xindex_ parameter. Declare virtual functoin
13723 do_initialize_xindex.
13724 (Object::adjust_sym_shndx): New function.
13725 (Object::set_xindex): New protected function.
13726 (class Symbol_value): Add is_ordinary_shndx_ field.
13727 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13728 (Symbol_value::value): Assert ordinary section.
13729 (Symbol_value::initialize_input_to_output_map): Likewise.
13730 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13731 Change all callers.
13732 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
13733 all callers.
13734 (class Sized_relobj): Update declarations.
13735 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13736 parameter. Change all callers.
13737 (Sized_relobj::adjust_shndx): New function.
13738 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13739 field.
13740 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13741 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
13742 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
13743 (Sized_dynobj::read_dynsym_section): Adjust section links.
13744 (Sized_dynobj::read_dynamic): Likewise.
13745 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
13746 section links.
13747 (Sized_dynobj::do_initialize_xindex): New function.
13748 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
13749 do_initialize_xindex.
13750 (Sized_dynobj::adjust_shndx): New function.
13751 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13752 dynsym_xindex_ fields.
13753 (Layout::finalize): Add a call to set_section_indexes before
13754 creating the symtab sections.
13755 (Layout::set_section_indexes): Don't do anything if the section
13756 already has a section index.
13757 (Layout::create_symtab_sections): Add shnum parameter. Change
13758 caller. Create .symtab_shndx section if needed.
13759 (Layout::create_shdrs): Add shstrtab_section parameter. Change
13760 caller.
13761 (Layout::allocated_output_section_count): New function.
13762 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13763 needed.
13764 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13765 fields. Update declarations.
13766 (Layout::symtab_xindex): New function.
13767 (Layout::dynsym_xindex): New function.
13768 (class Write_symbols_task): Add layout_ field.
13769 (Write_symbols_task::Write_symbols_task): Add layout parameter.
13770 Change caller.
13771 * output.cc (Output_section_headers::Output_section_headers): Add
13772 shstrtab_section parameter. Change all callers.
13773 (Output_section_headers::do_sized_write): Store overflow values
13774 for section count and section string table section index in
13775 section header zero.
13776 (Output_file_header::do_sized_write): Check for overflow of
13777 section count and section string table section index.
13778 (Output_symtab_xindex::do_write): New function.
13779 (Output_symtab_xindex::endian_do_write): New function.
13780 * output.h (class Output_section_headers): Add shstrtab_section_.
13781 Update declarations.
13782 (class Output_symtab_xindex): Define.
13783 (Output_section::has_out_shndx): New function.
13784 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13785 field.
13786 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13787 Change all callers.
13788 (Sized_symbol::init): Likewise.
13789 (Symbol::output_section): Check for ordinary symbol.
13790 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
13791 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
13792 callers.
13793 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13794 Change all callers. Simplify handling of symbols from sections
13795 not included in the link.
13796 (Symbol_table::add_from_dynobj): Handle ordinary symbol
13797 distinction.
13798 (Weak_alias_sorter::operator()): Assert that symbols are
13799 ordinary.
13800 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13801 distinction.
13802 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13803 parameters. Change all callers.
13804 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
13805 symbol distinction. Use SHN_XINDEX when needed.
13806 (Symbol_table::write_section_symbol): Add symtab_xindex
13807 parameter. Change all callers.
13808 (Symbol_table::sized_write_section_symbol): Likewise. Use
13809 SHN_XINDEX when needed.
13810 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
13811 declarations.
13812 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
13813 (Symbol::is_defined): Check is_ordinary.
13814 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13815 (Symbol::is_absolute, Symbol::is_common): Likewise.
13816 (class Sized_symbol): Update declarations.
13817 (class Symbol_table): Update declarations.
13818 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13819 parameters. Change all callers.
13820 (Sized_symbol::override): Likewise.
13821 (Symbol_table::override): Likewise.
13822 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
13823 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
13824 is_ordinary, and orig_st_shndx parameters. Change all callers.
13825 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13826 to be in an ordinary section.
13827 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13828 object and is_ordinary parameters. Change all callers.
13829 (Sized_dwarf_line_info::read_relocs): Add object parameter.
13830 Change all callers. Don't add undefined or non-ordinary symbols
13831 to reloc_map_.
13832 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13833 Change all callers.
13834 * dwarf_reader.h (class Sized_dwarf_line_info): Update
13835 declarations.
13836 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13837 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13838 (Sized_relobj::relocate_sections): Likewise.
13839 * target-reloc.h (scan_relocs): Adjust section symbol index.
13840 (scan_relocatable_relocs): Likewise.
13841 * i386.cc (Scan::local): Check for ordinary symbols.
13842 * sparc.cc (Scan::local): Likewise.
13843 * x86_64.cc (Scan::local): Likewise.
13844 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13845 to symbol_section_and_value.
13846 * testsuite/many_sections_test.cc: New file.
13847 * testsuite/Makefile.am (BUILT_SOURCES): Define.
13848 (check_PROGRAMS): Add many_sections_test.
13849 (many_sections_test_SOURCES): Define.
13850 (many_sections_test_DEPENDENCIES): Define.
13851 (many_sections_test_LDFLAGS): Define.
13852 (BUILT_SOURCES): Add many_sections_define.h.
13853 (many_sections_define.h): New target.
13854 (BUILT_SOURCES): Add many_sections_check.h.
13855 (many_sections_check.h): New target.
13856 (check_PROGRAMS): Add many_sections_r_test.
13857 (many_sections_r_test_SOURCES): Define.
13858 (many_sections_r_test_DEPENDENCIES): Define.
13859 (many_sections_r_test_LDFLAGS): Define.
13860 (many_sections_r_test_LDADD): Define.
13861 (many_sections_r_test.o): New target.
13862 * testsuite/Makefile.in: Rebuild.
13863
13864 2008-04-17 Cary Coutant <ccoutant@google.com>
13865
13866 * errors.cc (Errors::info): New function.
13867 (gold_info): New function.
13868 * errors.h (Errors::info): New function.
13869 * gold.h (gold_info): New function.
13870 * object.cc (Input_objects::add_object): Print trace output.
13871 * options.cc (options::parse_set): New function.
13872 (General_options::parse_wrap): Deleted.
13873 (General_options::General_options): Deleted initializer.
13874 * options.h (options::String_set): New typedef.
13875 (options::parse_set): New function.
13876 (DEFINE_set): New macro.
13877 (General_options::wrap): Changed to use DEFINE_set. Changed
13878 callers of any_wrap_symbols and is_wrap_symbol.
13879 (General_options::trace, General_options::trace_symbol):
13880 New options.
13881 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13882 (General_options::wrap_symbols_): Deleted.
13883 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13884
13885 2008-04-17 David S. Miller <davem@davemloft.net>
13886
13887 * options.cc (General_options::parse_V): New function.
13888 * options.h: Add entries for -V and -Qy.
13889
13890 2008-04-17 Ian Lance Taylor <iant@google.com>
13891
13892 * common.cc (Symbol_table::allocate_commons): Remove options
13893 parameter. Change caller.
13894 (Symbol_table::do_allocate_commons): Remove options parameter.
13895 Change caller. Just call do_allocate_commons_list twice.
13896 (Symbol_table::do_allocate_commons_list): New function, broken out
13897 of do_allocate_commons.
13898 * common.h (class Allocate_commons_task): Remove options_ field.
13899 Update constructor.
13900 * symtab.cc (Symbol_table::Symbol_table): Initialize
13901 tls_commons_.
13902 (Symbol_table::add_from_object): Put TLS common symbols on
13903 tls_commons_ list.
13904 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13905 which are IN_OUTPUT_DATA.
13906 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13907 allocate_commons and do_allocate_commons declarations. Declare
13908 do_allocate_commons_list.
13909 * gold.cc (queue_middle_tasks): Update creation of
13910 Allocate_commons_task to not pass options.
13911 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13912 (TLS_TEST_C_FLAGS): New variable.
13913 (tls_test_c_pic.o): New target.
13914 (tls_test_shared.so): Link in tls_test_c_pic.o.
13915 (tls_test_c_pic_ie.o): New target.
13916 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13917 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13918 (tls_test_c.o): New target.
13919 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13920 (tls_pic_test_LDADD): Likewise.
13921 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13922 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13923 (tls_test_c_gnu2.o): New target.
13924 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13925 tls_test_c_gnu2.o.
13926 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13927 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13928 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13929 * testsuite/tls_test.cc: Include "config.h".
13930 (t_last): Call t11_last.
13931 * testsuite/tls_test.h (t11, t11_last): Declare.
13932 * testsuite/tls_test_c.c: New file.
13933 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13934 * configure.ac: Check for OpenMP support.
13935 * configure, config.in, Makefile.in: Rebuild.
13936 * testsuite/Makefile.in: Rebuild.
13937
13938 2008-04-16 Cary Coutant <ccoutant@google.com>
13939
13940 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13941 (Target_i386::tls_base_symbol_defined_): New field.
13942 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13943 (Target_i386::Scan::global): Likewise.
13944 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13945 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13946 (Target_x86_64::tls_base_symbol_defined_): New field.
13947 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13948 (Target_x86_64::Scan::global): Likewise.
13949
13950 2008-04-16 Cary Coutant <ccoutant@google.com>
13951
13952 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13953 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13954 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13955 building shared libraries.
13956 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13957 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13958 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13959 * testsuite/Makefile.in: Rebuild.
13960 * testsuite/weak_undef.h: New file.
13961 * testsuite/weak_undef_file1.cc: Add extra test cases.
13962 * testsuite/weak_undef_file2.cc: Likewise.
13963 * testsuite/weak_undef_test.cc: Likewise.
13964
13965 2008-04-16 David S. Miller <davem@davemloft.net>
13966
13967 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13968 Add issued_non_pic_error_ field. Declare check_non_pic.
13969 (Target_sparc::Scan::check_non_pic): New function.
13970 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13971 (Target_sparc::Scan::global): Likewise.
13972
13973 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13974 * configure: Rebuild.
13975
13976 * options.h (DEFINE_enable): New macro.
13977 (new_dtags): New enable option.
13978 (initfirst, interpose, loadfltr, nodefaultlib,
13979 nodelete, nodlopen, nodump): New -z options.
13980 * layout.cc (Layout:finish_dynamic_section): If new
13981 dtags enabled, emit DT_RUNPATH. Also, emit a
13982 DT_FLAGS_1 containing any specified -z flags.
13983
13984 2008-04-16 Ian Lance Taylor <iant@google.com>
13985
13986 * copy-relocs.cc: New file.
13987 * copy-relocs.h: New file.
13988 * reloc.cc: Remove Copy_relocs code.
13989 * reloc.h: Likewise.
13990 * reloc-types.h (struct Reloc_types) [both versions]: Add
13991 get_reloc_addend_noerror.
13992 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13993 variants of add_global which take an addend which must be zero.
13994 * i386.cc: Include "copy-relocs.h".
13995 (class Target_i386): Change type of copy_relocs_ to variable,
13996 update initializer.
13997 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13998 Change all callers.
13999 (Target_i386::do_finalize_sections): Change handling of
14000 copy_relocs_.
14001 * sparc.cc: Include "copy-relocs.h".
14002 (class Target_sparc): Change type of copy_relocs_ to variable,
14003 update initializer.
14004 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14005 Change all callers.
14006 (Target_sparc::do_finalize_sections): Change handling of
14007 copy_relocs_.
14008 * x86_64.cc: Include "copy-relocs.h".
14009 (class Target_x86_64): Change type of copy_relocs_ to variable,
14010 update initializer.
14011 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14012 class. Change all callers.
14013 (Target_x86_64::do_finalize_sections): Change handling of
14014 copy_relocs_.
14015 * Makefile.am (CCFILES): Add copy-relocs.cc.
14016 (HFILES): Add copy-relocs.h.
14017
14018 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14019
14020 * testsuite/script_test_4.sh: Permit leading zeroes.
14021
14022 2008-04-15 Ian Lance Taylor <iant@google.com>
14023
14024 * script-sections.cc (Script_sections::create_segments): Use
14025 header_size_adjustment even when there is enough room for the
14026 headers.
14027 * testsuite/script_test_4.sh: New file.
14028 * testsuite/script_test_4.t: New file.
14029 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14030 (check_DATA): Add script_test_4.stdout.
14031 (MOSTLYCLEANFILES): Likewise.
14032 (script_test_4): New target.
14033 (script_test_4.stdout): New target.
14034 * testsuite/Makefile.in: Rebuild.
14035
14036 * sparc.cc: Add definitions for Output_data_plt_sparc class
14037 constants.
14038
14039 2008-04-14 David S. Miller <davem@davemloft.net>
14040
14041 * sparc.cc: New file.
14042 * Makefile.am (TARGETSOURCES): Add sparc.cc
14043 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14044 * configure.tgt: Document targ_extra_size and
14045 targ_extra_big_endian. Add entries for sparc-* and
14046 sparc64-*.
14047 * configure.ac: Handle targ_extra_size and
14048 targ_extra_big_endian.
14049 * Makefile.in: Rebuild.
14050 * configure: Likewise.
14051 * po/POTFILES.in: Likewise.
14052 * po/gold.pot: Likewise.
14053
14054 2008-04-14 Ian Lance Taylor <iant@google.com>
14055
14056 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14057 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14058 in the name/type/flags to section mapping. Don't call
14059 allocate_output_section.
14060 (Layout::choose_output_section): Change parameter from adjust_name
14061 to is_input_section. Don't permit input sections after sections
14062 are attached to segments. Don't call allocate_output_section.
14063 (Layout::layout_eh_frame): Call update_flags_for_input_section,
14064 not write_enable_output_section.
14065 (Layout::make_output_section): Don't push to
14066 unattached_section_list_ nor call attach_to_segment. Call
14067 attach_section_to_segment if sections are attached.
14068 (Layout::attach_sections_to_segments): New function.
14069 (Layout::attach_section_to_segment): New function.
14070 (Layout::attach_allocated_section_to_segment): Rename from
14071 attach_to_segment. Remove flags parameter.
14072 (Layout::allocate_output_section): Remove function.
14073 (Layout::write_enable_output_section): Remove function.
14074 * layout.h (class Layout): Update for above changes. Add new
14075 field sections_are_attached_.
14076 * output.h (Output_section::update_flags_for_input_section): New
14077 function.
14078 * output.cc (Output_section::add_input_section): Call
14079 update_flags_for_input_section.
14080 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14081
14082 2008-04-11 Cary Coutant <ccoutant@google.com>
14083
14084 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14085 thought unnecessary.
14086 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14087
14088 2008-04-11 Ian Lance Taylor <iant@google.com>
14089
14090 * output.h (class Output_section_data): Remove inline definition
14091 of set_addralign.
14092 * output.cc (Output_section_data::set_addralign): New function.
14093
14094 2008-04-11 Cary Coutant <ccoutant@google.com>
14095
14096 Add support for TLS descriptors for i386 and x86_64.
14097 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14098 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14099 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14100 GOT_TYPE_TLS_DESC.
14101 (Target_i386::got_mod_index_entry): Remove unnecessary code.
14102 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14103 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
14104 relocations.
14105 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14106 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14107 Fix problem with initial-exec relocations.
14108 (Target_i386::Relocate::relocate_tls): Likewise.
14109 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14110 relaxation.
14111 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14112 support for section-plus-offset dynamic table entries.
14113 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14114 (Output_data_dynamic::Dynamic_entry): Add support for
14115 section-plus-offset dynamic table entries.
14116 (Output_data_dynamic::Classification): Likewise.
14117 (Output_data_dynamic::classification_): Renamed offset_.
14118 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14119 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14120 (Target_x86_64::make_plt_section): New function.
14121 (Target_x86_64::reserve_tlsdesc_entries): New function.
14122 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14123 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14124 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14125 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14126 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14127 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14128 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14129 add extra PLT entry for TLS descriptors.
14130 (Output_data_plt_x86_64::got_): New field.
14131 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14132 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14133 fields.
14134 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14135 descriptors.
14136 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14137 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14138 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14139 R_386_TLS_DESC_CALL relocations.
14140 (Target_x86_64::Scan::global): Likewise.
14141 (Target_x86_64::do_finalize_sections): Add dynamic table entries
14142 for TLS descriptors.
14143 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14144 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14145 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14146 GD-to-IE relaxation.
14147 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14148 and TLS_DESCRIPTORS.
14149 * Makefile.in: Rebuild.
14150 * configure: Rebuild.
14151 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14152 (tls_test_shared2.so): New target.
14153 (tls_shared_gd_to_ie_test_SOURCES): New variable.
14154 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14155 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14156 (tls_shared_gd_to_ie_test_LDADD): New variable.
14157 (tls_shared_gnu2_gd_to_ie_test): New target.
14158 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14159 New targets.
14160 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14161 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14162 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14163 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14164 (tls_shared_gnu2_test): New target.
14165 (tls_test_gnu2_shared.so): New target.
14166 (tls_shared_gnu2_test_SOURCES): New variable.
14167 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14168 (tls_shared_gnu2_test_LDFLAGS): New variable.
14169 (tls_shared_gnu2_test_LDADD): New variable.
14170 * testsuite/Makefile.in: Rebuild.
14171 * testsuite/Makefile.
14172
14173 2008-04-11 Ian Lance Taylor <iant@google.com>
14174
14175 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14176 justsyms.t.
14177 * testsuite/Makefile.in: Rebuild.
14178
14179 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14180 long.
14181 * testsuite/script_test_2.cc (main): Adjust test.
14182
14183 2008-04-11 David S. Miller <davem@davemloft.net>
14184 Ian Lance Taylor <iant@google.com>
14185
14186 * options.h (General_options): Add entries for '-Y' and
14187 '-relax'.
14188 * options.cc (General_options:finalize): If -Y was used, add those
14189 entries to the library path instead of the default "/lib" and
14190 "/usr/lib".
14191
14192 2008-04-11 David S. Miller <davem@davemloft.net>
14193
14194 * testsuite/justsyms.t: Start at 0x100.
14195 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14196 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14197 long.
14198 * testsuite/script_test_2.cc: Adjust string and section length
14199 checks.
14200
14201 2008-04-09 Ian Lance Taylor <iant@google.com>
14202
14203 PR gold/5996
14204 * script-sections.cc (Sections_element::allocate_to_segment): Add
14205 orphan parameter.
14206 (Output_section_definition::allocate_to_segment): Likewise.
14207 (Orphan_output_section::allocate_to_segment): Likewise.
14208 (Script_sections::attach_sections_using_phdrs_clause): Don't
14209 propagate non-PT_LOAD segments to orphan sections.
14210 * testsuite/Makefile.am (script_test_3.stdout): Generate using
14211 readelf rather than objdump.
14212 * testsuite/script_test_3.sh: Adjust accordingly. Test that
14213 .interp section and PT_INTERP segment are the same size.
14214 * testsuite/Makefile.in: Rebuild.
14215
14216 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14217 aliases for symbols defined in the same object.
14218 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14219 (weak_alias_test_SOURCES): New variable.
14220 (weak_alias_test_DEPENDENCIES): New variable.
14221 (weak_alias_test_LDFLAGS): New variable.
14222 (weak_alias_test_LDADD): New variable.
14223 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14224 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14225 (weak_alias_test_3.o): New target.
14226 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14227 * testsuite/weak_alias_test_main.cc: New file.
14228 * testsuite/weak_alias_test_1.cc: New file.
14229 * testsuite/weak_alias_test_2.cc: New file.
14230 * testsuite/weak_alias_test_3.cc: New file.
14231
14232 2008-04-08 Ian Lance Taylor <iant@google.com>
14233
14234 * options.h (class General_options): Add --noinhibit-exec option.
14235 * main.cc (main): Check --noinhibit-exec.
14236
14237 * options.h (class General_options): Define --wrap as a special
14238 option. Add wrap_symbols_ field.
14239 (General_options::any_wrap_symbols): New function.
14240 (General_options::is_wrap_symbol): New function.
14241 * options.cc (General_options::parse_wrap): New function.
14242 (General_options::General_options): Initialize wrap_symbols_.
14243 * symtab.cc (Symbol_table::wrap_symbol): New function.
14244 (Symbol_table::add_from_object): Handle --wrap.
14245 * symtab.h (class Symbol_table): Declare wrap_symbol.
14246 * target.h (Target::wrap_char): New function.
14247 (Target::Target_info): Add wrap_char field.
14248 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14249 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14250 * testsuite/testfile.cc (Target_test::test_target_info):
14251 Likewise.
14252
14253 * errors.cc (Errors::undefined_symbol): Mention symbol version if
14254 there is one.
14255
14256 * layout.h (class Layout): Add added_eh_frame_data_ field.
14257 * layout.cc (Layout::Layout): Initialize new field.
14258 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14259 output section until we find a section we merged successfully.
14260 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14261 that the size be non-zero.
14262
14263 * merge.cc (Object_merge_map::get_output_offset): Remove inline
14264 qualifier.
14265
14266 2008-04-08 Craig Silverstein <csilvers@google.com>
14267
14268 * configure.ac: Export new conditional variable HAVE_ZLIB.
14269 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14270 on HAVE_ZLIB.
14271 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14272 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14273
14274 2008-04-07 Ian Lance Taylor <iant@google.com>
14275
14276 * version.cc (version_string): Set to "1.5".
14277
14278 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14279 Add issued_non_pic_error_ field. Declare check_non_pic.
14280 (Target_x86_64::Scan::check_non_pic): New function.
14281 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14282 (Target_x86_64::Scan::global): Likewise.
14283
14284 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14285 addend parameter. Change caller. Handle merge sections.
14286 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14287 Address to Addend. Don't add in the result of
14288 local_section_offset, pass down the addend and use the returned
14289 value.
14290 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14291 Update declarations of local_section_offset and symbol_value.
14292 * testsuite/two_file_test_1.cc (t18): New function.
14293 * testsuite/two_file_test_2.cc (f18): New function.
14294 * testsuite/two_file_test_main.cc (main): Call t18.
14295 * testsuite/two_file_test.h (t18, f18): Declare.
14296
14297 * configure.ac: Don't test for objdump, c++filt, or readelf.
14298 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14299 conditionals.
14300 (TEST_READELF): New variable.
14301 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14302 (check_PROGRAMS): Add two_file_strip_test.
14303 (two_file_strip_test): New target.
14304 (check_PROGRAMS): Add two_file_same_shared_strip_test.
14305 (two_file_same_shared_strip_test_SOURCES): New variable.
14306 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14307 (two_file_same_shared_strip_test_LDFLAGS): New variable.
14308 (two_file_same_shared_strip_test_LDADD): New variable.
14309 (two_file_shared_strip.so): New target.
14310 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14311 (ver_test_5.syms, ver_test_7.syms): Likewise.
14312 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14313 (strip_test_3.stdout): Use TEST_OBJDUMP.
14314 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14315
14316 2008-04-04 Cary Coutant <ccoutant@google.com>
14317
14318 * symtab.h (Symbol::is_weak_undefined): New function.
14319 (Symbol::is_strong_undefined): New function.
14320 (Symbol::is_absolute): New function.
14321 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14322 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14323 absolute symbols.
14324 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14325 (weak_undef_test): New target.
14326 * testsuite/Makefile.in: Rebuild.
14327 * testsuite/weak_undef_file1.cc: New file.
14328 * testsuite/weak_undef_file2.cc: New file.
14329 * testsuite/weak_undef_test.cc: New file.
14330
14331 2008-04-03 Craig Silverstein <csilvers@google.com>
14332
14333 * compressed_output.h (class Output_compressed_section): Use
14334 unsigned buffer.
14335 * compressed_output.cc (zlib_compress): Use unsigned buffers,
14336 add zlib header.
14337 (zlib_compressed_suffix): Removed.
14338 (Output_compressed_section::set_final_data_size): Use unsigned
14339 buffers.
14340 * testsuite/Makefile.am (flagstest_compress_debug_sections):
14341 Fix linker invocation.
14342 (flagstest_o_specialfile_and_compress_debug_sections):
14343 Likewise.
14344 * testsuite/Makefile.in: Regenerated.
14345
14346 2008-04-02 David S. Miller <davem@davemloft.net>
14347
14348 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14349 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14350
14351 2008-04-02 Craig Silverstein <csilvers@google.com>
14352
14353 * TODO: New file.
14354
14355 2008-04-02 Ian Lance Taylor <iant@google.com>
14356
14357 * fileread.cc (File_read::find_view): Add byteshift and vshifted
14358 parameters. Update for new key type to views_. Change all
14359 callers.
14360 (File_read::read): Adjust for byteshift in returned view.
14361 (File_read::add_view): New function, broken out of
14362 find_and_make_view.
14363 (File_read::make_view): New function, broken out of
14364 find_and_make_view.
14365 (File_read::find_or_make_view): Add offset and aligned
14366 parameters. Rewrite accordingly. Change all callers.
14367 (File_read::get_view): Add offset and aligned parameters. Adjust
14368 for byteshift in return value.
14369 (File_read::get_lasting_view): Likewise.
14370 * fileread.h (class File_read): Update declarations.
14371 (class File_read::View): Add byteshift_ field. Add byteshift to
14372 constructor. Add byteshift method.
14373 * archive.h (Archive::clear_uncached_views): New function.
14374 (Archive::get_view): Add aligned parameter. Change all callers.
14375 * object.h (Object::get_view): Add aligned parameter. Change all
14376 callers.
14377 (Object::get_lasting_view): Likewise.
14378
14379 * fileread.cc (File_read::release): Don't call clear_views if
14380 there are multiple objects.
14381 * fileread.h (File_read::clear_uncached_views): New function.
14382 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14383 on the archive.
14384
14385 2008-03-31 Cary Coutant <ccoutant@google.com>
14386
14387 Add thin archive support.
14388 * archive.cc (Archive::armagt): New const.
14389 (Archive::setup): Remove task parameter and calls to unlock.
14390 (Archive::unlock_nested_archives): New function.
14391 (Archive::read_header): Add nested_off parameter. Change
14392 all callers.
14393 (Archive::interpret_header): Likewise.
14394 (Archive::include_all_members): Change to handle thin
14395 archives.
14396 (Archive::include_member): Likewise.
14397 * archive.h (Archive::Archive): Add new parameters and
14398 initializers.
14399 (Archive::armagt): New const.
14400 (Archive::setup): Remove task parameter.
14401 (Archive::unlock_nested_archives): New function.
14402 (Archive::read_header): Add nested_off parameter.
14403 (Archive::interpret_header): Likewise.
14404 (Archive::Nested_archive_table): New typedef.
14405 (Archive::is_thin_archive_): New field.
14406 (Archive::nested_archives_): New field.
14407 (Archive::options_): New field.
14408 (Archive::dirpath_): New field.
14409 (Archive::task_): New field.
14410 * readsyms.cc (Read_symbols::do_read_symbols): Add check
14411 for thin archives. Pass additional parameters to
14412 Archive::Archive. Unlock the archive file after calling
14413 Archive::setup.
14414
14415 2008-03-29 Ian Lance Taylor <iant@google.com>
14416
14417 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14418 version symbol to be local.
14419 * testsuite/ver_test_4.sh: New file.
14420 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14421 (check_DATA): Add ver_test_4.syms.
14422 (ver_test_4.syms): New target.
14423 * testsuite/Makefile.in: Rebuild.
14424
14425 * output.cc
14426 (Output_section::Input_section_sort_entry::has_priority): New
14427 function.
14428 (Output_section::Input_section_sort_entry::match_file_name): New
14429 function.
14430 (Output_section::Input_section_sort_entry::match_section_name):
14431 Remove.
14432 (Output_section::Input_section_sort_entry::match_section_name_prefix):
14433 Remove.
14434 (Output_section::Input_section_sort_entry::match_section_file):
14435 Remove.
14436 (Output_section::Input_section_sort_compare::operator()): Rewrite
14437 using new Input_section_sort_entry functions. Sort crtbegin and
14438 crtend first. Sort sections with no priority before sections with
14439 a priority.
14440 * testsuite/initpri1.c (d3): Check j != 4.
14441 (cd5): New constructor/destructor function.
14442 (main): Check j != 2.
14443
14444 * symtab.cc (Symbol_table::add_from_object): If we don't use the
14445 new symbol when resolving, don't call set_is_default.
14446 * testsuite/ver_test_7.cc: New file.
14447 * testsuite/ver_test_7.sh: New file.
14448 * testsuite/Makefile.am (ver_test_7.so): New target.
14449 (ver_test_7.o): New target.
14450 (check_SCRIPTS): Add ver_test_7.sh.
14451 (check_DATA): Add ver_test_7.syms.
14452 (ver_test_7.syms): New target.
14453
14454 2008-03-28 Ian Lance Taylor <iant@google.com>
14455
14456 * layout.cc (Layout::layout): If we see an input section with a
14457 name that needs sorting, set the must_sort flag for the output
14458 section.
14459 (Layout::make_output_section): If the name of the output section
14460 indicates that it might require sorting, set the may_sort flag.
14461 * output.h (Output_section::may_sort_attached_input_sections): New
14462 function.
14463 (Output_section::set_may_sort_attached_input_sections): New
14464 function.
14465 (Output_section::must_sort_attached_input_sections): New
14466 function.
14467 (Output_section::set_must_sort_attached_input_sections): New
14468 function.
14469 (class Output_section): Declare Input_section_sort_entry. Define
14470 Input_section_sort_compare. Declare
14471 sort_attached_input_sections. Add new fields:
14472 may_sort_attached_input_sections_,
14473 must_sort_attached_input_sections_,
14474 attached_input_sections_are_sorted_.
14475 * output.cc (Output_section::Output_section): Initialize new
14476 fields.
14477 (Output_section::add_input_section): Add an entry to
14478 input_sections_ if may_sort or must_sort are true.
14479 (Output_section::set_final_data_size): Call
14480 sort_attached_input_sections if necessary.
14481 (Output_section::Input_section_sort_entry): Define new class.
14482 (Output_section::Input_section_sort_compare::operator()): New
14483 function.
14484 (Output_section::sort_attached_input_sections): New function.
14485 * configure.ac: Check whether the compiler supports constructor
14486 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
14487 * testsuite/initpri1.c: New file.
14488 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14489 CONSTRUCTOR_PRIORITY.
14490 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14491 (initpri1_LDFLAGS): New variable.
14492 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14493
14494 2008-03-27 Ian Lance Taylor <iant@google.com>
14495
14496 * common.cc (Sort_commons::operator): Correct sorting algorithm.
14497 * testsuite/common_test_1.c: New file.
14498 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14499 (common_test_1_SOURCES): New variable.
14500 (common_test_1_DEPENDENCIES): New variable.
14501 (common_test_1_LDFLAGS): New variable.
14502
14503 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14504 and commons_ correctly when NAME/VERSION does not override
14505 NAME/NULL.
14506 * testsuite/ver_test_6.c: New file.
14507 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14508 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14509 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14510
14511 2008-03-26 Ian Lance Taylor <iant@google.com>
14512
14513 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14514 of an undefined symbol from a version script.
14515 * testsuite/Makefile.am (ver_test_5.so): New target.
14516 (ver_test_5.o): New target.
14517 (check_SCRIPTS): Add ver_test_5.sh.
14518 (check_DATA): Add ver_test_5.syms.
14519 (ver_test_5.syms): New target.
14520 * testsuite/ver_test_5.cc: New file.
14521 * testsuite/ver_test_5.script: New file.
14522 * testsuite/ver_test_5.sh: New file.
14523 * Makefile.in, testsuite/Makefile.in: Rebuild.
14524
14525 PR gold/5986
14526 Fix problems building gold with gcc 4.3.0.
14527 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14528 (gold_error_at_location, gold_warning_at_location): Use it.
14529 * configure.ac: Check whether we can compile and use a template
14530 function with a printf attribute.
14531 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14532 when jumping over bytes.
14533 * object.cc: Instantiate Object::read_section_data.
14534 * debug.h: Include <cstring>
14535 * dwarf_reader.cc: Include <algorithm>
14536 * main.cc: Include <cstring>.
14537 * options.cc: Include <cstring>.
14538 * output.cc: Include <cstring>.
14539 * script.cc: Include <cstring>.
14540 * script.h: Include <string>.
14541 * symtab.cc: Include <cstring> and <algorithm>.
14542 * target-select.cc: Include <cstring>.
14543 * version.cc: Include <string>.
14544 * testsuite/testmain.cc: Include <cstdlib>.
14545 * configure, config.in: Rebuild.
14546
14547 2008-03-25 Ian Lance Taylor <iant@google.com>
14548
14549 * options.cc: Include "../bfd/bfdver.h".
14550 (options::help): Print bug reporting address.
14551
14552 * version.cc (print_version): Adjust output for current value of
14553 BFD_VERSION_STRING.
14554
14555 * NEWS: New file.
14556
14557 * options.cc (options::help): Print list of supported targets.
14558 * target-select.h: Include <vector>.
14559 (class Target_selector): Make machine_, size_, and is_big_endian_
14560 fields const. Add bfd_name_ and instantiated_target_ fields.
14561 (Target_selector::Target_selector): Add bfd_name parameter.
14562 (Target_selector::recognize): Make non-virtual, call
14563 do_recognize.
14564 (Target_selector::recognize_by_name): Make non-virtual, call
14565 do_recognize_by_name.
14566 (Target_selector::supported_names): New function.
14567 (Target_selector::bfd_name): New function.
14568 (Target_selector::do_instantiate_target): New pure virtual
14569 function.
14570 (Target_selector::do_recognize): New virtual function.
14571 (Target_selector::do_recognize_by_name): New virtual function.
14572 (Target_selector::instantiate_target): New private function.
14573 (supported_target_names): Declare.
14574 * target-select.cc (Target_selector::Target_selector): Update for
14575 new parameter and fields.
14576 (select_target_by_name): Check that the name matches before
14577 calling recognize_by_name.
14578 (supported_target_names): New function.
14579 * i386.cc (class Target_selector_i386): Update Target_selector
14580 constructor call. Remove recognize and recognize_by_name. Add
14581 do_instantiate_target.
14582 * x86_64.cc (class Target_selector_x86_64): Likewise.
14583 * testsuite/testfile.cc (class Target_selector_test): Update for
14584 changes to Target_selector.
14585
14586 * README: Rewrite, with some notes on unsupported features.
14587
14588 2008-03-24 Cary Coutant <ccoutant@google.com>
14589
14590 * i386.cc (Target_i386::Got_type): New enum declaration.
14591 (Target_i386::Scan::local): Updated callers of Output_data_got
14592 member functions.
14593 (Target_i386::Scan::global): Likewise.
14594 (Target_i386::Relocate::relocate): Likewise.
14595 (Target_i386::Relocate::relocate_tls): Likewise.
14596 * object.h (Got_offset_list): New class.
14597 (Sized_relobj::local_has_got_offset): Added got_type parameter.
14598 (Sized_relobj::local_got_offset): Likewise.
14599 (Sized_relobj::set_local_got_offset): Likewise.
14600 (Sized_relobj::local_has_tls_got_offset): Removed.
14601 (Sized_relobj::local_tls_got_offset): Removed.
14602 (Sized_relobj::set_local_tls_got_offset): Removed.
14603 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14604 * output.cc (Output_data_got::add_global): Added got_type parameter.
14605 (Output_data_got::add_global_with_rel): Likewise.
14606 (Output_data_got::add_global_with_rela): Likewise.
14607 (Output_data_got::add_global_pair_with_rel): New function.
14608 (Output_data_got::add_global_pair_with_rela): New function.
14609 (Output_data_got::add_local): Added got_type parameter.
14610 (Output_data_got::add_local_with_rel): Likewise.
14611 (Output_data_got::add_local_with_rela): Likewise.
14612 (Output_data_got::add_local_pair_with_rel): New function.
14613 (Output_data_got::add_local_pair_with_rela): New function.
14614 (Output_data_got::add_global_tls): Removed.
14615 (Output_data_got::add_global_tls_with_rel): Removed.
14616 (Output_data_got::add_global_tls_with_rela): Removed.
14617 (Output_data_got::add_local_tls): Removed.
14618 (Output_data_got::add_local_tls_with_rel): Removed.
14619 (Output_data_got::add_local_tls_with_rela): Removed.
14620 * output.h (Output_data_got::add_global): Added got_type parameter.
14621 (Output_data_got::add_global_with_rel): Likewise.
14622 (Output_data_got::add_global_with_rela): Likewise.
14623 (Output_data_got::add_global_pair_with_rel): New function.
14624 (Output_data_got::add_global_pair_with_rela): New function.
14625 (Output_data_got::add_local): Added got_type parameter.
14626 (Output_data_got::add_local_with_rel): Likewise.
14627 (Output_data_got::add_local_with_rela): Likewise.
14628 (Output_data_got::add_local_pair_with_rel): New function.
14629 (Output_data_got::add_local_pair_with_rela): New function.
14630 (Output_data_got::add_global_tls): Removed.
14631 (Output_data_got::add_global_tls_with_rel): Removed.
14632 (Output_data_got::add_global_tls_with_rela): Removed.
14633 (Output_data_got::add_local_tls): Removed.
14634 (Output_data_got::add_local_tls_with_rel): Removed.
14635 (Output_data_got::add_local_tls_with_rela): Removed.
14636 * resolve.cc (Symbol::override_base_with_special): Removed
14637 reference to has_got_offset_ field.
14638 * symtab.cc (Symbol::init_fields): Replaced initialization
14639 of got_offset_ with got_offsets_. Removed initialization
14640 of has_got_offset_
14641 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14642 (Symbol::got_offset): Likewise.
14643 (Symbol::set_got_offset): Likewise.
14644 (Symbol::has_tls_got_offset): Removed.
14645 (Symbol::tls_got_offset): Removed.
14646 (Symbol::set_tls_got_offset): Removed.
14647 (Symbol::got_offset_): Removed.
14648 (Symbol::tls_mod_got_offset_): Removed.
14649 (Symbol::tls_pair_got_offset_): Removed.
14650 (Symbol::got_offsets_): New field.
14651 (Symbol::has_got_offset): Removed.
14652 (Symbol::has_tls_mod_got_offset): Removed.
14653 (Symbol::has_tls_pair_got_offset): Removed.
14654 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14655 (Target_x86_64::Scan::local): Updated callers of Output_data_got
14656 member functions.
14657 (Target_x86_64::Scan::global): Likewise.
14658 (Target_x86_64::Relocate::relocate): Likewise.
14659 (Target_x86_64::Relocate::relocate_tls): Likewise.
14660
14661 2008-03-25 Ben Elliston <bje@au.ibm.com>
14662
14663 * yyscript.y: Fix spelling error in comment.
14664
14665 2008-03-24 Ian Lance Taylor <iant@google.com>
14666
14667 * options.h (class General_options): Define build_id option.
14668 * layout.h (class Layout): Declare write_build_id, create_note,
14669 create_build_id. Add build_id_note_ member.
14670 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14671 "libiberty.h", "md5.h", "sha1.h".
14672 (Layout::Layout): Initialize eh_frame_data_,
14673 eh_frame_hdr_section_, and build_id_note_.
14674 (Layout::finalize): Call create_build_id.
14675 (Layout::create_note): New function, broken out of
14676 Layout::create_gold_note.
14677 (Layout::create_gold_note): Call create_note.
14678 (Layout::create_build_id): New function.
14679 (Layout::write_build_id): New function.
14680 (Close_task_runner::run): Call write_build_id.
14681
14682 * x86_64.cc: Correct license to GPLv3.
14683
14684 2008-03-23 Ian Lance Taylor <iant@google.com>
14685
14686 * options.cc: Include "demangle.h".
14687 (parse_optional_string): New function.
14688 (parse_long_option): Handle takes_optional_argument.
14689 (parse_short_option): Update dash_z initializer. Handle
14690 takes_optional_argument.
14691 (General_options::General_options): Initialize do_demangle_.
14692 (General_options::finalize): Set do_demangle_. Handle demangling
14693 style.
14694 * options.h (parse_optional_string): Declare.
14695 (struct One_option): Add optional_arg field. Update constructor.
14696 Update call constructor calls. Add takes_optional_argument
14697 function.
14698 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
14699 (DEFINE_optional_string): Define.
14700 (General_options::demangle): Change from DEFINE_bool to
14701 DEFINE_optional_string.
14702 (General_options::no_demangle): New function.
14703 (General_options::do_demangle): New function.
14704 (General_options::set_do_demangle): New function.
14705 (General_options::execstack_status_): Move definition to end of
14706 class definition.
14707 (General_options::static_): Likewise.
14708 (General_options::do_demangle_): New field.
14709 * object.cc (big_endian>::get_symbol_location_info): Call
14710 Options::do_demangle, not Options::demangle.
14711 * symtab.cc (demangle): Likewise.
14712
14713 2008-03-22 Ian Lance Taylor <iant@google.com>
14714
14715 * gold.h: Include <cstddef> and <sys/types.h>
14716 * options.h: Include <cstring>.
14717
14718 2008-03-21 Ian Lance Taylor <iant@google.com>
14719
14720 * Added source code to GNU binutils.
14721 \f
14722 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14723
14724 Copying and distribution of this file, with or without modification,
14725 are permitted in any medium without royalty provided the copyright
14726 notice and this notice are preserved.
14727
14728 Local Variables:
14729 mode: change-log
14730 left-margin: 8
14731 fill-column: 74
14732 version-control: never
14733 End:
This page took 0.372 seconds and 4 git commands to generate.