* gc.h (gc_process_relocs): Don't look through function descriptors.
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2013-03-15 Alan Modra <amodra@gmail.com>
2
3 * gc.h (gc_process_relocs): Don't look through function descriptors.
4 * icf.cc (get_section_contents): Do so here instead.
5
6 2013-03-13 Alan Modra <amodra@gmail.com>
7
8 * powerpc.cc (is_branch_reloc): Forward declare.
9 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
10 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
11 false for 64-bit, true for 32-bit non-branch relocs.
12 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
13 * testsuite/Makefile.am (icf_test): Use linker map file instead of
14 nm output.
15 (icf_safe_test): Generate linker map file as well as nm output.
16 (icf_safe_so_test): Likewise.
17 * testsuite/Makefile.in: Regenerate.
18 * testsuite/icf_test.sh: Parse linker map file to determine
19 section folding.
20 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
21 * testsuite/icf_safe_so_test.sh: Likewise.
22 (X86_32_or_ARM_specific_safe_fold): Merge into..
23 (arch_specific_safe_fold): ..this.
24 (X86_64_specific_safe_fold): Delete unused function.
25
26 2013-03-12 Alan Modra <amodra@gmail.com>
27
28 * gc.h (gc_process_relocs): Look through function descriptors
29 to determine shndx, symvalue and addend used by ICF. Tidy
30 variable duplication.
31
32 2013-03-11 Alan Modra <amodra@gmail.com>
33
34 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
35 * layout.cc (Layout_task_runner::run): ..to here.
36 * symtab.h (struct Symbol_location): Extract from..
37 (class Symbol_table): ..here.
38 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
39 * target.h (class Target): Add function_location and
40 do_function_location functions.
41 (class Sized_target): Add do_function_location.
42 * object.h (class Sized_relobj_file): Move find_shdr..
43 (class Object): ..to here.
44 * object.cc: Likewise. Update to suit. Instantiate.
45 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
46 * powerpc.cc (class Powerpc_dynobj): New.
47 (Target_powerpc::do_function_location): New function.
48 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
49 (Powerpc_dynobj::do_read_symbols): New function.
50 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
51
52 2013-03-08 Ian Lance Taylor <iant@google.com>
53
54 * options.cc (General_options::string_to_object_format): Accept
55 "default".
56
57 2013-03-08 Alan Modra <amodra@gmail.com>
58
59 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
60 pointer to Post_fde.
61 (struct Post_fde): Move definition to here..
62 * ehframe.cc (struct Post_fde): ..from here.
63 (Cie::write): Don't alloc Post_fde.
64 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
65
66 2013-03-07 Alan Modra <amodra@gmail.com>
67
68 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
69 relocation referencing .LC0.
70 * testsuite/discard_locals_test.sh: Remove FIXMEs.
71
72 2013-03-07 Alan Modra <amodra@gmail.com>
73
74 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
75 always_inline. Add assembly for powerpc to avoid GOT.
76
77 2013-03-07 Alan Modra <amodra@gmail.com>
78
79 * testsuite/script_test_10.sh: Don't test .bss section
80 header number.
81
82 2013-03-06 Alan Modra <amodra@gmail.com>
83
84 * powerpc.cc (class Powerpc_relobj): Move some member functions.
85 (Target_powerpc::symval_for_branch): Add symtab param. Update
86 all callers. Handle folded sections.
87 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
88 to Powerpc_relobj.
89 (Global_symbol_visitor_opd::operator()): Likewise.
90
91 2013-03-04 Alan Modra <amodra@gmail.com>
92
93 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
94 * testsuite/Makefile.in: Regenerate.
95
96 2013-03-01 Cary Coutant <ccoutant@google.com>
97
98 Add dwp support for v2 DWARF package file format.
99 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
100 tu_length parameter. Adjust all callers.
101 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
102 * dwp.cc: Include dwarf.h.
103 (Section_bounds): New struct type.
104 (Unit_set): New struct type.
105 (Dwo_file::Dwo_file): Initialize new data member.
106 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
107 Combine and rename to...
108 (Dwo_file::read_unit_index): ...this.
109 (Dwo_file::sized_read_compunit_index)
110 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
111 (Dwo_file::sized_read_unit_index): ...this.
112 (Dwo_file::copy_section): Remove section_name, is_str_offsets
113 parameters; add section_id parameter.
114 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
115 (Dwo_file::add_unit_set): ...this.
116 (Dwo_file::shndx_map_): Remove.
117 (Dwo_file::sect_offsets_): New data member.
118 (Dwp_output_file::Dwp_output_file): Initialize new data members.
119 (Dwp_output_file::add_section): Rename to...
120 (Dwp_output_file::add_contribution): ...this.
121 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
122 (Dwp_output_file::add_tu_set): Likewise.
123 (Dwp_output_file::Contribution): New type.
124 (Dwp_output_file::Section::contributions): New data member.
125 (Dwp_output_file::Cu_or_tu_set): Remove.
126 (Dwp_output_file::Section::Section): New ctor.
127 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
128 (Dwp_output_file::Dwp_index::Section_table): New type.
129 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
130 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
131 parameter.
132 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
133 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
134 (Dwp_output_file::Dwp_index::section_table): New member function.
135 (Dwp_output_file::Dwp_index::section_table_end): New member function.
136 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
137 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
138 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
139 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
140 (Dwp_output_file::Dwp_index::section_table_): New data member.
141 (Dwp_output_file::Dwp_index::section_mask_): New data member.
142 (Dwp_output_file::add_output_section): New member function.
143 (Dwp_output_file::write_new_section): New member function.
144 (Dwp_output_file::write_contributions): New member function.
145 (Dwp_output_file::section_id_map_): New data member.
146 (class Dwo_id_info_reader): Remove.
147 (class Unit_reader): New class.
148 (get_dwarf_section_name): New function.
149 (Dwo_file::read_executable): Adjust initializations of class data.
150 (Dwo_file::read): Add support for v2 package file format.
151 (Dwo_file::read_unit_index): Likewise.
152 (Dwo_file::sized_read_unit_index): Likewise.
153 (Dwo_file::copy_section): Likewise.
154 (Dwo_file::add_unit_set): Likewise.
155 (Dwp_output_file::add_output_section): Likewise.
156 (Dwp_output_file::add_contribution): Likewise.
157 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
158 for empty slot.
159 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
160 file format.
161 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
162 slot.
163 (Dwp_output_file::initialize): Remove unused function.
164 (Dwp_output_file::finalize): Add support for v2 package file format.
165 (Dwp_output_file::write_index): Likewise.
166 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
167 function prototype.
168
169 2013-03-01 Cary Coutant <ccoutant@google.com>
170
171 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
172 function into class definition in header file.
173 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
174 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
175 New function.
176 (Dwarf_info_reader::check_buffer): Move here from .cc file.
177
178 2013-02-28 Alan Modra <amodra@gmail.com>
179
180 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
181 * target.cc (Target::do_plt_fde_location): New function.
182 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
183 accessor function, and constructor param.
184 (struct Post_fde, Post_fdes): Declare.
185 (Cie::write): Add post_fdes param.
186 * ehframe.cc (Fde::write): Use plt_fde_location.
187 (struct Post_fde): Define.
188 (Cie::write): Stash FDEs added post merge mapping.
189 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
190 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
191 (Eh_frame::do_sized_write): Arrange to write post map FDES after
192 other FDEs.
193 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
194 (Target_powerpc::has_glink): New function.
195 (Target_powerpc::do_relax): Add eh_frame info for stubs.
196 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
197 glink_eh_frame_fde_32, default_fde): New data.
198 (Stub_table::eh_frame_added_): New var.
199 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
200 Make const.
201 (Stub_table::add_eh_frame): New function.
202 (Output_data_glink::add_eh_frame): New function.
203 (Target_powerpc::make_glink_section): Call add_eh_frame.
204
205 2013-02-15 Ian Lance Taylor <iant@google.com>
206
207 * options.h (DEFINE_uint64_alias): Define.
208 (class General_options): Add -Ttext-segment as an alias for
209 -Ttext.
210
211 2013-02-15 Alan Modra <amodra@gmail.com>
212
213 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
214 (Stub_table::do_write): ..here, two places.
215 (Stub_table::plt_call_size): Use it here too.
216
217 2013-02-11 Ian Lance Taylor <iant@google.com>
218
219 * descriptors.cc (Descriptors::close_all): New function.
220 * descriptors.h (class Descriptors): Declare close_all.
221 (close_all_descriptors): New inline function.
222 * plugin.cc: Include "descriptors.h".
223 (Plugin_manager::cleanup): Call close_all_descriptors.
224
225 2013-02-06 Alan Modra <amodra@gmail.com>
226
227 * README: Update coding style link.
228
229 2013-01-28 Cary Coutant <ccoutant@google.com>
230
231 * dwp.cc (File_list): New typedef.
232 (Dwo_name_info_reader): New class.
233 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
234 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
235 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
236 (Dwo_file::read_executable): New function.
237 (Dwo_file::read): Move common setup code to ...
238 (Dwo_file::make_object): ... here.
239 (dwp_options): Add --exec/-e.
240 (usage): Likewise.
241 (main): Likewise.
242
243 2013-01-24 Sriraman Tallam <tmsriram@google.com>
244
245 * layout.cc (Layout::layout): Check for option text_reorder.
246 (Layout::make_output_section): Ditto.
247 * options.h (text_reorder): New option.
248 * output.cc (Input_section_sort_compare): Remove special ordering
249 of section names.
250 (Output_section::
251 Input_section_sort_section_name_special_ordering_compare::
252 operator()): New function.
253 (Output_section::sort_attached_input_sections): Use new sort function
254 for .text.
255 * output.h (Input_section_sort_section_name_special_ordering_compare):
256 New struct.
257 * testsuite/Makefile.am (text_section_grouping): Test option
258 --no-text-reorder
259 * testsuite/Makefile.in: Regenerate.
260 * testsuite/text_section_grouping.sh: Check order of functions without
261 default text reordering.
262
263 2013-01-18 Mike Frysinger <vapier@gentoo.org>
264
265 * options.h (General_options): Change default to true for new_dtags.
266
267 2013-01-18 Mike Frysinger <vapier@gentoo.org>
268
269 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
270 when enable_new_dtags is false. Only add DT_RUNPATH when
271 enable_new_dtags is true.
272
273 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
274
275 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
276 used in declaration and definition consistent.
277 (Target_powerpc::symval_for_branch): Ditto.
278
279 2013-01-16 Sriraman Tallam <tmsriram@google.com>
280
281 * testsuite/plugin_final_layout.cc: Fix comment.
282
283 2013-01-16 Sriraman Tallam <tmsriram@google.com>
284
285 * layout.cc (Layout::layout): Do not do default sorting for
286 text sections when section ordering is specified.
287 (make_output_section): Ditto.
288 * testsuite/plugin_final_layout.cc: Name the function sections
289 to catch reordering issues.
290
291 2013-01-15 Alan Modra <amodra@gmail.com>
292
293 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
294 plt-thread-safe.
295
296 2013-01-15 Alan Modra <amodra@gmail.com>
297
298 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
299 * testsuite/Makefile.in: Regenerate.
300
301 2013-01-14 Alan Modra <amodra@gmail.com>
302
303 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
304 * testsuite/Makefile.in: Regenerate.
305
306 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
307
308 PR bfd/14430
309 Fix mingw gold build with plugins enabled
310 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
311 * configure.ac: Export DLOPEN_LIBS and add headers check.
312 * plugin.cc: Handle non-dlfcn case.
313 * Makefile.in: Regenerate.
314 * config.in: Regenerate.
315 * configure: Regenerate.
316 * testsuite/Makefile.in: Regenerate.
317
318 2013-01-09 Sriraman Tallam <tmsriram@google.com>
319
320 * output.h (sort_attached_input_sections): Change to be public.
321 * script-sections.cc
322 (Output_section_definition::set_section_addresses): Sort
323 attached input sections according to section order before linker
324 script assigns section addresses.
325 (Orphan_output_section::set_section_addresses): Sort
326 attached input sections according to section order before linker
327 script assigns section addresses.
328 * Makefile.am (final_layout.sh): Use a simple linker script to
329 check if section ordering still works.
330 * Makefile.in: Regenerate.
331
332 2013-01-09 Ben Cheng <bccheng@google.com>
333
334 * arm.cc (Target_arm::attributes_accept_div): New function.
335 (Target_arm::attributes_forbid_div): New function.
336 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
337 attribute using the same new functions as what bfd/elf32_arm.c
338 does.
339
340 2013-01-07 Cary Coutant <ccoutant@google.com>
341
342 PR gold/14993
343 * output.cc (Output_section::add_input_section): For incremental
344 updates, don't track input sections that are allocated from patch
345 space.
346
347 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
348 Ian Lance Taylor <iant@google.com>
349
350 PR gold/14897
351 * configure.ac (--enable-ld): Removed.
352 (install_as_default): Set to yes only for --enable-gold=default
353 or --disable-ld.
354 * configure: Regenerated.
355
356 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
357
358 * options.h (General_options): Add -fuse-ld= for GCC linker
359 option compatibility.
360
361 2013-01-04 Cary Coutant <ccoutant@google.com>
362
363 * configure.ac: Fix typo restoring CXXFLAGS.
364 * configure: Regenerate.
365
366 2013-01-04 Cary Coutant <ccoutant@google.com>
367
368 * testsuite/Makefile.am (CXXLINK_S): New macro.
369 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
370 * testsuite/Makefile.in: Regenerate.
371
372 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
373
374 * version.cc (print_version): Update copyright year to 2013.
375
376 2012-12-20 Ian Lance Taylor <iant@google.com>
377
378 * layout.cc (Layout::special_ordering_of_input_section): New
379 function.
380 (Layout::layout): If input section requires special ordering, must
381 sort input sections.
382 (Layout::make_output_section): May sort .text input sections.
383 (Layout::is_section_name_prefix_grouped): Remove.
384 * layout.h (class Layout): Declare
385 special_ordering_of_input_section. Don't declare
386 is_section_name_prefix_grouped.
387 * output.cc (Output_section::add_input_section): Revert last
388 change.
389 (Output_section::Input_section_sort::match_file_name): Don't crash
390 if called on output section data.
391 (Output_section::Input_section_sort_compare): Sort based on
392 special ordering.
393 (Output_section::Input_section_sort_section_order_index_compare):
394 Revert last patch.
395 (Output_section::sort_attached_input_sections): Likewise.
396
397 2012-12-18 Sriraman Tallam <tmsriram@google.com>
398
399 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
400 * layout.h (Layout::is_section_name_prefix_grouped): New function.
401 * output.cc (Output_section::add_input_section): Check if section
402 name contains special prefix. Keep input sections to sort such
403 sections.
404 (Output_section::Input_section_sort_section_order_index_compare
405 ::operator()): Group sections according to prefixes.
406 (Output_section::sort_attached_input_sections): Add condition to
407 Input_section_entry constructor call.
408 * testsuite/Makefile.am (text_section_grouping): New test.
409 * testsuite/Makefile.in: Regenerate.
410 * testsuite/text_section_grouping.cc: New file.
411 * testsuite/text_section_grouping.sh: New file.
412
413 2012-12-17 Nick Clifton <nickc@redhat.com>
414
415 * Makefile.am: Add copyright notice.
416 * NEWS: Likewise.
417 * README: Likewise.
418 * configure.ac: Likewise.
419 * ftruncate.c: Likewise.
420 * Makefile.in: Regenerate.
421
422 2012-12-14 Cary Coutant <ccoutant@google.com>
423
424 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
425 --no-as-needed flag.
426 (exception_separate_shared_12_test): Likewise.
427 (incremental_copy_test): Likewise.
428 * testsuite/Makefile.in: Regenerate.
429
430 2012-12-14 Cary Coutant <ccoutant@google.com>
431
432 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
433 (Dwp_output_file::Dwp_index::enter_set): Add assert.
434
435 2012-12-12 Alan Modra <amodra@gmail.com>
436
437 * powerpc.cc (class Track_tls): New.
438 (class Relocate, class Scan): Inherit Track_tls.
439 (Target_powerpc::Scan::local, global): Track tls optimization
440 and avoid creating plt entry for __tls_get_addr if all uses
441 are optimized away.
442 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
443
444 2012-12-12 Alan Modra <amodra@gmail.com>
445
446 * options.h (General_options): Add --toc-sort/--no-toc-sort.
447 Replace no_toc_optimize with toc_optimize.
448 * output.h (Output_section::input_sections): Provide non-const variant.
449 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
450 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
451 accessors.
452 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
453 (class Sort_toc_sections): New.
454 (Target_powerpc::do_finalize_sections): Sort toc sections.
455 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
456
457 2012-12-10 Roland McGrath <mcgrathr@google.com>
458
459 * testsuite/binary_unittest.cc (read_all): New function.
460 (Sized_binary_test): Use it instead of ::read.
461 * fileread.cc (do_read): Don't assume pread always reads the whole
462 amount in a single call.
463
464 2012-12-10 Alan Modra <amodra@gmail.com>
465
466 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
467 Set EM_PPC64 or EM_PPC here.
468 (Target_selector_powerpc::do_recognize): Delete.
469
470 2012-12-10 Alan Modra <amodra@gmail.com>
471
472 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
473 stub_table_.
474 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
475
476 2012-12-07 Roland McGrath <mcgrathr@google.com>
477
478 * testsuite/binary_unittest.cc (Sized_binary_test):
479 Use open_descriptor rather than ::open.
480
481 2012-12-07 Alan Modra <amodra@gmail.com>
482
483 * powerpc.cc (Stub_table::do_write): Delete redundant Address
484 typedef and invalid_address constant.
485 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
486 instantiate constants.
487
488 2012-12-06 Roland McGrath <mcgrathr@google.com>
489
490 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
491 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
492 * aclocal.m4: Regenerate.
493 * configure: Regenerate.
494 * Makefile.in: Regenerate.
495 * testsuite/Makefile.in: Regenerate.
496
497 2012-12-07 Alan Modra <amodra@gmail.com>
498
499 * options.h (General_options): Add no_toc_optimize.
500 * powerpc.cc (ok_lo_toc_insn): New function.
501 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
502
503 2012-12-06 Alan Modra <amodra@gmail.com>
504
505 * options.h (General_options): Add plt_align, plt_static_chain,
506 plt_thread_safe. Update stub_group_size help text.
507 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
508 for new plt_thread_safe_ var.
509 (use_plt_offset): Correct comments.
510 (Target_powerpc::do_relax): Look for thread creation symbols to
511 determine default plt_thread_safe value. Clear plt call stubs
512 as well as branch stubs each iteration.
513 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
514 insn constants.
515 (l, hi, ha, write_insn): Move earlier.
516 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
517 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
518 plt stubs too.
519 (Stub_table::update_size): Adjust.
520 (Stub_table::prev_size, set_prev_size): Delete.
521 (Stub_table::stub_align): Let --plt-align affect result.
522 (Stub_table::plt_call_size): Calculate sizes for various stubs.
523 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
524 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
525 (Stub_table::do_write): Support more stub variants.
526
527 2012-12-04 Alan Modra <amodra@gmail.com>
528
529 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
530 (Target_powerpc::do_define_standard_symbols): New function.
531
532 2012-12-03 Alan Modra <amodra@gmail.com>
533
534 * output.h: Formatting, whitespace.
535
536 2012-12-03 Alan Modra <amodra@gmail.com>
537
538 * layout.h (Layout::get_executable_sections): Declare.
539 * layout.cc (Layout::get_executable_sections): New function.
540 * arm.cc (Target_arm::group_sections): Use it.
541 (Arm_output_section::group_sections): Delete now redundant test.
542 * output.cc (Output_reloc::Output_reloc): Add is_relative.
543 param to handle relative relocs.
544 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
545 (Output_data_reloc::add_absolute): Adjust.
546 (Output_data_reloc::add_relative): New function.
547 (Output_data::reset_data_size): New function.
548 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
549 (Output_section::set_addralign): New function.
550 (Output_section::checkpoint_set_addralign): New function.
551 (Output_section::clear_section_offsets_need_adjustment): New function.
552 (Output_section::input_sections): Make public.
553 * powerpc.cc (class Output_data_brlt_powerpc): New.
554 (class Stub_table, class Stub_control): New.
555 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
556 stub_table_, set_stub_table, stub_table): New vectors and accessor
557 functions.
558 (Target_powerpc::do_may_relax, do_relax, push_branch,
559 new_stub_table, stub_tables, brlt_section, group_sections,
560 add_branch_lookup_table, find_branch_lookup_table,
561 write_branch_lookup_table, make_brlt_section): New functions.
562 (Target_powerpc::struct Sort_sections, class Branch_info): New.
563 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
564 branch_info_): New vars.
565 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
566 make call stubs here.
567 (Output_data_glink): Remove all call stub handling from this class.
568 (Target_powerpc::Scan::local, global): Save interesting branch
569 relocs and relocs for ifunc. Adjust calls to plt entry functions.
570 (Target_powerpc::do_finalize_sections): Only make reg save/restore
571 functions on final link.
572 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
573 Handle long branch destinations too.
574 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
575 do_plt_address_for_local): Adjust lookup of plt call stubs.
576
577 2012-11-30 Alan Modra <amodra@gmail.com>
578
579 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
580 relocs against protected symbols when building 32-bit shared libs.
581
582 2012-11-30 Alan Modra <amodra@gmail.com>
583
584 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
585 param. Call got_section() to make .got. Update all callers
586 and their callers and so on.
587
588 2012-11-30 Alan Modra <amodra@gmail.com>
589
590 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
591 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
592 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
593 value if it already exists.
594
595 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
596
597 PR gold/14858
598 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
599
600 2012-11-14 Roland McGrath <mcgrathr@google.com>
601
602 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
603 than bfc instruction for data sandboxing.
604
605 2012-11-08 Alan Modra <amodra@gmail.com>
606
607 * po/POTFILES.in: Regenerate.
608
609 2012-11-05 Alan Modra <amodra@gmail.com>
610
611 * configure.ac: Apply 2012-09-10 change to config.in here.
612 * configure: Regenerate.
613
614 2012-11-05 Alan Modra <amodra@gmail.com>
615
616 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
617 (struct Opd_ent): Use "Address" rather than "Offset".
618 (Output_data_got_powerpc::got_base_offset): Return Valtype.
619 (Target_powerpc::got_section): Make public.
620 (Target_powerpc::scan_relocs): Move code setting symbols..
621 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
622 Create _SDA_BASE_ only when referenced.
623
624 2012-11-02 Roland McGrath <mcgrathr@google.com>
625
626 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
627 from last change.
628
629 2012-11-01 Roland McGrath <mcgrathr@google.com>
630
631 * target.h (Sized_target::relocate_relocs): Use Elf_Off
632 for offset_in_output_section parameter.
633 (Sized_target::relocate_special_relocatable): Likewise.
634 * arm.cc (Target_arm::relocate_relocs): Likewise.
635 (Target_arm::relocate_special_relocatable): Likewise.
636 * i386.cc (Target_i386::relocate_relocs): Likewise.
637 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
638 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
639 * target-reloc.h (relocate_relocs): Likewise.
640 * testsuite/testfile.cc (Target_test): Likewise.
641 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
642 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
643
644 * system.h: Move inclusion of <clocale> to after <libintl.h> in
645 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
646
647 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
648 parameter, which is unused in the [!F_SETFD] case.
649
650 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
651 SYMNDX to off_t before comparing it to this->data_size().
652 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
653 * incremental.cc (Output_section_incremental_inputs::do_write):
654 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
655
656 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
657
658 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
659
660 * gold.cc (Target_arm::do_adjust_elf_header): Add the
661 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
662 in EABI_VER5.
663
664 2012-10-29 Cary Coutant <ccoutant@google.com>
665
666 * dwp.cc (usage): Add file and exit status parameters;
667 add --help and --version options.
668 (print_version): New function.
669 (main): Add --help and --version options.
670
671 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
672
673 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
674 final_layout_sequence.txt.
675 * testsuite/Makefile.in: Regenerated.
676
677 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
678
679 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
680 COMPILE generated by automake.
681 (LINK1): Likewise.
682 (CXXCOMPILE1): Likewise.
683 (CXXLINK1): Likewise.
684 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
685 (LINK): Likewise.
686 (CXXCOMPILE): Likewise.
687 (CXXLINK): Likewise.
688 * testsuite/Makefile.in: Regenerated.
689
690 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
691
692 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
693 on bad fwrite return.
694
695 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
696
697 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
698 on val.
699
700 2012-10-23 Cary Coutant <ccoutant@google.com>
701
702 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
703 * testsuite/Makefile.in: Regenerate.
704 * testsuite/dwp_test.h: New source file.
705 * testsuite/dwp_test_1.cc: New source file.
706 * testsuite/dwp_test_1.s: New source file.
707 * testsuite/dwp_test_1.sh: New source file.
708 * testsuite/dwp_test_1b.cc: New source file.
709 * testsuite/dwp_test_1b.s: New source file.
710 * testsuite/dwp_test_2.cc: New source file.
711 * testsuite/dwp_test_2.s: New source file.
712 * testsuite/dwp_test_2.sh: New source file.
713 * testsuite/dwp_test_main.cc: New source file.
714 * testsuite/dwp_test_main.s: New source file.
715
716 2012-10-23 Cary Coutant <ccoutant@google.com>
717
718 * dwp.h: New header file.
719 * dwp.cc: New source file.
720 * gold.h: Move shared declarations to system.h.
721 * system.h: New header file.
722 * Makefile.am: Add dwp.
723 * Makefile.in: Regenerate.
724
725 2012-10-23 Cary Coutant <ccoutant@google.com>
726
727 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
728 Dwarf_info_reader::read_from_pointer.
729 (Dwarf_pubnames_table::read_header): Likewise.
730 (Dwarf_pubnames_table::next_name): Likewise.
731 (Dwarf_die::read_attributes): Likewise.
732 (Dwarf_die::skip_attributes): Likewise.
733 (Dwarf_info_reader::read_from_pointer): New function template.
734 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
735 (Dwarf_pubnames_table): Likewise.
736 (Dwarf_info_reader::read_from_pointer): New function template.
737 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
738 Dwarf_pubnames_table ctor.
739
740 2012-10-23 Cary Coutant <ccoutant@google.com>
741
742 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
743 abbrev_shndx.
744 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
745 abbrev_shndx_.
746 (Dwarf_info_reader::set_abbrev_shndx): New method.
747 (Dwarf_info_reader::abbrev_shndx_): New data member.
748
749 2012-10-23 Cary Coutant <ccoutant@google.com>
750
751 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
752 from object, not parameters.
753 (Dwarf_info_reader::parse): Likewise.
754 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
755 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
756 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
757 methods.
758
759 2012-10-23 Cary Coutant <ccoutant@google.com>
760
761 * fileread.cc (Input_file::Input_file): New constructor.
762 * fileread.h (class Input_file): Add new constructor.
763
764 2012-10-18 Alan Modra <amodra@gmail.com>
765
766 PR gold/14727
767 * object.cc (Relobj::is_section_name_included): Also match
768 .sdata personality section.
769
770 2012-10-18 Alan Modra <amodra@gmail.com>
771
772 * target-reloc.h (class Default_comdat_behavior): New, package up..
773 (get_comdat_behaviour): ..this.
774 (relocate_section): Add Relocate_comdat_behavior template arg,
775 adjust code to suit.
776 * arm.cc (Target_arm::relocate_section): Adjust to suit.
777 (Target_arm::scan_reloc_section): Likewise.
778 * i386.cc (Target_i386::relocate_section): Likewise.
779 * sparc.cc (Target_sparc::relocate_section): Likewise.
780 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
781 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
782 * powerpc.cc (class Relocate_comdat_behavior): New.
783 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
784 gold::relocate_section with new template arg.
785
786 2012-10-18 Alan Modra <amodra@gmail.com>
787
788 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
789 dynamic relocs for GOT_TPREL got entries, without symbol if
790 resolving locally.
791 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
792 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
793 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
794
795 2012-10-17 Alan Modra <amodra@gmail.com>
796
797 PR gold/14726
798 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
799
800 2012-10-16 Sriraman Tallam <tmsriram@google.com>
801
802 * layout.cc (Layout::include_section): Keep sections marked
803 SHF_EXCLUDE when doing relocatable links.
804
805 2012-10-16 Alan Modra <amodra@gmail.com>
806
807 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
808 (Target_powerpc::do_finalize_sections): Call it.
809 (Output_data_save_res): New class and supporting functions.
810 (Target_powerpc::symval_for_branch): Only look up .opd entry for
811 normal symbols defined in object files.
812
813 2012-10-12 Alan Modra <amodra@gmail.com>
814
815 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
816 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
817 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
818 section if scan_opd_relocs not yet called.
819 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
820
821 2012-10-12 Alan Modra <amodra@gmail.com>
822
823 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
824 add_local_ifunc_entry): Revert last change.
825 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
826
827 2012-10-05 Alan Modra <amodra@gmail.com>
828
829 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
830 do_plt_address_for_global): New functions.
831 (Output_data_got_powerpc::do_write): Don't segfault when linking
832 statically.
833 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
834 add_local_ifunc_entry): Return true on adding entry..
835 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
836 glink->add_entry call. Remove unused symtab param. Adjust calls.
837 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
838 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
839 set up symbols here.
840 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
841 syms here. Do so even when no .iplt. Don't segfault when linking
842 statically.
843 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
844 new variants without reloc param.
845 (Glink_sym_ent::Glink_sym_ent): Likewise.
846 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
847 reloc when refs will resolve to plt call stub.
848 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
849 R_PPC_PLTREL24 to resolve locally.
850 (Target_powerpc::Scan::global): Correct ifunc handling.
851 (Target_powerpc::Relocate::relocate): Correct local sym glink
852 lookup. Don't destroy "value" when we have a plt call stub,
853 and when checking plt call validity.
854 (Target_powerpc::do_dynsym_value): Simplify.
855
856 2012-10-05 Alan Modra <amodra@gmail.com>
857
858 * i386.cc (Output_data_plt_i386::address_for_global,
859 address_for_local): Add plt offset to returned value. Adjust uses.
860 * sparc.cc (Output_data_plt_sparc::address_for_global,
861 address_for_local): Likewise.
862 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
863 address_for_local): Likewise.
864 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
865 address_for_local): Likewise.
866 * target.h (Target::plt_address_for_global, plt_address_for_local):
867 Update comment.
868 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
869 (Output_data_got::Got_entry::write): Nor here.
870 * output.h: Comment fix.
871
872 2012-10-02 Jiong Wang <jiwang@tilera.com>
873
874 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
875 global_offset_table_ value for larget got.
876 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
877
878 2012-09-29 Alan Modra <amodra@gmail.com>
879
880 * powerpc.cc (Target_powerpc::iplt_): New output section.
881 (Target_powerpc::iplt_section, make_iplt_section,
882 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
883 (Target_powerpc::make_plt_entry): Handle ifunc syms.
884 Target_powerpc::plt_entry_count): Count iplt entries too.
885 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
886 reloc section in constructor. New params.
887 (Target_powerpc::make_plt_section): Create reloc section here instead.
888 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
889 functions.
890 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
891 (Output_data_glink::add_entry, find_entry): New functions to
892 deal with local syms.
893 (Glink_sym_ent): Add support for local syms.
894 (Output_data_glink::do_write): Handle ifunc plt entries.
895 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
896 (Target_powerpc::Scan::local, global): Handle ifunc syms.
897 (Target_powerpc::Relocate::relocate): Likewise.
898 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
899
900 2012-09-25 Alan Modra <amodra@gmail.com>
901
902 * object.h (Sized_relobj_file::adjust_local_symbol,
903 do_adjust_local_symbol): New functions.
904 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
905 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
906 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
907 and irregular opd entry spacing.
908 (Powerpc_relobj::do_read_relocs): Add opd size checks.
909 (Global_symbol_visitor_opd): New functor.
910 (Target_powerpc::do_finalize_sections): Omit global symbols defined
911 on deleted opd entries.
912
913 2012-09-15 Jiong Wang <jiwang@tilera.com>
914
915 * tilegx.cc: New file.
916 * Makefile.am (TARGETSOURCES): Add tilegx.cc
917 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
918 * configure.tgt: Add entries for tilegx*.
919 * configure.ac: Likewise.
920 * Makefile.in: Rebuild.
921 * configure: Likewise.
922 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
923 tilegx.
924
925 2012-09-13 Alan Modra <amodra@gmail.com>
926
927 * target-reloc.h (scan_relocs): Call scan.local for relocs
928 against symbols in discarded sections. Pass is_discarded
929 param.
930 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
931 Add is_discarded param.
932 * powerpc (Target_powerpc::Scan::local): Likewise. Use
933 is_discarded to flag opd entry as discarded. Don't emit dyn
934 relocs on such entries.
935 (Target_powerpc::Scan::global): Similarly detect and handle
936 such opd entries.
937 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
938 opd_ent_. Update all uses.
939 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
940 (Target_powerpc::relocate_section): Zero out discarded opd
941 entry relocs.
942
943 2012-09-12 Ian Lance Taylor <iant@google.com>
944
945 PR gold/14570
946 * output.cc: Rename Output_data_got template parameter from size
947 to got_size for all functions. Compile all variants of
948 Output_data_got.
949 (Output_data_got::Got_entry::write): Correct use of size for
950 symbol value. Use local_is_tls rather than casting to
951 Sized_relobj_file.
952 * object.h (class Object): Add local_is_tls and do_local_is_tls.
953 (class Sized_relobj_file): Add do_local_is_tls.
954 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
955
956 2012-09-11 Alan Modra <amodra@gmail.com>
957
958 PR gold/14566
959 * layout.cc (Layout::set_segment_offsets): When using
960 common-page-size alignment, ensure we are on a new max-page-size
961 page.
962 * output.cc (Output_segment::set_section_addresses): Use
963 abi_pagesize, not common_pagesize for relro boundary.
964 (Output_segment::set_offset): Likewise.
965
966 2012-09-11 Alan Modra <amodra@gmail.com>
967
968 * output.h (Output_data_got::add_global_tls, add_local_tls,
969 add_local_tls_pair): New functions.
970 (Output_data_got::add_local_pair_with_rel): Remove second
971 reloc param. Expand comment.
972 (Output_data_got::Got_entry): Rename use_plt_offset_ to
973 use_plt_or_tls_offset_, similarly for constructor param.
974 (Output_data_got::Got_entry::write): Add got_index param.
975 * output.cc (Output_data_got::add_global_tls, add_local_tls,
976 add_local_tls_pair): New functions.
977 (Output_data_got::Got_entry::write): Handle tls symbols
978 with use_plt_or_tls_offset_ set specially.
979 (Output_data_got::add_local_pair_with_rel): Only one reloc.
980 (Output_data_got::do_write): Replace iterator with index, pass
981 index to entry write function.
982 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
983 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
984 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
985 call.
986 * i386.cc (Target_i386::Scan::local): Likewise.
987 * sparc.cc (Target_sparc::Scan::local): Likewise.
988 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
989 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
990 do_tls_offset_for_global): New functions.
991 (Target_powerpc::Scan::local): Correct TLS relocations and got
992 entry values.
993 (Target_powerpc::Scan::global): Don't emit unnecessary
994 dynamic relocations on TLS GOT entries.
995
996 2012-09-10 Matthias Klose <doko@ubuntu.com>
997
998 * config.in: Disable sanity check for kfreebsd.
999
1000 2012-09-10 Sterling Augustine <saugustine@google.com>
1001
1002 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1003 (Gdb_index::pubtypes_read): New parameter.
1004 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1005 to calls.
1006 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1007 pubtypes_object_.
1008
1009 2012-09-09 Alan Modra <amodra@gmail.com>
1010
1011 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1012 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1013 * gc.h (gc_process_relocs): Call target gc_add_reference.
1014 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1015 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1016 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1017 unnecessary cast.
1018 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1019 to cater for when we don't need code offset. Update use.
1020 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1021 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1022 set_opd_valid): New functions.
1023 (Target_powerpc::do_gc_add_reference): New function.
1024 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1025 stashed refs.
1026 (Target_powerpc::do_gc_mark_symbol): New function.
1027
1028 2012-09-06 Cary Coutant <ccoutant@google.com>
1029
1030 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1031 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1032 (Dwarf_die::skip_attributes): Likewise.
1033 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1034 * testsuite/gdb_index_test.cc (inline_func_1): New function.
1035 (main): Call it.
1036 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1037
1038 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
1039
1040 * testsuite/script_test_3.t: Add .got.plt output section
1041 statement.
1042 * testsuite/script_test_4.t: Likewise.
1043
1044 2012-09-05 Alan Modra <amodra@gmail.com>
1045
1046 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1047 update all uses and lose "enum" when using type.
1048
1049 2012-09-05 Alan Modra <amodra@gmail.com>
1050
1051 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1052 * configure: Regenerate.
1053 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1054 (plugin_final_layout.stdout): Likewise.
1055 (memory_test): Set page sizes to 0x1000.
1056 * testsuite/Makefile.in: Regenerate.
1057 * testsuite/discard_locals_test.sh: Add FIXME comment.
1058 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1059 * testsuite/pr14265.t: Add .got output section statement.
1060 * testsuite/script_test_2.t: Likewise.
1061 * testsuite/script_test_3.t: Likewise.
1062 * testsuite/script_test_4.t: Likewise.
1063 * testsuite/script_test_5.t: Likewise.
1064 * testsuite/script_test_6.t: Likewise.
1065 * testsuite/script_test_7.t: Likewise.
1066 * testsuite/script_test_9.t: Likewise.
1067
1068 2012-09-05 Alan Modra <amodra@gmail.com>
1069
1070 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1071 (Powerpc_relocate_functions::Status): New typedef.
1072 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1073 (Target_powerpc::Scan::local): Handle REL64.
1074 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1075 for REL32 and REL64.
1076 (Target_powerpc::symval_for_branch): New function, extracted from..
1077 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
1078 checks. Report overflow errors.
1079
1080 2012-09-05 Alan Modra <amodra@gmail.com>
1081
1082 * object.h (Sized_relobj_file::emit_relocs): Delete.
1083 (Sized_relobj_file::emit_relocs_reltype): Delete.
1084 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1085 relocate_relocs for --emit-relocs.
1086 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1087 * output.h: Update comment.
1088 (Output_segment::first_section): New function.
1089 (Output_segment::first_section_load_address): Use first_section.
1090 * output.cc (Output_segment::first_section): New function extracted..
1091 (Output_segment::first_section_load_address): ..from here. Delete.
1092 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1093 * target.h (Sized_target::relocate_for_relocatable): Likewise.
1094 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1095 adjust call to target.h function.
1096 * i386.cc (Target_i386): Likewise.
1097 * sparc.cc (Target_sparc): Likewise.
1098 * x86_64.cc (Target_x86_64): Likewise.
1099 * powerpc.cc (Target_powerpc): Likewise.
1100 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
1101 first tls section has section symbol for optimised local dynamic
1102 output relocs.
1103 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1104 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1105 optimised tls code.
1106 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1107 Rename to relocate_relocs. Update error message.
1108
1109 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
1110
1111 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1112 --just-symbols.
1113
1114 2012-08-31 Alan Modra <amodra@gmail.com>
1115
1116 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1117 (Powerpc_relobj::toc_base_offset): New stub function.
1118 (Target_powerpc): Add tp_offset, dtp_offset. Rename
1119 got_mod_index_offset to tlsld_got_offset. Update all refs.
1120 (Target_powerpc::Relocate::enum skip_tls): New.
1121 (Target_powerpc::call_tls_get_addr_): New var.
1122 (Target_powerpc::is_branch_reloc): Move to file scope.
1123 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1124 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1125 New functions.
1126 (Target_powerpc::enum Got_type): Delete old values, add new ones.
1127 (powerpc_info): Correct common_pagesize for ppc64.
1128 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1129 (Powerpc_relocate_functions): Add overflow check enums and functions.
1130 Add non-shift version of rela, rela_ua. Delete all rel public
1131 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
1132 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1133 addr16_ha3, addr14 functions.
1134 (Output_data_got_powerpc::add_constant_pair): New function.
1135 (Output_data_got_powerpc::got_base_offset): Likewise.
1136 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1137 (instruction constants): Sort, add some more.
1138 (Output_data_glink::do_write): Add and use Address typedef. Use
1139 object->toc_base_offset() stub for 64-bit.
1140 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1141 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1142 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1143 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
1144 Always treat .opd relocs as against locally defined symbol.
1145 Correct condition for RELATIVE relocs.
1146 (Target_powerpc::do_finalize_sections): Test for NULL sections.
1147 (Target_powerpc::Relocate::relocate): Use plt call stub as value
1148 for 32-bit syms with a plt entry. Correct ppc64 toc base
1149 calculations. Handle TLS relocs, and more. Add overflow
1150 checking and adjust for Powerpc_relocate_functions changes.
1151 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1152 Reinstate --emit-relocs code with FIXME.
1153
1154 2012-08-30 Alan Modra <amodra@gmail.com>
1155
1156 * layout.cc (Layout::set_segment_offsets): Set p_align to
1157 abi_pagesize, not common_pagesize.
1158 (Layout::relaxation_loop_body): Similarly use abi_pagesize
1159 to determine whether file header can go in segment.
1160
1161 2012-08-30 Alan Modra <amodra@gmail.com>
1162
1163 * output.h (Output_reloc::Output_reloc <output section>): Add
1164 is_relative param. Adjust calls.
1165 (Output_reloc::add_output_section_relative): New functions.
1166 * output.cc (Output_reloc::Output_reloc <output section>): Handle
1167 is_relative.
1168 (Output_reloc::symbol_value): Handle SECTION_CODE.
1169
1170 2012-08-24 Sriraman Tallam <tmsriram@google.com>
1171
1172 * gold.cc (queue_middle_tasks): Call layout again when unique
1173 segments for sections is desired.
1174 * layout.cc (Layout::Layout): Initialize new members.
1175 (Layout::get_output_section_flags): New function.
1176 (Layout::choose_output_section): Call get_output_section_flags.
1177 (Layout::layout): Make output section for mapping to a unique segment.
1178 (Layout::insert_section_segment_map): New function.
1179 (Layout::attach_allocated_section_to_segment): Make unique segment for
1180 output sections marked so.
1181 (Layout::segment_precedes): Check for unique segments when sorting.
1182 * layout.h (Layout::Unique_segment_info): New struct.
1183 (Layout::Section_segment_map): New typedef.
1184 (Layout::insert_section_segment_map): New function.
1185 (Layout::get_output_section_flags): New function.
1186 (Layout::is_unique_segment_for_sections_specified): New function.
1187 (Layout::set_unique_segment_for_sections_specified): New function.
1188 (Layout::unique_segment_for_sections_specified_): New member.
1189 (Layout::section_segment_map_): New member.
1190 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1191 Rename is_gc_pass_one to is_pass_one.
1192 Rename is_gc_pass_two to is_pass_two.
1193 Rename is_gc_or_icf to is_two_pass.
1194 Check for which pass based on whether symbols data is present.
1195 Make it two pass when unique segments for sections is desired.
1196 * output.cc (Output_section::Output_section): Initialize new
1197 members.
1198 * output.h (Output_section::is_unique_segment): New function.
1199 (Output_section::set_is_unique_segment): New function.
1200 (Output_section::is_unique_segment_): New member.
1201 (Output_section::extra_segment_flags): New function.
1202 (Output_section::set_extra_segment_flags): New function.
1203 (Output_section::extra_segment_flags_): New member.
1204 (Output_section::segment_alignment): New function.
1205 (Output_section::set_segment_alignment): New function.
1206 (Output_section::segment_alignment_): New member.
1207 (Output_segment::Output_segment): Initialize is_unique_segment_.
1208 (Output_segment::is_unique_segment): New function.
1209 (Output_segment::set_is_unique_segment): New function.
1210 (Output_segment::is_unique_segment_): New member.
1211 * plugin.cc (allow_unique_segment_for_sections): New function.
1212 (unique_segment_for_sections): New function.
1213 (Plugin::load): Add new functions to transfer vector.
1214 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1215 * Makefile.in: Regenerate.
1216 * testsuite/plugin_final_layout.sh: Check if unique segment
1217 functionality works.
1218 * testsuite/plugin_section_order.c (onload): Check if new interfaces
1219 are available.
1220 (allow_unique_segment_for_sections): New global.
1221 (unique_segment_for_sections): New global.
1222 (claim_file_hook): Call allow_unique_segment_for_sections.
1223 (all_symbols_read_hook): Call unique_segment_for_sections.
1224
1225 2012-08-22 Cary Coutant <ccoutant@google.com>
1226
1227 * layout.cc (Layout::include_section): Don't assert on GROUP
1228 sections with --emit-relocs.
1229
1230 2012-08-21 Cary Coutant <ccoutant@google.com>
1231
1232 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1233 if --export-dynamic-symbol names an undef symbol.
1234
1235 2012-08-18 Alan Modra <amodra@gmail.com>
1236
1237 * powerpc.cc: Formatting and white space.
1238 (Powerpc_relobj): Rename got2_section_ to special_.
1239 Add opd_ent_shndx_ and opd_ent_off_ vectors.
1240 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1241 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1242 (Target_powerpc): Add Address typedef and invalid_address. Use
1243 throughout.
1244 (Target_powerpc::is_branch_reloc): New function.
1245 (Powerpc_relocate_functions): Add Address typedef, use throughout.
1246 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1247 for dst_mask, value and addend.
1248 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1249 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1250 (Output_data_glink::do_write): Correct toc base. Don't try to use
1251 uint16_t for 24-bit offset. Use get_output_section_offset and
1252 check return.
1253 (Target_powerpc::Scan::local): Handle more relocs.
1254 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1255 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1256 Plug in toc restoring insn after plt calls. Translate branches
1257 to function descriptor symbols to corresponding entry point.
1258 (Target_powerpc::relocate_for_relocatable): Check return from
1259 get_output_section_offset.
1260 * symtab.h: Comment typo.
1261
1262 2012-08-14 Ian Lance Taylor <iant@google.com>
1263
1264 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1265 unsupported_relocal_local to call unsupported_reloc_global.
1266
1267 2012-08-14 Nick Clifton <nickc@redhat.com>
1268
1269 PR ld/14265
1270 * script-sections.cc (Sections_element::output_section_name): Add
1271 keep return parameter.
1272 (Output_section_element::match_name): Add keep return parameter.
1273 Return the value of the keep_ member.
1274 * script-sections.h (class Output_section): Update
1275 output_section_name prototype.
1276 * layout.cc (Layout::keep_input_section): New public member
1277 function.
1278 (Layout::choose_output_section): Pass keep parameter to
1279 output_section_name.
1280 * layout.h (class Layout): Add keep_input_section.
1281 * object.cc (Sized_relobj_file::do_layout): Check for kept input
1282 sections.
1283 * testsuite/Makefile.am: Add a test.
1284 * testsuite/Makefile.in: Regenerate.
1285 * testsuite/pr14265.c: Source file for the test.
1286 * testsuite/pr14265.t: Linker script for the test.
1287 * testsuite/pr14265.sh: Shell script for the test.
1288
1289 2012-08-14 Alan Modra <amodra@gmail.com>
1290
1291 * target.h (Target::output_section_name): New function.
1292 (Target::do_output_section_name): New function.
1293 * layout.cc (Layout::choose_output_section): Call the above.
1294 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1295
1296 2012-08-14 Alan Modra <amodra@gmail.com>
1297
1298 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1299 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1300 for replace_constant call.
1301 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1302 (Output_data_glink::do_print_to_mapfile): New function.
1303 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1304 (Target_powerpc::Relocate::relocate): Likewise.
1305
1306 2012-08-14 Alan Modra <amodra@gmail.com>
1307
1308 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1309 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1310 (Output_data_glink::add_entry,find_entry): Remove shndx param.
1311 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
1312 all references to shndx_. Handle special case for R_PPC_PLTREL24
1313 here.
1314 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1315 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1316 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1317 here.
1318 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1319 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1320
1321 2012-08-12 Alan Modra <amodra@gmail.com>
1322
1323 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
1324 (glink insn constants): Use uint32_t.
1325 (Output_data_glink::add_entry): Use insert, not [] operator.
1326
1327 2012-08-11 Alan Modra <amodra@gmail.com>
1328
1329 * object.h (Sized_relobj_file::find_shdr): New function.
1330 (Sized_relobj_file::find_special_sections): New function.
1331 * object.cc (Sized_relobj_file::find_shdr): New function.
1332 (Sized_relobj_file::find_eh_frame): Use find_shdr.
1333 (Sized_relobj_file::find_special_sections): New function, split out..
1334 (Sized_relobj_file::do_read_symbols): ..from here.
1335 * output.h (Output_data_got::replace_constant): New function.
1336 (Output_data_got::num_entries): New function.
1337 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1338 (Output_data_got::got_offset): Protected rather than private.
1339 (Output_data_got::replace_got_entry): New function.
1340 * output.cc (Output_data_got::replace_got_entry): New function.
1341 * powerpc.cc (class Powerpc_relobj): New.
1342 (class Powerpc_relocate_functions): Delete all psymval variants or
1343 convert to value,addend type. Delete pcrela, pcrela_unaligned.
1344 Implement _ha functions using corresponding _hi function.
1345 (Powerpc_relobj::find_special_sections): New function.
1346 (Target_powerpc::do_make_elf_object): New function.
1347 (class Output_data_got_powerpc): New.
1348 (class Output_data_glink): New.
1349 (class Powerpc_scan_relocatable_reloc): New.
1350 Many more changes througout file.
1351
1352 2012-08-09 Nick Clifton <nickc@redhat.com>
1353
1354 * po/vi.po: Updated Vietnamese translation.
1355
1356 2012-08-07 Ian Lance Taylor <iant@google.com>
1357
1358 * layout.cc (Layout::add_target_dynamic_tags): If
1359 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1360 plt_rel.
1361
1362 2012-07-30 Nick Clifton <nickc@redhat.com>
1363
1364 * po/gold.pot: Updated template.
1365 * po/es.po: Updated Spanish translation.
1366
1367 2012-07-18 Cary Coutant <ccoutant@google.com>
1368
1369 PR gold/14344
1370 * configure.ac: Add check for -gpubnames support.
1371 * configure: Regenerate.
1372 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1373 support; force -gno-pubnames.
1374 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1375 support.
1376 (gdb_index_test_4): New test.
1377 * testsuite/Makefile.in: Regenerate.
1378 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1379 * testsuite/gdb_index_test_2.sh: Likewise.
1380 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1381 * testsuite/gdb_index_test_4.sh: New script.
1382 * testsuite/gdb_index_test_comm.sh: New script with common code;
1383 don't look for space after colon.
1384
1385 2012-07-16 Sriraman Tallam <tmsriram@google.com>
1386
1387 * gold.cc (queue_middle_tasks): Update function order only after
1388 deferred objects due to plugins are processed.
1389
1390 2012-07-11 Ian Lance Taylor <iant@google.com>
1391
1392 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1393 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1394 (Target_arm::scan_reloc_for_stub): Likewise.
1395 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1396 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1397 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1398 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1399 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1400
1401 2012-07-10 Dodji Seketeli <dodji@redhat.com>
1402 Ian Lance Taylor <iant@google.com>
1403
1404 PR gold/14309
1405 * configure.ac: Test whether std::tr1::hash<off_t> works.
1406 * gold.h: Add a specialization for std::tr1::hash<off_t> if
1407 needed.
1408 * output.h (class Output_fill): Add virtual destructor.
1409 * configure, config.in: Rebuild.
1410
1411 2012-06-22 Roland McGrath <mcgrathr@google.com>
1412
1413 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1414
1415 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
1416
1417 * plugin.cc (Plugin::load): Handle position independent executables.
1418
1419 2012-06-06 Cary Coutant <ccoutant@google.com>
1420
1421 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1422 add .debug_macro.
1423 (lines_only_debug_sections): Likewise.
1424 (gdb_fast_lookup_sections): New static array.
1425 (is_gdb_debug_section): Rename formal parameter.
1426 (is_lines_only_debug_section): Likewise.
1427 (is_gdb_fast_lookup_section): New function.
1428 (Layout::include_section): Check for ".zdebug_" prefix; pass
1429 section name suffix to is_gdb_debug_section, et al.; check for
1430 fast-lookup sections when building .gdb_index.
1431 * options.h (--strip-debug-gdb): Update GDB version number.
1432
1433 2012-06-06 Cary Coutant <ccoutant@google.com>
1434
1435 * configure.ac: Add check for fallocate.
1436 * configure: Regenerate.
1437 * config.in: Regenerate.
1438
1439 * options.h (class General_options): Add --mmap-output-file and
1440 --posix-fallocate options.
1441 * output.cc: (posix_fallocate): Remove; replace with...
1442 (gold_fallocate): New function.
1443 (Output_file::map_no_anonymous): Call gold_fallocate.
1444 (Output_file::map): Check --mmap-output-file option.
1445
1446 2012-06-05 Jing Yu <jingyu@google.com>
1447
1448 * gold.h (textdomain): Add do {} to empty while(0).
1449 (bindtextdomain): Likewise.
1450
1451 2012-06-04 Cary Coutant <ccoutant@google.com>
1452
1453 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1454 has_dynsym_index.
1455
1456 2012-05-25 Sriraman Tallam <tmsriram@google.com>
1457
1458 * symtab.cc (Symbol_table::define_special_symbol):
1459 Initialize *poldsym to prevent uninitialized variable errors.
1460
1461 2012-05-23 Cary Coutant <ccoutant@google.com>
1462
1463 * layout.cc (Layout::section_name_mapping): Add rules to handle
1464 exact match on .data.rel.ro.local or .data.rel.ro.
1465 (Layout::output_section_name): Check for exact matches.
1466
1467 2012-05-23 Cary Coutant <ccoutant@google.com>
1468
1469 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1470 more carefully.
1471
1472 2012-05-22 Cary Coutant <ccoutant@google.com>
1473
1474 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1475 object before exporting symbol.
1476
1477 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
1478
1479 * testsuite/tls_test.cc: Include "config.h" first.
1480 * testsuite/tls_test_c.c: Likewise.
1481
1482 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
1483 Nick Clifton <nickc@redhat.com>
1484
1485 PR 14072
1486 * configure.in: Add check that sysdep.h has been included before
1487 any system header files.
1488 * configure: Regenerate.
1489 * config.in: Regenerate.
1490
1491 2012-05-14 Cary Coutant <ccoutant@google.com>
1492
1493 * layout.cc (Layout::make_output_section): Mark .tdata section
1494 as RELRO.
1495 * testsuite/relro_test.cc: Add a TLS variable.
1496
1497 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
1498
1499 PR gold/14091
1500 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1501 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1502 R_X86_64_64.
1503
1504 2012-05-08 Cary Coutant <ccoutant@google.com>
1505
1506 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1507 (lines_only_debug_sections): Likewise.
1508
1509 2012-05-02 Roland McGrath <mcgrathr@google.com>
1510
1511 * nacl.cc: New file.
1512 * nacl.h: New file.
1513 * Makefile.am (CCFILES, HFILES): Add them.
1514 * Makefile.in: Regenerate.
1515 * i386.cc (Output_data_plt_i386_nacl): New class.
1516 (Output_data_plt_i386_nacl_exec): New class.
1517 (Output_data_plt_i386_nacl_dyn): New class.
1518 (Target_i386_nacl): New class.
1519 (Target_selector_i386_nacl): New class.
1520 (target_selector_i386): Use it instead of Target_selector_i386.
1521 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1522 (Target_x86_64_nacl): New class.
1523 (Target_selector_x86_64_nacl): New class.
1524 (target_selector_x86_64, target_selector_x32): Use it instead of
1525 Target_selector_x86_64.
1526 * arm.cc (Output_data_plt_arm_nacl): New class.
1527 (Target_arm_nacl): New class.
1528 (Target_selector_arm_nacl): New class.
1529 (target_selector_arm, target_selector_armbe): Use it instead of
1530 Target_selector_arm.
1531
1532 * target-select.cc (select_target): Take new Input_file* and off_t
1533 arguments, pass them on to recognize method of selector.
1534 * object.cc (make_elf_sized_object): Update caller.
1535 * parameters.cc (parameters_force_valid_target): Likewise.
1536 * incremental.cc (make_sized_incremental_binary): Likewise.
1537 * target-select.h: Update decl.
1538 (Target_selector::recognize): Take new Input_file* argument,
1539 pass it on to do_recognize.
1540 (Target_selector::do_recognize): Take new Input_file* argument.
1541 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1542 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1543 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1544 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1545
1546 * target.h (Target::Target_info): New members isolate_execinstr
1547 and rosegment_gap.
1548 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1549 * arm.cc (Target_arm::arm_info): Update initializer.
1550 * i386.cc (Target_i386::i386_info): Likewise.
1551 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1552 * sparc.cc (Target_sparc::sparc_info): Likewise.
1553 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1554 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1555 * layout.cc (Layout::attach_allocated_section_to_segment):
1556 Take new const Target* argument. If target->isolate_execinstr(), act
1557 like --rosegment.
1558 (Layout::find_first_load_seg): Take new const Target* argument;
1559 if target->isolate_execinstr(), reject PF_X segments.
1560 (Layout::relaxation_loop_body): Update caller.
1561 (Layout::set_segment_offsets): If target->isolate_execinstr(),
1562 reset file offset to zero when we hit LOAD_SEG, and then do a second
1563 loop over the segments before LOAD_SEG to reassign offsets after
1564 addresses have been determined. Handle target->rosegment_gap().
1565 (Layout::attach_section_to_segment): Take new const Target* argument;
1566 pass it to attach_allocated_section_to_segment.
1567 (Layout::make_output_section): Update caller.
1568 (Layout::attach_sections_to_segments): Take new const Target* argument;
1569 pass it to attach_section_to_segment.
1570 * gold.cc (queue_middle_tasks): Update caller.
1571 * layout.h (Layout): Update method decls with new arguments.
1572
1573 * arm.cc (Target_arm::Target_arm): Take optional argument for the
1574 Target_info pointer to use.
1575 (Target_arm::do_make_data_plt): New virtual method.
1576 (Target_arm::make_data_plt): New method that calls it.
1577 (Target_arm::make_plt_entry): Use it.
1578 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1579 for the section alignment.
1580 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1581 method.
1582 (Output_data_plt_arm::first_plt_entry_offset): Call it.
1583 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1584 method.
1585 (Output_data_plt_arm::get_plt_entry_size): Call it.
1586 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1587 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1588 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1589 method.
1590 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1591 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1592 method instead of sizeof(plt_entry).
1593 (Output_data_plt_arm::add_entry): Likewise.
1594 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1595 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1596 than static method.
1597 (Target_arm::plt_entry_size): Likewise.
1598 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1599 Move to ...
1600 (Output_data_plt_arm_standard): ... here, new class.
1601 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1602 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1603 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1604
1605 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1606 Take additional argument for the PLT entry size.
1607 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1608 Use get_plt_entry_size method rather than plt_entry_size variable.
1609 (Output_data_plt_x86_64::reserve_slot): Likewise.
1610 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1611 (Output_data_plt_x86_64::add_entry): Likewise.
1612 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1613 (Output_data_plt_x86_64::address_for_global): Likewise.
1614 (Output_data_plt_x86_64::address_for_local): Likewise.
1615 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1616 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1617 Make method non-static.
1618 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1619 method.
1620 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1621 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1622 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1623 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1624 virtual method.
1625 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1626 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1627 virtual method.
1628 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1629 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1630 virtual method.
1631 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1632 (Output_data_plt_x86_64::plt_entry_size)
1633 (Output_data_plt_x86_64::first_plt_entry)
1634 (Output_data_plt_x86_64::plt_entry)
1635 (Output_data_plt_x86_64::tlsdesc_plt_entry)
1636 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1637 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1638 (Output_data_plt_x86_64_standard): ... here, new class.
1639 (Target_x86_64::Target_x86_64): Take optional argument for the
1640 Target_info pointer to use.
1641 (Target_x86_64::do_make_data_plt): New virtual method.
1642 (Target_x86_64::make_data_plt): New method to call it.
1643 (Target_x86_64::init_got_plt_for_update): Use that.
1644 Call this->plt_->add_eh_frame method here.
1645 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1646 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1647 rather than static method.
1648 (Target_x86_64::plt_entry_size): Likewise.
1649 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1650 rather than plt_entry_size variable. Move guts of PLT filling to...
1651 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1652 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1653 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1654
1655 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1656 additional argument for the section alignment.
1657 Don't do add_eh_frame_for_plt here.
1658 (Output_data_plt_i386::first_plt_entry_offset): Make the method
1659 non-static. Use get_plt_entry_size method rather than plt_entry_size
1660 variable.
1661 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1662 method.
1663 (Output_data_plt_i386::get_plt_entry_size): Call it.
1664 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1665 (Output_data_plt_i386::add_eh_frame): New method to call it.
1666 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1667 method.
1668 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1669 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1670 method.
1671 (Output_data_plt_i386::fill_plt_entry): New method to call it.
1672 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1673 method instead of plt_entry_size.
1674 (Output_data_plt_i386::plt_entry_size)
1675 (Output_data_plt_i386::plt_eh_frame_fde_size)
1676 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1677 (Output_data_plt_i386_standard): ... here, new class.
1678 (Output_data_plt_i386_exec): New class.
1679 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1680 (Output_data_plt_i386_exec::first_plt_entry): ... here.
1681 (Output_data_plt_i386::exec_plt_entry): Move to ...
1682 (Output_data_plt_i386_exec::plt_entry): ... here.
1683 (Output_data_plt_i386_dyn): New class.
1684 (Output_data_plt_i386::first_plt_entry): Move to ...
1685 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1686 (Output_data_plt_i386::dyn_plt_entry): Move to ...
1687 (Output_data_plt_i386_dyn::plt_entry): ... here.
1688 (Target_i386::Target_i386): Take optional argument for the Target_info
1689 pointer to use.
1690 (Target_i386::do_make_data_plt): New virtual method.
1691 (Target_i386::make_data_plt): New method to call it.
1692 (Target_i386::make_plt_section): Use that.
1693 Call this->plt_->add_eh_frame method here.
1694 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1695 rather than plt_entry_size variable.
1696 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1697 (Output_data_plt_i386::address_for_local): Likewise.
1698 (Output_data_plt_i386::do_write): Likewise.
1699 Move guts of PLT filling to...
1700 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1701 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1702 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1703 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1704
1705 2012-05-01 Cary Coutant <ccoutant@google.com>
1706
1707 * dwarf_reader.cc (Dwarf_die::read_attributes)
1708 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1709 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1710 * reduced_debug_output.cc
1711 (Output_reduced_debug_info_section::get_die_end): Remove
1712 DW_FORM_GNU_ref_index. Add default case.
1713
1714 2012-04-26 Mark Wielaard <mjw@redhat.com>
1715
1716 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1717 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1718 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1719 DW_AT_high_pc as offset from DW_AT_low_pc.
1720
1721 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1722 * testsuite/Makefile.in: Regenerate.
1723 * testsuite/gdb_index_test_3.c: New test source file.
1724 * testsuite/gdb_index_test_3.sh: New test source file.
1725
1726 2012-04-25 Ian Lance Taylor <iant@google.com>
1727
1728 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1729 pointer.
1730 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1731 as a class, not a struct.
1732 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1733 (Target_arm::apply_cortex_a8_workaround): Likewise.
1734 * gc.h: Declare Reloc_types as a struct, not a class.
1735 * object.h: Declare Symbols_data as a struct.
1736 * reloc.h: Declare Read_relocs_data as a struct.
1737 * target.h: Declare Relocate_info as a struct.
1738
1739 2012-04-24 David S. Miller <davem@davemloft.net>
1740
1741 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1742 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1743 and R_SPARC_WPLT30.
1744
1745 2012-04-24 Cary Coutant <ccoutant@google.com>
1746
1747 * incremental-dump.cc (find_input_containing_global): Replace
1748 magic number with symbolic constant.
1749 (dump_incremental_inputs): Update version number.
1750 * incremental.cc (Output_section_incremental_inputs): Update version
1751 number; import symbolic constants from Incremental_inputs_reader.
1752 (Incremental_inputs::create_data_sections): Align relocations
1753 section correctly for 64-bit targets.
1754 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1755 constants; add padding.
1756 (Output_section_incremental_inputs::write_header): Add assert for
1757 header_size.
1758 (Output_section_incremental_inputs::write_input_files): Add assert
1759 for input_entry_size.
1760 (Output_section_incremental_inputs::write_info_blocks): Add padding;
1761 add assert for object_info_size, input_section_entry_size,
1762 global_sym_entry_size.
1763 * incremental.h (Incremental_inputs_reader): Add symbolic constants
1764 for data structure sizes; use them.
1765 (Incremental_input_entry_reader): Import symbolic constants from
1766 Incremental_inputs_reader; use them.
1767
1768 2012-04-23 David S. Miller <davem@davemloft.net>
1769
1770 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1771 and elf_flags_set_.
1772 (Target_sparc::Target_sparc): Initialize new fields.
1773 (Target_sparc::do_make_elf_object): New function.
1774 (Target_sparc::do_adjust_elf_header): New function.
1775
1776 2012-04-23 Cary Coutant <ccoutant@google.com>
1777
1778 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1779 CU range table of gdb index.
1780
1781 2012-04-20 David S. Miller <davem@davemloft.net>
1782
1783 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1784 instead of false.
1785
1786 2012-04-16 David S. Miller <davem@davemloft.net>
1787
1788 * sparc.cc (Target_sparc::got_address): New function.
1789 (Sparc_relocate_functions::gdop_hix22): New function.
1790 (Sparc_relocate_functions::gdop_lox10): New function.
1791 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1792 relocs.
1793 (Target_sparc::Scan::local): Likewise if the global symbol is not
1794 preemptible and is not IFUNC.
1795 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1796 transformations for local and non-preemptible non-IFUNC global
1797 symbols.
1798
1799 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1800 writing out 64-bit part of ranges.
1801
1802 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1803 -fpic and -fpie respectively.
1804 * Makefile.in: Regenerate.
1805
1806 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1807 (Target_sparc::Target_sparc): Initialize new field.
1808 (Target_sparc::do_plt_section_for_global): New function.
1809 (Target_sparc::do_plt_section_for_local): New function.
1810 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1811 (Target_sparc::make_plt_section): New function, broken out of
1812 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1813 (Target_sparc::make_plt_entry): Call make_plt_section.
1814 (Target_sparc::make_local_ifunc_plt_entry): New function.
1815 (Target_sparc::rela_ifunc_section): New function.
1816 (Target_sparc::plt_section): Remove const.
1817 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1818 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1819 and ifunc_count_ fields.
1820 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1821 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1822 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1823 (Output_data_plt_sparc::rela_ifunc): New function.
1824 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1825 (Output_data_plt_sparc::has_ifunc_section): New function.
1826 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1827 (Output_data_plt_sparc::address_for_global): New function.
1828 (Output_data_plt_sparc::address_for_local): New function.
1829 (Output_data_plt_sparc::plt_index_to_offset): New function.
1830 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1831 and entry_count.
1832 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1833 entry_count.
1834 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1835 R_SPARC_JMP_IREL to switch.
1836 (Target_sparc::Scan::check_non_pic): Likewise.
1837 (Target_sparc::Scan::local): Handle IFUNC symbols.
1838 (Target_sparc::Scan::local): Likewise.
1839 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1840 and plt_address_for_local.
1841 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1842 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1843
1844 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1845 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1846 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1847 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1848 global relocs too.
1849 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1850 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1851 calls.
1852 * sparc.cc (Target_sparc::Scan::global): Likewise.
1853 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1854
1855 2012-04-16 Cary Coutant <ccoutant@google.com>
1856
1857 * archive.cc (Library_base::should_include_member): Check for
1858 --export-dynamic-symbol.
1859 * options.h (class General_options): Add --export-dynamic-symbol.
1860 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1861 --export-dynamic-symbol.
1862 (Symbol_table::gc_mark_undef_symbols): Likewise.
1863 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1864
1865 2012-04-12 David S. Miller <davem@davemloft.net>
1866
1867 * sparc.cc (Reloc::wdisp10): New relocation method.
1868 (Reloc::h34): Likewise.
1869 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1870 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1871 R_SPARC_WDISP10.
1872 (Target_sparc::Scan::local): Likewise.
1873 (Target_sparc::Scan::global): Likewise.
1874 (Target_sparc::Relocate::relocate): Likewise.
1875
1876 2012-04-09 Cary Coutant <ccoutant@google.com>
1877
1878 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1879 low_pc == 0.
1880
1881 2012-04-06 Ian Lance Taylor <iant@google.com>
1882
1883 * timer.cc: #include <unistd.h>.
1884
1885 2012-04-06 Roland McGrath <mcgrathr@google.com>
1886
1887 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1888 * config.in: Regenerate.
1889 * configure: Regenerate.
1890
1891 2012-04-05 Nick Clifton <nickc@redhat.com>
1892
1893 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1894 (AM_LC_MESSAGES): Add.
1895 * aclocal.m4: Regenerate.
1896 * config.in: Regenerate.
1897 * configure: Regenerate.
1898
1899 2012-03-21 Cary Coutant <ccoutant@google.com>
1900
1901 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1902 * Makefile.in: Regenerate.
1903 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1904 (Sized_elf_reloc_mapper::symbol_section): New function.
1905 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1906 (make_elf_reloc_mapper): New function.
1907 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1908 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1909 (Dwarf_abbrev_table::do_get_abbrev): New function.
1910 (Dwarf_ranges_table::read_ranges_table): New function.
1911 (Dwarf_ranges_table::read_range_list): New function.
1912 (Dwarf_pubnames_table::read_section): New function.
1913 (Dwarf_pubnames_table::read_header): New function.
1914 (Dwarf_pubnames_table::next_name): New function.
1915 (Dwarf_die::Dwarf_die): New function.
1916 (Dwarf_die::read_attributes): New function.
1917 (Dwarf_die::skip_attributes): New function.
1918 (Dwarf_die::set_name): New function.
1919 (Dwarf_die::set_linkage_name): New function.
1920 (Dwarf_die::attribute): New function.
1921 (Dwarf_die::string_attribute): New function.
1922 (Dwarf_die::int_attribute): New function.
1923 (Dwarf_die::uint_attribute): New function.
1924 (Dwarf_die::ref_attribute): New function.
1925 (Dwarf_die::child_offset): New function.
1926 (Dwarf_die::sibling_offset): New function.
1927 (Dwarf_info_reader::check_buffer): New function.
1928 (Dwarf_info_reader::parse): New function.
1929 (Dwarf_info_reader::do_parse): New function.
1930 (Dwarf_info_reader::do_read_string_table): New function.
1931 (Dwarf_info_reader::lookup_reloc): New function.
1932 (Dwarf_info_reader::get_string): New function.
1933 (Dwarf_info_reader::visit_compilation_unit): New function.
1934 (Dwarf_info_reader::visit_type_unit): New function.
1935 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1936 Sized_elf_reloc_mapper.
1937 (Sized_dwarf_line_info::symbol_section): Remove function.
1938 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1939 (Sized_dwarf_line_info::read_line_mappings): Remove object
1940 parameter, adjust callers.
1941 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1942 * dwarf_reader.h: Include <sys/types.h>.
1943 (class Track_relocs): Remove forward declaration.
1944 (class Elf_reloc_mapper): New class.
1945 (class Sized_elf_reloc_mapper): New class.
1946 (class Dwarf_abbrev_table): New class.
1947 (class Dwarf_range_list): New class.
1948 (class Dwarf_ranges_table): New class.
1949 (class Dwarf_pubnames_table): New class.
1950 (class Dwarf_die): New class.
1951 (class Dwarf_info_reader): New class.
1952 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1953 (Sized_dwarf_line_info::symbol_section): Remove member function.
1954 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1955 base class.
1956 * gdb-index.cc: New source file.
1957 * gdb-index.h: New source file.
1958 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1959 and .debug_types sections, call Layout::add_to_gdb_index.
1960 (Sized_relobj_incr::do_section_name): Implement.
1961 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1962 return type; Implement.
1963 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1964 return type.
1965 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1966 parameter list and return type.
1967 (Sized_incr_dynobj::do_section_contents): Likewise.
1968 * layout.cc: Include gdb-index.h.
1969 (Layout::Layout): Initialize gdb_index_data_.
1970 (Layout::init_fixed_output_section): Check for .gdb_index section.
1971 (Layout::add_to_gdb_index): New function. Instantiate.
1972 * layout.h: Add forward declaration for class Gdb_index.
1973 (Layout::add_to_gdb_index): New member function.
1974 (Layout::gdb_index_data_): New data member.
1975 * main.cc: Include gdb-index.h.
1976 (main): Print statistics for gdb index.
1977 * object.cc (Object::section_contents): Move code into
1978 do_section_contents.
1979 (need_decompressed_section): Check for sections needed when building
1980 gdb index.
1981 (build_compressed_section_map): Likewise.
1982 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1983 gdb index.
1984 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1985 sections; call Layout::add_to_gdb_index.
1986 (Sized_relobj_file::do_decompressed_section_contents): Call
1987 do_section_contents directly.
1988 * object.h (Object::do_section_contents): Adjust parameter list and
1989 return type.
1990 (Object::do_decompressed_section_contents): Call do_section_contents
1991 directly.
1992 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1993 return type.
1994 * options.h (class General_options): Add --gdb-index option.
1995 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1996 list and return type.
1997 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1998 * reloc.h (Track_relocs::checkpoint): New function.
1999 (Track_relocs::reset): New function.
2000
2001 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2002 New test cases.
2003 * testsuite/Makefile.in: Regenerate.
2004 * testsuite/gdb_index_test.cc: New test source file.
2005 * testsuite/gdb_index_test_1.sh: New test source file.
2006 * testsuite/gdb_index_test_2.sh: New test source file.
2007
2008 2012-03-19 Doug Kwan <dougkwan@google.com>
2009
2010 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2011 (Target_arm::do_finalize_sections): Remove code which defines
2012 __exidx_start and __exidx_end. Make symbol table parameter
2013 anonymous as it is not used.
2014 * gold.cc (queue_middle_tasks): Call target hook to define any
2015 target-specific symbols.
2016 * target.h (Target::define_standard_symbols): New method.
2017 (Target::do_define_standard_symbols): Same.
2018 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2019 * testsuite/Makefile.in: Regenerate.
2020 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2021 and __exidx_end.
2022 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2023 relocations are generated for __exidx_start and __exidx_end.
2024
2025 2012-03-16 Doug Kwan <dougkwan@google.com>
2026
2027 * testsuite/Makefile.am: Disable test initpri3b.
2028 * testsuite/Makefile.in: Regenerate.
2029
2030 2012-03-15 Doug Kwan <dougkwan@google.com>
2031
2032 * arm.cc (Target_arm::got_section): Make .got section read-only
2033 if -z now is given.
2034
2035 2012-03-15 Ian Lance Taylor <iant@google.com>
2036
2037 PR gold/13850
2038 * layout.cc (Layout::make_output_section): Correctly mark
2039 SHT_INIT_ARRAY, et. al., as relro.
2040
2041 2012-03-14 Doug Kwan <dougkwan@google.com>
2042
2043 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2044 dynamic relocations for protected symbols in shared objects.
2045
2046 2012-03-13 Ian Lance Taylor <iant@google.com>
2047
2048 * resolve.cc (Symbol_table::resolve): When merging common symbols,
2049 keep the larger alignment.
2050
2051 2012-03-12 Cary Coutant <ccoutant@google.com>
2052
2053 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2054 handling of DW_LNE_define_file.
2055
2056 2012-03-12 Cary Coutant <ccoutant@google.com>
2057
2058 * reduced_debug_output.cc
2059 (Output_reduced_debug_info_section::get_die_end): Add new FORM
2060 codes to switch.
2061
2062 2012-02-29 Cary Coutant <ccoutant@google.com>
2063
2064 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2065
2066 2012-02-29 Cary Coutant <ccoutant@google.com>
2067
2068 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2069 Call Object::decompressed_section_contents.
2070 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2071 New dtor.
2072 (Sized_dwarf_line_info::buffer_start_): New data member.
2073 * merge.cc (Output_merge_data::do_add_input_section): Call
2074 Object::decompressed_section_contents.
2075 (Output_merge_string::do_add_input_section): Likewise.
2076 * object.cc (need_decompressed_section): New function.
2077 (build_compressed_section_map): Decompress sections needed later.
2078 (Sized_relobj_file::do_decompressed_section_contents): New function.
2079 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2080 * object.h (Object::decompressed_section_contents): New function.
2081 (Object::discard_decompressed_sections): New function.
2082 (Object::do_decompressed_section_contents): New function.
2083 (Object::do_discard_decompressed_sections): New function.
2084 (Compressed_section_info): New type.
2085 (Compressed_section_map): Include decompressed section contents.
2086 (Sized_relobj_file::do_decompressed_section_contents): New function.
2087 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2088
2089 2012-02-16 Cary Coutant <ccoutant@google.com>
2090
2091 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2092 * testsuite/Makefile.in: Regenerate.
2093
2094 2012-02-14 Cary Coutant <ccoutant@google.com>
2095
2096 * options.cc (General_options::finalize): Disallow -pie and -static.
2097
2098 2012-02-03 Doug Kwan <dougkwan@google.com>
2099
2100 * arm.cc (Arm_relocate_functions::abs8,
2101 Arm_relocate_functions::abs16): Use
2102 Bits::has_signed_unsigned_overflow32.
2103 (Arm_relocate_functions::thm_abs8): Correct range of
2104 overflow check.
2105 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2106 in assertions.
2107
2108 2012-02-02 Doug Kwan <dougkwan@google.com>
2109
2110 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2111 position independent outputs, not just shared objects.
2112
2113 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
2114
2115 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2116 * configure: Regenerated.
2117
2118 2012-01-27 Ian Lance Taylor <iant@google.com>
2119
2120 * reloc.h (Bits): New class with static functions, copied from
2121 namespace utils in arm.cc.
2122 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
2123 instead.
2124
2125 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2126
2127 * incremental.cc (write_info_blocks): Correct relocation offset.
2128
2129 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2130
2131 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2132 (Relocate::tls_gd_to_le): Likewise.
2133
2134 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2135
2136 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2137
2138 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2139
2140 * configure.ac: Check if -mcmodel=medium works.
2141 * configure: Regenerated.
2142
2143 2012-01-24 Cary Coutant <ccoutant@google.com>
2144
2145 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2146 definition and ...
2147 (read_unsigned_LEB_128_x): ... this new function.
2148 (read_signed_LEB_128): Replaced with inline definition and ...
2149 (read_signed_LEB_128_x): ... this new function.
2150 * int_encoding.h (read_unsigned_LEB_128_x): New function.
2151 (read_unsigned_LEB_128): Add inline definition.
2152 (read_signed_LEB_128_x): New function.
2153 (read_signed_LEB_128): Add inline definition.
2154 * testsuite/Makefile.am (leb128_unittest): New unit test.
2155 * testsuite/Makefile.in: Regenerate.
2156 * testsuite/leb128_unittest.cc: New unit test.
2157
2158 2012-01-23 Ian Lance Taylor <iant@google.com>
2159
2160 PR gold/13617
2161 * i386.cc (Target_i386::do_code_fill): When using a jmp
2162 instruction, pad with nop instructions.
2163 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2164
2165 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
2166
2167 * x86_64.cc (gc_process_relocs): Add typename on types used in
2168 template.
2169 (scan_relocs): Likewise.
2170 (relocate_section): Likewise.
2171 (apply_relocation): Likewise.
2172
2173 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
2174
2175 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2176 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2177 under x32.
2178
2179 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
2180
2181 * x86_64.cc: Initial support for x32.
2182
2183 2012-01-03 Cary Coutant <ccoutant@google.com>
2184
2185 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2186 Use abstract base class for GOT.
2187 * gold/output.h (class Output_data_got_base): New abstract base class.
2188 (class Output_data_got): Derive from new base class, adjust ctors.
2189 (Output_data_got::reserve_slot): Make virtual; rename to
2190 do_reserve_slot; Adjust callers.
2191 * gold/target.h (Sized_target::init_got_plt_for_update): Return
2192 pointer to abstract base class.
2193 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2194
2195 2011-12-18 Ian Lance Taylor <iant@google.com>
2196
2197 * object.h (Relobj::local_symbol_value): New function.
2198 (Relobj::local_plt_offset): New function.
2199 (Relobj::local_has_got_offset): New function.
2200 (Relobj::local_got_offset): New function.
2201 (Relobj::set_local_got_offset): New function.
2202 (Relobj::do_local_symbol_value): New pure virtual function.
2203 (Relobj::do_local_plt_offset): Likewise.
2204 (Relobj::do_local_has_got_offset): Likewise.
2205 (Relobj::do_local_got_offset): Likewise.
2206 (Relobj::do_set_local_got_offset): Likewise.
2207 (Sized_relobj::do_local_has_got_offset): Rename from
2208 local_has_got_offset.
2209 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2210 (Sized_relobj::do_set_local_got_offset): Rename from
2211 set_local_got_offset.
2212 (Sized_relobj_file::do_local_plt_offset): Rename from
2213 local_plt_offset.
2214 (Sized_relobj_file::do_local_symbol_value): New function.
2215 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2216 local_plt_offset.
2217 * output.cc (Output_data_got::Got_entry::write): Change object to
2218 Relobj. Use local_symbol_value.
2219 (Output_data_got::add_global_with_rel): Change rel_dyn to
2220 Output_data_reloc_generic*. Use add_global_generic.
2221 (Output_data_got::add_global_with_rela): Remove. Change all
2222 callers to use add_global_with_rel.
2223 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2224 Output_data_reloc_generic*. Use add_global_generic.
2225 (Output_data_got::add_global_pair_with_rela): Remove. Change all
2226 callers to use add_global_pair_with_rel.
2227 (Output_data_got::add_local): Change object to Relobj*.
2228 (Output_data_got::add_local_plt): Likewise.
2229 (Output_data_got::add_local_with_rel): Change object to Relobj*,
2230 change rel_dyn to Output_data_reloc_generic*. Use
2231 add_local_generic.
2232 (Output_data_got::add_local_with_rela): Remove. Change all
2233 callers to use all_local_with_rel.
2234 (Output_data_got::add_local_pair_with_rel): Change object to
2235 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
2236 add_output_section_generic.
2237 (Output_data_got::add_local_pair_with_rela): Remove. Change all
2238 callers to use add_local_pair_with_rel.
2239 (Output_data_got::reserve_local): Change object to Relobj*.
2240 * output.h: (class Output_data_reloc_generic): Add pure virtual
2241 declarations for add_global_generic, add_local_generic,
2242 add_output_section_generic.
2243 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2244 functions for Output_data_reloc_generic. Update declarations for
2245 changes listed in output.cc.
2246 (class Output_data_got): Change template parameter to got_size.
2247 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
2248 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2249 function.
2250 (Sized_relobj_incr::do_local_plt_offset): New function.
2251 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2252 add_global_generic.
2253
2254 2011-12-17 Cary Coutant <ccoutant@google.com>
2255
2256 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2257 * resolve.cc (Symbol_table::resolve): Likewise.
2258 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2259 arrays.
2260 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2261
2262 2011-12-16 Ian Lance Taylor <iant@google.com>
2263
2264 * output.h (Output_data_reloc_generic::add): Only call
2265 add_dynamic_reloc if this is a dynamic reloc section.
2266
2267 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
2268
2269 PR gold/13505
2270 * target-reloc.h (apply_relocation): Replace <64, false> with
2271 <size, big_endian>.
2272
2273 2011-11-25 Nick Clifton <nickc@redhat.com>
2274
2275 * po/it.po: New Italian translation.
2276
2277 2011-11-17 Sterling Augustine <saugustine@google.com>
2278
2279 * script.cc (script_include_directive): Implement.
2280 (read_script_file): New local variables name and search_path. Update
2281 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2282 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2283 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2284
2285 2011-11-11 Sterling Augustine <saugustine@google.com>
2286
2287 * yyscript.y (section_cmd): Add support for INCLUDE directive.
2288 (file_or_sections_cmd): Likewise.
2289
2290 2011-11-11 Doug Kwan <dougkwan@google.com>
2291
2292 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2293 if --just-symbols is given.
2294
2295 2011-11-10 Doug Kwan <dougkwan@google.com>
2296
2297 PR gold/13362
2298 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2299 when processing data relocs.
2300 * reloc.h (Relocate_functions::rel_unaligned): New method.
2301 (Relocate_functions::pcrel_unaligned): Ditto.
2302 (Relocate_functions::rel32_unaligned): Ditto.
2303 (Relocate_functions::pcrel32_unaligned): Ditto.
2304
2305 2011-11-09 Doug Kwan <dougkwan@google.com>
2306
2307 PR gold/13362
2308 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2309 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2310 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2311 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2312 (Relocate_functions::rel_unaligned): New.
2313 (Relocate_functions::rel32_unaligned): New.
2314 * target-reloc.h (relocate_for_relocatable): Add code to handle
2315 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2316 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2317 arm_unaligned_reloc_r): New targets.
2318 * testsuite/Makefile.in: Regenerate.
2319 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2320 linking.
2321
2322 2011-11-02 Ian Lance Taylor <iant@google.com>
2323
2324 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
2325 NATIVE_LINKER.
2326 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2327 * options.cc (General_options::finalize): Use library search path
2328 from configure script if specified. If not native and no sysroot,
2329 only search TOOLLIBDIR.
2330 * options.h (Search_directory::Search_directory): Change name to
2331 const std::string&.
2332 (General_options::add_to_library_path_with_sysroot): Change arg to
2333 const std::string&.
2334 * configure, Makefile.in, config.in: Rebuild.
2335
2336 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2337
2338 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2339 we are working around the ARM1176 Erratum.
2340 * options.h (General_options::fix_arm1176): Add option.
2341 * testsuite/Makefile.am: Add testcases, and keep current ones
2342 working.
2343 * testsuite/Makefile.in: Regenerate.
2344 * testsuite/arm_fix_1176.s: New file.
2345 * testsuite/arm_fix_1176.sh: Likewise.
2346
2347 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2348
2349 * arm.cc (Target_arm::Target_arm): Remove initialisation of
2350 may_use_blx_.
2351 (Target_arm::may_use_blx): Remove method.
2352 (Target_arm::set_may_use_blx): Likewise.
2353 (Target_arm::may_use_v4t_interworking): New method.
2354 (Target_arm::may_use_v5t_interworking): Likewise.
2355 (Target_arm::may_use_blx_): Remove member variable.
2356 (Arm_relocate_functions::arm_branch_common): Check for v5T
2357 interworking.
2358 (Arm_relocate_functions::thumb_branch_common): Likewise.
2359 (Reloc_stub::stub_type_for_reloc): Likewise.
2360 (Target_arm::do_finalize_sections): Correct interworking checks.
2361 * testsuite/Makefile.am: Add new tests.
2362 * testsuite/Makefile.in: Regenerate.
2363 * testsuite/arm_farcall_arm_arm.s: New test.
2364 * testsuite/arm_farcall_arm_arm.sh: Likewise.
2365 * testsuite/arm_farcall_arm_thumb.s: Likewise.
2366 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2367 * testsuite/arm_farcall_thumb_arm.s: Likewise.
2368 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2369 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2370 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2371
2372 2011-10-31 Cary Coutant <ccoutant@google.com>
2373
2374 PR gold/13023
2375 * expression.cc (Expression::eval_with_dot): Add
2376 is_section_dot_assignment parameter.
2377 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
2378 absolute and assigning to dot within a section.
2379 * script-sections.cc
2380 (Output_section_element_assignment::set_section_addresses): Pass
2381 dot_section to set_if_absolute.
2382 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2383 as is_section_dot_assignment flag to eval_with_dot.
2384 (Output_section_element_dot_assignment::set_section_addresses):
2385 Likewise.
2386 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2387 parameter. Also set value if relative to dot_section; set the
2388 symbol's output_section.
2389 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2390 parameter. Adjust all callers.
2391 (Expression::eval_maybe_dot): Likewise.
2392 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2393 Adjust all callers.
2394 * testsuite/script_test_2.t: Test assignment of an absolute value
2395 to dot within an output section element.
2396
2397 2011-10-31 Cary Coutant <ccoutant@google.com>
2398
2399 * options.h (class General_options): Add --[no-]gnu-unique options.
2400 * symtab.cc (Symbol_table::sized_write_globals): Convert
2401 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2402
2403 2011-10-31 Cary Coutant <ccoutant@google.com>
2404
2405 PR gold/13359
2406 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2407 unnecessary assertion.
2408 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2409
2410 2011-10-31 Sriraman Tallam <tmsriram@google.com>
2411
2412 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2413 gc_mark_symbol.
2414 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2415 gc_mark_symbol.
2416 Change to just keep the section associated with symbol.
2417 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2418 they are externally visible and --export-dynamic is turned on.
2419 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2420
2421 2011-10-19 Ian Lance Taylor <iant@google.com>
2422
2423 PR gold/13163
2424 * script-sections.cc
2425 (Output_section_element_dot_assignment::needs_output_section): New
2426 function.
2427
2428 2011-10-19 Ian Lance Taylor <iant@google.com>
2429
2430 PR gold/13204
2431 * layout.cc (Layout::segment_precedes): Don't assert failure if a
2432 --section-start option was seen.
2433 * options.h (General_options::any_section_start): New function.
2434
2435 2011-10-18 David S. Miller <davem@davemloft.net>
2436
2437 PR binutils/13301
2438 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2439 member to track relocation locations that have moved during TLS
2440 reloc optimizations.
2441 (Target_sparc::Relocate::Relocate): Initialize to NULL.
2442 (Target_sparc::Relocate::relocate): Adjust view down by 4
2443 bytes if it matches reloc_adjust_addr_.
2444 (Target_sparc::Relocate::relocate_tls): Always move the
2445 __tls_get_addr call delay slot instruction forward 4 bytes when
2446 performing relaxation.
2447
2448 2011-10-18 Cary Coutant <ccoutant@google.com>
2449
2450 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2451 (Output_file::map_no_anonymous): Check for non-zero
2452 return code from posix_fallocate.
2453
2454 2011-10-17 Cary Coutant <ccoutant@google.com>
2455
2456 PR gold/13245
2457 * plugin.cc (is_visible_from_outside): Check for symbols
2458 referenced from dynamic objects.
2459 * resolve.cc (Symbol_table::resolve): Don't count references
2460 from dynamic objects as references from real ELF files.
2461 * testsuite/plugin_test_2.sh: Adjust expected result.
2462
2463 2011-10-17 Cary Coutant <ccoutant@google.com>
2464
2465 * gold.cc: Include timer.h.
2466 (queue_middle_tasks): Stamp time.
2467 (queue_final_tasks): Likewise.
2468 * main.cc (main): Store timer in parameters. Print timers
2469 for each pass.
2470 * parameters.cc (Parameters::Parameters): Initialize timer_.
2471 (Parameters::set_timer): New function.
2472 (set_parameters_timer): New function.
2473 * parameters.h (Parameters::set_timer): New function.
2474 (Parameters::timer): New function.
2475 (Parameters::timer_): New data member.
2476 (set_parameters_timer): New function.
2477 * timer.cc (Timer::stamp): New function.
2478 (Timer::get_pass_time): New function.
2479 * timer.h (Timer::stamp): New function.
2480 (Timer::get_pass_time): New function.
2481 (Timer::pass_times_): New data member.
2482
2483 2011-10-17 Cary Coutant <ccoutant@google.com>
2484
2485 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2486 task for members of lib groups.
2487
2488 2011-10-17 Cary Coutant <ccoutant@google.com>
2489
2490 PR gold/13288
2491 * fileread.cc (File_read::find_view): Add assert.
2492 (File_read::make_view): Move bounds check (replace with assert)...
2493 (File_read::find_or_make_view): ... to here.
2494
2495 2011-10-12 Cary Coutant <ccoutant@google.com>
2496
2497 * output.cc (Output_file::open_base_file): Handle case where
2498 ::read returns less than requested size.
2499
2500 2011-10-10 Cary Coutant <ccoutant@google.com>
2501
2502 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2503 Initialize defined_count_.
2504 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2505 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2506 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2507 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2508 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2509 * incremental.h (Sized_relobj_incr::defined_count_): New data
2510 member.
2511 (Sized_incr_dynobj::defined_count_): New data member.
2512 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2513 Return zeroes instead of internal error.
2514
2515 2011-10-10 Cary Coutant <ccoutant@google.com>
2516
2517 PR gold/13249
2518 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2519 (Output_reloc::symbol_value): Return PLT offset if flag is set.
2520 * output.h (class Output_reloc): Add use_plt_offset flag.
2521 (Output_reloc::type_): Adjust size of bit field.
2522 (Output_reloc::use_plt_offset_): New bit field.
2523 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2524 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2525 flag. Adjust all callers.
2526 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2527 creating RELATIVE relocations.
2528
2529 2011-10-10 Nick Clifton <nickc@redhat.com>
2530
2531 * po/es.po: Updated Spanish translation.
2532 * po/fi.po: Updated Finnish translation.
2533
2534 2011-10-03 Diego Novillo <dnovillo@google.com>
2535
2536 * options.cc (parse_uint): Fix dereference of RETVAL.
2537
2538 2011-09-29 Sriraman Tallam <tmsriram@google.com>
2539
2540 * layout.h (section_order_map_): New member.
2541 (get_section_order_map): New member function.
2542 * output.cc (Output_section::add_input_section): Check for patterns
2543 only when --section-ordering-file is specified.
2544 * gold.cc (queue_middle_tasks): Delay updating order of sections till
2545 output_sections have been formed.
2546 * layout.cc (Layout_Layout): Initialize section_order_map_.
2547 * plugin.cc (update_section_order): Store order in order_map. Do not
2548 update the order.
2549 * testsuite/Makefile.am: Add test case for plugin_final_layout.
2550 * testsuite/Makefile.in: Regenerate.
2551 * testsuite/plugin_section_order.c: New file.
2552 * testsuite/plugin_final_layout.cc: New file.
2553 * testsuite/plugin_final_layout.sh: New file.
2554
2555 2011-09-29 Cary Coutant <ccoutant@google.com>
2556
2557 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2558 Check for NULL.
2559 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2560 symbols during incremental update.
2561 (Symbol_table::add_from_dynobj): Likewise.
2562
2563 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2564 Ian Lance Taylor <iant@google.com>
2565
2566 * symtab.cc (Symbol_table::define_special_symbol): Always
2567 canonicalize version string.
2568
2569 2011-09-26 Cary Coutant <ccoutant@google.com>
2570
2571 * gold.cc (queue_initial_tasks): Move option checks ...
2572 * options.cc (General_options::finalize): ... to here. Disable
2573 some options; make others fatal.
2574
2575 2011-09-26 Cary Coutant <ccoutant@google.com>
2576
2577 gcc PR lto/47247
2578 * plugin.cc (get_symbols_v2): New function.
2579 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2580 (is_referenced_from_outside): New function.
2581 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2582 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2583 (get_symbols): Pass version parameter.
2584 (get_symbols_v2): New function.
2585 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2586 parameter.
2587 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2588 (onload): Add LDPT_GET_SYMBOLS_V2.
2589 (all_symbols_read_hook): Use get_symbols_v2; check for
2590 LDPR_PREVAILING_DEF_IRONLY_EXP.
2591 * testsuite/plugin_test_3.sh: Update expected results.
2592
2593 2011-09-23 Simon Baldwin <simonb@google.com>
2594
2595 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2596 configuration options.
2597 * configure: Regenerate.
2598 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2599 * Makefile.in: Regenerate.
2600 * testsuite/Makefile.in: Regenerate.
2601
2602 2011-09-19 Sriraman Tallam <tmsriram@google.com>
2603
2604 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2605
2606 2011-09-19 Cary Coutant <ccoutant@google.com>
2607
2608 * incremental.cc (can_incremental_update): Fix typo in comment.
2609 * incremental.h (can_incremental_update): Likewise.
2610
2611 2011-09-18 Cary Coutant <ccoutant@google.com>
2612
2613 * incremental.cc (can_incremental_update): New function.
2614 * incremental.h (can_incremental_update): New function.
2615 * layout.cc (Layout::init_fixed_output_section): Call it.
2616 (Layout::make_output_section): Don't allow patch space in .eh_frame.
2617 * object.cc (Sized_relobj_file::do_layout): Call
2618 can_incremental_update.
2619
2620 2011-09-13 Cary Coutant <ccoutant@google.com>
2621
2622 * configure.ac: Check for glibc support for gnu_indirect_function
2623 support with static linking, setting automake conditional
2624 IFUNC_STATIC.
2625 * Makefile.in: Regenerate.
2626 * configure: Regenerate.
2627
2628 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2629 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2630 for IFUNC_STATIC.
2631 * testsuite/Makefile.in: Regenerate.
2632
2633 2011-09-13 Cary Coutant <ccoutant@google.com>
2634
2635 * incremental.cc (Sized_relobj_incr::do_layout): Call
2636 report_comdat_group for kept comdat sections.
2637 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2638 * testsuite/Makefile.in: Regenerate.
2639 * testsuite/incr_comdat_test_1.cc: New source file.
2640 * testsuite/incr_comdat_test_2_v1.cc: New source file.
2641 * testsuite/incr_comdat_test_2_v2.cc: New source file.
2642 * testsuite/incr_comdat_test_2_v3.cc: New source file.
2643
2644 2011-09-13 Ian Lance Taylor <iant@google.com>
2645
2646 * object.cc (Sized_relobj_file::do_layout): Remove unused local
2647 variable external_symbols_offset.
2648
2649 2011-09-12 Ian Lance Taylor <iant@google.com>
2650
2651 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2652 triggered if object has no symbols.
2653
2654 2011-09-09 David S. Miller <davem@davemloft.net>
2655
2656 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2657 (Output_fill_debug_line::do_write): Likewise.
2658
2659 2011-08-29 Cary Coutant <ccoutant@google.com>
2660
2661 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2662 casts to match formatting specs.
2663 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2664
2665 2011-08-26 Cary Coutant <ccoutant@google.com>
2666
2667 * layout.cc (Free_list::allocate): Provide guarantee of minimum
2668 remaining hole size when allocating.
2669 (Layout::make_output_section): Set fill methods for debug sections.
2670 * layout.h (Free_list::Free_list_node): Move from private to
2671 public.
2672 (Free_list::set_min_hole_size): New function.
2673 (Free_list::begin, Free_list::end): New functions.
2674 (Free_list::min_hole_): New data member.
2675 * output.cc: Include dwarf.h.
2676 (Output_fill_debug_info::do_minimum_hole_size): New function.
2677 (Output_fill_debug_info::do_write): New function.
2678 (Output_fill_debug_line::do_minimum_hole_size): New function.
2679 (Output_fill_debug_line::do_write): New function.
2680 (Output_section::Output_section): Initialize new data member.
2681 (Output_section::set_final_data_size): Ensure patch space is larger
2682 than minimum hole size.
2683 (Output_section::do_write): Fill holes in debug sections.
2684 * output.h (Output_fill): New class.
2685 (Output_fill_debug_info): New class.
2686 (Output_fill_debug_line): New class.
2687 (Output_section::set_free_space_fill): New function.
2688 (Output_section::free_space_fill_): New data member.
2689 * testsuite/Makefile.am (incremental_test_3): Add
2690 --incremental-patch option.
2691 (incremental_test_4): Likewise.
2692 (incremental_test_5): Likewise.
2693 (incremental_test_6): Likewise.
2694 (incremental_copy_test): Likewise.
2695 (incremental_common_test_1): Likewise.
2696 * testsuite/Makefile.in: Regenerate.
2697
2698 2011-08-26 Nick Clifton <nickc@redhat.com>
2699
2700 * po/es.po: Updated Spanish translation.
2701
2702 2011-08-01 Cary Coutant <ccoutant@google.com>
2703
2704 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2705 * gold/testsuite/Makefile.in: Regenerate.
2706 * gold/testsuite/justsyms_exec.c: New source file.
2707 * gold/testsuite/justsyms_lib.c: New source file.
2708
2709 2011-08-01 Cary Coutant <ccoutant@google.com>
2710
2711 * layout.cc (Layout::set_segment_offsets): Don't realign text
2712 segment if -Ttext was specified.
2713 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2714 file type.
2715 * object.h (Sized_relobj_file::e_type): New function.
2716 (Sized_relobj_file::e_type_): New data member.
2717 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2718 base address for ET_EXEC files.
2719 * target.cc (Target::do_make_elf_object_implementation): Allow
2720 ET_EXEC files with --just-symbols option.
2721
2722 2011-07-28 Cary Coutant <ccoutant@google.com>
2723
2724 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2725 Add thread_number parameter.
2726 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2727 * workqueue-threads.cc
2728 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2729 current thread if its thread number is greater than desired thread
2730 count.
2731 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2732 Add thread_number parameter.
2733 (Workqueue::should_cancel_thread): Likewise.
2734 (Workqueue::find_runnable_or_wait): Pass thread_number to
2735 should_cancel_thread.
2736 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2737 parameter.
2738
2739 2011-07-22 Sriraman Tallam <tmsriram@google.com>
2740
2741 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2742 only after checking if it cannot be forced local.
2743 * symtab.h (is_externally_visible): Check if the symbol is not forced
2744 local.
2745
2746 2011-07-15 Ian Lance Taylor <iant@google.com>
2747
2748 * options.h (class General_options): Add --print-output-format.
2749 Move -EL next to -EB, for better --help output.
2750 * target-select.cc: Include <cstdio>, "options.h", and
2751 "parameters.h".
2752 (Target_selector::do_target_bfd_name): New function.
2753 (print_output_format): New function.
2754 * target-select.h (class Target_selector): Update declarations.
2755 (Target_selector::target_bfd_name): New function.
2756 (print_output_format): Declare.
2757 * main.cc: Include "target-select.h".
2758 (main): Handle --print-output-format.
2759 * gold.cc: Include "target-select.h".
2760 (queue_initial_tasks): Handle --print-output-format when there are
2761 no input files.
2762 * parameters.cc (parameters_force_valid_target): Give a better
2763 error message if -EB/-EL does not match target.
2764 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2765 function.
2766
2767 2011-07-15 Ian Lance Taylor <iant@google.com>
2768
2769 * i386.cc (class Output_data_plt_i386): Add layout_ field.
2770 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2771 (Output_data_plt_i386::do_write): Write address of .dynamic
2772 section to first entry in .got.plt section.
2773 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2774 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2775 Initialize layout_.
2776 (Output_data_plt_x86_64::do_write): Write address of .dynamic
2777 section to first entry in .got.plt section.
2778 * layout.h (Layout::dynamic_section): New function.
2779
2780 2011-07-13 Sriraman Tallam <tmsriram@google.com>
2781
2782 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2783 to claim_file call.
2784 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2785 input_section_position_, and input_section_glob_.
2786 (read_layout_from_file): Call function section_ordering_specified.
2787 * layout.h (is_section_ordering_specified): New function.
2788 (section_ordering_specified): New function.
2789 (section_ordering_specified_): New boolean member.
2790 * main.cc(main): Call load_plugins after layout object is defined.
2791 * output.cc (Output_section::add_input_section): Use
2792 function section_ordering_specified to check if section ordering is
2793 needed.
2794 * output.cc (Output_section::add_relaxed_input_section): Use
2795 function section_ordering_specified to check if section ordering is
2796 needed.
2797 (Output_section::update_section_layout): New function.
2798 (Output_section::sort_attached_input_sections): Check if input section
2799 must be reordered.
2800 * output.h (Output_section::update_section_layout): New function.
2801 * plugin.cc (get_section_count): New function.
2802 (get_section_type): New function.
2803 (get_section_name): New function.
2804 (get_section_contents): New function.
2805 (update_section_order): New function.
2806 (allow_section_ordering): New function.
2807 (Plugin::load): Add the new interfaces to the transfer vector.
2808 (Plugin_manager::load_plugins): New parameter.
2809 (Plugin_manager::all_symbols_read): New parameter.
2810 (Plugin_manager::claim_file): New parameter. Save the elf object for
2811 unclaimed objects.
2812 (Plugin_manager::get_elf_object): New function.
2813 (Plugin_manager::get_view): Change to directly use the bool to check
2814 if get_view is called from claim_file_hook.
2815 * plugin.h (input_objects): New function
2816 (Plugin__manager::load_plugins): New parameter.
2817 (Plugin_manager::claim_file): New parameter.
2818 (Plugin_manager::get_elf_object): New function.
2819 (Plugin_manager::in_claim_file_handler): New function.
2820 (Plugin_manager::in_claim_file_handler_): New member.
2821 (layout): New function.
2822 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2823 handler with an extra parameter. Make the elf object before calling
2824 claim_file handler.
2825 * testsuite/plugin_test.c (get_section_count): New function pointer.
2826 (get_section_type): New function pointer.
2827 (get_section_name): New function pointer.
2828 (get_section_contents): New function pointer.
2829 (update_section_order): New function pointer.
2830 (allow_section_ordering): New function pointer.
2831 (onload): Check if the new interfaces exist.
2832
2833 2011-07-13 Ian Lance Taylor <iant@google.com>
2834
2835 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2836 relro section.
2837 * x86_64.cc (Target_x86_64::got_section): Likewise.
2838 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2839 (relro_now_test_SOURCES): New variable.
2840 (relro_now_test_DEPENDENCIES): New variable.
2841 (relro_now_test_LDFLAGS): New variable.
2842 (relro_now_test_LDADD): New variable.
2843 (relro_now_test.so): New target.
2844 * testsuite/Makefile.in: Rebuild.
2845
2846 2011-07-12 Ian Lance Taylor <iant@google.com>
2847
2848 PR gold/12980
2849 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2850 GLOB_DAT relocation rather than a RELATIVE relocation for a
2851 protected symbol when creating a shared library.
2852 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2853 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2854 * testsuite/protected_main_1.cc (main): Test that protected
2855 function has same address.
2856
2857 2011-07-11 Ian Lance Taylor <iant@google.com>
2858
2859 PR gold/12979
2860 * options.h (class General_options): Add -Bgroup.
2861 * options.cc (General_options::finalize): If -Bgroup is set,
2862 default to --unresolved-symbols=report-all.
2863 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2864 * target-reloc.h (issue_undefined_symbol_error): Handle
2865 --unresolved-symbols=report-all.
2866
2867 2011-07-08 Ian Lance Taylor <iant@google.com>
2868
2869 PR gold/11985
2870 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2871 if linker script discards key sections.
2872 (Layout::create_dynamic_symtab): Likewise.
2873 (Layout::assign_local_dynsym_offsets): Likewise.
2874 (Layout::sized_create_version_sections): Likewise.
2875 (Layout::create_interp): Likewise.
2876 (Layout::finish_dynamic_section): Likewise.
2877 (Layout::set_dynamic_symbol_size): Likewise.
2878
2879 2011-07-08 Ian Lance Taylor <iant@google.com>
2880
2881 PR gold/12386
2882 * options.h (class General_options): Add --unresolved-symbols.
2883 * target-reloc.h (issue_undefined_symbol_error): Check
2884 --unresolved-symbols. Add comments.
2885
2886 2011-07-08 Ian Lance Taylor <iant@google.com>
2887
2888 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2889 expression more complex.
2890
2891 2011-07-08 Ian Lance Taylor <iant@google.com>
2892
2893 PR gold/11317
2894 * target-reloc.h (issue_undefined_symbol_error): New inline
2895 function, broken out of relocate_section.
2896 (relocate_section): Call issue_undefined_symbol_error.
2897 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2898 there is no TLS segment if we are about to issue an undefined
2899 symbol error.
2900 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2901
2902 2011-07-08 Ian Lance Taylor <iant@google.com>
2903
2904 PR gold/12279
2905 * resolve.cc (Symbol_table::should_override): Add fromtype
2906 parameter. Change all callers. Give error when linking together
2907 TLS and non-TLS symbol.
2908 (Symbol_table::should_override_with_special): Add fromtype
2909 parameter. Change all callers.
2910 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2911 there is no TLS segment if we have reported some errors.
2912 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2913
2914 2011-07-08 Ian Lance Taylor <iant@google.com>
2915
2916 PR gold/12372
2917 * target.h (Target::plt_address_for_global): New function.
2918 (Target::plt_address_for_local): New function.
2919 (Target::plt_section_for_global): Remove.
2920 (Target::plt_section_for_local): Remove.
2921 (Target::do_plt_address_for_global): New virtual function.
2922 (Target::do_plt_address_for_local): New virtual function.
2923 (Target::do_plt_section_for_global): Remove.
2924 (Target::do_plt_section_for_local): Remove.
2925 (Target::register_global_plt_entry): Add Symbol_table and Layout
2926 parameters.
2927 * output.cc (Output_data_got::Got_entry::write): Use
2928 plt_address_for_global and plt_address_for_local.
2929 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2930 address of output section.
2931 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2932 got_irelative_, and irelative_count_ fields. Update
2933 declarations.
2934 (Output_data_plt_i386::has_irelative_section): New function.
2935 (Output_data_plt_i386::entry_count): Add irelative_count_.
2936 (Output_data_plt_i386::set_final_data_size): Likewise.
2937 (class Target_i386): Add got_irelative_ and rel_irelative_
2938 fields. Update declarations.
2939 (Target_i386::Target_i386): Initialize new fields.
2940 (Target_i386::do_plt_address_for_global): New function replacing
2941 do_plt_section_for_global.
2942 (Target_i386::do_plt_address_for_local): New function replacing
2943 do_plt_section_for_local.
2944 (Target_i386::got_section): Create got_irelative_.
2945 (Target_i386::rel_irelative_section): New function.
2946 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2947 fields. Don't define __rel_iplt_{start,end}.
2948 (Output_data_plt_i386::add_entry): Add symtab and layout
2949 parameters. Change all callers. Use different PLT and GOT for
2950 IFUNC symbols.
2951 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2952 layout parameters. Change all callers. Use different PLT and
2953 GOT.
2954 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2955 (Output_data_plt_i386::rel_irelative): New function.
2956 (Output_data_plt_i386::address_for_global): New function.
2957 (Output_data_plt_i386::address_for_local): New function.
2958 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2959 IRELATIVE GOT when changing IFUNC GOT entries.
2960 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2961 reloc.
2962 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2963 if we didn't create an IRELATIVE GOT.
2964 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2965 plt_address_for_local.
2966 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2967 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2968 got_irelative_, and irelative_count_ fields. Update
2969 declarations.
2970 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2971 Initialize new fields. Remove symtab parameter. Change all
2972 callers.
2973 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2974 irelative_count_.
2975 (Output_data_plt_x86_64::has_irelative_section): New function.
2976 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2977 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2978 fields. Update declarations.
2979 (Target_x86_64::Target_x86_64): Initialize new fields.
2980 (Target_x86_64::do_plt_address_for_global): New function replacing
2981 do_plt_section_for_global.
2982 (Target_x86_64::do_plt_address_for_local): New function replacing
2983 do_plt_section_for_local.
2984 (Target_x86_64::got_section): Create got_irelative_.
2985 (Target_x86_64::rela_irelative_section): New function.
2986 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2987 all callers. Don't create __rel_iplt_{start,end}.
2988 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2989 parameters. Change all callers. Use different PLT and GOT for
2990 IFUNC symbols.
2991 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2992 layout parameters. Change all callers. Use different PLT and
2993 GOT.
2994 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2995 parameters. Change all callers. Use different PLT and GOT for
2996 IFUNC symbols.
2997 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2998 (Output_data_plt_x86_64::rela_irelative): New function.
2999 (Output_data_plt_x86_64::address_for_global): New function.
3000 (Output_data_plt_x86_64::address_for_local): New function.
3001 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3002 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3003 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3004 (Target_x86_64::register_global_plt_entry): Add symtab and layout
3005 parameters.
3006 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3007 reloc.
3008 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3009 symbols if we didn't create an IRELATIVE GOT.
3010 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3011 plt_address_for_local.
3012 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3013 * testsuite/ifuncvar1.c: New test file.
3014 * testsuite/ifuncvar2.c: New test file.
3015 * testsuite/ifuncvar3.c: New test file.
3016 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3017 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3018 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3019 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3020 * testsuite/Makefile.in: Rebuild.
3021
3022 2011-07-07 Cary Coutant <ccoutant@google.com>
3023
3024 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3025 (two_file_test_1_ndebug.o): Likewise.
3026 (two_file_test_1b_ndebug.o): Likewise.
3027 (two_file_test_2_ndebug.o): Likewise.
3028 (two_file_test_main_ndebug.o): Likewise.
3029 (incremental_test_2): Link with no-debug versions.
3030
3031 2011-07-06 Cary Coutant <ccoutant@google.com>
3032
3033 * gold/incremental.cc
3034 (Output_section_incremental_inputs::write_info_blocks): Check for
3035 hidden and internal symbols.
3036
3037 2011-07-06 Cary Coutant <ccoutant@google.com>
3038
3039 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3040 Check disposition for startup file.
3041 (Incremental_inputs::report_command_line): Ignore
3042 --incremental-startup-unchanged option.
3043 * options.cc (General_options::parse_incremental_startup_unchanged):
3044 New function.
3045 (General_options::General_options): Initialize new data member.
3046 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3047 (General_options): Add --incremental-startup-unchanged option.
3048 (General_options::incremental_startup_disposition): New function.
3049 (General_options::incremental_startup_disposition_): New data member.
3050
3051 2011-07-06 Cary Coutant <ccoutant@google.com>
3052
3053 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3054 input file index to Script_info ctor.
3055 (Sized_incremental_binary::do_file_has_changed): Find the
3056 command-line argument for files named in scripts.
3057 * incremental.h (Script_info::Script_info): New ctor
3058 with input file index.
3059 (Script_info::input_file_index): New function.
3060 (Script_info::input_file_index_): New data member.
3061 (Incremental_binary::get_library): Add const.
3062 (Incremental_binary::get_script_info): Add const.
3063 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3064 * testsuite/Makefile.am (incremental_test_5): New test case.
3065 (incremental_test_6): New test case.
3066 * testsuite/Makefile.in: Regenerate.
3067
3068 2011-07-06 Cary Coutant <ccoutant@google.com>
3069
3070 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3071 debug output when command lines differ.
3072
3073 2011-07-06 Cary Coutant <ccoutant@google.com>
3074
3075 * incremental.cc (Incremental_inputs::report_command_line): Ignore
3076 --incremental-patch option.
3077 * layout.cc (Free_list::allocate): Extend allocation beyond original
3078 end if enabled.
3079 (Layout::make_output_section): Mark sections that should get
3080 patch space.
3081 * options.cc (parse_percent): New function.
3082 * options.h (parse_percent): New function.
3083 (DEFINE_percent): New macro.
3084 (General_options): Add --incremental-patch option.
3085 * output.cc (Output_section::Output_section): Initialize new data
3086 members.
3087 (Output_section::add_input_section): Print section name when out
3088 of patch space.
3089 (Output_section::add_output_section_data): Likewise.
3090 (Output_section::set_final_data_size): Add patch space when
3091 doing --incremental-full.
3092 (Output_section::do_reset_address_and_file_offset): Remove patch
3093 space.
3094 (Output_segment::set_section_list_addresses): Print debug output
3095 only if --incremental-update.
3096 * output.h (Output_section::set_is_patch_space_allowed): New function.
3097 (Output_section::is_patch_space_allowed_): New data member.
3098 (Output_section::patch_space_): New data member.
3099 * parameters.cc (Parameters::incremental_full): New function.
3100 * parameters.h (Parameters::incremental_full): New function
3101 * testsuite/Makefile.am (incremental_test_2): Add test for
3102 --incremental-patch option.
3103 * testsuite/Makefile.in: Regenerate.
3104 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3105 (t18): Remove function body.
3106
3107 2011-07-05 Doug Kwan <dougkwan@google.com>
3108
3109 PR gold/12771
3110 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3111 Arm_Address type for relocation result.
3112 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
3113 overflow check.
3114 (Arm_relocate_functions::abs32): Use unaligned access.
3115 (Arm_relocate_functions::rel32): Ditto.
3116 (Arm_relocate_functions::prel31): Ditto.
3117 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3118 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3119 static data relocations.
3120 * testsuite/Makefile.in: Regnerate.
3121 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3122
3123 2011-07-05 Ian Lance Taylor <iant@google.com>
3124
3125 PR gold/12392
3126 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3127 symbols if necessary.
3128 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3129
3130 2011-07-05 Ian Lance Taylor <iant@google.com>
3131
3132 PR gold/12952
3133 * resolve.cc (Symbol::override_base_with_special): Simply override
3134 version with special symbol version, ignoring previous version.
3135
3136 2011-07-05 Ian Lance Taylor <iant@google.com>
3137
3138 * object.cc (Sized_relobj_file::include_section_group): Add
3139 information to comment about signature location.
3140
3141 2011-07-02 Ian Lance Taylor <iant@google.com>
3142
3143 PR gold/12957
3144 * options.h (class General_options): Add -f and -F.
3145 * options.cc (General_options::finalize): Fatal error if -f/-F
3146 are used without -shared.
3147 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3148
3149 2011-07-02 Ian Lance Taylor <iant@google.com>
3150
3151 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3152
3153 2011-07-01 Ian Lance Taylor <iant@google.com>
3154
3155 PR gold/12525
3156 PR gold/12952
3157 * resolve.cc (Symbol::override_base_with_special): Don't override
3158 the version if the overriding symbol has a different name.
3159 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
3160 all callers. If we give an error about an undefined version,
3161 define the base version if necessary.
3162 * dynobj.h (class Versions): Update declaration.
3163 * testsuite/weak_alias_test_5.cc: New file.
3164 * testsuite/weak_alias_test.script: New file.
3165 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3166 and versioned_alias have the right value, and call t2.
3167 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3168 weak_alias_test_5.so.
3169 (weak_alias_test_LDADD): Likewise.
3170 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3171 * testsuite/Makefile.in: Rebuild.
3172
3173 2011-07-01 Ian Lance Taylor <iant@google.com>
3174
3175 PR gold/12525
3176 * options.h (class General_options): Support -z notext.
3177 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3178 -Wl,-z,notext.
3179 (two_file_shared_nonpic.so): Likewise.
3180 (two_file_shared_mixed.so): Likewise.
3181 (two_file_shared_mixed_1.so): Likewise.
3182 (weak_undef_lib_nonpic.so): Likewise.
3183 (alt/weak_undef_lib_nonpic.so): Likewise.
3184 (tls_test_shared_nonpic.so): Likewise.
3185 * testsuite/Makefile.in: Rebuild.
3186
3187 2011-07-01 Ian Lance Taylor <iant@google.com>
3188
3189 PR gold/12525
3190 * configure.ac: Test whether static linking works, setting
3191 the automake conditional HAVE_STATIC.
3192 * testsuite/Makefile.am: Disable tests using -static if
3193 HAVE_STATIC is not true.
3194 * configure, testsuite/Makefile.in: Rebuild.
3195
3196 2011-07-01 Ian Lance Taylor <iant@google.com>
3197
3198 PR gold/12525
3199 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3200 Assert if we see DW_EH_PE_indirect.
3201 * target.h (Target::ehframe_datarel_base): New function.
3202 (Target::do_ehframe_datarel_base): New target function.
3203 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3204 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3205 function.
3206
3207 2011-07-01 Ian Lance Taylor <iant@google.com>
3208
3209 PR gold/12571
3210 * options.h (class General_options): Add
3211 --ld-generated-unwind-info.
3212 * ehframe.cc (Fde::write): Add address parameter. Change all
3213 callers. If associated with PLT, fill in address and size.
3214 (Cie::set_output_offset): Only add merge mapping if there is an
3215 object.
3216 (Cie::write): Add address parameter. Change all callers.
3217 (Eh_frame::add_ehframe_for_plt): New function.
3218 * ehframe.h (class Fde): Update declarations. Move shndx_ and
3219 input_offset_ fields into union u_, with new plt field.
3220 (Fde::Fde): Adjust for new union field.
3221 (Fde::Fde) [Output_data version]: New constructor.
3222 (Fde::add_mapping): Only add merge mapping if there is an object.
3223 (class Cie): Update declarations.
3224 (class Eh_frame): Declare add_ehframe_for_plt.
3225 * layout.cc (Layout::layout_eh_frame): Break out code into
3226 make_eh_frame_section, and call it.
3227 (Layout::make_eh_frame_section): New function.
3228 (Layout::add_eh_frame_for_plt): New function.
3229 * layout.h (class Layout): Update declarations.
3230 * merge.cc (Merge_map::add_mapping): Add assertion.
3231 * i386.cc: Include "dwarf.h".
3232 (class Output_data_plt_i386): Make first_plt_entry,
3233 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
3234 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3235 and plt_eh_frame_fde.
3236 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3237 boundary. Call add_eh_frame_for_plt if appropriate.
3238 * x86_64.cc: Include "dwarf.h".
3239 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
3240 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
3241 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3242 and plt_eh_frame_fde.
3243 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3244 appropriate.
3245
3246 2011-06-29 Ian Lance Taylor <iant@google.com>
3247
3248 PR gold/12629
3249 * object.cc (Sized_relobj_file::layout_section): Change shdr
3250 parameter to be const.
3251 (Sized_relobj_file::layout_eh_frame_section): New function, broken
3252 out of do_layout.
3253 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3254 appropriate. Call layout_eh_frame_section.
3255 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3256 sections.
3257 * object.h (class Sized_relobj_file): Update declarations.
3258
3259 2011-06-29 Ian Lance Taylor <iant@google.com>
3260
3261 PR gold/12652
3262 * script.cc (Token::integer_value): Accept trailing M/m/K/k
3263 modifier.
3264 (Lex::gather_token): Accept trailing M/m/K/k for integers.
3265
3266 2011-06-29 Ian Lance Taylor <iant@google.com>
3267
3268 PR gold/12675
3269 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3270 SHT_X86_64_UNWIND.
3271 * layout.cc (Layout::layout_eh_frame): Likewise.
3272
3273 2011-06-29 Ian Lance Taylor <iant@google.com>
3274
3275 PR gold/12695
3276 * layout.cc (Layout::symtab_section_shndx): New function.
3277 * layout.h (class Layout): Declare symtab_section_shndx.
3278 * output.cc (Output_section::write_header): Call it.
3279
3280 2011-06-29 Ian Lance Taylor <iant@google.com>
3281
3282 PR gold/12818
3283 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3284 symbols which are not used in a relocation.
3285
3286 2011-06-28 Ian Lance Taylor <iant@google.com>
3287
3288 PR gold/12898
3289 * layout.cc (Layout::segment_precedes): Don't crash if a linker
3290 script create indistinguishable segments.
3291 (Layout::set_segment_offsets): Use stable_sort when sorting
3292 segments. Pass this to Compare_segments constructor.
3293 * layout.h (class Layout): Make segment_precedes non-static.
3294 (class Compare_segments): Change from struct to class. Add
3295 layout_ field. Add constructor.
3296 * script-sections.cc
3297 (Script_sections::attach_sections_using_phdrs_clause): Rename
3298 local orphan to is_orphan. Don't report failure to put empty
3299 section in segment. On attachment failure, report name of
3300 section, and attach to first PT_LOAD segment.
3301
3302 2011-06-28 Ian Lance Taylor <iant@google.com>
3303
3304 PR gold/12934
3305 * target-select.cc (Target_selector::Target_selector): Add
3306 emulation parameter. Change all callers.
3307 (select_target_by_bfd_name): Rename from select_target_by_name.
3308 Change all callers.
3309 (select_target_by_emulation): New function.
3310 (supported_emulation_names): New function.
3311 * target-select.h (class Target_selector): Add emulation_ field.
3312 Update declarations.
3313 (Target_selector::recognize_by_bfd_name): Rename from
3314 recognize_by_name. Change all callers.
3315 (Target_selector::supported_bfd_names): Rename from
3316 supported_names. Change all callers.
3317 (Target_selector::recognize_by_emulation): New function.
3318 (Target_selector::supported_emulations): New function.
3319 (Target_selector::emulation): New function.
3320 (Target_selector::do_recognize_by_bfd_name): Rename from
3321 do_recognize_by_name. Change all callers.
3322 (Target_selector::do_supported_bfd_names): Rename from
3323 do_supported_names. Change all callers.
3324 (Target_selector::do_recognize_by_emulation): New function.
3325 (Target_selector::do_supported_emulations): New function.
3326 (select_target_by_bfd_name): Change name in declaration.
3327 (select_target_by_emulation): Declare.
3328 (supported_emulation_names): Declare.
3329 * parameters.cc (parameters_force_valid_target): Try to find
3330 target based on emulation from -m option.
3331 * options.h (class General_options): Change doc string for -m.
3332 * options.cc (help): Print emulations.
3333 (General_options::parse_V): Likewise.
3334 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3335 Add emulation parameter. Change all callers.
3336
3337 2011-06-28 Ian Lance Taylor <iant@google.com>
3338
3339 * target.h (class Target): Add osabi_ field.
3340 (Target::osabi): New function.
3341 (Target::set_osabi): New function.
3342 (Target::Target): Initialize osabi_.
3343 (Target::do_adjust_elf_header): Make pure virtual.
3344 (Sized_target::do_adjust_elf_header): Declare.
3345 * target.cc (Sized_target::do_adjust_elf_header): New function.
3346 (class Sized_target): Instantiate all versions.
3347 * freebsd.h (class Target_freebsd): Remove.
3348 (Target_selector_freebsd::do_recognize): Call set_osabi on
3349 Target.
3350 (Target_selector_freebsd::do_recognize_by_name): Likewise.
3351 (Target_selector_freebsd::set_osabi): Remove.
3352 * i386.cc (class Target_i386): Inherit from Sized_target rather
3353 than Target_freebsd.
3354 * x86_64.cc (class Target_x86_64): Likewise.
3355
3356 2011-06-28 Ian Lance Taylor <iant@google.com>
3357
3358 * target.h (Target::can_check_for_function_pointers): Rewrite.
3359 Make non-virtual.
3360 (Target::can_icf_inline_merge_sections): Likewise.
3361 (Target::section_may_have_icf_unsafe_poineters): Likewise.
3362 (Target::Target_info): Add can_icf_inline_merge_sections field.
3363 (Target::do_can_check_for_function_pointers): New virtual
3364 function.
3365 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3366 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3367 from can_check_for_function_pointers, move in file.
3368 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3369 section_may_have_icf_unsafe_poineters, move in file.
3370 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3371 * i386.cc (Target_i386::do_can_check_for_function_pointers):
3372 Rename from can_check_for_function_pointers, move in file.
3373 (Target_i386::can_icf_inline_merge_sections): Remove.
3374 (Target_i386::i386_info): Initialize
3375 can_icf_inline_merge_sections.
3376 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3377 Initialize can_icf_inline_merge_sections.
3378 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3379 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3380 Rename from can_check_for_function_pointers, move in file.
3381 (Target_x86_64::can_icf_inline_merge_sections): Remove.
3382 (Target_x86_64::x86_64_info): Initialize
3383 can_icf_inline_merge_sections.
3384 * testsuite/testfile.cc (Target_test::test_target_info):
3385 Likewise.
3386 * icf.cc (get_section_contents): Correct formatting.
3387
3388 2011-06-27 Ian Lance Taylor <iant@google.com>
3389
3390 * symtab.cc (Symbol::versioned_name): New function.
3391 (Symbol_table::add_to_final_symtab): Use versioned_name when
3392 appropriate.
3393 (Symbol_table::sized_write_symbol): Likewise.
3394 * symtab.h (class Symbol): Declare versioned_name.
3395 * stringpool.h (class Stringpool_template): Add variant of add
3396 which takes a std::basic_string.
3397 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3398 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3399 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3400 (ver_test_12.o): New target.
3401 * testsuite/Makefile.in: Rebuild.
3402
3403 2011-06-27 Doug Kwan <dougkwan@google.com>
3404
3405 * arm.cc (Arm_relocate_functions::thm_jump8,
3406 Arm_relocate_functions::thm_jump11): Use a wider signed
3407 type to compute offset.
3408 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3409 arm_thm_jump8.
3410 * testsuite/Makefile.in: Regenerate.
3411 * testsuite/arm_branch_in_range.sh: Check test results of
3412 arm_thm_jump11 and arm_thm_jump8.
3413 * testsuite/arm_thm_jump11.s: New test source file.
3414 * testsuite/arm_thm_jump11.t: New linker script.
3415 * testsuite/arm_thm_jump8.s: New test source file.
3416 * testsuite/arm_thm_jump8.t: New linker script.
3417
3418 2011-06-24 Ian Lance Taylor <iant@google.com>
3419
3420 * layout.cc: Include "object.h".
3421 (ctors_sections_in_init_array): New static variable.
3422 (Layout::is_ctors_in_init_array): New function.
3423 (Layout::layout): Add entry to ctors_sections_in_init_array if
3424 appropriate.
3425 * layout.h (class Layout): Declare is_ctors_in_init_array.
3426 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3427 is_ctors_reverse_view is set.
3428 (Sized_relobj_file::write_sections): Add layout parameter. Change
3429 all callers. Set is_ctors_reverse_view field of View_size.
3430 (Sized_relobj_file::reverse_words): New function.
3431 * object.h (Sized_relobj_file::View_size): Add
3432 is_ctors_reverse_view field.
3433 (class Sized_relobj_file): Update declarations.
3434 * testsuite/initpri3.c: New test.
3435 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3436 initpri3b.
3437 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3438 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3439 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3440 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3441 * testsuite/Makefile.in: Rebuild.
3442
3443 2011-06-24 Cary Coutant <ccoutant@google.com>
3444
3445 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3446 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3447 (debug_msg_cdebug.err): New targets.
3448 * testsuite/Makefile.in: Regenerate.
3449 * testsuite/debug_msg.sh: Check output of link with compressed debug.
3450 Fix checks for link with shared library.
3451
3452 2011-06-24 Doug Kwan <dougkwan@google.com>
3453
3454 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3455 skip empty text sections.
3456 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3457
3458 2011-06-22 Ian Lance Taylor <iant@google.com>
3459
3460 PR gold/12910
3461 * options.h (class General_options): Add --ctors-in-init-array.
3462 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3463 friends as SHT_PROGBITS for merging sections.
3464 (Layout::layout): Remove special handling of .init_array and
3465 friends. Don't sort if doing relocatable link. Sort for .ctors
3466 and .dtors if ctors_in_init_array.
3467 (Layout::make_output_section): Force correct section types for
3468 .init_array and friends. Don't sort if doing relocatable link,
3469 Don't sort .ctors and .dtors if ctors_in_init_array.
3470 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3471 (Layout::output_section_name): Add relobj parameter. Change all
3472 callers. Handle .ctors. and .dtors. in code rather than table.
3473 Handle .ctors and .dtors if ctors_in_init_array.
3474 (Layout::match_file_name): New function, moved from output.cc.
3475 * layout.h (class Layout): Update declarations.
3476 * output.cc: Include "layout.h".
3477 (Input_section_sort_entry::get_priority): New function.
3478 (Input_section_sort_entry::match_file_name): Just call
3479 Layout::match_file_name.
3480 (Output_section::Input_section_sort_init_fini_compare::operator()):
3481 Handle .ctors and .dtors. Sort by explicit priority rather than
3482 by name.
3483 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3484 * testsuite/initpri2.c: New test.
3485 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3486 (check_PROGRAMS): Add initpri2.
3487 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3488 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3489 * configure, testsuite/Makefile.in: Rebuild.
3490
3491 2011-06-19 Ian Lance Taylor <iant@google.com>
3492
3493 PR gold/12880
3494 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3495 .interp section to a PT_INTERP segment even if we have seen a
3496 --dynamic-linker option. Don't do it if we have seen a PHDRS
3497 clause in a linker script.
3498 (Layout::finalize): Don't create a .interp section if we've
3499 already create a PT_INTERP segment.
3500 (Layout::create_interp): Always call choose_output_section (revert
3501 patch of 2011-06-17). Don't create PT_INTERP segment.
3502 * script-sections.cc
3503 (Script_sections::create_note_and_tls_segments): Add a .interp
3504 section to a PT_INTERP segment even if we have seen a
3505 --dynamic-linker option.
3506
3507 2011-06-18 Ian Lance Taylor <iant@google.com>
3508
3509 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3510 merely because a non-PT_LOAD segment has a dynamic reloc.
3511
3512 2011-06-18 Ian Lance Taylor <iant@google.com>
3513
3514 * layout.cc (Layout::finish_dynamic_section): Don't create
3515 DT_FLAGS entry if not needed.
3516
3517 2011-06-18 Ian Lance Taylor <iant@google.com>
3518
3519 PR gold/12745
3520 * layout.cc (Layout::layout_eh_frame): Correct handling of
3521 writable .eh_frame section.
3522
3523 2011-06-17 Ian Lance Taylor <iant@google.com>
3524
3525 PR gold/12893
3526 * resolve.cc (Symbol_table::resolve): Don't give an error if a
3527 symbol is redefined with the exact same object and value.
3528
3529 2011-06-17 Ian Lance Taylor <iant@google.com>
3530
3531 PR gold/12880
3532 * layout.h (class Layout): Add interp_segment_ field.
3533 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3534 (Layout::attach_allocated_section_to_segment): If making shared
3535 library, put .interp section in PT_INTERP segment.
3536 (Layout::finalize): Also call create_interp if -dynamic-linker
3537 option was used.
3538 (Layout::create_interp): Assert that there is no PT_INTERP
3539 segment. If not using a SECTIONS clause, use make_output_section.
3540 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3541 * script-sections.cc
3542 (Script_sections::create_note_and_tls_segments): If making shared
3543 library, put .interp section in PT_INTERP segment.
3544
3545 2011-06-17 Ian Lance Taylor <iant@google.com>
3546
3547 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3548 when making a shared library.
3549
3550 2011-06-17 Ian Lance Taylor <iant@google.com>
3551
3552 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3553 parameter. Change all callers. Don't issue warning about PC32
3554 against locally defined symbol.
3555
3556 2011-06-16 Ian Lance Taylor <iant@google.com>
3557
3558 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3559 occurs in same object.
3560
3561 2011-06-14 Alan Modra <amodra@gmail.com>
3562
3563 * po/POTFILES.in: Regenerate.
3564
3565 2011-06-09 Ian Lance Taylor <iant@google.com>
3566
3567 * script-sections.cc
3568 (Orphan_output_section::set_section_addresses): For a relocatable
3569 link set address to 0.
3570
3571 2011-06-09 Cary Coutant <ccoutant@google.com>
3572
3573 PR gold/12804
3574 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3575 used with --compress-debug-sections.
3576 * gold/object.cc (Sized_relobj_file::do_layout): Report
3577 uncompressed size of compressed input sections.
3578
3579 2011-06-08 Cary Coutant <ccoutant@google.com>
3580
3581 PR gold/12804
3582 * testsuite/two_file_test_2_v1.cc: Change initialization of
3583 v2 to keep it in .data.
3584
3585 2011-06-07 Cary Coutant <ccoutant@google.com>
3586
3587 * common.cc (Symbol_table::do_allocate_commons_list): Call
3588 gold_fallback.
3589 * errors.cc (Errors::fatal): Adjust call to gold_exit.
3590 (Errors::fallback): New function.
3591 (gold_fallback): New function.
3592 * errors.h (Errors::fallback): New function.
3593 * gold.cc (gold_exit): Change status parameter to enum; adjust
3594 all callers.
3595 (queue_initial_tasks): Call gold_fallback.
3596 * gold.h: Include cstdlib.
3597 (Exit_status): New enum type.
3598 (gold_exit): Change status parameter to enum.
3599 (gold_fallback): New function.
3600 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3601 (Layout::create_symtab_sections): Likewise.
3602 (Layout::create_shdrs): Likewise.
3603 * main.cc (main): Adjust call to gold_exit.
3604 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3605 (Output_data_got::add_got_entry_pair): Likewise.
3606 (Output_section::add_input_section): Likewise.
3607 (Output_section::add_output_section_data): Likewise.
3608 (Output_segment::set_section_list_addresses): Likewise.
3609 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3610
3611 2011-06-07 Cary Coutant <ccoutant@google.com>
3612
3613 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3614 for incremental links.
3615 * output.cc (Output_segment::set_section_list_addresses): Remove
3616 FIXME and test for TLS or BSS.
3617
3618 2011-06-07 Cary Coutant <ccoutant@google.com>
3619
3620 * testsuite/Makefile.am: Add incremental_copy_test,
3621 incremental_common_test_1.
3622 * testsuite/Makefile.in: Regenerate.
3623 * testsuite/common_test_1_v1.c: New source file.
3624 * testsuite/common_test_1_v2.c: New source file.
3625 * testsuite/copy_test_v1.cc: New source file.
3626
3627 2011-06-07 Cary Coutant <ccoutant@google.com>
3628
3629 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3630 update, allocate common from bss section's free list.
3631 * incremental-dump.cc (dump_incremental_inputs): Print flag for
3632 linker-defined symbols.
3633 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3634 Skip GOT and PLT entries that are no longer referenced.
3635 (Output_section_incremental_inputs::write_info_blocks): Mark
3636 linker-defined symbols.
3637 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3638 * output.cc (Output_section::allocate): New function.
3639 * output.h (Output_section::allocate): New function.
3640 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3641 linker-defined symbols.
3642 (Symbol::override_base_with_special): Copy is_predefined_ flag.
3643 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3644 (Symbol::init_base_output_data): Likewise.
3645 (Symbol::init_base_output_segment): Likewise.
3646 (Symbol::init_base_constant): Likewise.
3647 (Sized_symbol::init_output_data): Likewise.
3648 (Sized_symbol::init_output_segment): Likewise.
3649 (Sized_symbol::init_constant): Likewise.
3650 (Symbol_table::do_define_in_output_data): Likewise.
3651 (Symbol_table::do_define_in_output_segment): Likewise.
3652 (Symbol_table::do_define_as_constant): Likewise.
3653 * symtab.h (Symbol::is_predefined): New function.
3654 (Symbol::init_base_output_data): Add is_predefined parameter.
3655 (Symbol::init_base_output_segment): Likewise.
3656 (Symbol::init_base_constant): Likewise.
3657 (Symbol::is_predefined_): New data member.
3658 (Sized_symbol::init_output_data): Add is_predefined parameter.
3659 (Sized_symbol::init_output_segment): Likewise.
3660 (Sized_symbol::init_constant): Likewise.
3661 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3662
3663 2011-06-07 Cary Coutant <ccoutant@google.com>
3664
3665 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3666 instead of emit_copy_reloc.
3667 (Copy_relocs::emit_copy_reloc): Refactor.
3668 (Copy_relocs::make_copy_reloc): New function.
3669 (Copy_relocs::add_copy_reloc): Remove.
3670 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3671 section.
3672 (Copy_relocs::make_copy_reloc): New function.
3673 (Copy_relocs::add_copy_reloc): Remove.
3674 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3675 unchanged input files.
3676 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3677 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3678 Reserve BSS space for COPY relocations.
3679 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3680 (Output_section_incremental_inputs::write_info_blocks): Record
3681 whether a symbol is copied from a shared object.
3682 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3683 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3684 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3685 (Incremental_input_entry_reader::get_output_symbol_index): Add
3686 is_copy parameter.
3687 (Incremental_binary::emit_copy_relocs): New function.
3688 (Incremental_binary::do_emit_copy_relocs): New function.
3689 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3690 new data member.
3691 (Sized_incremental_binary::add_copy_reloc): New function.
3692 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3693 (Sized_incremental_binary::Copy_reloc): New struct.
3694 (Sized_incremental_binary::Copy_relocs): New typedef.
3695 (Sized_incremental_binary::copy_relocs_): New data member.
3696 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3697 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3698 * target.h (Sized_target::emit_copy_reloc): New function.
3699 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3700
3701 2011-06-02 Cary Coutant <ccoutant@google.com>
3702
3703 PR gold/12163
3704 * gold/archive.cc (Archive::Archive): Initialize new data member.
3705 (Archive::include_all_members): Return if archive has already been
3706 included.
3707 * gold/archive.h (Archive::include_all_members_): New data member.
3708
3709 2011-06-02 Nick Clifton <nickc@redhat.com>
3710
3711 * dynobj.h: Fix spelling mistake in comment.
3712 * output.cc: Likewise.
3713
3714 2011-05-31 Doug Kwan <dougkwan@google.com>
3715 Asier Llano
3716
3717 PR gold/12826
3718 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3719 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3720 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
3721 redundant arm_exidx_test.so.
3722 * testsuite/Makefile.in: Regenerate.
3723 (check_SCRIPTS): Add pr12826.sh
3724 (check_DATA): Add pr12826.stdout
3725 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3726 * testsuite/pr12826.sh: New file.
3727 * testsuite/pr12826_1.s: Ditto.
3728 * testsuite/pr12826_1.s: Ditto.
3729
3730 2011-05-30 Ian Lance Taylor <iant@google.com>
3731
3732 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3733 sections.
3734
3735 2011-05-29 Ian Lance Taylor <iant@google.com>
3736
3737 PR gold/12804
3738 * testsuite/Makefile.am: Use different file name for two_file_test
3739 temporary file for each incremental test.
3740 * testsuite/Makefile.in: Rebuild.
3741
3742 2011-05-29 Ian Lance Taylor <iant@google.com>
3743
3744 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3745 binary input file is empty.
3746
3747 2011-05-27 Ian Lance Taylor <iant@google.com>
3748
3749 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3750 (ver_test_9.so): Likewise.
3751 * testsuite/Makefile.in: Rebuild.
3752
3753 2011-05-26 Cary Coutant <ccoutant@google.com>
3754
3755 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3756 * incremental.cc (Incremental_inputs::report_input_section): Fix
3757 comment, indentation.
3758 (Incremental_inputs::report_comdat_group): New function.
3759 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3760 of data for incremental input file entry.
3761 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3762 group count, COMDAT group signatures.
3763 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3764 an unchanged input file.
3765 * incremental.h (Incremental_object_entry::Incremental_object_entry):
3766 Initialize new data member.
3767 (Incremental_object_entry::add_comdat_group): New function.
3768 (Incremental_object_entry::get_comdat_group_count): New function.
3769 (Incremental_object_entry::get_comdat_signature_key): New function.
3770 (Incremental_object_entry::groups_): New data member.
3771 (Incremental_inputs::report_comdat_group): New function.
3772 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3773 data for incremental input file entry.
3774 (Incremental_input_entry_reader::get_comdat_group_count): New function.
3775 (Incremental_input_entry_reader::get_input_section): Adjust size of
3776 data for incremental input file entry.
3777 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3778 (Incremental_input_entry_reader::get_comdat_group_signature): New
3779 function.
3780 * object.cc (Sized_relobj::include_section_group): Report kept
3781 COMDAT groups for incremental links.
3782
3783 2011-05-24 David Meyer <pdox@google.com>
3784
3785 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3786 with name parameter. Add found_name parameter.
3787 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3788 * dirsearch.h (class Dirsearch): Update declaration.
3789
3790 2011-05-24 Ian Lance Taylor <iant@google.com>
3791
3792 * archive.cc (Library_base::should_include_member): Pull in object
3793 from archive if it defines the entry symbol.
3794 * parameters.cc (Parameters::entry): New function.
3795 * parameters.h (class Parameters): Declare entry.
3796 * output.h (class Output_file_header): Remove entry_ field.
3797 * output.cc (Output_file_header::Output_file_header): Remove entry
3798 parameter. Change all callers.
3799 (Output_file_header::entry): Use parameters->entry.
3800 * gold.cc (queue_middle_tasks): Likewise.
3801 * plugin.cc (Plugin_hook::run): Likewise.
3802
3803 2011-05-24 Cary Coutant <ccoutant@google.com>
3804
3805 * gold.cc (queue_initial_tasks): Pass incremental base filename
3806 to Output_file::open_base_file; don't print error message.
3807 * incremental-dump.cc (main): Adjust call to
3808 Output_file::open_for_modification.
3809 * incremental-dump.cc (main): Likewise.
3810 * incremental.cc (Incremental_inputs::report_command_line):
3811 Ignore --incremental-base option when comparing command lines.
3812 Ignore parameter when given as separate argument.
3813 * options.h (class General_options): Add --incremental-base.
3814 * output.cc (Output_file::Output_file):
3815 (Output_file::open_base_file): Add base_name and writable parameters;
3816 read base file into new file; print error message here.
3817 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3818 callers.
3819 * output.h (Output_file::open_for_modification): Rename to...
3820 (Output_file::open_base_file): ...this; add base_name and
3821 writable parameters; adjust all callers.
3822 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3823 callers.
3824 * testsuite/Makefile.am (incremental_test_4): Test
3825 --incremental-base.
3826 * testsuite/Makefile.in: Regenerate.
3827
3828 2011-05-24 Cary Coutant <ccoutant@google.com>
3829
3830 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3831 incremental_test_4.
3832 * testsuite/Makefile.in: Regenerate.
3833 * testsuite/two_file_test_1_v1.cc: New test source file.
3834 * testsuite/two_file_test_1b_v1.cc: New test source file.
3835 * testsuite/two_file_test_2_v1.cc: New test source file.
3836
3837 2011-05-24 Cary Coutant <ccoutant@google.com>
3838
3839 * dynobj.h (Dynobj::do_dynobj): New function.
3840 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3841 flag and soname for shared objects.
3842 * incremental.cc (Incremental_inputs::report_object): Make
3843 either Incremental_object_entry or Incremental_dynobj_entry; add
3844 soname to string table.
3845 (Incremental_inputs::report_input_section): Add assertion.
3846 (Output_section_incremental_inputs::set_final_data_size): Adjust
3847 type of input file entry for shared libraries; adjust size of
3848 shared library info entry.
3849 (Output_section_incremental_inputs::write_input_files): Write
3850 as_needed flag for shared libraries.
3851 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3852 of input file entry for shared libraries; write soname.
3853 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3854 soname from incremental info.
3855 * incremental.h (enum Incremental_input_flags): Add
3856 INCREMENTAL_INPUT_AS_NEEDED.
3857 (Incremental_input_entry::Incremental_input_entry): Initialize new
3858 data member.
3859 (Incremental_input_entry::set_as_needed): New function.
3860 (Incremental_input_entry::as_needed): New function.
3861 (Incremental_input_entry::do_dynobj_entry): New function.
3862 (Incremental_input_entry::as_needed_): New data member.
3863 (Incremental_object_entry::Incremental_object_entry): Don't check
3864 for shared library.
3865 (Incremental_object_entry::do_type): Likewise.
3866 (class Incremental_dynobj_entry): New class.
3867 (Incremental_input_entry_reader::as_needed): New function.
3868 (Incremental_input_entry_reader::get_soname): New function.
3869 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3870 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3871 size of shared library info entry.
3872 * layout.cc (Layout::finish_dynamic_section): Don't test for
3873 incremental link when adding DT_NEEDED entries.
3874 * object.h (Object::Object): Initialize new data member.
3875 (Object::dynobj): New function.
3876 (Object::set_as_needed): New function.
3877 (Object::as_needed): New function.
3878 (Object::do_dynobj): New function.
3879 (Object::as_needed_): New data member.
3880
3881 2011-05-24 Cary Coutant <ccoutant@google.com>
3882
3883 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3884 info; adjust display of GOT entries.
3885 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3886 vector of input objects; remove file_status_.
3887 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3888 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3889 got_plt reader; call target hooks to reserve GOT entries.
3890 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3891 of input file info header and GOT info entry.
3892 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3893 relocation info.
3894 (Got_plt_view_info::got_descriptor): Remove.
3895 (Got_plt_view_info::sym_index): New data member.
3896 (Got_plt_view_info::input_index): New data member.
3897 (Local_got_offset_visitor::visit): Write input file index.
3898 (Global_got_offset_visitor::visit): Write 0 for input file index.
3899 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3900 with sym_index and input_index.
3901 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3902 incremental info GOT entry; replace got_descriptor with input_index.
3903 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3904 map from input file index to object.
3905 (Sized_relobj_incr::do_layout): Replace direct data member reference
3906 with accessor function.
3907 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3908 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3909 Adjust size of input file info header.
3910 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3911 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3912 (Incremental_input_entry_reader::get_input_section): Adjust size of
3913 input file info header.
3914 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3915 of incremental info GOT entry.
3916 (Incremental_got_plt_reader::get_got_desc): Remove.
3917 (Incremental_got_plt_reader::get_got_symndx): New function.
3918 (Incremental_got_plt_reader::get_got_input_index): New function.
3919 (Sized_incremental_binary::Sized_incremental_binary): Remove
3920 file_status_; add input_objects_.
3921 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3922 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3923 (Sized_incremental_binary::file_is_unchanged): Remove.
3924 (Sized_incremental_binary::set_input_object): New function.
3925 (Sized_incremental_binary::input_object): New function.
3926 (Sized_incremental_binary::file_status_): Remove.
3927 (Sized_incremental_binary::input_objects_): New data member.
3928 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3929 references.
3930 (Sized_relobj_incr::invalid_address): Move to base class.
3931 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3932 class.
3933 (Sized_relobj_incr::do_output_section_offset): Likewise.
3934 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3935 (Sized_relobj_incr::section_offsets_): Likewise.
3936 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3937 function.
3938 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3939 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3940 with accessor function.
3941 (Sized_relobj_file::do_layout): Likewise.
3942 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3943 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3944 (Sized_relobj_file::compute_final_local_value): Replace refs to
3945 section_offsets_ with accessor function.
3946 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3947 * object.h (Relobj::Relobj): Initialize new data members.
3948 (Relobj::add_dyn_reloc): New function.
3949 (Relobj::first_dyn_reloc): New function.
3950 (Relobj::dyn_reloc_count): New function.
3951 (Relobj::first_dyn_reloc_): New data member.
3952 (Relobj::dyn_reloc_count_): New data member.
3953 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3954 references.
3955 (Sized_relobj::Address): New typedef.
3956 (Sized_relobj::invalid_address): Move here from child class.
3957 (Sized_relobj::Sized_relobj): Initialize new data members.
3958 (Sized_relobj::sized_relobj): New function.
3959 (Sized_relobj::is_output_section_offset_invalid): Move here from
3960 child class.
3961 (Sized_relobj::get_output_section_offset): Likewise.
3962 (Sized_relobj::local_has_got_offset): Likewise.
3963 (Sized_relobj::local_got_offset): Likewise.
3964 (Sized_relobj::set_local_got_offset): Likewise.
3965 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3966 (Sized_relobj::clear_got_offsets): New function.
3967 (Sized_relobj::section_offsets): Move here from child class.
3968 (Sized_relobj::do_output_section_offset): Likewise.
3969 (Sized_relobj::do_set_section_offset): Likewise.
3970 (Sized_relobj::Local_got_offsets): Likewise.
3971 (Sized_relobj::local_got_offsets_): Likewise.
3972 (Sized_relobj::section_offsets_): Likewise.
3973 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3974 references.
3975 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3976 class.
3977 (Sized_relobj_file::sized_relobj): New function
3978 (Sized_relobj_file::local_has_got_offset): Move to base class.
3979 (Sized_relobj_file::local_got_offset): Likewise.
3980 (Sized_relobj_file::set_local_got_offset): Likewise.
3981 (Sized_relobj_file::get_output_section_offset): Likewise.
3982 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3983 (Sized_relobj_file::do_output_section_offset): Likewise.
3984 (Sized_relobj_file::do_set_section_offset): Likewise.
3985 (Sized_relobj_file::Local_got_offsets): Likewise.
3986 (Sized_relobj_file::local_got_offsets_): Likewise.
3987 (Sized_relobj_file::section_offsets_): Likewise.
3988 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3989 (all constructors).
3990 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3991 (Output_reloc::get_symbol_index): Likewise.
3992 (Output_reloc::local_section_offset): Likewise.
3993 (Output_reloc::get_address): Likewise.
3994 (Output_reloc::symbol_value): Likewise.
3995 (Output_data_got::reserve_slot): Move to class definition.
3996 (Output_data_got::reserve_local): New function.
3997 (Output_data_got::reserve_slot_for_global): Remove.
3998 (Output_data_got::reserve_global): New function.
3999 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4000 (all constructors, two instantiations).
4001 (Output_reloc::get_relobj): New function (two instantiations).
4002 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4003 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4004 (Output_data_reloc::add_global): Adjust type of relobj.
4005 (Output_data_reloc::add_global_relative): Likewise.
4006 (Output_data_reloc::add_symbolless_global_addend): Likewise.
4007 (Output_data_reloc::add_local): Likewise.
4008 (Output_data_reloc::add_local_relative): Likewise.
4009 (Output_data_reloc::add_symbolless_local_addend): Likewise.
4010 (Output_data_reloc::add_local_section): Likewise.
4011 (Output_data_reloc::add_output_section): Likewise.
4012 (Output_data_reloc::add_absolute): Likewise.
4013 (Output_data_reloc::add_target_specific): Likewise.
4014 (Output_data_got::reserve_slot): Move definition here.
4015 (Output_data_got::reserve_local): New function.
4016 (Output_data_got::reserve_global): New function.
4017 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4018 section_offsets_ with accessor function.
4019 (Sized_relobj_file::write_sections): Likewise.
4020 (Sized_relobj_file::do_relocate_sections): Likewise.
4021 * target.h (Sized_target::reserve_local_got_entry): New function.
4022 (Sized_target::reserve_global_got_entry): New function.
4023 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4024 (Target_x86_64::reserve_global_got_entry): New function.
4025 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4026
4027 2011-05-23 Cary Coutant <ccoutant@google.com>
4028
4029 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4030 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4031 bit when checking got_type.
4032 * incremental.cc (Sized_incremental_binary::setup_readers):
4033 Store symbol table and string table locations; initialize bit vector
4034 of file status flags.
4035 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4036 unchanged files.
4037 (Sized_incremental_binary::do_process_got_plt): New function.
4038 (Sized_incremental_binary::get_symtab_view): Use stored locations.
4039 (Output_section_incremental_inputs::set_final_data_size): Record
4040 file index for each input file.
4041 (Output_section_incremental_inputs::write_got_plt): Store file index
4042 instead of input entry offset for each GOT entry.
4043 * incremental.h
4044 (Incremental_input_entry::Incremental_input_entry): Initialize new
4045 data member.
4046 (Incremental_input_entry::set_offset): Store file index.
4047 (Incremental_input_entry::get_file_index): New function.
4048 (Incremental_input_entry::file_index_): New data member.
4049 (Incremental_binary::process_got_plt): New function.
4050 (Incremental_binary::do_process_got_plt): New function.
4051 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4052 data members.
4053 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4054 (Sized_incremental_binary::set_file_is_unchanged): New function.
4055 (Sized_incremental_binary::file_is_unchanged): New function.
4056 (Sized_incremental_binary::do_process_got_plt): New function.
4057 (Sized_incremental_binary::file_status_): New data member.
4058 (Sized_incremental_binary::main_symtab_loc_): New data member.
4059 (Sized_incremental_binary::main_strtab_loc_): New data member.
4060 * output.cc (Output_data_got::Got_entry::write): Add case
4061 RESERVED_CODE.
4062 (Output_data_got::add_global): Call add_got_entry.
4063 (Output_data_got::add_global_plt): Likewise.
4064 (Output_data_got::add_global_with_rel): Likewise.
4065 (Output_data_got::add_global_with_rela): Likewise.
4066 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4067 (Output_data_got::add_global_pair_with_rela): Likewise.
4068 (Output_data_got::add_local): Call add_got_entry.
4069 (Output_data_got::add_local_plt): Likewise.
4070 (Output_data_got::add_local_with_rel): Likewise.
4071 (Output_data_got::add_local_with_rela): Likewise.
4072 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4073 (Output_data_got::add_local_pair_with_rela): Likewise.
4074 (Output_data_got::reserve_slot): New function.
4075 (Output_data_got::reserve_slot_for_global): New function.
4076 (Output_data_got::add_got_entry): New function.
4077 (Output_data_got::add_got_entry_pair): New function.
4078 (Output_section::add_output_section_data): Edit FIXME.
4079 * output.h
4080 (Output_section_data_build::Output_section_data_build): New
4081 constructor with size parameter.
4082 (Output_data_space::Output_data_space): Likewise.
4083 (Output_data_got::Output_data_got): Initialize new data member; new
4084 constructor with size parameter.
4085 (Output_data_got::add_constant): Call add_got_entry.
4086 (Output_data_got::reserve_slot): New function.
4087 (Output_data_got::reserve_slot_for_global): New function.
4088 (class Output_data_got::Got_entry): Add RESERVED_CODE.
4089 (Output_data_got::add_got_entry): New function.
4090 (Output_data_got::add_got_entry_pair): New function.
4091 (Output_data_got::free_list_): New data member.
4092 * target.h (Sized_target::init_got_plt_for_update): New function.
4093 (Sized_target::register_global_plt_entry): New function.
4094 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4095 Initialize new data member; call init; add constructor with PLT count.
4096 (Output_data_plt_x86_64::init): New function.
4097 (Output_data_plt_x86_64::add_relocation): New function.
4098 (Output_data_plt_x86_64::reserve_slot): New function.
4099 (Output_data_plt_x86_64::free_list_): New data member.
4100 (Target_x86_64::init_got_plt_for_update): New function.
4101 (Target_x86_64::register_global_plt_entry): New function.
4102 (Output_data_plt_x86_64::add_entry): Allocate from free list for
4103 incremental updates.
4104 (Output_data_plt_x86_64::add_relocation): New function.
4105 * testsuite/object_unittest.cc (Object_test): Set default options.
4106
4107 2011-05-16 Ian Lance Taylor <iant@google.com>
4108
4109 * options.h (class General_options): Make -i a synonym for -r.
4110
4111 2011-05-16 Ian Lance Taylor <iant@google.com>
4112
4113 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4114
4115 2011-05-10 Cary Coutant <ccoutant@google.com>
4116
4117 * object.cc (Sized_relobj::do_count_local_symbols): Check for
4118 strip_all (-s).
4119
4120 2011-05-06 Ian Lance Taylor <iant@google.com>
4121
4122 * layout.cc (Layout::layout): If the output section flags change,
4123 update the ordering.
4124
4125 2011-04-25 Cary Coutant <ccoutant@google.com>
4126
4127 * incremental-dump.cc (dump_incremental_inputs): Print local
4128 symbol info for each input file.
4129 * incremental.cc
4130 (Output_section_incremental_inputs::set_final_data_size): Add local
4131 symbol info to input file entries in incremental info.
4132 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4133 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4134 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4135 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4136 implementation.
4137 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4138 (Sized_incr_relobj::do_relocate): Write the local symbols.
4139 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4140 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4141 Adjust size of input file header.
4142 (Incremental_inputs_reader::get_local_symbol_offset): New function.
4143 (Incremental_inputs_reader::get_local_symbol_count): New function.
4144 (Incremental_inputs_reader::get_input_section): Adjust size of input
4145 file header.
4146 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4147 (Sized_incr_relobj::This): New typedef.
4148 (Sized_incr_relobj::sym_size): New const data member.
4149 (Sized_incr_relobj::Local_symbol): New struct.
4150 (Sized_incr_relobj::do_output_local_symbol_count): New function.
4151 (Sized_incr_relobj::do_local_symbol_offset): New function.
4152 (Sized_incr_relobj::local_symbol_count_): New data member.
4153 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4154 (Sized_incr_relobj::local_symbol_index_): New data member.
4155 (Sized_incr_relobj::local_symbol_offset_): New data member.
4156 (Sized_incr_relobj::local_dynsym_offset_): New data member.
4157 (Sized_incr_relobj::local_symbols_): New data member.
4158 * object.h (Relobj::output_local_symbol_count): New function.
4159 (Relobj::local_symbol_offset): New function.
4160 (Relobj::do_output_local_symbol_count): New function.
4161 (Relobj::do_local_symbol_offset): New function.
4162 (Sized_relobj::do_output_local_symbol_count): New function.
4163 (Sized_relobj::do_local_symbol_offset): New function.
4164
4165 2011-04-22 Vladimir Simonov <sv@sw.ru>
4166
4167 * descriptors.cc (set_close_on_exec): New function.
4168 (Descriptors::open): Use set_close_on_exec.
4169 * output.cc (S_ISLNK): Define if not defined.
4170
4171 2011-04-22 Cary Coutant <ccoutant@google.com>
4172
4173 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4174 global symbol map.
4175 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4176 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4177 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4178 relocations.
4179 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4180 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4181 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4182 * incremental.h
4183 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4184 function.
4185 (Incremental_binary::apply_incremental_relocs): New function.
4186 (Incremental_binary::do_apply_incremental_relocs): New function.
4187 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4188 data member.
4189 (Sized_incremental_binary::add_global_symbol): New function.
4190 (Sized_incremental_binary::global_symbol): New function.
4191 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4192 (Sized_incremental_binary::symbol_map_): New data member.
4193 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4194 * target.h (Sized_target::apply_relocation): New function.
4195 * target-reloc.h (apply_relocation): New function.
4196 * x86_64.cc (Target_x86_64::apply_relocation): New function.
4197
4198 2011-04-22 Doug Kwan <dougkwan@google.com>
4199
4200 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4201 flag of a SHT_ARM_EXIDX section.
4202 * testsuite/Makefile.am (arm_exidx_test): New test rules.
4203 * testsuite/Makefile.in: Regenerate.
4204 * testsuite/arm_exidx_test.s: New file.
4205 * testsuite/arm_exidx_test.sh: Same.
4206
4207 2011-04-20 Cary Coutant <ccoutant@google.com>
4208
4209 PR gold/12689
4210 * archive.h (Incremental_archive_entry::Archive_member):
4211 Initialize arg_serial_ (second constructor).
4212
4213 2011-04-17 Ian Lance Taylor <iant@google.com>
4214
4215 * object.cc (Relocate_info::location): Simplify location string.
4216 * errors.cc (Errors::error_at_location): Don't print program
4217 name.
4218 (Errors::warning_at_location): Likewise.
4219 (Errors::undefined_symbol): Likewise.
4220 * testsuite/debug_msg.sh: Update accordingly.
4221
4222 2011-04-14 Cary Coutant <ccoutant@google.com>
4223
4224 * gold/layout.cc (Layout::symtab_section_offset): New function.
4225 * gold/layout.h (Layout::symtab_section_offset): New function.
4226 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4227
4228 2011-04-12 Ian Lance Taylor <iant@google.com>
4229
4230 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
4231 with MREMAP_MAYMOVE.
4232 * output.h (class Output_file): Add map_is_allocated_ field.
4233 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
4234 not available, provide stubs. If mremap is not available, #define
4235 it to gold_mremap.
4236 (MREMAP_MAYMOVE): Define if not defined.
4237 (Output_file::Output_file): Initialize map_is_allocated_.
4238 (Output_file::resize): Check map_is_allocated_.
4239 (Output_file::map_anonymous): If mmap fails, use malloc.
4240 (Output_file::unmap): Don't do anything for an anonymous map.
4241 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
4242 is not available, provide stubs.
4243 (File_read::View::~View): Use free rather than delete[].
4244 (File_read::make_view): Use malloc rather than new[]. If mmap
4245 fails, use malloc.
4246 (File_read::find_or_make_view): Use malloc rather than new[].
4247 * gold.h: Remove HAVE_REMAP code.
4248 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
4249 exists. Rename mremap to gold_mremap. If mmap is not available
4250 don't do anything.
4251 * configure, config.in: Rebuild.
4252
4253 2011-04-11 Ian Lance Taylor <iant@google.com>
4254
4255 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4256 initialize local variable v.
4257
4258 2011-04-11 Cary Coutant <ccoutant@google.com>
4259
4260 * archive.cc (Archive::include_member): Adjust call to
4261 report_object.
4262 (Add_archive_symbols::run): Track argument serial numbers.
4263 (Lib_group::include_member): Likewise.
4264 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4265 * archive.h (Incremental_archive_entry::Archive_member):
4266 Initialize arg_serial_.
4267 (Archive_member::arg_serial_): New data member.
4268 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4269 (Sized_dynobj::do_add_symbols): Track symbols when doing an
4270 incremental link.
4271 (Sized_dynobj::do_for_all_local_got_entries): New function.
4272 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4273 function.
4274 * fileread.cc (get_mtime): New function.
4275 * fileread.h (get_mtime): New function.
4276 * gold.cc (queue_initial_tasks): Check for incremental update.
4277 (process_incremental_input): New function.
4278 (queue_middle_tasks): Don't force valid target for incremental
4279 update.
4280 * incremental-dump.cc (find_input_containing_global): Adjust
4281 size of symbol info entry.
4282 (dump_incremental_inputs): Dump argument serial number and
4283 in_system_directory flag; bias shndx by 1; print symbol names
4284 when dumping per-file symbol lists; use new symbol info readers.
4285 * incremental.cc
4286 (Output_section_incremental_inputs:update_data_size): New function.
4287 (Sized_incremental_binary::setup_readers): Setup input readers
4288 for each input file; build maps for files added from libraries
4289 and scripts.
4290 (Sized_incremental_binary::check_input_args): New function.
4291 (Sized_incremental_binary::do_check_inputs): Build map of argument
4292 serial numbers to input arguments.
4293 (Sized_incremental_binary::do_file_has_changed): Rename
4294 do_file_is_unchanged to this; compare file modification times.
4295 (Sized_incremental_binary::do_init_layout): New function.
4296 (Sized_incremental_binary::do_reserve_layout): New function.
4297 (Sized_incremental_binary::do_get_input_reader): Remove.
4298 (Sized_incremental_binary::get_symtab_view): New function.
4299 (Incremental_checker::can_incrementally_link_output_file): Remove.
4300 (Incremental_inputs::report_command_line): Exclude --debug options.
4301 (Incremental_inputs::report_archive_begin): Add parameter; track
4302 argument serial numbers; don't put input file entry for archive
4303 before archive members.
4304 (Incremental_inputs::report_archive_end): Put input file entry
4305 for archive after archive members.
4306 (Incremental_inputs::report_object): Add parameter; track argument
4307 serial numbers and in_system_directory flag.
4308 (Incremental_inputs::report_script): Add parameter; track argument
4309 serial numbers.
4310 (Output_section_incremental_inputs::set_final_data_size): Adjust
4311 size of symbol info entry; check for forwarding symbols.
4312 (Output_section_incremental_inputs::write_input_files): Write
4313 in_system_directory flag and argument serial number.
4314 (Output_section_incremental_inputs::write_info_blocks): Map section
4315 indices between incremental info and original input file; store
4316 input section index for each symbol.
4317 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4318 change operator() to visit().
4319 (class Global_got_offset_visitor): Likewise.
4320 (class Global_symbol_visitor_got_plt):
4321 (Output_section_incremental_inputs::write_got_plt): Use new visitor
4322 classes.
4323 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4324 (Sized_incr_relobj::do_read_symbols): New function.
4325 (Sized_incr_relobj::do_layout): New function.
4326 (Sized_incr_relobj::do_layout_deferred_sections): New function.
4327 (Sized_incr_relobj::do_add_symbols): New function.
4328 (Sized_incr_relobj::do_should_include_member): New function.
4329 (Sized_incr_relobj::do_for_all_global_symbols): New function.
4330 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4331 (Sized_incr_relobj::do_section_size): New function.
4332 (Sized_incr_relobj::do_section_name): New function.
4333 (Sized_incr_relobj::do_section_contents): New function.
4334 (Sized_incr_relobj::do_section_flags): New function.
4335 (Sized_incr_relobj::do_section_entsize): New function.
4336 (Sized_incr_relobj::do_section_address): New function.
4337 (Sized_incr_relobj::do_section_type): New function.
4338 (Sized_incr_relobj::do_section_link): New function.
4339 (Sized_incr_relobj::do_section_info): New function.
4340 (Sized_incr_relobj::do_section_addralign): New function.
4341 (Sized_incr_relobj::do_initialize_xindex): New function.
4342 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4343 (Sized_incr_relobj::do_read_relocs): New function.
4344 (Sized_incr_relobj::do_gc_process_relocs): New function.
4345 (Sized_incr_relobj::do_scan_relocs): New function.
4346 (Sized_incr_relobj::do_count_local_symbols): New function.
4347 (Sized_incr_relobj::do_finalize_local_symbols): New function.
4348 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4349 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4350 (Sized_incr_relobj::do_relocate): New function.
4351 (Sized_incr_relobj::do_set_section_offset): New function.
4352 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4353 (Sized_incr_dynobj::do_read_symbols): New function.
4354 (Sized_incr_dynobj::do_layout): New function.
4355 (Sized_incr_dynobj::do_add_symbols): New function.
4356 (Sized_incr_dynobj::do_should_include_member): New function.
4357 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4358 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4359 (Sized_incr_dynobj::do_section_size): New function.
4360 (Sized_incr_dynobj::do_section_name): New function.
4361 (Sized_incr_dynobj::do_section_contents): New function.
4362 (Sized_incr_dynobj::do_section_flags): New function.
4363 (Sized_incr_dynobj::do_section_entsize): New function.
4364 (Sized_incr_dynobj::do_section_address): New function.
4365 (Sized_incr_dynobj::do_section_type): New function.
4366 (Sized_incr_dynobj::do_section_link): New function.
4367 (Sized_incr_dynobj::do_section_info): New function.
4368 (Sized_incr_dynobj::do_section_addralign): New function.
4369 (Sized_incr_dynobj::do_initialize_xindex): New function.
4370 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4371 (make_sized_incremental_object): New function.
4372 (Incremental_library::copy_unused_symbols): New function.
4373 (Incremental_library::do_for_all_unused_symbols): New function.
4374 * incremental.h (enum Incremental_input_flags): New type.
4375 (class Incremental_checker): Remove.
4376 (Incremental_input_entry::Incremental_input_entry): Add argument
4377 serial number.
4378 (Incremental_input_entry::arg_serial): New function.
4379 (Incremental_input_entry::set_is_in_system_directory): New function.
4380 (Incremental_input_entry::is_in_system_directory): New function.
4381 (Incremental_input_entry::arg_serial_): New data member.
4382 (Incremental_input_entry::is_in_system_directory_): New data member.
4383 (class Script_info): Move here from script.h.
4384 (Script_info::Script_info): Add filename parameter.
4385 (Script_info::filename): New function.
4386 (Script_info::filename_): New data member.
4387 (Incremental_script_entry::Incremental_script_entry): Add argument
4388 serial number.
4389 (Incremental_object_entry::Incremental_object_entry): Likewise.
4390 (Incremental_object_entry::add_input_section): Build list of input
4391 sections with map to original shndx.
4392 (Incremental_object_entry::get_input_section_index): New function.
4393 (Incremental_object_entry::shndx_): New data member.
4394 (Incremental_object_entry::name_key_): Rename; adjust all refs.
4395 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4396 (Incremental_archive_entry::Incremental_archive_entry): Add argument
4397 serial number.
4398 (Incremental_inputs::report_archive_begin): Likewise.
4399 (Incremental_inputs::report_object): Likewise.
4400 (Incremental_inputs::report_script): Likewise.
4401 (class Incremental_global_symbol_reader): New class.
4402 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4403 and store flags and input file type.
4404 (Incremental_input_entry_reader::arg_serial): New function.
4405 (Incremental_input_entry_reader::type): Extract type from flags.
4406 (Incremental_input_entry_reader::is_in_system_directory): New function.
4407 (Incremental_input_entry_reader::get_input_section_count): Call
4408 accessor function for type.
4409 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4410 function for type; adjust size of global symbol entry.
4411 (Incremental_input_entry_reader::get_global_symbol_count): Call
4412 accessor function for type.
4413 (Incremental_input_entry_reader::get_object_count): Likewise.
4414 (Incremental_input_entry_reader::get_object_offset): Likewise.
4415 (Incremental_input_entry_reader::get_member_count): Likewise.
4416 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4417 (Incremental_input_entry_reader::get_member_offset): Likewise.
4418 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4419 (Incremental_input_entry_reader::Global_symbol_info): Remove.
4420 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4421 (Incremental_input_entry_reader::get_global_symbol_reader): New
4422 function.
4423 (Incremental_input_entry_reader::get_output_symbol_index): New
4424 function.
4425 (Incremental_input_entry_reader::type_): Remove.
4426 (Incremental_input_entry_reader::flags_): New data member.
4427 (Incremental_inputs_reader::input_file_offset): New function.
4428 (Incremental_inputs_reader::input_file_index): New function.
4429 (Incremental_inputs_reader::input_file): Call input_file_offset.
4430 (Incremental_inputs_reader::input_file_at_offset): New function.
4431 (Incremental_relocs_reader::get_r_type): Reformat.
4432 (Incremental_relocs_reader::get_r_shndx): Reformat.
4433 (Incremental_relocs_reader::get_r_offset): Reformat.
4434 (Incremental_relocs_reader::data): New function.
4435 (Incremental_binary::Incremental_binary): Initialize new data members.
4436 (Incremental_binary::check_inputs): Add cmdline parameter.
4437 (Incremental_binary::file_is_unchanged): Remove.
4438 (Input_reader::arg_serial): New function.
4439 (Input_reader::get_unused_symbol_count): New function.
4440 (Input_reader::get_unused_symbol): New function.
4441 (Input_reader::do_arg_serial): New function.
4442 (Input_reader::do_get_unused_symbol_count): New function.
4443 (Input_reader::do_get_unused_symbol): New function.
4444 (Incremental_binary::input_file_count): New function.
4445 (Incremental_binary::get_input_reader): Change signature to use
4446 index instead of filename.
4447 (Incremental_binary::file_has_changed): New function.
4448 (Incremental_binary::get_input_argument): New function.
4449 (Incremental_binary::get_library): New function.
4450 (Incremental_binary::get_script_info): New function.
4451 (Incremental_binary::init_layout): New function.
4452 (Incremental_binary::reserve_layout): New function.
4453 (Incremental_binary::output_file): New function.
4454 (Incremental_binary::do_check_inputs): New function.
4455 (Incremental_binary::do_file_is_unchanged): Remove.
4456 (Incremental_binary::do_file_has_changed): New function.
4457 (Incremental_binary::do_init_layout): New function.
4458 (Incremental_binary::do_reserve_layout): New function.
4459 (Incremental_binary::do_input_file_count): New function.
4460 (Incremental_binary::do_get_input_reader): Change signature.
4461 (Incremental_binary::input_args_map_): New data member.
4462 (Incremental_binary::library_map_): New data member.
4463 (Incremental_binary::script_map_): New data member.
4464 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4465 new data members.
4466 (Sized_incremental_binary::output_section): New function.
4467 (Sized_incremental_binary::inputs_reader): Add const.
4468 (Sized_incremental_binary::symtab_reader): Add const.
4469 (Sized_incremental_binary::relocs_reader): Add const.
4470 (Sized_incremental_binary::got_plt_reader): Add const.
4471 (Sized_incremental_binary::get_symtab_view): New function.
4472 (Sized_incremental_binary::Inputs_reader): New typedef.
4473 (Sized_incremental_binary::Input_entry_reader): New typedef.
4474 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4475 (Sized_incremental_binary::do_file_is_unchanged): Remove.
4476 (Sized_incremental_binary::do_file_has_changed): New function.
4477 (Sized_incremental_binary::do_init_layout): New function.
4478 (Sized_incremental_binary::do_reserve_layout): New function.
4479 (Sized_input_reader::Inputs_reader): Remove.
4480 (Sized_input_reader::Input_entry_reader): Remove.
4481 (Sized_input_reader::do_arg_serial): New function.
4482 (Sized_input_reader::do_get_unused_symbol_count): New function.
4483 (Sized_input_reader::do_get_unused_symbol): New function.
4484 (Sized_incremental_binary::do_input_file_count): New function.
4485 (Sized_incremental_binary::do_get_input_reader): Change signature;
4486 use index instead of filename.
4487 (Sized_incremental_binary::section_map_): New data member.
4488 (Sized_incremental_binary::input_entry_readers_): New data member.
4489 (class Sized_incr_relobj): New class.
4490 (class Sized_incr_dynobj): New class.
4491 (make_sized_incremental_object): New function.
4492 (class Incremental_library): New class.
4493 * layout.cc (Free_list::num_lists): New static data member.
4494 (Free_list::num_nodes): New static data member.
4495 (Free_list::num_removes): New static data member.
4496 (Free_list::num_remove_visits): New static data member.
4497 (Free_list::num_allocates): New static data member.
4498 (Free_list::num_allocate_visits): New static data member.
4499 (Free_list::init): New function.
4500 (Free_list::remove): New function.
4501 (Free_list::allocate): New function.
4502 (Free_list::dump): New function.
4503 (Free_list::print_stats): New function.
4504 (Layout_task_runner::run): Resize output file for incremental updates.
4505 (Layout::Layout): Initialize new data members.
4506 (Layout::set_incremental_base): New function.
4507 (Layout::init_fixed_output_section): New function.
4508 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4509 incremental updates.
4510 (Layout::create_gold_note): Do not create gold note section for
4511 incremental updates.
4512 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4513 for incremental updates.
4514 (Layout::set_section_offsets): For incremental updates, allocate space
4515 from free list.
4516 (Layout::create_symtab_sections): Layout with offsets relative to
4517 start of section; for incremental updates, allocate space from free
4518 list.
4519 (Layout::create_shdrs): For incremental updates, allocate space from
4520 free list.
4521 (Layout::finish_dynamic_section): For incremental updates, do not
4522 check --as-needed (fixed in subsequent patch).
4523 * layout.h (class Free_list): New class.
4524 (Layout::set_incremental_base): New function.
4525 (Layout::incremental_base): New function.
4526 (Layout::init_fixed_output_section): New function.
4527 (Layout::allocate): New function.
4528 (Layout::incremental_base_): New data member.
4529 (Layout::free_list_): New data member.
4530 * main.cc (main): Print Free_list statistics.
4531 * object.cc (Relobj::finalize_incremental_relocs): Add
4532 clear_counts parameter; clear counts only when clear_counts is set.
4533 (Sized_relobj::Sized_relobj): Initialize new base class.
4534 (Sized_relobj::do_layout): Don't report special sections.
4535 (Sized_relobj::do_for_all_local_got_entries): New function.
4536 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4537 symtab_off to all symbol table offsets.
4538 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4539 * object.h (class Got_offset_list): Move to top of file.
4540 (Object::Object): Allow case where input_file == NULL.
4541 (Object::~Object): Likewise.
4542 (Object::input_file): Assert that input_file != NULL.
4543 (Object::lock): Allow case where input_file == NULL.
4544 (Object::unlock): Likewise.
4545 (Object::is_locked): Likewise.
4546 (Object::token): Likewise.
4547 (Object::release): Likewise.
4548 (Object::is_incremental): New function.
4549 (Object::get_mtime): New function.
4550 (Object::for_all_local_got_entries): New function.
4551 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4552 (Object::set_is_in_system_directory): New function.
4553 (Object::is_in_system_directory): New function.
4554 (Object::do_is_incremental): New function.
4555 (Object::do_get_mtime): New function.
4556 (Object::do_for_all_local_got_entries): New function.
4557 (Object::is_in_system_directory_): New data member.
4558 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4559 (class Sized_relobj_base): New class.
4560 (class Sized_relobj): Derive from Sized_relobj_base.
4561 (class Sized_relobj::Symbols): Redeclare from base class.
4562 (class Sized_relobj::local_got_offset_list): Remove.
4563 (class Sized_relobj::Output_sections): Redeclare from base class.
4564 (class Sized_relobj::do_for_all_local_got_entries): New function.
4565 (class Sized_relobj::write_local_symbols): Add offset parameter.
4566 (class Sized_relobj::local_symbol_offset_): Update comment.
4567 (class Sized_relobj::local_dynsym_offset_): Update comment.
4568 * options.cc (Input_arguments::add_file): Remove const.
4569 * options.h (Input_file_argument::Input_file_argument):
4570 Initialize arg_serial_ (all constructors).
4571 (Input_file_argument::set_arg_serial): New function.
4572 (Input_file_argument::arg_serial): New function.
4573 (Input_file_argument::arg_serial_): New data member.
4574 (Input_arguments::Input_arguments): Initialize file_count_.
4575 (Input_arguments::add_file): Remove const.
4576 (Input_arguments::number_of_input_files): New function.
4577 (Input_arguments::file_count_): New data member.
4578 (Command_line::number_of_input_files): Call
4579 Input_arguments::number_of_input_files.
4580 * output.cc (Output_segment_headers::Output_segment_headers):
4581 Set current size.
4582 (Output_section::Input_section::current_data_size): New function.
4583 (Output_section::Output_section): Initialize new data members.
4584 (Output_section::add_input_section): Don't do merge sections for
4585 an incremental link; allocate space from free list for an
4586 incremental update.
4587 (Output_section::add_output_section_data): Allocate space from
4588 free list for an incremental update.
4589 (Output_section::update_data_size): New function.
4590 (Output_section::set_fixed_layout): New function.
4591 (Output_section::reserve): New function.
4592 (Output_segment::set_section_addresses): Remove const.
4593 (Output_segment::set_section_list_addresses): Remove const; allocate
4594 space from free list for an incremental update.
4595 (Output_segment::set_offset): Adjust size of RELRO segment for an
4596 incremental update.
4597 * output.h (Output_data::current_data_size): Move here from
4598 child classes.
4599 (Output_data::pre_finalize_data_size): New function.
4600 (Output_data::update_data_size): New function.
4601 (Output_section_headers::update_data_size): new function.
4602 (Output_section_data_build::current_data_size): Move to Output_data.
4603 (Output_data_strtab::update_data_size): New function.
4604 (Output_section::current_data_size): Move to Output_data.
4605 (Output_section::set_fixed_layout): New function.
4606 (Output_section::has_fixed_layout): New function.
4607 (Output_section::reserve): New function.
4608 (Output_section::update_data_size): New function.
4609 (Output_section::has_fixed_layout_): New data member.
4610 (Output_section::free_list_): New data member.
4611 (Output_segment::set_section_addresses): Remove const.
4612 (Output_segment::set_section_list_addresses): Remove const.
4613 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4614 New function.
4615 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4616 New function.
4617 * readsyms.cc (Read_symbols::do_read_symbols): Add library
4618 parameter when calling Add_symbols constructor; store argument
4619 serial number for members of a lib group.
4620 (Add_symbols::locks): Allow case where token == NULL.
4621 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4622 (Read_member::~Read_member): New function.
4623 (Read_member::is_runnable): New function.
4624 (Read_member::locks): New function.
4625 (Read_member::run): New function.
4626 (Check_script::~Check_script): New function.
4627 (Check_script::is_runnable): New function.
4628 (Check_script::locks): New function.
4629 (Check_script::run): New function.
4630 (Check_library::~Check_library): New function.
4631 (Check_library::is_runnable): New function.
4632 (Check_library::locks): New function.
4633 (Check_library::run): New function.
4634 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4635 (Add_symbols::library_): New data member.
4636 (class Read_member): New class.
4637 (class Check_script): New class.
4638 (class Check_library): New class.
4639 * reloc.cc (Read_relocs::is_runnable): Allow case where
4640 token == NULL.
4641 (Read_relocs::locks): Likewise.
4642 (Scan_relocs::locks): Likewise.
4643 (Relocate_task::locks): Likewise.
4644 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4645 to clear counters.
4646 (Sized_relobj::incremental_relocs_scan): Fix comment.
4647 (Sized_relobj::do_relocate): Pass output file offset to
4648 write_local_symbols.
4649 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4650 from class declaration.
4651 * script.cc (read_input_script): Allocate Script_info; pass
4652 argument serial number to report_script.
4653 * script.h (class Script_info): Move to incremental.h.
4654 * symtab.cc (Symbol_table::add_from_incrobj): New function.
4655 * symtab.h (Symbol_table::add_from_incrobj): New function.
4656 (Symbol_table::set_file_offset): New function.
4657
4658 2011-04-05 Cary Coutant <ccoutant@google.com>
4659
4660 * incremental-dump.cc (dump_incremental_inputs): Change signature
4661 to take a Sized_incremental_binary; change caller. Use readers
4662 in Sized_incremental_binary.
4663 * incremental.cc
4664 (Sized_incremental_binary::find_incremental_inputs_sections):
4665 Rename do_find_incremental_inputs_sections to this.
4666 (Sized_incremental_binary::setup_readers): New function.
4667 (Sized_incremental_binary::do_check_inputs): Check
4668 has_incremental_info_ flag; move setup code to setup_readers;
4669 use input readers.
4670 (Sized_incremental_binary::do_file_is_unchanged): New function.
4671 (Sized_incremental_binary::do_get_input_reader): New function.
4672 * incremental.h (class Incremental_binary): Move to end of file.
4673 (Incremental_binary::file_is_unchanged): New function.
4674 (Incremental_binary::do_file_is_unchanged): New function.
4675 (Incremental_binary::Input_reader): New class.
4676 (Incremental_binary::get_input_reader): New function.
4677 (class Sized_incremental_binary): Move to end of file.
4678 (Sized_incremental_binary::Sized_incremental_binary): Setup the
4679 input section reader classes.
4680 (Sized_incremental_binary::has_incremental_info): New function.
4681 (Sized_incremental_binary::inputs_reader): New function.
4682 (Sized_incremental_binary::symtab_reader): New function.
4683 (Sized_incremental_binary::relocs_reader): New function.
4684 (Sized_incremental_binary::got_plt_reader): New function.
4685 (Sized_incremental_binary::do_file_is_unchanged): New function.
4686 (Sized_incremental_binary::Sized_input_reader): New class.
4687 (Sized_incremental_binary::get_input_reader): New function.
4688 (Sized_incremental_binary::find_incremental_inputs_sections):
4689 Rename do_find_incremental_inputs_sections to this.
4690 (Sized_incremental_binary::setup_readers): New function.
4691 (Sized_incremental_binary::has_incremental_info_): New data member.
4692 (Sized_incremental_binary::inputs_reader_): New data member.
4693 (Sized_incremental_binary::symtab_reader_): New data member.
4694 (Sized_incremental_binary::relocs_reader_): New data member.
4695 (Sized_incremental_binary::got_plt_reader_): New data member.
4696 (Sized_incremental_binary::current_input_file_): New data member.
4697
4698 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
4699
4700 PR gold/12640
4701 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4702 violation.
4703
4704 2011-03-30 Cary Coutant <ccoutant@google.com>
4705
4706 * archive.cc (Archive::include_member): Adjust call to report_object.
4707 (Add_archive_symbols::run): Add script_info to call to
4708 report_archive_begin.
4709 (Lib_group::include_member): Adjust call to report_object.
4710 (Add_lib_group_symbols::run): Adjust call to report_object.
4711 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4712 blocks. Add object count for script input files.
4713 * incremental.cc (Incremental_inputs::report_archive_begin): Add
4714 script_info parameter; change all callers.
4715 (Incremental_inputs::report_object): Add script_info parameter;
4716 change all callers.
4717 (Incremental_inputs::report_script): Store backpointer to
4718 incremental info entry.
4719 (Output_section_incremental_inputs::set_final_data_size): Record
4720 additional information for scripts.
4721 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4722 * incremental.h (Incremental_script_entry::add_object): New function.
4723 (Incremental_script_entry::get_object_count): New function.
4724 (Incremental_script_entry::get_object): New function.
4725 (Incremental_script_entry::objects_): New data member; adjust
4726 constructor.
4727 (Incremental_inputs::report_archive_begin): Add script_info parameter.
4728 (Incremental_inputs::report_object): Add script_info parameter.
4729 (Incremental_inputs_reader::get_object_count): New function.
4730 (Incremental_inputs_reader::get_object_offset): New function.
4731 * options.cc (Input_arguments::add_file): Return reference to
4732 new input argument.
4733 * options.h (Input_argument::set_script_info): New function.
4734 (Input_argument::script_info): New function.
4735 (Input_argument::script_info_): New data member; adjust all
4736 constructors.
4737 (Input_file_group::add_file): Return reference to new input argument.
4738 (Input_file_lib::add_file): Likewise.
4739 (Input_arguments::add_file): Likewise.
4740 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4741 * script.cc (Parser_closure::Parser_closure): Add script_info
4742 parameter; adjust all callers.
4743 (Parser_closure::script_info): New function.
4744 (Parser_closure::script_info_): New data member.
4745 (read_input_script): Report scripts earlier to incremental info.
4746 (script_add_file): Set script_info in Input_argument.
4747 (script_add_library): Likewise.
4748 * script.h (Script_options::Script_info): Rewrite class.
4749
4750 2011-03-29 Cary Coutant <ccoutant@google.com>
4751
4752 * archive.cc (Library_base::should_include_member): Move
4753 method here from class Archive.
4754 (Archive::Archive): Initialize base class.
4755 (Archive::should_include_member): Move to base class.
4756 (Archive::do_for_all_unused_symbols): New function.
4757 (Add_archive_symbols::run): Remove redundant access to
4758 incremental_inputs.
4759 (Lib_group::Lib_group): Initialize base class.
4760 (Lib_group::do_filename): New function.
4761 (Lib_group::include_member): Pass pointer to Lib_group to
4762 report_object.
4763 (Lib_group::do_for_all_unused_symbols): New function.
4764 (Add_lib_group_symbols::run): Report archive information for
4765 incremental links.
4766 * archive.h (class Library_base): New base class.
4767 (class Archive): Derive from Library_base.
4768 (Archive::filename): Move to base class.
4769 (Archive::set_incremental_info): Likewise.
4770 (Archive::incremental_info): Likewise.
4771 (Archive::Should_include): Likewise.
4772 (Archive::should_include_member): Likewise.
4773 (Archive::Armap_entry): Remove.
4774 (Archive::Unused_symbol_iterator): Remove.
4775 (Archive::unused_symbols_begin): Remove.
4776 (Archive::unused_symbols_end): Remove.
4777 (Archive::do_filename): New function.
4778 (Archive::do_get_mtime): New function.
4779 (Archive::do_for_all_unused_symbols): New function.
4780 (Archive::task_): Move to base class.
4781 (Archive::incremental_info_): Likewise.
4782 (class Lib_group): Derive from Library_base.
4783 (Lib_group::do_filename): New function.
4784 (Lib_group::do_get_mtime): New function.
4785 (Lib_group::do_for_all_unused_symbols): New function.
4786 (Lib_group::task_): Move to base class.
4787 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4788 function.
4789 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4790 function.
4791 * incremental.cc (Incremental_inputs::report_archive_begin):
4792 Use Library_base; call library's get_mtime; add incremental inputs
4793 entry before members.
4794 (class Unused_symbol_visitor): New class.
4795 (Incremental_inputs::report_archive_end): Use Library_base; use
4796 visitor class to record unused symbols; don't add incremental inputs
4797 entry after members.
4798 (Incremental_inputs::report_object): Use Library_base.
4799 * incremental.h
4800 (Incremental_archive_entry::Incremental_archive_entry): Remove
4801 unused Archive parameter.
4802 (Incremental_inputs::report_archive_begin): Use Library_base.
4803 (Incremental_inputs::report_archive_end): Likewise.
4804 (Incremental_inputs::report_object): Likewise.
4805 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4806 function.
4807 * object.h (Object::for_all_global_symbols): New function.
4808 (Object::do_for_all_global_symbols): New function.
4809 (Sized_relobj::do_for_all_global_symbols): New function.
4810 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4811 function.
4812 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4813 function.
4814
4815 2011-03-27 Ian Lance Taylor <iant@google.com>
4816
4817 * archive.cc (Archive::interpret_header): Return -1 if something
4818 goes wrong. Change callers accordingly.
4819
4820 2011-03-25 Cary Coutant <ccoutant@google.com>
4821
4822 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4823 * testsuite/Makefile.in: Regenerate.
4824
4825 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4826
4827 * plugin.cc (get_view): New.
4828 (Plugin::load): Pass get_view to the plugin.
4829 (Plugin_manager::get_view): New.
4830
4831 2011-03-21 Ian Lance Taylor <iant@google.com>
4832
4833 * testsuite/final_layout.sh: Rewrite to not use dc.
4834 * testsuite/relro_test.sh: Fail if dc is not present.
4835
4836 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4837
4838 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4839 Change == to -eq.
4840 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4841 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4842 Change == to -eq.
4843 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4844 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4845
4846 2011-03-14 Ian Lance Taylor <iant@google.com>
4847
4848 * script-sections.cc (Sort_output_sections::script_compare):
4849 Rename from is_before, change return type.
4850 (Sort_output_sections::operator()): Adjust accordingly.
4851
4852 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4853
4854 PR gold/12572
4855 * testsuite/odr_violation2.cc: Add comment to make all error line
4856 numbers double digits.
4857 * testsuite/debug_msg.sh: Adjust expected errors.
4858
4859 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4860
4861 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4862 but mark earlier ones as non-canonical
4863 (offset_to_iterator): Update search target and example
4864 (do_addr2line): Return extra lines in a vector*
4865 (format_file_lineno): Extract from do_addr2line
4866 (one_addr2line): Add vector* out-param
4867 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4868 when a lineno entry appeared last for its instruction
4869 (Dwarf_line_info): Add vector* out-param
4870 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4871 * symtab.cc (Odr_violation_compare): Include the lineno in the
4872 comparison again.
4873 (linenos_from_loc): New. Combine the canonical line for an
4874 address with its other lines.
4875 (True_if_intersect): New. Helper functor to make
4876 std::set_intersection a query.
4877 (detect_odr_violations): Compare sets of lines instead of just
4878 one line for each function. This became less deterministic, but
4879 has fewer false positives.
4880 * symtab.h: Declarations.
4881 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4882 mix an optimized and non-optimized object in the same binary
4883 (odr_violation2.so): Same.
4884 * testsuite/Makefile.in: Regenerate from Makefile.am.
4885 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4886 * testsuite/debug_msg.sh: Update line numbers and add
4887 assertions.
4888 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4889 non-optimized context.
4890 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4891 isn't inlined, and use OdrDerived in an optimized context.
4892 * testsuite/odr_header1.h: Defines OdrDerived, where
4893 optimization will change the
4894 first-instruction-in-the-destructor's file and line number.
4895 * testsuite/odr_header2.h: Defines OdrBase.
4896
4897 2011-03-09 Ian Lance Taylor <iant@google.com>
4898
4899 * fileread.cc (File_read::clear_views): Don't delete the whole
4900 file view.
4901
4902 2011-03-08 Ian Lance Taylor <iant@google.com>
4903
4904 PR gold/12525
4905 * fileread.cc: #include <climits>.
4906 (GOLD_IOV_MAX): Define.
4907 (File_read::read_multiple): Limit number of entries by iov_max.
4908 * fileread.h (class File_read): Always set max_readv_entries to
4909 128.
4910
4911 2011-03-07 Ian Lance Taylor <iant@google.com>
4912
4913 PR gold/12525
4914 * options.h (class General_options): Add -dy and -dn.
4915
4916 2011-03-02 Cary Coutant <ccoutant@google.com>
4917
4918 * testsuite/script_test_9.t: Add TLS segment.
4919
4920 2011-03-02 Simon Baldwin <simonb@google.com>
4921
4922 * configure.ac: Add check for gnu_indirect_function support in
4923 the toolchain building binutils.
4924 * configure: Rebuild.
4925
4926 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4927
4928 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4929 plugin only symbols.
4930 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4931 in plugin files as not needed in the symbol table.
4932
4933 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4934
4935 * output.cc (Output_section::add_input_section): Delay fill
4936 generation for section ordering.
4937
4938 2011-02-09 Ian Lance Taylor <iant@google.com>
4939
4940 PR gold/12316
4941 * object.h (class Sized_relobj): Remove clear_local_symbols.
4942 * reloc.cc (Sized_relobj::do_relocate): Don't call
4943 clear_local_symbols.
4944
4945 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4946
4947 * plugin.cc (is_visible_from_outside): Return true for symbols
4948 in the -u option.
4949
4950 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4951
4952 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4953 filename.
4954
4955 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4956
4957 * icf.h (is_section_foldable_candidate): Change type of parameter
4958 to std::string.
4959 * icf.cc (Icf::find_identical_sections): Change type of local variable
4960 section_name to be std::string.
4961 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4962
4963 2011-01-25 Ian Lance Taylor <iant@google.com>
4964
4965 * script.cc (script_add_extern): Rewrite to use
4966 add_symbol_reference.
4967
4968 2011-01-25 Doug Kwan <dougkwan@google.com>
4969
4970 * icf.cc (get_section_contents): Always lock section's object.
4971
4972 2011-01-24 Ian Lance Taylor <iant@google.com>
4973
4974 * options.h (class General_options): Accept
4975 --no-detect-odr-violations.
4976
4977 2011-01-24 Ian Lance Taylor <iant@google.com>
4978
4979 * version.cc (version_string): Bump to 1.11.
4980
4981 2011-01-24 Ian Lance Taylor <iant@google.com>
4982
4983 * plugin.cc (class Plugin_rescan): Define new class.
4984 (Plugin_manager::claim_file): Set any_claimed_.
4985 (Plugin_manager::save_archive): New function.
4986 (Plugin_manager::save_input_group): New function.
4987 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4988 necessary.
4989 (Plugin_manager::new_undefined_symbol): New function.
4990 (Plugin_manager::rescan): New function.
4991 (Plugin_manager::rescannable_defines): New function.
4992 (Plugin_manager::add_input_file): Set any_added_.
4993 * plugin.h (class Plugin_manager): define new fields rescannable_,
4994 undefined_symbols_, any_claimed_, and any_added_. Declare
4995 Plugin_rescan as friend. Declare new functions.
4996 (Plugin_manager::Rescannable): Define type.
4997 (Plugin_manager::Rescannable_list): Define type.
4998 (Plugin_manager::Undefined_symbol_list): Define type.
4999 (Plugin_manager::Plugin_manager): Initialize new fields.
5000 * archive.cc (Archive::defines_symbol): New function.
5001 (Add_archive_symbols::run): Pass archive to plugins if any.
5002 * archive.h (class Archive): Declare defines_symbol.
5003 * readsyms.cc (Input_group::~Input_group): New function.
5004 (Finish_group::run): Pass input_group to plugins if any.
5005 * readsyms.h (class Input_group): Declare destructor.
5006 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5007 any.
5008
5009 2011-01-10 Ian Lance Taylor <iant@google.com>
5010
5011 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5012 section as relro.
5013 (Layout::set_segment_offsets): Reset increase_relro before calling
5014 set_section_addresses a second time.
5015
5016 2011-01-04 Cary Coutant <ccoutant@google.com>
5017
5018 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5019 sections before NOBITS sections.
5020
5021 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
5022
5023 * version.cc (print_version): Update copyright to 2011.
5024
5025 2010-12-23 Cary Coutant <ccoutant@google.com>
5026
5027 * output.h (Output_data_reloc::add_output_section): Pass OD instead
5028 of OS to this->add. Add OD parameter to second form of the function.
5029
5030 2010-12-20 Ian Lance Taylor <iant@google.com>
5031
5032 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5033 second of two consecutive entries with same offset.
5034
5035 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5036
5037 * testsuite/Makefile.am (ifuncmain2static_LDADD)
5038 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5039 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5040 to avoid unneeded links against $(LDADD).
5041 * testsuite/Makefile.in: Regenerate.
5042
5043 2010-12-15 Ian Lance Taylor <iant@google.com>
5044
5045 PR gold/12324
5046 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5047 for R_X86_64_32 and R_X86_64_PC32.
5048 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5049 ver_matching_def_pic.o.
5050 (ver_matching_def_pic.o): New target.
5051
5052 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5053
5054 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5055 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5056 Move definition before File_read::View member definitions.
5057 (File_read::View::~View): Initialize and hold lock before
5058 updating current_mapped_bytes.
5059
5060 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5061
5062 * dwarf_reader.cc: Remove outdated comment.
5063 * gold-threads.cc: Fix typo in error message.
5064 * archive.cc: Fix typos in comments.
5065 * archive.h: Likewise.
5066 * arm-reloc-property.cc: Likewise.
5067 * arm-reloc-property.h: Likewise.
5068 * arm-reloc.def: Likewise.
5069 * arm.cc: Likewise.
5070 * attributes.h: Likewise.
5071 * cref.cc: Likewise.
5072 * ehframe.cc: Likewise.
5073 * fileread.h: Likewise.
5074 * gold.h: Likewise.
5075 * i386.cc: Likewise.
5076 * icf.cc: Likewise.
5077 * incremental.h: Likewise.
5078 * int_encoding.cc: Likewise.
5079 * layout.h: Likewise.
5080 * main.cc: Likewise.
5081 * merge.h: Likewise.
5082 * object.cc: Likewise.
5083 * object.h: Likewise.
5084 * options.cc: Likewise.
5085 * readsyms.cc: Likewise.
5086 * reduced_debug_output.cc: Likewise.
5087 * reloc.cc: Likewise.
5088 * script-sections.cc: Likewise.
5089 * sparc.cc: Likewise.
5090 * symtab.h: Likewise.
5091 * target-reloc.h: Likewise.
5092 * target.cc: Likewise.
5093 * target.h: Likewise.
5094 * timer.cc: Likewise.
5095 * timer.h: Likewise.
5096 * x86_64.cc: Likewise.
5097
5098 2010-12-09 Cary Coutant <ccoutant@google.com>
5099
5100 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5101 stack.
5102 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5103 parameter; change all callers.
5104 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5105 * options.h (warn_execstack): New option.
5106
5107 2010-12-07 Doug Kwan <dougkwan@google.com>
5108
5109 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5110 like function call relocations.
5111
5112 2010-12-07 Ian Lance Taylor <iant@google.com>
5113
5114 * archive.cc (Archive::get_elf_object_for_member): Permit
5115 punconfigured to be NULL.
5116 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5117 (Archive::include_member): Pass NULL to get_elf_object_for_member
5118 if we searched for the archive and this is the first included
5119 object.
5120
5121 2010-12-01 Ian Lance Taylor <iant@google.com>
5122
5123 * dwarf_reader.h (class Sized_dwarf_line_info): Add
5124 track_relocs_type_ field.
5125 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5126 Set track_relocs_type_.
5127 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5128 contents when using RELA relocs.
5129 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5130 reloc_map_.
5131 * reloc.cc (Track_relocs::next_addend): New function.
5132 * reloc.h (class Track_relocs): Declare next_addend.
5133
5134 2010-12-01 Ian Lance Taylor <iant@google.com>
5135
5136 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5137 virtual destructor.
5138
5139 2010-12-01 Ian Lance Taylor <iant@google.com>
5140
5141 * README: Update compilers known to work and fail.
5142
5143 2010-11-23 Matthias Klose <doko@ubuntu.com>
5144
5145 * configure.in: For --enable-gold, handle value `default' instead of
5146 `both*'. Always install ld as ld.bfd, install as ld if gold is
5147 not the default.
5148 * configure: Regenerate.
5149
5150 2010-11-18 Doug Kwan <dougkwan@google.com>
5151
5152 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5153 and right_alignment to be zero. Store result alignment only if it is
5154 greater than existing alignment.
5155
5156 2010-11-16 Cary Coutant <ccoutant@google.com>
5157
5158 PR gold/12220
5159 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5160 Check for ".zdebug_line".
5161
5162 2010-11-16 Doug Kwan <dougkwan@google.com>
5163 Cary Coutant <ccoutant@google.com>
5164
5165 * output.h (Output_segment::set_section_addresses): Pass increase_relro
5166 by reference; adjust all callers.
5167 * output.cc (Output_segment::set_section_addresses): Adjust references
5168 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5169 list is empty.
5170 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5171 end at page boundary.
5172
5173 2010-11-16 Cary Coutant <ccoutant@google.com>
5174
5175 PR gold/12220
5176 * layout.cc (Layout::choose_output_section): Transform names of
5177 compressed sections even when using a script with a SECTIONS clause.
5178 (Layout::output_section_name): Remove code to transform
5179 compressed debug section names.
5180 * output.cc (Output_section::add_input_section): Use uncompressed
5181 section size when tracking input sections.
5182
5183 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
5184
5185 * symtab.h (Symbol::NON_PIC_REF): Remove.
5186 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5187 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
5188 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5189 (Symbol::use_plt_offset): Take a flags argument and pass it
5190 directly to needs_dynamic_reloc. Restrict check for undefined
5191 weak symbols to function calls.
5192 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5193 (Target_arm::Scan::global): Use it.
5194 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5195 (Target_arm::Relocate::relocate): Likewise.
5196 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5197 parameter with an r_type parameter. Use get_reference_flags
5198 to get the flags.
5199 (Target_arm::Relocate::relocate): Update accordingly.
5200 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5201 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5202 (Target_i386::Scan::global): Likewise.
5203 (Target_i386::Relocate::relocate): Likewise.
5204 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5205 parameter with an r_type parameter. Use get_reference_flags
5206 to get the flags.
5207 (Target_i386::Relocate::relocate): Update accordingly.
5208 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5209 (Target_powerpc::Scan::global): Use it.
5210 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5211 (Target_powerpc::Relocate::relocate): Likewise.
5212 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5213 (Target_sparc::Scan::global): Use it.
5214 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5215 (Target_sparc::Relocate::relocate): Likewise.
5216 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5217 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5218 (Target_x86_64::Scan::global): Likewise.
5219 (Target_x86_64::Relocate::relocate): Likewise.
5220
5221 2010-11-08 Doug Kwan <dougkwan@google.com>
5222 Cary Coutant <ccoutant@google.com>
5223
5224 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5225 (Arm_exidx_merge_section::section_contents_): New data member.
5226 (Arm_input_section::Arm_input_section): Initialize original_contents_.
5227 (Arm_input_section::~Arm_input_section): De-allocate memory.
5228 (Arm_input_section::original_contents_): New data member.
5229 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5230 in parameters instead of calling Object::section_contents without
5231 locking.
5232 (Arm_output_section::group_section): New parameter TASK. Pass it
5233 to callees that need locking objects.
5234 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
5235 to lock EXIDX input sections. Fix a formatting issue. Call
5236 Arm_exidx_merged_section::build_contents to create merged section
5237 contents.
5238 (Arm_output_section::create_stub_group): New parameter TASK. Use it
5239 to lock object of stub table owner.
5240 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5241 TEXT_SIZE to initialize data member TEXT_SIZE_.
5242 (Arm_exidx_input_section::addralign): Fix typo in comment.
5243 (Arm_exidx_input_section::text_size): New method.
5244 (Target_arm::do_relax): New parameter TASK. Pass it to callees
5245 that require locking objects. Lock objects before scanning for stubs
5246 and updating local symbols.
5247 (Arm_input_section<big_endian>::init): Copy contents of original
5248 input section.
5249 (Arm_input_section<big_endian>::do_write): Use saved contents of
5250 original input section instead of calling Object::section_contents
5251 without locking.
5252 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5253 size without calling Object::section_size().
5254 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5255 for size. Allocate a buffer for merged EXIDX entries.
5256 (Arm_exidx_merged_section::build_contents): New method.
5257 (Arm_exidx_merged_section::do_write): Move merge section contents
5258 building code to Arm_exidx_merged_section::build_contetns. Write
5259 out contetns in buffer instead of building it on the fly.
5260 (Arm_relobj::make_exidx_input_section): Also pass text section size
5261 to Arm_exidx_input_section constructor.
5262 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
5263 (Arm_dynobj::do_read_symbols): Fix memory leak.
5264 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5265 * target.h: (class Task): Add forward declaration.
5266 (Target::relax): Add new parameter TASK and pass it to
5267 Target::do_relax().
5268 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
5269
5270 2010-11-05 Cary Coutant <ccoutant@google.com>
5271
5272 PR gold/10708
5273 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5274 object when reading from the file.
5275 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5276 second layout pass.
5277 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5278 when reading section contents.
5279 (get_section_contents): Likewise.
5280 (icf::find_identical_sections): Likewise.
5281 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5282 object when reading from the file.
5283 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5284 the object when doing deferred section layout.
5285
5286 2010-11-03 Nick Clifton <nickc@redhat.com>
5287
5288 PR gold/12001
5289 * script.h (class Symbol_assignment: name): New member. Returns
5290 the name of the symbol.
5291 * scrfipt.cc (Script_options::is_pending_assignment): New member.
5292 Returns true if the given symbol name is on the list of
5293 assignments wating to be processed.
5294 * archive.cc (should_incldue_member): If the symbol is undefined,
5295 check to see if it is on the list of symbols pending assignment.
5296
5297 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
5298
5299 * script-sections.cc (Script_sections::find_memory_region): Check
5300 for a NULL output section pointer.
5301
5302 2010-10-29 Doug Kwan <dougkwan@google.com>
5303
5304 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5305 Output_section::add_relaxed_input_section.
5306 * output.cc (Output_section::add_relaxed_input_section): Add new
5307 arguments LAYOUT and NAME. Set section order index.
5308 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5309 Copy section order index.
5310 * output.h (Output_section::add_relaxed_input_section): Add new
5311 arguments LAYOUT and NAME.
5312
5313 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5314
5315 * testsuite/Makefile.am: Move gcctestdir/ld rule to
5316 NATIVE_OR_CROSS_LINKER.
5317 * testsuite/Makefile.in: Regenerate.
5318
5319 2010-10-20 Doug Kwan <dougkwan@google.com>
5320
5321 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5322 without SHF_LINK_ORDER flags.
5323 * layout.cc (Layout::choose_output_section): Do not filter
5324 SHF_LINK_ORDER flag in a relocatable link.
5325
5326 2010-10-17 Cary Coutant <ccoutant@google.com>
5327
5328 * output.h (Output_segment::set_section_addresses): Change function
5329 signature. Update all callers.
5330 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5331 sections.
5332 (Output_segment::set_section_addresses): Align after last TLS
5333 section. Add padding before last relro section instead of after.
5334
5335 2010-10-17 Doug Kwan <dougkwan@google.com>
5336
5337 * gold/arm.cc (Target_arm::got_section): Use correct order and set
5338 GOT output section to be writable.
5339
5340 2010-10-14 Cary Coutant <ccoutant@google.com>
5341
5342 * debug.h (DEBUG_INCREMENTAL): New flag.
5343 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5344 * gold.cc (queue_initial_tasks): Check parameters for incremental link
5345 mode.
5346 * incremental.cc (report_command_line): Ignore all forms of
5347 --incremental.
5348 * layout.cc (Layout::Layout): Check parameters for incremental link
5349 mode.
5350 * options.cc (General_options::parse_incremental): New function.
5351 (General_options::parse_no_incremental): New function.
5352 (General_options::parse_incremental_full): New function.
5353 (General_options::parse_incremental_update): New function.
5354 (General_options::incremental_mode_): New data member.
5355 (General_options::finalize): Check incremental_mode_.
5356 * options.h (General_options): Update help text for --incremental.
5357 Add --no-incremental, --incremental-full, --incremental-update.
5358 (General_options::Incremental_mode): New enum type.
5359 (General_options::incremental_mode): New function.
5360 (General_options::incremental_mode_): New data member.
5361 * parameters.cc (Parameters::incremental_mode_): New data member.
5362 (Parameters::set_options): Set incremental_mode_.
5363 (Parameters::set_incremental_full): New function.
5364 (Parameters::incremental): New function.
5365 (Parameters::incremental_update): New function.
5366 (set_parameters_incremental_full): New function.
5367 * parameters.h (Parameters::set_incremental_full): New function.
5368 (Parameters::incremental): New function.
5369 (Parameters::incremental_update): New function.
5370 (Parameters::incremental_mode_): New data member.
5371 (set_parameters_incremental_full): New function.
5372 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5373 incremental link mode.
5374 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5375 (Sized_relobj::do_relocate_sections): Likewise.
5376 * testsuite/Makefile.am (incremental_test): Use --incremental-full
5377 option.
5378 * testsuite/Makefile.in: Regenerate.
5379 * testsuite/incremental_test.sh: Filter all forms of --incremental.
5380
5381 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5382
5383 * script-sections.h (class Script_sections): Make
5384 Sections_elements typedef public.
5385 * script-sections.cc (class Sort_output_sections): Add elements_
5386 field. Add constructor which sets it; change all callers.
5387 (Sort_output_sections::is_before): New function.
5388 (Sort_output_sections::operator()): Call is_before.
5389 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5390 conditional.
5391 * testsuite/script_test_10.sh: New test. Test script section
5392 order.
5393 * testsuite/script_test_10.t: Likewise.
5394 * testsuite/script_test_10.s: Likewise.
5395 * testsuite/Makefile.am: Wrap the cross linker tests and the
5396 common tests into NATIVE_OR_CROSS_LINKER.
5397 (check_SCRIPTS): Add script_test_10.sh.
5398 (check_DATA): Add script_test_10.stdout.
5399 (script_test_10.o, script_test_10): New targets.
5400 (script_test_10.stdout): New target.
5401 * configure, testsuite/Makefile.in: Regenerate.
5402
5403 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5404
5405 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5406 error for the deprecated relocations.
5407 (Target_arm::Scan::global): Likewise.
5408 (Target_arm::Relocate::relocate): Likewise.
5409
5410 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
5411
5412 * fileread.cc (Input_file::find_file): Initialize *found_name
5413 and *namep when using the fallback search for case 4.
5414
5415 2010-10-11 Cary Coutant <ccoutant@google.com>
5416
5417 * options.h (class General_options): Redefine -z lazy as an alias for
5418 the negation of -z now.
5419
5420 2010-10-11 Ian Lance Taylor <iant@google.com>
5421
5422 * resolve.cc (symbol_to_bits): Report the value of the unsupported
5423 binding.
5424
5425 2010-10-06 Nick Clifton <nickc@redhat.com>
5426
5427 * script-sections.cc(class Memory_region): Remove
5428 current_lma_offset_ field. Rename current_vma_offset_ to
5429 current_offset_. Add last_section_ field.
5430 (Memory_region::get_current_vma_address): Rename to
5431 get_current_address.
5432 (Memory_region::get_current_lma_address): Delete.
5433 (Memory_region::increment_vma_offset): Rename to
5434 increment_offset.
5435 (Memory_region::increment_lma_offset): Delete.
5436 (Memory_region::attributes_compatible): New method. Returns
5437 true if the provided section is compatible with the region.
5438 (Memory_region::get_last_section): New method. Returns the last
5439 section to use the region.
5440 (Memory_region::set_last_section): New method. Stores the last
5441 section to use the region.
5442 (Script_sections::block_in_region): New method. Returns true if
5443 a block of memory is contained within a region.
5444 (Script_sections::find_memory_region): New method. Locates a
5445 memory region to be used to set a VMA or LMA address.
5446 (Output_section_definition::set_section_addresses): Add code to
5447 check for addresses set by memory regions.
5448 (Output_segment::set_section_addresses): Remove memory region
5449 walking code.
5450 (Script_sections::create_segment): Add a warning if a header
5451 segment is created outside of any region.
5452 * script-sections.h (class Script_sections): Add prototypes for
5453 find_memory_region and block_in_region methods.
5454 * testsuite/memory_test.s: Use .long instead of .word.
5455 * testsuite/memory_test.t: Add some more output sections.
5456 * testsuite/memory_test.sh: Update expected output.
5457
5458 2010-10-02 Doug Kwan <dougkwan@google.com>
5459
5460 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5461 defintion to symtab.h
5462 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5463 declaration to defintion.
5464
5465 2010-10-01 Nick Clifton <nickc@redhat.com>
5466
5467 * expression.cc (eval): Replace dummy argument with NULL.
5468 (eval_maybe_dot): Check for a NULL result section pointer.
5469 (Symbol_expression::value): Likewise.
5470 (Dot_expression::value): Likewise.
5471 (BINARY_EXPRESSION): Likewise.
5472 (Max_expression::value): Likewise.
5473 (Min_expression::value): Likewise.
5474 (Absolute_expression::value): Likewise.
5475 (Addr_expression::value_from_output_section): Likewise.
5476 (Loaddddr_expression::value_from_output_section): Likewise.
5477 (Segment_start_expression::value): Likewise.
5478 * script-sections.cc
5479 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5480 argument with NULL.
5481 (Sections_elememt_dot_assignment::set_section_addresses):
5482 Likewise.
5483 (Output_data_expression::do_write_to_buffer): Likewise.
5484 (Output_section_definition::finalize_symbols): Likewise.
5485 (Output_section_definition::set_section_addresses): Likewise.
5486
5487 2010-09-30 Doug Kwan <dougkwan@google.com>
5488
5489 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5490
5491 2010-09-28 Sriraman Tallam <tmsriram@google.com>
5492
5493 * target.h (Target::can_icf_inline_merge_sections): New virtual
5494 function.
5495 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5496 virtual function.
5497 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5498 virtual function.
5499 * icf.cc (get_section_contents): Inline merge sections only when
5500 target allows it.
5501
5502 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5503
5504 * configure: Regenerate.
5505
5506 2010-09-17 Ian Lance Taylor <iant@google.com>
5507
5508 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5509 * testsuite/Makefile.am (memory_test.o): New target.
5510 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5511 memory_test.t.
5512 * testsuite/Makefile.in: Rebuild.
5513
5514 2010-09-17 Doug Kwan <dougkwan@google.com>
5515
5516 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5517 defintion if relocation uses GOT entries of the symbol.
5518 * testsuite/icf_safe_test.sh: Fix test.
5519 * testsuite/icf_safe_so_test.sh: Fix test.
5520
5521 2010-09-16 Cary Coutant <ccoutant@google.com>
5522
5523 * script_sections.cc (class Memory_region): Remove "NULL" from
5524 vector initializations.
5525
5526 2010-09-15 Cary Coutant <ccoutant@google.com>
5527
5528 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5529 Resolve forwarding symbols.
5530
5531 2010-09-15 Doug Kwan <dougkwan@google.com>
5532
5533 * gold/testsuite/script_test_3.t: Add ARM special sections.
5534 * gold/testsuite/script_test_4.t: Same.
5535 * gold/testsuite/script_test_5.t: Same.
5536 * gold/testsuite/script_test_6.t: Same.
5537 * gold/testsuite/script_test_7.t: Same.
5538 * gold/testsuite/script_test_7.t: Same.
5539 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5540
5541 2010-09-14 Cary Coutant <ccoutant@google.com>
5542
5543 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5544 (Target_x86_64::Relocate::relocate_tls): Replace check for
5545 saw_tls_block_reloc_ with test for executable section.
5546
5547 2010-09-12 Cary Coutant <ccoutant@google.com>
5548
5549 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5550 position-independent executables to shared libraries need dynamic
5551 relocations.
5552 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5553 position-independent executables.
5554 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5555 * testsuite/Makefile.in: Regenerate.
5556
5557 2010-09-10 Nick Clifton <nickc@redhat.com>
5558
5559 PR gold/11997
5560 * testsuite/memory_test.t: Discard any sections that are not
5561 needed.
5562
5563 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
5564
5565 PR gold/11996
5566 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5567 "This::" to work around a bug in gcc 4.2.
5568
5569 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5570
5571 2010-09-09 Rafael Espindola <espindola@google.com>
5572
5573 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5574 sections with different PF_X flags in the same segment.
5575 (Layout::find_first_load_seg): Search all segments to find the first
5576 one.
5577 * options.h (rosegment): New.
5578
5579 2010-09-08 Rafael Espindola <espindola@google.com>
5580
5581 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5582
5583 2010-09-08 Doug Kwan <dougkwan@google.com>
5584
5585 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5586 (Arm_relobj::do_relocate_sections): Add new parameter for output
5587 file to match the parent.
5588 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5589 of local symbols instead of input values. Update code to track
5590 changes in gold::relocate_section.
5591 * object.cc (Sized_relobj::compute_final_local_value): New methods.
5592 (Sized_relobj::compute_final_local_value_internal): New methods.
5593 (Sized_relobj::do_finalize_local_symbols): Move code from loop
5594 body into private version of Sized_relobj::compute_final_local_value.
5595 Call the inline method.
5596 * object.h (Symbol_value::Symbol_value): Define destructor. Free
5597 merged symbol value if there is one.
5598 (Symbol_value::has_output_value): New method defintiion.
5599 (Sized_relobj::Compute_final_local_value_status): New enum type.
5600 (Sized_relobj::compute_final_local_value): New methods.
5601 (Sized_relobj::compute_final_local_value_internal): New methods.
5602 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5603 and arm_cortex_a8.sh.
5604 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5605 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5606 New tests.
5607 * Makefile.in: Regenerate.
5608 * testsuite/arm_bl_out_of_range.s: Update test.
5609 * testsuite/thumb_bl_out_of_range.s: Ditto.
5610 * testsuite/thumb_blx_out_of_range.s: Ditto.
5611 * testsuite/arm_branch_out_of_range.sh: New file.
5612 * testsuite/arm_cortex_a8.sh: Ditto.
5613 * testsuite/arm_cortex_a8_b.s: Ditto.
5614 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5615 * testsuite/arm_cortex_a8_b_local.s: Ditto.
5616 * testsuite/arm_cortex_a8_bl.s: Ditto.
5617 * testsuite/arm_cortex_a8_blx.s: Ditto.
5618 * testsuite/arm_cortex_a8_local.s: Ditto.
5619 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5620 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5621
5622 2010-09-08 Rafael Espindola <espindola@google.com>
5623
5624 * Makefile.am (memory_test.stdout): Run readelf with -W.
5625 * Makefile.in: Regenerate.
5626 * testsuite/memory_test.sh: Make the regexps accept both 32 and
5627 64 bit output.
5628
5629 2010-09-08 Rafael Espindola <espindola@google.com>
5630
5631 * script-sections.cc (Script_sections::add_memory_region): Convert
5632 field precision to int.
5633 * script.cc (script_set_section_region, script_set_section_region):
5634 Convert field precision to int.
5635
5636 2010-09-08 Rafael Espindola <espindola@google.com>
5637
5638 * arm.cc (do_finalize_sections): Create the __exidx_start and
5639 __exdix_end symbols even when the section is missing.
5640
5641 2010-09-08 Nick Clifton <nickc@redhat.com>
5642
5643 * README: Remove claim that MEMORY is not supported.
5644 * expression.cc (script_exp_function_origin)
5645 (script_exp_function_length): Move from here to ...
5646 * script.cc: ... here.
5647 (script_set_section_region, script_add_memory)
5648 (script_parse_memory_attr, script_include_directive): New
5649 functions.
5650 * script-sections.cc
5651 (class Memory_region): New class.
5652 (class Output_section_definition): Add set_memory_region,
5653 set_section_vma, set_section_lma and get_section_name methods.
5654 (class Script_Sections): Add add_memory_region,
5655 find_memory_region, find_memory_region_origin,
5656 find_memory_region_length and set_memory_region methods.
5657 Have set_section_addresses method walk the list of set memory
5658 regions.
5659 Extend the print methos to display memory regions.
5660 * script-sections.h: Add prototypes for new methods.
5661 Add enum for MEMORY region attributes.
5662 * yyscript.y: Add support for parsing MEMORY regions.
5663 * script-c.h: Add prototypes for new functions.
5664 * testsuite/Makefile.am: Add test of MEMORY region functionality.
5665 * testsuite/Makefile.in: Regenerate.
5666 * testsuite/memory_test.sh: New script.
5667 * testsuite/memory_test.s: New assembler source file.
5668 * testsuite/memory_test.t: New linker script.
5669
5670 2010-08-27 Doug Kwan <dougkwan@google.com>
5671
5672 * gold/resolve.cc (Symbol_table::should_override): Let a weak
5673 reference override an existing dynamic weak reference.
5674 * testsuite/Makefile.am: Add new test dyn_weak_ref.
5675 * testsuite/Makefile.in: Regenerate.
5676 * testsuite/dyn_weak_ref.sh: New file.
5677 * testsuite/dyn_weak_ref_1.c: Ditto.
5678 * testsuite/dyn_weak_ref_2.c: Ditto.
5679
5680 2010-08-27 Ian Lance Taylor <iant@google.com>
5681
5682 * incremental.h (class Incremental_input_entry): Add virtual
5683 destructor.
5684
5685 2010-08-27 Ian Lance Taylor <iant@google.com>
5686
5687 * testsuite/start_lib_test_3.c: Mark t3 as used.
5688
5689 2010-08-27 Nick Clifton <nickc@redhat.com>
5690
5691 * options.cc (version_script): Fix small typo in previous
5692 whitespace tidyup.
5693
5694 2010-08-25 Nick Clifton <nickc@redhat.com>
5695
5696 * archive.cc: Formatting fixes: Remove whitespace between
5697 typename and following asterisk. Remove whitespace between
5698 function name and opening parenthesis.
5699 * archive.h: Likewise.
5700 * arm.cc: Likewise.
5701 * attributes.cc: Likewise.
5702 * attributes.h: Likewise.
5703 * common.cc: Likewise.
5704 * copy-relocs.cc: Likewise.
5705 * dirsearch.h: Likewise.
5706 * dynobj.cc: Likewise.
5707 * ehframe.cc: Likewise.
5708 * ehframe.h: Likewise.
5709 * expression.cc: Likewise.
5710 * fileread.cc: Likewise.
5711 * fileread.h: Likewise.
5712 * gc.h: Likewise.
5713 * gold-threads.cc: Likewise.
5714 * gold.cc: Likewise.
5715 * i386.cc: Likewise.
5716 * icf.h: Likewise.
5717 * incremental-dump.cc: Likewise.
5718 * incremental.cc: Likewise.
5719 * layout.cc: Likewise.
5720 * layout.h: Likewise.
5721 * main.cc: Likewise.
5722 * merge.cc: Likewise.
5723 * merge.h: Likewise.
5724 * object.cc: Likewise.
5725 * object.h: Likewise.
5726 * options.cc: Likewise.
5727 * options.h: Likewise.
5728 * output.cc: Likewise.
5729 * output.h: Likewise.
5730 * plugin.cc: Likewise.
5731 * plugin.h: Likewise.
5732 * powerpc.cc: Likewise.
5733 * reloc.cc: Likewise.
5734 * script-c.h: Likewise.
5735 * script-sections.cc: Likewise.
5736 * script.cc: Likewise.
5737 * stringpool.cc: Likewise.
5738 * symtab.cc: Likewise.
5739 * symtab.h: Likewise.
5740 * target.cc: Likewise.
5741 * timer.cc: Likewise.
5742 * timer.h: Likewise.
5743 * version.cc: Likewise.
5744 * x86_64.cc: Likewise.
5745
5746 2010-08-24 Nick Clifton <nickc@redhat.com>
5747
5748 PR 11899
5749 * layout.cc (segment_precedes): Sort segments by their physical
5750 addresses, if they have been set.
5751
5752 2010-08-23 Cary Coutant <ccoutant@google.com>
5753
5754 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5755 symbols data.
5756 (Lib_group::include_member): Unlock object after deleting its
5757 symbols data.
5758 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5759 the bug fixed here.
5760
5761 2010-08-19 Neil Vachharajani <nvachhar@google.com>
5762 Cary Coutant <ccoutant@google.com>
5763
5764 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5765 constructor, and set_blocker.
5766 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5767 readsyms_blocker_.
5768 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5769 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5770 * testsuite/Makefile.am (start_lib_test): New test case.
5771 * testsuite/Makefile.in: Regenerate.
5772 * testsuite/start_lib_test_main.c: New file.
5773 * testsuite/start_lib_test_1.c: New file.
5774 * testsuite/start_lib_test_2.c: New file.
5775 * testsuite/start_lib_test_3.c: New file.
5776
5777 2010-08-19 Ian Lance Taylor <iant@google.com>
5778
5779 * Makefile.in: Rebuild with automake 1.11.1.
5780 * aclocal.m4: Likewise.
5781 * testsuite/Makefile.in: Likewise.
5782
5783 2010-08-19 Ian Lance Taylor <iant@google.com>
5784
5785 PR 10893
5786 * i386.cc (class Output_data_plt_i386): Update declarations.
5787 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5788 local_ifuncs_ fields.
5789 (Target_i386::do_plt_section_for_global): New function.
5790 (Target_i386::do_plt_section_for_local): New function.
5791 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5792 parameter; change all callers. Initialize global_ifuncs_ and
5793 local_ifuncs_. If doing a static link define __rel_iplt_start and
5794 __rel_iplt_end.
5795 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5796 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5797 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5798 symbols.
5799 (Target_i386::make_plt_section): New function, broken out of
5800 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5801 (Target_i386::make_plt_entry): Call make_plt_section.
5802 (Target_i386::make_local_ifunc_plt_entry): New function.
5803 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5804 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5805 R_386_IRELATIVE to switch.
5806 (Target_i386::Scan::global): Likewise.
5807 (Target_i386::Relocate::relocate): Likewise.
5808 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5809 switch.
5810 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5811 (Target_x86_64::do_plt_section_for_global): New function.
5812 (Target_x86_64::do_plt_section_for_local): New function.
5813 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5814 parameter; change all callers. If doing a static link define
5815 __rela_iplt_start and __rela_iplt_end.
5816 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5817 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5818 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5819 to point to .plt.
5820 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5821 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5822 switch.
5823 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5824 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5825 R_X86_64_IRELATIVE to switch.
5826 (Target_x86_64::Scan::global): Likewise.
5827 (Target_x86_64::Relocate::relocate): Likewise.
5828 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5829 switch.
5830 * target.h (class Target): Add plt_section_for_global and
5831 plt_section_for_local functions. Add do_plt_section_for_global
5832 and do_plt_section_for_local virtual functions.
5833 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5834 clarifying comments.
5835 (Symbol::use_plt_offset): Handle IFUNC symbol.
5836 * object.cc (Sized_relobj::Sized_relobj): Initialize
5837 local_plt_offsets_.
5838 (Sized_relobj::local_has_plt_offset): New function.
5839 (Sized_relobj::local_plt_offset): New function.
5840 (Sized_relobj::set_local_plt_offset): New function.
5841 (Sized_relobj::do_count): Handle IFUNC symbol.
5842 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5843 a bit away from input_shndx_ field. Add set_is_func_symbol and
5844 is_ifunc_symbol functions.
5845 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5846 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5847 local_plt_offsets_ field.
5848 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5849 * output.h (class Output_section_data): Add non-const
5850 output_section function.
5851 (class Output_data_got): Update declarations.
5852 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5853 Add use_plt_offset parameter to global and local constructors.
5854 Change all callers. Change local_sym_index_ field to 31 bits.
5855 Change GSYM_CODE and CONSTANT_CODE accordingly.
5856 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5857 doing a static link don't set sh_link field.
5858 (Output_data_got::Got_entry::write): Use PLT offset if
5859 appropriate.
5860 (Output_data_got::add_global_plt): New function.
5861 (Output_data_got::add_local_plt): New function.
5862 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5863 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5864 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5865 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5866 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5867 IFUNC conditional.
5868 * testsuite/ifunc-sel.h: New file.
5869 * testsuite/ifuncmain1.c: New file.
5870 * testsuite/ifuncmain1vis.c: New file.
5871 * testsuite/ifuncmod1.c: New file.
5872 * testsuite/ifuncdep2.c: New file.
5873 * testsuite/ifuncmain2.c: New file.
5874 * testsuite/ifuncmain3.c: New file.
5875 * testsuite/ifuncmod3.c: New file.
5876 * testsuite/ifuncmain4.c: New file.
5877 * testsuite/ifuncmain5.c: New file.
5878 * testsuite/ifuncmod5.c: New file.
5879 * testsuite/ifuncmain6pie.c: New file.
5880 * testsuite/ifuncmod6.c: New file.
5881 * testsuite/ifuncmain7.c: New file.
5882 * configure, testsuite/Makefile.in: Rebuild.
5883
5884 2010-08-18 Ian Lance Taylor <iant@google.com>
5885
5886 * incremental.cc
5887 (Output_section_incremental_inputs::write_input_files): Add cast
5888 to avoid signed/unsigned comparison warning.
5889 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5890
5891 2010-08-12 Cary Coutant <ccoutant@google.com>
5892
5893 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5894
5895 2010-08-13 Ian Lance Taylor <iant@google.com>
5896
5897 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5898
5899 2010-08-12 Cary Coutant <ccoutant@google.com>
5900 Doug Kwan <dougkwan@google.com>
5901
5902 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5903 defintion overrides non-weak undef, remember that the original undef
5904 is not weak.
5905 * symtab.cc (Symbol_table::sized_write_global): For undef without
5906 an original weak binding, set binding to global in output.
5907 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5908 * testsuite/Makefile.in: Regenerate.
5909 * testsuite/strong_ref_weak_def.sh: New file.
5910 * testsuite/strong_ref_weak_def_1.c: Ditto.
5911 * testsuite/strong_ref_weak_def_2.c: Ditto.
5912
5913 2010-08-12 Cary Coutant <ccoutant@google.com>
5914
5915 * testsuite/incremental_test.sh: Rewrite.
5916 * testsuite/incremental_test_1.c: Rewrite.
5917 * testsuite/incremental_test_2.c: Rewrite.
5918
5919 2010-08-12 Cary Coutant <ccoutant@google.com>
5920
5921 * arm.cc (Target_arm::got_size): Add const.
5922 (Target_arm::got_entry_count): New function.
5923 (Target_arm::plt_entry_count): New function.
5924 (Target_arm::first_plt_entry_offset): New function.
5925 (Target_arm::plt_entry_size): New function.
5926 (Output_data_plt_arm::entry_count): New function.
5927 (Output_data_plt_arm::first_plt_entry_offset): New function.
5928 (Output_data_plt_arm::get_plt_entry_size): New function.
5929 * i386.cc (Target_i386::got_size): Add const.
5930 (Target_i386::got_entry_count): New function.
5931 (Target_i386::plt_entry_count): New function.
5932 (Target_i386::first_plt_entry_offset): New function.
5933 (Target_i386::plt_entry_size): New function.
5934 (Output_data_plt_i386::entry_count): New function.
5935 (Output_data_plt_i386::first_plt_entry_offset): New function.
5936 (Output_data_plt_i386::get_plt_entry_size): New function.
5937 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5938 find_incremental_inputs_sections. Dump incremental_got_plt section.
5939 * incremental.cc: Include target.h.
5940 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5941 parameter. Adjust all callers. Find incremental_got_plt section.
5942 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5943 section.
5944 (Output_section_incremental_inputs::set_final_data_size): Calculate
5945 size of incremental_got_plt section.
5946 (Output_section_incremental_inputs::do_write): Write the
5947 incremental_got_plt section.
5948 (Got_plt_view_info): New struct.
5949 (Local_got_offset_visitor): New class.
5950 (Global_got_offset_visitor): New class.
5951 (Global_symbol_visitor_got_plt): New class.
5952 (Output_section_incremental_inputs::write_got_plt): New function.
5953 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5954 Add parameter. Adjust all callers.
5955 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5956 (Incremental_inputs::got_plt_section): New function.
5957 (Incremental_inputs::got_plt_section_): New data member.
5958 (Incremental_got_plt_reader): New class.
5959 * layout.cc (Layout::create_incremental_info_sections): Add the
5960 incremental_got_plt section.
5961 * object.h (Got_offset_list::get_list): New function.
5962 (Got offset_list::for_all_got_offsets): New function.
5963 (Sized_relobj::local_got_offset_list): New function.
5964 * powerpc.cc (Target_powerpc::got_size): Add const.
5965 (Target_powerpc::got_entry_count): New function.
5966 (Target_powerpc::plt_entry_count): New function.
5967 (Target_powerpc::first_plt_entry_offset): New function.
5968 (Target_powerpc::plt_entry_size): New function.
5969 (Output_data_plt_powerpc::entry_count): New function.
5970 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5971 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5972 * sparc.cc (Target_sparc::got_size): Add const.
5973 (Target_sparc::got_entry_count): New function.
5974 (Target_sparc::plt_entry_count): New function.
5975 (Target_sparc::first_plt_entry_offset): New function.
5976 (Target_sparc::plt_entry_size): New function.
5977 (Output_data_plt_sparc::entry_count): New function.
5978 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5979 (Output_data_plt_sparc::get_plt_entry_size): New function.
5980 * symtab.h (Symbol::got_offset_list): New function.
5981 (Symbol_table::for_all_symbols): New function.
5982 * target.h (Sized_target::got_entry_count): New function.
5983 (Sized_target::plt_entry_count): New function.
5984 (Sized_target::plt_entry_size): New function.
5985 * x86_64.cc (Target_x86_64::got_size): Add const.
5986 (Target_x86_64::got_entry_count): New function.
5987 (Target_x86_64::plt_entry_count): New function.
5988 (Target_x86_64::first_plt_entry_offset): New function.
5989 (Target_x86_64::plt_entry_size): New function.
5990 (Output_data_plt_x86_64::entry_count): New function.
5991 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5992 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5993
5994 2010-08-12 Cary Coutant <ccoutant@google.com>
5995
5996 * archive.cc: Include incremental.h.
5997 (Archive::Archive): Initialize incremental_info_.
5998 (Archive::include_member): Record archive members in incremental info.
5999 (Add_archive_symbols::run): Record begin and end of an archive in
6000 incremental info.
6001 (Lib_group::include_member): Record objects in incremental info.
6002 * archive.h (Incremental_archive_entry): Forward declaration.
6003 (Archive::set_incremental_info): New member function.
6004 (Archive::incremental_info): New member function.
6005 (Archive::Unused_symbol_iterator): New class.
6006 (Archive::unused_symbols_begin): New member function.
6007 (Archive::unused_symbols_end): New member function.
6008 (Archive::incremental_info_): New data member.
6009 * incremental-dump.cc (find_input_containing_global): New function.
6010 (dump_incremental_inputs): Dump new incremental info sections.
6011 * incremental.cc: Include symtab.h.
6012 (Output_section_incremental_inputs): New class.
6013 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6014 new incremental info sections.
6015 (Sized_incremental_binary::do_check_inputs): Likewise.
6016 (Incremental_inputs::report_archive): Remove.
6017 (Incremental_inputs::report_archive_begin): New function.
6018 (Incremental_inputs::report_archive_end): New function.
6019 (Incremental_inputs::report_object): New function.
6020 (Incremental_inputs::finalize_inputs): Remove.
6021 (Incremental_inputs::report_input_section): New function.
6022 (Incremental_inputs::report_script): Rewrite.
6023 (Incremental_inputs::finalize): Do nothing but finalize string table.
6024 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6025 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6026 (Incremental_inputs::create_data_sections): New function.
6027 (Incremental_inputs::relocs_entsize): New function.
6028 (Output_section_incremental_inputs::set_final_data_size): New function.
6029 (Output_section_incremental_inputs::do_write): New function.
6030 (Output_section_incremental_inputs::write_header): New function.
6031 (Output_section_incremental_inputs::write_input_files): New function.
6032 (Output_section_incremental_inputs::write_info_blocks): New function.
6033 (Output_section_incremental_inputs::write_symtab): New function.
6034 * incremental.h (Incremental_script_entry): Forward declaration.
6035 (Incremental_object_entry): Forward declaration.
6036 (Incremental_archive_entry): Forward declaration.
6037 (Incremental_inputs): Forward declaration.
6038 (Incremental_inputs_header_data): Remove.
6039 (Incremental_inputs_header): Remove.
6040 (Incremental_inputs_header_write): Remove.
6041 (Incremental_inputs_entry_data): Remove.
6042 (Incremental_inputs_entry): Remove.
6043 (Incremental_inputs_entry_write): Remove.
6044 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6045 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6046 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6047 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6048 Likewise.
6049 (Incremental_input_entry): New class.
6050 (Incremental_script_entry): New class.
6051 (Incremental_object_entry): New class.
6052 (Incremental_archive_entry): New class.
6053 (Incremental_inputs::Incremental_inputs): Initialize new data members.
6054 (Incremental_inputs::report_inputs): Remove.
6055 (Incremental_inputs::report_archive): Remove.
6056 (Incremental_inputs::report_archive_begin): New function.
6057 (Incremental_inputs::report_archive_end): New function.
6058 (Incremental_inputs::report_object): Change prototype.
6059 (Incremental_inputs::report_input_section): New function.
6060 (Incremental_inputs::report_script): Change prototype.
6061 (Incremental_inputs::get_reloc_count): New function.
6062 (Incremental_inputs::set_reloc_count): New function.
6063 (Incremental_inputs::create_data_sections): New function.
6064 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6065 (Incremental_inputs::inputs_section): New function.
6066 (Incremental_inputs::symtab_section): New function.
6067 (Incremental_inputs::relocs_section): New function.
6068 (Incremental_inputs::get_stringpool): Add const.
6069 (Incremental_inputs::command_line): Add const.
6070 (Incremental_inputs::inputs): Remove.
6071 (Incremental_inputs::command_line_key): New function.
6072 (Incremental_inputs::input_file_count): New function.
6073 (Incremental_inputs::input_files): New function.
6074 (Incremental_inputs::relocs_entsize): New function.
6075 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6076 (Incremental_inputs::finalize_inputs): Remove.
6077 (Incremental_inputs::Input_info): Remove.
6078 (Incremental_inputs::lock_): Remove.
6079 (Incremental_inputs::inputs_): Change type.
6080 (Incremental_inputs::inputs_map_): Remove.
6081 (Incremental_inputs::current_object_entry_): New data member.
6082 (Incremental_inputs::inputs_section_): New data member.
6083 (Incremental_inputs::symtab_section_): New data member.
6084 (Incremental_inputs::relocs_section_): New data member.
6085 (Incremental_inputs::reloc_count_): New data member.
6086 (Incremental_inputs_reader): New class.
6087 (Incremental_symtab_reader): New class.
6088 (Incremental_relocs_reader): New class.
6089 * layout.cc (Layout::finalize): Move finalization of incremental info
6090 and creation of incremental info sections to follow finalization of
6091 symbol table. Set offsets for postprocessing sections.
6092 (Layout::create_incremental_info_sections): Call
6093 Incremental_inputs::create_data_sections. Add incremental symtab
6094 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
6095 sections to layout after input sections.
6096 * layout.h (struct Timespec): Forward declaration.
6097 (Layout::incremental_inputs): Add const.
6098 (Layout::create_incremental_info_sections): Add parameter.
6099 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6100 * object.cc: Include incremental.h.
6101 (Relobj::finalize_incremental_relocs): New function.
6102 (Sized_relobj::do_layout): Record input sections in incremental info.
6103 * object.h (Object::output_section): New function.
6104 (Object::output_section_offset): Moved from Relobj.
6105 (Object::get_incremental_reloc_base): New function.
6106 (Object::get_incremental_reloc_count): New function.
6107 (Object::do_output_section): New function.
6108 (Object::do_output_section_offset): Moved from Relobj.
6109 (Object::do_get_incremental_reloc_base): New function.
6110 (Object::do_get_incremental_reloc_count): New function.
6111 (Object::Object): Initialize new data members.
6112 (Relobj::output_section): Renamed do_output_section and moved to
6113 protected.
6114 (Relobj::output_section_offset): Moved to Object.
6115 (Relobj::do_get_incremental_reloc_base): New function.
6116 (Relobj::do_get_incremental_reloc_count): New function.
6117 (Relobj::allocate_incremental_reloc_counts): New function.
6118 (Relobj::count_incremental_reloc): New function.
6119 (Relobj::finalize_incremental_relocs): New function.
6120 (Relobj::next_incremental_reloc_index): New function.
6121 (Relobj::reloc_counts_): New data member.
6122 (Relobj::reloc_bases_): New data member.
6123 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
6124 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
6125 (Sized_relobj::incremental_relocs_scan): New function.
6126 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6127 (Sized_relobj::incremental_relocs_write): New function.
6128 (Sized_relobj::incremental_relocs_write_reltype): New function.
6129 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6130 incremental link.
6131 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6132 archives and object files elsewhere.
6133 (Add_symbols::run): Report object files here.
6134 (Finish_group::run): Report end of archive at end of group.
6135 * reloc.cc: Include layout.h, incremental.h.
6136 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6137 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6138 (Sized_relobj::incremental_relocs_scan): New function.
6139 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6140 (Sized_relobj::do_relocate_sections): Write incremental relocations.
6141 (Sized_relobj::incremental_relocs_write): New function.
6142 (Sized_relobj::incremental_relocs_write_reltype): New function.
6143 * script.cc (read_input_script): Rewrite test for incremental link.
6144 Change call to Incremental_inputs::report_script.
6145 * symtab.h (Symbol_table::first_global_index): New function.
6146 (Symbol_table::output_count): New function.
6147
6148 2010-08-12 Doug Kwan <dougkwan@google.com>
6149
6150 * arm.cc (Target_arm::merge_object_attributes): Check command line
6151 options --no-wchar-size-warning and --no-enum-size-warning.
6152 * options.h (General_options): Add ld-compatible options
6153 --no-enum-size-warning and --no-wchar-size-warning.
6154
6155 2010-08-04 Ian Lance Taylor <iant@google.com>
6156
6157 * x86_64.cc (Target_x86_64::Scan::local): Use
6158 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6159 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6160 (Target_x86_64::Scan::global): Likewise.
6161 (Target_x86_64::Relocate::relocate): Likewise.
6162 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6163 Likewise.
6164
6165 2010-08-03 Cary Coutant <ccoutant@google.com>
6166
6167 * merge.cc (Output_merge_string::do_add_input_section): Count strings
6168 to reserve space in merged_strings vector. Keep total input size
6169 for stats.
6170 (Output_merge_string::do_print_merge_stats): Print total input size.
6171 * merge.h (Output_merge_string): Add input_size_ field.
6172 * stringpool.cc (Stringpool_template::string_length): Move
6173 implementations out of Stringpool_template class and place in
6174 stringpool.h.
6175 * stringpool.h (string_length): Move out of Stringpool_template.
6176
6177 2010-08-03 Ian Lance Taylor <iant@google.com>
6178
6179 PR 11712
6180 * layout.cc (relaxation_loop_body): If address of load segment is
6181 set, adjust address to include headers if possible.
6182
6183 2010-08-03 Ian Lance Taylor <iant@google.com>
6184
6185 * version.cc (version_string): Bump to 1.10.
6186
6187 2010-08-03 Ian Lance Taylor <iant@google.com>
6188
6189 PR 11805
6190 * layout.h (enum Output_section_order): Define.
6191 (class Layout): Update declarations.
6192 * layout.cc (Layout::get_output_section): Add order parameter.
6193 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6194 is_first_non_relro parameters. Change all callers.
6195 (Layout::choose_output_section): Likewise.
6196 (Layout::add_output_section_data): Likewise.
6197 (Layout::make_output_section): Likewise. Set order.
6198 (Layout::default_section_order): New function.
6199 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6200 * output.cc (Output_section::Output_section): Initialize order_.
6201 Don't initialize deleted fields.
6202 (Output_segment::Output_segment): Don't initialize deleted
6203 fields.
6204 (Output_segment::add_output_section_to_load): New function
6205 replacing add_output_section. Change all callers to call this or
6206 add_output_section_to_nonload.
6207 (Output_segment::add_output_section_to_nonload): New function.
6208 (Output_segment::remove_output_section): Rewrite.
6209 (Output_segment::add_initial_output_data): Likewise.
6210 (Output_segment::has_any_data_sections): Likewise.
6211 (Output_segment::is_first_section_relro): Likewise.
6212 (Output_segment::maximum_alignment): Likewise.
6213 (Output_segment::has_dynamic_reloc): New function replacing
6214 dynamic_reloc_count. Change all callers.
6215 (Output_segment::has_dynamic_reloc_list): New function replacing
6216 dynamic_reloc_count_list. Change all callers.
6217 (Output_segment::set_section_addresses): Rewrite.
6218 (Output_segment::set_offset): Rewrite.
6219 (Output_segment::find_first_and_last_list): Remove.
6220 (Output_segment::set_tls_offsets): Rewrite.
6221 (Output_segment::first_section_load_address): Likewise.
6222 (Output_segment::output_section_count): Likewise.
6223 (Output_segment::section_with_lowest_load_address): Likewise.
6224 (Output_segment::write_section_headers): Likewise.
6225 (Output_segment::print_sections_to_map): Likewise.
6226 * output.h (class Output_data): Remove dynamic_reloc_count_
6227 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
6228 (Output_data::add_dynamic_reloc): Rewrite.
6229 (Output_data::has_dynamic_reloc): New function.
6230 (Output_data::dynamic_reloc_count): Remove.
6231 (class Output_section): Add order_ field. Remvoe is_relro_local_,
6232 is_last_relro_, is_first_non_relro_, is_interp_,
6233 is_dynamic_linker_section_ fields. Add order and set_order
6234 functions. Remove is_relro_local, set_is_relro_local,
6235 is_last_relro, set_is_last_relro, is_first_non_relro,
6236 set_is_first_non_relro functions, is_interp, set_is_interp,
6237 is_dynamic_linker_section, and set_is_dynamic_linker_section
6238 functions.
6239 (class Output_segment): Change Output_data_list from std::list to
6240 std:;vector. Add output_lists_ field. Remove output_data_ and
6241 output_bss_ fields. Update declarations.
6242
6243 2010-08-02 Ian Lance Taylor <iant@google.com>
6244
6245 * arm.cc (Target_arm::gc_process_relocs): Use typename.
6246 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6247 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6248
6249 2010-08-02 Ian Lance Taylor <iant@google.com>
6250
6251 PR 11855
6252 * script.cc (Script_options::Script_options): Initialize
6253 symbol_definitions_ and symbol_references_.
6254 (Script_options::add_symbol_assignment): Update
6255 symbol_definitions_ and symbol_references_.
6256 (Script_options::add_symbol_reference): New function.
6257 (script_symbol): New function.
6258 * script.h (class Script_options): Add symbol_definitions_ and
6259 symbol_references_ fields.
6260 (Script_options::referenced_const_iterator): New type.
6261 (Script_options::referenced_begin): New function.
6262 (Script_options::referenced_end): New function.
6263 (Script_options::is_referenced): New function.
6264 (Script_options::any_unreferenced): New function.
6265 * script-c.h (script_symbol): Declare.
6266 * yyscript.y (exp): Call script_symbol.
6267 * symtab.cc: Include "script.h".
6268 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6269 Change all callers. Check symbols referenced by scripts.
6270 (Symbol_table::add_undefined_symbols_from_command_line): Add
6271 layout parameter. Change all callers.
6272 (Symbol_table::do_add_undefined_symbols_from_command_line):
6273 Likewise. Break out loop body. Check symbols referenced by
6274 scripts.
6275 (Symbol_table::add_undefined_symbol_from_command_line): New
6276 function broken out of
6277 do_add_undefined_symbols_from_command_line.
6278 * symtab.h (class Symbol_table): Update declarations.
6279 * archive.cc: Include "layout.h".
6280 (Archive::should_include_member): Add layout parameter. Change
6281 all callers. Check for symbol mentioned in expression.
6282 * archive.h (class Archive): Update declaration.
6283 * object.cc (Sized_relobj::do_should_include_member): Add layout
6284 parameter.
6285 * object.h (Object::should_include_member): Add layout parameter.
6286 Change all callers.
6287 (Object::do_should_include_member): Add layout parameter.
6288 (class Sized_relobj): Update declaration.
6289 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6290 parameter.
6291 * dynobj.h (class Sized_dynobj): Update declaration.
6292 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6293 layout parameter.
6294 * plugin.h (class Sized_pluginobj): Update declaration.
6295
6296 2010-08-02 Ian Lance Taylor <iant@google.com>
6297
6298 PR 11866
6299 * output.cc (Output_segment::set_offset): Search for the first and
6300 last sections rather than assuming that the list is in order.
6301 (Output_segment::find_first_and_last_list): New function.
6302 * output.h (class Output_segment): Update declarations.
6303 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6304 (relro_strip_test_SOURCES): New variable.
6305 (relro_strip_test_DEPENDENCIES): New variable.
6306 (relro_strip_test_LDFLAGS): New variable.
6307 (relro_strip_test_LDADD): New variable.
6308 (relro_strip_test.so): New target.
6309
6310 2010-08-02 Ian Lance Taylor <iant@google.com>
6311
6312 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6313 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6314 (Target_i386::got_tlsdesc_section): New function.
6315 (Target_i386::got_section): Create space for GOT entries for
6316 TLSDESC relocations.
6317 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6318 R_386_TLS_GOTDESC.
6319 (Target_i386::Scan::global): Likewise.
6320 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6321 using TLSDESC GOT.
6322 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6323 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6324 (Target_x86_64::got_tlsdesc_section): New function.
6325 (Target_x86_64::got_section): Create space for GOT entries for
6326 TLSDESC relocations.
6327 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6328 R_386_TLS_GOTDESC.
6329 (Target_x86_64::Scan::global): Likewise.
6330 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6331 using TLSDESC GOT.
6332
6333 2010-08-02 Ian Lance Taylor <iant@google.com>
6334
6335 * testsuite/final_layout.sh: Use dc to convert from hex to
6336 decimal.
6337
6338 2010-07-29 Sriraman Tallam <tmsriram@google.com>
6339
6340 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6341 paramter to the call to gold::gc_process_relocs.
6342 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6343 paramter to the call to gold::gc_process_relocs.
6344 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6345 parameter to the call to gold::gc_process_relocs.
6346 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6347 template parameter to the call to gold::gc_process_relocs.
6348 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6349 paramter to the call to gold::gc_process_relocs.
6350 * gc.h (get_embedded_addend_size): New function.
6351 (gc_process_relocs): Save the size of the reloc for use by ICF.
6352 * icf.cc (get_section_contents): Get the addend from the text section
6353 for SHT_REL relocation sections.
6354 * icf.h (Icf::Reloc_addend_size_info): New typedef.
6355 (Icf::Reloc_info): Add new member reloc_addend_size_info.
6356 * int_encoding.h (read_from_pointer): New overloaded function.
6357 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6358 * testsuite/icf_sht_rel_addend_test.sh: New file.
6359 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6360 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6361
6362 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6363
6364 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6365 * Makefile.in: Regenerate.
6366 * testsuite/Makefile.in: Regenerate.
6367
6368 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
6369
6370 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6371 * gold/testsuite/debug_msg.cc: Likewise.
6372 * gold/testsuite/odr_violation1.cc
6373 * gold/testsuite/odr_violation2.cc
6374
6375 2010-07-21 Cary Coutant <ccoutant@google.com>
6376
6377 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6378 string, and length fields.
6379 (Output_merge_string::Merged_strings_list): New type.
6380 (Output_merge_string::Merged_strings_lists): New typedef.
6381 (Output_merge_string): Replace merged_strings_ with
6382 merged_strings_lists_.
6383 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6384 Merged_strings_list per input object and section. Don't store pointer
6385 to the string. Don't store length with each merged string entry.
6386 (Output_merge_string::finalize_merged_data): Loop over list of merged
6387 strings lists. Recompute length of each merged string.
6388
6389 2010-07-15 Cary Coutant <ccoutant@google.com>
6390
6391 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6392 here.
6393
6394 2010-07-14 Ian Lance Taylor <iant@google.com>
6395
6396 * descriptors.cc (Descriptors::open): Report correct name in error
6397 message.
6398
6399 2010-07-13 Doug Kwan <dougkwan@google.com>
6400
6401 * arm.cc (Arm_input_section::Arm_input_section): For a
6402 SHT_ARM_EXIDX section, always keeps the input sections.
6403 (Arm_input_section::set_exidx_section_link): New method.
6404 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6405 has_errors_ to false.
6406 (Arm_exidx_input_section::has_errors,
6407 Arm_exidx_input_section::set_has_errors): New methods.
6408 (Arm_exidx_input_section::has_errors_): New data member.
6409 (Arm_relobj::get_exidx_shndx_list): New method.
6410 (Arm_output_section::append_text_sections_to_list): Do not skip
6411 section without SHF_EXECINSTR.
6412 (Arm_output_section::fix_exidx_coverage): Skip input sections with
6413 errors.
6414 (Arm_relobj::make_exidx_input_section): Add new parameter for text
6415 section header. Make error messages more verbose. Check for
6416 a non-executable section linked to an EXIDX section.
6417 (Arm_relobj::do_read_symbols): Remove error checking, which has been
6418 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
6419 check that there is no deferred EXIDX section if we exit early.
6420 Instead of not making an EXIDX section in case of an error, make one
6421 and set the has_errors flag of it.
6422 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6423 in a relocatable link.
6424 (Target_arm::do_relax): Look for the EXIDX output section instead of
6425 assuming that it is called .ARM.exidx.
6426 (Target_arm::fix_exidx_coverage): Add a new parameter for input
6427 section list. Do not check for SHF_EXECINSTR section flags but
6428 skip any input section with errors.
6429 * output.cc (Output_section::Output_section): Initialize
6430 always_keeps_input_sections_ to false.
6431 (Output_section::add_input_section): Check for
6432 always_keeps_input_sections_.
6433 * output.h (Output_section::always_keeps_input_sections,
6434 Output_section::set_always_keeps_input_sections): New methods.
6435 (Output_section::always_keeps_input_sections): New data member.
6436
6437 2010-07-13 Rafael Espindola <espindola@google.com>
6438
6439 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6440 * fileread.h (Input_file): Add try_extra_search_path and find_file.
6441
6442 2010-07-13 Philip Herron <herron.philip@googlemail.com>
6443 Ian Lance Taylor <iant@google.com>
6444
6445 * output.h (Output_section_lookup_maps::add_merge_section):
6446 Correct check of whether value was inserted.
6447 (Output_section_lookup_maps::add_merge_input_section): Likewise.
6448 (Output_section_lookup_maps::add_relaxed_input_section):
6449 Likewise.
6450 * arm.cc (Target_arm::got_section): Remove used local os.
6451 * i386.cc (Target_i386::got_section): Likewise.
6452 * x86_64.cc (Target_x86_64::got_section): Likewise.
6453 * sparc.cc (Target_sparc::got_section): Likewise.
6454 (Target_sparc::relocate): Remove unused local have_got_offset.
6455 * powerpc.cc (Target_powerpc::relocate): Likewise.
6456
6457 2010-07-13 Ian Lance Taylor <iant@google.com>
6458
6459 * compressed_output.cc (zlib_decompress): Fix signature in
6460 !HAVE_ZLIB_H case.
6461
6462 * archive.cc (Archive::include_member): Unlock an external member
6463 of a thin archive. Don't bother to delete an object we know is
6464 NULL.
6465
6466 2010-07-12 Cary Coutant <ccoutant@google.com>
6467
6468 * compressed_output.cc (zlib_decompress): New function.
6469 (get_uncompressed_size): New function.
6470 (decompress_input_section): New function.
6471 * compressed_output.h (get_uncompressed_size): New function.
6472 (decompress_input_section): New function.
6473 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6474 Handle compressed debug sections.
6475 * layout.cc (is_compressed_debug_section): New function.
6476 (Layout::output_section_name): Map compressed section names to
6477 canonical names.
6478 * layout.h (is_compressed_debug_section): New function.
6479 (is_debug_info_section): Recognize compressed debug sections.
6480 * merge.cc: Include compressed_output.h.
6481 (Output_merge_data::do_add_input_section): Handle compressed
6482 debug sections.
6483 (Output_merge_string::do_add_input_section): Handle compressed
6484 debug sections.
6485 * object.cc: Include compressed_output.h.
6486 (Sized_relobj::Sized_relobj): Initialize new data members.
6487 (build_compressed_section_map): New function.
6488 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6489 * object.h (Object::section_is_compressed): New method.
6490 (Object::do_section_is_compressed): New method.
6491 (Sized_relobj::Compressed_section_map): New type.
6492 (Sized_relobj::do_section_is_compressed): New method.
6493 (Sized_relobj::compressed_sections_): New data member.
6494 * output.cc (Output_section::add_input_section): Handle compressed
6495 debug sections.
6496 * reloc.cc: Include compressed_output.h.
6497 (Sized_relobj::write_sections): Handle compressed debug sections.
6498
6499 2010-07-08 Cary Coutant <ccoutant@google.com>
6500
6501 * resolve.cc (Symbol_table::resolve): Remember whether undef was
6502 weak when resolving to a dynamic def.
6503 (Symbol_table::should_override): Add adjust_dyndef flag; set it
6504 for weak undef/dynamic def cases. Adjust callers.
6505 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6506 undef_binding_weak_.
6507 (Symbol_table::sized_write_globals): Adjust symbol binding.
6508 (Symbol_table::sized_write_symbol): Add binding parameter.
6509 * symtab.h (Symbol::set_undef_binding): New method.
6510 (Symbol::is_undef_binding_weak): New method.
6511 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6512 (Symbol_table::should_override): Add new parameter.
6513 (Symbol_table::sized_write_symbol): Add new parameter.
6514
6515 * testsuite/weak_undef_file1.cc: Add new test case.
6516 * testsuite/weak_undef_file2.cc: Fix header comment.
6517 * testsuite/weak_undef_test.cc: Add new test case.
6518
6519 2010-06-29 Doug Kwan <dougkwan@google.com>
6520
6521 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6522 Initialize USE_SYMBOL_.
6523 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6524 definition.
6525 (Arm_reloc_property::uses_symbol_): New data member declaration.
6526 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6527 uses symbol value and symbol is undefined but not weakly undefined.
6528
6529 2010-06-28 Rafael Espindola <espindola@google.com>
6530
6531 * plugin.cc (Plugin::load): Use dlerror.
6532
6533 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
6534
6535 * symtab.cc (detect_odr_violations): When reporting an ODR
6536 violation, report an object where the symbol is defined.
6537
6538 2010-06-25 Doug Kwan <dougkwan@google.com>
6539
6540 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6541 (Target_arm::section_may_have_icf_unsafe_pointers): New method
6542 definition.
6543 (Target_arm::Scan::local_reloc_may_be_function_pointer,
6544 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6545 target hook to detect function points.
6546 (Target_arm::Scan::possible_function_pointer_reloc): New method.
6547 * icf.h (Icf::check_section_for_function_pointers): Change type of
6548 parameter SECTION_NAME to const reference to std::string. Use
6549 target hook to determine if section may have unsafe pointers.
6550 * target.h (Target::section_may_have_icf_unsafe_pointers): New
6551 method definition.
6552
6553 2010-06-21 Rafael Espindola <espindola@google.com>
6554
6555 * fileread.cc (Input_file::find_fie): New
6556 (Input_file::open): Use Input_file::find_fie.
6557 * fileread.h (Input_file::find_fie): New
6558 * plugin.cc (set_extra_library_path): New.
6559 (Plugin::load): Add set_extra_library_path to the transfer vector.
6560 (Plugin_manager::set_extra_library_path): New.
6561 (Plugin_manager::add_input_file): Use the extra search path if set.
6562 (set_extra_library_path(): New.
6563 * plugin.h (Plugin_manager): Add set_extra_library_path and
6564 extra_search_path_.
6565
6566 2010-06-19 Cary Coutant <ccoutant@google.com>
6567
6568 * layout.cc (gdb_sections): Add .debug_types.
6569 (lines_only_debug_sections): Likewise.
6570
6571 2010-06-18 Rafael Espindola <espindola@google.com>
6572
6573 * plugin.cc (add_input_file,add_input_library)
6574 (Plugin_manager::add_input_file): Make filename arguments const.
6575 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6576 const.
6577
6578 2010-06-16 Doug Kwan <dougkwan@google.com>
6579
6580 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6581 .ARM.attributes section if we have not merged any input
6582 attributes sections.
6583
6584 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6585
6586 * arm.cc: Allow combining objects with no EABI version
6587 information.
6588
6589 2010-06-15 Rafael Espindola <espindola@google.com>
6590
6591 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6592
6593 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6594
6595 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6596 (struct iovec): Correct !HAVE_READV definition.
6597
6598 2010-06-10 Cary Coutant <ccoutant@google.com>
6599
6600 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6601 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6602 reloc sections.
6603 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6604
6605 PR 11683
6606 * symtab.h (Symbol::is_placeholder): New member function.
6607 * target-reloc.h (relocate_section): Check for placeholder symbols.
6608
6609 * testsuite/Makefile.am (plugin_test_8): New test.
6610 (plugin_test_9): New test.
6611 * testsuite/Makefile.in: Regenerate.
6612
6613 2010-06-09 Nick Clifton <nickc@redhat.com>
6614
6615 * yyscript.y (input_list_element): Allow strings prefixed with
6616 the '-' character. Treat these as libraries.
6617 * script.cc (script_add_library): New function. Adds a library
6618 specified by "-l<name>" found in an input script.
6619 * script-c.h: Add prototype for script_add_library.
6620
6621 2010-06-07 Doug Kwan <dougkwan@google.com>
6622
6623 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6624 Restrict stub-group size to be within long conditional branch
6625 range when working around cortex-A8 erratum.
6626
6627 2010-06-07 Damien Diederen <dd@crosstwine.com>
6628
6629 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6630 #ifdef typo.
6631
6632 2010-06-03 Sriraman Tallam <tmsriram@google.com>
6633
6634 PR gold/11658
6635 * output.cc
6636 (Output_section::Input_section_sort_entry::compare_section_ordering):
6637 Change to return non-zero correctly.
6638 (Output_section::Input_section_sort_section_order_index_compare
6639 ::operator()): Change to fix ambiguity in comparisons.
6640
6641 2010-06-01 Sriraman Tallam <tmsriram@google.com>
6642
6643 * gold.h (is_wildcard_string): New function.
6644 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6645 (Layout::layout_eh_frame): Ditto.
6646 (Layout::find_section_order_index): New method.
6647 (Layout::read_layout_from_file): New method.
6648 * layout.h (Layout::find_section_order_index): New method.
6649 (Layout::read_layout_from_file): New method.
6650 (Layout::input_section_position_): New private member.
6651 (Layout::input_section_glob_): New private member.
6652 * main.cc (main): Call read_layout_from_file here.
6653 * options.h (--section-ordering-file): New option.
6654 * output.cc (Output_section::input_section_order_specified_): New
6655 member.
6656 (Output_section::Output_section): Initialize new member.
6657 (Output_section::add_input_section): Add new parameter.
6658 Keep input sections when --section-ordering-file is used.
6659 (Output_section::set_final_data_size): Sort input sections when
6660 section ordering file is specified.
6661 (Output_section::Input_section_sort_entry): Add new parameter.
6662 Check sorting type.
6663 (Output_section::Input_section_sort_entry::compare_section_ordering):
6664 New method.
6665 (Output_section::Input_section_sort_compare::operator()): Change to
6666 consider section_order_index.
6667 (Output_section::Input_section_sort_init_fini_compare::operator()):
6668 Change to consider section_order_index.
6669 (Output_section::Input_section_sort_section_order_index_compare
6670 ::operator()): New method.
6671 (Output_section::sort_attached_input_sections): Change to sort
6672 according to section order when specified.
6673 (Output_section::add_input_section<32, true>): Add new parameter.
6674 (Output_section::add_input_section<64, true>): Add new parameter.
6675 (Output_section::add_input_section<32, false>): Add new parameter.
6676 (Output_section::add_input_section<64, false>): Add new parameter.
6677 * output.h (Output_section::add_input_section): Add new parameter.
6678 (Output_section::input_section_order_specified): New
6679 method.
6680 (Output_section::set_input_section_order_specified): New method.
6681 (Input_section::Input_section): Initialize section_order_index_.
6682 (Input_section::section_order_index): New method.
6683 (Input_section::set_section_order_index): New method.
6684 (Input_section::section_order_index_): New member.
6685 (Input_section::Input_section_sort_section_order_index_compare): New
6686 struct.
6687 (Output_section::input_section_order_specified_): New member.
6688 * script-sections.cc (is_wildcard_string): Delete and move modified
6689 method to gold.h.
6690 (Output_section_element_input::Output_section_element_input): Modify
6691 call to is_wildcard_string.
6692 (Output_section_element_input::Input_section_pattern
6693 ::Input_section_pattern): Ditto.
6694 (Output_section_element_input::Output_section_element_input): Ditto.
6695 * testsuite/Makefile.am (final_layout): New test case.
6696 * testsuite/Makefile.in: Regenerate.
6697 * testsuite/final_layout.cc: New file.
6698 * testsuite/final_layout.sh: New file.
6699
6700 2010-06-01 Rafael Espindola <espindola@google.com>
6701
6702 * plugin.cc (Plugin::load): Pass the output name to the plugin.
6703
6704 2010-06-01 Rafael Espindola <espindola@google.com>
6705
6706 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6707 visibility of symbols.
6708
6709 2010-05-27 Doug Kwan <dougkwan@google.com>
6710
6711 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6712 from start of output section instead of address for a local symbol
6713 in a merged or relaxed section when doing a relocatable link.
6714
6715 2010-05-26 Rafael Espindola <espindola@google.com>
6716
6717 PR 11604
6718 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6719 adding sections the garbage collector removed.
6720 * gold/testsuite/Makefile.am: Add test.
6721 * gold/testsuite/Makefile.in: Regenerate.
6722 * gold/testsuite/plugin_test_7.sh: New.
6723 * gold/testsuite/plugin_test_7_1.c: New.
6724 * gold/testsuite/plugin_test_7_2.c: New.
6725
6726 2010-05-26 Rafael Espindola <espindola@google.com>
6727
6728 * script-sections.cc (Output_section_definition::set_section_addresses):
6729 Check for --section-start.
6730
6731 2010-05-26 Doug Kwan <dougkwan@google.com>
6732
6733 * arm.cc (Arm_scan_relocatable_relocs): New class.
6734 (Target_arm::relocate_special_relocatable): New method.
6735 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6736 (Arm_relocate_functions::thumb_branch_common): Same.
6737 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6738 instead of Default_scan_relocatable_relocs.
6739 * target-reloc.h (relocate_for_relocatable): Let target handle
6740 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6741 * target.h (Sized_target::relocate_special_relocatable): New method.
6742
6743 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6744
6745 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6746
6747 2010-05-23 Doug Kwan <dougkwan@google.com>
6748
6749 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6750 instead of a cast.
6751 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6752 with a direct branch, not a conditional branch, to a stub.
6753 * merge.cc (Output_merge_base::record_input_section): New method
6754 defintion.
6755 (Output_merge_data::do_add_input_section): Record input section if
6756 keeps-input-sections flag is set.
6757 (Output_merge_string::do_add_input_section): Ditto.
6758 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6759 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6760 INPUT_SECTIONS_.
6761 (Output_merge_base::keeps_input_sections,
6762 Output_merge_base::set_keeps_input_sections,
6763 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6764 method definitions.
6765 (Output_merge_base::Input_sections): New type declaration.
6766 (Output_merge_base::input_sections_begin,
6767 Output_merge_base::input_sections_end,
6768 Output_merge_base::do_set_keeps_input_sections): New method definitions.
6769 (Output_merge_base::bool keeps_input_sections_,
6770 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6771 Output_merge_base::input_sections_): New data members.
6772 (Output_merge_data::do_set_keeps_input_sections): New method
6773 defintion.
6774 (Output_merge_string::do_set_keeps_input_sections): Ditto.
6775 * output.cc (Output_section::Input_section::relobj): Move method
6776 defintion from class declaration to here and handle merge sections.
6777 (Output_section::Input_section::shndx): Ditto.
6778 (Output_section::Output_section): Remove initializations of removed
6779 data members and initialize new data member LOOKUP_MAPS_.
6780 (Output_section::add_input_section): Set keeps-input-sections flag
6781 for a newly created merge output section as appropriate. Adjust code
6782 to use Output_section_lookup_maps class.
6783 (Output_section::add_relaxed_input_section): Adjst code for lookup
6784 maps code refactoring.
6785 (Output_section::add_merge_input_section): Add a new parameter
6786 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6787 class. If adding input section to a newly created merge output
6788 section fails, remove the new merge section.
6789 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6790 Adjust code for use of the Output_section_lookup_maps class.
6791 (Output_section::find_merge_section): Ditto.
6792 (Output_section::build_lookup_maps): New method defintion.
6793 (Output_section::find_relaxed_input_section): Adjust code to use
6794 Output_section_lookup_maps class.
6795 (Output_section::get_input_sections): Export merge sections. Adjust
6796 code to use Output_section_lookup_maps class.
6797 (Output_section:::add_script_input_section): Adjust code to use
6798 Output_section_lookup_maps class. Update lookup maps for merge
6799 sections also.
6800 (Output_section::discard_states): Use Output_section_lookup_maps.
6801 (Output_section::restore_states): Same.
6802 * output.h (Merge_section_properties): Move class defintion out of
6803 Output_section.
6804 (Output_section_lookup_maps): New class.
6805 (Output_section::Input_section::is_merge_section): New method
6806 defintion.
6807 (Output_section::Input_section::relobj): Move defintion out of class
6808 defintion. Declare method only.
6809 (Output_section::Input_section::shndx): Ditto.
6810 (Output_section::Input_section::output_merge_base): New method defintion.
6811 (Output_section::Input_section::u2_.pomb): New union field.
6812 (Output_section::Merge_section_by_properties_map,
6813 Output_section::Output_section_data_by_input_section_map,
6814 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6815 Remove types.
6816 (Output_section::add_merge_input_section): Add new parameter
6817 KEEPS_INPUT_SECTIONS.
6818 (Output_section::build_lookup_maps): New method declaration.
6819 (Output_section::merge_section_map_,
6820 Output_section::merge_section_by_properties_map_,
6821 Output_section::relaxed_input_section_map_,
6822 Output_section::is_relaxed_input_section_map_valid_): Remove data
6823 members.
6824 (Output_section::lookup_maps_): New data member.
6825
6826 2010-05-21 Doug Kwan <dougkwan@google.com>
6827
6828 PR gold/11619
6829 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6830 avoid a compilation error.
6831
6832 2010-05-19 Rafael Espindola <espindola@google.com>
6833
6834 * script-sections.cc (Output_section_definition::allocate_to_segment):
6835 Update the phdrs_list even when the output section is NULL.
6836 * testsuite/Makefile.am: Add test.
6837 * testsuite/Makefile.in: Regenerate.
6838 * testsuite/script_test_9.cc: New.
6839 * testsuite/script_test_9.sh: New.
6840 * testsuite/script_test_9.t: New.
6841
6842 2010-05-19 Doug Kwan <dougkwan@google.com>
6843
6844 * arm.cc (Arm_input_section::original_size): New method.
6845 (Arm_input_section::do_addralign): Add a cast.
6846 (Arm_input_section::do_output_offset): Remove static cast.
6847 (Arm_input_section::original_addralign,
6848 Arm_input_section::original_size_): Change type to uint32_t.
6849 (Arm_input_section::init): Add safe casts for section alignment
6850 and size.
6851 (Arm_input_section::set_final_data_size): Do not set address and
6852 offset of stub table.
6853 (Arm_output_section::fix_exidx_coverage): Change use of of
6854 Output_section::Simple_input_section to that of
6855 Output_section::Input_section.
6856 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6857 except for the first pass.
6858 * output.cc (Output_section::get_input_sections): Change type of
6859 input_sections to std::list<Input_section>.
6860 (Output_section::add_script_input_section): Rename from
6861 Output_section::add_simple_input_section. Change type of SIS
6862 parameter from Simple_input_section to Input_section.
6863 * output.h (Output_section::Simple_input_section): Remove class.
6864 (Output_section::Input_section): Change class visibility to public.
6865 (Output_section::Input_section::addralign): Use stored alignments
6866 for special input sections if set.
6867 (Output_section::Input_section::set_addralign): New method.
6868 (Output_section::get_input_sections): Change parameter type from
6869 list of Simple_input_section to list of Input_section.
6870 (Output_section::add_script_input_section): Rename from
6871 Output_section::add_simple_input_section. Change first parameter's
6872 type from Simple_input_section to Input_section and remove the
6873 second and third parameters.
6874 * script-sections.cc (Input_section::Input_section_list): Change
6875 type to list of Output_section::Input_section/
6876 (Input_section_info::Input_section_info): Change parameter type of
6877 INPUT_SECTION to Output_section::Input_section.
6878 (Input_section_info::input_section): Change return type.
6879 (Input_section_info::input_section_): Change type to
6880 Output_section::Input_section.
6881 (Output_section_element_input::set_section_addresses): Adjust code
6882 to use Output_section::Input_section instead of
6883 Output_section::Simple_input_section. Adjust code for renaming
6884 of Output_section::add_simple_input_section.
6885 (Orphan_output_section::set_section_addresses): Ditto.
6886
6887 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6888
6889 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6890 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6891
6892 2010-05-18 Rafael Espindola <espindola@google.com>
6893
6894 * options.cc (General_options::finalize): Handle -nostdlib.
6895 * options.h (nostdlib): New option.
6896 * script.cc (script_add_search_dir): Handle -nostdlib.
6897
6898 2010-05-12 Doug Kwan <dougkwan@google.com>
6899
6900 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6901 attributes section only if there no attributes section after merging.
6902 (Target_arm::merge_object_attributes): Move value of
6903 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6904 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6905 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6906 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6907 and arm_attr_merge_7.stdout.
6908 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6909 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6910 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6911 arm_attr_merge_7b.o): New rules.
6912 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6913 arm_attr_merge_7
6914 * testsuite/Makefile.in: Regenerate.
6915 * testsuite/arm_attr_merge.sh: New file.
6916 * testsuite/arm_attr_merge_[67][ab].s: Same.
6917
6918 2010-05-05 Nick Clifton <nickc@redhat.com>
6919
6920 * po/es.po: Updated Spanish translation.
6921
6922 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6923
6924 * Makefile.am (install-exec-local): Properly install gold as
6925 default cross linker.
6926 * Makefile.in: Regenerated.
6927
6928 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6929 Nick Clifton <nickc@redhat.com>
6930
6931 * configure.ac (install_as_default): Define and set to false
6932 unless --enable-gold or --enable-gold=both/gold has been
6933 specified.
6934 * configure: Regenerate.
6935
6936 * Makefile.am (install-exec-local): Install the executable as
6937 'ld.gold'. If install_as_default is true then also install it as
6938 'ld'.
6939 * Makefile.in: Regenerated.
6940
6941 2010-04-24 Ian Lance Taylor <iant@google.com>
6942
6943 * layout.cc (Layout::layout_reloc): In relocatable link don't
6944 combine reloc sections for grouped sections.
6945
6946 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6947
6948 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6949 sections that are not ordinary to icf.
6950 * icf.cc (get_section_contents): Handle relocation pointing to section
6951 with no object or shndx information.
6952 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6953 * testsuite/Makefile.in: Regenerate.
6954 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6955 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6956
6957 2010-04-22 Ian Lance Taylor <iant@google.com>
6958
6959 * expression.cc (Expression::Expression_eval_info): Add
6960 result_alignment_pointer field.
6961 (Expression::eval_with_dot): Add result_alignment_pointer
6962 parameter. Change all callers.
6963 (Expression::eval_maybe_dot): Likewise.
6964 (class Binary_expression): Add alignment_pointer parameter to
6965 left_value and right_value. Change all callers.
6966 (BINARY_EXPRESSION): Set result alignment.
6967 (class Trinary_expression): Add alignment_pointer parameter to
6968 arg2_value and arg3_value. Change all callers.
6969 (Trinary_cond::value): Set result alignment.
6970 (Max_expression::value, Min_expression::value): Likewise.
6971 (Align_expression::value): Likewise.
6972 * script-sections.cc (class Sections_element): Add dot_alignment
6973 parameter to set_section_addresses virtual function. Update
6974 instantiations.
6975 (class Output_section_element): Likewise.
6976 (Script_sections::create_segments): Add dot_alignment parameter.
6977 Change all callers.
6978 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6979 (Script_sections::set_phdrs_clause_addresses): Likewise.
6980 * script-sections.h: Update declarations.
6981 * script.h: Update declarations.
6982 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6983 min_p_align.
6984 * testsuite/script_test_3.t: Set large alignment.
6985 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6986 segment has expected alignment.
6987
6988 2010-04-22 Nick Clifton <nickc@redhat.com>
6989
6990 * po/gold.pot: Updated by the Translation project.
6991 * po/vi.po: Updated Vietnamese translation.
6992
6993 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6994
6995 * testsuite/Makefile.am (check_PROGRAMS): Add
6996 icf_virtual_function_folding_test.
6997 * testsuite/Makefile.in: Regenerated.
6998
6999 2010-04-15 Andrew Haley <aph@redhat.com>
7000
7001 * options.h (merge_exidx_entries): New option.
7002 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7003 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7004 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7005 (Target_arm::merge_exidx_entries): New function.
7006 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7007 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7008 to Arm_exidx_fixup constructor.
7009 Add new arg, merge_exidx_entries.
7010 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7011 Arm_output_section::fix_exidx_coverage.
7012
7013 2010-04-18 Sriraman Tallam <tmsriram@google.com>
7014
7015 * icf.cc (get_section_contents): Check for preemptible functions.
7016 Ignore addend when appropriate.
7017 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
7018 section folded.
7019 (add_from_relobj): Check for section folded.
7020 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7021 * symtab.h (should_add_dynsym_entry): Add new parameter.
7022 * target-reloc.h (scan_relocs): Check for section folded.
7023 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7024 Check reloc types for function pointers in shared objects.
7025 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7026 case.
7027 (icf_preemptible_functions_test): New test case.
7028 (icf_string_merge_test): New test case.
7029 * testsuite.Makefile.in: Regenerate.
7030 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7031 bar_glob. Refactor code.
7032 * testsuite/icf_preemptible_functions_test.cc: New file.
7033 * testsuite/icf_preemptible_functions_test.sh: New file.
7034 * testsuite/icf_string_merge_test.cc: New file.
7035 * testsuite/icf_string_merge_test.sh: New file.
7036 * testsuite/icf_virtual_function_folding_test.cc: New file.
7037 * testsuite/icf_virtual_function_folding_test.sh: New file.
7038
7039 2010-04-14 Doug Kwan <dougkwan@google.com>
7040
7041 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7042 for local symbol recounting if we remove a section due to ICF.
7043 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7044 there are no regular objects in input.
7045
7046 2010-04-13 Doug Kwan <dougkwan@google.com>
7047
7048 * arm.cc (Arm_input_section::set_final_data_size): Compute
7049 accurate final data size instead of using current data size.
7050
7051 2010-04-09 Doug Kwan <dougkwan@google.com>
7052
7053 * layout.cc (Layout::choose_output_section): Handle script section
7054 types.
7055 (Layout::make_output_section_for_script): Add section type parameter.
7056 Handle script section types.
7057 * layout.h (Layout::make_output_section_for_script): Add section
7058 type parameter.
7059 * output.cc (Output_section::Output_section): Initialize data member
7060 is_noload_.
7061 (Output_section::do_reset_address_and_file_offset): Do not set address
7062 to 0 if section is a NOLOAD section.
7063 * output.h (Output_section::is_noload): New method.
7064 (Output_section::set_is_noload): Ditto.
7065 (Output_section::is_noload_): New data member.
7066 * script-c.h (Script_section_type): New enum type.
7067 (struct Parser_output_section_header): Add new file section_type.
7068 * script-sections.cc (Sections_element::output_section_name): Add
7069 parameter for returning script section type.
7070 (Output_section_definition::output_section_name): Ditto.
7071 (Output_section_definition::section_type)P; New method.
7072 (Output_section_definiton::script_section_type_name): Ditto.
7073 (Output_section_definition::script_section_type_): New data member.
7074 (Output_section_definition::Output_section_definition): Initialize
7075 data member Output_section_definition::script_section_type_.
7076 (Output_section_definition::create_sections): Pass script section type
7077 to Layout::make_output_section_for_script.
7078 (Output_section_definition::output_section_name): Return script
7079 section type to caller.
7080 (Output_section_definition::set_section_address): Do not advance
7081 dot value and load address if section type is NOLOAD. Set address
7082 of NOLOAD sections regardless of section flags.
7083 (Output_section_definition::print): Print section type if it is
7084 not SCRIPT_SECTION_TYPE_NONE.
7085 (Output_section_definition::section_type): New method.
7086 (Output_section_definition::script_section_type_name): Ditto.
7087 (Script_sections::output_section_name): Add new parameter
7088 PSECTION_TYPE for returning script section type. Pass it to
7089 section elements. Handle discard sections.
7090 (Sort_output_sections::operator()): Handle NOLOAD sections.
7091 * script-sections.h (Script_sections::Section_type): New enum type.
7092 (Script_sections::output_section_name): Add a new parameter for
7093 returning script section type.
7094 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7095 INFO and NOLOAD.
7096 * yyscript.y (union): Add new field SECTION_TYPE.
7097 (COPY, DSECT, INFO, NOLOAD): New tokens.
7098 (opt_address_and_section_type): Change type to output_section_header.
7099 (section_type): New non-terminal
7100 (section_header): Handle section type.
7101 (opt_address_and_section_type): Return section type value.
7102
7103 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
7104
7105 * testsuite/plugin_common_test_1.c (foo): Add prototype.
7106 * testsuite/plugin_common_test_2.c (foo): Likewise.
7107
7108 2010-04-08 Doug Kwan <dougkwan@google.com>
7109
7110 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7111 Output_merge_data.
7112 * output.cc (Output_section::add_merge_input_section): Simplify
7113 code and return status of Output_merge_base::add_input_section.
7114 Update merge section map only if Output_merge_base::add_input_section
7115 returns true.
7116
7117 2010-04-07 Doug Kwan <dougkwan@google.com>
7118
7119 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7120 if section is marked as containing instructions but has no mapping
7121 symbols.
7122 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7123 correct section index.
7124 (Arm_relobj::find_linked_text_section): Ditto.
7125
7126 2010-04-07 Cary Coutant <ccoutant@google.com>
7127
7128 * archive.cc (include_member): Destroy Read_symbols_data object before
7129 releasing file.
7130 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7131 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7132 (Read_symbols_data::~Read_symbols_data) New destructor.
7133 (Section_relocs::Section_relocs) New constructor.
7134 (Section_relocs::~Section_relocs) New destructor.
7135 (Read_relocs_data::Read_relocs_data) New constructor.
7136 (Read_relocs_data::~Read_relocs_data) New destructor.
7137 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7138 pointers to NULL after deleting.
7139
7140 2010-04-07 Doug Kwan <dougkwan@google.com>
7141
7142 * arm.cc: Replace "endianity" with "endianness" in comments.
7143 (Arm_exidx_cantunwind): Ditto.
7144 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7145 (Arm_relobj::merge_flags_and_attributes): New method.
7146 (Arm_relobj::merge_flags_and_attributes_): New data member.
7147 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7148 (Arm_relobj::scan_sections_for_stubs): Ditto.
7149 (Arm_relobj::do_read_symbols): Check to see if we really want to
7150 merge processor-specific flags and attributes. Exit early if
7151 an object is empty except for section names and the undefined symbol.
7152 (Target_arm::do_finalize_sections): Move check for ELF format to
7153 Arm_relobj::do_read_symbols. Merge processor specific flags and
7154 attributes from a regular object only when we have determined that
7155 it is aapropriate. Do not create an .ARM.attributes section in
7156 output if there is no regular input object.
7157 (Target_arm::merge_processor_specific_flags): Check
7158 --warn-mismatch before printing any error.
7159 (Target_arm::merge_object_attributes): Ditto.
7160 * gold.cc (queue_middle_tasks): Handle the case in which there is
7161 no regular object in input.
7162 * options.cc (General_options::parse_EB): New method.
7163 (General_options::parse_EL): Same.
7164 (General_options::General_options): Initialize endianness_.
7165 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7166 New options.
7167 (General_options::Endianness): New enum.
7168 (General_options::endianness): New method.
7169 (General_options::endianness_): New data member.
7170 * parameters.cc (Parameters::set_options): Check target endianness.
7171 (Parameters::set_target_once): Ditto.
7172 (Parameters::check_target_endianness): New method.
7173 (parameters_force_valid_target): If either -EL or -EB is specified,
7174 use it to define endianness of default target.
7175 * parameters.h (Parameters::check_target_endianness): New method
7176 declaration.
7177 * target.h (class Target): Change "endianity" to "endianness"
7178 in comments.
7179
7180 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7181
7182 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7183 * configure: Regenerate.
7184 * Makefile.in: Regenerate.
7185 * testsuite/Makefile.in: Regenerate.
7186
7187 2010-04-06 Cary Coutant <ccoutant@google.com>
7188
7189 gcc PR lto/42757
7190 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7191 prevailing definitions of common symbols.
7192 * testsuite/plugin_test_6.sh: New test case.
7193 * testsuite/plugin_common_test_1.c: New test case.
7194 * testsuite/plugin_common_test_2.c: New test case.
7195 * testsuite/Makefile.am (plugin_test_6): New test case.
7196 * testsuite/Makefile.in: Regenerate.
7197
7198 2010-04-06 Nick Clifton <nickc@redhat.com>
7199
7200 * po/vi.po: New Vietnamese translation.
7201
7202 2010-03-30 Doug Kwan <dougkwan@google.com>
7203
7204 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7205
7206 2010-03-25 Doug Kwan <dougkwan@google.com>
7207
7208 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7209 to avoid a conversion warning on a 32-bit host.
7210
7211 2010-03-24 Ian Lance Taylor <iant@google.com>
7212
7213 * testsuite/script_test_3.t: Add a TLS segment.
7214 * testsuite/Makefile.am (check_PROGRAMS): Add
7215 tls_phdrs_script_test.
7216 (tls_phdrs_script_test_SOURCES): Define.
7217 (tls_phdrs_script_test_DEPENDENCIES): Define.
7218 (tls_phdrs_script_test_LDFLAGS): Define.
7219 (tls_phdrs_script_test_LDADD): Define.
7220 * testsuite/Makefile.in: Rebuild.
7221
7222 2010-03-23 Cary Coutant <ccoutant@google.com>
7223
7224 * fileread.cc (find_or_make_view): Fix comment.
7225
7226 2010-03-23 Ian Lance Taylor <iant@google.com>
7227
7228 * script-sections.cc (class Orphan_section_placement): Define
7229 PLACE_TLS and PLACE_TLS_BSS.
7230 (Orphan_section_placement::Orphan_section_placement): Initialize
7231 new places.
7232 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7233 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7234 (tls_script_test_SOURCES): Define.
7235 (tls_script_test_DEPENDENCIES): Define.
7236 (tls_script_test_LDFLAGS): Define.
7237 (tls_script_test_LDADD): Define.
7238 * testsuite/Makefile.in: Rebuild.
7239
7240 2010-03-22 Doug Kwan <dougkwan@google.com>
7241
7242 * arm.cc (Arm_relocate_functions::abs8,
7243 Arm_relocate_functions::abs16): Use correct check for overflow
7244 specified in the ARM ELF specs.
7245 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
7246 target of a BLX instruction specially.
7247 (Reloc_stub::stub_type_for_reloc): Ditto.
7248 (Relocate::relocate): Use symbolic names instead of numeric relocation
7249 codes to report error.
7250 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7251 workaround.
7252 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7253 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7254 thumb2_blx_out_of_range.stdout
7255 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7256 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7257 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7258 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7259 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7260 thumb2_blx_in_range, thumb2_blx_in_range.o,
7261 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7262 thumb2_blx_out_of_range.o): New rules.
7263 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7264 thumb2_blx_in_range and thumb2_blx_out_of_range.
7265 * testsuite/Makefile.in: Regenerate.
7266 * arm_branch_in_range.sh: Add tests for THUMB BLX.
7267 * testsuite/thumb_blx_in_range.s: New file.
7268 * testsuite/thumb_blx_out_of_range.s: New file.
7269
7270 2010-03-22 Rafael Espindola <espindola@google.com>
7271
7272 * archive.cc (Should_include): Move to archive.h.
7273 (should_include_member): Make it a member of Archive.
7274 (Lib_group): New.
7275 (Add_lib_group_symbols): New.
7276 * archive.h: Include options.h.
7277 (Archive_member): Moved from Archive.
7278 (Should_include): Moved from archive.cc.
7279 (Lib_group): New.
7280 (Add_lib_group_symbols): New.
7281 * dynobj.cc (do_should_include_member): New.
7282 * dynobj.h (do_should_include_member): New.
7283 * gold.cc (queue_initial_tasks): Update call to queue.
7284 * main.cc (main): Print lib group stats.
7285 * object.cc (do_should_include_member): New.
7286 * object.h: Include archive.h.
7287 (Object::should_include_member): New.
7288 (Object::do_should_include_member): New.
7289 (Sized_relobj::do_should_include_member): New.
7290 * options.cc (General_options::parse_start_lib): New.
7291 (General_options::parse_end_lib): New.
7292 (Input_arguments::add_file): Handle lib groups.
7293 (Input_arguments::start_group): Check we are not in a lib.
7294 (Input_arguments::start_lib): New.
7295 (Input_arguments::end_lib): New.
7296 * options.h (General_options): Add start_lib and end_lib.
7297 (Input_argument::lib_): New.
7298 (Input_argument::lib): New.
7299 (Input_argument::is_lib): New.
7300 (Input_file_lib): New.
7301 (Input_arguments::in_lib_): New.
7302 (Input_arguments::in_lib): New.
7303 (Input_arguments::start_lib): New.
7304 (Input_arguments::end_lib_): New.
7305 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7306 in unused members as preempted.
7307 (Sized_pluginobj::do_should_include_member): New.
7308 * plugin.h (Sized_pluginobj::do_should_include_member): New.
7309 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7310 return the blocker.
7311 (Read_symbols::do_whole_lib_group): New.
7312 (Read_symbols::do_lib_group): New.
7313 (Read_symbols::do_read_symbols): Handle lib groups.
7314 (Read_symbols::get_name): Handle lib groups.
7315 * readsyms.h (Read_symbols): Add an archive member pointer.
7316 (Read_symbols::do_whole_lib_group): New.
7317 (Read_symbols::do_lib_group): New.
7318 (Read_symbols::member_): New.
7319 * script.cc (read_input_script): Update call to queue_soon.
7320
7321 2010-03-19 Doug Kwan <dougkwan@google.com>
7322
7323 * arm.cc (Stub_table::Stub_table): Initialize new data members
7324 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7325 (Stub_table::add_reloc_stub): Assign stub offset and update
7326 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7327 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7328 New data members.
7329 (Stub_table::update_data_size_and_addralign): Use
7330 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7331 instead of going over all reloc stubs.
7332 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7333 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7334 Stringpool_template::offset_ to size of Stringpool_char.
7335 (Stringpool_template::new_key_offset): Remove code to initialize
7336 Stringpool_template::offset_.
7337 * stringpool.h (Stringpool_template::set_no_zero_null): Set
7338 Stringpool_template::offset_ to zero.
7339
7340 2010-03-15 Doug Kwan <dougkwan@google.com>
7341
7342 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7343 offset_.
7344 (Stringpool_template::new_key_offset): New method.
7345 (Stringpool_template::add_string): Assign offsets when adding new
7346 strings.
7347 (Stringpool_template::set_string_offsets): Do not set string offsets
7348 when not optimizing.
7349 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7350 member size_.
7351 (Chunked_vector::clear): Clear size_.
7352 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7353 (Chunked_vector::size): Return size_.
7354 (Chunked_vector::push_back): Use size_ to find insert position.
7355 (Chunked_vector::size_): New data member.
7356 (Stringpool_template::set_no_zero_null): Assert string set is empty.
7357 (Stringpool_template::new_key_offset): New method declaration.
7358 (Stringpool_template::offset_): New data member.
7359
7360 2010-03-15 Rafael Espindola <espindola@google.com>
7361
7362 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7363 Add_symbols' constructor.
7364 * readsyms.h (Add_symbols): Remove the input_group member.
7365
7366 2010-03-10 Ian Lance Taylor <iant@google.com>
7367
7368 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7369 target to ask whether a reference to a symbol requires a stack
7370 split.
7371 * target.h (Target::is_call_to_non_split): New function.
7372 (Target::do_is_call_to_non_split): Declare virtual function.
7373 * target.cc: Include "symtab.h".
7374 (Target::do_is_call_to_non_split): New function.
7375 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7376
7377 2010-03-10 Cary Coutant <ccoutant@google.com>
7378
7379 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7380 (File_read::open[1]): Remove initial mapping of whole_file_view_.
7381 (File_read::open[2]): Add whole_file_view_ to list of views.
7382 (File_read::make_view): Remove test of whole_file_view_.
7383 (File_read::find_or_make_view): Create whole_file_view_ if
7384 necessary.
7385 (File_read::clear_views): Replace bool parameter with enum;
7386 adjust all callers. Don't delete views with permanent data;
7387 do delete cached views and views from archives if
7388 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
7389 if clearing the corresponding view.
7390 * fileread.h (File_read::Clear_views_mode): New enum.
7391 (File_read::View::is_permanent_view): New method.
7392 (File_read::clear_views): Replace bool parameter
7393 with enum; adjust all callers.
7394 * options.h (General_options): Change keep_files_mapped option;
7395 add map_whole_files.
7396 * readsyms.cc (Add_symbols::run): Delete sd_ object before
7397 releasing the file.
7398 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7399 the file.
7400
7401 2010-03-10 David S. Miller <davem@davemloft.net>
7402
7403 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7404
7405 2010-03-09 Sriraman Tallam <tmsriram@google.com>
7406
7407 * icf.cc (get_section_contents): Add '@' marker after processing the
7408 merge reloc.
7409
7410 2010-03-08 Doug Kwan <dougkwan@google.com>
7411
7412 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7413 due to a conversion warning.
7414 (Arm_relobj::update_output_local_symbol_count): Check for local
7415 symbol with unset output index.
7416
7417 2010-03-05 Ian Lance Taylor <iant@google.com>
7418
7419 * options.h (class General_options): Add --spare-dynamic-tags.
7420 * output.cc (Output_data_dynamic::set_final_data_size): Implement
7421 --spare-dynamic-tags.
7422
7423 2010-03-05 Ian Lance Taylor <iant@google.com>
7424
7425 * incremental.cc: Include "libiberty.h".
7426
7427 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
7428
7429 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7430 function, is_info_ member.
7431 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7432 (Versions::Versions): Update caller.
7433 (Versions::define_base_version): Likewise.
7434 (Versions::add_def): Likewise.
7435
7436 2010-03-03 Sriraman Tallam <tmsriram@google.com>
7437
7438 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7439 (Scan::possible_function_pointer_reloc): New function.
7440 (Scan::local_reloc_may_be_function_pointer): Change to call
7441 possible_function_pointer_reloc.
7442 (Scan::global_reloc_may_be_function_pointer): Ditto.
7443 * icf.h (Icf::check_section_for_function_pointers): Change to reject
7444 relocations in ".data.rel.ro._ZTV" section.
7445 * testsuite/icf_safe_so_test.sh: Change to pass i386.
7446 * testsuite/icf_safe_so_test.cc: Ditto.
7447 * testsuite/icf_safe_test.cc: Ditto.
7448 * testsuite/icf_safe_test.sh: Ditto.
7449
7450 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7451 Ian Lance Taylor <iant@google.com>
7452
7453 * target-reloc.h (relocate_section): Check the symbol table index
7454 for -1U before setting the local symbol index.
7455 (scan_relocatable_relocs): If copying the relocation, record that
7456 the local symbol is required.
7457 * object.h (Symbol_value::is_output_symtab_index_set): New
7458 function.
7459 (Symbol_value::may_be_discarded_from_output_symtab): New
7460 function.
7461 (Symbol_value::has_output_symtab_entry): New function.
7462 (Symbol_value::needs_output_symtab_entry): Remove.
7463 (Symbol_value::output_symtab_index): Make sure the symbol index is
7464 set.
7465 (Symbol_value::set_output_symtab_index): Make sure the symbol
7466 index is not set. Make sure the new index is valid.
7467 (Symbol_value::set_must_have_output_symtab_entry): New function.
7468 (Symbol_value::has_output_dynsym_entry): New function.
7469 (Symbol_value::set_output_dynsym_index): Make sure the new index
7470 is valid.
7471 (Sized_relobj::set_must_have_output_symtab_entry): New function.
7472 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7473 local symbol if permitted.
7474 (Sized_relobj::do_finalize_local_symbols): Call
7475 is_output_symtab_index_set rather than needs_output_symtab_entry.
7476 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7477 rather than needs_output_symtab_entry. Call
7478 has_output_dynsym_entry rather than needs_output_dynsym_entry.
7479 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7480 is_output_symtab_index_set rather than needs_output_symtab_entry.
7481 * testsuite/discard_locals_relocatable_test.c: New file.
7482 * testsuite/discard_locals_test.sh: Test -r.
7483 * testsuite/Makefile.am (check_DATA): Add
7484 discard_locals_relocatable_test1.syms,
7485 discard_local_relocatable_test2.syms.
7486 (MOSTLYCLEANFILES): Likewise. Also add
7487 discard_locals_relocatable_test1.lout and
7488 discard_locals_relocatable_test2.out.
7489 (discard_locals_relocatable_test1.syms): New target.
7490 (discard_locals_relocatable_test.o): New target.
7491 (discard_locals_relocatable_test1.out): New target.
7492 (discard_locals_relocatable_test2.syms): New target.
7493 (discard_locals_relocatable_test2.out): New target.
7494 (various): Add missing ../ld-new dependencies.
7495 * testsuite/Makefile.in: Rebuild.
7496
7497 2010-03-03 Nick Clifton <nickc@redhat.com>
7498
7499 * po/fi.po: New Finnish translation.
7500
7501 2010-03-01 Doug Kwan <dougkwan@google.com>
7502
7503 * layout.cc (Layout::Layout): Force section types of .init_array*,
7504 .preinit_array* and .fini_array* sections.
7505 * output.cc (Output_section::Input_section_sort_entry::has_priority):
7506 Fix check of return value of std::string::find.().
7507 (Output_section::Input_section_sort_compare::operator()): Remove
7508 comment about .init_array.
7509 (Output_section::Input_section_sort_init_fini_compare::operator()):
7510 New method.
7511 (Output_section::sort_attached_input_sections): Handle .init_array
7512 and .fini_array specially.
7513 * output.h (Output_section::Inut_section_sort_compare): Update
7514 comment.
7515 (Output_section::Input_section_sort_init_fini_compare): New struct.
7516
7517 2010-02-26 Doug Kwan <dougkwan@google.com>
7518
7519 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7520 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7521 * testsuite/debug_msg.sh: Avoid matching source line number for
7522 use of global variable undef_int.
7523
7524 2010-02-26 Doug Kwan <dougkwan@google.com>
7525
7526 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7527 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7528 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7529 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7530 * options.cc (General_options::General_options): Initialize member
7531 fix_v4bx_.
7532 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7533 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7534 and rm_no_fix_v4bx.stdout
7535 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7536 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7537 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7538 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7539 and arm_no_fix_v4bx.
7540 * Makefile.in: Regenerate.
7541 * testsuite/arm_fix_v4bx.s: New file.
7542 * testsuite/arm_fix_v4bx.sh: Ditto.
7543
7544 2010-02-24 Doug Kwan <dougkwan@google.com>
7545
7546 * arm.cc (Target_arm::got_section): Make the .got section the first
7547 non RELRO section in the data segment.
7548 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7549 suffixes of section names.
7550
7551 2010-02-24 Doug Kwan <dougkwan@google.com>
7552
7553 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7554 flags and attributes merging if an input file is a binary file.
7555 * fileread.cc (Input_file::open): Record format of original file.
7556 * fileread.h (Input_file::Format): New enum type.
7557 (Input_file::Input_file): Initialize data member format_.
7558 (Input_file::format): New method definition.
7559 (Input_file::format_):: New data member.
7560
7561 2010-02-24 Doug Kwan <dougkwan@google.com>
7562
7563 * arm.cc (Arm_output_data_got): New class.
7564 (ARM_TCB_SIZE): New constant
7565 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7566 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7567 If user uses a script with a SECTIONS clause, issue only a warning
7568 for a misplaced EXIDX input section. Otherwise, issue an error.
7569 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7570 garbage collection.
7571 (Target_arm::got_mode_index_entry): Handle static linking.
7572 (Target_arm::Scan::local): Ditto.
7573 (Target_arm::Scan::global): Ditto.
7574 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
7575 all incorrectly implemented relocations.
7576 (Target_arm::fix_exidx_coverage): Pass layout to
7577 Arm_output_section::fix_exidx_coverage.
7578 * layout.cc (Layout::section_name_mapping): Remove trailing dots
7579 from ".ARM.exidx." and ".ARM.extab.".
7580
7581 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7582
7583 * arm.cc (Target_arm::do_finalize_sections): Create attribute
7584 section if it does not already exist.
7585 * attributes.cc (Attributes_section_data::Attributes_section_data):
7586 Don't crash if size is zero.
7587
7588 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7589 Ian Lance Taylor <iant@google.com>
7590
7591 * gold.cc (queue_middle_tasks): If no input files were opened,
7592 exit.
7593 * workqueue.h (Task_function::Task_function): Assert that there is
7594 a blocker.
7595
7596 2010-02-22 Doug Kwan <dougkwan@google.com>
7597
7598 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7599 * icf.cc (get_section_contents): Cast snprintf arguments to long long
7600 types to avoid warnings due to different uint64_t implementations
7601 on different hosts.
7602
7603 2010-02-21 Doug Kwan <dougkwan@google.com>
7604
7605 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7606 handling of the maximum backward branch offset.
7607 (Arm_relocate_functions::thumb_branch_common): Ditto.
7608 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7609 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7610 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7611 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7612 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7613 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7614 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7615 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7616 thumb_bl_out_of_range thumb_bl_out_of_range.o,
7617 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7618 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7619 thumb2_bl_out_of_range.o): New rules.
7620 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7621 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7622 thumb2_bl_out_of_range
7623 * testsuite/Makefile.in: Regenerate.
7624 * testsuite/arm_bl_in_range.s: New file.
7625 * testsuite/arm_bl_out_of_range.s: Ditto.
7626 * testsuite/arm_branch_in_range.sh: Ditto.
7627 * testsuite/arm_branch_range.t: Ditto.
7628 * testsuite/thumb2_branch_range.t: Ditto.
7629 * testsuite/thumb_bl_in_range.s: Ditto.
7630 * testsuite/thumb_bl_out_of_range.s: Ditto.
7631 * testsuite/thumb_branch_range.t: Ditto.
7632
7633 2010-02-20 Sriraman Tallam <tmsriram@google.com>
7634
7635 * gc.h (gc_process_relocs): Change vectors to point to the new list.
7636 Add reloc offset information.
7637 * icf.cc (get_section_contents): Change iterators to point to the new
7638 vectors. Add reloc offset information to the contents.
7639 * icf.h (Icf::Sections_reachable_info): New typedef.
7640 (Icf::Sections_reachable_list): New typedef.
7641 (Icf::Offset_info): New typedef.
7642 (Icf::Reloc_info): New struct typedef.
7643 (Icf::Reloc_info_list): New typedef.
7644 (Icf::symbol_reloc_list): Delete method.
7645 (Icf::addend_reloc_list): Delete method.
7646 (Icf::section_reloc_list): Delete method.
7647 (Icf::reloc_info_list): New method.
7648 (Icf::reloc_info_list_): New member.
7649
7650 2010-02-19 Doug Kwan <dougkwan@google.com>
7651
7652 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7653 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7654 * arm.cc (Arm_relocation_functions): New forward declaration.
7655 (Target_arm::Target_arm): Initialize new data members
7656 got_mod_index_offset_ and tls_base_symbol_defined_.
7657 (Target_arm::Relocate::relocate_tls): New method.
7658 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7659 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7660 New methods.
7661 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7662 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7663 (Target_arm::got_mod_index_offset_,
7664 Target_arm::tls_base_symbol_defined_): New data members.
7665 (Target_arm::Scan::local, Target::Scan::global,
7666 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7667 relocations.
7668
7669 2010-02-18 Doug Kwan <dougkwan@google.com>
7670
7671 * arm.cc (Arm_relobj::find_linked_text_section): New method.
7672 (Arm_relobj::make_exidx_input_section): Pass section index of linked
7673 text section as a parameter becuase some broken tools may not set
7674 the link in section header.
7675 (Target_arm::has_got_section): New method.
7676 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7677 without any mapping symbol as data only. Remove warning.
7678 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7679 link in its section header, try to discover the link by inspecting the
7680 REL31 relocation at the beginning of the section.
7681 (Target_arm::Scan::check_non_pic): Report name of offending relocation
7682 in error message.
7683 (Target_arm::Scan::global): Treat any reference to the symbol
7684 _GLOBAL_OFFSET_TABLE_ as a GOT access.
7685
7686 2010-02-12 Sriraman Tallam <tmsriram@google.com>
7687
7688 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7689 (Scan::global_reloc_may_be_function_pointer): New function.
7690 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7691 (Scan::global_reloc_may_be_function_pointer): New function.
7692 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7693 (Scan::global_reloc_may_be_function_pointer): New function.
7694 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7695 (Scan::global_reloc_may_be_function_pointer): New function.
7696 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7697 (Scan::global_reloc_may_be_function_pointer): New function.
7698 (Scan::possible_function_pointer_reloc): New function.
7699 (Target_x86_64::can_check_for_function_pointers): New function.
7700 * gc.h (gc_process_relocs): Scan relocation types to determine if
7701 function pointers were taken for targets that support it.
7702 * icf.cc (Icf::find_identical_sections): Include functions for
7703 folding in safe ICF whose pointer is not taken.
7704 * icf.h (Secn_fptr_taken_set): New typedef.
7705 (fptr_section_id_): New member.
7706 (section_has_function_pointers): New function.
7707 (set_section_has_function_pointers): New function.
7708 (check_section_for_function_pointers): New function.
7709 * options.h: Fix comment for safe ICF option.
7710 * target.h (can_check_for_function_pointers): New function.
7711 * testsuite/Makefile.am: Add icf_safe_so_test test case.
7712 Modify icf_safe_test for X86-64.
7713 * testsuite/Makefile.in: Regenerate.
7714 * testsuite/icf_safe_so_test.cc: New file.
7715 * testsuite/icf_safe_so_test.sh: New file.
7716 * testsuite/icf_safe_test.cc (kept_func_3): New function.
7717 (main): Change to take pointer to function kept_func_3.
7718 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7719 folding is done correctly for X86-64.
7720
7721 2010-02-12 David S. Miller <davem@davemloft.net>
7722
7723 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7724 is_symbolless parameter.
7725 (Output_reloc<SHT_REL>::is_symbolless): New.
7726 (Output_reloc<SHT_REL>::is_symbolless_): New.
7727 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7728 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7729 (Output_reloc<SHT_RELA>::is_symbolless): New.
7730 (Output_data_reloc::add_global): Handle is_symbolless.
7731 (Output_data_reloc::add_global_relative): Likewise.
7732 (Output_data_reloc::add_local): Likewise.
7733 (Output_data_reloc::add_local_relative): Likewise.
7734 (Output_data_reloc::add_symbolless_global_addend): New.
7735 (Output_data_reloc::add_symbolless_local_addend): New.
7736 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7737 is_symbolless.
7738 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7739 instead of ->is_relative_
7740 (Output_reloc::write): Likewise.
7741 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7742 (Output_reloc::write_rel): Simplify.
7743
7744 * sparc.cc (Target_sparc::Scan::local): Use
7745 ->add_symbolless_local_addend as needed.
7746 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7747 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
7748 based upon relocation offset.
7749
7750 2010-02-11 Doug Kwan <dougkwan@google.com>
7751
7752 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7753 (Target_arm::Scan::global): Ditto. Also remove a comment before the
7754 beginning of function.
7755 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7756 and MOVT_ABS relocations. Those are non issued in scanning. Fix
7757 parameter is_32bit in calls to should_apply_static_reloc.
7758 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7759 (check_DATA): Add arm_abs_global.stdout.
7760 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7761 arm_abs_global.stdout): New rules.
7762 (MOSTLLYCLEANFILES): Add arm_abs_global
7763 * Makefile.in: Regenerate.
7764 * testsuite/arm_abs_global.s: New file.
7765 * testsuite/arm_abs_global.sh: Ditto.
7766 * testsuite/arm_abs_lib.s: Ditto.
7767
7768 2010-02-11 Ian Lance Taylor <iant@google.com>
7769
7770 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7771 Read_relocs task.
7772 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
7773 Allocate_commons_task first.
7774 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7775 task, rather than symtab_lock_.
7776 (Gc_process_relocs::~Gc_process_relocs): New function.
7777 (Gc_process_relocs::is_runnable): Check this_blocker_.
7778 (Gc_process_relocs::locks): Use next_blocker_ rather than
7779 blocker_.
7780 (Scan_relocs::~Scan_relocs): New function.
7781 (Scan_relocs::is_runnable): Check this_blocker_ rather than
7782 symtab_lock_.
7783 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7784 next_blocker_.
7785 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7786 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7787 constructor accordingly.
7788 (class Gc_process_relocs): Likewise.
7789 (class Scan_relocs): Likewise.
7790 * common.h (class Allocate_commons_task): Remove symtab_lock_
7791 field, and corresponding constructor parameter.
7792 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7793 symtab_lock_.
7794 (Allocate_commons_task::locks): Likewise.
7795
7796 2010-02-11 Ian Lance Taylor <iant@google.com>
7797
7798 * gold-threads.h (class Once): Define.
7799 (class Initialize_lock): Rewrite as child of Once.
7800 * gold-threads.cc (class Once_initialize): Define.
7801 (once_pointer_control): New static variable.
7802 (once_pointer, once_arg): New static variables.
7803 (c_run_once): New static function.
7804 (Once::Once, Once::run_once, Once::internal_run): New functions.
7805 (class Initialize_lock_once): Remove.
7806 (initialize_lock_control): Remove.
7807 (initialize_lock_pointer): Remove.
7808 (initialize_lock_once): Remove.
7809 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7810 (Initialize_lock::initialize): Rewrite.
7811 (Initialize_lock::do_run_once): New function.
7812 * archive.cc (Archive::interpret_header): Only clear name if it is
7813 not already empty.
7814 * fileread.cc: Include "gold-threads.h"
7815 (file_counts_lock): New static variable.
7816 (file_counts_initialize_lock): Likewise.
7817 (File_read::release): Only increment counts when using --stats.
7818 Use a lock around the increment.
7819 * parameters.cc (class Set_parameters_target_once): Define.
7820 (set_parameters_target_once): New static variable.
7821 (Parameters::Parameters): Move here from parameters.h.
7822 (Parameters::set_target): Rewrite.
7823 (Parameters::set_target_once): New function.
7824 (Parameters::clear_target): Move here and rewrite.
7825 * parameters.h (class Parameters): Update declarations. Add
7826 set_parameters_target_once_ field.
7827 (Parameters::Parameters): Move to parameters.cc.
7828 (Parameters::clear_target): Likewise.
7829 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7830 task.
7831 (Start_group::~Start_group): New function.
7832 (Start_group::is_runnable): New function.
7833 (Start_group::locks, Start_group::run): New functions.
7834 (Finish_group::run): Change saw_undefined to size_t.
7835 * readsyms.h (class Start_group): Define.
7836 (class Finish_group): Change saw_undefined_ field to size_t.
7837 (Finish_group::Finish_group): Remove saw_undefined and
7838 this_blocker parameters. Change all callers.
7839 (Finish_group::set_saw_undefined): New function.
7840 (Finish_group::set_blocker): New function.
7841 * symtab.h (class Symbol_table): Change saw_undefined to return
7842 size_t. Change saw_undefined_ field to size_t.
7843 * target-select.cc (Set_target_once::do_run_once): New function.
7844 (Target_selector::Target_selector): Initialize set_target_once_
7845 field. Don't initialize lock_ and initialize_lock_ fields.
7846 (Target_selector::instantiate_target): Rewrite.
7847 (Target_selector::set_target): New function.
7848 * target-select.h (class Set_target_once): Define.
7849 (class Target_selector): Update declarations. Make
7850 Set_target_once a friend. Remove lock_ and initialize_lock_
7851 fields. Add set_target_once_ field.
7852
7853 2010-02-10 Ian Lance Taylor <iant@google.com>
7854
7855 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7856 queueing any tasks.
7857 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7858 (queue_middle_tasks): Add all blockers before queueing any tasks.
7859 (queue_final_tasks): Likewise.
7860 * token.h (Task_token::add_blockers): New function.
7861 * object.h (Input_objects::number_of_relobjs): New function.
7862
7863 2010-02-10 Ian Lance Taylor <iant@google.com>
7864
7865 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7866 shared, not if not position independent.
7867 * x86_64.cc (Relocate::relocate_tls): Likewise.
7868 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7869 (tls_pie_pic_test): New target.
7870 * testsuite/Makefile.in: Rebuild.
7871
7872 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7873 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7874 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7875 * testsuite/Makefile.in: Rebuild.
7876
7877 2010-02-09 David S. Miller <davem@davemloft.net>
7878
7879 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7880 R_SPARC_RELATIVE using ->add_local_relative().
7881 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7882
7883 * output.h (Output_data_dynamic::add_section_size): New method
7884 that takes two Output_data objects.
7885 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7886 entry param. Handle it in initializers.
7887 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7888 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7889 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7890 arg.
7891 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7892 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7893 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7894 for dynrel_includes_plt.
7895 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7896 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7897 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7898 before .rela.plt
7899 (Target_sparc::do_finalize_sections): Update to pass true for
7900 dynrel_includes_plt.
7901 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7902 output before .rela.plt
7903 (Target_powerpc::do_finalize_sections): Update to pass true for
7904 dynrel_includes_plt when 32-bit.
7905
7906 2010-02-08 Doug Kwan <dougkwan@google.com>
7907
7908 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7909 method.
7910 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7911 Arm_relobj::scan_section_for_cortex_a8_stubs,
7912 Arm_relobj::do_relocation_section): Instead of calling
7913 Output_section::output_address, use faster
7914 Arm_relobj::simple_input_section_output_address.
7915
7916 2010-02-08 David S. Miller <davem@davemloft.net>
7917
7918 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7919 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7920 relocation helper function.
7921
7922 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7923 just like R_SPARC_GOT{10,13,22}.
7924 (Target_sparc::Scan::local): Likewise.
7925 (Target_sparc::Relocate:relocate): Likewise.
7926
7927 2010-02-06 Ian Lance Taylor <iant@google.com>
7928
7929 * configure.ac: Rewrite targetobjs duplicate removal code to use
7930 only shell constructs.
7931 * configure: Rebuild.
7932
7933 2010-02-05 Doug Kwan <dougkwan@google.com>
7934
7935 PR 11247
7936 * arm.cc (Arm_relobj::section_is_scannable): New method.
7937 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7938 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7939
7940 2010-02-04 Doug Kwan <dougkwan@google.com>
7941
7942 PR 11247
7943 * arm-reloc-property.cc (cstdio): Include.
7944 * configure.ac (targetobjs): Remove duplicates.
7945 * configure: Regenerate.
7946 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7947 big and little endian version for a given address size.
7948
7949 2010-02-03 Doug Kwan <dougkwan@google.com>
7950
7951 * arm-reloc-property.cc
7952 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7953 definition.
7954 * arm-reloc-property.h
7955 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7956 New method definition.
7957 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7958 declaration.
7959 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7960 overflow to N.
7961 (GOT_PREL): Change implemented to Y.
7962 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7963 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7964 (Arm_relocate_functions::movw_abs_nc): Remove method.
7965 (Arm_relocate_functions::movt_abs): Ditto.
7966 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7967 (Arm_relocate_functions::thm_movt_abs): Ditto.
7968 (Arm_relocate_functions::movw_rel_nc): Ditto.
7969 (Arm_relocate_functions::movw_rel): Ditto.
7970 (Arm_relocate_functions::movt_rel): Ditto.
7971 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7972 (Arm_relocate_functions:thm_movw_rel): Ditto.
7973 (Arm_relocate_functions:thm_movt_rel): Ditto.
7974 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7975 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7976 New method definitions.
7977 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7978 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7979 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7980 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7981 (Target_arm::Relocate::relocate): Check for non-static or
7982 unimplemented relocation code and exit early. Change calls to
7983 Target_arm::reloc_uses_thumb_bit and
7984 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7985 instead. Refactor code to handle similar relocations to increase
7986 code sharing. Remove check for unsupported relocation code in switch
7987 statement.
7988 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7989 relocation property table to find out size. Change error message to
7990 print out the name of a relocation code instead of the numeric value.
7991 (Target_arm::scan_reloc_for_stub): Use relocation property table
7992 instead of calling Target_arm::reloc_uses_thumb_bit().
7993
7994 2010-02-02 Doug Kwan <dougkwan@google.com>
7995
7996 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7997 types of relaxed input section.
7998
7999 2010-02-02 Doug Kwan <dougkwan@google.com>
8000
8001 * Makefile.am (HFILES): Add arm-reloc-property.h.
8002 (DEFFILES): New.
8003 (TARGETSOURCES): Add arm-reloc-property.cc
8004 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8005 (libgold_a_SOURCES): $(DEFFILES)
8006 * Makefile.in: Regenerate.
8007 * arm-reloc-property.cc: New file.
8008 * arm-reloc-property.h: New file.
8009 * arm-reloc.def: New file.
8010 * arm.cc: Update comments.
8011 (arm-reloc-property.h): New included header.
8012 (arm_reloc_property_table): New global variable.
8013 (Target_arm::do_select_as_default_target): New method definition.
8014 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8015 arm-reloc-property to targ_extra_obj.
8016 * parameters.cc (set_parameters_target): Call
8017 Target::select_as_default_target().
8018 * target.h (Target::select_as_default_target): New method definition.
8019 (Target::do_select_as_default_target): Same.
8020
8021 2010-02-01 Doug Kwan <dougkwan@google.com>
8022
8023 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8024 first_output_text_section_.
8025 (Arm_exidx_fixup::first_output_text_section): New method definition.
8026 (Arm_exidx_fixup::first_output_text_section_): New data member.
8027 (Arm_exidx_fixup::process_exidx_section): Record the first text
8028 output section seen.
8029 (Arm_output_section::fix_exidx_coverage): Set correct linked section
8030 and entsize in output section header.
8031
8032 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8033
8034 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8035 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8036 (Arm_relocate_functions::thm_alu11): New Method.
8037 (Arm_relocate_functions::thm_pc8): New Method.
8038 (Arm_relocate_functions::thm_pc12): New Method.
8039 (Target_arm::Scan::local): Handle the relocations.
8040 (Target_arm::Scan::global): Likewise.
8041 (Target_arm::Relocate::relocate): Likewise.
8042 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8043
8044 2010-01-29 Doug Kwan <dougkwan@google.com>
8045
8046 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8047 of relocation types as ld.
8048
8049 2010-01-29 Doug Kwan <dougkwan@google.com>
8050
8051 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8052 to public.
8053 (Arm_relocate_functions::thumb_branch_common): Ditto.
8054 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8055 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8056 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8057 Arm_relocate_functions::jump24): Remove.
8058 (Target_arm::Relocate::relocate): Adjust code to call
8059 Arm_relocation_functions::arm_branch_common and
8060 Arm_relocation_functions::thumb_branch_common instead of their removed
8061 wrappers. Merge switch-cases together to reduce source code size.
8062
8063 2010-01-29 Doug Kwan <dougkwan@google.com>
8064
8065 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8066 output_local_symbol_count_needs_update_.
8067 (Arm_relobj::output_local_symbol_count_needs_update,
8068 Arm_relobj::set_output_local_symbol_count_needs_update,
8069 Arm_relobj::update_output_local_symbol_count): New methods.
8070 (Arm_relobj::output_local_symbol_count_needs_update_): New data
8071 member.
8072 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8073 of pointed function as in a R_ARM_PREL31 relocation.
8074 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8075 for output local symbol count updating.
8076 (Target_arm::do_relax): Update output local symbol counts in objects
8077 if necessary.
8078 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8079
8080 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8081
8082 * arm.cc: Added support for the ARM relocations:
8083 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8084 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8085 (Arm_relocate_functions::movw_rel_nc): Renamed (was
8086 movw_prel_nc).
8087 (Arm_relocate_functions::movw_rel): New method.
8088 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8089 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8090 thm_movw_prel_nc).
8091 (Arm_relocate_functions::thm_movw_rel): New method.
8092 (Arm_relocate_functions::thm_movt_rel): Renamed (was
8093 thm_movt_prel).
8094 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8095 relocations.
8096 (Target_arm::Scan::global): Likewise.
8097 (Target_arm::Relocate::relocate): Likewise.
8098 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8099 Likewise.
8100
8101 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8102
8103 * arm.cc: Added support for ARM group relocations.
8104 (Target_arm::reloc_needs_sym_origin): New method.
8105 (Arm_relocate_functions::calc_grp_kn): New method.
8106 (Arm_relocate_functions::calc_grp_residual): New method.
8107 (Arm_relocate_functions::calc_grp_gn): New method.
8108 (Arm_relocate_functions::arm_grp_alu): New Method.
8109 (Arm_relocate_functions::arm_grp_ldr): New Method.
8110 (Arm_relocate_functions::arm_grp_ldrs): New Method.
8111 (Arm_relocate_functions::arm_grp_ldc): New Method.
8112 (Target_arm::Scan::local): Handle the ARM group relocations.
8113 (Target_arm::Scan::global): Likewise.
8114 (Target_arm::Relocate::relocate): Likewise.
8115 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8116 Likewise.
8117
8118 2010-01-26 Doug Kwan <dougkwan@google.com>
8119
8120 * arm.cc (set): Include.
8121 (class Arm_exidx_fixup): Change type of last_input_section_ to const
8122 pointer type.
8123 (Arm_output_section::Text_section_list): New type.
8124 (Arm_output_section::append_text_sections_to_list): New method.
8125 (Arm_output_section::fix_exidx_coverage): Ditto.
8126 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8127 (Arm_relobj::convert_input_section_to_relaxed_section): Use
8128 Relobj::set_section_offset() instead of
8129 Sized_relobj::invalidate_section_offset().
8130 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8131 parameter for section headers. Ignore relocation sections for
8132 unallocated sections and EXIDX sections.
8133 (Target_arm::fix_exidx_coverage): New method.
8134 (Target_arm::output_section_address_less_than): New type.
8135 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8136 linked text section instead of the EXIDX section.
8137 (Arm_output_section::create_stub_group): Add an assertion to check
8138 that this is not an EXIDX output section.
8139 (Arm_output_section::append_text_sections_to_list): New method.
8140 (Arm_output_section::fix_exidx_coverage): Ditto.
8141 (Arm_relobj::scan_sections_for_stubs): Adjust call to
8142 Arm_relobj::section_needs_reloc_stub_scanning.
8143 (Target_arm::do_relax): Fix EXIDX output section coverage in the
8144 first pass.
8145 (Target_arm::fix_exidx_coverage): New method.
8146 * object.h (Relobj::set_output_section): New method.
8147 (Sized_relobj::invalidate_section_offset): Remove method.
8148 (Sized_relobj::do_invalidate_section_offset): Remove method.
8149 (Sized_relobj::do_set_section_offset): Handle offset value -1.
8150
8151 2010-01-25 Doug Kwan <dougkwan@google.com>
8152
8153 * arm.cc (Arm_exidx_merged_section::do_output_offset):
8154 Fix warning due to signed and unsigned comparison on a 32-bit host.
8155
8156 2010-01-22 Doug Kwan <dougkwan@google.com>
8157
8158 * arm.cc (Target_arm::do_relax): Record an output section for section
8159 offset adjustment it contains any stub table that has changed.
8160 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8161 offsets in an output section if necessary.
8162 * output.cc (Output_section::Output_section): Initialize
8163 section_offsets_need_adjustments_.
8164 (Output_section::add_input_section_for_script): Renamed to
8165 Output_section::add_simple_input_section.
8166 (Output_section::save_states): Add a comment.
8167 (Output_section::discard_states): New method defintion.
8168 (Output_section::adjust_section_offsets): Same.
8169 * output.h (Output_section::add_input_section_for_script): Renamed to
8170 Output_section::add_simple_input_section.
8171 (Output_section::discard_states): New method declaration.
8172 (Output_section::adjust_section_offsets): Same.
8173 (Output_section::section_offsets_need_adjustment,
8174 Output_section::set_section_offsets_need_adjustment): New method
8175 definitions.
8176 (Output_section::section_offsets_need_adjustment_): New data member.
8177 * script-sections.cc
8178 (Output_section_element_input::set_section_address): Adjust code for
8179 renaming of Output_section::add_input_section_for_script.
8180 (Orphan_output_section::set_section_address): Same.
8181
8182 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8183
8184 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8185 Fix_v4bx enum values .
8186 * gold/options.h (General_options): New option definitions.
8187 (General_options::fix_v4bx): New method.
8188 (General_options::Fix_v4bx): New enum.
8189 * gold/options.cc (General_options::parse_fix_v4bx): New method.
8190 (General_options::parse_fix_v4bx_interworking): New method.
8191
8192 2010-01-22 Doug Kwan <dougkwan@google.com>
8193
8194 * arm.cc (Arm_exidx_fixup): New class.
8195
8196 2010-01-21 Doug Kwan <dougkwan@google.com>
8197
8198 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8199 classes.
8200 (Arm_exidx_section_offset_map): New type.
8201
8202 2010-01-21 Doug Kwan <dougkwan@google.com>
8203
8204 * arm.cc (Arm_exidx_input_section): New class.
8205 (Arm_relobj::exidx_input_section_by_link,
8206 Arm_relobj::exidx_input_section_by_shndx,
8207 Arm_relobj::make_exidx_input_section): New methods.
8208 (read_arm_attributes_section): Remove.
8209 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8210 information about them.
8211 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8212 to here.
8213
8214 2010-01-20 Doug Kwan <dougkwan@google.com>
8215
8216 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8217 Input_section_specifier to Section_id.
8218 (Target_arm::new_arm_input_section: Adjust code for change of key
8219 type.
8220 (Target_arm::find_arm_input_section): Ditto.
8221 * gc.h (object.h): Include for Section_id nand Section_id_hash.
8222 (Section_id): Remove.
8223 (Garbage_collection::Section_id_hash): Remove.
8224 * icf.h (object.h): Include for Section_id nand Section_id_hash.
8225 (Section_id): Remove.
8226 (Icf::Section_id_hash): Remove.
8227 * object.h (Section_id, Const_section_id, Section_id_hash,
8228 Const_section_id_hash): New type definitions.
8229 * output.cc (Output_section::add_relaxed_input_section): Change to
8230 use Const_section_id instead of Input_section_specifier as key type.
8231 (Output_section::add_merge_input_section): Ditto.
8232 (Output_section::build_relaxation_map): Change to use Section_id
8233 instead of Input_section_specifier as key type.
8234 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8235 Ditto.
8236 (Output_section::convert_input_sections_to_relaxed_sections): Change
8237 to use Const_section_id instead of Input_section_specifier as key type.
8238 (Output_section::find_merge_section): Ditto.
8239 (Output_section::find_relaxed_input_section): Ditto.
8240 * output.h (Input_section_specifier): Remove class.
8241 (Output_section::Output_section_data_by_input_section_map): Change
8242 key type to Const_section_id.
8243 (Output_section::Output_relaxed_input_section_by_input_section_map):
8244 Ditto.
8245 (Output_section::Relaxation_map): Change key type to Section_id.
8246
8247 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8248
8249 * gold/arm.cc: Added support for R_ARM_V4BX relocation
8250 (class Arm_v4bx_stub): New class.
8251 (DEF_STUBS): Updated definition to support v4_veneer_bx.
8252 (Stub_factory::make_arm_v4bx_stub): New method.
8253 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8254 (Stub_table::empty): Handle v4bx stubs.
8255 (Stub_table::add_arm_v4bx_stub): New method.
8256 (Stub_table::find_arm_v4bx_stub): New method.
8257 (Arm_relocate_functions::v4bx): New method.
8258 (Target_arm::fix_v4bx): New method.
8259 (Target_arm::Target_arm): Handle R_ARM_V4BX.
8260 (Stub_table::relocate_stubs): Likewise.
8261 (Stub_table::do_write): Likewise.
8262 (Stub_table::update_data_size_and_addralign): Likewise.
8263 (Stub_table::finalize_stubs): Likewise.
8264 (Target_arm::Scan::local): Likewise.
8265 (Target_arm::Scan::global): Likewise.
8266 (Target_arm::do_finalize_sections): Likewise.
8267 (Target_arm::Relocate::relocate): Likewise.
8268 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8269 Likewise.
8270 (Target_arm::scan_reloc_for_stub): Likewise.
8271 (Target_arm::scan_reloc_section_for_stubs): Likewise.
8272
8273 2010-01-19 Ian Lance Taylor <iant@google.com>
8274
8275 * output.cc (Output_section_headers::do_sized_write): Write large
8276 segment count to sh_info field.
8277 (Output_file_header::do_sized_write): For large segment count,
8278 write PN_XNUM to e_phnum field.
8279
8280 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8281
8282 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8283 (Arm_relocate_functions::thm_jump8): New function.
8284 (Arm_relocate_functions::thm_jump11): New function.
8285 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8286 R_ARM_THM_JUMP11.
8287 (Target_arm::Scan::global): Likewise.
8288 (Target_arm::Relocate::relocate): Likewise.
8289 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8290 Likewise.
8291
8292 2010-01-14 Doug Kwan <dougkwan@google.com>
8293
8294 * arm.cc (map, utility): Include headers.
8295 (Target_arm::apply_cortex_a8_workaround): New method.
8296 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8297 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8298 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8299 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8300 the --[no-]fix-cortex-a8 command line options.
8301 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8302 (Target_arm::relocate_stub): Use addend in instruction template.
8303 * options.h (DEFINE_bool): Set the user-set flag.
8304 (General_options): Add --[no-]-fix-cortex options.
8305 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8306 : Update fast look-up map after conversion.
8307
8308 2010-01-14 Sriraman Tallam <tmsriram@google.com>
8309
8310 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8311 in the first pass of do_layout.
8312
8313 2010-01-13 Doug Kwan <dougkwan@google.com>
8314
8315 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8316 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8317 apparent compiler problem of not folding static constant integral
8318 data members of elfcpp::Elf_sizes<32>.
8319
8320 2010-01-13 Doug Kwan <dougkwan@google.com>
8321
8322 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8323 Arm_relobj::section_needs_cortex_a8_stub_scanning,
8324 Arm_relobj::scan_section_for_cortex_a8_erratum,
8325 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8326 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8327 sections to scan for relocation stubs into a new method
8328 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
8329 relocation and Cortex-A8 stub scanning.
8330 (Target_arm::do_relax): Force stubs to be after stubbed sections
8331 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
8332 the beginning of a new relaxation pass. Update a comment.
8333 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8334
8335 2010-01-12 Ian Lance Taylor <iant@google.com>
8336
8337 * target-reloc.h (visibility_error): New inline function.
8338 (relocate_section): Call visibility_error.
8339 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8340 (MOSTLYCLEANFILES): Likewise.
8341 (protected_4_pic.o, protected_3.err): New targets.
8342 * testsuite/protected_4.cc: New file.
8343
8344 2010-01-12 Doug Kwan <dougkwan@google.com>
8345
8346 * arm.cc (Cortex_a8_reloc): New class.
8347 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8348 and cortex_a8_relocs_info_.
8349 (Target_arm::fix_cortex_a8): New method definition.
8350 (Target_arm::Cortex_a8_relocs_info): New type.
8351 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8352 New data member declarations.
8353 (Target_arm::scan_reloc_for_stub): Record information about
8354 relocations for THUMB branches that might be exempted from the
8355 Cortex-A8 workaround.
8356 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8357 at the beginning of a relaxation pass.
8358
8359 2010-01-12 Doug Kwan <dougkwan@google.com>
8360
8361 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8362 (Arm_relobj::Mapping_symbol_position,
8363 Arm_reloj::Mapping_symbol_position_less,
8364 Arm_relobj::Mapping_symbols_info): New types.
8365 (Target_arm::is_mapping_symbol_name): New method definition.
8366 (Arm_relobj::do_count_local_symbols): Save information about mapping
8367 symbols.
8368
8369 2010-01-11 Doug Kwan <dougkwan@google.com>
8370
8371 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8372 Arm_relocate_functions::thumb32_branch_upper,
8373 Arm_relocate_functions::thumb32_branch_lower,
8374 Arm_relocate_functions::thumb32_cond_branch_offset,
8375 Arm_relocate_functions::thumb32_cond_branch_upper,
8376 Arm_relocate_functions::thumb32_cond_branch_lower,
8377 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8378 branch offset encoding.
8379 (Arm_relocate_functions::thumb_branch_common): Use new branch
8380 offset encoding methods to avoid code duplication.
8381 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8382 (Stub_addend_reader::operator()): Use new branch encoding method
8383 to avoid code duplication.
8384
8385 2010-01-11 Doug Kwan <dougkwan@google.com>
8386
8387 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8388 (Target_arm::do_finalize_sections): Define special EXIDX section
8389 symbols only if referenced.
8390 * gc.h (Garbage_collection::add_reference): New method.
8391 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8392 code duplication.
8393
8394 2010-01-11 Ian Lance Taylor <iant@google.com>
8395
8396 * script.cc (Version_script_info::build_expression_list_lookup):
8397 Change complaing about duplicate wildcard match from error to
8398 warning.
8399
8400 * script.cc (class Lazy_demangler): Recreate--revert part of patch
8401 of 2009-12-30.
8402 (Version_script_info::Version_script_info): Initialize globs_,
8403 default_version_, default_is_global_, and exact_. Don't
8404 initialize globals_ or locals_.
8405 (Version_script_info::build_lookup_tables): Build local symbols
8406 first.
8407 (Version_script_info::unquote): New function.
8408 (Version_script_info::add_exact_match): New function.
8409 (Version_script_info::build_expression_list_lookup): Remove lookup
8410 parameter. Add is_global parameter. Change all callers. Handle
8411 wildcard pattern specially. Unquote pattern. Call
8412 add_exact_match.
8413 (Version_script_info::get_name_to_match): New function.
8414 (Version_script_info::get_symbol_version): New function.
8415 (Version_script_info::get_symbol_version_helper): Remove.
8416 (Version_script_info::check_unmatched_names): Call unquote.
8417 * script.h (class Version_script_info): Change get_symbol_version
8418 to be non-inline and add is_global parameter; change all callers.
8419 Rewrite symbol_is_local. Update declarations. Define struct
8420 Version_tree_match, Exact, Globs. Don't define struct Lookup.
8421 Remove globals_ and locals_ members. Add exact_, globs_,
8422 default_version_, is_global_.
8423 (Version_script_info::Glob): Remove pattern, add expression and
8424 is_global. Update constructor. Change all callers.
8425 * dynobj.cc (Versions::finalize): Mark the version symbol as the
8426 default version.
8427 (Versions::symbol_section_contents): If a symbol is undefined, or
8428 defined in a dynamic object, set the version index to
8429 VER_NDX_LOCAL.
8430 * symtab.cc (Symbol_table::add_from_relobj): Don't call
8431 symbol_is_local.
8432 (Symbol_table::add_from_pluginobj): Likewise.
8433 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8434
8435 2010-01-11 Doug Kwan <dougkwan@google.com>
8436
8437 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8438 (incremental_dump_LDADD): Add linking option for libintl.
8439 * Makefile.in: Regenerate.
8440
8441 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
8442
8443 PR gold/11144
8444 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8445 instead of -Ds.
8446 * testsuite/Makefile.in: Regenerated.
8447
8448 2010-01-10 Doug Kwan <dougkwan@google.com>
8449
8450 * options.h (DEFINE_var): Use parentheses around argument varname__
8451 in macro body to avoid any unintended subsequent substitutions.
8452
8453 2010-01-10 Ian Lance Taylor <iant@google.com>
8454
8455 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8456 candidates before doing symbol resolution.
8457
8458 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8459 ODR candidates if only one is weak.
8460
8461 2010-01-08 Ian Lance Taylor <iant@google.com>
8462
8463 * script.cc (Version_script_info::build_expression_list_lookup):
8464 Don't warn about ambiguous version, just record the ambiguity.
8465 (Version_script_info::get_symbol_version_helper): Give error if
8466 version is ambiguous.
8467
8468 2010-01-08 Doug Kwan <dougkwan@google.com>
8469
8470 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8471 prev_data_size_ and prev_addralign_. Remove initializer for
8472 deleted data member has_been_changed_.
8473 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8474 to determine if the table is empty.
8475 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8476 Remove.
8477 (Stub_table::add_reloc_stub): Define method in class definition
8478 instead of just declaring it there.
8479 (Stub_table::add_cortex_a8_stub): New method definition.
8480 (Stub_table::update_data_size_and_addralign): Ditto.
8481 (Stub_table::finalize_stubs): Ditto.
8482 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8483 (Stub_table::do_addralign_): Return address alignment in the
8484 (Stub_table::do_reset_address_and_file_offset): Define method in
8485 class definition instead of declaring it there. Set current data
8486 size to be the data size of the previous pass.
8487 (Stub_table::set_final_data_size): Use current data size as the
8488 final data size.
8489 (Stub_table::relocate_stub): Change parameter type of stub from
8490 Reloc_stub pointer to Stub pointer.
8491 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8492 (Stub_table::Cortex_a8_stub_list): New typedef.
8493 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8494 Stub_table::prev_addralign_): New data member.
8495 (Arm_relobj::Arm_relobj): Initialize data member
8496 section_has_cortex_a8_workaround_.
8497 (Arm_relobj::section_has_cortex_a8_workaround,
8498 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8499 definitions.
8500 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8501 declarations.
8502 (Target_arm::relocate_stub): Change parameter type of stub from
8503 Reloc_stub pointer to Stub pointer.
8504 (Insn_template::size, Insn_template::alignment): Handle
8505 THUMB16_SPECIAL_TYPE.
8506 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8507 Stub_table::update_data_size_and_addralign,
8508 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8509 definitions.
8510 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8511 (Stub_table::do_write): Ditto.
8512 (Target_arm::do_relax): Adjust code for changes in Stub_table.
8513
8514 2010-01-08 Ian Lance Taylor <iant@google.com>
8515
8516 PR 11108
8517 * symtab.h (class Symbol): Remove fields is_target_special_ and
8518 has_plt_offset_. Add field is_defined_in_discarded_section_.
8519 (Symbol::is_defined_in_discarded_section): New function.
8520 (Symbol::set_is_defined_in_discarded_section): New function.
8521 (Symbol::has_plt_offset): Rewrite.
8522 (Symbol::set_plt_offset): Verify that new offset is not -1U.
8523 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8524 Don't initialize is_target_special_ or has_plt_offset_.
8525 Initialize is_defined_in_discarded_section_.
8526 (Symbol_table::add_from_relobj): If appropriate, set
8527 is_defined_in_discarded_section.
8528 * resolve.cc (Symbol::override_base_with_special): Don't test
8529 is_target_special_. Change has_plt_offset_ to has_plt_offset().
8530 * target-reloc.h (relocate_section): Do special handling for
8531 symbols defined in discarded sections for global symbols as well
8532 as local symbols.
8533
8534 2010-01-08 Ian Lance Taylor <iant@google.com>
8535
8536 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8537 the SHT_SYMTAB case.
8538
8539 2010-01-08 Ian Lance Taylor <iant@google.com>
8540
8541 * object.cc (Sized_relobj::do_layout): Don't get confused if
8542 layout_eh_frame returns NULL.
8543
8544 2010-01-08 Ian Lance Taylor <iant@google.com>
8545
8546 PR 11084
8547 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8548 dynamic symbol table, use the normal symbol table.
8549 (Sized_dynobj::do_read_symbols): Remove assertion about type of
8550 symbol table.
8551
8552 2010-01-08 Ian Lance Taylor <iant@google.com>
8553
8554 PR 11072
8555 * layout.cc (Layout::include_section): Remove .gnu_debuglink
8556 sections.
8557
8558 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
8559
8560 * version.cc (print_version): Change to "Copyright 2010".
8561
8562 2010-01-08 Ian Lance Taylor <iant@google.com>
8563
8564 PR 10287
8565 PR 11063
8566 * i386.cc (class Target_i386): Change return type of plt_section
8567 to be non-const.
8568 (class Output_data_plt_i386): Add tls_desc_rel_ field.
8569 (Output_data_plt_i386::Output_data_plt_i386): Initialize
8570 tls_desc_rel_ field.
8571 (Output_data_plt_i386::rel_tls_desc): New function.
8572 (Target_i386::rel_tls_desc_section): New function.
8573 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8574 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8575 R_386_TLS_DESC reloc in rel_tls_desc_section.
8576 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8577 Define struct Tlsdesc_info.
8578 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8579 (Target_x86_64::do_reloc_symbol_index): New function.
8580 (Target_x86_64::add_tlsdesc_info): New function.
8581 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8582 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8583 tlsdesc_rel_ field.
8584 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
8585 all callers.
8586 (Output_data_plt_x86_64::rela_tlsdesc): New function.
8587 (Target_x86_64::rela_tlsdesc_section): New function.
8588 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8589 handling.
8590 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8591 (Target_x86_64::do_reloc_addend): New function.
8592 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8593 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8594 declarations. Define TARGET_CODE. Add arg field to u1_ union.
8595 (Output_reloc::type): New function.
8596 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8597 (Output_reloc::is_target_specific): New function.
8598 (Output_reloc::target_arg): New function.
8599 (class Output_reloc) [SHT_RELA]: Add four new constructors for
8600 absolute relocs and target specific relocs.
8601 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8602 add_target_specific.
8603 (class Output_data_reloc) [SHT_RELA]: Likewise.
8604 * output.cc (Output_reloc::Output_reloc): Add four new versions
8605 for absolute relocs and target specific relocs.
8606 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8607 (Output_reloc::get_symbol_index): Likewise.
8608 (Output_reloc::local_section_offset): Check that local_sym_index_
8609 is not TARGET_CODE or 0.
8610 (Output_reloc::symbol_value): Likewise.
8611 (Output_reloc::write) [SHT_RELA]: Call target for target specific
8612 reloc.
8613 * target.h (class Target): Add reloc_symbol_index and reloc_addend
8614 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
8615 functions.
8616 * layout.cc (add_target_dynamic_tags): Use output section for
8617 DT_PLTRELSZ and DT_JMPREL.
8618
8619 2010-01-07 Ian Lance Taylor <iant@google.com>
8620
8621 PR 11061
8622 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8623 function.
8624 (class Output_data_reloc_generic): Define.
8625 (class Output_data_reloc_base): Change base class to
8626 Output_data_reloc_generic. Change add() method to call
8627 bump_relative_reloc_count for a relative reloc. Remove
8628 sort_relocs_ field.
8629 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8630 to sort_relocs().
8631 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8632 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
8633 appropriate.
8634 * layout.h (class Layout): Update declaration.
8635
8636 2010-01-07 Ian Lance Taylor <iant@google.com>
8637
8638 * output.h (class Output_data): Add const version of
8639 output_section and do_output_section.
8640 (class Output_section_data): Add const version of
8641 do_output_section.
8642 (class Output_section): Likewise.
8643 * layout.cc (Layout::add_target_dynamic_tags): New function.
8644 * layout.h (class Layout): Update declarations.
8645 * arm.cc (Target_arm::do_finalize_sections): Use
8646 add_target_dynamic_tags.
8647 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8648 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8649 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8650 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8651
8652 2010-01-07 Ian Lance Taylor <iant@google.com>
8653
8654 PR 11042
8655 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8656 object as needed.
8657
8658 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
8659 Ian Lance Taylor <iant@google.com>
8660
8661 PR 11019
8662 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8663 Xindex::read_symtab_xindex.
8664
8665 2010-01-07 Doug Kwan <dougkwan@google.com>
8666
8667 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8668 (Insn_template::thumb16_bcond_insn): New method declaration.
8669 (Insn_template): Fix spelling.
8670 (Stub::thumb16_special): New method declaration.
8671 (Stub::do_write): Define virtual method which was previously pure
8672 virtual.
8673 (Stub::do_thumb16_special): New method declaration.
8674 (Stub::do_fixed_endian_write): New template member.
8675 (Reloc_stub::do_write): Remove.
8676 (Reloc_stub::do_fixed_endian_write): Remove.
8677 (Cortex_a8_stub): New class definition.
8678 (Stub_factory::make_cortex_a8_stub): New method definition.
8679 (Stub_factory::Stub_factory): Add missing static storage class
8680 qualifier for elf32_arm_stub_a8_veneer_blx.
8681
8682 2010-01-07 Ian Lance Taylor <iant@google.com>
8683
8684 PR 10980
8685 * options.h (class General_options): Add --warn-unresolved-symbols
8686 and --error-unresolved-symbols.
8687 * errors.cc (Errors::undefined_symbol): Implement
8688 --warn-unresolved-symbols.
8689
8690 * options.h (class General_options): Add -z text and -z textoff.
8691 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8692
8693 2010-01-06 Sriraman Tallam <tmsriram@google.com>
8694
8695 * gc.h (Garbage_collection::Cident_section_map): New typedef.
8696 (Garbage_collection::cident_sections): New function.
8697 (Garbage_collection::add_cident_section): New function.
8698 (Garbage_collection::cident_sections_): New member.
8699 (gc_process_relocs): Add references to sections whose names are C
8700 identifiers.
8701 * gold.h (cident_section_start_prefix): New constant.
8702 (cident_section_stop_prefix): New constant.
8703 (is_cident): New function.
8704 * layout.cc (Layout::define_section_symbols): Replace string constants
8705 with the newly defined constants.
8706 * object.cc (Sized_relobj::do_layout): Track sections whose names are
8707 C identifiers.
8708 * testsuite/Makefile.am: Add gc_orphan_section_test.
8709 * testsuite/Makefile.in: Regenerate.
8710 * testsuite/gc_orphan_section_test.cc: New file.
8711 * testsuite/gc_orphan_section_test.sh: New file.
8712
8713 2010-01-06 Ian Lance Taylor <iant@google.com>
8714
8715 PR 10980
8716 * options.h (class General_options): Add --warn-shared-textrel.
8717 * layout.cc (Layout::finish_dynamic_section): Implement
8718 --warn-shared-textrel.
8719
8720 PR 10980
8721 * options.h (class General_options): Add --warn-multiple-gp.
8722
8723 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8724
8725 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8726 $(THREADSLIB) and $(LIBDL).
8727 * Makefile.in: Rebuild.
8728
8729 2010-01-06 Ian Lance Taylor <iant@google.com>
8730
8731 PR 10980
8732 * options.cc (General_options::parse_section_start): New function.
8733 (General_options::section_start): New function.
8734 (General_options::General_options): Initialize all members.
8735 * options.h: Include <map>
8736 (class General_options): Add --section-start. Add section_starts_
8737 member.
8738 * layout.cc (Layout::attach_allocated_section_to_segment): If
8739 --section-start was used, set the address of the segment. Remove
8740 local sort_sections.
8741 (Layout::relaxation_loop_body): If the address of the load segment
8742 has been set by --section-start, don't use it.
8743 * output.h (Output_segment::update_flags_for_output_section): New
8744 function.
8745 * output.cc (Output_segment::add_output_section): Call
8746 update_flags_for_output_section.
8747
8748 2010-01-05 Ian Lance Taylor <iant@google.com>
8749
8750 PR 10980
8751 * options.h (class General_options): Add --undefined-version.
8752 * script.cc (struct Version_expression): Add was_matched_by_symbol
8753 field.
8754 (Version_script_info::matched_symbol): New function.
8755 (Version_script_info::get_symbol_version_helper): Call
8756 matched_symbol.
8757 (Version_script_info::check_unmatched_names): New function.
8758 * script.h (class Version_script_info): Update declarations.
8759 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8760
8761 * options.h (class General_options): Use DEFINE_bool_alias for
8762 allow_multiple_definition.
8763 * resolve.cc (Symbol_table::should_override): Don't test
8764 allow_multiple_definition.
8765
8766 PR 10980
8767 * options.h (class General_options): Add --cref.
8768 * main.cc (main): Print cref table if --cref. Don't close mapfile
8769 until after printing cref table.
8770 * cref.cc: Include "symtab.h".
8771 (class Cref_inputs): Define Cref_table_compare and Cref_table.
8772 (Cref_table_compare::operator()): New function.
8773 (Cref_inputs::gather_cref): New function.
8774 (filecol): New static const.
8775 (Cref_inputs::print_cref): New function.
8776 (Cref::print_cref): New function.
8777 * cref.h: Include <cstdio>.
8778 (class Cref): Update declarations.
8779 * mapfile.h (Mapfile::file): New function.
8780 * object.h (class Object): Define Symbols. Declare virtual
8781 do_get_global_symbols.
8782 (Object::get_global_symbols): New function.
8783 * object.cc (Input_objects::add_object): Pass object to cref_ if
8784 --cref.
8785 (Input_objects::archive_start): Likewise.
8786 (Input_objects::archive_stop): Likewise.
8787 (Input_objects::print_cref): New function.
8788 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8789 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8790 --cref.
8791 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8792 function.
8793 * plugin.h (class Sized_pluginobj): Update declarations.
8794
8795 2010-01-05 Ian Lance Taylor <iant@google.com>
8796
8797 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8798 to is_default_version. Rename insdef to insdefault.
8799 (Symbol_table::add_from_relobj): Rename def to is_default_version
8800 and local to is_forced_local.
8801 (Symbol_table::add_from_pluginobj): Likewise.
8802 (Symbol_table::add_from_dynobj): Likewise.
8803 (Symbol_table::define_special_symbol): Rename insdef to
8804 insdefault.
8805
8806 2010-01-04 Ian Lance Taylor <iant@google.com>
8807
8808 PR 10980
8809 * options.h (class General_options): Add
8810 --allow-multiple-definition and -z muldefs.
8811 * resolve.cc (Symbol_table::should_override): Don't warn about a
8812 multiple symbol definition if --allow-multiple-definition or -z
8813 muldefs.
8814
8815 PR 10980
8816 * options.h (class General_options): Add --add-needed and
8817 --copy-dt-needed-entries. Tweak --as-needed help entry.
8818 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8819 error if --copy-dt-needed-entries aka --add-needed is used and
8820 would cause a change in behaviour.
8821
8822 PR 10980
8823 * options.h (class General_options): Add -G as a short version of
8824 --shared. Add no-op options -assert, -g, and -i.
8825
8826 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8827
8828 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8829 check for .text or .gnu.linkonce.t sections.
8830 * icf.cc (Icf::find_identical_sections): Ditto.
8831 Change the detection for mangled function name within the section
8832 name.
8833 * icf.h (is_section_foldable_candidate): New function.
8834
8835 2009-12-30 Ian Lance Taylor <iant@google.com>
8836
8837 PR 10980
8838 * options.h (class General_options): Permit two dashes with
8839 --retain-symbols-file.
8840
8841 2009-12-30 Ian Lance Taylor <iant@google.com>
8842
8843 PR 10979
8844 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8845 don't put the file header and segment headers in the text
8846 segment.
8847
8848 PR 10979
8849 * common.cc (Sort_commons::operator()): Stabilize sort when both
8850 entries are NULL.
8851 (Symbol_table::do_allocate_commons_list): When allocating common
8852 symbols, skip a symbol which is no longer common.
8853 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8854 an object before checking its type.
8855 * testsuite/common_test_2.c: New file.
8856 * testsuite/common_test_3.c: New file.
8857 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8858 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8859 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8860 (common_test_2_pic.o, common_test_2.so): New targets.
8861 (common_test_3_pic.o, common_test_3.so): New targets.
8862 * testsuite/Makefile.in: Rebuild.
8863
8864 PR 10979
8865 * script.cc (read_input_script): If we see a new SECTIONS clause,
8866 and we have added an input section, give an error.
8867 * layout.h (class Layout): Add have_added_input_section function.
8868 Add have_added_input_section_ field.
8869 * layout.cc (Layout::Layout): Initialize
8870 have_added_input_section_.
8871 (Layout::layout): Set have_added_input_section_.
8872 (Layout::layout_eh_frame): Likewise.
8873
8874 2009-12-30 Ian Lance Taylor <iant@google.com>
8875
8876 PR 10931
8877 * options.h (class General_options): Add --sort-common option.
8878 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8879 * common.cc (Sort_common): Add sort_order parameter to
8880 constructor. Add sort_order_ field.
8881 (Sort_commons::operator): Check sort_order_.
8882 (Symbol_table::allocate_commons): Determine the sort order.
8883 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8884 Change all callers.
8885 (Symbol_table::do_allocate_commons_list): Likewise.
8886
8887 2009-12-30 Ian Lance Taylor <iant@google.com>
8888
8889 PR 10916
8890 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8891 symbols from this object, don't change the visibility of an
8892 undefined symbol.
8893 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8894
8895 2009-12-30 Ian Lance Taylor <iant@google.com>
8896
8897 PR 10861
8898 * script.h (class Version_script_info): Define Language enum.
8899 Update declarations. Define Glob, Exact, and Lookup types. Add
8900 new fields globals_, locals_, and is_finalized_.
8901 * script.cc: Various formatting fixes.
8902 (class Parser_closure): Change language_stack_ from a vector of
8903 std::string to one of Version_script_info::Language. Adjust all
8904 uses accordingly.
8905 (class Lazy_demangler): Remove.
8906 (struct Version_expression): Change language from std::string to
8907 Version_script_info::Language.
8908 (Version_script_info::Version_script_info): New function.
8909 (Version_script_info::~Version_script_info): Don't call clear.
8910 (Version_script_info::finalize): New function.
8911 (Version_script_info::build_lookup_tables): New function.
8912 (Version_script_info::build_expression_list_lookup): New
8913 function.
8914 (Version_script_info::get_symbol_version_helper): Rewrite to use
8915 lookup tables.
8916 (Version_script_info::print_expression_list): Adjust to use
8917 Version_script_info::Language.
8918 (script_push_lex_into_version_mode): Check that the version script
8919 has not been finalized.
8920 (version_script_push_lang): Change language string to
8921 Version_script_info::Language.
8922 * options.cc (Command_line::version_script): New function.
8923 * options.h (class General_options): Add finalize_dynamic_list
8924 function. Change version_script from declaration to definition.
8925 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8926 * testsuite/version_script.map: Remove duplicate def of foo.
8927 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8928 version_script.map.
8929 * testsuite/Makefile.in: Rebuild.
8930
8931 2009-12-30 Ian Lance Taylor <iant@google.com>
8932
8933 PR 10843
8934 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8935 if the input symbol index is 0, make the output symbol index 0.
8936
8937 2009-12-30 Ian Lance Taylor <iant@google.com>
8938
8939 PR 10670
8940 * options.h (class General_options): Add -x/--discard-all.
8941 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8942 --discard-all. If the local symbol needs a dynamic entry, check
8943 that before handling --discard-locals.
8944
8945 2009-12-30 Ian Lance Taylor <iant@google.com>
8946
8947 PR 10450
8948 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8949 flags to PF_R.
8950 (Output_segment::add_output_section): Don't change the flags if
8951 the type is PT_TLS.
8952
8953 PR 10450
8954 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8955 GNU hash table if they need a dynamic value. Otherwise, don't add
8956 them if they are defined in a dynamic object or are forced local.
8957
8958 2009-12-29 Ian Lance Taylor <iant@google.com>
8959
8960 PR 10450
8961 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8962 .gnu.hash table for a 32-bit target.
8963
8964 PR 10450
8965 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8966 regular and a dynamic object only needs a dynamic symbol table
8967 entry if it is externally visible.
8968
8969 PR 10450
8970 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8971 constructor. Add global_offset_table_ field.
8972 (Target_i386::got_section): Set global_offset_table_.
8973 (Target_i386::do_finalize_sections): Set global_offset_table_
8974 size.
8975 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8976 in constructor. Add global_offset_table_ field.
8977 (Target_x86_64::got_section): Set global_offset_table_.
8978 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8979 size.
8980
8981 * layout.cc (Layout::Layout): Initialize increase_relro_.
8982 (Layout::get_output_section): Add is_relro, is_last_relro, and
8983 is_first_non_relro parameters. Change all callers.
8984 (Layout::choose_output_section): Likewise.
8985 (Layout::add_output_section_data): Likewise.
8986 (Layout::make_output_section): Likewise.
8987 (Layout::set_segment_offsets): Clear increase_relro when using a
8988 linker script.
8989 * layout.h (class Layout): Add increase_relro method. Add
8990 increase_relro_ field. Update declarations.
8991 * output.cc (Output_section::Output_section): Initialize
8992 is_last_relro_ and is_first_non_relro_.
8993 (Output_segment::add_output_section): Group relro sections is
8994 do_sort is true. Handle is_last_relro and is_first_non_relro.
8995 (Output_segment::maximum_alignment): Remove relro handling.
8996 (Output_segment::set_section_addresses): Add increase_relro
8997 parameter. Change all callers. Add initial alignment to align
8998 relro sections on separate page. Remove old relro handling.
8999 (Output_segment::set_section_list_addresses): Remove in_relro
9000 parameter. Change all callers.
9001 (Output_segment::set_offset): Add increase parameter. Change all
9002 callers. Remove old relro handling.
9003 * output.h (class Output_section): Add new methods: is_last_relro,
9004 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9005 Add is_last_relro_ and is_first_non_relro_ fields.
9006 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9007 Create separate .got.plt section. Call increase_relro.
9008 * x86_64.cc (Target_x86_64::got_section): Likewise.
9009 * testsuite/relro_script_test.t: Add .got.plt.
9010
9011 PR 10450
9012 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9013 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9014 (Layout::finalize): Call set_dynamic_symbol_size.
9015 (Layout::set_dynamic_symbol_size): New function.
9016 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
9017 set_dynamic_symbol_size.
9018
9019 PR 10450
9020 * output.h (class Output_section): Add is_entsize_zero_ field.
9021 * output.cc (Output_section::Output_section): Initialize
9022 is_entsize_zero_.
9023 (Output_section::set_entsize): If two different entsizes are
9024 requested, force it to zero.
9025 (Output_section::add_input_section): Set flags for .debug_str
9026 before updating section flags. Set entsize.
9027 (Output_section::update_flags_for_input_section): Set SHF_MERGE
9028 and SHF_STRING if all input sections have those flags.
9029
9030 2009-12-29 Rafael Espindola <espindola@google.com>
9031
9032 * main.cc (main): Fix the sys time reporting.
9033 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9034 reporting.
9035
9036 2009-12-29 Sriraman Tallam <tmsriram@google.com>
9037
9038 * options.cc (General_options::parse_version): Allow -v to exit
9039 without an error if there is nothing to link.
9040
9041 2009-12-29 Ian Lance Taylor <iant@google.com>
9042
9043 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9044 using a version of gcc before 4.1.
9045 * configure: Rebuild.
9046
9047 2009-12-28 Chris Demetriou <cgd@google.com>
9048
9049 * attributes.cc (Output_attributes_section_data::do_write): Use
9050 std::vector::front rather than std::vector::data.
9051
9052 2009-12-28 Ian Lance Taylor <iant@google.com>
9053
9054 * symtab.h (class Symbol_table): Add enum Defined.
9055 * resolve.cc (Symbol_table::should_override): Add defined
9056 parameter. Change all callers. Test whether object is NULL
9057 before calling a method on it.
9058 (Symbol_table::report_resolve_problem): Add defined parameter.
9059 Change all callers.
9060 (Symbol_table::should_override_with_special): Likewise.
9061 * symtab.cc (Symbol_table::define_in_output_data): Add defined
9062 parameter. Change all callers.
9063 (Symbol_table::do_define_in_output_data): Likewise.
9064 (Symbol_table::define_in_output_segment): Likewise.
9065 (Symbol_table::do_define_in_output_segment): Likewise.
9066 (Symbol_table::define_as_constant): Likewise.
9067 (Symbol_table::do_define_as_constant): Likewise.
9068 * script.h (class Symbol_assignment): Add is_defsym parameter to
9069 constructor; change all callers.
9070 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9071 parameter. Change all callers. Add is_defsym_ field.
9072 (class Parser_closure): Add parsing_defsym parameter to
9073 constructor; change all callers. Add parsing_defsym accessor
9074 function. Add parsing_defsym_ field.
9075
9076 2009-12-28 Ian Lance Taylor <iant@google.com>
9077
9078 * gold.cc (queue_middle_tasks): Fix formatting.
9079 * object.cc (Relobj::is_section_name_included): Likewise.
9080
9081 2009-12-23 Ian Lance Taylor <iant@google.com>
9082
9083 * i386.cc (Target_i386::do_calls_non_split): Recognize
9084 -fsplit-stack prologue for a function with a static chain.
9085 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9086 -fsplit-stack prologue when using %r11.
9087
9088 2009-12-21 Sriraman Tallam <tmsriram@google.com>
9089
9090 * options.cc (General_options::parse_version): Make -v continue and do
9091 the link like GNU ld does.
9092
9093 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
9094
9095 * Makefile.am (CCFILES): Add timer.cc.
9096 (HFILES): Add timer.h.
9097 * configure.ac: Check for sysconf and times.
9098 * main.cc: include timer.h.
9099 (main): Use Timer instead of get_run_time.
9100 * timer.cc: New.
9101 * timer.h: New.
9102 * workqueue.cc: include timer.h.
9103 (Workqueue::find_and_run_task):
9104 Report user, sys and wall time.
9105 * Makefile.in: Regenerate.
9106 * config.in: Regenerate.
9107 * configure: Regenerate.
9108
9109 2009-12-16 Doug Kwan <dougkwan@google.com>
9110
9111 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9112 sections.
9113 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9114 relaxed input sections.
9115 * output.cc (Output_section::find_relaxed_input_section): Change
9116 return type to Output_relaxed_input_section pointer. Adjust code
9117 for new type of relaxed_input_section_map_.
9118 * output.h (Output_section::find_relaxed_input_section): Change
9119 return type to Output_relaxed_input_section pointer.
9120 (Output_section::Output_relaxed_input_section_by_input_section_map):
9121 New type.
9122 (Output_section::relaxed_input_section_map_): Change type to
9123 Output_section::Output_relaxed_input_section_by_input_section_map.
9124 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9125 input section.
9126
9127 2009-12-15 Ian Lance Taylor <iant@google.com>
9128
9129 * layout.cc (Layout::create_shstrtab): Only write out after input
9130 sections if we are compressing debug sections.
9131
9132 2009-12-15 Ian Lance Taylor <iant@google.com>
9133
9134 * archive.cc (Archive::add_symbols): Only look up a symbol without
9135 a version if there is, in fact, a version.
9136
9137 2009-12-14 Ian Lance Taylor <iant@google.com>
9138
9139 Revert -Wshadow changes, all changes from:
9140 2009-12-11 Doug Kwan <dougkwan@google.com>
9141 2009-12-11 Nick Clifton <nickc@redhat.com>
9142 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9143
9144 2009-12-11 Doug Kwan <dougkwan@google.com>
9145
9146 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9147 due to -Wshadow.
9148 * attributes.cc (Object_attribute::size): Ditto.
9149 (Attributes_section_data::size): Ditto.
9150 (Attributes_section_data::Attributes_section_data): Ditto.
9151 (Output_attributes_section_data::do_write): Ditto.
9152 * attributes.h (Object_attribute::set_type): Ditto.
9153 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9154
9155 2009-12-11 Nick Clifton <nickc@redhat.com>
9156
9157 * archive.cc: Fix shadowed variable warnings.
9158 * arm.cc: Likewise.
9159 * compressed_output.cc: Likewise.
9160 * compressed_output.h: Likewise.
9161 * configure: Likewise.
9162 * dwarf_reader.cc: Likewise.
9163 * dynobj.cc: Likewise.
9164 * dynobj.h: Likewise.
9165 * ehframe.cc: Likewise.
9166 * ehframe.h: Likewise.
9167 * errors.cc: Likewise.
9168 * expression.cc: Likewise.
9169 * fileread.cc: Likewise.
9170 * fileread.h: Likewise.
9171 * freebsd.h: Likewise.
9172 * i386.cc: Likewise.
9173 * icf.cc: Likewise.
9174 * incremental.h: Likewise.
9175 * layout.cc: Likewise.
9176 * layout.h: Likewise.
9177 * mapfile.cc: Likewise.
9178 * merge.cc: Likewise.
9179 * merge.h: Likewise.
9180 * object.cc: Likewise.
9181 * object.h: Likewise.
9182 * options.h: Likewise.
9183 * output.cc: Likewise.
9184 * output.h: Likewise.
9185 * parameters.cc: Likewise.
9186 * plugin.cc: Likewise.
9187 * powerpc.cc: Likewise.
9188 * reduced_debug_output.cc: Likewise.
9189 * reduced_debug_output.h: Likewise.
9190 * reloc.cc: Likewise.
9191 * reloc.h: Likewise.
9192 * resolve.cc: Likewise.
9193 * script-sections.cc: Likewise.
9194 * script.cc: Likewise.
9195 * script.h: Likewise.
9196 * sparc.cc: Likewise.
9197 * symtab.cc: Likewise.
9198 * symtab.h: Likewise.
9199 * target-select.cc: Likewise.
9200 * target-select.h: Likewise.
9201 * token.h: Likewise.
9202 * workqueue.cc: Likewise.
9203 * workqueue.h: Likewise.
9204 * x86_64.cc: Likewise.
9205
9206 2009-12-10 Doug Kwan <dougkwan@google.com>
9207
9208 * arm.cc (attributes.h): New include.
9209 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9210 (Arm_relobj::~Arm_relobj): Delete object pointed by
9211 attributes_section_data_.
9212 (Arm_relobj::attributes_section_data): New method definition.
9213 (Arm_relobj::attributes_section_data_): New data member declaration.
9214 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9215 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9216 attributes_section_data_.
9217 (Arm_dynobj::attributes_section_data): New method definition.
9218 (Arm_dynobj::attributes_section_data_): New data member declaration.
9219 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
9220 initialization value of may_use_blx_ to false.
9221 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9222 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9223 object attributes to compute results instead of hard-coding.
9224 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9225 Target_arm::get_secondary_compatible_arch,
9226 Target_arm::set_secondary_compatible_arch
9227 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9228 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9229 New method declarations.
9230 (Target_arm::get_aeabi_object_attribute): New method definition.
9231 (Target_arm::attributes_section_data_): New data member declaration.
9232 (read_arm_attributes_section): New template definition.
9233 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9234 (Arm_dynobj::do_read_symbols): Ditto.
9235 (Target_arm::do_finalize_sections): Merge attributes sections from
9236 input. Check for BLX use after attributes section merging.
9237 Fix __exidx_start and __exidx_end visibility. Create an
9238 .ARM.attributes section if necessary.
9239 (Target_arm::get_secondary_compatible_arch,
9240 Target_arm::set_secondary_compatible_arch,
9241 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9242 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9243 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9244 New method definitions.
9245
9246 2009-12-09 Ian Lance Taylor <iant@google.com>
9247
9248 * plugin.cc (Plugin::load): Don't cast from void* to a function
9249 pointer.
9250
9251 2009-12-09 Ian Lance Taylor <iant@google.com>
9252
9253 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9254 information fields.
9255
9256 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
9257
9258 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9259 Replace two_file_shared_1.so with two_file_shared_2.so.
9260 * testsuite/Makefile.in: Regenerated.
9261
9262 2009-12-08 Doug Kwan <dougkwan@google.com>
9263
9264 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9265 (HFILES): Add attributes.h and int_encoding.h.
9266 * Makefile.in: Regenerate.
9267 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9268 function definitions to int_encoding.cc
9269 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9270 prototypes to int_encoding.h
9271 * reduced_debug_output.cc (int_encoding.h): New include.
9272 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9273 function definitions to int_encoding.cc
9274 (insert_into_vector, read_from_pointer): Move template definitions to
9275 int_encoding.h
9276 * attributes.cc: New file.
9277 * attributes.h: New file.
9278 * int_encoding.cc: New file.
9279 * int_encoding.h: New file.
9280
9281 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
9282
9283 PR gold/11055
9284 * incremental-dump.cc (dump_incremental_inputs): New.
9285 (main): Use dump_incremental_inputs.
9286
9287 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
9288
9289 PR gold/10893
9290 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9291 checking elfcpp::STT_FUNC.
9292 (Target_i386::Relocate::relocate): Likewise.
9293 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9294
9295 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9296 symbols from shared libraries into normal FUNC symbols.
9297
9298 * symtab.h (Symbol): Add is_func and use it.
9299
9300 2009-12-05 Doug Kwan <dougkwan@google.com>
9301
9302 * arm.cc (Target_arm::arm_info): Initialize new fields
9303 attributes_section and attributes_vendor.
9304 * i386.cc (Target_i386::i386_info): Same.
9305 * object.cc (Sized_relobj::do_layout): Skip attribute section.
9306 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9307 fields attributes_section and attributes_vendor.
9308 * sparc.cc (Target_sparc::sparc_info): Same.
9309 * target.h (Target::attributes_section, Target::attributes_vendor,
9310 Target::is_attributes_section, Target::attribute_arg_type,
9311 Target::attributes_order): New method definitions.
9312 (Target::Target_info::attributes_section,
9313 Target::Target_info::attributes_vendor): New fields.
9314 (Target::do_attribute_arg_type, Target::do_attributes_order): New
9315 virtual method definitions.
9316 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9317 attributes_section and attributes_vendor.
9318 * testsuite/testfile.cc (Target_test::test_target_info): Same.
9319
9320 2009-12-05 Doug Kwan <dougkwan@google.com>
9321
9322 * arm.cc: Update comments about interworking and stub generation.
9323 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9324 considered as non-PIC.
9325 (Arm_relocate_functions::base_abs): Fix formatting.
9326 (Arm_relocate_functions::got_prel): Fix comment. Change interface
9327 of function to use GOT entry address instead of offset.
9328 (Target_arm::Scan::global): Issue an error if a symbol would need a
9329 PLT does not get one because it is untyped. Remove code to create
9330 dynamic symbols for relative branches.
9331 (Target_arm::Relocate::relocate: Use 0 instead of false since function
9332 takes unsigned integer instead of boolean.
9333
9334 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
9335
9336 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9337 (two_file_test_LDADD): Likewise.
9338 (common_test_1_LDADD): Likewise.
9339 (exception_test_LDADD) Likewise.
9340 (weak_test_LDADD): Likewise.
9341 (many_sections_test_LDADD): Likewise.
9342 (initpri1_LDADD): Likewise.
9343 (script_test_1_LDADD): Likewise.
9344 (script_test_2_LDADD): Likewise.
9345 (justsyms_LDADD): Likewise.
9346 (binary_test_LDADD): Likewise.
9347 (large_LDADD): Likewise.
9348 * testsuite/Makefile.in: Regenerated.
9349
9350 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
9351
9352 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9353 (Symbol_table::override_with_special): Likewise.
9354 (Symbol_table::add_from_object): Likewise.
9355
9356 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9357
9358 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9359 Don't set the data_offset twice.
9360
9361 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9362
9363 * testsuite/Makefile.in: Regenerate.
9364
9365 2009-12-03 Doug Kwan <dougkwan@google.com>
9366
9367 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9368 (Target_arm::do_finalize_sections): Add parameter for symbol table
9369 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
9370 * i386.cc (Target_i386::do_finalize_sections): Add an additional
9371 parameter for symbol table pointer.
9372 * layout.cc (Layout::finalize): Call Target::finalize_sections with
9373 an additional parameter for a pointer to symbol table.
9374 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9375 parameter for a symbol table pointer.
9376 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9377 * target.h (Target::finalize_sections, Target::do_finalize_sections):
9378 Ditto.
9379 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9380 parameter for a symbol table pointer.
9381
9382 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
9383
9384 * incremental.cc (Incremental_inputs_header)
9385 (Incremental_inputs_header_write, Incremental_inputs_entry)
9386 (Incremental_inputs_entry_write): Move ...
9387 * incremental.h (Incremental_inputs_header)
9388 (Incremental_inputs_header_write, Incremental_inputs_entry)
9389 (Incremental_inputs_entry_write): here.
9390
9391 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9392
9393 * incremental.cc (make_sized_incremental_binary): Set the target.
9394 Error if it is incompatible.
9395 * output.h (Output_file): Add filename method.
9396
9397 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9398
9399 * incremental.cc (Incremental_inputs_entry): Remove unused argument
9400 from the get_* methods.
9401
9402 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9403
9404 * incremental-dump.cc (main): Check that the offeset of a script is 0.
9405 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9406 Write 0 for the data_offset of scripts.
9407
9408 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9409
9410 * testsuite/Makefile.am: Add the incremental_test.sh test.
9411 * testsuite/incremental_test.sh: New.
9412 * testsuite/incremental_test_1.c: New.
9413 * testsuite/incremental_test_2.c: New.
9414
9415 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
9416
9417 * incremental-dump.cc (main): Fix typos.
9418
9419 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
9420
9421 PR gold/11025
9422 * incremental-dump.cc (main): Use llu to print 64 bit values.
9423
9424 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
9425 H.J. Lu <hongjiu.lu@intel.com>
9426
9427 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9428 $(LIBDL).
9429 (incremental_dump_LDADD): Likewise.
9430 * Makefile.in: Regenerated.
9431
9432 2009-11-25 Doug Kwan <dougkwan@google.com>
9433
9434 Revert:
9435
9436 2009-11-25 Doug Kwan <dougkwan@google.com>
9437
9438 * arm.cc (Target_arm::Target_arm): Move method definition
9439 outside of class definition. Add code to handle
9440 --target1-rel, --target1-abs and --target2= options.
9441 (Target_arm::get_reloc_reloc_type): Change method to be
9442 non-static and const.
9443 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9444 New data member declaration.
9445 (Target_arm::Scan::local, Target_arm::Scan::global,
9446 Target_arm::Relocate::relocate,
9447 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9448 Adjust call to Target_arm::get_real_reloc_type.
9449 (Target_arm::get_real_reloc_type): Use command line options
9450 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9451 * options.h (--target1-rel, --target1-abs, --target2): New
9452 ARM-only options.
9453
9454 2009-11-25 Doug Kwan <dougkwan@google.com>
9455
9456 * arm.cc (Target_arm::Target_arm): Move method definition outside of
9457 class definition. Add code to handle --target1-rel, --target1-abs
9458 and --target2= options.
9459 (Target_arm::get_reloc_reloc_type): Change method to be non-static
9460 and const.
9461 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9462 member declaration.
9463 (Target_arm::Scan::local, Target_arm::Scan::global,
9464 Target_arm::Relocate::relocate,
9465 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9466 call to Target_arm::get_real_reloc_type.
9467 (Target_arm::get_real_reloc_type): Use command line options to
9468 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9469 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9470 options.
9471
9472 2009-11-25 Doug Kwan <dougkwan@google.com>
9473
9474 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9475 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9476 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9477 formatting.
9478 (Arm_relocate_functions::thm_call): Replace body with a call to
9479 Arm_relocate_functions::thumb_branch_common.
9480 (Arm_relocate_functions::thm_jump24,
9481 Arm_relocate_functions::thm_xpc22): New method definitions.
9482 (Arm_relocate_functions::thumb_branch_common): New method definition.
9483 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9484 operator.
9485 (Target_arm::Relocate::relocate): Adjust call to thm_call.
9486 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9487
9488 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9489
9490 * Makefile.am: Build incremental-dump
9491 * Makefile.in: Regenerate.
9492 * incremental-dump.cc: New.
9493 * incremental.cc (Incremental_inputs_header_data,
9494 Incremental_inputs_entry_data): Move to incremental.h
9495 * incremental.h: (Incremental_inputs_header_data,
9496 Incremental_inputs_entry_data): Move from incremental.cc
9497
9498 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9499
9500 * incremental.cc (Incremental_inputs_header,
9501 Incremental_inputs_header_write, Incremental_inputs_entry,
9502 Incremental_inputs_entry_write): Add a typedef with the data type.
9503
9504 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9505
9506 * incremental.cc (Incremental_inputs_header,
9507 Incremental_inputs_header_write, Incremental_inputs_entry,
9508 Incremental_inputs_entry_write): Update comment about which
9509 type has the filed descriptions.
9510
9511 2009-11-15 Doug Kwan <dougkwan@google.com>
9512
9513 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9514 (Arm_relocate_functions::arm_branch_common): Change method defintion
9515 in class definition to a method declaration and update list of formal
9516 parameters.
9517 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9518 Arm_relocation_functions::jump24): Adjust call to
9519 Arm_relocate_functions::arm_branch_common. Update list of formal
9520 parameters.
9521 (Arm_relocate_functions::xpc25): New method definition.
9522 (Arm_relocate_functions::arm_branch_common): Move method defintion
9523 out from class definition. Use stubs for mode-switching and extending
9524 branch ranges.
9525 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9526 specially. Change code to enable use of stubs in ARM branches.
9527
9528 2009-11-10 Doug Kwan <dougkwan@google.com>
9529
9530 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9531 in method declaration.
9532 (Target_arm::relocate_stub): New method declaration.
9533 (Target_arm::default_target): Change to return a pointer instead of
9534 a const reference.
9535 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9536 Target_arm::default_target.
9537 (Arm_Relobj::do_relocate_sections): Remove options paramater in
9538 method definition.
9539 (Target_arm::relocate_section): Adjust view.
9540 (Target_arm::relocate_stub): New method definition.
9541
9542 2009-11-10 Doug Kwan <dougkwan@google.com>
9543
9544 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9545 a format warning.
9546 * incremental.cc (open_incremental_binary): Initialized local
9547 variables to avoid warnings.
9548 * object.cc (make_elf_object): Ditto.
9549 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9550 a format warning.
9551
9552 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
9553
9554 PR gold/10930
9555 * testsuite/plugin_test.c: Include "config.h".
9556
9557 2009-11-09 Doug Kwan <dougkwan@google.com>
9558
9559 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9560 (arm_symbol_value): Remove.
9561 (Arm_relocate_functions::arm_branch_common,
9562 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9563 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9564 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9565 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9566 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9567 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9568 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9569 Arm_relocate_functions::thm_mobw_abs_nc,
9570 Arm_relocate_functions::thm_mov_abs,
9571 Arm_relocate_functions::movw_prel_nc,
9572 Arm_relocate_functions::thm_movt_abs,
9573 Arm_relocate_functions::movt_prel,
9574 Arm_relocate_functions::thm_movw_prel_nc,
9575 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9576 (Target_arm::Relocate::relocate): Only decompose address into two
9577 parts if relocation type uses the thumb-bit and pass the actual
9578 bit instead of a flag indicating that the thumb-bit is used. Adjust
9579 calls to methods in Arm_relocate_functions for this change.
9580
9581 2009-11-08 Ian Lance Taylor <iant@google.com>
9582
9583 PR 10925
9584 * reloc.cc: Instantiate
9585 Sized_relobj::initialize_input_to_output_maps and
9586 Sized_relobj:free_input_to_output_maps.
9587
9588 2009-11-06 Ian Lance Taylor <iant@google.com>
9589
9590 PR 10876
9591 * defstd.cc (in_segment): Set only_if_ref true for "end".
9592
9593 2009-11-06 Doug Kwan <dougkwan@google.com>
9594
9595 * arm.cc (class Reloc_stub): Correct a comment.
9596 (Target_arm::Target_arm): Initialize arm_input_section_map_.
9597 (Target_arm::scan_section_for_stubs): New method declaration.
9598 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9599 Change methods from private to protected.
9600 (Target_arm::do_may_relax): New method definition.
9601 (Target_arm::do_relax, Target_arm::group_sections,
9602 Target_arm::scan_reloc_for_stub,
9603 Target_arm::scan_reloc_section_for_stubs): New method declarations.
9604 (Target_arm::arm_input_section_map_): New data member declaration.
9605 (Target_arm::scan_reloc_for_stub,
9606 Target_arm::scan_reloc_section_for_stubs,
9607 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9608 Target_arm::do_relax): New method definitions.
9609
9610 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
9611
9612 * configure.ac: Check for (struct stat)::st_mtim
9613 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9614 * config.in: Regenerate.
9615 * configure: Regenerate.
9616
9617 2009-11-05 Ian Lance Taylor <iant@google.com>
9618
9619 PR 10910
9620 * output.cc (Output_segment::add_output_section): Add missing
9621 return statement.
9622
9623 2009-11-04 Ian Lance Taylor <iant@google.com>
9624
9625 PR 10880
9626 * object.h (class Object): Add is_needed and set_is_needed
9627 methods. Add is_needed_ field. Make bool fields into bitfields.
9628 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9629 defined in a dynamic object and referenced by a regular object,
9630 set is_needed for the dynamic object.
9631 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9632 if the file is marked with as_needed and it is not needed.
9633
9634 2009-11-04 Ian Lance Taylor <iant@google.com>
9635
9636 PR 10887
9637 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9638 tags if data is discarded by linker script.
9639 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9640 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9641 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9642 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9643
9644 2009-11-04 Ian Lance Taylor <iant@google.com>
9645
9646 * layout.cc (Layout::get_output_section): Add is_interp and
9647 is_dynamic_linker_section parameters. Change all callers.
9648 (Layout::choose_output_section): Likewise.
9649 (Layout::make_output_section): Likewise.
9650 (Layout::add_output_section_data): Add is_dynamic_linker_section
9651 parameter. Change all callers.
9652 * layout.h (class Layout): Update declarations.
9653 * output.h (class Output_section): Add is_interp, set_is_interp,
9654 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9655 Add is_interp_, is_dynamic_linker_section_ fields. Change
9656 generate_code_fills_at_write_ to a bitfield.
9657 * output.cc (Output_section::Output_sections): Initialize new
9658 fields.
9659 (Output_segment::add_output_section): Add do_sort parameter.
9660 Change all callers.
9661
9662 2009-11-03 Ian Lance Taylor <iant@google.com>
9663
9664 PR 10860
9665 * options.h (class General_options): Add --warn-common.
9666 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9667 merging two common symbols.
9668 (Symbol_table::should_override): Handle --warn-common when merging
9669 a common symbol with a defined symbol. Use report_resolve_problem
9670 for multiple definitions.
9671 (Symbol_table::report_resolve_problem): New function.
9672 * symtab.h (class Symbol_table): Declare report_resolve_problem.
9673
9674 2009-11-03 Doug Kwan <dougkwan@google.com>
9675
9676 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9677 stub_factory_.
9678 (Target_arm::stub_factory): New method definition.
9679 (Target_arm::new_arm_input_section,
9680 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9681 Target_arm::reloc_uses_thumb_bit): New method declarations.
9682 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9683 New type definitions.
9684 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9685 member declarations.
9686 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9687 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9688 New method definitions.
9689
9690 2009-11-03 Ian Lance Taylor <iant@google.com>
9691
9692 * options.h (class General_options): Add --warn_constructors.
9693
9694 2009-11-03 Ian Lance Taylor <iant@google.com>
9695
9696 PR 10893
9697 * defstd.cc (in_section): Add entries for __rel_iplt_start,
9698 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9699
9700 2009-11-03 Ian Lance Taylor <iant@google.com>
9701
9702 PR 10895
9703 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9704 --msgid-bugs-address.
9705 (install-pdf): New target.
9706 (install-data_yes): Look up one directory to find mkinstalldirs.
9707
9708 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
9709
9710 * po/Make-in (.po.gmo): Don't generate .gmo files in source
9711 tree.
9712
9713 2009-10-30 Doug Kwan <dougkwan@google.com>
9714
9715 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9716
9717 2009-10-30 Doug Kwan <dougkwan@google.com>
9718
9719 * arm.cc (Stub_addend_reader): New struct template definition
9720 and partial specializations.
9721 (Stub_addend_reader::operator()): New method definition for a
9722 partially specialized template.
9723
9724 2009-10-30 Doug Kwan <dougkwan@google.com>
9725
9726 * arm.cc (Arm_relobj::processor_specific_flags): New method
9727 definition.
9728 (Arm_relobj::do_read_symbols): New method declaration.
9729 (Arm_relobj::processor_specific_flags_): New data member declaration.
9730 (Arm_dynobj): New class definition.
9731 (Target_arm::do_finalize_sections): Add input_objects parameter.
9732 (Target_arm::do_adjust_elf_header): New method declaration.
9733 (Target_arm::are_eabi_versions_compatible,
9734 (Target_arm::merge_processor_specific_flags): New method declaration.
9735 (Target_arm::do_make_elf_object): New overloaded method definitions
9736 and declaration.
9737 (Arm_relobj::do_read_symbols): New method definition.
9738 (Arm_dynobj::do_read_symbols): Ditto.
9739 (Target_arm::do_finalize_sections): Add input_objects parameters.
9740 Merge processor-specific flags from all input objects.
9741 (Target_arm::are_eabi_versions_compatible,
9742 Target_arm::merge_processor_specific_flags,
9743 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9744 New method definitions.
9745 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9746 Input_objects pointer type parameter.
9747 * layout.cc (Layout::finalize): Pass input objects to target's.
9748 finalize_sections function.
9749 * output.cc (Output_file_header::do_sized_write): Set ELF file
9750 header's processor-specific flags.
9751 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9752 Input_objects pointer type parameter.
9753 * sparc.cc (Target_sparc::do_finalize_sections): Same.
9754 * target.h (Input_objects): New forward class declaration.
9755 (Target::processor_specific_flags,
9756 Target::are_processor_specific_flags_sect): New method definitions.
9757 (Target::finalize_sections): Add input_objects parameter.
9758 (Target::Target): Initialize processor_specific_flags_ and
9759 are_processor_specific_flags_set_.
9760 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9761 parameter.
9762 (Target::set_processor_specific_flags): New method definition.
9763 (Target::processor_specific_flags_,
9764 Target::are_processor_specific_flags_set_): New data member
9765 declarations.
9766 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9767 Input_objects pointer type parameter.
9768
9769 2009-10-30 Doug Kwan <dougkwan@google.com>
9770
9771 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9772
9773 2009-10-28 Ian Lance Taylor <iant@google.com>
9774
9775 * object.h (class Relobj): Drop options parameter from
9776 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9777 do_scan_relocs, do_relocate. Change all callers.
9778 (class Sized_relobj): Drop options parameters from
9779 do_gc_process_relocs, do_scan_relocs, do_relocate,
9780 do_relocate_sections, relocate_sections, emit_relocs_scan,
9781 emit_relocs_scan_reltype. Change all callers.
9782 (struct Relocate_info): Remove options field and all references to
9783 it.
9784 * reloc.h (class Read_relocs): Remove options constructor
9785 parameter and options_ field. Change all callers.
9786 (class Gc_process_relocs, class Scan_relocs): Likewise.
9787 (class Relocate_task): Likewise.
9788 * target-reloc.h (scan_relocs): Remove options parameter. Change
9789 all callers.
9790 (scan_relocatable_relocs): Likewise.
9791 * target.h (class Sized_target): Remove options parameter from
9792 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9793 all callers.
9794 * gc.h (gc_process_relocs): Remove options parameter. Change all
9795 callers.
9796 * arm.cc: Update functions to remove options parameters.
9797 * i386.cc: Likewise.
9798 * powerpc.cc: Likewise.
9799 * sparc.cc: Likewise.
9800 * x86_64.cc: Likewise.
9801 * testsuite/testfile.cc: Likewise.
9802
9803 2009-10-28 Doug Kwan <dougkwan@google.com>
9804
9805 * arm.cc (Arm_relobj): New class definition.
9806 (Arm_relobj::scan_sections_for_stubs,
9807 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9808 New method definitions.
9809
9810 2009-10-28 Cary Coutant <ccoutant@google.com>
9811
9812 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9813 (Plugin::cleanup_done_): New member.
9814 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9815 (Plugin_manager::cleanup_done_): Remove.
9816 (Plugin_manager::add_input_file): Edit error message.
9817 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9818 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9819
9820 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9821
9822 * fileread.cc: (File_read::View::~View): Use the new
9823 data_ownership_ filed.
9824 (File_read::~File_read): Dispose the new whole_file_view_.
9825 (File_read::open): Mmap the whole file if needed.
9826 (File_read::open): Use whole_file_view_ instead of contents_.
9827 (File_read::find_view): Use whole_file_view_ if applicable.
9828 (File_read::do_read): Use whole_file_view_ instead of contents_.
9829 (File_read::make_view): Use whole_file_view_ instead of contents_,
9830 update File_read::View::View call.
9831 (File_read::find_or_make_view): Update File_read::View::View
9832 call.
9833 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9834 remove contents_
9835 (File_read::View::Data_ownership): New enum.
9836 (File_read::View::View): Replace bool mapped_ with Data_ownership
9837 argument.
9838 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9839 (File_read::View::data_ownership_): New field.
9840 (File_read::contents_): Remove (replaced by whole_file_view_).
9841 (File_read::whole_file_view_): New field.
9842 * options.h (class General_options): Add --keep-files-mapped.
9843
9844 2009-10-27 Cary Coutant <ccoutant@google.com>
9845
9846 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9847 * testsuite/Makefile.am (plugin_test_5): New test case.
9848 * testsuite/Makefile.in: Regenerate.
9849
9850 2009-10-25 Doug Kwan <dougkwan@google.com>
9851
9852 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9853 from private to protected to allow access by child class.
9854 (Sized_relobj::do_relocate_sections): New method declaration.
9855 (Sized_relobj::relocate_sections): Virtualize.
9856 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9857 Sized_relobj::relocate_sections. Instantiate template explicitly
9858 for different target sizes and endianity.
9859
9860 2009-10-24 Doug Kwan <dougkwan@google.com>
9861
9862 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9863 (Arm_input_section::as_arm_input_section): New method.
9864 (Arm_output_section): New class definition.
9865 (Arm_output_section::create_stub_group,
9866 Arm_output_section::group_sections): New method definitions.
9867
9868 2009-10-22 Doug Kwan <dougkwan@google.com>
9869
9870 * arm.cc (Arm_input_section): New class definition.
9871 (Arm_input_section::init, Arm_input_section:do_write,
9872 Arm_input_section::set_final_data_size,
9873 Arm_input_section::do_reset_address_and_file_offset): New method
9874 definitions.
9875
9876 2009-10-21 Doug Kwan <dougkwan@google.com>
9877
9878 * arm.cc (Stub_table, Arm_input_section): New forward class
9879 declarations.
9880 (Stub_table): New class defintion.
9881 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9882 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9883 New method definition.
9884
9885 2009-10-21 Doug Kwan <dougkwan@google.com>
9886
9887 * arm.cc: Update copyright comments.
9888 (Target_arm): New forward class template declaration.
9889 (Arm_address): New type.
9890 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9891 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9892 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9893 constants.
9894 (Insn_template): Same.
9895 (DEF_STUBS): New macro.
9896 (Stub_type): New enum type.
9897 (Stub_template): New class definition.
9898 (Stub): Same.
9899 (Reloc_stub): Same.
9900 (Stub_factory): Same.
9901 (Target_arm::Target_arm): Initialize may_use_blx_ and
9902 should_force_pic_veneer_.
9903 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9904 Target_arm::should_force_pic_veneer,
9905 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9906 Target_arm::using_thumb_only, Target_arm:;default_target): New
9907 method defintions.
9908 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9909 New data member declarations.
9910 (Insn_template::size, Insn_template::alignment): New method defintions.
9911 (Stub_template::Stub_template): New method definition.
9912 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9913 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9914 (Stub_factory::Stub_factory): New method definition.
9915 * gold.h (string_hash): New template.
9916 * output.h (Input_section_specifier::hash_value): Use
9917 gold::string_hash.
9918 (Input_section_specifier::string_hash): Remove.
9919 * stringpool.cc (Stringpool_template::string_hash): Use
9920 gold::string_hash.
9921
9922 2009-10-20 Doug Kwan <dougkwan@google.com>
9923
9924 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9925 symbols of relaxed input sections.
9926 * output.h (Output_section::find_relaxed_input_section): Make
9927 method public.
9928
9929 2009-10-16 Doug Kwan <dougkwan@google.com>
9930
9931 * dynobj.cc (Versions::Versions): Initialize version_script_.
9932 Only insert base version symbol definition for a shared object
9933 if version script defines any version versions.
9934 (Versions::define_base_version): New method definition.
9935 (Versions::add_def): Check that base version is not needed.
9936 (Versions::add_need): Define base version lazily.
9937 * dynobj.h (Versions::define_base_version): New method declaration.
9938 (Versions::needs_base_version_): New data member declaration.
9939 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9940 (check_DATA): Add no_version_test.stdout.
9941 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9942 New make rules.
9943 * testsuite/Makefile.in: Regenerate.
9944 * testsuite/no_version_test.c: New file.
9945 * testsuite/no_version_test.sh: Ditto.
9946
9947 2009-10-16 Doug Kwan <dougkwan@google.com>
9948
9949 * expression.cc (class Segment_start_expression): New class definition.
9950 (Segment_start_expression::value): New method definition.
9951 (script_exp_function_segment_start): Return a new
9952 Segment_start_expression.
9953 * gold/script-c.h (script_saw_segment_start_expression): New function
9954 prototype.
9955 * script-sections.cc (Script_sections::Script_sections): Initialize
9956 SAW_SEGMENT_START_EXPRESSION_ to false.
9957 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9958 and -Tbbs options to specify section addresses if given in
9959 command line and no SEGMENT_START expression is seen in a script.
9960 * script-sections.h (Script_sections::saw_segment_start_expression,
9961 Script_sections::set_saw_segment_start_expression): New method
9962 definition.
9963 (Script_sections::saw_segment_start_expression_): New data member
9964 declaration.
9965 * script.cc (script_saw_segment_start_expression): New function.
9966 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9967 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9968 script_test_7.sh and script_test_8.sh.
9969 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9970 script_test_8.stdout.
9971 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9972 (script_test_6, script_test_6.stdout, script_test_7,
9973 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9974 * Makefile.in: Regenerate.
9975 * testsuite/script_test_6.sh: New file.
9976 * testsuite/script_test_6.t: Same.
9977 * testsuite/script_test_7.sh: Same.
9978 * testsuite/script_test_7.t: Same.
9979 * testsuite/script_test_8.sh: Same.
9980
9981 2009-10-16 Doug Kwan <dougkwan@google.com>
9982
9983 * output.cc (Output_segment::set_section_list_address): Cast
9984 expressions to unsigned long long type to avoid format warnings.
9985
9986 2009-10-15 Ian Lance Taylor <iant@google.com>
9987
9988 * script.cc (Script_options::add_symbol_assignment): Always add a
9989 dot assignment to script_sections_.
9990 * script-sections.cc (Script_sections::add_dot_assignment):
9991 Initialize if necessary.
9992
9993 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9994 program headers with no load segment if there is a linker script.
9995
9996 * layout.cc (Layout::set_segment_offsets): Align the file offset
9997 to the segment aligment for -N or -n with no load segment.
9998 * output.cc (Output_segment::add_output_section): Don't crash if
9999 the first section is a TLS section.
10000 (Output_segment::set_section_list_addresses): Print an error
10001 message if the address moves backward in a linker script.
10002 * script-sections.cc
10003 (Output_section_element_input::set_section_addresses): Don't
10004 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10005 (Orphan_output_section::set_section_addresses): Likewise.
10006
10007 2009-10-15 Doug Kwan <dougkwan@google.com>
10008
10009 * layout.cc (Layout::finish_dynamic_section): Generate tags
10010 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10011 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10012 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10013
10014 2009-10-14 Ian Lance Taylor <iant@google.com>
10015
10016 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10017 fields.
10018 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10019 data_shdr fields of relinfo.
10020 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10021 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
10022 R_386_TLS_LDO_32, adjust based on section flags.
10023 (Target_i386::Relocate::fix_up_ldo): Remove.
10024
10025 2009-10-13 Ian Lance Taylor <iant@google.com>
10026
10027 Add support for -pie.
10028 * options.h (class General_options): Add -pie and
10029 --pic-executable.
10030 (General_options::output_is_position_independent): Test -pie.
10031 (General_options::output_is_executable): Return true if not shared
10032 and not relocatable.
10033 (General_options::output_is_pie): Remove.
10034 * options.cc (General_options::finalize): Reject incompatible uses
10035 of -pie.
10036 * gold.cc (queue_middle_tasks): A -pie link is not static.
10037 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10038 * symtab.cc (Symbol::final_value_is_known): Return false if
10039 output_is_position_independent.
10040 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10041 output_is_position_independent.
10042 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10043 output_is_position_independent.
10044 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10045 output_is_position_independent.
10046 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10047 two_file_pie_test.
10048 (basic_pie_test.o, basic_pie_test): New targets.
10049 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10050 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10051 (two_file_pie_test): New target.
10052 * testsuite/Makefile.in: Rebuild.
10053 * README: Remove note saying that -pie is not supported.
10054
10055 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
10056
10057 * options.h (class General_options): Add -init and -fini.
10058 * layout.cc (Layout::finish_dynamic_section): Emit
10059 given init and fini functions.
10060
10061 2009-10-13 Sriraman Tallam <tmsriram@google.com>
10062
10063 * gc.h (gc_process_relocs): Check if icf is enabled using new
10064 function.
10065 * gold.cc (queue_initial_tasks): Likewise.
10066 (queue_middle_tasks): Likewise.
10067 * object.cc (do_layout): Likewise.
10068 * symtab.cc (is_section_folded): Likewise.
10069 * main.cc (main): Likewise.
10070 * reloc.cc (Read_relocs::run): Likewise.
10071 (Sized_relobj::do_scan_relocs): Likewise.
10072 * icf.cc (is_function_ctor_or_dtor): New function.
10073 (Icf::find_identical_sections): Check if function is ctor or dtor when
10074 safe icf is chosen.
10075 * options.h (General_options::icf): Change option to be an enum.
10076 (Icf_status): New enum.
10077 (icf_enabled): New method.
10078 (icf_safe_folding): New method.
10079 (set_icf_status): New method.
10080 (icf_status_): New variable.
10081 * (options.cc) (General_options::finalize): Set icf_status_.
10082 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10083 icf_test and icf_keep_unique_test to use the --icf enum flag.
10084 * testsuite/icf_safe_test.sh: New file.
10085 * testsuite/icf_safe_test.cc: New file.
10086
10087 2009-10-12 Sriraman Tallam <tmsriram@google.com>
10088
10089 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10090 includes to gc.h and icf.h.
10091 * arm.cc: Include gc.h.
10092 * gold.cc: Likewise.
10093 * i386.cc: Likewise.
10094 * powerpc.cc: Likewise.
10095 * sparc.cc: Likewise.
10096 * x86_64.cc: Likewise.
10097 * gc.h: Include icf.h.
10098
10099 2009-10-11 Ian Lance Taylor <iant@google.com>
10100
10101 * plugin.cc: Include "gold.h" before other header files.
10102
10103 2009-10-10 Chris Demetriou <cgd@google.com>
10104
10105 * options.h (Input_file_argument::Input_file_type): New enum.
10106 (Input_file_argument::is_lib_): Replace with...
10107 (Input_file_argument::type_): New member.
10108 (Input_file_argument::Input_file_argument): Take Input_file_type
10109 'type' rather than boolean 'is_lib' as second argument.
10110 (Input_file_argument::is_lib): Use type_.
10111 (Input_file_argument::is_searched_file): New function.
10112 (Input_file_argument::may_need_search): Handle is_searched_file.
10113 * options.cc (General_options::parse_library): Support -l:filename.
10114 (General_options::parse_just_symbols): Update for Input_file_argument
10115 changes.
10116 (Command_line::process): Likewise.
10117 * archive.cc (Archive::get_file_and_offset): Likewise.
10118 * plugin.cc (Plugin_manager::release_input_file): Likewise.
10119 * script.cc (read_script_file, script_add_file): Likewise.
10120 * fileread.cc (Input_file::Input_file): Likewise.
10121 (Input_file::will_search_for): Handle is_searched_file.
10122 (Input_file::open): Likewise.
10123 * readsyms.cc (Read_symbols::get_name): Likewise.
10124 * testsuite/Makefile.am (searched_file_test): New test.
10125 * testsuite/Makefile.in: Regenerate.
10126 * testsuite/searched_file_test.cc: New file.
10127 * testsuite/searched_file_test_lib.cc: New file.
10128
10129 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10130 Ian Lance Taylor <iant@google.com>
10131
10132 * descriptor.cc: Include <cstdio> and "binary-io.h".
10133 (Descriptors::open): Open the files in binary mode always.
10134 * script.cc (Lex::get_token): Treat \r as whitespace.
10135
10136 2009-10-09 Ian Lance Taylor <iant@google.com>
10137
10138 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10139
10140 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10141 Ian Lance Taylor <iant@google.com>
10142
10143 * configure.ac: Check for readv function also.
10144 * fileread.cc (readv): Define if not HAVE_READV.
10145 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10146 does not exist.
10147 * config.in: Regenerate.
10148 * configure: Regenerate.
10149
10150 2009-10-09 Doug Kwan <dougkwan@google.com>
10151
10152 * layout.cc (Layout::make_output_section): Call target hook to make
10153 ordinary output section.
10154 (Layout::finalize): Adjust parameter list of call the
10155 Target::may_relax().
10156 * layout.h (class Layout::section_list): New method.
10157 * merge.h (Output_merge_base::entsize): Change visibility to public.
10158 (Output_merge_base::is_string, Output_merge_base::do_is_string):
10159 New methods.
10160 (Output_merge_string::do_is_string): New method.
10161 * object.cc (Sized_relobj::do_setup): renamed from
10162 Sized_relobj::set_up.
10163 * object.h (Sized_relobj::adjust_shndx,
10164 Sized_relobj::initializ_input_to_output_maps,
10165 Sized_relobj::free_input_to_output_maps): Change visibilities to
10166 protected.
10167 (Sized_relobj::setup): Virtualize.
10168 (Sized_relobj::do_setup): New method declaration.
10169 (Sized_relobj::invalidate_section_offset,
10170 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10171 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10172 * options.cc (parse_int): New function.
10173 * options.h (parse_int): New declaration.
10174 (DEFINE_int): New macro.
10175 (stub_group_size): New option.
10176 * output.cc (Output_section::Output_section): Initialize memebers
10177 merge_section_map_, merge_section_by_properties_map_,
10178 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10179 (Output_section::add_input_section): Handled deferred code-fill
10180 generation and remove an old comment.
10181 (Output_section::add_relaxed_input_section): New method definition.
10182 (Output_section::add_merge_input_section): Use merge section by
10183 properties map to speed to search. Update merge section maps
10184 as appropriate.
10185 (Output_section::build_relaxation_map): New method definition.
10186 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10187 Same.
10188 (Output_section::relax_input_section): Renamed to
10189 Output_section::convert_input_sections_to_relaxed_sections and change
10190 interface to take a vector of pointers to relaxed sections.
10191 (Output_section::find_merge_section,
10192 Output_section::find_relaxed_input_section): New method definitions.
10193 (Output_section::is_input_address_mapped,
10194 Output_section::output_offset, Output_section::output_address):
10195 Use output section data maps to speed up searching.
10196 (Output_section::find_starting_output_address): Add comments.
10197 (Output_section::do_write,
10198 Output_section::write_to_postprocessing_buffer): Do code-fill
10199 generation as appropriate.
10200 (Output_section::get_input_sections): Invalidate relaxed input section
10201 map.
10202 (Output_section::restore_states): Adjust type of checkpoint .
10203 Invalidate relaxed input section map.
10204 * output.h (Output_merge_base): New class declaration.
10205 (Input_section_specifier): New class defintion.
10206 (class Output_relaxed_input_section) Change base class to
10207 Output_section_data_build.
10208 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10209 base class initializer.
10210 (Output_section::add_relaxed_input_section): New method declaration.
10211 (Output_section::Input_section): Change visibility to protected.
10212 (Output_section::Input_section::relobj,
10213 Output_section::Input_section::shndx): Handle relaxed input sections.
10214 Output_section::input_sections) Change visibility to protected. Also
10215 define overload to return a non-const pointer.
10216 (Output_section::Merge_section_properties): New class defintion.
10217 (Output_section::Merge_section_by_properties_map,
10218 Output_section::Output_section_data_by_input_section_map,
10219 Output_section::Relaxation_map): New types.
10220 (Output_section::relax_input_section): Rename method to
10221 Output_section::convert_input_sections_to_relaxed_sections and change
10222 interface to take a vector of relaxed section pointers.
10223 (Output_section::find_merge_section,
10224 Output_section::find_relaxed_input_section,
10225 Output_section::build_relaxation_map,
10226 Output_section::convert_input_sections_in_list_to_relaxed_sections):
10227 New method declarations.
10228 (Output_section::merge_section_map_
10229 Output_section::merge_section_by_properties_map_,
10230 Output_section::relaxed_input_section_map_,
10231 Output_section::is_relaxed_input_section_map_valid_,
10232 Output_section::generate_code_fills_at_write_): New data members.
10233 * script-sections.cc
10234 (Output_section_element_input::set_section_addresses): Call
10235 current_data_size and addralign methods of relaxed input sections.
10236 (Orphan_output_section::set_section_addresses): Call current_data_size
10237 and addralign methods of relaxed input sections.
10238 * symtab.cc (Symbol_table::compute_final_value): Extract template
10239 from the body of Symbol_table::sized_finalize_symbol.
10240 (Symbol_table::sized_finalized_symbol): Call
10241 Symbol_table::compute_final_value.
10242 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10243 (Symbol_table::compute_final_value): New templated method declaration.
10244 * target.cc (Target::do_make_output_section): New method defintion.
10245 * target.h (Target::make_output_section): New method declaration.
10246 (Target::relax): Add more parameters for input objects, symbol table
10247 and layout. Adjust call to do_relax.
10248 (Target::do_make_output_section): New method declaration.
10249 (Target::do_relax): Add parameters for input objects, symbol table
10250 and layout.
10251
10252 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10253
10254 * pread.c: Include stdio.h.
10255
10256 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10257
10258 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10259 defined.
10260
10261 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10262
10263 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10264 Change read_shndx type to unsigned int.
10265 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10266 int.
10267 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10268 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10269 Change read_shndx type to unsigned int.
10270 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10271 int.
10272 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10273 * layout.cc (Layout::create_symtab_sections): Cast the result of
10274 local_symcount * symsize to off_t in the gold_assert.
10275
10276 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10277
10278 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10279 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10280 R_ARM_BASE_ABS.
10281 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10282 (Arm_relocate_functions::thm_abs5): New function.
10283 (Arm_relocate_functions::abs12): New function.
10284 (Arm_relocate_functions::abs16): New function.
10285 (Arm_relocate_functions::base_abs): New function.
10286 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10287 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
10288 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10289 R_ARM_BASE_ABS.
10290 (Scan::global): Likewise.
10291 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10292 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10293 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10294 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10295 R_ARM_BASE_ABS.
10296
10297 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10298
10299 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10300 (Arm_relocate_functions::movt_prel): New function.
10301 (Arm_relocate_functions::thm_movw_prel_nc): New function.
10302 (Arm_relocate_functions::thm_movt_prel): New function.
10303 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10304 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10305 (Scan::global, Relocate::relocate): Likewise.
10306 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10307
10308 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10309
10310 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10311 Incremental_checker.
10312 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10313 unsigned int.
10314 (class Incremental_inputs_header): New class.
10315 (Incremental_inputs_header_writer): Edit comment.
10316 (Incremental_inputs_entry): New class.
10317 (Incremental_inputs_entry_writer): Edit comment.
10318 (Sized_incremental_binary::do_find_incremental_inputs_section):
10319 Add *strtab_shndx parameter, fill it.
10320 (Sized_incremental_binary::do_check_inputs): New method.
10321 (Incremental_checker::can_incrementally_link_output_file): Use
10322 Sized_incremental_binary::check_inputs.
10323 (Incremental_inputs::report_command_line): Save command line in
10324 command_line_.
10325 * incremental.h:
10326 (Incremental_binary::find_incremental_inputs_section): New
10327 method.
10328 (Incremental_binary::do_find_incremental_inputs_section): Add
10329 strtab_shndx parameter.
10330 (Incremental_binary::do_check_inputs): New pure virtual method.
10331 (Sized_incremental_binary::do_check_inputs): Declare.
10332 (Incremental_checker::Incremental_checker): Add incremental_inputs
10333 parameter, use it to initialize incremental_inputs_.
10334 (Incremental_checker::incremental_inputs_): New field.
10335 (Incremental_checker::command_line): New method.
10336 (Incremental_checker::inputs): New method.
10337 (Incremental_checker::command_line_): New field.
10338
10339 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10340
10341 * incremental.cc: Include <cstdarg> and "target-select.h".
10342 (vexplain_no_incremental): New function.
10343 (explain_no_incremental): New function.
10344 (Incremental_binary::error): New method.
10345 (Sized_incremental_binary::do_find_incremental_inputs_section): New
10346 method.
10347 (make_sized_incremental_binary): New function.
10348 (open_incremental_binary): New function.
10349 (can_incrementally_link_file): Add checks if output is ELF and has
10350 inputs section.
10351 * incremental.h: Include "elfcpp_file.h" and "output.h".
10352 (Incremental_binary): New class.
10353 (Sized_incremental_binary): New class.
10354 (open_incremental_binary): Declare.
10355 * object.cc (is_elf_object): Use
10356 elfcpp::Elf_recognizer::is_elf_file.
10357 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10358 * output.h (Output_file::filesize): New method.
10359
10360 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10361
10362 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10363 New function.
10364 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10365 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10366 function.
10367 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10368 function.
10369 (Arm_relocate_functions::movw_abs_nc): New function.
10370 (Arm_relocate_functions::movt_abs): New function.
10371 (Arm_relocate_functions::thm_movw_abs_nc): New function.
10372 (Arm_relocate_functions::thm_movt_abs): New function.
10373 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10374 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10375 (Scan::global): Likewise.
10376 (Relocate::relocate): Likewise.
10377 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10378
10379 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10380
10381 * arm.cc (Arm_relocate_functions::got_prel) New function.
10382 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10383 (Relocate::relocate): Likewise.
10384 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10385
10386 2009-10-06 Ian Lance Taylor <iant@google.com>
10387
10388 * options.h (class General_options): Define
10389 split_stack_adjust_size parameter.
10390 * object.h (class Object): Add uses_split_stack_ and
10391 has_no_split_stack_ fields. Add uses_split_stack and
10392 has_no_split_stack accessor functions. Declare
10393 handle_split_stack_section.
10394 (class Reloc_symbol_changes): Define.
10395 (class Sized_relobj): Define Function_offsets. Declare
10396 split_stack_adjust, split_stack_adjust_reltype, and
10397 find_functions.
10398 * object.cc (Object::handle_split_stack_section): New function.
10399 (Sized_relobj::do_layout): Call handle_split_stack_section.
10400 * dynobj.cc (Sized_dynobj::do_layout): Call
10401 handle_split_stack_section.
10402 * reloc.cc (Sized_relobj::relocate_sections): Call
10403 split_stack_adjust for executable sections in split_stack
10404 objects. Pass reloc_map to relocate_section.
10405 (Sized_relobj::split_stack_adjust): New function.
10406 (Sized_relobj::split_stack_adjust_reltype): New function.
10407 (Sized_relobj::find_functions): New function.
10408 * target-reloc.h: Include "object.h".
10409 (relocate_section): Add reloc_symbol_changes parameter. Change
10410 all callers.
10411 * target.h (class Target): Add calls_non_split method. Declare
10412 do_calls_non_split virtual method. Declare match_view and
10413 set_view_to_nop.
10414 * target.cc: Include "elfcpp.h".
10415 (Target::do_calls_non_split): New function.
10416 (Target::match_view): New function.
10417 (Target::set_view_to_nop): New function.
10418 * gold.cc (queue_middle_tasks): Give an error if mixing
10419 split-stack and non-split-stack objects with -r.
10420 * i386.cc (Target_i386::relocate_section): Add
10421 reloc_symbol_changes parameter.
10422 (Target_i386::do_calls_non_split): New function.
10423 * x86_64.cc (Target_x86_64::relocate_section): Add
10424 reloc_symbol_changes parameter.
10425 (Target_x86_64::do_calls_non_split): New function.
10426 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10427 parameter.
10428 * powerpc.cc (Target_powerpc::relocate_section): Add
10429 reloc_symbol_changes parameter.
10430 * sparc.cc (Target_sparc::relocate_section): Add
10431 reloc_symbol_changes parameter.
10432 * configure.ac: Call AM_CONDITIONAL for the default target.
10433 * configure: Rebuild.
10434 * testsuite/Makefile.am (TEST_AS): New variable.
10435 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10436 (check_DATA): Add split_i386 and split_x86_64 files.
10437 (SPLIT_DEFSYMS): Define.
10438 (split_i386_[1234n].o): New targets.
10439 (split_i386_[124]): New targets.
10440 (split_i386_[1234r].stdout): New targets.
10441 (split_x86_64_[1234n].o): New targets.
10442 (split_x86_64_[124]): New targets.
10443 (split_x86_64_[1234r].stdout): New targets.
10444 (MOSTLYCLEANFILES): Add new executables.
10445 * testsuite/split_i386.sh: New file.
10446 * testsuite/split_x86_64.sh: New file.
10447 * testsuite/split_i386_1.s: New file.
10448 * testsuite/split_i386_2.s: New file.
10449 * testsuite/split_i386_3.s: New file.
10450 * testsuite/split_i386_4.s: New file.
10451 * testsuite/split_i386_n.s: New file.
10452 * testsuite/split_x86_64_1.s: New file.
10453 * testsuite/split_x86_64_2.s: New file.
10454 * testsuite/split_x86_64_3.s: New file.
10455 * testsuite/split_x86_64_4.s: New file.
10456 * testsuite/split_x86_64_n.s: New file.
10457 * testsuite/testfile.cc (Target_test): Update relocation_section
10458 function.
10459 * testsuite/Makefile.in: Rebuild.
10460
10461 2009-10-06 Ian Lance Taylor <iant@google.com>
10462
10463 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10464 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10465 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
10466 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10467 the address on ldo_addrs_.
10468 (Target_i386::Relocate::fix_up_ldo): New function.
10469
10470 2009-10-06 Rafael Espindola <espindola@google.com>
10471
10472 * plugin.cc (add_input_library): New.
10473 (Plugin::load): Add add_input_library to tv.
10474 (Plugin_manager::add_input_file): Add the is_lib argument.
10475 (add_input_file): Update call to Plugin_manager::add_input_file.
10476 (add_input_library): New.
10477 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10478
10479 2009-09-30 Doug Kwan <dougkwan@google.com>
10480
10481 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10482 symbol and call Symbol::may_need_copy_reloc to determine if
10483 a copy reloc is needed.
10484 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10485 nocopyreloc is given in command line.
10486 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10487 given in command line.
10488 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10489 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10490 of the removed Target_i386::may_need_copy_reloc.
10491 * options.h (copyreloc): New option with default value false.
10492 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10493 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10494 instead of the removed Target_powerpc::may_need_copy_reloc.
10495 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10496 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10497 instead of the removed Target_sparc::may_need_copy_reloc.
10498 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10499 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10500 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10501 instead of the removed Target_x86_64::may_need_copy_reloc.
10502
10503 2009-09-30 Ian Lance Taylor <iant@google.com>
10504
10505 * object.h (class Object): Remove target_ field, and target,
10506 sized_target, and set_target methods.
10507 (Object::sized_target): Remove.
10508 (class Sized_relobj): Update declarations. Remove sized_target.
10509 * object.cc (Sized_relobj::setup): Remove target parameter.
10510 Change all callers.
10511 (Input_objects::add_object): Don't do anything with the target.
10512 (make_elf_sized_object): Add punconfigured parameter. Change all
10513 callers. Set or test parameter target.
10514 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10515 Change all callers.
10516 * parameters.cc (Parameters::set_target): Change parameter type to
10517 be non-const.
10518 (Parameters::default_target): Remove.
10519 (set_parameters_target): Change parameter type to be non-const.
10520 (parameters_force_valid_target): New function.
10521 (parameters_clear_target): New function.
10522 * parameters.h (class Parameters): Update declarations. Remove
10523 default_target method. Add sized_target and clear_target
10524 methods. Change target_ to be non-const.
10525 (set_parameters_target): Update declaration.
10526 (parameters_force_valid_target): Declare.
10527 (parameters_clear_target): Declare.
10528 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10529 as NULL if we aren't searching.
10530 (Add_symbols::run): Don't check for compatible target.
10531 * fileread.cc (Input_file::open_binary): Call
10532 parameters_force_valid_target.
10533 * gold.cc (queue_middle_tasks): Likewise.
10534 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
10535 set_target on object.
10536 * dynobj.h (class Sized_dynobj): Update declarations.
10537 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10538 make_elf_object returns NULL.
10539 (Archive::include_member): Don't check whether object target is
10540 compatible.
10541 * output.cc (Output_section::add_input_section): Get target from
10542 parameters.
10543 (Output_section::relax_input_section): Likewise.
10544 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10545 parameters.
10546 (Sized_relobj::do_scan_relocs): Likewise.
10547 (Sized_relobj::relocate_sections): Likewise.
10548 * resolve.cc (Symbol_table::resolve): Likewise.
10549 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
10550 parameter. Change all callers.
10551 (Symbol_table::add_from_object): Get target from parameters.
10552 (Symbol_table::add_from_relobj): Don't check object target.
10553 (Symbol_table::add_from_dynobj): Likewise.
10554 (Symbol_table::define_special_symbol): Get target from
10555 parameters.
10556 * symtab.h (class Symbol_table): Update declaration.
10557 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10558 parameter. Change all callers. Clear parameter target.
10559 (Binary_test): Test target here.
10560 * testsuite/object_unittest.cc (gold_testsuite): Remove
10561 target_test_pointer parameter. Change all callers.
10562 (Object_test): Test target here.
10563
10564 2009-09-26 Ian Lance Taylor <iant@google.com>
10565
10566 * testsuite/initpri1.c: Don't try to use constructor priorities if
10567 compiling with gcc before 4.3.
10568
10569 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
10570
10571 * testsuite/retain_symbols_file_test.sh (check_present): Change
10572 output file name to retain_symbols_file_test.stdout.
10573 (check_absent): Likewise.
10574
10575 2009-09-18 Craig Silverstein <csilvers@google.com>
10576
10577 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10578 * options.cc: Include <cerrno> and <fstream>.
10579 (General_options::finalize): Parse -retain-symbols-file tag.
10580 * options.h: New flag.
10581 (General_options): New method should_retain_symbol, new
10582 variable symbols_to_retain.
10583 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10584 should_retain_symbol map.
10585 * testsuite/Makefile.am (retain_symbols_file_test): New test.
10586 * testsuite/Makefile.in: Regenerate.
10587 * testsuite/retain_symbols_file_test.sh: New file.
10588
10589 2009-09-18 Nick Clifton <nickc@redhat.com>
10590
10591 * po/es.po: Updated Spanish translation.
10592
10593 2009-09-17 Doug Kwan <dougkwan@google.com>
10594
10595 * debug.h (DEBUG_RELAXATION): New constant.
10596 (DEBUG_ALL): Add DEBUG_RELAXATION.
10597 (debug_string_to_enum): Add relaxation debug option.
10598 * layout.cc
10599 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10600 Layout::Relaxation_debug_check::read_sections,
10601 Layout::Relaxation_debug_check::read_sections): New method definitions.
10602 (Layout::Layout): Initialize data members
10603 record_output_section_data_from_scrips_,
10604 script_output_section_data_list_ and relaxation_debug_check_.
10605 (Layout::save_segments, Layout::restore_segments,
10606 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10607 Layout::relaxation_loop_body): New method definitions.
10608 (Layout::finalize): Support relaxation. Move section layout code to
10609 Layout::relaxation_loop_body.
10610 (Layout::set_asection_address_from_script): Move code for orphan
10611 section placement out.
10612 (Layout::place_orphan_sections_in_script): New method definition.
10613 * layout.h (Output_segment_headers, Output_file_header):
10614 New forward class declarations.
10615 (Layout::~Layout): Define.
10616 (Layout::new_output_section_data_from_script): New method definition.
10617 (Layout::place_orphan_sections_in_script): New method declaration.
10618 (Layout::Segment_states): New type declaration.
10619 (Layout::save_segments, Layout::restore_segments,
10620 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10621 Layout::relaxation_loop_body): New method declarations.
10622 (Layout::Output_section_data_list): New type declaration.
10623 (Layout::Relaxation_debug_check): New class definition.
10624 (Layout::record_output_section_data_from_script_,
10625 Layout::script_output_section_data_list_, Layout::segment_states_,
10626 Layout::relaxation_debug_check_): New data members.
10627 * output.cc: (Output_section_headers::do_size): New method definition.
10628 (Output_section_headers::Output_section_headers): Move size
10629 computation to Output_section_headers::do_size.
10630 (Output_segment_headers::do_size): New method definition.
10631 (Output_file_header::Output_file_header): Move size computation to
10632 Output_file_header::do_size and call it.
10633 (Output_file_header::do_size): New method definition.
10634 (Output_data_group::Output_data_group): Adjust call to
10635 Output_section_data.
10636 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10637 (Output_symtab_xindex::do_write): Add array bound check.
10638 (Output_section::Input_section::print_to_mapfile): Handle
10639 RELAXED_INPUT_SECTION_CODE.
10640 (Output_section::Output_section): Initialize data member checkpoint_.
10641 (Output_section::~Output_section): Delete checkpoint object pointed
10642 by checkpoint_.
10643 (Output_section::add_input_section): Always add an Input_section if
10644 relaxing.
10645 (Output_section::add_merge_input_section): Add assert.
10646 (Output_section::relax_input_section): New method definition.
10647 (Output_section::set_final_data_size): Set load address to zero for
10648 an unallocated section.
10649 (Output_section::do_address_and_file_offset_have_reset_values):
10650 New method definition.
10651 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10652 Handle relaxed input section.
10653 (Output_section::sort_attached_input_sections): Checkpoint input
10654 section list lazily.
10655 (Output_section::get_input_sections): Change type of input_sections to
10656 list of Simple_input_section pointers. Checkpoint input section list
10657 lazily. Also handle relaxed input sections.
10658 (Output_section::add_input_section_for_script): Take a reference to
10659 a Simple_input_section object instead of Relobj pointer and section
10660 index as parameter. Handle relaxed input sections.
10661 (Output_section::save_states, Output_section::restore_states): New
10662 method definitions.
10663 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10664 (Output_data::is_data_size_fixed): New method definition.
10665 (Output_data::reset_addresss_and_file_offset): Do not reset data size
10666 if it is fixed.
10667 (Output_data::address_and_file_offset_have_reset_values): New method
10668 definition.
10669 (Output_data::do_address_and_file_offset_have_reset_values): New method
10670 definition.
10671 (Output_data::set_data_size): Check that data size is not fixed.
10672 (Output_data::fix_data_size): New method definition.
10673 (Output_data::is_data_size_fixed_): New data member.
10674 (Output_section_headers::set_final_data_size): New method definition.
10675 (Output_section_headers::do_size): New method declaration.
10676 (Output_segment_headers::set_final_data_size): New method definition.
10677 (Output_segment_headers::do_size): New method declaration.
10678 (Output_file_header::set_final_data_size)::New method definition.
10679 (Output_file_header::do_size)::New method declaration.
10680 (Output_section_data::Output_section_data): Add new parameter
10681 is_data_size_fixed and use it to fix data size.
10682 (Output_data_const::Output_data_const): Adjust call to base class
10683 constructor and fix data size.
10684 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10685 base class constructor and fix data size.
10686 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10687 base class constructor and fix data size.
10688 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10689 class constructor and fix data size.
10690 (Output_data_group::set_final_data_size): New method definition.
10691 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10692 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10693 class constructor and fix data size.
10694 (Output_relaxed_input_section): New class definition.
10695 (Output_section::Simple_input_section): New class definition.
10696 (Output_section::get_input_sections): Adjust parameter list.
10697 (Output_section::add_input_section_for_script): Same.
10698 (Output_section::save_states, Output_section::restore_states,
10699 Output_section::do_address_and_file_offset_have_reset_values,
10700 (Output_section::Input_section::Input_section): Handle
10701 RELAXED_INPUT_SECTION_CODE. Add new overload for
10702 Output_relaxed_input_section.
10703 (Output_section::Input_section::is_input_section,
10704 Output_section::Input_section::set_output_section): Handle relaxed
10705 input section.
10706 (Output_section::Input_section::is_relaxed_input_section,
10707 Output_section::Input_section::output_section_data,
10708 Output_section::Input_section::relaxed_input_section): New method
10709 definitions.
10710 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10711 value.
10712 (Output_section::Input_section::u1_): Update comments.
10713 (Output_section::Input_section::u2_): Add new union member poris.
10714 (Output_section::Checkpoint_output_section): New classs definition.
10715 (Output_section::relax_input_section): New method declaration.
10716 (Output_section::checkpoint_): New data member.
10717 (Output_segment): Update comments.
10718 (Output_segment::Output_segment): Un-privatize copy constructor.
10719 (Output_segment::operator=): Un-privatize.
10720 * script-sections.cc (Output_section_element::Input_section_list):
10721 Change element type to Output_section::Simple_input_section.
10722 (Output_section_element_dot_assignment::set_section_addresses):
10723 Register output section data for relaxation clean up.
10724 (Output_data_exression::Output_data_expression): Adjust call to base
10725 constructor to fix data size.
10726 (Output_section_element_data::set_section_addresses): Register
10727 Output_data_expression object for relaxation clean up.
10728 (struct Input_section_info): Replace Relobj pointer and section index
10729 pair with Output_section::Simple_input_section and Convert struct to a
10730 class.
10731 (Input_section_sorter::operator()): Adjust access to
10732 Input_section_info data member to use accessors.
10733 (Output_section_element_input::set_section_addresses): Use layout
10734 parameter. Adjust code to use Output_section::Simple_input_section
10735 and Input_secction_info classes. Register filler for relaxation
10736 clean up.
10737 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10738 and section index pair with Output_section::Simple_input_section
10739 class. Adjust code accordingly.
10740 (Phdrs_element::release_segment): New method definition.
10741 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10742 segment list.
10743 (Script_sections::release_segments): New method definition.
10744 * gold/script-sections.h (Script_sections::release_segments): New
10745 method declaration.
10746 * gold/target.h (Target::may_relax, Target::relax,
10747 Target::do_may_relax, Target::do_relax): New method definitions.
10748
10749 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10750
10751 * arm.cc (has_signed_unsigned_overflow): New function.
10752 (Arm_relocate_functions::abs8): New function.
10753 (Target_arm::Scan::local): Handle R_ARM_ABS8.
10754 (Target_arm::Scan::global): Likewise.
10755 (Target_arm::relocate::relocate): Likewise.
10756 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10757 Likewise.
10758
10759 2009-09-16 Cary Coutant <ccoutant@google.com>
10760
10761 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10762 * testsuite/Makefile.in: Regenerate.
10763
10764 2009-09-11 Nick Clifton <nickc@redhat.com>
10765
10766 * po/gold.pot: Updated by the Translation project.
10767
10768 2009-09-08 Cary Coutant <ccoutant@google.com>
10769
10770 * output.cc (Output_file::open): Add execute permission to empty file.
10771 * testsuite/Makefile.am (permission_test): New test.
10772 * testsuite/Makefile.in: Regenerate.
10773
10774 2009-09-02 Ian Lance Taylor <iant@google.com>
10775
10776 * output.cc (Output_file::resize): Call map_no_anonymous rather
10777 than map.
10778
10779 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
10780
10781 * gold.cc: Include "incremental.h".
10782 (queue_initial_tasks): Call Incremental_checker methods.
10783 * incremental.cc: Include "output.h".
10784 (Incremental_checker::can_incrementally_link_output_file): New
10785 method.
10786 * incremental.h (Incremental_checker): New class.
10787
10788 * output.cc (Output_file::open_for_modification): New method.
10789 (Output_file::map_anonymous): Changed return type to bool. Record
10790 map in base_ field.
10791 (Output_file::map_no_anonymous): New method, broken out of map.
10792 (Output_file::map): Use map_no_anonymous and map_anonymous.
10793 * output.h (class Output_file): Update declarations.
10794
10795 2009-08-24 Cary Coutant <ccoutant@google.com>
10796
10797 * options.h (Command_line::Pre_options): New class.
10798 (Command_line::pre_options): New member.
10799 * options.cc (gold::options::ready_to_register): New variable.
10800 (One_option::register_option): Do nothing if not registering options.
10801 Assert if same short option registered twice.
10802 (General_options::General_options): Turn off option registration when
10803 done constructing.
10804 (Command_line::Pre_options::Pre_options): New constructor.
10805
10806 2009-08-24 Cary Coutant <ccoutant@google.com>
10807
10808 * options.h (General_options::no_keep_memory): Remove incorrect
10809 short option.
10810
10811 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10812
10813 * Makefile.am (am__skiplex, am__skipyacc): New.
10814 * Makefile.in: Regenerate.
10815
10816 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10817
10818 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10819 (INCLUDES): ... this.
10820 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10821 (AM_CPPFLAGS): Renamed from ...
10822 (INCLUDE): ... this.
10823 * Makefile.in, testsuite/Makefile.in: Regenerate.
10824
10825 * Makefile.in: Regenerate.
10826 * aclocal.m4: Likewise.
10827 * config.in: Likewise.
10828 * configure: Likewise.
10829 * testsuite/Makefile.in: Likewise.
10830
10831 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10832 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10833 * Makefile.in: Regenerate.
10834 * testsuite/Makefile.in: Regenerate.
10835
10836 2009-08-19 Cary Coutant <ccoutant@google.com>
10837
10838 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10839 symbols in shared libraries overridden by hidden or internal symbols
10840 in the main program.
10841
10842 2009-08-19 Chris Demetriou <cgd@google.com>
10843
10844 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10845 checking source file names in error messages.
10846
10847 2009-08-18 Doug Kwan <dougkwan@google.com>
10848
10849 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10850 an elcpp::Ehdr as parameter. Adjust call to set_target.
10851 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10852 an elfcpp::Ehdr as parameter.
10853 * object.cc (Object::set_target): Remove the version that looks up
10854 a target and sets it.
10855 (Sized_relobj::setup): Take a Target object instead of
10856 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10857 (make_elf_sized_object): Find target and ask target to
10858 make an ELF object.
10859 * object.h: (Object::set_target): Remove the version that looks up
10860 a target and sets it.
10861 (Sized_relobj::setup): Take a Target object instead of
10862 an elfcpp:Ehdr as parameter.
10863 * target.cc: Include dynobj.h.
10864 (Target::do_make_elf_object_implementation): New.
10865 (Target::do_make_elf_object): New.
10866 * target.h (Target::make_elf_object): New template declaration.
10867 (Target::do_make_elf_object): New method declarations.
10868 (Target::do_make_elf_object_implementation): New template declaration.
10869
10870 2009-08-14 Ian Lance Taylor <iant@google.com>
10871
10872 * gold.h (FUNCTION_NAME): Define.
10873 (gold_unreachable): Use FUNCTION_NAME.
10874
10875 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10876
10877 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10878 symbol in the --keep-unique list is not found.
10879
10880 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10881
10882 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10883 been maked as --keep-unique.
10884 (Icf::unfold_section): New function.
10885 * icf.h (Icf::unfold_section): New function.
10886 * options.h (General_options::keep_unique): New option.
10887 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10888 * testsuite/Makefile.in: Regenerate.
10889 * testsuite/icf_keep_unique_test.sh: New file.
10890 * testsuite/icf_keep_unique_test.cc: New file.
10891
10892 2009-08-12 Cary Coutant <ccoutant@google.com>
10893
10894 PR 10471
10895 * resolve.cc (Symbol_table::resolve): Check for references from
10896 dynamic objects to hidden and internal symbols.
10897 * testsuite/Makefile.am (hidden_test.sh): New test.
10898 * testsuite/Makefile.in: Regenerate.
10899 * testsuite/hidden_test.sh: New script.
10900 * testsuite/hidden_test_1.c: New test source.
10901 * testsuite/hidden_test_main.c: New test source.
10902
10903 2009-08-11 Doug Kwan <dougkwan@google.com>
10904
10905 * arm.cc: Update comments.
10906 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10907 segment to locate the .ARM.exidx section if present.
10908
10909 2009-08-09 Doug Kwan <dougkwan@google.com>
10910
10911 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10912 patch.
10913
10914 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10915 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10916 compiler warnings.
10917
10918 2009-08-06 Sriraman Tallam <tmsriram@google.com>
10919
10920 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10921 valid tls_segment only for non-debug-section relocations.
10922 * testsuite/Makefile.am: Add gc_tls_test.
10923 * testsuite/Makefile.in: Regenerate.
10924 * testsuite/gc_tls_test.cc: New file.
10925 * testsuite/gc_tls_test.sh: New file.
10926
10927 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10928
10929 * icf.cc: New file.
10930 * icf.h: New file.
10931 * Makefile.am (CCFILES): Add icf.cc.
10932 (HFILES): Add icf.h
10933 * Makefile.in: Regenerate.
10934 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10935 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10936 section, symbol and addend information for the relocs.
10937 * gold.cc (queue_middle_tasks): Call identical code folding.
10938 * gold.h: Add defines for multimap.
10939 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10940 to the call of finalize_local_symbols.
10941 * main.cc (main): Create object of class Icf.
10942 * object.cc (Sized_relobj::do_layout): Allow this function to be
10943 called twice during icf.
10944 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10945 to sections marked as identical by icf.
10946 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10947 when available.
10948 (Sized_relobj::do_section_entsize): New function.
10949 * object.h (Object::section_entsize): New function.
10950 (Object::do_section_entsize): New pure virtual function.
10951 (Relobj::finalize_local_symbols): Add new parameter.
10952 (Relobj::do_section_entsize): New function.
10953 * options.h (General_options::icf): New option.
10954 (General_options::icf_iterations): New option.
10955 (General_options::print_icf_sections): New option.
10956 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10957 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10958 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10959 icf.
10960 * symtab.cc (Symbol_table::is_section_folded): New function.
10961 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10962 to sections marked as identical by icf.
10963 * symtab.h (Symbol_table::set_icf): New function.
10964 (Symbol_table::icf): New function.
10965 (Symbol_table::is_section_folded): New function.
10966 (Symbol_table::icf_): New data member.
10967 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10968 * testsuite/Makefile.am: Add commands to build icf_test.
10969 * testsuite/Makefile.in: Regenerate.
10970 * testsuite/icf_test.sh: New file.
10971 * testsuite/icf_test.cc: New file.
10972
10973 2009-07-24 Chris Demetriou <cgd@google.com>
10974
10975 * layout.cc (is_compressible_debug_section): Fix incorrect
10976 comment about compressed section names.
10977
10978 2009-07-20 Ian Lance Taylor <ian@airs.com>
10979
10980 PR 10419
10981 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10982
10983 2009-07-16 Ian Lance Taylor <iant@google.com>
10984
10985 PR 10400
10986 * layout.h: #include <map>.
10987 (class Kept_section): Change from struct to class. Add accessors
10988 and setters. Add section size to Comdat_group mapping. Change
10989 Comdat_group to std::map. Add is_comdat_ field. Add
10990 linkonce_size field in union.
10991 (class Layout): Update declaration of find_or_add_kept_section.
10992 Don't declare find_kept_object.
10993 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10994 parameter. Add object, shndx, is_comdat, and is_group_name
10995 parameters. Change all callers. Adjust for new Kept_section.
10996 (Layout::find_kept_object): Remove.
10997 * object.cc (Sized_relobj::include_section_group): Update use of
10998 Kept_section. Rename secnum to shndx. Only record
10999 Kept_comdat_section if sections are the same size.
11000 (Sized_relobj::include_linkonce_section): Update use of
11001 Kept_section. Only record Kept_comdat_section if sections are the
11002 same size. Set size of linkonce section.
11003 (Sized_relobj::map_to_kept_section): Update call to
11004 get_kept_comdat_section.
11005 * object.h (class Sized_relobj): Rename fields in
11006 Kept_comdat_section to drop trailing underscores; change object
11007 field to Relobj*. Change Kept_comdat_section_table to store
11008 struct rather than pointer.
11009 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11010 Add kept_object and kept_shndx parameters. Change all callers.
11011 (Sized_relobj::get_kept_comdat_section): Change return type to
11012 bool. Add kept_object and kept_shndx parameters. Change all
11013 callers.
11014 * plugin.cc (Pluginobj::include_comdat_group): Update call to
11015 Layout::find_or_add_kept_section.
11016
11017 2009-07-09 Ian Lance Taylor <iant@google.com>
11018
11019 * merge.cc (Object_merge_map::initialize_input_to_output_map):
11020 Reserve space in the hash table.
11021
11022 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
11023
11024 * fileread.cc (File_read::get_mtime): New method.
11025 * fileread.h (Timespec): New structure.
11026 (File_read::get_mtime): New method.
11027 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11028 Renamed from timestamp_nsec.
11029 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11030 Elf_Xword.
11031 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11032 timestamp_nsec.
11033 (Incremental_inputs::report_archive): Save mtime; style fix.
11034 (Incremental_inputs::report_obejct): Save mtime; style fix.
11035 (Incremental_inputs::report_script): Save mtime; style fix.
11036 (Incremental_inputs::finalize_inputs): Style fix.
11037 (Incremental_inputs::finalize): Style fix.
11038 (Incremental_inputs::create_input_section_data): Store inputs
11039 mtime.
11040 * incremental.h (Incremental_inputs::report_script): Add mtime
11041 argument.
11042 (Incremental_inputs::Input_info::Input_info): Intialize only one
11043 union member.
11044 (Incremental_inputs::Input_info::archive): Move to nameless
11045 union.
11046 (Incremental_inputs::Input_info::obejct): Move to nameless union.
11047 (Incremental_inputs::Input_info::script): Move to nameless union.
11048 (Incremental_inputs::mtime): New field.
11049 * script.cc (read_input_script): Pass file mtime to
11050 Incremental_input.
11051 * script.h (Script_info::inputs): Style fix.
11052
11053 2009-07-01 Ian Lance Taylor <ian@airs.com>
11054
11055 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11056 instead of 32.
11057
11058 2009-06-24 Ian Lance Taylor <iant@google.com>
11059
11060 PR 10156
11061 * layout.cc (Layout::choose_output_section): If we find an
11062 existing section, update the flags.
11063 (Layout::create_notes): New function, broken out of
11064 Layout::finalize.
11065 (Layout::finalize): Don't create note sections.
11066 (Layout::create_note): Don't crash if linker script discards
11067 section.
11068 (Layout::create_gold_note): Likewise.
11069 (Layout::create_build_id): Likewise. Don't set
11070 after_input_sections on the section.
11071 (Layout::create_executable_stack_info): Remove target parameter.
11072 Change caller.
11073 * layout.h (class Layout): Declare create_notes. Update
11074 declaration of create_executable_stack_info.
11075 * gold.cc (queue_middle_tasks): Call create_notes.
11076 * output.cc (Output_section::update_flags_for_input_section): Move
11077 here from output.h. If SHF_ALLOC flag is newly set, mark address
11078 invalid.
11079 * output.h (Output_data::mark_address_invalid): New function.
11080 (class Output_section): Only declare, not define,
11081 update_flags_for_input_section. Remove set_flags.
11082
11083 2009-06-24 Ian Lance Taylor <iant@google.com>
11084
11085 * script-sections.cc (Output_section_definition::
11086 set_section_addresses): Rename shadowing local load_address to
11087 laddr.
11088
11089 2009-06-24 Ian Lance Taylor <iant@google.com>
11090
11091 PR 10244
11092 * reloc.cc (relocate_sections): Skip empty relocation sections.
11093
11094 2009-06-23 Ian Lance Taylor <iant@google.com>
11095
11096 PR 10156
11097 * layout.cc (Layout::create_note): Use choose_output_section
11098 rather than make_output_section.
11099
11100 2009-06-23 Ian Lance Taylor <iant@google.com>
11101
11102 PR 10237
11103 * options.cc (General_options::parse_V): Set printed_version_.
11104 (General_options::General_options): Initialize printed_version_.
11105 * options.h (class General_options): Add printed_version_ field.
11106 * gold.cc (queue_initial_tasks): If there are no input files,
11107 don't give a fatal error if we printed the version information.
11108 (queue_middle_tasks): If using -r with a shared object, give a
11109 fatal error rather than an ordinary error.
11110
11111 2009-06-23 Ian Lance Taylor <iant@google.com>
11112
11113 PR 10219
11114 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11115 (Layout::make_output_section): Set have_stabstr_section_ if we see
11116 a .stab*str section.
11117 (Layout::finalize): Call link_stabs_sections.
11118 (Layout::link_stabs_sections): New file.
11119 * layout.h (class Layout): Add have_stabstr_section_ field.
11120 Declare link_stabs_sections.
11121
11122 2009-06-23 Doug Kwan <dougkwan@google.com>
11123
11124 * Makefile.am (libgold_a_LIBADD): New.
11125 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11126 * Makefile.in: Regenerate.
11127 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11128 * configure: Regenerate.
11129 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11130 * fileread.cc: Include sys/state.h
11131 * gold.h: Declare memmem and strndup if found missing.
11132 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11133
11134 2009-06-23 Ian Lance Taylor <iant@google.com>
11135
11136 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11137 * configure: Rebuild.
11138
11139 2009-06-23 Ian Lance Taylor <iant@google.com>
11140
11141 PR 10147
11142 * object.cc (Object::section_contents): Don't try to get a view if
11143 the section has length zero.
11144 (Object::handle_gnu_warning_section): If the section is empty, use
11145 the name of the section as the warning.
11146
11147 2009-06-23 Ian Lance Taylor <iant@google.com>
11148
11149 PR 10133
11150 * stringpool.h (class Stringpool_template): Add optimize_ field.
11151 (Stringpool_template::set_optimize): New function.
11152 * stringpool.cc (Stringpool_template::Stringpool_template):
11153 Initialize optimize_ field.
11154 (Stringpool_template::set_string_offsets): Test local optimize
11155 fild rather than parameter.
11156 * layout.cc (Layout::Layout): Call set_optimize on the section
11157 name stringpool.
11158
11159 2009-06-22 Ian Lance Taylor <iant@google.com>
11160
11161 PR 10030
11162 * yyscript.y: Parse TARGET.
11163 * script.cc (script_set_target): New function.
11164 * script-c.h (script_set_target): Declare.
11165 * options.cc (General_options::string_to_object_format): Rename
11166 from string_to_object_format in anonymous namespace. Change
11167 callers.
11168 * options.h (class General_options): Declare
11169 string_to_object_format.
11170
11171 2009-06-22 Ian Lance Taylor <iant@google.com>
11172
11173 * script-sections.cc (Script_sections::create_segments): Don't put
11174 program headers in a PT_LOAD segment if -n or -N.
11175
11176 2009-06-22 Ian Lance Taylor <iant@google.com>
11177
11178 PR 10141
11179 * options.h (class General_options): Add -z lazy and -z now. Sort
11180 -z options into alphabetical order.
11181 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11182
11183 2009-06-21 Ian Lance Taylor <iant@google.com>
11184
11185 * layout.cc (Layout::make_output_section): Call
11186 Target::new_output_section.
11187 (Layout::attach_allocated_section_to_segment): Put large section
11188 sections in a separate load segment with the large segment flag
11189 set.
11190 (Layout::segment_precedes): Sort large data segments after other
11191 load segments.
11192 (align_file_offset): New static function.
11193 (Layout::set_segment_offsets): Use align_file_offset.
11194 * output.h (class Output_section): Add is_small_section_ and
11195 is_large_section_ fields.
11196 (Output_section::is_small_section): New function.
11197 (Output_section::set_is_small_section): New function.
11198 (Output_section::is_large_section): New function.
11199 (Output_section::set_is_large_section): New function.
11200 (Output_section::is_large_data_section): New function.
11201 (class Output_segment): Add is_large_data_segment_ field.
11202 (Output_segment::is_large_data_segment): New function.
11203 (Output_segment::set_is_large_data_segment): New function.
11204 * output.cc (Output_section::Output_section): Initialize new
11205 fields.
11206 (Output_segment::Output_segment): Likewise.
11207 (Output_segment::add_output_section): Add assertion that large
11208 data sections always go in large data segments. Force small data
11209 sections to the end of the list of data sections. Force small BSS
11210 sections to the start of the list of BSS sections. For large BSS
11211 sections to the end of the list of BSS sections.
11212 * symtab.h (class Symbol): Declare is_common_shndx.
11213 (Symbol::is_defined): Check Symbol::is_common_shndx.
11214 (Symbol::is_common): Likewise.
11215 (class Symbol_table): Define enum Commons_section_type. Update
11216 declarations. Add small_commons_ and large_commons_ fields.
11217 * symtab.cc (Symbol::is_common_shndx): New function.
11218 (Symbol_table::Symbol_table): Initialize new fields.
11219 (Symbol_table::add_from_object): Put small and large common
11220 symbols in the right list.
11221 (Symbol_table::sized_finalized_symbol): Check
11222 Symbol::is_common_shndx.
11223 (Symbol_table::sized_write_globals): Likewise.
11224 * common.cc (Symbol_table::do_allocate_commons): Allocate new
11225 common symbol lists. Don't call do_allocate_commons_list if the
11226 list is empty.
11227 (Symbol_table::do_allocate_commons_list): Remove is_tls
11228 parameter. Add comons_section_type parameter. Change all
11229 callers. Handle small and large common symbols.
11230 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11231 Symbol::is_common_shndx.
11232 * resolve.cc (symbol_to_bits): Likewise.
11233 * target.h (Target::small_common_shndx): New function.
11234 (Target::small_common_section_flags): New function.
11235 (Target::large_common_shndx): New function.
11236 (Target::large_common_section_flags): New function.
11237 (Target::new_output_section): New function.
11238 (Target::Target_info): Add small_common_shndx, large_common_shndx,
11239 small_common_section_flags, and large_common_section_flags
11240 fields.
11241 (Target::do_new_output_section): New virtual function.
11242 * arm.cc (Target_arm::arm_info): Initialize new fields.
11243 * i386.cc (Target_i386::i386_info): Likewise.
11244 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11245 Likewise.
11246 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11247 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11248 (Target_x86_64::do_new_output_section): New function.
11249 * configure.ac: Define conditional MCMODEL_MEDIUM.
11250 * testsuite/Makefile.am (check_PROGRAMS): Add large.
11251 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11252 (large_LDFLAGS): Define.
11253 * testsuite/large.c: New file.
11254 * testsuite/testfile.cc (Target_test::test_target_info):
11255 Initialize new fields.
11256 * configure, testsuite/Makefile.in: Rebuild.
11257
11258 2009-06-05 Doug Kwan <dougkwan@google.com>
11259
11260 * Makefile.am (CCFILES): Add target.cc.
11261 * Makefile.in: Regenerate.
11262 * i386.cc (class Target_i386): Define new virtual method to
11263 override do_is_local_label_name in parent.
11264 * object.cc (Sized_relobj::do_count_local_symbols): Discard
11265 local symbols if --discard-locals or -X is given.
11266 * options.h (class General_options): Declare new options
11267 '--discard-locals' and '-X' for discarding locals.
11268 * target.h (class Target): Define new methods is_local_label_name.
11269 Declare new virtual method do_is_local_label_name.
11270 * target.cc: New file.
11271 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11272 (check_SCRIPTS): Add discard_locals_test.sh.
11273 (check_DATA): Add discard_local_tests.syms.
11274 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11275 (discard_local_tests.syms, discard_locals_test.o): New make rules.
11276 * testsuite/Makefile.in: Regenerate.
11277 * testsuite/discard_locals_test.c: New file.
11278 * testsuite/discard_locals_test.sh: Same.
11279
11280 2009-06-05 Doug Kwan <dougkwan@google.com>
11281
11282 * object.cc (Sized_relobj::Sized_relobj): Initialize
11283 discarded_eh_frame_shndx_ to -1U.
11284 (Sized_relobj::do_layout): Record index of a discard .eh_frame
11285 section.
11286 (Sized_relobj::do_count_local_symbols): Skip local symbols in
11287 a discarded .eh_frame section.
11288 (Sized_relobj::do_finalize_local_symbols): Ditto.
11289 * object.h (class Sized_relobj): Declare new member
11290 discarded_eh_frame_shndx_.
11291 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11292 (local_labels_test.o, local_labels_test): New rules.
11293 * testsuite/Makefile.in: Regenerate.
11294
11295 2009-06-04 Doug Kwan <dougkwan@google.com>
11296
11297 * layout.cc (Layout::section_name_mapping): Add mapping for
11298 special ARM sections.
11299
11300 2009-06-03 Doug Kwan <dougkwan@google.com>
11301
11302 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11303 (utils::has_overflow): Same.
11304
11305 2009-06-03 Ian Lance Taylor <iant@google.com>
11306
11307 * layout.cc (Layout::section_name_mapping): New array, replacing
11308 Layout::linkonce_mapping.
11309 (Layout::section_name_mapping_count): New variable, replacing
11310 Layout::linkonce_mapping_count.
11311 (Layout::linkonce_output_name): Remove.
11312 (Layout::output_section_name): Rewrite.
11313 * layout.h (class Layout): Rename Linkonce_mapping to
11314 Section_name_mapping, linkonce_mapping to section_name_mapping,
11315 linkonce_mapping_count to section_name_mapping_count. Don't
11316 declare linkonce_output_name.
11317
11318 2009-06-03 Doug Kwan <dougkwan@google.com>
11319
11320 * gold/arm.cc (namespace utils): New.
11321 (Target_arm::reloc_is_non_pic): Define new method.
11322 (class Arm_relocate_functions): New.
11323 (Target_arm::Relocate::relocate): Handle relocation types used by
11324 Android.
11325
11326 2009-06-03 Ian Lance Taylor <iant@google.com>
11327
11328 * arm.cc (Target_arm::scan::global): Use || instead of |.
11329
11330 2009-06-02 Doug Kwan <dougkwan@google.com>
11331
11332 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
11333 issued_non_pic_error_.
11334 (class Target_arm::Scan): Declare new method check_non_pic.
11335 Define new method symbol_needs_plt_entry.
11336 Declare new data member issued_non_pic_error_.
11337 (class Target_arm::Relocate): Declare new method
11338 should_apply_static_reloc.
11339 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11340 (Target_arm::Scan::check_non_pic): Define new method.
11341 (Target_arm::Scan::local): Handle a small subset of reloc types used
11342 by Android.
11343 (Target_arm::Scan::local): Same.
11344 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11345
11346 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
11347
11348 * incremental.cc (Incremental_inputs::report_command_line): Filter
11349 out --incremental-* options.
11350
11351 2009-05-29 Doug Kwan <dougkwan@google.com>
11352
11353 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11354 template class.
11355 (class Target_arm): Update comment.
11356 (Target_arm::Target_arm): Initialize new data members GOT_,
11357 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11358 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11359 and Target_arm::rel_dyn_section.
11360 Declare new_enum Target_arm::Got_type.
11361 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11362 and DYNBSS_.
11363 Update commments for member do_dynsym_value.
11364 (Target_arm::got_size, Target_arm::plt_section,
11365 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11366 new methods inside class defintion.
11367 (Target_arm::got_section): Define new method.
11368 (Target_arm::rel_dyn_section): Same.
11369 (Output_data_plt_arm): New template class.
11370 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11371 (Output_data_plt_arm:do_adjust_output_section): Define new method.
11372 (Output_data_plt_arm::add_entry): Same.
11373 (Output_data_plt_arm::first_plt_entry): Define new
11374 static data member for PLT instruction template.
11375 (Output_data_plt_arm::plt_entry): Same.
11376 (Output_data_plt_arm::do_write): Define new method.
11377 (Target_arm::make_plt_entry): Same.
11378 (Target_arm::do_finalize_sections): Same.
11379 (Target_arm::do_dynsym_value): Same.
11380
11381 2009-05-28 Doug Kwan <dougkwan@google.com>
11382
11383 * Makefile.am (TARGETSOURCES): Add arm.cc.
11384 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11385 * Makefile.in: Regenerate.
11386 * arm.cc: New file.
11387 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11388
11389 2009-05-26 Doug Kwan <dougkwan@google.com>
11390
11391 * options.cc (General_options::parse_exclude_libs). Fix a comment.
11392 (General_options::check_excluded_libs): Strip off directories in
11393 archive name before matching like GNU ld does.
11394 * testsuite/Makefile.am (MOSTLYCLEANFILES,
11395 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11396 (exclude_libs_test_LDFLAGS): Add linker option
11397 -Wl,--exclude-libs,libexclude_libs_test_3
11398 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11399 an explicit archive without using -l.
11400 (alt/libexclude_libs_test_3.a): New make rule.
11401 * testsuite/Makefile.in: Regenerate.
11402 * testsuite/exclude_libs_test.c : Declare lib3_default().
11403 (main): Call it.
11404 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11405 * exclude_libs_test_3.c: New file.
11406
11407 2009-05-26 Nick Clifton <nickc@redhat.com>
11408
11409 * po/id.po: New Indonesian translation.
11410 * po/gold.pot: Updated template file.
11411
11412 2009-05-22 Sriraman Tallam <tmsriram@google.com>
11413
11414 * testsuite/Makefile.am: Add -ffunction-sections to compile
11415 gc_comdat_test files. Add -Wl,--gc-sections to build
11416 gc_comdat_test.
11417 * testsuite/Makefile.in: Regenerate.
11418 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11419
11420 2009-05-21 Sriraman Tallam <tmsriram@google.com>
11421
11422 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11423 kept comdat section was garbage collected.
11424 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11425 * testsuite/Makefile.in: Regenerate.
11426 * testsuite/gc_comdat_test.sh: New file.
11427 * testsuite/gc_comdat_test_1.cc: New file.
11428 * testsuite/gc_comdat_test_2.cc: New file.
11429
11430 2009-05-19 Doug Kwan <dougkwan@google.com>
11431
11432 * archive.cc (Archive::Archive): Move constructor from archive.h
11433 to here. Initialize no_export_.
11434 (Archive::get_elf_object_for_member): Set no_export flag of object.
11435 * archive.h (Archive::Archive): Move constructor body to
11436 archive.cc.
11437 (Archive::no_export): New method.
11438 (Archive::no_export_): New field.
11439 * object.h (Object::Object): Initialize no_export_ to false.
11440 (Object::no_export, Object::set_no_export): New methods.
11441 (Object::no_export_): New field.
11442 * options.cc (General_options::parse_exclude_libs): New method.
11443 (General_options::check_excluded_libs) Same.
11444 * options.h (exclude_libs): New option.
11445 (General_options::check_excluded_libs): New method declaration.
11446 (General_options::excluded_libs_): New field.
11447 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11448 default or protected visibility if an object has no-export flag set.
11449 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11450 (check_SCRIPTS): Add exclude_libs_test.sh.
11451 (check_DATA): Add exclude_libs_test.syms.
11452 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11453 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11454 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11455 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11456 (exclude_libs_test.syms, libexclude_libs_test_1.a,
11457 libexclude_libs_test_2.a): New rules.
11458 * testsuite/Makefile.in: Regenerate.
11459 * testsuite/exclude_libs_test.c: New file.
11460 * testsuite/exclude_libs_test.sh: Ditto.
11461 * testsuite/exclude_libs_test_1.c: Ditto.
11462 * testsuite/exclude_libs_test_2.c: Ditto.
11463
11464 2009-05-15 Ian Lance Taylor <iant@google.com>
11465
11466 * configure.ac: Check for declarations for cases where libiberty.h
11467 checks HAVE_DECL_xxx.
11468 * configure, config.in: Rebuild.
11469
11470 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
11471
11472 * gold.h (Incremental_argument_list): Remove (invalid) forward
11473 declaration.
11474 * incremental.cc (Incremental_inputs::report_achive): New method.
11475 (Incremental_inputs::report_object): New method.
11476 (Incremental_inputs::report_script): New method.
11477 (Incremental_inputs::finalize_inputs): New method.
11478 (Incremental_inputs::finalize): Call finalize_inputs().
11479 (Incremental_inputs::sized_create_incremental_inputs_section_data):
11480 Create inputs entries.
11481 * incremental.h (Incremental_input_type): New enum.
11482 (Incremental_inputs::Incremental_input): Initialize new fields.
11483 (Incremental_inputs::report_inputs): New method.
11484 (Incremental_inputs::report_achive): New method.
11485 (Incremental_inputs::report_object): New method.
11486 (Incremental_inputs::report_script): New method.
11487 (Incremental_inputs::finalize_inputs): New method.
11488 (Incremental_inputs::Input_info): New struct.
11489 (Incremental_inputs::Input_info_map): New typedef.
11490 (Incremental_inputs::lock_): New field.
11491 (Incremental_inputs::Inputs_): New field.
11492 (Incremental_inputs::Inputs_map): New field.
11493 * main.cc (main): Call Incremental_input::report_inputs.
11494 * options.h (Input_argument_list): Typedef moved from
11495 Input_arguments.
11496 (Input_file_group::Files): Remove, use ::Input_argument_list.
11497 (Input_file_group::Input_argument_list): Remove, use
11498 ::Input_argument_list.
11499 * plugin.cc (Plugin_manager::add_input_file): Add error in
11500 incremental build.
11501 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11502 functions.
11503 * script.cc (read_input_script): Call
11504 Incremental_input::report_script.
11505 * script.h (Script_info): New class.
11506
11507 2009-04-27 Ian Lance Taylor <iant@google.com>
11508
11509 * x86_64.cc (do_adjust_output_section): Set entsize to
11510 plt_entry_size.
11511
11512 2009-04-23 Elliott Hughes <enh@google.com>
11513
11514 * output.cc (Output_file::close): After short writes, continue
11515 writing from the correct offset in the buffer being written.
11516
11517 2009-04-23 Chris Demetriou <cgd@google.com>
11518
11519 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11520 * configure: Regenerate.
11521 * config.in: Regenerate.
11522 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11523 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11524
11525 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
11526
11527 * incremental.cc (Incremental_inputs_header_data): Renamed from
11528 Incremental_input_header_data.
11529 (Incremental_inputs_header_data::data_size): New field.
11530 (Incremental_inputs_header_data::put_input_file_count): Renamed
11531 from input_file_count.
11532 (Incremental_inputs_header_data::put_command_line_offset): Renamed
11533 from command_line_offset.
11534 (Incremental_inputs_header_data::put_reserved): Renamed from
11535 put_reserved.
11536 (Incremental_inputs_entry_data): Renamed from
11537 Incremental_input_entry_data.
11538 (Incremental_inputs_entry_data::data_size): New field.
11539 (Incremental_inputs::report_command_line): New method.
11540 (Incremental_inputs::finalize): New method.
11541 (Incremental_inputs::create_incremental_inputs_data): New method.
11542 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11543 * incremental.h: New file.
11544 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11545 (Layout::finalize): Create incremental inputs section in
11546 incremental builds.
11547 (Layout::create_incremental_info_sections): New method.
11548 * layout.h (Layout::incremental_inputs): New method.
11549 (Layout::create_incremental_info_sections): New method.
11550 (Layout::incremental_inputs_): New field.
11551 * main.cc (main): Notify Incremental_input of the command line.
11552
11553 2009-04-01 Ian Lance Taylor <iant@google.com>
11554 Mikolaj Zalewski <mikolajz@google.com>
11555
11556 * gold.h (reserve_unordered_map): Define, three versions, one for
11557 each version of Unordered_map.
11558 * layout.cc (Layout::Layout): Remove options parameter. Add
11559 number_of_input_files parameter. Don't initialize options_.
11560 Initialize number_of_input_files_ and resized_signatures_. Move
11561 sections_are_attached_.
11562 (Layout::layout_group): Reserve space for group_signatures_.
11563 (Layout::find_or_add_kept_section): Change name parameter to be a
11564 reference. Resize signatures_ map when it gets large enough.
11565 (Layout::layout_eh_frame): Use parameters->options() instead of
11566 this->options_.
11567 (Layout::make_output_section): Likewise.
11568 (Layout::attach_allocated_section_to_segment): Likewise.
11569 (Layout::finalize, Layout::create_executable_stack): Likewise.
11570 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11571 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11572 * layout.h (class Layout): Update declarations. Remove options_
11573 field. Add number_of_input_files_ and resized_signatures_
11574 fields. Move sections_are_attached_ field.
11575 * main.cc (main): Pass number of input files to Layout
11576 constructor. Don't pass options.
11577
11578 2009-03-30 Ian Lance Taylor <iant@google.com>
11579
11580 * ffsll.c (ffsll): Correct implementation.
11581
11582 2009-03-27 Ian Lance Taylor <iant@google.com>
11583
11584 * ffsll.c: New file.
11585 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11586 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11587 * ftruncate.c (ftruncate): Declare before definition.
11588 * mremap.c (mremap): Likewise.
11589 * pread.c (pread): Likewise.
11590 * configure, Makefile.in, config.in: Rebuild.
11591
11592 * mremap.c: New file.
11593 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11594 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11595 (mremap): Declare if HAVE_MREMAP is not defined.
11596 * configure, Makefile.in, config.in: Rebuild.
11597
11598 2009-03-27 Cary Coutant <ccoutant@google.com>
11599
11600 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11601 position independent.
11602 * sparc.cc (Target_sparc::check_non_pic): Likewise.
11603 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11604
11605 2009-03-24 Cary Coutant <ccoutant@google.com>
11606
11607 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11608 an executable.
11609 (needs_dynamic_reloc): Likewise.
11610
11611 2009-03-24 Ian Lance Taylor <iant@google.com>
11612
11613 * yyscript.y (file_cmd): Recognize EXTERN.
11614 (extern_name_list, extern_name_list_body): New nonterminals.
11615 * script.cc (script_add_extern): Define.
11616 * script-c.h (script_add_extern): Declare.
11617
11618 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
11619
11620 * object.cc (is_elf_object): Define.
11621 * object.h (is_elf_object): Declare.
11622 * archive.cc (Archive::get_elf_object_for_member): Call
11623 is_elf_object.
11624 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11625
11626 2009-03-24 Elliott Hughes <enh@google.com>
11627
11628 * output.cc (Output_file::map_anonymous): Define.
11629 (Output_file::map): Use map_anonymous. If the regular mmap fails,
11630 try an anonymous one. Report the size if the mmap fails.
11631 * output.h (class Output_file): Declare map_anonymous.
11632
11633 2009-03-24 Ian Lance Taylor <iant@google.com>
11634
11635 * target-select.cc (instantiate_target): Don't acquire the lock if
11636 the instantiated_target_ field has already been set.
11637
11638 2009-03-23 Ian Lance Taylor <iant@google.com>
11639
11640 * gold-threads.h (class Initialize_lock): Define.
11641 * gold-threads.cc (class Initialize_lock_once): Define.
11642 (initialize_lock_control): New static variable.
11643 (initialize_lock_pointer): New static variable.
11644 (initialize_lock_once): New static function.
11645 (Initialize_lock::Initialize_lock): Define.
11646 (Initialize_lock::initialize): Define.
11647 * target-select.h: Include "gold-threads.h".
11648 (class Target_selector): Add lock_ and initialize_lock_ fields.
11649 Don't define instantiate_target, just declare it.
11650 * target-select.cc (Target_selector::Target_selector): Initialize
11651 new fields.
11652 (Target_selector::instantiate_target): Define.
11653 * descriptors.h: Include "gold-threads.h".
11654 (class Descriptors): Add initialize_lock_ field.
11655 * descriptors.cc (Descriptors::Descriptors): Initialize new
11656 field.
11657 (Descriptors::open): Use initialize_lock_ field
11658 * errors.h (class Errors): Add initialize_lock_ field.
11659 * errors.cc (Errors::Errors): Initialize new field.
11660 (Errors::initialize_lock): Use initialize_lock_ field.
11661 * powerpc.cc (class Target_selector_powerpc): Remove
11662 instantiated_target_ field. In do_recognize call
11663 instantiate_target rather than do_instantiate_target. In
11664 do_instantiate_target just allocate a new target.
11665 * sparc.cc (class Target_selector_sparc): Likewise.
11666
11667 * freebsd.h: New file.
11668 * i386.cc: Include "freebsd.h".
11669 (Target_i386): Derive from Target_freebsd rather than
11670 Sized_target.
11671 (Target_selector_i386): Derive from Target_selector_freebsd rather
11672 than Target_selector.
11673 * x86_64.cc: Include "freebsd.h".
11674 (Target_x86_64): Derive from Target_freebsd rather than
11675 Sized_target.
11676 (Target_selector_x86_64): Derive from Target_selector_freebsd
11677 rather than Target_selector.
11678 * target.h (class Target): Add adjust_elf_header and
11679 do_adjust_elf_header.
11680 * output.cc (Output_file_header:: do_sized_write): Call target
11681 adjust_elf_header routine.
11682 * configure.tgt: Set targ_osabi.
11683 * configure.ac: Define GOLD_DEFAULT_OSABI.
11684 * parameters.cc (Parameters::default_target): Pass
11685 GOLD_DEFAULT_OSABI to select_target.
11686 * target-select.h (class Target_selector): Make instantiate_target
11687 protected rather than private.
11688 * Makefile.am (HFILES): Add freebsd.h.
11689 * configure, Makefile.in, config.in: Rebuild.
11690
11691 * merge.cc (do_add_input_section): Correct pend value. Change
11692 message about last entry not being null terminated from error to
11693 warning.
11694
11695 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
11696
11697 * incremental.cc: New file.
11698 * Makefile.am (CCFILES): Add incremental.cc.
11699 * Makefile.in: Rebuild.
11700
11701 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
11702
11703 * layout.cc (Layout::output_section_name): Preserve names
11704 of '.note.' sections.
11705
11706 2009-03-19 Ian Lance Taylor <iant@google.com>
11707
11708 * descriptors.cc (Descriptors::open): Check that the options are
11709 valid before using them.
11710
11711 2009-03-18 Ian Lance Taylor <iant@google.com>
11712
11713 * script-sections.h: Include <list>.
11714 (class Script_sections): Change Sections_elements from std::vector
11715 to std::list. Typedef public Elements_iterator. Add
11716 orphan_section_placement_, data_segment_align_start_, and
11717 saw_data_segment_align_ fields. Remove data_segment_align_index_
11718 field.
11719 * script-sections.cc (class Orphan_section_placement): New class.
11720 (class Sections_element): Add virtual functions is_relro and
11721 orphan_section_init. Remove virtual function place_orphan_here.
11722 (class Output_section_definition): Add is_relro and
11723 orphan_section_init. Remove place_orphan_here.
11724 (class Orphan_output_section): Likewise.
11725 (Script_sections::Script_sections): Update for field changes.
11726 (Script_sections::data_segment_align): Set saw_data_segment_align_
11727 and data_segment_align_start_, not data_segment_align_index.
11728 (Script_sections::data_segment_relro_end): Check
11729 saw_data_segment_align_. Use data_segment_align_start_ rather
11730 than data_segment_align_index_.
11731 (Script_sections::place_orphan): Rewrite to use
11732 Orphan_section_placement.
11733
11734 2009-03-17 Ian Lance Taylor <iant@google.com>
11735
11736 * archive.cc (Archive::add_symbols): Check for a version attached
11737 to the symbol name in the archive map.
11738 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11739 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11740 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11741 (ver_test_11.a): New target.
11742 * testsuite/Makefile.in: Rebuild.
11743
11744 * configure.ac: Check for chsize and posix_fallocate. Replace
11745 ftruncate.
11746 * ftruncate.c: New file, from gnulib.
11747 * output.cc (posix_fallocate): Define dummy version if not
11748 HAVE_POSIX_FALLOCATE.
11749 (Output_file::map): Call posix_fallocate rather than lseek and
11750 write.
11751 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11752 * configure, Makefile.in, config.in: Rebuild.
11753
11754 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
11755
11756 * layout.h (Layout::create_note): Add section_name parameter.
11757 * layout.cc (Layout::create_note): Likewise.
11758 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11759
11760 2009-03-17 Ian Lance Taylor <iant@google.com>
11761
11762 * descriptors.cc: Include "options.h".
11763 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11764 (Descriptors::open): Always use O_CLOEXEC when opening a new
11765 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
11766 then set FD_CLOEXEC.
11767
11768 * sparc.cc (class Target_sparc): Add has_got_section.
11769 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11770 make sure we have a GOT section.
11771
11772 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11773 (Target_sparc::Scan::local): Likewise.
11774 (Target_sparc::Scan::global): Likewise.
11775 (Target_sparc::Relocate::relocate): Likewise.
11776 (Target_sparc::Relocate::relocate_tls): Likewise.
11777
11778 * symtab.cc (Symbol_table::define_default_version): New function,
11779 broken out of add_from_object.
11780 (Symbol_table::add_from_object): Call define_default_version.
11781 (Symbol_table::define_special_symbol): Add resolve_oldsym
11782 parameter. Change all callers. If the version for a symbol comes
11783 from a version script, resolve it with the symbol with the same
11784 name with no version. Also add the symbol without a version if
11785 appropriate.
11786 (do_define_in_output_data): If resolving with oldsym, don't delete
11787 sym.
11788 (do_define_in_output_segment): Likewise.
11789 (do_define_as_constant): Likewise.
11790 * symtab.h (class Symbol_table): Update declarations.
11791
11792 2009-03-13 Ian Lance Taylor <iant@google.com>
11793
11794 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11795 (Read_symbols::requeue): New function.
11796 (Read_symbols::do_read_symbols): If make_elf_object fails because
11797 the target type is not configured, and the file was searched for,
11798 issue a warning and retry with the next directory.
11799 (Add_symbols::run): If the file has an incompatible format, and
11800 it was searched for, requeue the Read_symbols task. On error,
11801 release the object.
11802 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11803 dirindex parameter to constructor. Change all callers. Declare
11804 incompatible_warning and requeue.
11805 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11806 input_argument_ and input_group_ fields. Add them to
11807 constructor. Change all callers.
11808 (class Read_script): Add dirindex_ field. Add it to constructor.
11809 Change all callers.
11810 * archive.cc (Archive::setup): Remove input_objects parameter.
11811 Change all callers.
11812 (Archive::get_file_and_offset): Likewise.
11813 (Archive::read_all_symbols): Likewise.
11814 (Archive::read_symbols): Likewise.
11815 (Archive::get_elf_object_for_member): Remove input_objects
11816 parameter. Add punconfigured parameter. Change all callers.
11817 (Archive::add_symbols): Change return type to bool. Check return
11818 value of include_member.
11819 (Archive::include_all_members): Likewise.
11820 (Archive::include_member): Change return type to bool. Return
11821 false if first included object has incompatible target. Set
11822 included_member_ field.
11823 (Add_archive_symbols::run): If add_symbols returns false, requeue
11824 Read_symbols task.
11825 * archive.h (class Archive): Add included_member_ field.
11826 Initialize it in constructor. Add input_file and searched_for
11827 methods. Update declarations.
11828 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11829 input_argument_ fields. Add them to constructor. Change all
11830 callers.
11831 * script.cc: Include "target-select.h".
11832 (class Parser_closure): Add skip_on_incompatible_target_ and
11833 found_incompatible_target_ fields. Add
11834 skip_on_incompatible_target parameter to constructor. Change all
11835 callers. Add methods skip_on_incompatible_target,
11836 clear_skip_on_incompatible_target, found_incompatible_target, and
11837 set_found_incompatible_target.
11838 (read_input_script): Add dirindex parameter. Change all callers.
11839 If parser finds an incompatible target, requeue Read_symbols
11840 task.
11841 (script_set_symbol): Clear skip_on_incompatible_target in
11842 closure.
11843 (script_add_assertion, script_parse_option): Likewise.
11844 (script_start_sections, script_add_phdr): Likewise.
11845 (script_check_output_format): New function.
11846 * script.h (read_input_script): Update declaration.
11847 * script-c.h (script_check_output_format): Declare.
11848 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11849 (ignore_cmd): Remove OUTPUT_FORMAT.
11850 * fileread.cc (Input_file::Input_file): Add explicit this.
11851 (Input_file::will_search_for): New function.
11852 (Input_file::open): Add pindex parameter. Change all callers.
11853 * fileread.h (class Input_file): Add input_file_argument method.
11854 Declare will_search_for. Update declarations.
11855 * object.cc (make_elf_object): Add punconfigured parameter.
11856 Change all callers.
11857 * object.h (class Object): Make input_file public. Add
11858 searched_for method.
11859 (make_elf_object): Update declaration.
11860 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11861 restart search.
11862 * dirsearch.h (class Dirsearch): Update declaration.
11863 * options.h (class General_options): Add --warn-search-mismatch.
11864 * parameters.cc (Parameters::is_compatible_target): New function.
11865 * parameters.h (class Parameters): Declare is_compatible_target.
11866 * workqueue.cc (Workqueue::add_blocker): New function.
11867 * workqueue.h (class Workqueue): Declare add_blocker.
11868
11869 * fileread.cc (Input_file::open): Remove options parameter.
11870 Change all callers.
11871 (Input_file::open_binary): Likewise.
11872 * script.cc (read_input_script): Likewise.
11873 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11874 options parameter from constructor. Change all callers.
11875 (class Read_script): Likewise.
11876 * fileread.h (class Input_file): Update declarations.
11877 * script.h (read_input_script): Update declaration.
11878
11879 2009-03-10 Nick Clifton <nickc@redhat.com>
11880
11881 * po/es.po: New Spanish translation.
11882
11883 2009-03-06 Cary Coutant <ccoutant@google.com>
11884
11885 * options.cc (parse_short_option): Keep dash_z from registering itself.
11886
11887 2009-03-03 Ian Lance Taylor <iant@google.com>
11888
11889 PR 9918
11890 * target-reloc.h (relocate_section): Pass output_section to
11891 relocate.
11892 * i386.cc (Target_i386::should_apply_static_reloc): Add
11893 output_section parameter. Change all callers.
11894 (Target_i386::Relocate::relocate): Add output_section parameter.
11895 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11896 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11897 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11898 * testsuite/two_file_shared.sh: New script.
11899 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11900 (check_DATA): Add two_file_shared.dbg.
11901 (two_file_shared.dbg): New target.
11902 * testsuite/Makefile.in: Rebuild.
11903
11904 2009-03-01 Ian Lance Taylor <iant@google.com>
11905
11906 * configure.ac: Check for byteswap.h.
11907 * configure: Rebuild.
11908 * config.in: Rebuild.
11909
11910 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11911
11912 * layout.cc (Layout::find_or_add_kept_section): New function.
11913 (Layout::add_comdat): Removed.
11914 * layout.h (struct Kept_section): Move out of class Layout.
11915 Remove trailing underscores from field names. Add group_sections
11916 field. Rename group_ field to is_group. Change all uses.
11917 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11918 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11919 comdat_groups_ field.
11920 (Sized_relobj::include_section_group): Use
11921 find_or_add_kept_section and Kept_section::group_sections.
11922 (Sized_relobj::include_linkonce_section): Likewise.
11923 * object.cc (class Sized_relobj): Don't define Comdat_group or
11924 Comdat_group_table. Remove find_comdat_group and
11925 add_comdat_group. Remove comdat_groups_ field.
11926 * plugin.cc (include_comdat_group): Use
11927 Layout::find_or_add_kept_section.
11928
11929 2009-02-28 Ian Lance Taylor <iant@google.com>
11930
11931 * README: --gc-sections and map files are now supported. Document
11932 some build requirements.
11933
11934 PR 6992
11935 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11936 relocatable link set the value of the section symbol to zero.
11937 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11938 relocatable link don't include the section address in the local
11939 symbol value.
11940
11941 2009-02-27 Ian Lance Taylor <iant@google.com>
11942
11943 PR 6811
11944 * options.h (class Search_directory): Add is_system_directory.
11945 (class General_options): Declare is_in_system_directory.
11946 * options.cc (get_relative_sysroot): Make static.
11947 (get_default_sysroot): Make static.
11948 (General_optoins::is_in_system_directory): New function.
11949 * fileread.cc (Input_file::is_in_system_directory): New function.
11950 * fileread.h (class Input_file): Declare is_in_system_directory.
11951 * object.h (class Object): Add is_in_system_directory.
11952 (class Input_objects): Remove system_library_directory_ field.
11953 * object.cc (Input_objects::add_object): Don't set
11954 system_library_directory_.
11955 (input_objects::found_in_system_library_directory): Remove.
11956 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11957 parameter. Change all callers.
11958 (Symbol_table::sized_write_globals): Likewise.
11959 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11960 Call Object::is_in_system_directory.
11961 * symtab.h (class Symbol_table): Update declarations.
11962
11963 PR 5990
11964 * descriptors.h (Open_descriptor): Add is_on_stack field.
11965 * descriptors.cc (Descriptors::open): If the descriptor is on the
11966 top of the stack, remove it. Initialize is_on_stack field.
11967 (Descriptors::release): Only add pod to stack if it is not on the
11968 stack already.
11969 (Descriptors::close_some_descriptor): Clear stack_next and
11970 is_on_stack fields.
11971
11972 PR 7091
11973 * output.cc (Output_section::find_starting_output_address): Rename
11974 from starting_output_address; add PADDR parameter; change return
11975 type.
11976 * output.h (class Output_section): Declare
11977 find_starting_output_address instead of starting_output_address.
11978 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11979 section symbol for which we can't find a merge section.
11980
11981 PR 9836
11982 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11983 hidden or internal, force the symbol to be local.
11984 * resolve.cc (Symbol::override_visibility): Define.
11985 (Symbol::override_base): Use override_visibility.
11986 (Symbol_table::resolve): Likewise.
11987 (Symbol::override_base_with_special): Likewise.
11988 (Symbol_table::override_with_special): If the visibility is hidden
11989 or internal, force the symbol to be local.
11990 * symtab.h (class Symbol): Add set_visibility and
11991 override_visibility.
11992 * testsuite/ver_test_1.sh: New file.
11993 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11994 (check_DATA): Add ver_test_1.syms.
11995 (ver_test_1.syms): New target.
11996 * testsuite/Makefile.in: Rebuild.
11997
11998 2009-02-25 Cary Coutant <ccoutant@google.com>
11999
12000 * layout.cc (Layout::choose_output_section): Don't rename sections
12001 when using a linker script that has a SECTIONS clause.
12002 * Makefile.in: Regenerate.
12003
12004 * testsuite/Makefile.am (script_test_5.sh): New test case.
12005 * testsuite/Makefile.in: Regenerate.
12006 * testsuite/script_test_5.cc: New file.
12007 * testsuite/script_test_5.sh: New file.
12008 * testsuite/script_test_5.t: New file.
12009
12010 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
12011
12012 * archive.cc (Archive::include_member): Update calls to add_symbols.
12013 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12014 the Layout argument.
12015 * dynobj.h (do_add_symbols): Add the Layout argument.
12016 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12017 Layout argument.
12018 * object.h (Object::add_symbols): Add the Layout argument.
12019 (Object::do_add_symbols): Add the Layout argument.
12020 (Sized_relobj::do_add_symbols): Add the Layout argument.
12021 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12022 Unify the two versions.
12023 (Add_plugin_symbols): Remove.
12024 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12025 (Sized_pluginobj::do_add_symbols): Unify the two versions.
12026 (Add_plugin_symbols): Remove.
12027 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12028 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12029 (Add_symbols::run): Make it work with Pulginobj.
12030
12031 2009-02-06 Ian Lance Taylor <iant@google.com>
12032
12033 * object.cc (Sized_relobj::do_layout): Make info message start
12034 with lower case letter.
12035
12036 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
12037
12038 * binary.cc: Fix file comment.
12039
12040 * options.h (enum Incremental_disposition): Define.
12041 (class General_options): Add new options: --incremental,
12042 --incremental_changed, --incremental_unchanged,
12043 --incremental_unknown. Add incremental_disposition_ and
12044 implicit_incremental_ fields.
12045 (General_options::incremental_disposition): New function.
12046 (class Position_dependent_options): Add incremental_disposition
12047 option.
12048 (Position_dependent_options::copy_from_options): Set incremental
12049 dispositions.
12050 * options.cc (General_options::parse_incremental_changed): New
12051 function.
12052 (General_options::parse_incremental_unchanged): New function.
12053 (General_options::parse_incremental_unknown): New function.
12054 (General_options::General_options): Initialize new fields
12055 incremental_disposition_ and implicit_incremental_.
12056 (General_options::finalize): Check for uasge of --incremental-*
12057 without --incremental.
12058
12059 2009-02-06 Chris Demetriou <cgd@google.com>
12060
12061 * gold.h (gold_undefined_symbol): Change to take only a Symbol
12062 pointer and to report location as the file name associated with
12063 the symbol.
12064 (gold_undefined_symbol_at_location): New function to replace the
12065 old gold_undefined_symbol functionality.
12066 * target-reloc.h (relocate_section): Update to use
12067 gold_undefined_symbol_at_location.
12068 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12069 Call gold_undefined_symbol function rather than gold_error.
12070 * errors.h (Errors::undefined_symbol): Take location as a
12071 string, rather than calculating it from a relocation.
12072 * errors.cc (Errors::fatal): Print "fatal error:" before the
12073 formatted message.
12074 (Errors::error, Errors::error_at_location): Print "error: "
12075 before the formatted message.
12076 (Errors::undefined_symbol): Take location as a string, rather
12077 than calculating it from a relocation.
12078 (gold_undefined_symbol_at_location): New function akin to
12079 old gold_undefined_symbol, calculates location from relocation.
12080 (gold_undefined_symbol): Change to take only a Symbol pointer
12081 and to report location as the file name associated with the symbol.
12082 * testsuite/debug_msg.sh: Update for changed error messages.
12083 * testsuite/undef_symbol.sh: Likewise.
12084
12085 2009-02-04 Duncan Sands <baldrick@free.fr>
12086
12087 PR 9812
12088 * reduced_debug_output.h
12089 (Output_reduced_debug_abbrev_section::failed): Use format for
12090 gold_warning.
12091 (Output_reduced_debug_info_section::faild): Likewise.
12092
12093 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
12094
12095 * script.cc (Lazy_demangler): New class.
12096 (Version_script_info::get_symbol_version_helper): Demangle a
12097 symbol only once.
12098
12099 2009-01-29 Cary Coutant <ccoutant@google.com>
12100
12101 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12102 to __tls_get_addr.
12103 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12104
12105 2009-01-28 Ian Lance Taylor <iant@google.com>
12106
12107 * version.cc (version_string): Bump to 1.9.
12108
12109 * gold.h: Include <cstring> and <stdint.h>.
12110 * version.cc: Include <cstdio>.
12111 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12112 warning.
12113 * reduced_debug_output.cc (insert_into_vector): Rename from
12114 Insert_into_vector; change all callers. Use Swap_unaligned to
12115 avoid aliasing issue; remove union since it is unnecessary.
12116
12117 2009-01-27 Sriraman Tallam <tmsriram@google.com>
12118
12119 * Makefile.am (CCFILES): Add gc.cc.
12120 (HFILES): Add gc.h.
12121 * Makefile.in: Regenerate.
12122 * gold.cc (Gc_runner): New class.
12123 (queue_initial_tasks): Call garbage collection related tasks
12124 when corresponding options are invoked.
12125 (queue_middle_gc_tasks): New function.
12126 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12127 processed early before laying out sections during garbage collection.
12128 * gold.h (queue_middle_gc_tasks): New function.
12129 (is_prefix_of): Move from "layout.cc".
12130 * i386.cc (Target_i386::gc_process_relocs): New function.
12131 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12132 * main.cc (main): Create object of class "Garbage_collection".
12133 * object.cc (Relobj::copy_symbols_data): New function.
12134 (Relobj::is_section_name_included): New function.
12135 (Sized_relobj::do_layout): Allow this function to be called twice
12136 during garbage collection and defer layout of section during the
12137 first call.
12138 * object.h (Relobj::get_symbols_data): New function.
12139 (Relobj::is_section_name_included): New function.
12140 (Relobj::copy_symbols_data): New function.
12141 (Relobj::set_symbols_data): New function.
12142 (Relobj::get_relocs_data): New function.
12143 (Relobj::set_relocs_data): New function.
12144 (Relobj::is_output_section_offset_invalid): New pure virtual function.
12145 (Relobj::gc_process_relocs): New function.
12146 (Relobj::do_gc_process_relocs): New pure virtual function.
12147 (Relobj::sd_): New data member.
12148 (Sized_relobj::is_output_section_offset_invalid): New function.
12149 (Sized_relobj::do_gc_process_relocs): New function.
12150 * options.h (General_options::gc_sections): Modify to not be a no-op.
12151 (General_options::print_gc_sections): New option.
12152 * plugin.cc (Plugin_finish::run): Remove function call to
12153 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
12154 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12155 * reloc.cc (Read_relocs::run): Add task to process relocs and
12156 determine unreferenced sections when doing garbage collection.
12157 (Gc_process_relocs): New class.
12158 (Sized_relobj::do_gc_process_relocs): New function.
12159 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12160 sections that are garbage collected.
12161 * reloc.h (Gc_process_relocs): New class.
12162 * sparc.cc (Target_sparc::gc_process_relocs): New function.
12163 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12164 symbols whose corresponding sections are garbage collected.
12165 (Symbol_table::Symbol_table): Add new parameter for the garbage
12166 collection object.
12167 (Symbol_table::gc_mark_undef_symbols): New function.
12168 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12169 (Symbol_table::gc_mark_dyn_syms): New function.
12170 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12171 as garbage.
12172 (Symbol_table::add_from_object): Likewise.
12173 (Symbol_table::add_from_relobj): When building shared objects, do not
12174 treat externally visible symbols as garbage.
12175 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12176 table information for static and relocatable links.
12177 * symtab.h (Symbol_table::set_gc): New function.
12178 (Symbol_table::gc): New function.
12179 (Symbol_table::gc_mark_undef_symbols): New function.
12180 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12181 (Symbol_table::gc_mark_dyn_syms): New function.
12182 (Symbol_table::gc_): New data member.
12183 * target.h (Sized_target::gc_process_relocs): New pure virtual
12184 function.
12185 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12186 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12187
12188 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
12189
12190 * options.h (General_options::gc_sections): Define as a no-op for now.
12191 (General_options::no_keep_memory): Ditto.
12192 (General_options::Bshareable): Define.
12193 * options.cc (General_options::finalize): Honor -Bshareable.
12194
12195 2009-01-20 Andreas Schwab <schwab@suse.de>
12196
12197 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12198 read the value in the contents, since we don't use it. Use the
12199 template endianness when writing.
12200 (Relocate::relocate): Use it for R_PPC_REL16_HA.
12201
12202 2009-01-19 Andreas Schwab <schwab@suse.de>
12203
12204 * configure.tgt (powerpc64-*): Fix targ_obj.
12205
12206 2009-01-15 Ian Lance Taylor <iant@google.com>
12207
12208 * object.cc (Sized_relobj::write_local_symbols): Don't write out
12209 local symbols when stripping all symbols.
12210
12211 2009-01-14 Cary Coutant <ccoutant@google.com>
12212
12213 * output.cc (Output_reloc): Add explicit instantiations.
12214
12215 2009-01-14 Cary Coutant <ccoutant@google.com>
12216
12217 * archive.cc (Archive::get_elf_object_for_member): Remove call
12218 to File_read::claim_for_plugin.
12219 * descriptors.cc (Descriptors::open): Remove reference to
12220 is_claimed.
12221 (Descriptors::claim_for_plugin): Remove.
12222 * descriptors.h (Descriptors::claim_for_plugin): Remove.
12223 (Descriptors::is_claimed): Remove.
12224 (claim_descriptor_for_plugin): Remove.
12225 * fileread.cc (File_read::claim_for_plugin): Remove.
12226 * fileread.h (File_read::claim_for_plugin): Remove.
12227 (File_read::descriptor): Reopen descriptor if necessary.
12228 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
12229 (Plugin_manager::all_symbols_read): Add task parameter. Change
12230 all callers.
12231 (Plugin_manager::get_input_file): New function.
12232 (Plugin_manager::release_input_file): New function.
12233 (Pluginobj::Pluginobj): Add filesize parameter and initialize
12234 corresponding data member.
12235 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12236 and pass to base constructor. Change all callers.
12237 (get_input_file, release_input_file): New functions.
12238 (make_sized_plugin_object): Add filesize parameter. Change all callers.
12239 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12240 (Plugin_manager::all_symbols_read): Add task parameter.
12241 (Plugin_manager::get_input_file): New function.
12242 (Plugin_manager::release_input_file): New function.
12243 (Plugin_manager::task_): New data member.
12244 (Pluginobj::Pluginobj): Add filesize parameter.
12245 (Pluginobj::filename): New function.
12246 (Pluginobj::descriptor): New function.
12247 (Pluginobj::filesize): New function.
12248 (Pluginobj::filesize_): New data member.
12249 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12250 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12251 File_read::claim_for_plugin; use Object::unlock to unlock the file.
12252
12253 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12254 with archive libraries.
12255 * testsuite/Makefile.in: Regenerate.
12256 * testsuite/plugin_test.c (struct sym_info): New type.
12257 (get_input_file, release_input_file): New static variables.
12258 (onload): Capture new transfer vector entries.
12259 (claim_file_hook): Stop reading at end of file according to filesize.
12260 Factor out parsing of readelf output into separate function.
12261 (all_symbols_read_hook): Exercise get_input_file and release_input_file
12262 APIs and get the source file name from the symbol table. Convert
12263 source file name to corresponding object file name. Print info
12264 message when adding new input files.
12265 (parse_readelf_line): New function.
12266 * testsuite/plugin_test_1.sh: Add checks for new info messages.
12267 * testsuite/plugin_test_2.sh: Likewise.
12268 * testsuite/plugin_test_3.sh: Likewise.
12269 * testsuite/plugin_test_4.sh: New test case.
12270
12271 2009-01-07 Ian Lance Taylor <iant@google.com>
12272
12273 * version.cc (version_string): Bump to 1.8.
12274
12275 2008-12-23 Cary Coutant <ccoutant@google.com>
12276
12277 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12278 * plugin.cc (Plugin_manager::finish): Rename as
12279 layout_deferred_objects. Move cleanup to separate function.
12280 (Plugin_manager::cleanup): New function.
12281 (Plugin_finish::run): Call layout_deferred_objects and cleanup
12282 separately.
12283 * plugin.h (Plugin_manager::finish): Rename as
12284 layout_deferred_objects.
12285 (Plugin_manager::cleanup): New function.
12286 (Plugin_manager::cleanup_done): New field.
12287
12288 2008-12-23 Cary Coutant <ccoutant@google.com>
12289
12290 * plugin.cc (is_visible_from_outside): New function.
12291 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12292 so we don't return "IR only" status for exported symbols or -r links.
12293
12294 * testsuite/Makefile.am (plugin_test_3): New test case.
12295 * testsuite/Makefile.in: Regenerate.
12296 * testsuite/plugin_test_3.sh: New file.
12297
12298 2008-12-22 Cary Coutant <ccoutant@google.com>
12299
12300 * object.cc (Sized_relobj::layout_section): New function.
12301 (Sized_relobj::do_layout): Defer layout of input sections until after
12302 plugin has provided replacement files.
12303 (Sized_relobj::do_layout_deferred_sections): New function.
12304 * object.h (Relobj::set_section_offset): Remove virtual keyword.
12305 (Relobj::layout_deferred_sections): New function.
12306 (Relobj::do_layout_deferred_sections): New function.
12307 (Sized_relobj::do_layout_deferred_sections): New function.
12308 (Sized_relobj::layout_section): New function.
12309 (Sized_relobj::Deferred_layout): New structure.
12310 (Sized_relobj::deferred_layout_): New field.
12311 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12312 Change all callers. Layout deferred sections.
12313 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
12314 references.
12315 (Plugin_hook::run): Move code from do_plugin_hook inline.
12316 (Plugin_hook::do_plugin_hook): Remove.
12317 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12318 (Plugin_manager::finish): Renamed, was cleanup.
12319 (Plugin_manager::should_defer_layout): New function.
12320 (Plugin_manager::add_deferred_layout_object): New function.
12321 (Plugin_manager::Deferred_layout_list): New type.
12322 (Plugin_manager::deferred_layout_objects_): New field.
12323 (Plugin_hook::do_plugin_hook): Remove.
12324
12325 2008-12-17 Ian Lance Taylor <iant@google.com>
12326
12327 * options.h (class General_options): Add --no case for
12328 --export-dynamic.
12329
12330 2008-12-16 Cary Coutant <ccoutant@google.com>
12331
12332 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12333 vector.
12334 (Plugin_manager::claim_file): Create plugin object even if
12335 plugin did not call the add_symbols callback.
12336 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12337 asking for more symbols than were added.
12338 * testsuite/Makefile.am (plugin_test_1): Add test case with
12339 no global symbols.
12340 (empty.syms): New target.
12341 * testsuite/Makefile.in: Regenerate.
12342 * testsuite/plugin_test.c (claim_file_hook): Add new debug
12343 message. Don't call add_symbols if no globals.
12344 (all_symbols_read_hook): Don't provide replacement for empty
12345 claimed file.
12346
12347 2008-12-12 Ian Lance Taylor <iant@google.com>
12348
12349 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12350 r_type == 0 for a local symbol with r_sym == 0.
12351 (scan_relocatable_relocs): Pass r_sym to
12352 local_non_section_strategy.
12353 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12354 r_sym parameter.
12355
12356 * configure.ac: Update test for TLS descriptors: they are
12357 supported as of glibc 2.9.
12358 * configure: Rebuild.
12359
12360 2008-12-11 Ian Lance Taylor <iant@google.com>
12361
12362 PR 7091
12363 * target-reloc.h (Default_scan_relocatable_relocs): For each
12364 function, map r_type == 0 to RELOC_DISCARD.
12365
12366 2008-12-10 Cary Coutant <ccoutant@google.com>
12367
12368 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12369 object to override a kept COMDAT group from a plugin object.
12370
12371 2008-12-09 Ian Lance Taylor <iant@google.com>
12372
12373 PR 7088
12374 * yyscript.y (file_cmd): Handle INPUT.
12375
12376 * testsuite/initpri1.c: Change all declarations to be full
12377 prototypes by adding void, to avoid compiler warnings.
12378
12379 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
12380
12381 * options.cc (General_options::parse_plugin_opt): New.
12382 (General_options::add_plugin): The argument now is just the filename.
12383 (General_options::add_plugin_option): New.
12384 * options.h (plugin_opt): New.
12385 (add_plugin): Change argument name.
12386 (add_plugin_option): New.
12387 * plugin.cc (Plugin::load): Don't parse the plugin option.
12388 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12389 (Plugin::add_option): New.
12390 (Plugin::args_): Change type.
12391 (Plugin::filename_): New.
12392 (Plugin_manager::add_plugin_option): New.
12393 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12394 * testsuite/Makefile.in: Regenerate.
12395
12396 2008-12-05 Cary Coutant <ccoutant@google.com>
12397
12398 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12399 Handle --strip-lto-sections option.
12400 * options.h (strip_lto_sections): New option.
12401
12402 2008-12-01 Cary Coutant <ccoutant@google.com>
12403
12404 * plugin.cc (ld_plugin_message): Change format parameter to const.
12405 Fix mismatch between new[] and delete.
12406
12407 2008-11-14 Cary Coutant <ccoutant@google.com>
12408
12409 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12410 instead of -1U.
12411
12412 2008-11-05 Craig Silverstein <csilvers@google.com>
12413
12414 * options.cc (General_options::parse_dynamic_list): New function.
12415 * options.h (General_options): New flags dynamic_list,
12416 dynamic_list_data, dynamic_list_cpp_new, and
12417 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
12418 (General_options::in_dynamic_list): New function.
12419 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12420 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12421 (Lex::can_continue_name): Likewise.
12422 (yylex): Likewise.
12423 (read_script_file): New parameter script_options.
12424 (read_dynamic_list): New function.
12425 (Script_options::define_dynamic_list): New function.
12426 (dynamic_list_keyword_parsecodes): New variable.
12427 (dynamic_list_keywords): New variable.
12428 * script.h (Script_options::define_dynamic_list): New function
12429 prototype.
12430 (read_dynamic_list): New function prototype.
12431 * symtab.cc (strprefix): New macro.
12432 (Symbol::should_add_dynsym_entry): Support dynamic_list,
12433 dynamic_list_data, dynamic_list_cpp_new, and
12434 dynamic_list_cpp_typeinfo.
12435 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12436 (dynamic_list_expr): New rule.
12437 (dynamic_list_nodes): Likewise.
12438 (dynamic_list_node): Likewise.
12439 * testsuite/Makefile.am (dynamic_list): New test.
12440 * testsuite/Makefile.in: Regenerated.
12441 * testsuite/dynamic_list.t: New file.
12442 * testsuite/dynamic_list.sh: New file.
12443
12444 2008-11-05 Craig Silverstein <csilvers@google.com>
12445
12446 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12447 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12448 (t11_last): Likewise.
12449 * testsuite/ver_test_6.c (main): Likewise.
12450
12451 2008-10-07 Cary Coutant <ccoutant@google.com>
12452
12453 * options.c (General_options::finalize): Add check for -static and
12454 -shared.
12455 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12456 is not empty.
12457
12458 2008-10-02 Cary Coutant <ccoutant@google.com>
12459
12460 * plugin.cc (make_sized_plugin_object): Fix conditional
12461 compilation to work when not all targets are enabled.
12462
12463 2008-09-29 Cary Coutant <ccoutant@google.com>
12464
12465 * archive.cc (Archive::get_file_and_offset): Use filename instead
12466 of name to get library path.
12467 (Archive::include_member): Unlock external member of a thin archive.
12468
12469 * testsuite/Makefile.am (TEST_AR): New variable.
12470 (thin_archive_test_1): New test.
12471 (thin_archive_test_2): New test.
12472 * testsuite/Makefile.in: Regenerate.
12473 * testsuite/thin_archive_main.cc: New file.
12474 * testsuite/thin_archive_test_1.cc: New file.
12475 * testsuite/thin_archive_test_2.cc: New file.
12476 * testsuite/thin_archive_test_3.cc: New file.
12477 * testsuite/thin_archive_test_4.cc: New file.
12478
12479 2008-09-29 Cary Coutant <ccoutant@google.com>
12480
12481 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12482 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12483 instead of -1U.
12484 (Sized_relobj::do_finalize_local_symbols): Likewise.
12485 (Sized_relobj::map_to_kept_section): Likewise.
12486 * object.h (Sized_relobj::invalid_address): New constant.
12487 (Sized_relobj::do_output_section_offset): Check for invalid_address
12488 and return -1ULL.
12489 * output.cc (Output_reloc::local_section_offset): Use constant
12490 invalid_address instead of -1U.
12491 (Output_reloc::get_address): Likewise.
12492 (Output_section::output_address): Change -1U to -1ULL.
12493 * output.h (Output_reloc::invalid_address): New constant.
12494 * reloc.cc (Sized_relobj::write_sections): Use constant
12495 invalid_address instead of -1U.
12496 (Sized_relobj::relocate_sections): Likewise.
12497 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12498 values for merge sections.
12499 * target-reloc.h (relocate_for_relocatable): Use constant
12500 invalid_address instead of -1U.
12501
12502 2008-09-19 Cary Coutant <ccoutant@google.com>
12503
12504 Add plugin functionality for link-time optimization (LTO).
12505 * configure.ac (plugins): Add --enable-plugins option.
12506 * configure: Regenerate.
12507 * config.in: Regenerate.
12508 * Makefile.am (LIBDL): New variable.
12509 (CCFILES): Add plugin.cc.
12510 (HFILES): Add plugin.h.
12511 (ldadd_var): Add LIBDL.
12512 * Makefile.in: Regenerate.
12513
12514 * archive.cc: Include "plugin.h".
12515 (Archive::setup): Don't preread archive symbols when using a plugin.
12516 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
12517 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12518 files.
12519 (Archive::include_member): Add symbols from plugin objects.
12520 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12521 * descriptors.cc (Descriptors::open): Check for file descriptors
12522 abandoned by plugins.
12523 (Descriptors::claim_for_plugin): New function.
12524 * descriptors.h (Descriptors::claim_for_plugin): New function.
12525 (Open_descriptor::is_claimed): New field.
12526 (claim_descriptor_for_plugin): New function.
12527 * fileread.cc (File_read::claim_for_plugin): New function.
12528 * fileread.h (File_read::claim_for_plugin): New function.
12529 (File_read::descriptor): New function.
12530 * gold.cc: Include "plugin.h".
12531 (queue_initial_tasks): Add task to call plugin hooks for generating
12532 new object files.
12533 * main.cc: Include "plugin.h".
12534 (main): Load plugin libraries.
12535 * object.h (Pluginobj): Declare.
12536 (Object::pluginobj): New function.
12537 (Object::do_pluginobj): New function.
12538 (Object::set_target): New function.
12539 * options.cc: Include "plugin.h".
12540 (General_options::parse_plugin): New function.
12541 (General_options::General_options): Initialize plugins_ field.
12542 (General_options::add_plugin): New function.
12543 * options.h (Plugin_manager): Declare.
12544 (General_options): Add --plugin option.
12545 (General_options::has_plugins): New function.
12546 (General_options::plugins): New function.
12547 (General_options::add_plugin): New function.
12548 (General_options::plugins_): New field.
12549 * plugin.cc: New file.
12550 * plugin.h: New file.
12551 * readsyms.cc: Include "plugin.h".
12552 (Read_symbols::do_read_symbols): Check for archive before checking
12553 for ELF file. Call plugin hooks to claim files.
12554 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12555 from a real object file; force override when processing replacement
12556 files.
12557 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12558 (Symbol::init_base_object): Likewise.
12559 (Symbol::init_base_output_data): Likewise.
12560 (Symbol::init_base_output_segment): Likewise.
12561 (Symbol::init_base_constant): Likewise.
12562 (Symbol::init_base_undefined): Likewise.
12563 (Symbol::output_section): Assert that object is not a plugin.
12564 (Symbol_table::add_from_pluginobj): New function.
12565 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12566 undefined.
12567 (Symbol_table::sized_write_globals): Likewise.
12568 (Symbol_table::add_from_pluginobj): Instantiate template.
12569 * symtab.h (Sized_pluginobj): Declare.
12570 (Symbol::in_real_elf): New function.
12571 (Symbol::set_in_real_elf): New function.
12572 (Symbol::in_real_elf_): New field.
12573 (Symbol_table::add_from_pluginobj): New function.
12574
12575 * testsuite/Makefile.am (AM_CFLAGS): New variable.
12576 (LIBDL): New variable.
12577 (LDADD): Add LIBDL.
12578 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12579 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12580 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12581 (MOSTLYCLEANFILES): Likewise.
12582 * testsuite/Makefile.in: Regenerate.
12583 * testsuite/plugin_test.c: New file.
12584 * testsuite/plugin_test_1.sh: New file.
12585 * testsuite/plugin_test_2.sh: New file.
12586
12587 2008-09-16 Ian Lance Taylor <iant@google.com>
12588
12589 * target-reloc.h (relocate_section): Check whether a symbol is
12590 defined by the ABI before reporting an undefined symbol error.
12591 * target.h (Target::is_defined_by_abi): Make parameter const.
12592 (Target::do_is_defined_by_abi): Likewise.
12593 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12594 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12595 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12596 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12597 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12598 * testsuite/Makefile.in: Rebuild.
12599
12600 * fileread.cc (make_view): Add casts to avoid warning.
12601
12602 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12603
12604 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12605 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12606
12607 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12608
12609 * options.h (General_options::output_is_executable): New.
12610 (General_options::output_is_pie): New.
12611 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12612 for shared libraries.
12613 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12614
12615 2008-09-11 Chris Demetriou <cgd@google.com>
12616
12617 * options.h (origin): New -z option.
12618 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12619 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12620 in DT_FLAGS_1.
12621
12622 2008-09-05 Cary Coutant <ccoutant@google.com>
12623
12624 * fileread.cc (File_read::make_view): Add check for attempt to map
12625 beyond end of file.
12626
12627 2008-09-05 Cary Coutant <ccoutant@google.com>
12628
12629 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12630 explicit instantiations.
12631
12632 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
12633
12634 PR gold/6858
12635 * options.cc (General_options::finalize): Allow undefined symbols
12636 in shlibs if linking -shared.
12637
12638 PR gold/6859
12639 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12640 symbols as not needing a dynsym entry.
12641
12642 2008-08-20 Craig Silverstein <csilvers@google.com>
12643
12644 * fileread.cc (File_read::open): Do not lock the file unless it
12645 was successfully opened.
12646
12647 2008-08-14 Cary Coutant <ccoutant@google.com>
12648
12649 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12650 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12651 * testsuite/tls_test.cc (struct int128): 128-bit struct
12652 for testing TLS relocs with non-zero addend.
12653 (v12): New TLS variable.
12654 (t12): New test.
12655 (t_last): Add check for v12.
12656 * testsuite/tls_test.h (t12): New function.
12657 * testsuite/tls_test_main.cc (thread_routine): Call new test.
12658
12659 2008-08-13 Ian Lance Taylor <iant@google.com>
12660
12661 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12662 set tls_segment_ or relro_segment_.
12663 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12664 when appropriate.
12665 * output.h (Output_section::clear_is_relro): New function.
12666 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12667 sections specially even when output_data_ is empty.
12668 (Output_segment::maximum_alignment): When first section is relro,
12669 only force alignment for PT_LOAD segments.
12670 * script.cc (script_data_segment_align): New function.
12671 (script_data_segment_relro_end): New function.
12672 * script-c.h (script_data_segment_align): Declare.
12673 (script_data_segment_relro_end): Declare.
12674 * script-sections.h (class Script_sections): Declare
12675 data_segment_align and data_segment_relro_end. Add fields
12676 segment_align_index_ and saw_relro_end_.
12677 * script-sections.cc (class Sections_element): Add set_is_relro
12678 virtual function. Add new bool* parameter to place_orphan_here.
12679 Add get_output_section virtual function.
12680 (class Output_section_definition): Add set_is_relro. Add new
12681 bool* parameter to place_orphan_here. Add get_output_section.
12682 Add is_relro_ field.
12683 (Output_section_definition::Output_section_definition): Initialize
12684 evaluated_address_, evaluated_load_address, evaluated_addralign_,
12685 and is_relro_ fields.
12686 (Output_section_definition::place_orphan_here): Add is_relro
12687 parameter.
12688 (Output_section_definition::set_section_addresses): Set relro for
12689 output section.
12690 (Output_section_definition::alternate_constraint): Likewise.
12691 (class Orphan_output_section): Add new bool* parameter to
12692 place_orphan_here. Add get_output_section.
12693 (Orphan_output_section::place_orphan_here): Add is_relro
12694 parameter.
12695 (Script_sections::Script_sections): Initialize
12696 data_segment_align_index_ and saw_relro_end_.
12697 (Script_sections::data_segment_align): New function.
12698 (Script_sections::data_segment_relro_end): New function.
12699 (Script_sections::place_orphan): Set or clear is_relro.
12700 (Script_sections::set_section_addresses): Force alignment of first
12701 TLS section.
12702 * yyscript.y (exp): Call script_data_segment_align and
12703 script_data_segment_relro_end.
12704 * testsuite/relro_script_test.t: New file.
12705 * testsuite/relro_test.cc (using_script): Declare.
12706 (t1, t2): Test using_script.
12707 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12708 (relro_script_test_SOURCES): Define.
12709 (relro_script_test_DEPENDENCIES): Define.
12710 (relro_script_test_LDFLAGS): Define.
12711 (relro_script_test_LDADD): Define.
12712 (relro_script_test.so): New target.
12713 * testsuite/Makefile.in: Rebuild.
12714
12715 2008-08-06 Cary Coutant <ccoutant@google.com>
12716
12717 * archive.cc (Archive::total_archives, Archive::total_members)
12718 (Archive::total_members_loaded): New variables.
12719 (Archive::setup): Add parameter. Add option to preread
12720 archive symbols.
12721 (Archive::read_armap): Add counter.
12722 (Archive::get_file_and_offset): New function.
12723 (Archive::get_elf_object_for_member): New function.
12724 (Archive::read_all_symbols): New function.
12725 (Archive::read_symbols): New function.
12726 (Archive::add_symbols): Add counters.
12727 (Archive::include_all_members): Use armap to find members if it's
12728 already built.
12729 (Archive::include_member): Skip reading symbols if already read.
12730 Factored code into Archive::get_file_and_offset and
12731 Archive::get_elf_object_for_member. Changed call to
12732 Mapfile::report_include_archive_member.
12733 (Archive::print_stats): New function.
12734 * archive.h: Declare Object and Read_symbols_data classes.
12735 (Archive::Archive): Add initializers for new members.
12736 (Archive::setup): Add parameter.
12737 (Archive::print_stats): New function.
12738 (Archive::total_archives, Archive::total_members)
12739 (Archive::total_members_loaded): New variables.
12740 (Archive::get_file_and_offset): New function.
12741 (Archive::get_elf_object_for_member): New function.
12742 (Archive::read_all_symbols): New function.
12743 (Archive::read_symbols): New function.
12744 (Archive::Archive_member): New class.
12745 (Archive::members_): New member.
12746 (Archive::num_members_): New member.
12747 * main.cc: Include archive.h.
12748 (main): Call Archive::print_stats.
12749 * mapfile.cc (Mapfile::report_include_archive_member): Delete
12750 archive parameter; member_name is now the fully-decorated name.
12751 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12752 * options.h: (General_options): Add --preread-archive-symbols option.
12753 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12754 Archive::setup.
12755
12756 2008-08-04 Ian Lance Taylor <iant@google.com>
12757
12758 * symtab.h (Symbol::use_plt_offset): New function.
12759 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12760 * powerpc.cc (Relocate::relocate): Likewise.
12761 * sparc.cc (Relocate::relocate): Likewise.
12762 * x86_64.cc (Relocate::relocate): Likewise.
12763 * testsuite/weak_plt.sh: New test.
12764 * testsuite/weak_plt_main.cc: New test.
12765 * testsuite/weak_plt_shared.cc: New test.
12766 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12767 (check_PROGRAMS): Add weak_plt.
12768 (check_DATA): Add weak_plt_shared.so.
12769 (weak_plt_main_pic.o, weak_plt): New targets.
12770 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12771 * testsuite/Makefile.in: Rebuild.
12772
12773 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12774 gcctestdir/ld.
12775 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12776 * testsuite/Makefile.in: Rebuild.
12777
12778 2008-08-04 Alan Modra <amodra@bigpond.net.au>
12779
12780 * Makefile.am (POTFILES.in): Set LC_ALL=C.
12781 * Makefile.in: Regenerate.
12782 * po/POTFILES.in: Regenerate.
12783
12784 2008-07-29 Ian Lance Taylor <iant@google.com>
12785
12786 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12787 symbols before other symbols.
12788 * testsuite/script_test_2.cc (test_addr): Declare.
12789 (test_addr_alias): Declare.
12790 (main): Check that test_addr and test_addr_alias have the right
12791 values.
12792 * testsuite/script_test_2.t: Define test_addr_alias and
12793 test_addr.
12794
12795 2008-07-24 Ian Lance Taylor <iant@google.com>
12796
12797 PR 5990
12798 * descriptors.cc: New file.
12799 * descriptors.h: New file.
12800 * gold-threads.h (class Hold_optional_lock): New class.
12801 * fileread.cc: Include "descriptors.h".
12802 (File_read::~File_read): Release descriptor rather than closing
12803 it.
12804 (File_read::open) [file]: Call open_descriptor rather than open.
12805 Set is_descriptor_opened_.
12806 (File_read::open) [memory]: Assert that descriptor is not open.
12807 (File_read::reopen_descriptor): New function.
12808 (File_read::release): Release descriptor.
12809 (File_read::do_read): Make non-const. Reopen descriptor.
12810 (File_read::read): Make non-const.
12811 (File_read::make_view): Reopen descriptor.
12812 (File_read::do_readv): Likewise.
12813 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12814 Update declarations.
12815 * layout.cc: Include "descriptors.h".
12816 (Layout::create_build_id): Use open_descriptor rather than open.
12817 * output.cc: Include "descriptors.h".
12818 (Output_file::open): Use open_descriptor rather than open.
12819 * archive.cc (Archive::const_iterator): Change Archive to be
12820 non-const.
12821 (Archive::begin, Archive::end): Make non-const.
12822 (Archive::count_members): Likewise.
12823 * archive.h (class Archive): Update declarations.
12824 * object.h (Object::read): Make non-const.
12825 * Makefile.am (CCFILES): Add descriptors.cc.
12826 (HFILES): Add descriptors.h.
12827 * Makefile.in: Rebuild.
12828
12829 PR 6716
12830 * gold.h: Always include <clocale>. Add Solaris workarounds
12831 following code in binutils/sysdep.h.
12832
12833 PR 6048
12834 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12835 this->eh_frame_hdr_ is NULL before using it.
12836
12837 * dynobj.cc (Versions::Versions): Update comment.
12838
12839 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12840 the base version name.
12841
12842 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12843 array size plus one.
12844 (Stringpool_template::set_string_offsets): Subtract one from key
12845 before using it as an array index.
12846 (Stringpool_template::get_offset_with_length): Likewise.
12847 (Stringpool_template::write_to_buffer): Likewise.
12848 * stringpool.h (Stringpool_template::get_offset_from_key):
12849 Likewise.
12850
12851 2008-07-23 Ian Lance Taylor <iant@google.com>
12852
12853 PR 6658
12854 * object.h (Merged_symbol_value::value): Do our best to handle a
12855 negative addend.
12856
12857 PR 6647
12858 * script.cc (Version_script_info::get_versions): Don't add empty
12859 version tag to return value.
12860 (Version_script_info::get_symbol_version_helper): Change return
12861 type to bool. Add pversion parameter. Change all callers.
12862 (script_register_vers_node): Don't require a non-NULL tag.
12863 * script.h (class Version_script_info): Update declarations.
12864 (Version_script_info::get_symbol_version): Change return type to
12865 bool. Add version parameter. Change all callers.
12866 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12867 handling. Handle an empty version from a version script.
12868 (Symbol_table::define_special_symbol): Likewise.
12869 * testsuite/ver_test_10.script: New file.
12870 * testsuite/ver_test_10.sh: New file.
12871 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12872 (check_DATA): Add ver_test_10.syms.
12873 (ver_test_10.syms, ver_test_10.so): New target.
12874 * testsuite/Makefile.in: Rebuild.
12875
12876 2008-07-23 Simon Baldwin <simonb@google.com>
12877
12878 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12879 to zero for undefined symbols from dynamic libraries.
12880
12881 2008-07-23 Ian Lance Taylor <iant@google.com>
12882
12883 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12884 Change all callers.
12885 * symtab.h (class Symbol_table): Update declaration.
12886 * testsuite/ver_test_9.cc: New file.
12887 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12888 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12889 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12890 (ver_test_9.so, ver_test_9.o): New targets.
12891 * testsuite/Makefile.in: Rebuild.
12892
12893 2008-07-22 Ian Lance Taylor <iant@google.com>
12894
12895 * options.h (class General_options): Define --check-sections.
12896 * layout.cc (Layout::set_segment_offsets): Handle
12897 --check-sections.
12898
12899 * options.h (class General_options): Define -n/--nmagic and
12900 -N/--omagic.
12901 * options.cc (General_options::finalize): For -n/--nmagic or
12902 -N/--omagic, set -static.
12903 * layout.cc (Layout::attach_allocated_section_to_segment): If
12904 -N/--omagic, don't put read-only and read-write sections in
12905 different segments.
12906 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12907 finding a read-only segment.
12908 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12909 don't set the minimum segment alignment to the common page size,
12910 and don't set the file offset to the address modulo the page size.
12911 * script-sections.cc (Script_sections::create_segments): If
12912 -n/--omagic, don't put read-only and read-write sections in
12913 different segments.
12914
12915 * cref.cc: New file.
12916 * cref.h: New file.
12917 * options.h (class General_options): Add --print-symbol-counts.
12918 * main.cc (main): Issue defined symbol report if requested.
12919 * archive.cc (Archive::interpret_header): Make into a const member
12920 function.
12921 (Archive::add_symbols): Call Input_objects::archive_start and
12922 archive_stop.
12923 (Archive::const_iterator): Define new class.
12924 (Archive::begin, Archive::end): New functions.
12925 (Archive::include_all_members): Rewrite to use iterator.
12926 (Archive::count_members): New function.
12927 * archive.h (class Archive): Update declarations.
12928 (Archive::filename): New function.
12929 * object.cc: Include "cref.h".
12930 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12931 (Sized_relobj::do_get_global_symbol_counts): New function.
12932 (Input_objects::add_object): Add object to cross-referencer.
12933 (Input_objects::archive_start): New function.
12934 (Input_objects::archive_stop): New function.
12935 (Input_objects::print_symbol_counts): New function.
12936 * object.h: Declare Cref and Archive.
12937 (Object::get_global_symbol_counts): New function.
12938 (Object::do_get_global_symbol_counts): New pure virtual function.
12939 (class Sized_relobj): Add defined_count_ field. Update
12940 declarations.
12941 (class Input_objects): Add cref_ field. Update constructor.
12942 Update declarations.
12943 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12944 defined_count_.
12945 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12946 symbol counts.
12947 (Sized_dynobj::do_get_global_symbol_counts): New function.
12948 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12949 defined_count_. Update declarations. Define Symbols typedef.
12950 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12951 parameter. Change all callers.
12952 (Symbol_table::add_from_dynobj): Add sympointers and defined
12953 parameters. Change all callers.
12954 * symtab.h (class Symbol_table): Update declarations.
12955 * Makefile.am (CCFILES): Add cref.cc.
12956 (HFILES): Add cref.h.
12957 * Makefile.in: Rebuild.
12958
12959 2008-07-22 Simon Baldwin <simonb@google.com>
12960
12961 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12962 to zero when writing undefined symbols.
12963
12964 2008-07-22 Ian Lance Taylor <iant@google.com>
12965
12966 * output.cc (Output_section::add_input_section): Don't try to
12967 merge empty merge sections.
12968
12969 2008-07-21 Craig Silverstein <csilvers@google.com>
12970
12971 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12972 Include symbol version in error message.
12973
12974 2008-07-20 Chris Demetriou <cgd@google.com>
12975
12976 * configure.ac (gold_cv_c_random_seed): New configured variable.
12977 (RANDOM_SEED_CFLAGS): New substituted variable.
12978 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12979 * configure: Rebuild.
12980 * Makefile.in: Likewise.
12981 * testsuite/Makefile.in: Likewise.
12982
12983 2008-07-18 Ian Lance Taylor <iant@google.com>
12984
12985 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12986 where we see NAME/NULL and NAME/VERSION as separate symbols.
12987 * testsuite/ver_test_main.cc (main): Call t4.
12988 (t4, t4_2a): Define.
12989 * testsuite/ver_test_2.cc (t4_2): Define.
12990 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12991 * testsuite/ver_test_4.cc (t4_2a): Define.
12992 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12993 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12994
12995 2008-07-17 Ian Lance Taylor <iant@google.com>
12996
12997 * dynobj.cc (Versions::add_def): If we give an error about a
12998 missing version, go ahead and create the version anyhow.
12999
13000 2008-07-10 Ian Lance Taylor <iant@google.com>
13001
13002 Handle output sections with more than 0x7fffffff bytes.
13003 * object.h (class Relobj): Change map_to_output_ to
13004 output_sections_, and just keep a section pointer. Change all
13005 uses. Move comdat group support to Sized_relobj.
13006 (Relobj::is_section_specially_mapped): Remove.
13007 (Relobj::output_section): Remove poff parameter. Change all
13008 callers.
13009 (Relobj::output_section_offset): New function.
13010 (Relobj::set_section_offset): Rewrite.
13011 (Relobj::map_to_output): Remove.
13012 (Relobj::output_sections): New function.
13013 (Relobj::do_output_section_offset): New pure virtual function.
13014 (Relobj::do_set_section_offset): Likewise.
13015 (class Sized_relobj): Add section_offsets_ field. Add comdat
13016 group support from Relobj. Update declarations.
13017 (Sized_relobj::get_output_section_offset): New function.
13018 (Sized_relobj::do_output_section_offset): New function.
13019 (Sized_relobj::do_set_section_offset): New function.
13020 * object.cc (Relobj::output_section_address): Remove.
13021 (Sized_relobj::Sized_relobj): Initialize new fields.
13022 (Sized_relobj::include_section_group): Cast find_kept_object to
13023 Sized_relobj.
13024 (Sized_relobj::include_linkonce_section): Likewise.
13025 (Sized_relobj::do_layout): Use separate arrays for output section
13026 and output offset.
13027 (Sized_relobj::do_count_local_symbols): Change map_to_output to
13028 output_sections.
13029 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13030 output_sections and section_offsets.
13031 (Sized_relobj::write_local_symbols): Likewise.
13032 (map_to_kept_section): Compute output address directly.
13033 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13034 output_sections and section_offsets.
13035 (Sized_relobj::write_sections): Likewise.
13036 (Sized_relobj::relocate_sections): Likewise.
13037 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13038 * output.h (class Output_reloc): Update declarations. Change
13039 u2_.relobj to Sized_relobj*.
13040 (class Output_data_reloc): Change add functions to use
13041 Sized_relobj*.
13042 * output.cc (Output_reloc::Output_reloc): Change relobj to
13043 Sized_relobj*.
13044 (Output_reloc::local_section_offset): Change return type to
13045 Elf_Addr. Use get_output_section_offset.
13046 (Output_reloc::get_address): Likewise.
13047 (Output_section::is_input_address_mapped): Don't call
13048 is_section_specially_mapped.
13049 (Output_section::output_offset): Likewise.
13050 (Output_section::output_address): Likewise.
13051 (Output_section::starting_output_address): Likewise.
13052 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13053 parameter to Sized_relobj*.
13054 (Copy_relocs::need_copy_reloc): Likewise.
13055 (Copy_relocs::save): Likewise.
13056 * copy-relocs.h (class Copy_relocs): Update declarations.
13057 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13058 Sized_relobj*. Change relobj_ field to Sized_relobj*.
13059 * target-reloc.h (relocate_for_relocatable): Change
13060 offset_in_output_section type to Elf_Addr. Change code that uses
13061 it as well.
13062 * layout.cc (Layout::layout): Always set *off.
13063 * mapfile.cc (Mapfile::print_input_section): Use
13064 output_section_offset.
13065 * i386.cc (Target_i386::copy_reloc): Change object parameter to
13066 Sized_relobj*.
13067 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13068 * sparc.cc (Target_sparc::copy_reloc): Likewise.
13069 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13070
13071 2008-07-03 Ian Lance Taylor <iant@google.com>
13072
13073 * layout.cc (Layout::include_section): Do not discard unrecognized
13074 SHT_STRTAB sections.
13075
13076 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
13077
13078 * script.cc (Lex::can_continue_name): Make '?' allowable in
13079 version-script names.
13080 * testsuite/version_script.map: Change glob pattern to use '?'
13081
13082 2008-06-30 Manish Singh <yosh@gimp.org>
13083
13084 PR 6585
13085 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13086 Correct typo.
13087
13088 2008-06-30 Ian Lance Taylor <iant@google.com>
13089
13090 PR 6660
13091 PR 6682
13092 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13093 versions]: Don't try to read the value in the contents, since we
13094 don't use it. Use the template endianness when writing.
13095
13096 2008-06-25 Cary Coutant <ccoutant@google.com>
13097
13098 * fileread.cc (File_read::make_view): Assert on zero-length view.
13099 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13100 symbol table when there are no symbols to read.
13101
13102 2008-06-23 Craig Silverstein <csilvers@google.com>
13103
13104 * version.cc (version_string): Bump to 1.7
13105
13106 2008-06-18 Craig Silverstein <csilvers@google.com>
13107
13108 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13109 constant 0xFFFF to type Valtype.
13110 (Powerpc_relocate_functions::rel16_ha): Likewise.
13111
13112 2008-06-17 Ian Lance Taylor <iant@google.com>
13113
13114 * output.h (Output_section::Input_section): Initialize p2align_ to
13115 zero for Output_section_data constructors.
13116 (Output_section::Input_section::addralign): If not an input
13117 section, return the alignment of the Output_section_data.
13118 * testsuite/copy_test.cc: New file.
13119 * testsuite/copy_test_1.cc: New file.
13120 * testsuite/copy_test_2.cc: New file.
13121 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13122 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13123 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13124 (copy_test_1_pic.o, copy_test_1.so): New targets.
13125 (copy_test_2_pic.o, copy_test_2.so): New targets.
13126 * testsuite/Makefile.in: Rebuild.
13127
13128 * script-sections.cc (Script_sections::place_orphan): Initialize
13129 local variable exact.
13130
13131 2008-06-13 David Edelsohn <edelsohn@gnu.org>
13132
13133 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13134
13135 2008-06-12 David Edelsohn <edelsohn@gnu.org>
13136 David S. Miller <davem@davemloft.net>
13137
13138 * powerpc.cc: New file.
13139 * Makefile.am (TARGETSOURCES): Add powerpc.cc
13140 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13141 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13142 * Makefile.in: Rebuild.
13143
13144 2008-06-09 Ian Lance Taylor <iant@google.com>
13145
13146 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13147 <exception>.
13148 (throwing, orig_terminate): New static variables.
13149 (terminate_handler): New static function.
13150 (t2): Set terminate handler.
13151
13152 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
13153
13154 PR 6584
13155 * binary.cc (Binary_to_elf::sized_convert): Fix .data
13156 alignment.
13157
13158 2008-05-30 Cary Coutant <ccoutant@google.com>
13159
13160 * archive.cc (Archive::include_all_members) Correct to step
13161 over symbol table and extended name table in thin archives.
13162
13163 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
13164
13165 PR 6407
13166 * target-reloc.h (relocate_for_relocatable): Fix new_offset
13167 calculation.
13168
13169 2008-05-28 Caleb Howe <cshowe@google.com>
13170
13171 * reduced_debug_output.cc: New file.
13172 * reduced_debug_output.h: New file.
13173 * options.h (class General_options): Add --strip-debug-non-line.
13174 * options.cc (General_options::finalize): Add strip_debug_non_line
13175 to the strip heirarchy.
13176 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13177 fields.
13178 * layout.cc: Include "reduced_debug_output.h".
13179 (Layout::Layout): Initialize new fields.
13180 (line_only_debug_sections): New static array.
13181 (is_lines_only_debug_sections): New static inline function.
13182 (Layout::include_section): Handle --strip-debug-non-line.
13183 (Layout::make_output_section): If --strip-debug-non-line, build
13184 new output sections for .debug_abbrev and .debug_info.
13185 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13186 gold. Warn about possible overflow.
13187 (read_signed_LEB_128): Likewise.
13188 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13189 (read_signed_LEB_128): Declare.
13190 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13191 (HFILES): Add reduced_debug_output.h.
13192 * Makefile.in: Rebuild.
13193
13194 2008-05-21 Ian Lance Taylor <iant@google.com>
13195
13196 * mapfile.cc: New file.
13197 * mapfile.h: New file.
13198 * options.h (class General_options): Add -M/--print-map and -Map.
13199 * options.cc (General_options::finalize): Make -M equivalent to
13200 -Map -.
13201 * main.cc: Include <cstdio> and "mapfile.h".
13202 (main): Open mapfile if requested.
13203 * gold.cc (class Middle_runner): Add mapfile_ field. Update
13204 constructor. Change caller.
13205 (queue_initial_tasks): Add mapfile parameter. Change caller.
13206 (queue_middle_tasks): Likewise.
13207 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13208 declarations.
13209 * archive.cc: Include "mapfile.h".
13210 (Archive::add_symbols): Add mapfile parameter. Change all
13211 callers. Pass mapfile, symbol, and reason to include_member.
13212 (Archive::include_all_members): Add mapfile parameter. Change all
13213 callers.
13214 (Archive::include_member): Add mapfile, sym, and why parameters.
13215 Change all callers. Report inclusion to map file.
13216 * archive.h: Include "fileread.h".
13217 (class Archive): Update declarations.
13218 (Archive::file): New const method.
13219 (class Add_archive_symbols): Add mapfile_ field. Update
13220 constructor. Change all callers.
13221 * readsyms.h (class Read_symbols): Likewise.
13222 (class Finish_group): Likewise.
13223 (class Read_script): Likewise.
13224 * common.cc: Include "mapfile.h".
13225 (Symbol_table::allocate_commons): Add mapfile parameter. Change
13226 all callers.
13227 (Symbol_table::do_allocate_commons): Likewise.
13228 (Symbol_table::do_allocate_commons_list): Likewise. Report common
13229 symbol allocation to mapfile.
13230 * common.h (class Allocate_commons_task): Add mapfile_ field.
13231 Update constructor. Change all callers.
13232 * symtab.h (class Symbol_table): Update declarations.
13233 * layout.cc: Include "mapfile.h".
13234 (Layout_task_runner::run): Print information to mapfile.
13235 (Layout::create_gold_note): Change Output_data_fixed_space to
13236 Output_data_zero_fill.
13237 (Layout::create_build_id): Likewise.
13238 (Layout::print_to_mapfile): New function.
13239 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
13240 constructor. Change caller.
13241 (class Layout): Declare print_to_mapfile.
13242 * output.cc (Output_section::Input_section::print_to_mapfile): New
13243 function.
13244 (Output_section::add_input_section): If producing a map, always
13245 add to input_sections_ list.
13246 (Output_section::do_print_to_mapfile): New function.
13247 (Output_segment::print_sections_to_mapfile): New function.
13248 (Output_segment::print_section_list_to_mapfile): New function.
13249 * output.h: Include "mapfile.h".
13250 (Output_data::print_to_mapfile): New function.
13251 (Output_data::do_print_to_mapfile): New virtual function.
13252 (Output_segment_headers::do_print_to_mapfile): New function.
13253 (Output_file_header::do_print_to_mapfile): New function.
13254 (Output_data_const::do_print_to_mapfile): New function.
13255 (class Output_data_const_buffer): Add map_name_ field. Update
13256 constructor. Change all callers. Add do_print_to_mapfile
13257 function.
13258 (class Output_data_fixed_space): Likewise.
13259 (class Output_data_space): Likewise.
13260 (class Output_data_zero_fill): New class.
13261 (Output_data_strtab::do_print_to_mapfile): New function.
13262 (Output_data_reloc_base::do_print_to_mapfile): New function.
13263 (Output_relocatable_relocs::do_print_to_mapfile): New function.
13264 (Output_data_group::do_print_to_mapfile): New function.
13265 (Output_data_got::do_print_to_mapfile): New function.
13266 (Output_data_dynamic::do_print_to_mapfile): New function.
13267 (Output_symtab_xindex::do_print_to_mapfile): New function.
13268 (class Output_section): Declare do_print_to_mapflie. Declare
13269 print_to_mapfile in Input_section.
13270 (class Output_segment): Declare new functions.
13271 * object.h (Sized_relobj::symbol_count): New function.
13272 * script-sections.cc
13273 (Output_section_element_dot_assignment::set_section_addresses):
13274 Change Output_data_fixed_space to Output_data_zero_fill.
13275 (Output_data_expression::do_print_to_mapfile): New function.
13276 * script.cc (read_input_script): Add mapfile parameter. Change
13277 all callers.
13278 * script.h (read_input_script): Update declaration.
13279 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13280 (Eh_frame::do_print_to_mapfile): New function.
13281 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13282 (Output_merge_string::do_print_to_mapfile): New function.
13283 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13284 function.
13285 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13286 function.
13287 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13288 function.
13289 * Makefile.am (CCFILES): Add mapfile.cc.
13290 (HFILES): Add mapfile.h.
13291 * Makefile.in: Rebuild.
13292
13293 2008-05-19 Ian Lance Taylor <iant@google.com>
13294
13295 * options.h (class General_options): Add -z relro.
13296 * layout.cc (Layout::Layout): Initialize relro_segment_.
13297 (Layout::add_output_section_data): Return the output section.
13298 (Layout::make_output_section): Rcognize relro sections and mark
13299 them appropriately.
13300 (Layout::attach_allocated_section_to_segment): Put relro sections
13301 in a PT_GNU_RELRO segment.
13302 (Layout::create_initial_dynamic_sections): Mark the .dynamic
13303 section as relro.
13304 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13305 PT_TLS segments.
13306 (Layout::linkonce_mapping): Map d.rel.ro.local to
13307 .data.rel.ro.local.
13308 (Layout::output_section_name): Us .data.rel.ro.local for any
13309 section which begins with that.
13310 * layout.h (class Layout): Update add_output_section_data
13311 declaration. Add relro_segment_ field.
13312 * output.cc (Output_section::Output_section): Initialize is_relro_
13313 and is_relro_local_ fields.
13314 (Output_segment::add_output_section): Group relro sections.
13315 (Output_segment::is_first_section_relro): New function.
13316 (Output_segment::maximum_alignment): If there is a relro section,
13317 align the segment to the common page size.
13318 (Output_segment::set_section_addresses): Track whether we are
13319 looking at relro sections. If the last section is a relro
13320 section, align to the common page size.
13321 (Output_segment::set_section_list_addresses): Add in_relro
13322 parameter. Change all callers. Align to the page size when
13323 moving from relro to non-relro section.
13324 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13325 segment.
13326 * output.h (class Output_section): Add is_relro_ and
13327 is_relro_local_ fields.
13328 (Output_section::is_relro): New function.
13329 (Output_section::set_is_relro): New function.
13330 (Output_section::is_relro_local): New function.
13331 (Output_section::set_is_relro_local): New function.
13332 (class Output_segment): Update declarations.
13333 * i386.cc (Target_i386::got_section): Mark .got section as relro.
13334 * sparc.cc (Target_sparc::got_section): Likewise.
13335 * x86_64.cc (Target_x86_64::got_section): Likewise.
13336 * testsuite/relro_test_main.cc: New file.
13337 * testsuite/relro_test.cc: New file.
13338 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13339 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13340 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13341 (relro_test.so, relro_test_pic.o): New targets.
13342 * testsuite/Makefile.in: Rebuild.
13343
13344 2008-05-16 Ian Lance Taylor <iant@google.com>
13345
13346 * output.cc (Output_segment::add_output_section): Remove front
13347 parameter.
13348 * output.h (class Output_segment): Remove
13349 add_initial_output_section and overloaded add_output_section.
13350 Update declaration of remaining add_output_section.
13351 * layout.cc (Layout::create_interp): Call add_output_section
13352 rather than add_initial_output_section.
13353 (Layout::finish_dynamic_section): Likewise.
13354
13355 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13356 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
13357 know the dynamic type.
13358 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13359 field. Initialize it in constructor.
13360 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13361 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13362 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13363 reloc.
13364
13365 * output.cc (Output_reloc::get_address): Change return type to
13366 Elf_Addr.
13367 * output.h (class Output_reloc): Update get_address declaration.
13368 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13369 for section addresses.
13370
13371 2008-05-09 Ian Lance Taylor <iant@google.com>
13372
13373 PR 6493
13374 * gold.cc (gold_nomem): Use return value of write.
13375
13376 2008-05-08 Ian Lance Taylor <iant@google.com>
13377
13378 * symtab.c (Symbol::init_base_output_data): Add version
13379 parameter. Change all callers.
13380 (Symbol::init_base_output_segment): Likewise.
13381 (Symbol::init_base_constant): Likewise.
13382 (Symbol::init_base_undefined): Likewise.
13383 (Sized_symbol::init_output_data): Likewise.
13384 (Sized_symbol::init_output_segment): Likewise.
13385 (Sized_symbol::init_constant): Likewise.
13386 (Sized_symbol::init_undefined): Likewise.
13387 (Symbol_table::do_define_in_output_data): If the new symbol has a
13388 version, mark it as the default.
13389 (Symbol_table::do_define_in_output_segment): Likewise.
13390 (Symbol_table::do_define_as_constant): Likewise.
13391 * symtab.h (class Symbol): Update declarations.
13392 (class Sized_symbol): Likewise.
13393 * resolve.cc (Symbol::override_version): New function.
13394 (Symbol::override_base): Call override_version.
13395 (Symbol::override_base_with_special): Likewise.
13396 * testsuite/ver_script_8.script: New file.
13397 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13398 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13399 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13400 (ver_test_8_1.so, ver_test_8_2.so): New targets.
13401
13402 2008-05-06 Ian Lance Taylor <iant@google.com>
13403
13404 PR 6049
13405 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13406 functions.
13407 (class General_options): Remove existing --undefined, and add
13408 --no-undefined instead. Add new --undefined as synonym for -u.
13409 * archive.cc (Archive::add_symbols): Check whether symbol was
13410 named with -u.
13411 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13412 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13413 all uses. Add IS_UNDEFINED. Update declarations to split
13414 different versions of init_base. Declare init_base_undefined.
13415 (Symbol::is_defined): Handle IS_UNDEFINED.
13416 (Symbol::is_undefined): Likewise.
13417 (Symbol::is_weak_undefined): Call is_undefined.
13418 (Symbol::is_absolute): Handle IS_CONSTANT.
13419 (class Sized_symbol): Update declarations to split different
13420 versions of init. Declare init_undefined.
13421 (class Symbol_table): Declare new functions.
13422 * symtab.cc (Symbol::init_base_object): Rename from init_base.
13423 Change all callers.
13424 (Symbol::init_base_output_data): Likewise.
13425 (Symbol::init_base_output_segment): Likewise.
13426 (Symbol::init_base_constant): Likewise.
13427 (Symbol::init_base_undefined): New function.
13428 (Sized_symbol::init_object): Rename from init. Change all
13429 callers.
13430 (Sized_symbol::init_output_data): Likewise.
13431 (Sized_symbol::init_output_segment): Likewise.
13432 (Sized_symbol::init_constant): Likewise.
13433 (Sized_symbol::init_undefined): New function.
13434 (Symbol_table::add_undefined_symbols_from_command_line): New
13435 function.
13436 (Symbol_table::do_add_undefined_symbols_from_command_line): New
13437 function.
13438 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13439 (Symbol::output_section): Likewise.
13440 (Symbol::set_output_section): Likewise.
13441 (Symbol_table::sized_finalize_symbol): Likewise.
13442 (Symbol_table::sized_write_globals): Likewise.
13443 * resolve.cc (Symbol_table::should_override): Likewise.
13444 (Symbol::override_base_with_special): Likewise.
13445
13446 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13447 symbol, change it to have default visibility.
13448 * testsuite/protected_1.cc: New file.
13449 * testsuite/protected_2.cc: New file.
13450 * testsuite/protected_3.cc: New file.
13451 * testsuite/protected_main_1.cc: New file.
13452 * testsuite/protected_main_2.cc: New file.
13453 * testsuite/protected_main_3.cc: New file.
13454 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13455 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13456 (protected_1_LDFLAGS, protected_1_LDADD): Define.
13457 (protected_1.so): New target.
13458 (protected_1_pic.o, protected_2_pic.o): New targets.
13459 (protected_3_pic.o): New target.
13460 (check_PROGRAMS): Add protected_2.
13461 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13462 (protected_2_LDFLAGS, protected_2_LDADD): Define.
13463 * testsuite/Makefile.in: Rebuild.
13464
13465 * options.h (DEFINE_var): Add set_user_set_##varname__.
13466 (DEFINE_bool_alias): New macro.
13467 (class General_options): Define -Bstatic using DEFINE_bool_alias
13468 rather than DEFINE_special. Add --undefined as an alias for -z
13469 defs.
13470 * options.cc (General_options::parse_Bstatic): Remove.
13471
13472 * options.h (class General_options): Add --fatal-warnings.
13473 * main.cc (main): Implement --fatal-warnings.
13474 * errors.h (Errors::warning_count): New function.
13475
13476 * options.h (class General_options): Add -Bsymbolic-functions.
13477 * symtab.h (Symbol::is_preemptible): Check for
13478 -Bsymbolic-functions.
13479
13480 2008-05-05 Ian Lance Taylor <iant@google.com>
13481
13482 * options.h (DEFINE_bool): For DASH_Z, create the negative option
13483 as noVARNAME rather than no-VARNAME.
13484 (class General_options): Add option -z combreloc.
13485 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13486 get_address.
13487 (Output_reloc::sort_before) [SHT_REL]: New function.
13488 (Output_reloc::sort_before) [SHT_RELA]: New function.
13489 (class Output_data_reloc_base): Add sort_relocs_ field. Define
13490 Sort_relocs_comparison.
13491 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13492 parameter. Change all callers.
13493 (Output_data_reloc::Output_data_reloc) [both versions]: Add
13494 sort_relocs parameter. Change all callers.
13495 * output.cc (Output_reloc::get_address): New function, broken out
13496 of write_rel.
13497 (Output_reloc::write_rel): Call it.
13498 (Output_reloc::compare): New function.
13499 (Output_data_reloc_base::do_write): Optionally sort relocs.
13500
13501 * configure.ac: If targ_extra_obj is set, link it in.
13502 * configure.tgt: Initialize all variables.
13503 (x86_64*): Set targ_extra_obj and targ_extra_size.
13504 * configure: Rebuild.
13505
13506 * object.cc (Sized_relobj::include_section_group): Adjust section
13507 indexes read from group data. Build vector to pass to
13508 layout_group.
13509 * layout.cc (Layout::layout_group): Add flags and shndxes
13510 parameters. Remove contents parameter. Change caller. Update
13511 explicit instantiations.
13512 * layout.h (class Layout): Update layout_group declaration.
13513 * output.cc (Output_data_group::Output_data_group): Add flags and
13514 input_shndxes parameters. Remove contents parameter. Change
13515 caller.
13516 (Output_data_group::do_write): Change input_sections_ to
13517 input_shndxes_.
13518 * output.h (class Output_data_group): Update constructor
13519 declaration. Rename input_sections_ to input_shndxes_.
13520 * testsuite/many_sections_test.cc: Add template.
13521
13522 2008-04-30 Cary Coutant <ccoutant@google.com>
13523
13524 * target-reloc.h (relocate_section): Fix dead-pointer bug.
13525
13526 * layout.cc (Layout::include_section): Refactored check for debug
13527 info section.
13528 (Layout::add_comdat): Add new parameters. Change type
13529 of signature parameter. Add object and shndx to signatures table.
13530 (Layout::find_kept_object): New function.
13531 * layout.h: Include <cstring>.
13532 (Layout::is_debug_info_section): New function.
13533 (Layout::add_comdat): Add new parameters.
13534 (Layout::find_kept_object): New function.
13535 (Layout::Kept_section): New struct.
13536 (Layout::Signatures): Change type of map range.
13537 * object.cc (Relobj::output_section_address): New function.
13538 (Sized_relobj::include_section_group): Add new parameters. Change
13539 calls to Layout::add_comdat. Change to build table of kept comdat
13540 groups and table mapping discarded sections to kept sections.
13541 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
13542 (Sized_relobj::do_layout): Change calls to include_section_group and
13543 include_linkonce_section.
13544 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13545 value to zero when section is discarded.
13546 (Sized_relobj::map_to_kept_section): New function.
13547 * object.h (Relobj::output_section_address): New function.
13548 (Relobj::Comdat_group): New type.
13549 (Relobj::find_comdat_group): New function.
13550 (Relobj::Comdat_group_table): New type.
13551 (Relobj::Kept_comdat_section): New type.
13552 (Relobj::Kept_comdat_section_table): New type.
13553 (Relobj::add_comdat_group): New function.
13554 (Relobj::set_kept_comdat_section): New function.
13555 (Relobj::get_kept_comdat_section): New function.
13556 (Relobj::comdat_groups_): New field.
13557 (Relobj::kept_comdat_sections_): New field.
13558 (Symbol_value::input_value): Update comment.
13559 (Sized_relobj::map_to_kept_section) New function.
13560 (Sized_relobj::include_linkonce_section): Add new parameter.
13561 * target-reloc.h (Comdat_behavior): New type.
13562 (get_comdat_behavior): New function.
13563 (relocate_section): Add code to map a discarded section to the
13564 corresponding kept section when applying a relocation.
13565
13566 2008-04-30 Craig Silverstein <csilvers@google.com>
13567
13568 * dwarf_reader.cc (next_generation_count): New static var.
13569 (Addr2line_cache_entry): New struct.
13570 (addr2line_cache): New static var.
13571 (Dwarf_line_info::one_addr2line): Added caching.
13572 (Dwarf_line_info::clear_addr2line_cache): New function.
13573 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13574 cache-size parameter.
13575 (Dwarf_line_info::one_addr2line_cache): New function.
13576 * symtab.cc (Symbol_table::detect_odr_violations): Pass
13577 new cache-size argument to one_addr2line(), and clear cache.
13578
13579 2008-04-28 Cary Coutant <ccoutant@google.com>
13580
13581 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13582 R_386_PC8 relocations.
13583
13584 2008-04-23 Ian Lance Taylor <iant@google.com>
13585
13586 * object.cc (Sized_relobj::include_section_group): Check for
13587 invalid section group.
13588
13589 * object.cc (make_elf_object): Correct test for 64-bit ELF file
13590 header size.
13591
13592 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13593 than read for file header.
13594 * archive.cc (Archive::include_member): Likewise.
13595
13596 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
13597
13598 * aclocal.m4: Regenerate.
13599 * configure: Regenerate.
13600
13601 2008-04-19 Ian Lance Taylor <iant@google.com>
13602
13603 * version.cc (version_string): Bump to 1.6.
13604
13605 * testsuite/Makefile.am (many_sections_r_test): New target.
13606 (many_sections_r_test_SOURCES): Remove.
13607 (many_sections_r_test_DEPENDENCIES): Remove.
13608 (many_sections_r_test_LDFLAGS): Remove.
13609 (many_sections_r_test_LDADD): Remove.
13610
13611 * object.cc (Sized_relobj::do_add_symbols): Always pass
13612 local_symbol_count_ to add_from_relobj.
13613
13614 * testsuite/Makefile.am (many_sections_check.h): Only check one in
13615 every thousand variables.
13616 * testsuite/Makefile.in: Rebuild.
13617
13618 * object.cc (Xindex::initialize_symtab_xindex): New function.
13619 (Xindex::read_symtab_xindex): New function.
13620 (Xindex::sym_xindex_to_shndx): New function.
13621 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13622 available.
13623 (Sized_relobj::do_initialize_xindex): New function.
13624 (Sized_relobj::do_read_symbols): Adjust section links.
13625 (Sized_relobj::symbol_section_and_value): Add is_ordinary
13626 parameter. Change all callers.
13627 (Sized_relobj::include_section_group): Adjust section links and
13628 symbol section indexes.
13629 (Sized_relobj::do_layout): Adjust section links.
13630 (Sized_relobj::do_count_local_symbols): Adjust section links and
13631 symbol section indexes.
13632 (Sized_relobj::do_finalize_local_symbols): Distinguish between
13633 ordinary and special symbols.
13634 (Sized_relobj::write_local_symbols): Add symtab_xindex and
13635 dynsym_xindex parameters. Change all callers. Adjust section
13636 links. Use SHN_XINDEX when needed.
13637 (Sized_relobj::get_symbol_location_info): Adjust section links.
13638 Don't get fooled by special symbols.
13639 * object.h (class Xindex): Define.
13640 (class Object): Add xindex_ parameter. Declare virtual functoin
13641 do_initialize_xindex.
13642 (Object::adjust_sym_shndx): New function.
13643 (Object::set_xindex): New protected function.
13644 (class Symbol_value): Add is_ordinary_shndx_ field.
13645 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13646 (Symbol_value::value): Assert ordinary section.
13647 (Symbol_value::initialize_input_to_output_map): Likewise.
13648 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13649 Change all callers.
13650 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
13651 all callers.
13652 (class Sized_relobj): Update declarations.
13653 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13654 parameter. Change all callers.
13655 (Sized_relobj::adjust_shndx): New function.
13656 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13657 field.
13658 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13659 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
13660 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
13661 (Sized_dynobj::read_dynsym_section): Adjust section links.
13662 (Sized_dynobj::read_dynamic): Likewise.
13663 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
13664 section links.
13665 (Sized_dynobj::do_initialize_xindex): New function.
13666 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
13667 do_initialize_xindex.
13668 (Sized_dynobj::adjust_shndx): New function.
13669 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13670 dynsym_xindex_ fields.
13671 (Layout::finalize): Add a call to set_section_indexes before
13672 creating the symtab sections.
13673 (Layout::set_section_indexes): Don't do anything if the section
13674 already has a section index.
13675 (Layout::create_symtab_sections): Add shnum parameter. Change
13676 caller. Create .symtab_shndx section if needed.
13677 (Layout::create_shdrs): Add shstrtab_section parameter. Change
13678 caller.
13679 (Layout::allocated_output_section_count): New function.
13680 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13681 needed.
13682 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13683 fields. Update declarations.
13684 (Layout::symtab_xindex): New function.
13685 (Layout::dynsym_xindex): New function.
13686 (class Write_symbols_task): Add layout_ field.
13687 (Write_symbols_task::Write_symbols_task): Add layout parameter.
13688 Change caller.
13689 * output.cc (Output_section_headers::Output_section_headers): Add
13690 shstrtab_section parameter. Change all callers.
13691 (Output_section_headers::do_sized_write): Store overflow values
13692 for section count and section string table section index in
13693 section header zero.
13694 (Output_file_header::do_sized_write): Check for overflow of
13695 section count and section string table section index.
13696 (Output_symtab_xindex::do_write): New function.
13697 (Output_symtab_xindex::endian_do_write): New function.
13698 * output.h (class Output_section_headers): Add shstrtab_section_.
13699 Update declarations.
13700 (class Output_symtab_xindex): Define.
13701 (Output_section::has_out_shndx): New function.
13702 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13703 field.
13704 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13705 Change all callers.
13706 (Sized_symbol::init): Likewise.
13707 (Symbol::output_section): Check for ordinary symbol.
13708 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
13709 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
13710 callers.
13711 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13712 Change all callers. Simplify handling of symbols from sections
13713 not included in the link.
13714 (Symbol_table::add_from_dynobj): Handle ordinary symbol
13715 distinction.
13716 (Weak_alias_sorter::operator()): Assert that symbols are
13717 ordinary.
13718 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13719 distinction.
13720 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13721 parameters. Change all callers.
13722 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
13723 symbol distinction. Use SHN_XINDEX when needed.
13724 (Symbol_table::write_section_symbol): Add symtab_xindex
13725 parameter. Change all callers.
13726 (Symbol_table::sized_write_section_symbol): Likewise. Use
13727 SHN_XINDEX when needed.
13728 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
13729 declarations.
13730 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
13731 (Symbol::is_defined): Check is_ordinary.
13732 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13733 (Symbol::is_absolute, Symbol::is_common): Likewise.
13734 (class Sized_symbol): Update declarations.
13735 (class Symbol_table): Update declarations.
13736 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13737 parameters. Change all callers.
13738 (Sized_symbol::override): Likewise.
13739 (Symbol_table::override): Likewise.
13740 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
13741 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
13742 is_ordinary, and orig_st_shndx parameters. Change all callers.
13743 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13744 to be in an ordinary section.
13745 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13746 object and is_ordinary parameters. Change all callers.
13747 (Sized_dwarf_line_info::read_relocs): Add object parameter.
13748 Change all callers. Don't add undefined or non-ordinary symbols
13749 to reloc_map_.
13750 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13751 Change all callers.
13752 * dwarf_reader.h (class Sized_dwarf_line_info): Update
13753 declarations.
13754 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13755 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13756 (Sized_relobj::relocate_sections): Likewise.
13757 * target-reloc.h (scan_relocs): Adjust section symbol index.
13758 (scan_relocatable_relocs): Likewise.
13759 * i386.cc (Scan::local): Check for ordinary symbols.
13760 * sparc.cc (Scan::local): Likewise.
13761 * x86_64.cc (Scan::local): Likewise.
13762 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13763 to symbol_section_and_value.
13764 * testsuite/many_sections_test.cc: New file.
13765 * testsuite/Makefile.am (BUILT_SOURCES): Define.
13766 (check_PROGRAMS): Add many_sections_test.
13767 (many_sections_test_SOURCES): Define.
13768 (many_sections_test_DEPENDENCIES): Define.
13769 (many_sections_test_LDFLAGS): Define.
13770 (BUILT_SOURCES): Add many_sections_define.h.
13771 (many_sections_define.h): New target.
13772 (BUILT_SOURCES): Add many_sections_check.h.
13773 (many_sections_check.h): New target.
13774 (check_PROGRAMS): Add many_sections_r_test.
13775 (many_sections_r_test_SOURCES): Define.
13776 (many_sections_r_test_DEPENDENCIES): Define.
13777 (many_sections_r_test_LDFLAGS): Define.
13778 (many_sections_r_test_LDADD): Define.
13779 (many_sections_r_test.o): New target.
13780 * testsuite/Makefile.in: Rebuild.
13781
13782 2008-04-17 Cary Coutant <ccoutant@google.com>
13783
13784 * errors.cc (Errors::info): New function.
13785 (gold_info): New function.
13786 * errors.h (Errors::info): New function.
13787 * gold.h (gold_info): New function.
13788 * object.cc (Input_objects::add_object): Print trace output.
13789 * options.cc (options::parse_set): New function.
13790 (General_options::parse_wrap): Deleted.
13791 (General_options::General_options): Deleted initializer.
13792 * options.h (options::String_set): New typedef.
13793 (options::parse_set): New function.
13794 (DEFINE_set): New macro.
13795 (General_options::wrap): Changed to use DEFINE_set. Changed
13796 callers of any_wrap_symbols and is_wrap_symbol.
13797 (General_options::trace, General_options::trace_symbol):
13798 New options.
13799 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13800 (General_options::wrap_symbols_): Deleted.
13801 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13802
13803 2008-04-17 David S. Miller <davem@davemloft.net>
13804
13805 * options.cc (General_options::parse_V): New function.
13806 * options.h: Add entries for -V and -Qy.
13807
13808 2008-04-17 Ian Lance Taylor <iant@google.com>
13809
13810 * common.cc (Symbol_table::allocate_commons): Remove options
13811 parameter. Change caller.
13812 (Symbol_table::do_allocate_commons): Remove options parameter.
13813 Change caller. Just call do_allocate_commons_list twice.
13814 (Symbol_table::do_allocate_commons_list): New function, broken out
13815 of do_allocate_commons.
13816 * common.h (class Allocate_commons_task): Remove options_ field.
13817 Update constructor.
13818 * symtab.cc (Symbol_table::Symbol_table): Initialize
13819 tls_commons_.
13820 (Symbol_table::add_from_object): Put TLS common symbols on
13821 tls_commons_ list.
13822 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13823 which are IN_OUTPUT_DATA.
13824 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13825 allocate_commons and do_allocate_commons declarations. Declare
13826 do_allocate_commons_list.
13827 * gold.cc (queue_middle_tasks): Update creation of
13828 Allocate_commons_task to not pass options.
13829 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13830 (TLS_TEST_C_FLAGS): New variable.
13831 (tls_test_c_pic.o): New target.
13832 (tls_test_shared.so): Link in tls_test_c_pic.o.
13833 (tls_test_c_pic_ie.o): New target.
13834 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13835 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13836 (tls_test_c.o): New target.
13837 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13838 (tls_pic_test_LDADD): Likewise.
13839 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13840 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13841 (tls_test_c_gnu2.o): New target.
13842 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13843 tls_test_c_gnu2.o.
13844 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13845 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13846 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13847 * testsuite/tls_test.cc: Include "config.h".
13848 (t_last): Call t11_last.
13849 * testsuite/tls_test.h (t11, t11_last): Declare.
13850 * testsuite/tls_test_c.c: New file.
13851 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13852 * configure.ac: Check for OpenMP support.
13853 * configure, config.in, Makefile.in: Rebuild.
13854 * testsuite/Makefile.in: Rebuild.
13855
13856 2008-04-16 Cary Coutant <ccoutant@google.com>
13857
13858 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13859 (Target_i386::tls_base_symbol_defined_): New field.
13860 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13861 (Target_i386::Scan::global): Likewise.
13862 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13863 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13864 (Target_x86_64::tls_base_symbol_defined_): New field.
13865 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13866 (Target_x86_64::Scan::global): Likewise.
13867
13868 2008-04-16 Cary Coutant <ccoutant@google.com>
13869
13870 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13871 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13872 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13873 building shared libraries.
13874 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13875 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13876 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13877 * testsuite/Makefile.in: Rebuild.
13878 * testsuite/weak_undef.h: New file.
13879 * testsuite/weak_undef_file1.cc: Add extra test cases.
13880 * testsuite/weak_undef_file2.cc: Likewise.
13881 * testsuite/weak_undef_test.cc: Likewise.
13882
13883 2008-04-16 David S. Miller <davem@davemloft.net>
13884
13885 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13886 Add issued_non_pic_error_ field. Declare check_non_pic.
13887 (Target_sparc::Scan::check_non_pic): New function.
13888 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13889 (Target_sparc::Scan::global): Likewise.
13890
13891 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13892 * configure: Rebuild.
13893
13894 * options.h (DEFINE_enable): New macro.
13895 (new_dtags): New enable option.
13896 (initfirst, interpose, loadfltr, nodefaultlib,
13897 nodelete, nodlopen, nodump): New -z options.
13898 * layout.cc (Layout:finish_dynamic_section): If new
13899 dtags enabled, emit DT_RUNPATH. Also, emit a
13900 DT_FLAGS_1 containing any specified -z flags.
13901
13902 2008-04-16 Ian Lance Taylor <iant@google.com>
13903
13904 * copy-relocs.cc: New file.
13905 * copy-relocs.h: New file.
13906 * reloc.cc: Remove Copy_relocs code.
13907 * reloc.h: Likewise.
13908 * reloc-types.h (struct Reloc_types) [both versions]: Add
13909 get_reloc_addend_noerror.
13910 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13911 variants of add_global which take an addend which must be zero.
13912 * i386.cc: Include "copy-relocs.h".
13913 (class Target_i386): Change type of copy_relocs_ to variable,
13914 update initializer.
13915 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13916 Change all callers.
13917 (Target_i386::do_finalize_sections): Change handling of
13918 copy_relocs_.
13919 * sparc.cc: Include "copy-relocs.h".
13920 (class Target_sparc): Change type of copy_relocs_ to variable,
13921 update initializer.
13922 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13923 Change all callers.
13924 (Target_sparc::do_finalize_sections): Change handling of
13925 copy_relocs_.
13926 * x86_64.cc: Include "copy-relocs.h".
13927 (class Target_x86_64): Change type of copy_relocs_ to variable,
13928 update initializer.
13929 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13930 class. Change all callers.
13931 (Target_x86_64::do_finalize_sections): Change handling of
13932 copy_relocs_.
13933 * Makefile.am (CCFILES): Add copy-relocs.cc.
13934 (HFILES): Add copy-relocs.h.
13935
13936 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13937
13938 * testsuite/script_test_4.sh: Permit leading zeroes.
13939
13940 2008-04-15 Ian Lance Taylor <iant@google.com>
13941
13942 * script-sections.cc (Script_sections::create_segments): Use
13943 header_size_adjustment even when there is enough room for the
13944 headers.
13945 * testsuite/script_test_4.sh: New file.
13946 * testsuite/script_test_4.t: New file.
13947 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13948 (check_DATA): Add script_test_4.stdout.
13949 (MOSTLYCLEANFILES): Likewise.
13950 (script_test_4): New target.
13951 (script_test_4.stdout): New target.
13952 * testsuite/Makefile.in: Rebuild.
13953
13954 * sparc.cc: Add definitions for Output_data_plt_sparc class
13955 constants.
13956
13957 2008-04-14 David S. Miller <davem@davemloft.net>
13958
13959 * sparc.cc: New file.
13960 * Makefile.am (TARGETSOURCES): Add sparc.cc
13961 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13962 * configure.tgt: Document targ_extra_size and
13963 targ_extra_big_endian. Add entries for sparc-* and
13964 sparc64-*.
13965 * configure.ac: Handle targ_extra_size and
13966 targ_extra_big_endian.
13967 * Makefile.in: Rebuild.
13968 * configure: Likewise.
13969 * po/POTFILES.in: Likewise.
13970 * po/gold.pot: Likewise.
13971
13972 2008-04-14 Ian Lance Taylor <iant@google.com>
13973
13974 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13975 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13976 in the name/type/flags to section mapping. Don't call
13977 allocate_output_section.
13978 (Layout::choose_output_section): Change parameter from adjust_name
13979 to is_input_section. Don't permit input sections after sections
13980 are attached to segments. Don't call allocate_output_section.
13981 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13982 not write_enable_output_section.
13983 (Layout::make_output_section): Don't push to
13984 unattached_section_list_ nor call attach_to_segment. Call
13985 attach_section_to_segment if sections are attached.
13986 (Layout::attach_sections_to_segments): New function.
13987 (Layout::attach_section_to_segment): New function.
13988 (Layout::attach_allocated_section_to_segment): Rename from
13989 attach_to_segment. Remove flags parameter.
13990 (Layout::allocate_output_section): Remove function.
13991 (Layout::write_enable_output_section): Remove function.
13992 * layout.h (class Layout): Update for above changes. Add new
13993 field sections_are_attached_.
13994 * output.h (Output_section::update_flags_for_input_section): New
13995 function.
13996 * output.cc (Output_section::add_input_section): Call
13997 update_flags_for_input_section.
13998 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13999
14000 2008-04-11 Cary Coutant <ccoutant@google.com>
14001
14002 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14003 thought unnecessary.
14004 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14005
14006 2008-04-11 Ian Lance Taylor <iant@google.com>
14007
14008 * output.h (class Output_section_data): Remove inline definition
14009 of set_addralign.
14010 * output.cc (Output_section_data::set_addralign): New function.
14011
14012 2008-04-11 Cary Coutant <ccoutant@google.com>
14013
14014 Add support for TLS descriptors for i386 and x86_64.
14015 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14016 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14017 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14018 GOT_TYPE_TLS_DESC.
14019 (Target_i386::got_mod_index_entry): Remove unnecessary code.
14020 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14021 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
14022 relocations.
14023 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14024 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14025 Fix problem with initial-exec relocations.
14026 (Target_i386::Relocate::relocate_tls): Likewise.
14027 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14028 relaxation.
14029 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14030 support for section-plus-offset dynamic table entries.
14031 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14032 (Output_data_dynamic::Dynamic_entry): Add support for
14033 section-plus-offset dynamic table entries.
14034 (Output_data_dynamic::Classification): Likewise.
14035 (Output_data_dynamic::classification_): Renamed offset_.
14036 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14037 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14038 (Target_x86_64::make_plt_section): New function.
14039 (Target_x86_64::reserve_tlsdesc_entries): New function.
14040 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14041 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14042 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14043 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14044 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14045 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14046 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14047 add extra PLT entry for TLS descriptors.
14048 (Output_data_plt_x86_64::got_): New field.
14049 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14050 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14051 fields.
14052 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14053 descriptors.
14054 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14055 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14056 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14057 R_386_TLS_DESC_CALL relocations.
14058 (Target_x86_64::Scan::global): Likewise.
14059 (Target_x86_64::do_finalize_sections): Add dynamic table entries
14060 for TLS descriptors.
14061 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14062 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14063 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14064 GD-to-IE relaxation.
14065 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14066 and TLS_DESCRIPTORS.
14067 * Makefile.in: Rebuild.
14068 * configure: Rebuild.
14069 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14070 (tls_test_shared2.so): New target.
14071 (tls_shared_gd_to_ie_test_SOURCES): New variable.
14072 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14073 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14074 (tls_shared_gd_to_ie_test_LDADD): New variable.
14075 (tls_shared_gnu2_gd_to_ie_test): New target.
14076 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14077 New targets.
14078 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14079 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14080 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14081 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14082 (tls_shared_gnu2_test): New target.
14083 (tls_test_gnu2_shared.so): New target.
14084 (tls_shared_gnu2_test_SOURCES): New variable.
14085 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14086 (tls_shared_gnu2_test_LDFLAGS): New variable.
14087 (tls_shared_gnu2_test_LDADD): New variable.
14088 * testsuite/Makefile.in: Rebuild.
14089 * testsuite/Makefile.
14090
14091 2008-04-11 Ian Lance Taylor <iant@google.com>
14092
14093 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14094 justsyms.t.
14095 * testsuite/Makefile.in: Rebuild.
14096
14097 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14098 long.
14099 * testsuite/script_test_2.cc (main): Adjust test.
14100
14101 2008-04-11 David S. Miller <davem@davemloft.net>
14102 Ian Lance Taylor <iant@google.com>
14103
14104 * options.h (General_options): Add entries for '-Y' and
14105 '-relax'.
14106 * options.cc (General_options:finalize): If -Y was used, add those
14107 entries to the library path instead of the default "/lib" and
14108 "/usr/lib".
14109
14110 2008-04-11 David S. Miller <davem@davemloft.net>
14111
14112 * testsuite/justsyms.t: Start at 0x100.
14113 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14114 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14115 long.
14116 * testsuite/script_test_2.cc: Adjust string and section length
14117 checks.
14118
14119 2008-04-09 Ian Lance Taylor <iant@google.com>
14120
14121 PR gold/5996
14122 * script-sections.cc (Sections_element::allocate_to_segment): Add
14123 orphan parameter.
14124 (Output_section_definition::allocate_to_segment): Likewise.
14125 (Orphan_output_section::allocate_to_segment): Likewise.
14126 (Script_sections::attach_sections_using_phdrs_clause): Don't
14127 propagate non-PT_LOAD segments to orphan sections.
14128 * testsuite/Makefile.am (script_test_3.stdout): Generate using
14129 readelf rather than objdump.
14130 * testsuite/script_test_3.sh: Adjust accordingly. Test that
14131 .interp section and PT_INTERP segment are the same size.
14132 * testsuite/Makefile.in: Rebuild.
14133
14134 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14135 aliases for symbols defined in the same object.
14136 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14137 (weak_alias_test_SOURCES): New variable.
14138 (weak_alias_test_DEPENDENCIES): New variable.
14139 (weak_alias_test_LDFLAGS): New variable.
14140 (weak_alias_test_LDADD): New variable.
14141 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14142 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14143 (weak_alias_test_3.o): New target.
14144 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14145 * testsuite/weak_alias_test_main.cc: New file.
14146 * testsuite/weak_alias_test_1.cc: New file.
14147 * testsuite/weak_alias_test_2.cc: New file.
14148 * testsuite/weak_alias_test_3.cc: New file.
14149
14150 2008-04-08 Ian Lance Taylor <iant@google.com>
14151
14152 * options.h (class General_options): Add --noinhibit-exec option.
14153 * main.cc (main): Check --noinhibit-exec.
14154
14155 * options.h (class General_options): Define --wrap as a special
14156 option. Add wrap_symbols_ field.
14157 (General_options::any_wrap_symbols): New function.
14158 (General_options::is_wrap_symbol): New function.
14159 * options.cc (General_options::parse_wrap): New function.
14160 (General_options::General_options): Initialize wrap_symbols_.
14161 * symtab.cc (Symbol_table::wrap_symbol): New function.
14162 (Symbol_table::add_from_object): Handle --wrap.
14163 * symtab.h (class Symbol_table): Declare wrap_symbol.
14164 * target.h (Target::wrap_char): New function.
14165 (Target::Target_info): Add wrap_char field.
14166 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14167 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14168 * testsuite/testfile.cc (Target_test::test_target_info):
14169 Likewise.
14170
14171 * errors.cc (Errors::undefined_symbol): Mention symbol version if
14172 there is one.
14173
14174 * layout.h (class Layout): Add added_eh_frame_data_ field.
14175 * layout.cc (Layout::Layout): Initialize new field.
14176 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14177 output section until we find a section we merged successfully.
14178 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14179 that the size be non-zero.
14180
14181 * merge.cc (Object_merge_map::get_output_offset): Remove inline
14182 qualifier.
14183
14184 2008-04-08 Craig Silverstein <csilvers@google.com>
14185
14186 * configure.ac: Export new conditional variable HAVE_ZLIB.
14187 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14188 on HAVE_ZLIB.
14189 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14190 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14191
14192 2008-04-07 Ian Lance Taylor <iant@google.com>
14193
14194 * version.cc (version_string): Set to "1.5".
14195
14196 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14197 Add issued_non_pic_error_ field. Declare check_non_pic.
14198 (Target_x86_64::Scan::check_non_pic): New function.
14199 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14200 (Target_x86_64::Scan::global): Likewise.
14201
14202 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14203 addend parameter. Change caller. Handle merge sections.
14204 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14205 Address to Addend. Don't add in the result of
14206 local_section_offset, pass down the addend and use the returned
14207 value.
14208 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14209 Update declarations of local_section_offset and symbol_value.
14210 * testsuite/two_file_test_1.cc (t18): New function.
14211 * testsuite/two_file_test_2.cc (f18): New function.
14212 * testsuite/two_file_test_main.cc (main): Call t18.
14213 * testsuite/two_file_test.h (t18, f18): Declare.
14214
14215 * configure.ac: Don't test for objdump, c++filt, or readelf.
14216 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14217 conditionals.
14218 (TEST_READELF): New variable.
14219 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14220 (check_PROGRAMS): Add two_file_strip_test.
14221 (two_file_strip_test): New target.
14222 (check_PROGRAMS): Add two_file_same_shared_strip_test.
14223 (two_file_same_shared_strip_test_SOURCES): New variable.
14224 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14225 (two_file_same_shared_strip_test_LDFLAGS): New variable.
14226 (two_file_same_shared_strip_test_LDADD): New variable.
14227 (two_file_shared_strip.so): New target.
14228 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14229 (ver_test_5.syms, ver_test_7.syms): Likewise.
14230 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14231 (strip_test_3.stdout): Use TEST_OBJDUMP.
14232 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14233
14234 2008-04-04 Cary Coutant <ccoutant@google.com>
14235
14236 * symtab.h (Symbol::is_weak_undefined): New function.
14237 (Symbol::is_strong_undefined): New function.
14238 (Symbol::is_absolute): New function.
14239 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14240 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14241 absolute symbols.
14242 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14243 (weak_undef_test): New target.
14244 * testsuite/Makefile.in: Rebuild.
14245 * testsuite/weak_undef_file1.cc: New file.
14246 * testsuite/weak_undef_file2.cc: New file.
14247 * testsuite/weak_undef_test.cc: New file.
14248
14249 2008-04-03 Craig Silverstein <csilvers@google.com>
14250
14251 * compressed_output.h (class Output_compressed_section): Use
14252 unsigned buffer.
14253 * compressed_output.cc (zlib_compress): Use unsigned buffers,
14254 add zlib header.
14255 (zlib_compressed_suffix): Removed.
14256 (Output_compressed_section::set_final_data_size): Use unsigned
14257 buffers.
14258 * testsuite/Makefile.am (flagstest_compress_debug_sections):
14259 Fix linker invocation.
14260 (flagstest_o_specialfile_and_compress_debug_sections):
14261 Likewise.
14262 * testsuite/Makefile.in: Regenerated.
14263
14264 2008-04-02 David S. Miller <davem@davemloft.net>
14265
14266 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14267 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14268
14269 2008-04-02 Craig Silverstein <csilvers@google.com>
14270
14271 * TODO: New file.
14272
14273 2008-04-02 Ian Lance Taylor <iant@google.com>
14274
14275 * fileread.cc (File_read::find_view): Add byteshift and vshifted
14276 parameters. Update for new key type to views_. Change all
14277 callers.
14278 (File_read::read): Adjust for byteshift in returned view.
14279 (File_read::add_view): New function, broken out of
14280 find_and_make_view.
14281 (File_read::make_view): New function, broken out of
14282 find_and_make_view.
14283 (File_read::find_or_make_view): Add offset and aligned
14284 parameters. Rewrite accordingly. Change all callers.
14285 (File_read::get_view): Add offset and aligned parameters. Adjust
14286 for byteshift in return value.
14287 (File_read::get_lasting_view): Likewise.
14288 * fileread.h (class File_read): Update declarations.
14289 (class File_read::View): Add byteshift_ field. Add byteshift to
14290 constructor. Add byteshift method.
14291 * archive.h (Archive::clear_uncached_views): New function.
14292 (Archive::get_view): Add aligned parameter. Change all callers.
14293 * object.h (Object::get_view): Add aligned parameter. Change all
14294 callers.
14295 (Object::get_lasting_view): Likewise.
14296
14297 * fileread.cc (File_read::release): Don't call clear_views if
14298 there are multiple objects.
14299 * fileread.h (File_read::clear_uncached_views): New function.
14300 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14301 on the archive.
14302
14303 2008-03-31 Cary Coutant <ccoutant@google.com>
14304
14305 Add thin archive support.
14306 * archive.cc (Archive::armagt): New const.
14307 (Archive::setup): Remove task parameter and calls to unlock.
14308 (Archive::unlock_nested_archives): New function.
14309 (Archive::read_header): Add nested_off parameter. Change
14310 all callers.
14311 (Archive::interpret_header): Likewise.
14312 (Archive::include_all_members): Change to handle thin
14313 archives.
14314 (Archive::include_member): Likewise.
14315 * archive.h (Archive::Archive): Add new parameters and
14316 initializers.
14317 (Archive::armagt): New const.
14318 (Archive::setup): Remove task parameter.
14319 (Archive::unlock_nested_archives): New function.
14320 (Archive::read_header): Add nested_off parameter.
14321 (Archive::interpret_header): Likewise.
14322 (Archive::Nested_archive_table): New typedef.
14323 (Archive::is_thin_archive_): New field.
14324 (Archive::nested_archives_): New field.
14325 (Archive::options_): New field.
14326 (Archive::dirpath_): New field.
14327 (Archive::task_): New field.
14328 * readsyms.cc (Read_symbols::do_read_symbols): Add check
14329 for thin archives. Pass additional parameters to
14330 Archive::Archive. Unlock the archive file after calling
14331 Archive::setup.
14332
14333 2008-03-29 Ian Lance Taylor <iant@google.com>
14334
14335 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14336 version symbol to be local.
14337 * testsuite/ver_test_4.sh: New file.
14338 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14339 (check_DATA): Add ver_test_4.syms.
14340 (ver_test_4.syms): New target.
14341 * testsuite/Makefile.in: Rebuild.
14342
14343 * output.cc
14344 (Output_section::Input_section_sort_entry::has_priority): New
14345 function.
14346 (Output_section::Input_section_sort_entry::match_file_name): New
14347 function.
14348 (Output_section::Input_section_sort_entry::match_section_name):
14349 Remove.
14350 (Output_section::Input_section_sort_entry::match_section_name_prefix):
14351 Remove.
14352 (Output_section::Input_section_sort_entry::match_section_file):
14353 Remove.
14354 (Output_section::Input_section_sort_compare::operator()): Rewrite
14355 using new Input_section_sort_entry functions. Sort crtbegin and
14356 crtend first. Sort sections with no priority before sections with
14357 a priority.
14358 * testsuite/initpri1.c (d3): Check j != 4.
14359 (cd5): New constructor/destructor function.
14360 (main): Check j != 2.
14361
14362 * symtab.cc (Symbol_table::add_from_object): If we don't use the
14363 new symbol when resolving, don't call set_is_default.
14364 * testsuite/ver_test_7.cc: New file.
14365 * testsuite/ver_test_7.sh: New file.
14366 * testsuite/Makefile.am (ver_test_7.so): New target.
14367 (ver_test_7.o): New target.
14368 (check_SCRIPTS): Add ver_test_7.sh.
14369 (check_DATA): Add ver_test_7.syms.
14370 (ver_test_7.syms): New target.
14371
14372 2008-03-28 Ian Lance Taylor <iant@google.com>
14373
14374 * layout.cc (Layout::layout): If we see an input section with a
14375 name that needs sorting, set the must_sort flag for the output
14376 section.
14377 (Layout::make_output_section): If the name of the output section
14378 indicates that it might require sorting, set the may_sort flag.
14379 * output.h (Output_section::may_sort_attached_input_sections): New
14380 function.
14381 (Output_section::set_may_sort_attached_input_sections): New
14382 function.
14383 (Output_section::must_sort_attached_input_sections): New
14384 function.
14385 (Output_section::set_must_sort_attached_input_sections): New
14386 function.
14387 (class Output_section): Declare Input_section_sort_entry. Define
14388 Input_section_sort_compare. Declare
14389 sort_attached_input_sections. Add new fields:
14390 may_sort_attached_input_sections_,
14391 must_sort_attached_input_sections_,
14392 attached_input_sections_are_sorted_.
14393 * output.cc (Output_section::Output_section): Initialize new
14394 fields.
14395 (Output_section::add_input_section): Add an entry to
14396 input_sections_ if may_sort or must_sort are true.
14397 (Output_section::set_final_data_size): Call
14398 sort_attached_input_sections if necessary.
14399 (Output_section::Input_section_sort_entry): Define new class.
14400 (Output_section::Input_section_sort_compare::operator()): New
14401 function.
14402 (Output_section::sort_attached_input_sections): New function.
14403 * configure.ac: Check whether the compiler supports constructor
14404 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
14405 * testsuite/initpri1.c: New file.
14406 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14407 CONSTRUCTOR_PRIORITY.
14408 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14409 (initpri1_LDFLAGS): New variable.
14410 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14411
14412 2008-03-27 Ian Lance Taylor <iant@google.com>
14413
14414 * common.cc (Sort_commons::operator): Correct sorting algorithm.
14415 * testsuite/common_test_1.c: New file.
14416 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14417 (common_test_1_SOURCES): New variable.
14418 (common_test_1_DEPENDENCIES): New variable.
14419 (common_test_1_LDFLAGS): New variable.
14420
14421 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14422 and commons_ correctly when NAME/VERSION does not override
14423 NAME/NULL.
14424 * testsuite/ver_test_6.c: New file.
14425 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14426 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14427 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14428
14429 2008-03-26 Ian Lance Taylor <iant@google.com>
14430
14431 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14432 of an undefined symbol from a version script.
14433 * testsuite/Makefile.am (ver_test_5.so): New target.
14434 (ver_test_5.o): New target.
14435 (check_SCRIPTS): Add ver_test_5.sh.
14436 (check_DATA): Add ver_test_5.syms.
14437 (ver_test_5.syms): New target.
14438 * testsuite/ver_test_5.cc: New file.
14439 * testsuite/ver_test_5.script: New file.
14440 * testsuite/ver_test_5.sh: New file.
14441 * Makefile.in, testsuite/Makefile.in: Rebuild.
14442
14443 PR gold/5986
14444 Fix problems building gold with gcc 4.3.0.
14445 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14446 (gold_error_at_location, gold_warning_at_location): Use it.
14447 * configure.ac: Check whether we can compile and use a template
14448 function with a printf attribute.
14449 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14450 when jumping over bytes.
14451 * object.cc: Instantiate Object::read_section_data.
14452 * debug.h: Include <cstring>
14453 * dwarf_reader.cc: Include <algorithm>
14454 * main.cc: Include <cstring>.
14455 * options.cc: Include <cstring>.
14456 * output.cc: Include <cstring>.
14457 * script.cc: Include <cstring>.
14458 * script.h: Include <string>.
14459 * symtab.cc: Include <cstring> and <algorithm>.
14460 * target-select.cc: Include <cstring>.
14461 * version.cc: Include <string>.
14462 * testsuite/testmain.cc: Include <cstdlib>.
14463 * configure, config.in: Rebuild.
14464
14465 2008-03-25 Ian Lance Taylor <iant@google.com>
14466
14467 * options.cc: Include "../bfd/bfdver.h".
14468 (options::help): Print bug reporting address.
14469
14470 * version.cc (print_version): Adjust output for current value of
14471 BFD_VERSION_STRING.
14472
14473 * NEWS: New file.
14474
14475 * options.cc (options::help): Print list of supported targets.
14476 * target-select.h: Include <vector>.
14477 (class Target_selector): Make machine_, size_, and is_big_endian_
14478 fields const. Add bfd_name_ and instantiated_target_ fields.
14479 (Target_selector::Target_selector): Add bfd_name parameter.
14480 (Target_selector::recognize): Make non-virtual, call
14481 do_recognize.
14482 (Target_selector::recognize_by_name): Make non-virtual, call
14483 do_recognize_by_name.
14484 (Target_selector::supported_names): New function.
14485 (Target_selector::bfd_name): New function.
14486 (Target_selector::do_instantiate_target): New pure virtual
14487 function.
14488 (Target_selector::do_recognize): New virtual function.
14489 (Target_selector::do_recognize_by_name): New virtual function.
14490 (Target_selector::instantiate_target): New private function.
14491 (supported_target_names): Declare.
14492 * target-select.cc (Target_selector::Target_selector): Update for
14493 new parameter and fields.
14494 (select_target_by_name): Check that the name matches before
14495 calling recognize_by_name.
14496 (supported_target_names): New function.
14497 * i386.cc (class Target_selector_i386): Update Target_selector
14498 constructor call. Remove recognize and recognize_by_name. Add
14499 do_instantiate_target.
14500 * x86_64.cc (class Target_selector_x86_64): Likewise.
14501 * testsuite/testfile.cc (class Target_selector_test): Update for
14502 changes to Target_selector.
14503
14504 * README: Rewrite, with some notes on unsupported features.
14505
14506 2008-03-24 Cary Coutant <ccoutant@google.com>
14507
14508 * i386.cc (Target_i386::Got_type): New enum declaration.
14509 (Target_i386::Scan::local): Updated callers of Output_data_got
14510 member functions.
14511 (Target_i386::Scan::global): Likewise.
14512 (Target_i386::Relocate::relocate): Likewise.
14513 (Target_i386::Relocate::relocate_tls): Likewise.
14514 * object.h (Got_offset_list): New class.
14515 (Sized_relobj::local_has_got_offset): Added got_type parameter.
14516 (Sized_relobj::local_got_offset): Likewise.
14517 (Sized_relobj::set_local_got_offset): Likewise.
14518 (Sized_relobj::local_has_tls_got_offset): Removed.
14519 (Sized_relobj::local_tls_got_offset): Removed.
14520 (Sized_relobj::set_local_tls_got_offset): Removed.
14521 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14522 * output.cc (Output_data_got::add_global): Added got_type parameter.
14523 (Output_data_got::add_global_with_rel): Likewise.
14524 (Output_data_got::add_global_with_rela): Likewise.
14525 (Output_data_got::add_global_pair_with_rel): New function.
14526 (Output_data_got::add_global_pair_with_rela): New function.
14527 (Output_data_got::add_local): Added got_type parameter.
14528 (Output_data_got::add_local_with_rel): Likewise.
14529 (Output_data_got::add_local_with_rela): Likewise.
14530 (Output_data_got::add_local_pair_with_rel): New function.
14531 (Output_data_got::add_local_pair_with_rela): New function.
14532 (Output_data_got::add_global_tls): Removed.
14533 (Output_data_got::add_global_tls_with_rel): Removed.
14534 (Output_data_got::add_global_tls_with_rela): Removed.
14535 (Output_data_got::add_local_tls): Removed.
14536 (Output_data_got::add_local_tls_with_rel): Removed.
14537 (Output_data_got::add_local_tls_with_rela): Removed.
14538 * output.h (Output_data_got::add_global): Added got_type parameter.
14539 (Output_data_got::add_global_with_rel): Likewise.
14540 (Output_data_got::add_global_with_rela): Likewise.
14541 (Output_data_got::add_global_pair_with_rel): New function.
14542 (Output_data_got::add_global_pair_with_rela): New function.
14543 (Output_data_got::add_local): Added got_type parameter.
14544 (Output_data_got::add_local_with_rel): Likewise.
14545 (Output_data_got::add_local_with_rela): Likewise.
14546 (Output_data_got::add_local_pair_with_rel): New function.
14547 (Output_data_got::add_local_pair_with_rela): New function.
14548 (Output_data_got::add_global_tls): Removed.
14549 (Output_data_got::add_global_tls_with_rel): Removed.
14550 (Output_data_got::add_global_tls_with_rela): Removed.
14551 (Output_data_got::add_local_tls): Removed.
14552 (Output_data_got::add_local_tls_with_rel): Removed.
14553 (Output_data_got::add_local_tls_with_rela): Removed.
14554 * resolve.cc (Symbol::override_base_with_special): Removed
14555 reference to has_got_offset_ field.
14556 * symtab.cc (Symbol::init_fields): Replaced initialization
14557 of got_offset_ with got_offsets_. Removed initialization
14558 of has_got_offset_
14559 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14560 (Symbol::got_offset): Likewise.
14561 (Symbol::set_got_offset): Likewise.
14562 (Symbol::has_tls_got_offset): Removed.
14563 (Symbol::tls_got_offset): Removed.
14564 (Symbol::set_tls_got_offset): Removed.
14565 (Symbol::got_offset_): Removed.
14566 (Symbol::tls_mod_got_offset_): Removed.
14567 (Symbol::tls_pair_got_offset_): Removed.
14568 (Symbol::got_offsets_): New field.
14569 (Symbol::has_got_offset): Removed.
14570 (Symbol::has_tls_mod_got_offset): Removed.
14571 (Symbol::has_tls_pair_got_offset): Removed.
14572 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14573 (Target_x86_64::Scan::local): Updated callers of Output_data_got
14574 member functions.
14575 (Target_x86_64::Scan::global): Likewise.
14576 (Target_x86_64::Relocate::relocate): Likewise.
14577 (Target_x86_64::Relocate::relocate_tls): Likewise.
14578
14579 2008-03-25 Ben Elliston <bje@au.ibm.com>
14580
14581 * yyscript.y: Fix spelling error in comment.
14582
14583 2008-03-24 Ian Lance Taylor <iant@google.com>
14584
14585 * options.h (class General_options): Define build_id option.
14586 * layout.h (class Layout): Declare write_build_id, create_note,
14587 create_build_id. Add build_id_note_ member.
14588 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14589 "libiberty.h", "md5.h", "sha1.h".
14590 (Layout::Layout): Initialize eh_frame_data_,
14591 eh_frame_hdr_section_, and build_id_note_.
14592 (Layout::finalize): Call create_build_id.
14593 (Layout::create_note): New function, broken out of
14594 Layout::create_gold_note.
14595 (Layout::create_gold_note): Call create_note.
14596 (Layout::create_build_id): New function.
14597 (Layout::write_build_id): New function.
14598 (Close_task_runner::run): Call write_build_id.
14599
14600 * x86_64.cc: Correct license to GPLv3.
14601
14602 2008-03-23 Ian Lance Taylor <iant@google.com>
14603
14604 * options.cc: Include "demangle.h".
14605 (parse_optional_string): New function.
14606 (parse_long_option): Handle takes_optional_argument.
14607 (parse_short_option): Update dash_z initializer. Handle
14608 takes_optional_argument.
14609 (General_options::General_options): Initialize do_demangle_.
14610 (General_options::finalize): Set do_demangle_. Handle demangling
14611 style.
14612 * options.h (parse_optional_string): Declare.
14613 (struct One_option): Add optional_arg field. Update constructor.
14614 Update call constructor calls. Add takes_optional_argument
14615 function.
14616 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
14617 (DEFINE_optional_string): Define.
14618 (General_options::demangle): Change from DEFINE_bool to
14619 DEFINE_optional_string.
14620 (General_options::no_demangle): New function.
14621 (General_options::do_demangle): New function.
14622 (General_options::set_do_demangle): New function.
14623 (General_options::execstack_status_): Move definition to end of
14624 class definition.
14625 (General_options::static_): Likewise.
14626 (General_options::do_demangle_): New field.
14627 * object.cc (big_endian>::get_symbol_location_info): Call
14628 Options::do_demangle, not Options::demangle.
14629 * symtab.cc (demangle): Likewise.
14630
14631 2008-03-22 Ian Lance Taylor <iant@google.com>
14632
14633 * gold.h: Include <cstddef> and <sys/types.h>
14634 * options.h: Include <cstring>.
14635
14636 2008-03-21 Ian Lance Taylor <iant@google.com>
14637
14638 * Added source code to GNU binutils.
14639 \f
14640 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14641
14642 Copying and distribution of this file, with or without modification,
14643 are permitted in any medium without royalty provided the copyright
14644 notice and this notice are preserved.
14645
14646 Local Variables:
14647 mode: change-log
14648 left-margin: 8
14649 fill-column: 74
14650 version-control: never
14651 End:
This page took 0.359227 seconds and 5 git commands to generate.