daily update
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2013-03-13 Alan Modra <amodra@gmail.com>
2
3 * powerpc.cc (is_branch_reloc): Forward declare.
4 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
5 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
6 false for 64-bit, true for 32-bit non-branch relocs.
7 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
8 * testsuite/Makefile.am (icf_test): Use linker map file instead of
9 nm output.
10 (icf_safe_test): Generate linker map file as well as nm output.
11 (icf_safe_so_test): Likewise.
12 * testsuite/Makefile.in: Regenerate.
13 * testsuite/icf_test.sh: Parse linker map file to determine
14 section folding.
15 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
16 * testsuite/icf_safe_so_test.sh: Likewise.
17 (X86_32_or_ARM_specific_safe_fold): Merge into..
18 (arch_specific_safe_fold): ..this.
19 (X86_64_specific_safe_fold): Delete unused function.
20
21 2013-03-12 Alan Modra <amodra@gmail.com>
22
23 * gc.h (gc_process_relocs): Look through function descriptors
24 to determine shndx, symvalue and addend used by ICF. Tidy
25 variable duplication.
26
27 2013-03-11 Alan Modra <amodra@gmail.com>
28
29 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
30 * layout.cc (Layout_task_runner::run): ..to here.
31 * symtab.h (struct Symbol_location): Extract from..
32 (class Symbol_table): ..here.
33 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
34 * target.h (class Target): Add function_location and
35 do_function_location functions.
36 (class Sized_target): Add do_function_location.
37 * object.h (class Sized_relobj_file): Move find_shdr..
38 (class Object): ..to here.
39 * object.cc: Likewise. Update to suit. Instantiate.
40 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
41 * powerpc.cc (class Powerpc_dynobj): New.
42 (Target_powerpc::do_function_location): New function.
43 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
44 (Powerpc_dynobj::do_read_symbols): New function.
45 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
46
47 2013-03-08 Ian Lance Taylor <iant@google.com>
48
49 * options.cc (General_options::string_to_object_format): Accept
50 "default".
51
52 2013-03-08 Alan Modra <amodra@gmail.com>
53
54 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
55 pointer to Post_fde.
56 (struct Post_fde): Move definition to here..
57 * ehframe.cc (struct Post_fde): ..from here.
58 (Cie::write): Don't alloc Post_fde.
59 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
60
61 2013-03-07 Alan Modra <amodra@gmail.com>
62
63 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
64 relocation referencing .LC0.
65 * testsuite/discard_locals_test.sh: Remove FIXMEs.
66
67 2013-03-07 Alan Modra <amodra@gmail.com>
68
69 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
70 always_inline. Add assembly for powerpc to avoid GOT.
71
72 2013-03-07 Alan Modra <amodra@gmail.com>
73
74 * testsuite/script_test_10.sh: Don't test .bss section
75 header number.
76
77 2013-03-06 Alan Modra <amodra@gmail.com>
78
79 * powerpc.cc (class Powerpc_relobj): Move some member functions.
80 (Target_powerpc::symval_for_branch): Add symtab param. Update
81 all callers. Handle folded sections.
82 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
83 to Powerpc_relobj.
84 (Global_symbol_visitor_opd::operator()): Likewise.
85
86 2013-03-04 Alan Modra <amodra@gmail.com>
87
88 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
89 * testsuite/Makefile.in: Regenerate.
90
91 2013-03-01 Cary Coutant <ccoutant@google.com>
92
93 Add dwp support for v2 DWARF package file format.
94 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
95 tu_length parameter. Adjust all callers.
96 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
97 * dwp.cc: Include dwarf.h.
98 (Section_bounds): New struct type.
99 (Unit_set): New struct type.
100 (Dwo_file::Dwo_file): Initialize new data member.
101 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
102 Combine and rename to...
103 (Dwo_file::read_unit_index): ...this.
104 (Dwo_file::sized_read_compunit_index)
105 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
106 (Dwo_file::sized_read_unit_index): ...this.
107 (Dwo_file::copy_section): Remove section_name, is_str_offsets
108 parameters; add section_id parameter.
109 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
110 (Dwo_file::add_unit_set): ...this.
111 (Dwo_file::shndx_map_): Remove.
112 (Dwo_file::sect_offsets_): New data member.
113 (Dwp_output_file::Dwp_output_file): Initialize new data members.
114 (Dwp_output_file::add_section): Rename to...
115 (Dwp_output_file::add_contribution): ...this.
116 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
117 (Dwp_output_file::add_tu_set): Likewise.
118 (Dwp_output_file::Contribution): New type.
119 (Dwp_output_file::Section::contributions): New data member.
120 (Dwp_output_file::Cu_or_tu_set): Remove.
121 (Dwp_output_file::Section::Section): New ctor.
122 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
123 (Dwp_output_file::Dwp_index::Section_table): New type.
124 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
125 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
126 parameter.
127 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
128 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
129 (Dwp_output_file::Dwp_index::section_table): New member function.
130 (Dwp_output_file::Dwp_index::section_table_end): New member function.
131 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
132 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
133 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
134 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
135 (Dwp_output_file::Dwp_index::section_table_): New data member.
136 (Dwp_output_file::Dwp_index::section_mask_): New data member.
137 (Dwp_output_file::add_output_section): New member function.
138 (Dwp_output_file::write_new_section): New member function.
139 (Dwp_output_file::write_contributions): New member function.
140 (Dwp_output_file::section_id_map_): New data member.
141 (class Dwo_id_info_reader): Remove.
142 (class Unit_reader): New class.
143 (get_dwarf_section_name): New function.
144 (Dwo_file::read_executable): Adjust initializations of class data.
145 (Dwo_file::read): Add support for v2 package file format.
146 (Dwo_file::read_unit_index): Likewise.
147 (Dwo_file::sized_read_unit_index): Likewise.
148 (Dwo_file::copy_section): Likewise.
149 (Dwo_file::add_unit_set): Likewise.
150 (Dwp_output_file::add_output_section): Likewise.
151 (Dwp_output_file::add_contribution): Likewise.
152 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
153 for empty slot.
154 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
155 file format.
156 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
157 slot.
158 (Dwp_output_file::initialize): Remove unused function.
159 (Dwp_output_file::finalize): Add support for v2 package file format.
160 (Dwp_output_file::write_index): Likewise.
161 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
162 function prototype.
163
164 2013-03-01 Cary Coutant <ccoutant@google.com>
165
166 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
167 function into class definition in header file.
168 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
169 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
170 New function.
171 (Dwarf_info_reader::check_buffer): Move here from .cc file.
172
173 2013-02-28 Alan Modra <amodra@gmail.com>
174
175 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
176 * target.cc (Target::do_plt_fde_location): New function.
177 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
178 accessor function, and constructor param.
179 (struct Post_fde, Post_fdes): Declare.
180 (Cie::write): Add post_fdes param.
181 * ehframe.cc (Fde::write): Use plt_fde_location.
182 (struct Post_fde): Define.
183 (Cie::write): Stash FDEs added post merge mapping.
184 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
185 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
186 (Eh_frame::do_sized_write): Arrange to write post map FDES after
187 other FDEs.
188 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
189 (Target_powerpc::has_glink): New function.
190 (Target_powerpc::do_relax): Add eh_frame info for stubs.
191 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
192 glink_eh_frame_fde_32, default_fde): New data.
193 (Stub_table::eh_frame_added_): New var.
194 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
195 Make const.
196 (Stub_table::add_eh_frame): New function.
197 (Output_data_glink::add_eh_frame): New function.
198 (Target_powerpc::make_glink_section): Call add_eh_frame.
199
200 2013-02-15 Ian Lance Taylor <iant@google.com>
201
202 * options.h (DEFINE_uint64_alias): Define.
203 (class General_options): Add -Ttext-segment as an alias for
204 -Ttext.
205
206 2013-02-15 Alan Modra <amodra@gmail.com>
207
208 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
209 (Stub_table::do_write): ..here, two places.
210 (Stub_table::plt_call_size): Use it here too.
211
212 2013-02-11 Ian Lance Taylor <iant@google.com>
213
214 * descriptors.cc (Descriptors::close_all): New function.
215 * descriptors.h (class Descriptors): Declare close_all.
216 (close_all_descriptors): New inline function.
217 * plugin.cc: Include "descriptors.h".
218 (Plugin_manager::cleanup): Call close_all_descriptors.
219
220 2013-02-06 Alan Modra <amodra@gmail.com>
221
222 * README: Update coding style link.
223
224 2013-01-28 Cary Coutant <ccoutant@google.com>
225
226 * dwp.cc (File_list): New typedef.
227 (Dwo_name_info_reader): New class.
228 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
229 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
230 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
231 (Dwo_file::read_executable): New function.
232 (Dwo_file::read): Move common setup code to ...
233 (Dwo_file::make_object): ... here.
234 (dwp_options): Add --exec/-e.
235 (usage): Likewise.
236 (main): Likewise.
237
238 2013-01-24 Sriraman Tallam <tmsriram@google.com>
239
240 * layout.cc (Layout::layout): Check for option text_reorder.
241 (Layout::make_output_section): Ditto.
242 * options.h (text_reorder): New option.
243 * output.cc (Input_section_sort_compare): Remove special ordering
244 of section names.
245 (Output_section::
246 Input_section_sort_section_name_special_ordering_compare::
247 operator()): New function.
248 (Output_section::sort_attached_input_sections): Use new sort function
249 for .text.
250 * output.h (Input_section_sort_section_name_special_ordering_compare):
251 New struct.
252 * testsuite/Makefile.am (text_section_grouping): Test option
253 --no-text-reorder
254 * testsuite/Makefile.in: Regenerate.
255 * testsuite/text_section_grouping.sh: Check order of functions without
256 default text reordering.
257
258 2013-01-18 Mike Frysinger <vapier@gentoo.org>
259
260 * options.h (General_options): Change default to true for new_dtags.
261
262 2013-01-18 Mike Frysinger <vapier@gentoo.org>
263
264 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
265 when enable_new_dtags is false. Only add DT_RUNPATH when
266 enable_new_dtags is true.
267
268 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
269
270 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
271 used in declaration and definition consistent.
272 (Target_powerpc::symval_for_branch): Ditto.
273
274 2013-01-16 Sriraman Tallam <tmsriram@google.com>
275
276 * testsuite/plugin_final_layout.cc: Fix comment.
277
278 2013-01-16 Sriraman Tallam <tmsriram@google.com>
279
280 * layout.cc (Layout::layout): Do not do default sorting for
281 text sections when section ordering is specified.
282 (make_output_section): Ditto.
283 * testsuite/plugin_final_layout.cc: Name the function sections
284 to catch reordering issues.
285
286 2013-01-15 Alan Modra <amodra@gmail.com>
287
288 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
289 plt-thread-safe.
290
291 2013-01-15 Alan Modra <amodra@gmail.com>
292
293 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
294 * testsuite/Makefile.in: Regenerate.
295
296 2013-01-14 Alan Modra <amodra@gmail.com>
297
298 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
299 * testsuite/Makefile.in: Regenerate.
300
301 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
302
303 PR bfd/14430
304 Fix mingw gold build with plugins enabled
305 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
306 * configure.ac: Export DLOPEN_LIBS and add headers check.
307 * plugin.cc: Handle non-dlfcn case.
308 * Makefile.in: Regenerate.
309 * config.in: Regenerate.
310 * configure: Regenerate.
311 * testsuite/Makefile.in: Regenerate.
312
313 2013-01-09 Sriraman Tallam <tmsriram@google.com>
314
315 * output.h (sort_attached_input_sections): Change to be public.
316 * script-sections.cc
317 (Output_section_definition::set_section_addresses): Sort
318 attached input sections according to section order before linker
319 script assigns section addresses.
320 (Orphan_output_section::set_section_addresses): Sort
321 attached input sections according to section order before linker
322 script assigns section addresses.
323 * Makefile.am (final_layout.sh): Use a simple linker script to
324 check if section ordering still works.
325 * Makefile.in: Regenerate.
326
327 2013-01-09 Ben Cheng <bccheng@google.com>
328
329 * arm.cc (Target_arm::attributes_accept_div): New function.
330 (Target_arm::attributes_forbid_div): New function.
331 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
332 attribute using the same new functions as what bfd/elf32_arm.c
333 does.
334
335 2013-01-07 Cary Coutant <ccoutant@google.com>
336
337 PR gold/14993
338 * output.cc (Output_section::add_input_section): For incremental
339 updates, don't track input sections that are allocated from patch
340 space.
341
342 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
343 Ian Lance Taylor <iant@google.com>
344
345 PR gold/14897
346 * configure.ac (--enable-ld): Removed.
347 (install_as_default): Set to yes only for --enable-gold=default
348 or --disable-ld.
349 * configure: Regenerated.
350
351 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
352
353 * options.h (General_options): Add -fuse-ld= for GCC linker
354 option compatibility.
355
356 2013-01-04 Cary Coutant <ccoutant@google.com>
357
358 * configure.ac: Fix typo restoring CXXFLAGS.
359 * configure: Regenerate.
360
361 2013-01-04 Cary Coutant <ccoutant@google.com>
362
363 * testsuite/Makefile.am (CXXLINK_S): New macro.
364 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
365 * testsuite/Makefile.in: Regenerate.
366
367 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
368
369 * version.cc (print_version): Update copyright year to 2013.
370
371 2012-12-20 Ian Lance Taylor <iant@google.com>
372
373 * layout.cc (Layout::special_ordering_of_input_section): New
374 function.
375 (Layout::layout): If input section requires special ordering, must
376 sort input sections.
377 (Layout::make_output_section): May sort .text input sections.
378 (Layout::is_section_name_prefix_grouped): Remove.
379 * layout.h (class Layout): Declare
380 special_ordering_of_input_section. Don't declare
381 is_section_name_prefix_grouped.
382 * output.cc (Output_section::add_input_section): Revert last
383 change.
384 (Output_section::Input_section_sort::match_file_name): Don't crash
385 if called on output section data.
386 (Output_section::Input_section_sort_compare): Sort based on
387 special ordering.
388 (Output_section::Input_section_sort_section_order_index_compare):
389 Revert last patch.
390 (Output_section::sort_attached_input_sections): Likewise.
391
392 2012-12-18 Sriraman Tallam <tmsriram@google.com>
393
394 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
395 * layout.h (Layout::is_section_name_prefix_grouped): New function.
396 * output.cc (Output_section::add_input_section): Check if section
397 name contains special prefix. Keep input sections to sort such
398 sections.
399 (Output_section::Input_section_sort_section_order_index_compare
400 ::operator()): Group sections according to prefixes.
401 (Output_section::sort_attached_input_sections): Add condition to
402 Input_section_entry constructor call.
403 * testsuite/Makefile.am (text_section_grouping): New test.
404 * testsuite/Makefile.in: Regenerate.
405 * testsuite/text_section_grouping.cc: New file.
406 * testsuite/text_section_grouping.sh: New file.
407
408 2012-12-17 Nick Clifton <nickc@redhat.com>
409
410 * Makefile.am: Add copyright notice.
411 * NEWS: Likewise.
412 * README: Likewise.
413 * configure.ac: Likewise.
414 * ftruncate.c: Likewise.
415 * Makefile.in: Regenerate.
416
417 2012-12-14 Cary Coutant <ccoutant@google.com>
418
419 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
420 --no-as-needed flag.
421 (exception_separate_shared_12_test): Likewise.
422 (incremental_copy_test): Likewise.
423 * testsuite/Makefile.in: Regenerate.
424
425 2012-12-14 Cary Coutant <ccoutant@google.com>
426
427 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
428 (Dwp_output_file::Dwp_index::enter_set): Add assert.
429
430 2012-12-12 Alan Modra <amodra@gmail.com>
431
432 * powerpc.cc (class Track_tls): New.
433 (class Relocate, class Scan): Inherit Track_tls.
434 (Target_powerpc::Scan::local, global): Track tls optimization
435 and avoid creating plt entry for __tls_get_addr if all uses
436 are optimized away.
437 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
438
439 2012-12-12 Alan Modra <amodra@gmail.com>
440
441 * options.h (General_options): Add --toc-sort/--no-toc-sort.
442 Replace no_toc_optimize with toc_optimize.
443 * output.h (Output_section::input_sections): Provide non-const variant.
444 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
445 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
446 accessors.
447 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
448 (class Sort_toc_sections): New.
449 (Target_powerpc::do_finalize_sections): Sort toc sections.
450 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
451
452 2012-12-10 Roland McGrath <mcgrathr@google.com>
453
454 * testsuite/binary_unittest.cc (read_all): New function.
455 (Sized_binary_test): Use it instead of ::read.
456 * fileread.cc (do_read): Don't assume pread always reads the whole
457 amount in a single call.
458
459 2012-12-10 Alan Modra <amodra@gmail.com>
460
461 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
462 Set EM_PPC64 or EM_PPC here.
463 (Target_selector_powerpc::do_recognize): Delete.
464
465 2012-12-10 Alan Modra <amodra@gmail.com>
466
467 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
468 stub_table_.
469 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
470
471 2012-12-07 Roland McGrath <mcgrathr@google.com>
472
473 * testsuite/binary_unittest.cc (Sized_binary_test):
474 Use open_descriptor rather than ::open.
475
476 2012-12-07 Alan Modra <amodra@gmail.com>
477
478 * powerpc.cc (Stub_table::do_write): Delete redundant Address
479 typedef and invalid_address constant.
480 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
481 instantiate constants.
482
483 2012-12-06 Roland McGrath <mcgrathr@google.com>
484
485 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
486 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
487 * aclocal.m4: Regenerate.
488 * configure: Regenerate.
489 * Makefile.in: Regenerate.
490 * testsuite/Makefile.in: Regenerate.
491
492 2012-12-07 Alan Modra <amodra@gmail.com>
493
494 * options.h (General_options): Add no_toc_optimize.
495 * powerpc.cc (ok_lo_toc_insn): New function.
496 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
497
498 2012-12-06 Alan Modra <amodra@gmail.com>
499
500 * options.h (General_options): Add plt_align, plt_static_chain,
501 plt_thread_safe. Update stub_group_size help text.
502 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
503 for new plt_thread_safe_ var.
504 (use_plt_offset): Correct comments.
505 (Target_powerpc::do_relax): Look for thread creation symbols to
506 determine default plt_thread_safe value. Clear plt call stubs
507 as well as branch stubs each iteration.
508 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
509 insn constants.
510 (l, hi, ha, write_insn): Move earlier.
511 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
512 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
513 plt stubs too.
514 (Stub_table::update_size): Adjust.
515 (Stub_table::prev_size, set_prev_size): Delete.
516 (Stub_table::stub_align): Let --plt-align affect result.
517 (Stub_table::plt_call_size): Calculate sizes for various stubs.
518 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
519 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
520 (Stub_table::do_write): Support more stub variants.
521
522 2012-12-04 Alan Modra <amodra@gmail.com>
523
524 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
525 (Target_powerpc::do_define_standard_symbols): New function.
526
527 2012-12-03 Alan Modra <amodra@gmail.com>
528
529 * output.h: Formatting, whitespace.
530
531 2012-12-03 Alan Modra <amodra@gmail.com>
532
533 * layout.h (Layout::get_executable_sections): Declare.
534 * layout.cc (Layout::get_executable_sections): New function.
535 * arm.cc (Target_arm::group_sections): Use it.
536 (Arm_output_section::group_sections): Delete now redundant test.
537 * output.cc (Output_reloc::Output_reloc): Add is_relative.
538 param to handle relative relocs.
539 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
540 (Output_data_reloc::add_absolute): Adjust.
541 (Output_data_reloc::add_relative): New function.
542 (Output_data::reset_data_size): New function.
543 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
544 (Output_section::set_addralign): New function.
545 (Output_section::checkpoint_set_addralign): New function.
546 (Output_section::clear_section_offsets_need_adjustment): New function.
547 (Output_section::input_sections): Make public.
548 * powerpc.cc (class Output_data_brlt_powerpc): New.
549 (class Stub_table, class Stub_control): New.
550 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
551 stub_table_, set_stub_table, stub_table): New vectors and accessor
552 functions.
553 (Target_powerpc::do_may_relax, do_relax, push_branch,
554 new_stub_table, stub_tables, brlt_section, group_sections,
555 add_branch_lookup_table, find_branch_lookup_table,
556 write_branch_lookup_table, make_brlt_section): New functions.
557 (Target_powerpc::struct Sort_sections, class Branch_info): New.
558 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
559 branch_info_): New vars.
560 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
561 make call stubs here.
562 (Output_data_glink): Remove all call stub handling from this class.
563 (Target_powerpc::Scan::local, global): Save interesting branch
564 relocs and relocs for ifunc. Adjust calls to plt entry functions.
565 (Target_powerpc::do_finalize_sections): Only make reg save/restore
566 functions on final link.
567 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
568 Handle long branch destinations too.
569 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
570 do_plt_address_for_local): Adjust lookup of plt call stubs.
571
572 2012-11-30 Alan Modra <amodra@gmail.com>
573
574 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
575 relocs against protected symbols when building 32-bit shared libs.
576
577 2012-11-30 Alan Modra <amodra@gmail.com>
578
579 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
580 param. Call got_section() to make .got. Update all callers
581 and their callers and so on.
582
583 2012-11-30 Alan Modra <amodra@gmail.com>
584
585 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
586 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
587 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
588 value if it already exists.
589
590 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
591
592 PR gold/14858
593 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
594
595 2012-11-14 Roland McGrath <mcgrathr@google.com>
596
597 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
598 than bfc instruction for data sandboxing.
599
600 2012-11-08 Alan Modra <amodra@gmail.com>
601
602 * po/POTFILES.in: Regenerate.
603
604 2012-11-05 Alan Modra <amodra@gmail.com>
605
606 * configure.ac: Apply 2012-09-10 change to config.in here.
607 * configure: Regenerate.
608
609 2012-11-05 Alan Modra <amodra@gmail.com>
610
611 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
612 (struct Opd_ent): Use "Address" rather than "Offset".
613 (Output_data_got_powerpc::got_base_offset): Return Valtype.
614 (Target_powerpc::got_section): Make public.
615 (Target_powerpc::scan_relocs): Move code setting symbols..
616 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
617 Create _SDA_BASE_ only when referenced.
618
619 2012-11-02 Roland McGrath <mcgrathr@google.com>
620
621 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
622 from last change.
623
624 2012-11-01 Roland McGrath <mcgrathr@google.com>
625
626 * target.h (Sized_target::relocate_relocs): Use Elf_Off
627 for offset_in_output_section parameter.
628 (Sized_target::relocate_special_relocatable): Likewise.
629 * arm.cc (Target_arm::relocate_relocs): Likewise.
630 (Target_arm::relocate_special_relocatable): Likewise.
631 * i386.cc (Target_i386::relocate_relocs): Likewise.
632 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
633 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
634 * target-reloc.h (relocate_relocs): Likewise.
635 * testsuite/testfile.cc (Target_test): Likewise.
636 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
637 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
638
639 * system.h: Move inclusion of <clocale> to after <libintl.h> in
640 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
641
642 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
643 parameter, which is unused in the [!F_SETFD] case.
644
645 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
646 SYMNDX to off_t before comparing it to this->data_size().
647 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
648 * incremental.cc (Output_section_incremental_inputs::do_write):
649 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
650
651 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
652
653 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
654
655 * gold.cc (Target_arm::do_adjust_elf_header): Add the
656 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
657 in EABI_VER5.
658
659 2012-10-29 Cary Coutant <ccoutant@google.com>
660
661 * dwp.cc (usage): Add file and exit status parameters;
662 add --help and --version options.
663 (print_version): New function.
664 (main): Add --help and --version options.
665
666 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
667
668 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
669 final_layout_sequence.txt.
670 * testsuite/Makefile.in: Regenerated.
671
672 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
673
674 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
675 COMPILE generated by automake.
676 (LINK1): Likewise.
677 (CXXCOMPILE1): Likewise.
678 (CXXLINK1): Likewise.
679 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
680 (LINK): Likewise.
681 (CXXCOMPILE): Likewise.
682 (CXXLINK): Likewise.
683 * testsuite/Makefile.in: Regenerated.
684
685 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
686
687 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
688 on bad fwrite return.
689
690 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
691
692 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
693 on val.
694
695 2012-10-23 Cary Coutant <ccoutant@google.com>
696
697 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
698 * testsuite/Makefile.in: Regenerate.
699 * testsuite/dwp_test.h: New source file.
700 * testsuite/dwp_test_1.cc: New source file.
701 * testsuite/dwp_test_1.s: New source file.
702 * testsuite/dwp_test_1.sh: New source file.
703 * testsuite/dwp_test_1b.cc: New source file.
704 * testsuite/dwp_test_1b.s: New source file.
705 * testsuite/dwp_test_2.cc: New source file.
706 * testsuite/dwp_test_2.s: New source file.
707 * testsuite/dwp_test_2.sh: New source file.
708 * testsuite/dwp_test_main.cc: New source file.
709 * testsuite/dwp_test_main.s: New source file.
710
711 2012-10-23 Cary Coutant <ccoutant@google.com>
712
713 * dwp.h: New header file.
714 * dwp.cc: New source file.
715 * gold.h: Move shared declarations to system.h.
716 * system.h: New header file.
717 * Makefile.am: Add dwp.
718 * Makefile.in: Regenerate.
719
720 2012-10-23 Cary Coutant <ccoutant@google.com>
721
722 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
723 Dwarf_info_reader::read_from_pointer.
724 (Dwarf_pubnames_table::read_header): Likewise.
725 (Dwarf_pubnames_table::next_name): Likewise.
726 (Dwarf_die::read_attributes): Likewise.
727 (Dwarf_die::skip_attributes): Likewise.
728 (Dwarf_info_reader::read_from_pointer): New function template.
729 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
730 (Dwarf_pubnames_table): Likewise.
731 (Dwarf_info_reader::read_from_pointer): New function template.
732 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
733 Dwarf_pubnames_table ctor.
734
735 2012-10-23 Cary Coutant <ccoutant@google.com>
736
737 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
738 abbrev_shndx.
739 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
740 abbrev_shndx_.
741 (Dwarf_info_reader::set_abbrev_shndx): New method.
742 (Dwarf_info_reader::abbrev_shndx_): New data member.
743
744 2012-10-23 Cary Coutant <ccoutant@google.com>
745
746 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
747 from object, not parameters.
748 (Dwarf_info_reader::parse): Likewise.
749 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
750 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
751 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
752 methods.
753
754 2012-10-23 Cary Coutant <ccoutant@google.com>
755
756 * fileread.cc (Input_file::Input_file): New constructor.
757 * fileread.h (class Input_file): Add new constructor.
758
759 2012-10-18 Alan Modra <amodra@gmail.com>
760
761 PR gold/14727
762 * object.cc (Relobj::is_section_name_included): Also match
763 .sdata personality section.
764
765 2012-10-18 Alan Modra <amodra@gmail.com>
766
767 * target-reloc.h (class Default_comdat_behavior): New, package up..
768 (get_comdat_behaviour): ..this.
769 (relocate_section): Add Relocate_comdat_behavior template arg,
770 adjust code to suit.
771 * arm.cc (Target_arm::relocate_section): Adjust to suit.
772 (Target_arm::scan_reloc_section): Likewise.
773 * i386.cc (Target_i386::relocate_section): Likewise.
774 * sparc.cc (Target_sparc::relocate_section): Likewise.
775 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
776 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
777 * powerpc.cc (class Relocate_comdat_behavior): New.
778 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
779 gold::relocate_section with new template arg.
780
781 2012-10-18 Alan Modra <amodra@gmail.com>
782
783 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
784 dynamic relocs for GOT_TPREL got entries, without symbol if
785 resolving locally.
786 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
787 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
788 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
789
790 2012-10-17 Alan Modra <amodra@gmail.com>
791
792 PR gold/14726
793 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
794
795 2012-10-16 Sriraman Tallam <tmsriram@google.com>
796
797 * layout.cc (Layout::include_section): Keep sections marked
798 SHF_EXCLUDE when doing relocatable links.
799
800 2012-10-16 Alan Modra <amodra@gmail.com>
801
802 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
803 (Target_powerpc::do_finalize_sections): Call it.
804 (Output_data_save_res): New class and supporting functions.
805 (Target_powerpc::symval_for_branch): Only look up .opd entry for
806 normal symbols defined in object files.
807
808 2012-10-12 Alan Modra <amodra@gmail.com>
809
810 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
811 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
812 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
813 section if scan_opd_relocs not yet called.
814 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
815
816 2012-10-12 Alan Modra <amodra@gmail.com>
817
818 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
819 add_local_ifunc_entry): Revert last change.
820 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
821
822 2012-10-05 Alan Modra <amodra@gmail.com>
823
824 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
825 do_plt_address_for_global): New functions.
826 (Output_data_got_powerpc::do_write): Don't segfault when linking
827 statically.
828 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
829 add_local_ifunc_entry): Return true on adding entry..
830 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
831 glink->add_entry call. Remove unused symtab param. Adjust calls.
832 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
833 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
834 set up symbols here.
835 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
836 syms here. Do so even when no .iplt. Don't segfault when linking
837 statically.
838 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
839 new variants without reloc param.
840 (Glink_sym_ent::Glink_sym_ent): Likewise.
841 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
842 reloc when refs will resolve to plt call stub.
843 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
844 R_PPC_PLTREL24 to resolve locally.
845 (Target_powerpc::Scan::global): Correct ifunc handling.
846 (Target_powerpc::Relocate::relocate): Correct local sym glink
847 lookup. Don't destroy "value" when we have a plt call stub,
848 and when checking plt call validity.
849 (Target_powerpc::do_dynsym_value): Simplify.
850
851 2012-10-05 Alan Modra <amodra@gmail.com>
852
853 * i386.cc (Output_data_plt_i386::address_for_global,
854 address_for_local): Add plt offset to returned value. Adjust uses.
855 * sparc.cc (Output_data_plt_sparc::address_for_global,
856 address_for_local): Likewise.
857 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
858 address_for_local): Likewise.
859 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
860 address_for_local): Likewise.
861 * target.h (Target::plt_address_for_global, plt_address_for_local):
862 Update comment.
863 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
864 (Output_data_got::Got_entry::write): Nor here.
865 * output.h: Comment fix.
866
867 2012-10-02 Jiong Wang <jiwang@tilera.com>
868
869 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
870 global_offset_table_ value for larget got.
871 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
872
873 2012-09-29 Alan Modra <amodra@gmail.com>
874
875 * powerpc.cc (Target_powerpc::iplt_): New output section.
876 (Target_powerpc::iplt_section, make_iplt_section,
877 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
878 (Target_powerpc::make_plt_entry): Handle ifunc syms.
879 Target_powerpc::plt_entry_count): Count iplt entries too.
880 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
881 reloc section in constructor. New params.
882 (Target_powerpc::make_plt_section): Create reloc section here instead.
883 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
884 functions.
885 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
886 (Output_data_glink::add_entry, find_entry): New functions to
887 deal with local syms.
888 (Glink_sym_ent): Add support for local syms.
889 (Output_data_glink::do_write): Handle ifunc plt entries.
890 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
891 (Target_powerpc::Scan::local, global): Handle ifunc syms.
892 (Target_powerpc::Relocate::relocate): Likewise.
893 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
894
895 2012-09-25 Alan Modra <amodra@gmail.com>
896
897 * object.h (Sized_relobj_file::adjust_local_symbol,
898 do_adjust_local_symbol): New functions.
899 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
900 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
901 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
902 and irregular opd entry spacing.
903 (Powerpc_relobj::do_read_relocs): Add opd size checks.
904 (Global_symbol_visitor_opd): New functor.
905 (Target_powerpc::do_finalize_sections): Omit global symbols defined
906 on deleted opd entries.
907
908 2012-09-15 Jiong Wang <jiwang@tilera.com>
909
910 * tilegx.cc: New file.
911 * Makefile.am (TARGETSOURCES): Add tilegx.cc
912 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
913 * configure.tgt: Add entries for tilegx*.
914 * configure.ac: Likewise.
915 * Makefile.in: Rebuild.
916 * configure: Likewise.
917 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
918 tilegx.
919
920 2012-09-13 Alan Modra <amodra@gmail.com>
921
922 * target-reloc.h (scan_relocs): Call scan.local for relocs
923 against symbols in discarded sections. Pass is_discarded
924 param.
925 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
926 Add is_discarded param.
927 * powerpc (Target_powerpc::Scan::local): Likewise. Use
928 is_discarded to flag opd entry as discarded. Don't emit dyn
929 relocs on such entries.
930 (Target_powerpc::Scan::global): Similarly detect and handle
931 such opd entries.
932 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
933 opd_ent_. Update all uses.
934 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
935 (Target_powerpc::relocate_section): Zero out discarded opd
936 entry relocs.
937
938 2012-09-12 Ian Lance Taylor <iant@google.com>
939
940 PR gold/14570
941 * output.cc: Rename Output_data_got template parameter from size
942 to got_size for all functions. Compile all variants of
943 Output_data_got.
944 (Output_data_got::Got_entry::write): Correct use of size for
945 symbol value. Use local_is_tls rather than casting to
946 Sized_relobj_file.
947 * object.h (class Object): Add local_is_tls and do_local_is_tls.
948 (class Sized_relobj_file): Add do_local_is_tls.
949 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
950
951 2012-09-11 Alan Modra <amodra@gmail.com>
952
953 PR gold/14566
954 * layout.cc (Layout::set_segment_offsets): When using
955 common-page-size alignment, ensure we are on a new max-page-size
956 page.
957 * output.cc (Output_segment::set_section_addresses): Use
958 abi_pagesize, not common_pagesize for relro boundary.
959 (Output_segment::set_offset): Likewise.
960
961 2012-09-11 Alan Modra <amodra@gmail.com>
962
963 * output.h (Output_data_got::add_global_tls, add_local_tls,
964 add_local_tls_pair): New functions.
965 (Output_data_got::add_local_pair_with_rel): Remove second
966 reloc param. Expand comment.
967 (Output_data_got::Got_entry): Rename use_plt_offset_ to
968 use_plt_or_tls_offset_, similarly for constructor param.
969 (Output_data_got::Got_entry::write): Add got_index param.
970 * output.cc (Output_data_got::add_global_tls, add_local_tls,
971 add_local_tls_pair): New functions.
972 (Output_data_got::Got_entry::write): Handle tls symbols
973 with use_plt_or_tls_offset_ set specially.
974 (Output_data_got::add_local_pair_with_rel): Only one reloc.
975 (Output_data_got::do_write): Replace iterator with index, pass
976 index to entry write function.
977 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
978 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
979 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
980 call.
981 * i386.cc (Target_i386::Scan::local): Likewise.
982 * sparc.cc (Target_sparc::Scan::local): Likewise.
983 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
984 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
985 do_tls_offset_for_global): New functions.
986 (Target_powerpc::Scan::local): Correct TLS relocations and got
987 entry values.
988 (Target_powerpc::Scan::global): Don't emit unnecessary
989 dynamic relocations on TLS GOT entries.
990
991 2012-09-10 Matthias Klose <doko@ubuntu.com>
992
993 * config.in: Disable sanity check for kfreebsd.
994
995 2012-09-10 Sterling Augustine <saugustine@google.com>
996
997 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
998 (Gdb_index::pubtypes_read): New parameter.
999 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1000 to calls.
1001 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1002 pubtypes_object_.
1003
1004 2012-09-09 Alan Modra <amodra@gmail.com>
1005
1006 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1007 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1008 * gc.h (gc_process_relocs): Call target gc_add_reference.
1009 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1010 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1011 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1012 unnecessary cast.
1013 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1014 to cater for when we don't need code offset. Update use.
1015 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1016 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1017 set_opd_valid): New functions.
1018 (Target_powerpc::do_gc_add_reference): New function.
1019 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1020 stashed refs.
1021 (Target_powerpc::do_gc_mark_symbol): New function.
1022
1023 2012-09-06 Cary Coutant <ccoutant@google.com>
1024
1025 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1026 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1027 (Dwarf_die::skip_attributes): Likewise.
1028 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1029 * testsuite/gdb_index_test.cc (inline_func_1): New function.
1030 (main): Call it.
1031 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1032
1033 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
1034
1035 * testsuite/script_test_3.t: Add .got.plt output section
1036 statement.
1037 * testsuite/script_test_4.t: Likewise.
1038
1039 2012-09-05 Alan Modra <amodra@gmail.com>
1040
1041 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1042 update all uses and lose "enum" when using type.
1043
1044 2012-09-05 Alan Modra <amodra@gmail.com>
1045
1046 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1047 * configure: Regenerate.
1048 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1049 (plugin_final_layout.stdout): Likewise.
1050 (memory_test): Set page sizes to 0x1000.
1051 * testsuite/Makefile.in: Regenerate.
1052 * testsuite/discard_locals_test.sh: Add FIXME comment.
1053 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1054 * testsuite/pr14265.t: Add .got output section statement.
1055 * testsuite/script_test_2.t: Likewise.
1056 * testsuite/script_test_3.t: Likewise.
1057 * testsuite/script_test_4.t: Likewise.
1058 * testsuite/script_test_5.t: Likewise.
1059 * testsuite/script_test_6.t: Likewise.
1060 * testsuite/script_test_7.t: Likewise.
1061 * testsuite/script_test_9.t: Likewise.
1062
1063 2012-09-05 Alan Modra <amodra@gmail.com>
1064
1065 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1066 (Powerpc_relocate_functions::Status): New typedef.
1067 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1068 (Target_powerpc::Scan::local): Handle REL64.
1069 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1070 for REL32 and REL64.
1071 (Target_powerpc::symval_for_branch): New function, extracted from..
1072 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
1073 checks. Report overflow errors.
1074
1075 2012-09-05 Alan Modra <amodra@gmail.com>
1076
1077 * object.h (Sized_relobj_file::emit_relocs): Delete.
1078 (Sized_relobj_file::emit_relocs_reltype): Delete.
1079 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1080 relocate_relocs for --emit-relocs.
1081 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1082 * output.h: Update comment.
1083 (Output_segment::first_section): New function.
1084 (Output_segment::first_section_load_address): Use first_section.
1085 * output.cc (Output_segment::first_section): New function extracted..
1086 (Output_segment::first_section_load_address): ..from here. Delete.
1087 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1088 * target.h (Sized_target::relocate_for_relocatable): Likewise.
1089 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1090 adjust call to target.h function.
1091 * i386.cc (Target_i386): Likewise.
1092 * sparc.cc (Target_sparc): Likewise.
1093 * x86_64.cc (Target_x86_64): Likewise.
1094 * powerpc.cc (Target_powerpc): Likewise.
1095 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
1096 first tls section has section symbol for optimised local dynamic
1097 output relocs.
1098 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1099 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1100 optimised tls code.
1101 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1102 Rename to relocate_relocs. Update error message.
1103
1104 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
1105
1106 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1107 --just-symbols.
1108
1109 2012-08-31 Alan Modra <amodra@gmail.com>
1110
1111 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1112 (Powerpc_relobj::toc_base_offset): New stub function.
1113 (Target_powerpc): Add tp_offset, dtp_offset. Rename
1114 got_mod_index_offset to tlsld_got_offset. Update all refs.
1115 (Target_powerpc::Relocate::enum skip_tls): New.
1116 (Target_powerpc::call_tls_get_addr_): New var.
1117 (Target_powerpc::is_branch_reloc): Move to file scope.
1118 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1119 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1120 New functions.
1121 (Target_powerpc::enum Got_type): Delete old values, add new ones.
1122 (powerpc_info): Correct common_pagesize for ppc64.
1123 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1124 (Powerpc_relocate_functions): Add overflow check enums and functions.
1125 Add non-shift version of rela, rela_ua. Delete all rel public
1126 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
1127 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1128 addr16_ha3, addr14 functions.
1129 (Output_data_got_powerpc::add_constant_pair): New function.
1130 (Output_data_got_powerpc::got_base_offset): Likewise.
1131 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1132 (instruction constants): Sort, add some more.
1133 (Output_data_glink::do_write): Add and use Address typedef. Use
1134 object->toc_base_offset() stub for 64-bit.
1135 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1136 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1137 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1138 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
1139 Always treat .opd relocs as against locally defined symbol.
1140 Correct condition for RELATIVE relocs.
1141 (Target_powerpc::do_finalize_sections): Test for NULL sections.
1142 (Target_powerpc::Relocate::relocate): Use plt call stub as value
1143 for 32-bit syms with a plt entry. Correct ppc64 toc base
1144 calculations. Handle TLS relocs, and more. Add overflow
1145 checking and adjust for Powerpc_relocate_functions changes.
1146 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1147 Reinstate --emit-relocs code with FIXME.
1148
1149 2012-08-30 Alan Modra <amodra@gmail.com>
1150
1151 * layout.cc (Layout::set_segment_offsets): Set p_align to
1152 abi_pagesize, not common_pagesize.
1153 (Layout::relaxation_loop_body): Similarly use abi_pagesize
1154 to determine whether file header can go in segment.
1155
1156 2012-08-30 Alan Modra <amodra@gmail.com>
1157
1158 * output.h (Output_reloc::Output_reloc <output section>): Add
1159 is_relative param. Adjust calls.
1160 (Output_reloc::add_output_section_relative): New functions.
1161 * output.cc (Output_reloc::Output_reloc <output section>): Handle
1162 is_relative.
1163 (Output_reloc::symbol_value): Handle SECTION_CODE.
1164
1165 2012-08-24 Sriraman Tallam <tmsriram@google.com>
1166
1167 * gold.cc (queue_middle_tasks): Call layout again when unique
1168 segments for sections is desired.
1169 * layout.cc (Layout::Layout): Initialize new members.
1170 (Layout::get_output_section_flags): New function.
1171 (Layout::choose_output_section): Call get_output_section_flags.
1172 (Layout::layout): Make output section for mapping to a unique segment.
1173 (Layout::insert_section_segment_map): New function.
1174 (Layout::attach_allocated_section_to_segment): Make unique segment for
1175 output sections marked so.
1176 (Layout::segment_precedes): Check for unique segments when sorting.
1177 * layout.h (Layout::Unique_segment_info): New struct.
1178 (Layout::Section_segment_map): New typedef.
1179 (Layout::insert_section_segment_map): New function.
1180 (Layout::get_output_section_flags): New function.
1181 (Layout::is_unique_segment_for_sections_specified): New function.
1182 (Layout::set_unique_segment_for_sections_specified): New function.
1183 (Layout::unique_segment_for_sections_specified_): New member.
1184 (Layout::section_segment_map_): New member.
1185 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1186 Rename is_gc_pass_one to is_pass_one.
1187 Rename is_gc_pass_two to is_pass_two.
1188 Rename is_gc_or_icf to is_two_pass.
1189 Check for which pass based on whether symbols data is present.
1190 Make it two pass when unique segments for sections is desired.
1191 * output.cc (Output_section::Output_section): Initialize new
1192 members.
1193 * output.h (Output_section::is_unique_segment): New function.
1194 (Output_section::set_is_unique_segment): New function.
1195 (Output_section::is_unique_segment_): New member.
1196 (Output_section::extra_segment_flags): New function.
1197 (Output_section::set_extra_segment_flags): New function.
1198 (Output_section::extra_segment_flags_): New member.
1199 (Output_section::segment_alignment): New function.
1200 (Output_section::set_segment_alignment): New function.
1201 (Output_section::segment_alignment_): New member.
1202 (Output_segment::Output_segment): Initialize is_unique_segment_.
1203 (Output_segment::is_unique_segment): New function.
1204 (Output_segment::set_is_unique_segment): New function.
1205 (Output_segment::is_unique_segment_): New member.
1206 * plugin.cc (allow_unique_segment_for_sections): New function.
1207 (unique_segment_for_sections): New function.
1208 (Plugin::load): Add new functions to transfer vector.
1209 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1210 * Makefile.in: Regenerate.
1211 * testsuite/plugin_final_layout.sh: Check if unique segment
1212 functionality works.
1213 * testsuite/plugin_section_order.c (onload): Check if new interfaces
1214 are available.
1215 (allow_unique_segment_for_sections): New global.
1216 (unique_segment_for_sections): New global.
1217 (claim_file_hook): Call allow_unique_segment_for_sections.
1218 (all_symbols_read_hook): Call unique_segment_for_sections.
1219
1220 2012-08-22 Cary Coutant <ccoutant@google.com>
1221
1222 * layout.cc (Layout::include_section): Don't assert on GROUP
1223 sections with --emit-relocs.
1224
1225 2012-08-21 Cary Coutant <ccoutant@google.com>
1226
1227 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1228 if --export-dynamic-symbol names an undef symbol.
1229
1230 2012-08-18 Alan Modra <amodra@gmail.com>
1231
1232 * powerpc.cc: Formatting and white space.
1233 (Powerpc_relobj): Rename got2_section_ to special_.
1234 Add opd_ent_shndx_ and opd_ent_off_ vectors.
1235 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1236 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1237 (Target_powerpc): Add Address typedef and invalid_address. Use
1238 throughout.
1239 (Target_powerpc::is_branch_reloc): New function.
1240 (Powerpc_relocate_functions): Add Address typedef, use throughout.
1241 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1242 for dst_mask, value and addend.
1243 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1244 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1245 (Output_data_glink::do_write): Correct toc base. Don't try to use
1246 uint16_t for 24-bit offset. Use get_output_section_offset and
1247 check return.
1248 (Target_powerpc::Scan::local): Handle more relocs.
1249 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1250 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1251 Plug in toc restoring insn after plt calls. Translate branches
1252 to function descriptor symbols to corresponding entry point.
1253 (Target_powerpc::relocate_for_relocatable): Check return from
1254 get_output_section_offset.
1255 * symtab.h: Comment typo.
1256
1257 2012-08-14 Ian Lance Taylor <iant@google.com>
1258
1259 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1260 unsupported_relocal_local to call unsupported_reloc_global.
1261
1262 2012-08-14 Nick Clifton <nickc@redhat.com>
1263
1264 PR ld/14265
1265 * script-sections.cc (Sections_element::output_section_name): Add
1266 keep return parameter.
1267 (Output_section_element::match_name): Add keep return parameter.
1268 Return the value of the keep_ member.
1269 * script-sections.h (class Output_section): Update
1270 output_section_name prototype.
1271 * layout.cc (Layout::keep_input_section): New public member
1272 function.
1273 (Layout::choose_output_section): Pass keep parameter to
1274 output_section_name.
1275 * layout.h (class Layout): Add keep_input_section.
1276 * object.cc (Sized_relobj_file::do_layout): Check for kept input
1277 sections.
1278 * testsuite/Makefile.am: Add a test.
1279 * testsuite/Makefile.in: Regenerate.
1280 * testsuite/pr14265.c: Source file for the test.
1281 * testsuite/pr14265.t: Linker script for the test.
1282 * testsuite/pr14265.sh: Shell script for the test.
1283
1284 2012-08-14 Alan Modra <amodra@gmail.com>
1285
1286 * target.h (Target::output_section_name): New function.
1287 (Target::do_output_section_name): New function.
1288 * layout.cc (Layout::choose_output_section): Call the above.
1289 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1290
1291 2012-08-14 Alan Modra <amodra@gmail.com>
1292
1293 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1294 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1295 for replace_constant call.
1296 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1297 (Output_data_glink::do_print_to_mapfile): New function.
1298 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1299 (Target_powerpc::Relocate::relocate): Likewise.
1300
1301 2012-08-14 Alan Modra <amodra@gmail.com>
1302
1303 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1304 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1305 (Output_data_glink::add_entry,find_entry): Remove shndx param.
1306 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
1307 all references to shndx_. Handle special case for R_PPC_PLTREL24
1308 here.
1309 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1310 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1311 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1312 here.
1313 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1314 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1315
1316 2012-08-12 Alan Modra <amodra@gmail.com>
1317
1318 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
1319 (glink insn constants): Use uint32_t.
1320 (Output_data_glink::add_entry): Use insert, not [] operator.
1321
1322 2012-08-11 Alan Modra <amodra@gmail.com>
1323
1324 * object.h (Sized_relobj_file::find_shdr): New function.
1325 (Sized_relobj_file::find_special_sections): New function.
1326 * object.cc (Sized_relobj_file::find_shdr): New function.
1327 (Sized_relobj_file::find_eh_frame): Use find_shdr.
1328 (Sized_relobj_file::find_special_sections): New function, split out..
1329 (Sized_relobj_file::do_read_symbols): ..from here.
1330 * output.h (Output_data_got::replace_constant): New function.
1331 (Output_data_got::num_entries): New function.
1332 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1333 (Output_data_got::got_offset): Protected rather than private.
1334 (Output_data_got::replace_got_entry): New function.
1335 * output.cc (Output_data_got::replace_got_entry): New function.
1336 * powerpc.cc (class Powerpc_relobj): New.
1337 (class Powerpc_relocate_functions): Delete all psymval variants or
1338 convert to value,addend type. Delete pcrela, pcrela_unaligned.
1339 Implement _ha functions using corresponding _hi function.
1340 (Powerpc_relobj::find_special_sections): New function.
1341 (Target_powerpc::do_make_elf_object): New function.
1342 (class Output_data_got_powerpc): New.
1343 (class Output_data_glink): New.
1344 (class Powerpc_scan_relocatable_reloc): New.
1345 Many more changes througout file.
1346
1347 2012-08-09 Nick Clifton <nickc@redhat.com>
1348
1349 * po/vi.po: Updated Vietnamese translation.
1350
1351 2012-08-07 Ian Lance Taylor <iant@google.com>
1352
1353 * layout.cc (Layout::add_target_dynamic_tags): If
1354 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1355 plt_rel.
1356
1357 2012-07-30 Nick Clifton <nickc@redhat.com>
1358
1359 * po/gold.pot: Updated template.
1360 * po/es.po: Updated Spanish translation.
1361
1362 2012-07-18 Cary Coutant <ccoutant@google.com>
1363
1364 PR gold/14344
1365 * configure.ac: Add check for -gpubnames support.
1366 * configure: Regenerate.
1367 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1368 support; force -gno-pubnames.
1369 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1370 support.
1371 (gdb_index_test_4): New test.
1372 * testsuite/Makefile.in: Regenerate.
1373 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1374 * testsuite/gdb_index_test_2.sh: Likewise.
1375 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1376 * testsuite/gdb_index_test_4.sh: New script.
1377 * testsuite/gdb_index_test_comm.sh: New script with common code;
1378 don't look for space after colon.
1379
1380 2012-07-16 Sriraman Tallam <tmsriram@google.com>
1381
1382 * gold.cc (queue_middle_tasks): Update function order only after
1383 deferred objects due to plugins are processed.
1384
1385 2012-07-11 Ian Lance Taylor <iant@google.com>
1386
1387 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1388 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1389 (Target_arm::scan_reloc_for_stub): Likewise.
1390 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1391 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1392 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1393 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1394 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1395
1396 2012-07-10 Dodji Seketeli <dodji@redhat.com>
1397 Ian Lance Taylor <iant@google.com>
1398
1399 PR gold/14309
1400 * configure.ac: Test whether std::tr1::hash<off_t> works.
1401 * gold.h: Add a specialization for std::tr1::hash<off_t> if
1402 needed.
1403 * output.h (class Output_fill): Add virtual destructor.
1404 * configure, config.in: Rebuild.
1405
1406 2012-06-22 Roland McGrath <mcgrathr@google.com>
1407
1408 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1409
1410 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
1411
1412 * plugin.cc (Plugin::load): Handle position independent executables.
1413
1414 2012-06-06 Cary Coutant <ccoutant@google.com>
1415
1416 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1417 add .debug_macro.
1418 (lines_only_debug_sections): Likewise.
1419 (gdb_fast_lookup_sections): New static array.
1420 (is_gdb_debug_section): Rename formal parameter.
1421 (is_lines_only_debug_section): Likewise.
1422 (is_gdb_fast_lookup_section): New function.
1423 (Layout::include_section): Check for ".zdebug_" prefix; pass
1424 section name suffix to is_gdb_debug_section, et al.; check for
1425 fast-lookup sections when building .gdb_index.
1426 * options.h (--strip-debug-gdb): Update GDB version number.
1427
1428 2012-06-06 Cary Coutant <ccoutant@google.com>
1429
1430 * configure.ac: Add check for fallocate.
1431 * configure: Regenerate.
1432 * config.in: Regenerate.
1433
1434 * options.h (class General_options): Add --mmap-output-file and
1435 --posix-fallocate options.
1436 * output.cc: (posix_fallocate): Remove; replace with...
1437 (gold_fallocate): New function.
1438 (Output_file::map_no_anonymous): Call gold_fallocate.
1439 (Output_file::map): Check --mmap-output-file option.
1440
1441 2012-06-05 Jing Yu <jingyu@google.com>
1442
1443 * gold.h (textdomain): Add do {} to empty while(0).
1444 (bindtextdomain): Likewise.
1445
1446 2012-06-04 Cary Coutant <ccoutant@google.com>
1447
1448 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1449 has_dynsym_index.
1450
1451 2012-05-25 Sriraman Tallam <tmsriram@google.com>
1452
1453 * symtab.cc (Symbol_table::define_special_symbol):
1454 Initialize *poldsym to prevent uninitialized variable errors.
1455
1456 2012-05-23 Cary Coutant <ccoutant@google.com>
1457
1458 * layout.cc (Layout::section_name_mapping): Add rules to handle
1459 exact match on .data.rel.ro.local or .data.rel.ro.
1460 (Layout::output_section_name): Check for exact matches.
1461
1462 2012-05-23 Cary Coutant <ccoutant@google.com>
1463
1464 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1465 more carefully.
1466
1467 2012-05-22 Cary Coutant <ccoutant@google.com>
1468
1469 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1470 object before exporting symbol.
1471
1472 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
1473
1474 * testsuite/tls_test.cc: Include "config.h" first.
1475 * testsuite/tls_test_c.c: Likewise.
1476
1477 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
1478 Nick Clifton <nickc@redhat.com>
1479
1480 PR 14072
1481 * configure.in: Add check that sysdep.h has been included before
1482 any system header files.
1483 * configure: Regenerate.
1484 * config.in: Regenerate.
1485
1486 2012-05-14 Cary Coutant <ccoutant@google.com>
1487
1488 * layout.cc (Layout::make_output_section): Mark .tdata section
1489 as RELRO.
1490 * testsuite/relro_test.cc: Add a TLS variable.
1491
1492 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
1493
1494 PR gold/14091
1495 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1496 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1497 R_X86_64_64.
1498
1499 2012-05-08 Cary Coutant <ccoutant@google.com>
1500
1501 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1502 (lines_only_debug_sections): Likewise.
1503
1504 2012-05-02 Roland McGrath <mcgrathr@google.com>
1505
1506 * nacl.cc: New file.
1507 * nacl.h: New file.
1508 * Makefile.am (CCFILES, HFILES): Add them.
1509 * Makefile.in: Regenerate.
1510 * i386.cc (Output_data_plt_i386_nacl): New class.
1511 (Output_data_plt_i386_nacl_exec): New class.
1512 (Output_data_plt_i386_nacl_dyn): New class.
1513 (Target_i386_nacl): New class.
1514 (Target_selector_i386_nacl): New class.
1515 (target_selector_i386): Use it instead of Target_selector_i386.
1516 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1517 (Target_x86_64_nacl): New class.
1518 (Target_selector_x86_64_nacl): New class.
1519 (target_selector_x86_64, target_selector_x32): Use it instead of
1520 Target_selector_x86_64.
1521 * arm.cc (Output_data_plt_arm_nacl): New class.
1522 (Target_arm_nacl): New class.
1523 (Target_selector_arm_nacl): New class.
1524 (target_selector_arm, target_selector_armbe): Use it instead of
1525 Target_selector_arm.
1526
1527 * target-select.cc (select_target): Take new Input_file* and off_t
1528 arguments, pass them on to recognize method of selector.
1529 * object.cc (make_elf_sized_object): Update caller.
1530 * parameters.cc (parameters_force_valid_target): Likewise.
1531 * incremental.cc (make_sized_incremental_binary): Likewise.
1532 * target-select.h: Update decl.
1533 (Target_selector::recognize): Take new Input_file* argument,
1534 pass it on to do_recognize.
1535 (Target_selector::do_recognize): Take new Input_file* argument.
1536 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1537 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1538 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1539 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1540
1541 * target.h (Target::Target_info): New members isolate_execinstr
1542 and rosegment_gap.
1543 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1544 * arm.cc (Target_arm::arm_info): Update initializer.
1545 * i386.cc (Target_i386::i386_info): Likewise.
1546 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1547 * sparc.cc (Target_sparc::sparc_info): Likewise.
1548 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1549 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1550 * layout.cc (Layout::attach_allocated_section_to_segment):
1551 Take new const Target* argument. If target->isolate_execinstr(), act
1552 like --rosegment.
1553 (Layout::find_first_load_seg): Take new const Target* argument;
1554 if target->isolate_execinstr(), reject PF_X segments.
1555 (Layout::relaxation_loop_body): Update caller.
1556 (Layout::set_segment_offsets): If target->isolate_execinstr(),
1557 reset file offset to zero when we hit LOAD_SEG, and then do a second
1558 loop over the segments before LOAD_SEG to reassign offsets after
1559 addresses have been determined. Handle target->rosegment_gap().
1560 (Layout::attach_section_to_segment): Take new const Target* argument;
1561 pass it to attach_allocated_section_to_segment.
1562 (Layout::make_output_section): Update caller.
1563 (Layout::attach_sections_to_segments): Take new const Target* argument;
1564 pass it to attach_section_to_segment.
1565 * gold.cc (queue_middle_tasks): Update caller.
1566 * layout.h (Layout): Update method decls with new arguments.
1567
1568 * arm.cc (Target_arm::Target_arm): Take optional argument for the
1569 Target_info pointer to use.
1570 (Target_arm::do_make_data_plt): New virtual method.
1571 (Target_arm::make_data_plt): New method that calls it.
1572 (Target_arm::make_plt_entry): Use it.
1573 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1574 for the section alignment.
1575 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1576 method.
1577 (Output_data_plt_arm::first_plt_entry_offset): Call it.
1578 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1579 method.
1580 (Output_data_plt_arm::get_plt_entry_size): Call it.
1581 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1582 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1583 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1584 method.
1585 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1586 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1587 method instead of sizeof(plt_entry).
1588 (Output_data_plt_arm::add_entry): Likewise.
1589 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1590 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1591 than static method.
1592 (Target_arm::plt_entry_size): Likewise.
1593 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1594 Move to ...
1595 (Output_data_plt_arm_standard): ... here, new class.
1596 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1597 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1598 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1599
1600 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1601 Take additional argument for the PLT entry size.
1602 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1603 Use get_plt_entry_size method rather than plt_entry_size variable.
1604 (Output_data_plt_x86_64::reserve_slot): Likewise.
1605 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1606 (Output_data_plt_x86_64::add_entry): Likewise.
1607 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1608 (Output_data_plt_x86_64::address_for_global): Likewise.
1609 (Output_data_plt_x86_64::address_for_local): Likewise.
1610 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1611 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1612 Make method non-static.
1613 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1614 method.
1615 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1616 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1617 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1618 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1619 virtual method.
1620 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1621 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1622 virtual method.
1623 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1624 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1625 virtual method.
1626 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1627 (Output_data_plt_x86_64::plt_entry_size)
1628 (Output_data_plt_x86_64::first_plt_entry)
1629 (Output_data_plt_x86_64::plt_entry)
1630 (Output_data_plt_x86_64::tlsdesc_plt_entry)
1631 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1632 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1633 (Output_data_plt_x86_64_standard): ... here, new class.
1634 (Target_x86_64::Target_x86_64): Take optional argument for the
1635 Target_info pointer to use.
1636 (Target_x86_64::do_make_data_plt): New virtual method.
1637 (Target_x86_64::make_data_plt): New method to call it.
1638 (Target_x86_64::init_got_plt_for_update): Use that.
1639 Call this->plt_->add_eh_frame method here.
1640 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1641 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1642 rather than static method.
1643 (Target_x86_64::plt_entry_size): Likewise.
1644 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1645 rather than plt_entry_size variable. Move guts of PLT filling to...
1646 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1647 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1648 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1649
1650 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1651 additional argument for the section alignment.
1652 Don't do add_eh_frame_for_plt here.
1653 (Output_data_plt_i386::first_plt_entry_offset): Make the method
1654 non-static. Use get_plt_entry_size method rather than plt_entry_size
1655 variable.
1656 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1657 method.
1658 (Output_data_plt_i386::get_plt_entry_size): Call it.
1659 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1660 (Output_data_plt_i386::add_eh_frame): New method to call it.
1661 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1662 method.
1663 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1664 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1665 method.
1666 (Output_data_plt_i386::fill_plt_entry): New method to call it.
1667 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1668 method instead of plt_entry_size.
1669 (Output_data_plt_i386::plt_entry_size)
1670 (Output_data_plt_i386::plt_eh_frame_fde_size)
1671 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1672 (Output_data_plt_i386_standard): ... here, new class.
1673 (Output_data_plt_i386_exec): New class.
1674 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1675 (Output_data_plt_i386_exec::first_plt_entry): ... here.
1676 (Output_data_plt_i386::exec_plt_entry): Move to ...
1677 (Output_data_plt_i386_exec::plt_entry): ... here.
1678 (Output_data_plt_i386_dyn): New class.
1679 (Output_data_plt_i386::first_plt_entry): Move to ...
1680 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1681 (Output_data_plt_i386::dyn_plt_entry): Move to ...
1682 (Output_data_plt_i386_dyn::plt_entry): ... here.
1683 (Target_i386::Target_i386): Take optional argument for the Target_info
1684 pointer to use.
1685 (Target_i386::do_make_data_plt): New virtual method.
1686 (Target_i386::make_data_plt): New method to call it.
1687 (Target_i386::make_plt_section): Use that.
1688 Call this->plt_->add_eh_frame method here.
1689 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1690 rather than plt_entry_size variable.
1691 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1692 (Output_data_plt_i386::address_for_local): Likewise.
1693 (Output_data_plt_i386::do_write): Likewise.
1694 Move guts of PLT filling to...
1695 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1696 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1697 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1698 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1699
1700 2012-05-01 Cary Coutant <ccoutant@google.com>
1701
1702 * dwarf_reader.cc (Dwarf_die::read_attributes)
1703 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1704 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1705 * reduced_debug_output.cc
1706 (Output_reduced_debug_info_section::get_die_end): Remove
1707 DW_FORM_GNU_ref_index. Add default case.
1708
1709 2012-04-26 Mark Wielaard <mjw@redhat.com>
1710
1711 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1712 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1713 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1714 DW_AT_high_pc as offset from DW_AT_low_pc.
1715
1716 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1717 * testsuite/Makefile.in: Regenerate.
1718 * testsuite/gdb_index_test_3.c: New test source file.
1719 * testsuite/gdb_index_test_3.sh: New test source file.
1720
1721 2012-04-25 Ian Lance Taylor <iant@google.com>
1722
1723 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1724 pointer.
1725 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1726 as a class, not a struct.
1727 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1728 (Target_arm::apply_cortex_a8_workaround): Likewise.
1729 * gc.h: Declare Reloc_types as a struct, not a class.
1730 * object.h: Declare Symbols_data as a struct.
1731 * reloc.h: Declare Read_relocs_data as a struct.
1732 * target.h: Declare Relocate_info as a struct.
1733
1734 2012-04-24 David S. Miller <davem@davemloft.net>
1735
1736 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1737 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1738 and R_SPARC_WPLT30.
1739
1740 2012-04-24 Cary Coutant <ccoutant@google.com>
1741
1742 * incremental-dump.cc (find_input_containing_global): Replace
1743 magic number with symbolic constant.
1744 (dump_incremental_inputs): Update version number.
1745 * incremental.cc (Output_section_incremental_inputs): Update version
1746 number; import symbolic constants from Incremental_inputs_reader.
1747 (Incremental_inputs::create_data_sections): Align relocations
1748 section correctly for 64-bit targets.
1749 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1750 constants; add padding.
1751 (Output_section_incremental_inputs::write_header): Add assert for
1752 header_size.
1753 (Output_section_incremental_inputs::write_input_files): Add assert
1754 for input_entry_size.
1755 (Output_section_incremental_inputs::write_info_blocks): Add padding;
1756 add assert for object_info_size, input_section_entry_size,
1757 global_sym_entry_size.
1758 * incremental.h (Incremental_inputs_reader): Add symbolic constants
1759 for data structure sizes; use them.
1760 (Incremental_input_entry_reader): Import symbolic constants from
1761 Incremental_inputs_reader; use them.
1762
1763 2012-04-23 David S. Miller <davem@davemloft.net>
1764
1765 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1766 and elf_flags_set_.
1767 (Target_sparc::Target_sparc): Initialize new fields.
1768 (Target_sparc::do_make_elf_object): New function.
1769 (Target_sparc::do_adjust_elf_header): New function.
1770
1771 2012-04-23 Cary Coutant <ccoutant@google.com>
1772
1773 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1774 CU range table of gdb index.
1775
1776 2012-04-20 David S. Miller <davem@davemloft.net>
1777
1778 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1779 instead of false.
1780
1781 2012-04-16 David S. Miller <davem@davemloft.net>
1782
1783 * sparc.cc (Target_sparc::got_address): New function.
1784 (Sparc_relocate_functions::gdop_hix22): New function.
1785 (Sparc_relocate_functions::gdop_lox10): New function.
1786 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1787 relocs.
1788 (Target_sparc::Scan::local): Likewise if the global symbol is not
1789 preemptible and is not IFUNC.
1790 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1791 transformations for local and non-preemptible non-IFUNC global
1792 symbols.
1793
1794 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1795 writing out 64-bit part of ranges.
1796
1797 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1798 -fpic and -fpie respectively.
1799 * Makefile.in: Regenerate.
1800
1801 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1802 (Target_sparc::Target_sparc): Initialize new field.
1803 (Target_sparc::do_plt_section_for_global): New function.
1804 (Target_sparc::do_plt_section_for_local): New function.
1805 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1806 (Target_sparc::make_plt_section): New function, broken out of
1807 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1808 (Target_sparc::make_plt_entry): Call make_plt_section.
1809 (Target_sparc::make_local_ifunc_plt_entry): New function.
1810 (Target_sparc::rela_ifunc_section): New function.
1811 (Target_sparc::plt_section): Remove const.
1812 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1813 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1814 and ifunc_count_ fields.
1815 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1816 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1817 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1818 (Output_data_plt_sparc::rela_ifunc): New function.
1819 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1820 (Output_data_plt_sparc::has_ifunc_section): New function.
1821 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1822 (Output_data_plt_sparc::address_for_global): New function.
1823 (Output_data_plt_sparc::address_for_local): New function.
1824 (Output_data_plt_sparc::plt_index_to_offset): New function.
1825 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1826 and entry_count.
1827 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1828 entry_count.
1829 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1830 R_SPARC_JMP_IREL to switch.
1831 (Target_sparc::Scan::check_non_pic): Likewise.
1832 (Target_sparc::Scan::local): Handle IFUNC symbols.
1833 (Target_sparc::Scan::local): Likewise.
1834 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1835 and plt_address_for_local.
1836 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1837 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1838
1839 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1840 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1841 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1842 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1843 global relocs too.
1844 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1845 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1846 calls.
1847 * sparc.cc (Target_sparc::Scan::global): Likewise.
1848 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1849
1850 2012-04-16 Cary Coutant <ccoutant@google.com>
1851
1852 * archive.cc (Library_base::should_include_member): Check for
1853 --export-dynamic-symbol.
1854 * options.h (class General_options): Add --export-dynamic-symbol.
1855 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1856 --export-dynamic-symbol.
1857 (Symbol_table::gc_mark_undef_symbols): Likewise.
1858 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1859
1860 2012-04-12 David S. Miller <davem@davemloft.net>
1861
1862 * sparc.cc (Reloc::wdisp10): New relocation method.
1863 (Reloc::h34): Likewise.
1864 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1865 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1866 R_SPARC_WDISP10.
1867 (Target_sparc::Scan::local): Likewise.
1868 (Target_sparc::Scan::global): Likewise.
1869 (Target_sparc::Relocate::relocate): Likewise.
1870
1871 2012-04-09 Cary Coutant <ccoutant@google.com>
1872
1873 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1874 low_pc == 0.
1875
1876 2012-04-06 Ian Lance Taylor <iant@google.com>
1877
1878 * timer.cc: #include <unistd.h>.
1879
1880 2012-04-06 Roland McGrath <mcgrathr@google.com>
1881
1882 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1883 * config.in: Regenerate.
1884 * configure: Regenerate.
1885
1886 2012-04-05 Nick Clifton <nickc@redhat.com>
1887
1888 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1889 (AM_LC_MESSAGES): Add.
1890 * aclocal.m4: Regenerate.
1891 * config.in: Regenerate.
1892 * configure: Regenerate.
1893
1894 2012-03-21 Cary Coutant <ccoutant@google.com>
1895
1896 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1897 * Makefile.in: Regenerate.
1898 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1899 (Sized_elf_reloc_mapper::symbol_section): New function.
1900 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1901 (make_elf_reloc_mapper): New function.
1902 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1903 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1904 (Dwarf_abbrev_table::do_get_abbrev): New function.
1905 (Dwarf_ranges_table::read_ranges_table): New function.
1906 (Dwarf_ranges_table::read_range_list): New function.
1907 (Dwarf_pubnames_table::read_section): New function.
1908 (Dwarf_pubnames_table::read_header): New function.
1909 (Dwarf_pubnames_table::next_name): New function.
1910 (Dwarf_die::Dwarf_die): New function.
1911 (Dwarf_die::read_attributes): New function.
1912 (Dwarf_die::skip_attributes): New function.
1913 (Dwarf_die::set_name): New function.
1914 (Dwarf_die::set_linkage_name): New function.
1915 (Dwarf_die::attribute): New function.
1916 (Dwarf_die::string_attribute): New function.
1917 (Dwarf_die::int_attribute): New function.
1918 (Dwarf_die::uint_attribute): New function.
1919 (Dwarf_die::ref_attribute): New function.
1920 (Dwarf_die::child_offset): New function.
1921 (Dwarf_die::sibling_offset): New function.
1922 (Dwarf_info_reader::check_buffer): New function.
1923 (Dwarf_info_reader::parse): New function.
1924 (Dwarf_info_reader::do_parse): New function.
1925 (Dwarf_info_reader::do_read_string_table): New function.
1926 (Dwarf_info_reader::lookup_reloc): New function.
1927 (Dwarf_info_reader::get_string): New function.
1928 (Dwarf_info_reader::visit_compilation_unit): New function.
1929 (Dwarf_info_reader::visit_type_unit): New function.
1930 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1931 Sized_elf_reloc_mapper.
1932 (Sized_dwarf_line_info::symbol_section): Remove function.
1933 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1934 (Sized_dwarf_line_info::read_line_mappings): Remove object
1935 parameter, adjust callers.
1936 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1937 * dwarf_reader.h: Include <sys/types.h>.
1938 (class Track_relocs): Remove forward declaration.
1939 (class Elf_reloc_mapper): New class.
1940 (class Sized_elf_reloc_mapper): New class.
1941 (class Dwarf_abbrev_table): New class.
1942 (class Dwarf_range_list): New class.
1943 (class Dwarf_ranges_table): New class.
1944 (class Dwarf_pubnames_table): New class.
1945 (class Dwarf_die): New class.
1946 (class Dwarf_info_reader): New class.
1947 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1948 (Sized_dwarf_line_info::symbol_section): Remove member function.
1949 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1950 base class.
1951 * gdb-index.cc: New source file.
1952 * gdb-index.h: New source file.
1953 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1954 and .debug_types sections, call Layout::add_to_gdb_index.
1955 (Sized_relobj_incr::do_section_name): Implement.
1956 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1957 return type; Implement.
1958 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1959 return type.
1960 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1961 parameter list and return type.
1962 (Sized_incr_dynobj::do_section_contents): Likewise.
1963 * layout.cc: Include gdb-index.h.
1964 (Layout::Layout): Initialize gdb_index_data_.
1965 (Layout::init_fixed_output_section): Check for .gdb_index section.
1966 (Layout::add_to_gdb_index): New function. Instantiate.
1967 * layout.h: Add forward declaration for class Gdb_index.
1968 (Layout::add_to_gdb_index): New member function.
1969 (Layout::gdb_index_data_): New data member.
1970 * main.cc: Include gdb-index.h.
1971 (main): Print statistics for gdb index.
1972 * object.cc (Object::section_contents): Move code into
1973 do_section_contents.
1974 (need_decompressed_section): Check for sections needed when building
1975 gdb index.
1976 (build_compressed_section_map): Likewise.
1977 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1978 gdb index.
1979 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1980 sections; call Layout::add_to_gdb_index.
1981 (Sized_relobj_file::do_decompressed_section_contents): Call
1982 do_section_contents directly.
1983 * object.h (Object::do_section_contents): Adjust parameter list and
1984 return type.
1985 (Object::do_decompressed_section_contents): Call do_section_contents
1986 directly.
1987 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1988 return type.
1989 * options.h (class General_options): Add --gdb-index option.
1990 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1991 list and return type.
1992 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1993 * reloc.h (Track_relocs::checkpoint): New function.
1994 (Track_relocs::reset): New function.
1995
1996 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1997 New test cases.
1998 * testsuite/Makefile.in: Regenerate.
1999 * testsuite/gdb_index_test.cc: New test source file.
2000 * testsuite/gdb_index_test_1.sh: New test source file.
2001 * testsuite/gdb_index_test_2.sh: New test source file.
2002
2003 2012-03-19 Doug Kwan <dougkwan@google.com>
2004
2005 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2006 (Target_arm::do_finalize_sections): Remove code which defines
2007 __exidx_start and __exidx_end. Make symbol table parameter
2008 anonymous as it is not used.
2009 * gold.cc (queue_middle_tasks): Call target hook to define any
2010 target-specific symbols.
2011 * target.h (Target::define_standard_symbols): New method.
2012 (Target::do_define_standard_symbols): Same.
2013 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2014 * testsuite/Makefile.in: Regenerate.
2015 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2016 and __exidx_end.
2017 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2018 relocations are generated for __exidx_start and __exidx_end.
2019
2020 2012-03-16 Doug Kwan <dougkwan@google.com>
2021
2022 * testsuite/Makefile.am: Disable test initpri3b.
2023 * testsuite/Makefile.in: Regenerate.
2024
2025 2012-03-15 Doug Kwan <dougkwan@google.com>
2026
2027 * arm.cc (Target_arm::got_section): Make .got section read-only
2028 if -z now is given.
2029
2030 2012-03-15 Ian Lance Taylor <iant@google.com>
2031
2032 PR gold/13850
2033 * layout.cc (Layout::make_output_section): Correctly mark
2034 SHT_INIT_ARRAY, et. al., as relro.
2035
2036 2012-03-14 Doug Kwan <dougkwan@google.com>
2037
2038 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2039 dynamic relocations for protected symbols in shared objects.
2040
2041 2012-03-13 Ian Lance Taylor <iant@google.com>
2042
2043 * resolve.cc (Symbol_table::resolve): When merging common symbols,
2044 keep the larger alignment.
2045
2046 2012-03-12 Cary Coutant <ccoutant@google.com>
2047
2048 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2049 handling of DW_LNE_define_file.
2050
2051 2012-03-12 Cary Coutant <ccoutant@google.com>
2052
2053 * reduced_debug_output.cc
2054 (Output_reduced_debug_info_section::get_die_end): Add new FORM
2055 codes to switch.
2056
2057 2012-02-29 Cary Coutant <ccoutant@google.com>
2058
2059 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2060
2061 2012-02-29 Cary Coutant <ccoutant@google.com>
2062
2063 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2064 Call Object::decompressed_section_contents.
2065 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2066 New dtor.
2067 (Sized_dwarf_line_info::buffer_start_): New data member.
2068 * merge.cc (Output_merge_data::do_add_input_section): Call
2069 Object::decompressed_section_contents.
2070 (Output_merge_string::do_add_input_section): Likewise.
2071 * object.cc (need_decompressed_section): New function.
2072 (build_compressed_section_map): Decompress sections needed later.
2073 (Sized_relobj_file::do_decompressed_section_contents): New function.
2074 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2075 * object.h (Object::decompressed_section_contents): New function.
2076 (Object::discard_decompressed_sections): New function.
2077 (Object::do_decompressed_section_contents): New function.
2078 (Object::do_discard_decompressed_sections): New function.
2079 (Compressed_section_info): New type.
2080 (Compressed_section_map): Include decompressed section contents.
2081 (Sized_relobj_file::do_decompressed_section_contents): New function.
2082 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2083
2084 2012-02-16 Cary Coutant <ccoutant@google.com>
2085
2086 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2087 * testsuite/Makefile.in: Regenerate.
2088
2089 2012-02-14 Cary Coutant <ccoutant@google.com>
2090
2091 * options.cc (General_options::finalize): Disallow -pie and -static.
2092
2093 2012-02-03 Doug Kwan <dougkwan@google.com>
2094
2095 * arm.cc (Arm_relocate_functions::abs8,
2096 Arm_relocate_functions::abs16): Use
2097 Bits::has_signed_unsigned_overflow32.
2098 (Arm_relocate_functions::thm_abs8): Correct range of
2099 overflow check.
2100 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2101 in assertions.
2102
2103 2012-02-02 Doug Kwan <dougkwan@google.com>
2104
2105 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2106 position independent outputs, not just shared objects.
2107
2108 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
2109
2110 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2111 * configure: Regenerated.
2112
2113 2012-01-27 Ian Lance Taylor <iant@google.com>
2114
2115 * reloc.h (Bits): New class with static functions, copied from
2116 namespace utils in arm.cc.
2117 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
2118 instead.
2119
2120 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2121
2122 * incremental.cc (write_info_blocks): Correct relocation offset.
2123
2124 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2125
2126 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2127 (Relocate::tls_gd_to_le): Likewise.
2128
2129 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2130
2131 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2132
2133 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2134
2135 * configure.ac: Check if -mcmodel=medium works.
2136 * configure: Regenerated.
2137
2138 2012-01-24 Cary Coutant <ccoutant@google.com>
2139
2140 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2141 definition and ...
2142 (read_unsigned_LEB_128_x): ... this new function.
2143 (read_signed_LEB_128): Replaced with inline definition and ...
2144 (read_signed_LEB_128_x): ... this new function.
2145 * int_encoding.h (read_unsigned_LEB_128_x): New function.
2146 (read_unsigned_LEB_128): Add inline definition.
2147 (read_signed_LEB_128_x): New function.
2148 (read_signed_LEB_128): Add inline definition.
2149 * testsuite/Makefile.am (leb128_unittest): New unit test.
2150 * testsuite/Makefile.in: Regenerate.
2151 * testsuite/leb128_unittest.cc: New unit test.
2152
2153 2012-01-23 Ian Lance Taylor <iant@google.com>
2154
2155 PR gold/13617
2156 * i386.cc (Target_i386::do_code_fill): When using a jmp
2157 instruction, pad with nop instructions.
2158 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2159
2160 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
2161
2162 * x86_64.cc (gc_process_relocs): Add typename on types used in
2163 template.
2164 (scan_relocs): Likewise.
2165 (relocate_section): Likewise.
2166 (apply_relocation): Likewise.
2167
2168 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
2169
2170 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2171 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2172 under x32.
2173
2174 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
2175
2176 * x86_64.cc: Initial support for x32.
2177
2178 2012-01-03 Cary Coutant <ccoutant@google.com>
2179
2180 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2181 Use abstract base class for GOT.
2182 * gold/output.h (class Output_data_got_base): New abstract base class.
2183 (class Output_data_got): Derive from new base class, adjust ctors.
2184 (Output_data_got::reserve_slot): Make virtual; rename to
2185 do_reserve_slot; Adjust callers.
2186 * gold/target.h (Sized_target::init_got_plt_for_update): Return
2187 pointer to abstract base class.
2188 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2189
2190 2011-12-18 Ian Lance Taylor <iant@google.com>
2191
2192 * object.h (Relobj::local_symbol_value): New function.
2193 (Relobj::local_plt_offset): New function.
2194 (Relobj::local_has_got_offset): New function.
2195 (Relobj::local_got_offset): New function.
2196 (Relobj::set_local_got_offset): New function.
2197 (Relobj::do_local_symbol_value): New pure virtual function.
2198 (Relobj::do_local_plt_offset): Likewise.
2199 (Relobj::do_local_has_got_offset): Likewise.
2200 (Relobj::do_local_got_offset): Likewise.
2201 (Relobj::do_set_local_got_offset): Likewise.
2202 (Sized_relobj::do_local_has_got_offset): Rename from
2203 local_has_got_offset.
2204 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2205 (Sized_relobj::do_set_local_got_offset): Rename from
2206 set_local_got_offset.
2207 (Sized_relobj_file::do_local_plt_offset): Rename from
2208 local_plt_offset.
2209 (Sized_relobj_file::do_local_symbol_value): New function.
2210 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2211 local_plt_offset.
2212 * output.cc (Output_data_got::Got_entry::write): Change object to
2213 Relobj. Use local_symbol_value.
2214 (Output_data_got::add_global_with_rel): Change rel_dyn to
2215 Output_data_reloc_generic*. Use add_global_generic.
2216 (Output_data_got::add_global_with_rela): Remove. Change all
2217 callers to use add_global_with_rel.
2218 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2219 Output_data_reloc_generic*. Use add_global_generic.
2220 (Output_data_got::add_global_pair_with_rela): Remove. Change all
2221 callers to use add_global_pair_with_rel.
2222 (Output_data_got::add_local): Change object to Relobj*.
2223 (Output_data_got::add_local_plt): Likewise.
2224 (Output_data_got::add_local_with_rel): Change object to Relobj*,
2225 change rel_dyn to Output_data_reloc_generic*. Use
2226 add_local_generic.
2227 (Output_data_got::add_local_with_rela): Remove. Change all
2228 callers to use all_local_with_rel.
2229 (Output_data_got::add_local_pair_with_rel): Change object to
2230 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
2231 add_output_section_generic.
2232 (Output_data_got::add_local_pair_with_rela): Remove. Change all
2233 callers to use add_local_pair_with_rel.
2234 (Output_data_got::reserve_local): Change object to Relobj*.
2235 * output.h: (class Output_data_reloc_generic): Add pure virtual
2236 declarations for add_global_generic, add_local_generic,
2237 add_output_section_generic.
2238 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2239 functions for Output_data_reloc_generic. Update declarations for
2240 changes listed in output.cc.
2241 (class Output_data_got): Change template parameter to got_size.
2242 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
2243 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2244 function.
2245 (Sized_relobj_incr::do_local_plt_offset): New function.
2246 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2247 add_global_generic.
2248
2249 2011-12-17 Cary Coutant <ccoutant@google.com>
2250
2251 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2252 * resolve.cc (Symbol_table::resolve): Likewise.
2253 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2254 arrays.
2255 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2256
2257 2011-12-16 Ian Lance Taylor <iant@google.com>
2258
2259 * output.h (Output_data_reloc_generic::add): Only call
2260 add_dynamic_reloc if this is a dynamic reloc section.
2261
2262 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
2263
2264 PR gold/13505
2265 * target-reloc.h (apply_relocation): Replace <64, false> with
2266 <size, big_endian>.
2267
2268 2011-11-25 Nick Clifton <nickc@redhat.com>
2269
2270 * po/it.po: New Italian translation.
2271
2272 2011-11-17 Sterling Augustine <saugustine@google.com>
2273
2274 * script.cc (script_include_directive): Implement.
2275 (read_script_file): New local variables name and search_path. Update
2276 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2277 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2278 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2279
2280 2011-11-11 Sterling Augustine <saugustine@google.com>
2281
2282 * yyscript.y (section_cmd): Add support for INCLUDE directive.
2283 (file_or_sections_cmd): Likewise.
2284
2285 2011-11-11 Doug Kwan <dougkwan@google.com>
2286
2287 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2288 if --just-symbols is given.
2289
2290 2011-11-10 Doug Kwan <dougkwan@google.com>
2291
2292 PR gold/13362
2293 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2294 when processing data relocs.
2295 * reloc.h (Relocate_functions::rel_unaligned): New method.
2296 (Relocate_functions::pcrel_unaligned): Ditto.
2297 (Relocate_functions::rel32_unaligned): Ditto.
2298 (Relocate_functions::pcrel32_unaligned): Ditto.
2299
2300 2011-11-09 Doug Kwan <dougkwan@google.com>
2301
2302 PR gold/13362
2303 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2304 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2305 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2306 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2307 (Relocate_functions::rel_unaligned): New.
2308 (Relocate_functions::rel32_unaligned): New.
2309 * target-reloc.h (relocate_for_relocatable): Add code to handle
2310 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2311 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2312 arm_unaligned_reloc_r): New targets.
2313 * testsuite/Makefile.in: Regenerate.
2314 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2315 linking.
2316
2317 2011-11-02 Ian Lance Taylor <iant@google.com>
2318
2319 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
2320 NATIVE_LINKER.
2321 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2322 * options.cc (General_options::finalize): Use library search path
2323 from configure script if specified. If not native and no sysroot,
2324 only search TOOLLIBDIR.
2325 * options.h (Search_directory::Search_directory): Change name to
2326 const std::string&.
2327 (General_options::add_to_library_path_with_sysroot): Change arg to
2328 const std::string&.
2329 * configure, Makefile.in, config.in: Rebuild.
2330
2331 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2332
2333 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2334 we are working around the ARM1176 Erratum.
2335 * options.h (General_options::fix_arm1176): Add option.
2336 * testsuite/Makefile.am: Add testcases, and keep current ones
2337 working.
2338 * testsuite/Makefile.in: Regenerate.
2339 * testsuite/arm_fix_1176.s: New file.
2340 * testsuite/arm_fix_1176.sh: Likewise.
2341
2342 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2343
2344 * arm.cc (Target_arm::Target_arm): Remove initialisation of
2345 may_use_blx_.
2346 (Target_arm::may_use_blx): Remove method.
2347 (Target_arm::set_may_use_blx): Likewise.
2348 (Target_arm::may_use_v4t_interworking): New method.
2349 (Target_arm::may_use_v5t_interworking): Likewise.
2350 (Target_arm::may_use_blx_): Remove member variable.
2351 (Arm_relocate_functions::arm_branch_common): Check for v5T
2352 interworking.
2353 (Arm_relocate_functions::thumb_branch_common): Likewise.
2354 (Reloc_stub::stub_type_for_reloc): Likewise.
2355 (Target_arm::do_finalize_sections): Correct interworking checks.
2356 * testsuite/Makefile.am: Add new tests.
2357 * testsuite/Makefile.in: Regenerate.
2358 * testsuite/arm_farcall_arm_arm.s: New test.
2359 * testsuite/arm_farcall_arm_arm.sh: Likewise.
2360 * testsuite/arm_farcall_arm_thumb.s: Likewise.
2361 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2362 * testsuite/arm_farcall_thumb_arm.s: Likewise.
2363 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2364 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2365 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2366
2367 2011-10-31 Cary Coutant <ccoutant@google.com>
2368
2369 PR gold/13023
2370 * expression.cc (Expression::eval_with_dot): Add
2371 is_section_dot_assignment parameter.
2372 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
2373 absolute and assigning to dot within a section.
2374 * script-sections.cc
2375 (Output_section_element_assignment::set_section_addresses): Pass
2376 dot_section to set_if_absolute.
2377 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2378 as is_section_dot_assignment flag to eval_with_dot.
2379 (Output_section_element_dot_assignment::set_section_addresses):
2380 Likewise.
2381 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2382 parameter. Also set value if relative to dot_section; set the
2383 symbol's output_section.
2384 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2385 parameter. Adjust all callers.
2386 (Expression::eval_maybe_dot): Likewise.
2387 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2388 Adjust all callers.
2389 * testsuite/script_test_2.t: Test assignment of an absolute value
2390 to dot within an output section element.
2391
2392 2011-10-31 Cary Coutant <ccoutant@google.com>
2393
2394 * options.h (class General_options): Add --[no-]gnu-unique options.
2395 * symtab.cc (Symbol_table::sized_write_globals): Convert
2396 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2397
2398 2011-10-31 Cary Coutant <ccoutant@google.com>
2399
2400 PR gold/13359
2401 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2402 unnecessary assertion.
2403 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2404
2405 2011-10-31 Sriraman Tallam <tmsriram@google.com>
2406
2407 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2408 gc_mark_symbol.
2409 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2410 gc_mark_symbol.
2411 Change to just keep the section associated with symbol.
2412 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2413 they are externally visible and --export-dynamic is turned on.
2414 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2415
2416 2011-10-19 Ian Lance Taylor <iant@google.com>
2417
2418 PR gold/13163
2419 * script-sections.cc
2420 (Output_section_element_dot_assignment::needs_output_section): New
2421 function.
2422
2423 2011-10-19 Ian Lance Taylor <iant@google.com>
2424
2425 PR gold/13204
2426 * layout.cc (Layout::segment_precedes): Don't assert failure if a
2427 --section-start option was seen.
2428 * options.h (General_options::any_section_start): New function.
2429
2430 2011-10-18 David S. Miller <davem@davemloft.net>
2431
2432 PR binutils/13301
2433 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2434 member to track relocation locations that have moved during TLS
2435 reloc optimizations.
2436 (Target_sparc::Relocate::Relocate): Initialize to NULL.
2437 (Target_sparc::Relocate::relocate): Adjust view down by 4
2438 bytes if it matches reloc_adjust_addr_.
2439 (Target_sparc::Relocate::relocate_tls): Always move the
2440 __tls_get_addr call delay slot instruction forward 4 bytes when
2441 performing relaxation.
2442
2443 2011-10-18 Cary Coutant <ccoutant@google.com>
2444
2445 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2446 (Output_file::map_no_anonymous): Check for non-zero
2447 return code from posix_fallocate.
2448
2449 2011-10-17 Cary Coutant <ccoutant@google.com>
2450
2451 PR gold/13245
2452 * plugin.cc (is_visible_from_outside): Check for symbols
2453 referenced from dynamic objects.
2454 * resolve.cc (Symbol_table::resolve): Don't count references
2455 from dynamic objects as references from real ELF files.
2456 * testsuite/plugin_test_2.sh: Adjust expected result.
2457
2458 2011-10-17 Cary Coutant <ccoutant@google.com>
2459
2460 * gold.cc: Include timer.h.
2461 (queue_middle_tasks): Stamp time.
2462 (queue_final_tasks): Likewise.
2463 * main.cc (main): Store timer in parameters. Print timers
2464 for each pass.
2465 * parameters.cc (Parameters::Parameters): Initialize timer_.
2466 (Parameters::set_timer): New function.
2467 (set_parameters_timer): New function.
2468 * parameters.h (Parameters::set_timer): New function.
2469 (Parameters::timer): New function.
2470 (Parameters::timer_): New data member.
2471 (set_parameters_timer): New function.
2472 * timer.cc (Timer::stamp): New function.
2473 (Timer::get_pass_time): New function.
2474 * timer.h (Timer::stamp): New function.
2475 (Timer::get_pass_time): New function.
2476 (Timer::pass_times_): New data member.
2477
2478 2011-10-17 Cary Coutant <ccoutant@google.com>
2479
2480 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2481 task for members of lib groups.
2482
2483 2011-10-17 Cary Coutant <ccoutant@google.com>
2484
2485 PR gold/13288
2486 * fileread.cc (File_read::find_view): Add assert.
2487 (File_read::make_view): Move bounds check (replace with assert)...
2488 (File_read::find_or_make_view): ... to here.
2489
2490 2011-10-12 Cary Coutant <ccoutant@google.com>
2491
2492 * output.cc (Output_file::open_base_file): Handle case where
2493 ::read returns less than requested size.
2494
2495 2011-10-10 Cary Coutant <ccoutant@google.com>
2496
2497 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2498 Initialize defined_count_.
2499 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2500 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2501 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2502 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2503 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2504 * incremental.h (Sized_relobj_incr::defined_count_): New data
2505 member.
2506 (Sized_incr_dynobj::defined_count_): New data member.
2507 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2508 Return zeroes instead of internal error.
2509
2510 2011-10-10 Cary Coutant <ccoutant@google.com>
2511
2512 PR gold/13249
2513 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2514 (Output_reloc::symbol_value): Return PLT offset if flag is set.
2515 * output.h (class Output_reloc): Add use_plt_offset flag.
2516 (Output_reloc::type_): Adjust size of bit field.
2517 (Output_reloc::use_plt_offset_): New bit field.
2518 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2519 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2520 flag. Adjust all callers.
2521 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2522 creating RELATIVE relocations.
2523
2524 2011-10-10 Nick Clifton <nickc@redhat.com>
2525
2526 * po/es.po: Updated Spanish translation.
2527 * po/fi.po: Updated Finnish translation.
2528
2529 2011-10-03 Diego Novillo <dnovillo@google.com>
2530
2531 * options.cc (parse_uint): Fix dereference of RETVAL.
2532
2533 2011-09-29 Sriraman Tallam <tmsriram@google.com>
2534
2535 * layout.h (section_order_map_): New member.
2536 (get_section_order_map): New member function.
2537 * output.cc (Output_section::add_input_section): Check for patterns
2538 only when --section-ordering-file is specified.
2539 * gold.cc (queue_middle_tasks): Delay updating order of sections till
2540 output_sections have been formed.
2541 * layout.cc (Layout_Layout): Initialize section_order_map_.
2542 * plugin.cc (update_section_order): Store order in order_map. Do not
2543 update the order.
2544 * testsuite/Makefile.am: Add test case for plugin_final_layout.
2545 * testsuite/Makefile.in: Regenerate.
2546 * testsuite/plugin_section_order.c: New file.
2547 * testsuite/plugin_final_layout.cc: New file.
2548 * testsuite/plugin_final_layout.sh: New file.
2549
2550 2011-09-29 Cary Coutant <ccoutant@google.com>
2551
2552 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2553 Check for NULL.
2554 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2555 symbols during incremental update.
2556 (Symbol_table::add_from_dynobj): Likewise.
2557
2558 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2559 Ian Lance Taylor <iant@google.com>
2560
2561 * symtab.cc (Symbol_table::define_special_symbol): Always
2562 canonicalize version string.
2563
2564 2011-09-26 Cary Coutant <ccoutant@google.com>
2565
2566 * gold.cc (queue_initial_tasks): Move option checks ...
2567 * options.cc (General_options::finalize): ... to here. Disable
2568 some options; make others fatal.
2569
2570 2011-09-26 Cary Coutant <ccoutant@google.com>
2571
2572 gcc PR lto/47247
2573 * plugin.cc (get_symbols_v2): New function.
2574 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2575 (is_referenced_from_outside): New function.
2576 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2577 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2578 (get_symbols): Pass version parameter.
2579 (get_symbols_v2): New function.
2580 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2581 parameter.
2582 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2583 (onload): Add LDPT_GET_SYMBOLS_V2.
2584 (all_symbols_read_hook): Use get_symbols_v2; check for
2585 LDPR_PREVAILING_DEF_IRONLY_EXP.
2586 * testsuite/plugin_test_3.sh: Update expected results.
2587
2588 2011-09-23 Simon Baldwin <simonb@google.com>
2589
2590 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2591 configuration options.
2592 * configure: Regenerate.
2593 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2594 * Makefile.in: Regenerate.
2595 * testsuite/Makefile.in: Regenerate.
2596
2597 2011-09-19 Sriraman Tallam <tmsriram@google.com>
2598
2599 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2600
2601 2011-09-19 Cary Coutant <ccoutant@google.com>
2602
2603 * incremental.cc (can_incremental_update): Fix typo in comment.
2604 * incremental.h (can_incremental_update): Likewise.
2605
2606 2011-09-18 Cary Coutant <ccoutant@google.com>
2607
2608 * incremental.cc (can_incremental_update): New function.
2609 * incremental.h (can_incremental_update): New function.
2610 * layout.cc (Layout::init_fixed_output_section): Call it.
2611 (Layout::make_output_section): Don't allow patch space in .eh_frame.
2612 * object.cc (Sized_relobj_file::do_layout): Call
2613 can_incremental_update.
2614
2615 2011-09-13 Cary Coutant <ccoutant@google.com>
2616
2617 * configure.ac: Check for glibc support for gnu_indirect_function
2618 support with static linking, setting automake conditional
2619 IFUNC_STATIC.
2620 * Makefile.in: Regenerate.
2621 * configure: Regenerate.
2622
2623 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2624 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2625 for IFUNC_STATIC.
2626 * testsuite/Makefile.in: Regenerate.
2627
2628 2011-09-13 Cary Coutant <ccoutant@google.com>
2629
2630 * incremental.cc (Sized_relobj_incr::do_layout): Call
2631 report_comdat_group for kept comdat sections.
2632 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2633 * testsuite/Makefile.in: Regenerate.
2634 * testsuite/incr_comdat_test_1.cc: New source file.
2635 * testsuite/incr_comdat_test_2_v1.cc: New source file.
2636 * testsuite/incr_comdat_test_2_v2.cc: New source file.
2637 * testsuite/incr_comdat_test_2_v3.cc: New source file.
2638
2639 2011-09-13 Ian Lance Taylor <iant@google.com>
2640
2641 * object.cc (Sized_relobj_file::do_layout): Remove unused local
2642 variable external_symbols_offset.
2643
2644 2011-09-12 Ian Lance Taylor <iant@google.com>
2645
2646 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2647 triggered if object has no symbols.
2648
2649 2011-09-09 David S. Miller <davem@davemloft.net>
2650
2651 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2652 (Output_fill_debug_line::do_write): Likewise.
2653
2654 2011-08-29 Cary Coutant <ccoutant@google.com>
2655
2656 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2657 casts to match formatting specs.
2658 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2659
2660 2011-08-26 Cary Coutant <ccoutant@google.com>
2661
2662 * layout.cc (Free_list::allocate): Provide guarantee of minimum
2663 remaining hole size when allocating.
2664 (Layout::make_output_section): Set fill methods for debug sections.
2665 * layout.h (Free_list::Free_list_node): Move from private to
2666 public.
2667 (Free_list::set_min_hole_size): New function.
2668 (Free_list::begin, Free_list::end): New functions.
2669 (Free_list::min_hole_): New data member.
2670 * output.cc: Include dwarf.h.
2671 (Output_fill_debug_info::do_minimum_hole_size): New function.
2672 (Output_fill_debug_info::do_write): New function.
2673 (Output_fill_debug_line::do_minimum_hole_size): New function.
2674 (Output_fill_debug_line::do_write): New function.
2675 (Output_section::Output_section): Initialize new data member.
2676 (Output_section::set_final_data_size): Ensure patch space is larger
2677 than minimum hole size.
2678 (Output_section::do_write): Fill holes in debug sections.
2679 * output.h (Output_fill): New class.
2680 (Output_fill_debug_info): New class.
2681 (Output_fill_debug_line): New class.
2682 (Output_section::set_free_space_fill): New function.
2683 (Output_section::free_space_fill_): New data member.
2684 * testsuite/Makefile.am (incremental_test_3): Add
2685 --incremental-patch option.
2686 (incremental_test_4): Likewise.
2687 (incremental_test_5): Likewise.
2688 (incremental_test_6): Likewise.
2689 (incremental_copy_test): Likewise.
2690 (incremental_common_test_1): Likewise.
2691 * testsuite/Makefile.in: Regenerate.
2692
2693 2011-08-26 Nick Clifton <nickc@redhat.com>
2694
2695 * po/es.po: Updated Spanish translation.
2696
2697 2011-08-01 Cary Coutant <ccoutant@google.com>
2698
2699 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2700 * gold/testsuite/Makefile.in: Regenerate.
2701 * gold/testsuite/justsyms_exec.c: New source file.
2702 * gold/testsuite/justsyms_lib.c: New source file.
2703
2704 2011-08-01 Cary Coutant <ccoutant@google.com>
2705
2706 * layout.cc (Layout::set_segment_offsets): Don't realign text
2707 segment if -Ttext was specified.
2708 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2709 file type.
2710 * object.h (Sized_relobj_file::e_type): New function.
2711 (Sized_relobj_file::e_type_): New data member.
2712 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2713 base address for ET_EXEC files.
2714 * target.cc (Target::do_make_elf_object_implementation): Allow
2715 ET_EXEC files with --just-symbols option.
2716
2717 2011-07-28 Cary Coutant <ccoutant@google.com>
2718
2719 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2720 Add thread_number parameter.
2721 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2722 * workqueue-threads.cc
2723 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2724 current thread if its thread number is greater than desired thread
2725 count.
2726 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2727 Add thread_number parameter.
2728 (Workqueue::should_cancel_thread): Likewise.
2729 (Workqueue::find_runnable_or_wait): Pass thread_number to
2730 should_cancel_thread.
2731 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2732 parameter.
2733
2734 2011-07-22 Sriraman Tallam <tmsriram@google.com>
2735
2736 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2737 only after checking if it cannot be forced local.
2738 * symtab.h (is_externally_visible): Check if the symbol is not forced
2739 local.
2740
2741 2011-07-15 Ian Lance Taylor <iant@google.com>
2742
2743 * options.h (class General_options): Add --print-output-format.
2744 Move -EL next to -EB, for better --help output.
2745 * target-select.cc: Include <cstdio>, "options.h", and
2746 "parameters.h".
2747 (Target_selector::do_target_bfd_name): New function.
2748 (print_output_format): New function.
2749 * target-select.h (class Target_selector): Update declarations.
2750 (Target_selector::target_bfd_name): New function.
2751 (print_output_format): Declare.
2752 * main.cc: Include "target-select.h".
2753 (main): Handle --print-output-format.
2754 * gold.cc: Include "target-select.h".
2755 (queue_initial_tasks): Handle --print-output-format when there are
2756 no input files.
2757 * parameters.cc (parameters_force_valid_target): Give a better
2758 error message if -EB/-EL does not match target.
2759 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2760 function.
2761
2762 2011-07-15 Ian Lance Taylor <iant@google.com>
2763
2764 * i386.cc (class Output_data_plt_i386): Add layout_ field.
2765 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2766 (Output_data_plt_i386::do_write): Write address of .dynamic
2767 section to first entry in .got.plt section.
2768 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2769 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2770 Initialize layout_.
2771 (Output_data_plt_x86_64::do_write): Write address of .dynamic
2772 section to first entry in .got.plt section.
2773 * layout.h (Layout::dynamic_section): New function.
2774
2775 2011-07-13 Sriraman Tallam <tmsriram@google.com>
2776
2777 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2778 to claim_file call.
2779 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2780 input_section_position_, and input_section_glob_.
2781 (read_layout_from_file): Call function section_ordering_specified.
2782 * layout.h (is_section_ordering_specified): New function.
2783 (section_ordering_specified): New function.
2784 (section_ordering_specified_): New boolean member.
2785 * main.cc(main): Call load_plugins after layout object is defined.
2786 * output.cc (Output_section::add_input_section): Use
2787 function section_ordering_specified to check if section ordering is
2788 needed.
2789 * output.cc (Output_section::add_relaxed_input_section): Use
2790 function section_ordering_specified to check if section ordering is
2791 needed.
2792 (Output_section::update_section_layout): New function.
2793 (Output_section::sort_attached_input_sections): Check if input section
2794 must be reordered.
2795 * output.h (Output_section::update_section_layout): New function.
2796 * plugin.cc (get_section_count): New function.
2797 (get_section_type): New function.
2798 (get_section_name): New function.
2799 (get_section_contents): New function.
2800 (update_section_order): New function.
2801 (allow_section_ordering): New function.
2802 (Plugin::load): Add the new interfaces to the transfer vector.
2803 (Plugin_manager::load_plugins): New parameter.
2804 (Plugin_manager::all_symbols_read): New parameter.
2805 (Plugin_manager::claim_file): New parameter. Save the elf object for
2806 unclaimed objects.
2807 (Plugin_manager::get_elf_object): New function.
2808 (Plugin_manager::get_view): Change to directly use the bool to check
2809 if get_view is called from claim_file_hook.
2810 * plugin.h (input_objects): New function
2811 (Plugin__manager::load_plugins): New parameter.
2812 (Plugin_manager::claim_file): New parameter.
2813 (Plugin_manager::get_elf_object): New function.
2814 (Plugin_manager::in_claim_file_handler): New function.
2815 (Plugin_manager::in_claim_file_handler_): New member.
2816 (layout): New function.
2817 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2818 handler with an extra parameter. Make the elf object before calling
2819 claim_file handler.
2820 * testsuite/plugin_test.c (get_section_count): New function pointer.
2821 (get_section_type): New function pointer.
2822 (get_section_name): New function pointer.
2823 (get_section_contents): New function pointer.
2824 (update_section_order): New function pointer.
2825 (allow_section_ordering): New function pointer.
2826 (onload): Check if the new interfaces exist.
2827
2828 2011-07-13 Ian Lance Taylor <iant@google.com>
2829
2830 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2831 relro section.
2832 * x86_64.cc (Target_x86_64::got_section): Likewise.
2833 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2834 (relro_now_test_SOURCES): New variable.
2835 (relro_now_test_DEPENDENCIES): New variable.
2836 (relro_now_test_LDFLAGS): New variable.
2837 (relro_now_test_LDADD): New variable.
2838 (relro_now_test.so): New target.
2839 * testsuite/Makefile.in: Rebuild.
2840
2841 2011-07-12 Ian Lance Taylor <iant@google.com>
2842
2843 PR gold/12980
2844 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2845 GLOB_DAT relocation rather than a RELATIVE relocation for a
2846 protected symbol when creating a shared library.
2847 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2848 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2849 * testsuite/protected_main_1.cc (main): Test that protected
2850 function has same address.
2851
2852 2011-07-11 Ian Lance Taylor <iant@google.com>
2853
2854 PR gold/12979
2855 * options.h (class General_options): Add -Bgroup.
2856 * options.cc (General_options::finalize): If -Bgroup is set,
2857 default to --unresolved-symbols=report-all.
2858 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2859 * target-reloc.h (issue_undefined_symbol_error): Handle
2860 --unresolved-symbols=report-all.
2861
2862 2011-07-08 Ian Lance Taylor <iant@google.com>
2863
2864 PR gold/11985
2865 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2866 if linker script discards key sections.
2867 (Layout::create_dynamic_symtab): Likewise.
2868 (Layout::assign_local_dynsym_offsets): Likewise.
2869 (Layout::sized_create_version_sections): Likewise.
2870 (Layout::create_interp): Likewise.
2871 (Layout::finish_dynamic_section): Likewise.
2872 (Layout::set_dynamic_symbol_size): Likewise.
2873
2874 2011-07-08 Ian Lance Taylor <iant@google.com>
2875
2876 PR gold/12386
2877 * options.h (class General_options): Add --unresolved-symbols.
2878 * target-reloc.h (issue_undefined_symbol_error): Check
2879 --unresolved-symbols. Add comments.
2880
2881 2011-07-08 Ian Lance Taylor <iant@google.com>
2882
2883 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2884 expression more complex.
2885
2886 2011-07-08 Ian Lance Taylor <iant@google.com>
2887
2888 PR gold/11317
2889 * target-reloc.h (issue_undefined_symbol_error): New inline
2890 function, broken out of relocate_section.
2891 (relocate_section): Call issue_undefined_symbol_error.
2892 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2893 there is no TLS segment if we are about to issue an undefined
2894 symbol error.
2895 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2896
2897 2011-07-08 Ian Lance Taylor <iant@google.com>
2898
2899 PR gold/12279
2900 * resolve.cc (Symbol_table::should_override): Add fromtype
2901 parameter. Change all callers. Give error when linking together
2902 TLS and non-TLS symbol.
2903 (Symbol_table::should_override_with_special): Add fromtype
2904 parameter. Change all callers.
2905 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2906 there is no TLS segment if we have reported some errors.
2907 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2908
2909 2011-07-08 Ian Lance Taylor <iant@google.com>
2910
2911 PR gold/12372
2912 * target.h (Target::plt_address_for_global): New function.
2913 (Target::plt_address_for_local): New function.
2914 (Target::plt_section_for_global): Remove.
2915 (Target::plt_section_for_local): Remove.
2916 (Target::do_plt_address_for_global): New virtual function.
2917 (Target::do_plt_address_for_local): New virtual function.
2918 (Target::do_plt_section_for_global): Remove.
2919 (Target::do_plt_section_for_local): Remove.
2920 (Target::register_global_plt_entry): Add Symbol_table and Layout
2921 parameters.
2922 * output.cc (Output_data_got::Got_entry::write): Use
2923 plt_address_for_global and plt_address_for_local.
2924 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2925 address of output section.
2926 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2927 got_irelative_, and irelative_count_ fields. Update
2928 declarations.
2929 (Output_data_plt_i386::has_irelative_section): New function.
2930 (Output_data_plt_i386::entry_count): Add irelative_count_.
2931 (Output_data_plt_i386::set_final_data_size): Likewise.
2932 (class Target_i386): Add got_irelative_ and rel_irelative_
2933 fields. Update declarations.
2934 (Target_i386::Target_i386): Initialize new fields.
2935 (Target_i386::do_plt_address_for_global): New function replacing
2936 do_plt_section_for_global.
2937 (Target_i386::do_plt_address_for_local): New function replacing
2938 do_plt_section_for_local.
2939 (Target_i386::got_section): Create got_irelative_.
2940 (Target_i386::rel_irelative_section): New function.
2941 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2942 fields. Don't define __rel_iplt_{start,end}.
2943 (Output_data_plt_i386::add_entry): Add symtab and layout
2944 parameters. Change all callers. Use different PLT and GOT for
2945 IFUNC symbols.
2946 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2947 layout parameters. Change all callers. Use different PLT and
2948 GOT.
2949 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2950 (Output_data_plt_i386::rel_irelative): New function.
2951 (Output_data_plt_i386::address_for_global): New function.
2952 (Output_data_plt_i386::address_for_local): New function.
2953 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2954 IRELATIVE GOT when changing IFUNC GOT entries.
2955 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2956 reloc.
2957 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2958 if we didn't create an IRELATIVE GOT.
2959 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2960 plt_address_for_local.
2961 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2962 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2963 got_irelative_, and irelative_count_ fields. Update
2964 declarations.
2965 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2966 Initialize new fields. Remove symtab parameter. Change all
2967 callers.
2968 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2969 irelative_count_.
2970 (Output_data_plt_x86_64::has_irelative_section): New function.
2971 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2972 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2973 fields. Update declarations.
2974 (Target_x86_64::Target_x86_64): Initialize new fields.
2975 (Target_x86_64::do_plt_address_for_global): New function replacing
2976 do_plt_section_for_global.
2977 (Target_x86_64::do_plt_address_for_local): New function replacing
2978 do_plt_section_for_local.
2979 (Target_x86_64::got_section): Create got_irelative_.
2980 (Target_x86_64::rela_irelative_section): New function.
2981 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2982 all callers. Don't create __rel_iplt_{start,end}.
2983 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2984 parameters. Change all callers. Use different PLT and GOT for
2985 IFUNC symbols.
2986 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2987 layout parameters. Change all callers. Use different PLT and
2988 GOT.
2989 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2990 parameters. Change all callers. Use different PLT and GOT for
2991 IFUNC symbols.
2992 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2993 (Output_data_plt_x86_64::rela_irelative): New function.
2994 (Output_data_plt_x86_64::address_for_global): New function.
2995 (Output_data_plt_x86_64::address_for_local): New function.
2996 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2997 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2998 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2999 (Target_x86_64::register_global_plt_entry): Add symtab and layout
3000 parameters.
3001 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3002 reloc.
3003 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3004 symbols if we didn't create an IRELATIVE GOT.
3005 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3006 plt_address_for_local.
3007 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3008 * testsuite/ifuncvar1.c: New test file.
3009 * testsuite/ifuncvar2.c: New test file.
3010 * testsuite/ifuncvar3.c: New test file.
3011 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3012 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3013 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3014 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3015 * testsuite/Makefile.in: Rebuild.
3016
3017 2011-07-07 Cary Coutant <ccoutant@google.com>
3018
3019 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3020 (two_file_test_1_ndebug.o): Likewise.
3021 (two_file_test_1b_ndebug.o): Likewise.
3022 (two_file_test_2_ndebug.o): Likewise.
3023 (two_file_test_main_ndebug.o): Likewise.
3024 (incremental_test_2): Link with no-debug versions.
3025
3026 2011-07-06 Cary Coutant <ccoutant@google.com>
3027
3028 * gold/incremental.cc
3029 (Output_section_incremental_inputs::write_info_blocks): Check for
3030 hidden and internal symbols.
3031
3032 2011-07-06 Cary Coutant <ccoutant@google.com>
3033
3034 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3035 Check disposition for startup file.
3036 (Incremental_inputs::report_command_line): Ignore
3037 --incremental-startup-unchanged option.
3038 * options.cc (General_options::parse_incremental_startup_unchanged):
3039 New function.
3040 (General_options::General_options): Initialize new data member.
3041 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3042 (General_options): Add --incremental-startup-unchanged option.
3043 (General_options::incremental_startup_disposition): New function.
3044 (General_options::incremental_startup_disposition_): New data member.
3045
3046 2011-07-06 Cary Coutant <ccoutant@google.com>
3047
3048 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3049 input file index to Script_info ctor.
3050 (Sized_incremental_binary::do_file_has_changed): Find the
3051 command-line argument for files named in scripts.
3052 * incremental.h (Script_info::Script_info): New ctor
3053 with input file index.
3054 (Script_info::input_file_index): New function.
3055 (Script_info::input_file_index_): New data member.
3056 (Incremental_binary::get_library): Add const.
3057 (Incremental_binary::get_script_info): Add const.
3058 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3059 * testsuite/Makefile.am (incremental_test_5): New test case.
3060 (incremental_test_6): New test case.
3061 * testsuite/Makefile.in: Regenerate.
3062
3063 2011-07-06 Cary Coutant <ccoutant@google.com>
3064
3065 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3066 debug output when command lines differ.
3067
3068 2011-07-06 Cary Coutant <ccoutant@google.com>
3069
3070 * incremental.cc (Incremental_inputs::report_command_line): Ignore
3071 --incremental-patch option.
3072 * layout.cc (Free_list::allocate): Extend allocation beyond original
3073 end if enabled.
3074 (Layout::make_output_section): Mark sections that should get
3075 patch space.
3076 * options.cc (parse_percent): New function.
3077 * options.h (parse_percent): New function.
3078 (DEFINE_percent): New macro.
3079 (General_options): Add --incremental-patch option.
3080 * output.cc (Output_section::Output_section): Initialize new data
3081 members.
3082 (Output_section::add_input_section): Print section name when out
3083 of patch space.
3084 (Output_section::add_output_section_data): Likewise.
3085 (Output_section::set_final_data_size): Add patch space when
3086 doing --incremental-full.
3087 (Output_section::do_reset_address_and_file_offset): Remove patch
3088 space.
3089 (Output_segment::set_section_list_addresses): Print debug output
3090 only if --incremental-update.
3091 * output.h (Output_section::set_is_patch_space_allowed): New function.
3092 (Output_section::is_patch_space_allowed_): New data member.
3093 (Output_section::patch_space_): New data member.
3094 * parameters.cc (Parameters::incremental_full): New function.
3095 * parameters.h (Parameters::incremental_full): New function
3096 * testsuite/Makefile.am (incremental_test_2): Add test for
3097 --incremental-patch option.
3098 * testsuite/Makefile.in: Regenerate.
3099 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3100 (t18): Remove function body.
3101
3102 2011-07-05 Doug Kwan <dougkwan@google.com>
3103
3104 PR gold/12771
3105 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3106 Arm_Address type for relocation result.
3107 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
3108 overflow check.
3109 (Arm_relocate_functions::abs32): Use unaligned access.
3110 (Arm_relocate_functions::rel32): Ditto.
3111 (Arm_relocate_functions::prel31): Ditto.
3112 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3113 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3114 static data relocations.
3115 * testsuite/Makefile.in: Regnerate.
3116 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3117
3118 2011-07-05 Ian Lance Taylor <iant@google.com>
3119
3120 PR gold/12392
3121 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3122 symbols if necessary.
3123 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3124
3125 2011-07-05 Ian Lance Taylor <iant@google.com>
3126
3127 PR gold/12952
3128 * resolve.cc (Symbol::override_base_with_special): Simply override
3129 version with special symbol version, ignoring previous version.
3130
3131 2011-07-05 Ian Lance Taylor <iant@google.com>
3132
3133 * object.cc (Sized_relobj_file::include_section_group): Add
3134 information to comment about signature location.
3135
3136 2011-07-02 Ian Lance Taylor <iant@google.com>
3137
3138 PR gold/12957
3139 * options.h (class General_options): Add -f and -F.
3140 * options.cc (General_options::finalize): Fatal error if -f/-F
3141 are used without -shared.
3142 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3143
3144 2011-07-02 Ian Lance Taylor <iant@google.com>
3145
3146 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3147
3148 2011-07-01 Ian Lance Taylor <iant@google.com>
3149
3150 PR gold/12525
3151 PR gold/12952
3152 * resolve.cc (Symbol::override_base_with_special): Don't override
3153 the version if the overriding symbol has a different name.
3154 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
3155 all callers. If we give an error about an undefined version,
3156 define the base version if necessary.
3157 * dynobj.h (class Versions): Update declaration.
3158 * testsuite/weak_alias_test_5.cc: New file.
3159 * testsuite/weak_alias_test.script: New file.
3160 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3161 and versioned_alias have the right value, and call t2.
3162 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3163 weak_alias_test_5.so.
3164 (weak_alias_test_LDADD): Likewise.
3165 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3166 * testsuite/Makefile.in: Rebuild.
3167
3168 2011-07-01 Ian Lance Taylor <iant@google.com>
3169
3170 PR gold/12525
3171 * options.h (class General_options): Support -z notext.
3172 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3173 -Wl,-z,notext.
3174 (two_file_shared_nonpic.so): Likewise.
3175 (two_file_shared_mixed.so): Likewise.
3176 (two_file_shared_mixed_1.so): Likewise.
3177 (weak_undef_lib_nonpic.so): Likewise.
3178 (alt/weak_undef_lib_nonpic.so): Likewise.
3179 (tls_test_shared_nonpic.so): Likewise.
3180 * testsuite/Makefile.in: Rebuild.
3181
3182 2011-07-01 Ian Lance Taylor <iant@google.com>
3183
3184 PR gold/12525
3185 * configure.ac: Test whether static linking works, setting
3186 the automake conditional HAVE_STATIC.
3187 * testsuite/Makefile.am: Disable tests using -static if
3188 HAVE_STATIC is not true.
3189 * configure, testsuite/Makefile.in: Rebuild.
3190
3191 2011-07-01 Ian Lance Taylor <iant@google.com>
3192
3193 PR gold/12525
3194 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3195 Assert if we see DW_EH_PE_indirect.
3196 * target.h (Target::ehframe_datarel_base): New function.
3197 (Target::do_ehframe_datarel_base): New target function.
3198 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3199 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3200 function.
3201
3202 2011-07-01 Ian Lance Taylor <iant@google.com>
3203
3204 PR gold/12571
3205 * options.h (class General_options): Add
3206 --ld-generated-unwind-info.
3207 * ehframe.cc (Fde::write): Add address parameter. Change all
3208 callers. If associated with PLT, fill in address and size.
3209 (Cie::set_output_offset): Only add merge mapping if there is an
3210 object.
3211 (Cie::write): Add address parameter. Change all callers.
3212 (Eh_frame::add_ehframe_for_plt): New function.
3213 * ehframe.h (class Fde): Update declarations. Move shndx_ and
3214 input_offset_ fields into union u_, with new plt field.
3215 (Fde::Fde): Adjust for new union field.
3216 (Fde::Fde) [Output_data version]: New constructor.
3217 (Fde::add_mapping): Only add merge mapping if there is an object.
3218 (class Cie): Update declarations.
3219 (class Eh_frame): Declare add_ehframe_for_plt.
3220 * layout.cc (Layout::layout_eh_frame): Break out code into
3221 make_eh_frame_section, and call it.
3222 (Layout::make_eh_frame_section): New function.
3223 (Layout::add_eh_frame_for_plt): New function.
3224 * layout.h (class Layout): Update declarations.
3225 * merge.cc (Merge_map::add_mapping): Add assertion.
3226 * i386.cc: Include "dwarf.h".
3227 (class Output_data_plt_i386): Make first_plt_entry,
3228 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
3229 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3230 and plt_eh_frame_fde.
3231 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3232 boundary. Call add_eh_frame_for_plt if appropriate.
3233 * x86_64.cc: Include "dwarf.h".
3234 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
3235 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
3236 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3237 and plt_eh_frame_fde.
3238 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3239 appropriate.
3240
3241 2011-06-29 Ian Lance Taylor <iant@google.com>
3242
3243 PR gold/12629
3244 * object.cc (Sized_relobj_file::layout_section): Change shdr
3245 parameter to be const.
3246 (Sized_relobj_file::layout_eh_frame_section): New function, broken
3247 out of do_layout.
3248 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3249 appropriate. Call layout_eh_frame_section.
3250 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3251 sections.
3252 * object.h (class Sized_relobj_file): Update declarations.
3253
3254 2011-06-29 Ian Lance Taylor <iant@google.com>
3255
3256 PR gold/12652
3257 * script.cc (Token::integer_value): Accept trailing M/m/K/k
3258 modifier.
3259 (Lex::gather_token): Accept trailing M/m/K/k for integers.
3260
3261 2011-06-29 Ian Lance Taylor <iant@google.com>
3262
3263 PR gold/12675
3264 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3265 SHT_X86_64_UNWIND.
3266 * layout.cc (Layout::layout_eh_frame): Likewise.
3267
3268 2011-06-29 Ian Lance Taylor <iant@google.com>
3269
3270 PR gold/12695
3271 * layout.cc (Layout::symtab_section_shndx): New function.
3272 * layout.h (class Layout): Declare symtab_section_shndx.
3273 * output.cc (Output_section::write_header): Call it.
3274
3275 2011-06-29 Ian Lance Taylor <iant@google.com>
3276
3277 PR gold/12818
3278 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3279 symbols which are not used in a relocation.
3280
3281 2011-06-28 Ian Lance Taylor <iant@google.com>
3282
3283 PR gold/12898
3284 * layout.cc (Layout::segment_precedes): Don't crash if a linker
3285 script create indistinguishable segments.
3286 (Layout::set_segment_offsets): Use stable_sort when sorting
3287 segments. Pass this to Compare_segments constructor.
3288 * layout.h (class Layout): Make segment_precedes non-static.
3289 (class Compare_segments): Change from struct to class. Add
3290 layout_ field. Add constructor.
3291 * script-sections.cc
3292 (Script_sections::attach_sections_using_phdrs_clause): Rename
3293 local orphan to is_orphan. Don't report failure to put empty
3294 section in segment. On attachment failure, report name of
3295 section, and attach to first PT_LOAD segment.
3296
3297 2011-06-28 Ian Lance Taylor <iant@google.com>
3298
3299 PR gold/12934
3300 * target-select.cc (Target_selector::Target_selector): Add
3301 emulation parameter. Change all callers.
3302 (select_target_by_bfd_name): Rename from select_target_by_name.
3303 Change all callers.
3304 (select_target_by_emulation): New function.
3305 (supported_emulation_names): New function.
3306 * target-select.h (class Target_selector): Add emulation_ field.
3307 Update declarations.
3308 (Target_selector::recognize_by_bfd_name): Rename from
3309 recognize_by_name. Change all callers.
3310 (Target_selector::supported_bfd_names): Rename from
3311 supported_names. Change all callers.
3312 (Target_selector::recognize_by_emulation): New function.
3313 (Target_selector::supported_emulations): New function.
3314 (Target_selector::emulation): New function.
3315 (Target_selector::do_recognize_by_bfd_name): Rename from
3316 do_recognize_by_name. Change all callers.
3317 (Target_selector::do_supported_bfd_names): Rename from
3318 do_supported_names. Change all callers.
3319 (Target_selector::do_recognize_by_emulation): New function.
3320 (Target_selector::do_supported_emulations): New function.
3321 (select_target_by_bfd_name): Change name in declaration.
3322 (select_target_by_emulation): Declare.
3323 (supported_emulation_names): Declare.
3324 * parameters.cc (parameters_force_valid_target): Try to find
3325 target based on emulation from -m option.
3326 * options.h (class General_options): Change doc string for -m.
3327 * options.cc (help): Print emulations.
3328 (General_options::parse_V): Likewise.
3329 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3330 Add emulation parameter. Change all callers.
3331
3332 2011-06-28 Ian Lance Taylor <iant@google.com>
3333
3334 * target.h (class Target): Add osabi_ field.
3335 (Target::osabi): New function.
3336 (Target::set_osabi): New function.
3337 (Target::Target): Initialize osabi_.
3338 (Target::do_adjust_elf_header): Make pure virtual.
3339 (Sized_target::do_adjust_elf_header): Declare.
3340 * target.cc (Sized_target::do_adjust_elf_header): New function.
3341 (class Sized_target): Instantiate all versions.
3342 * freebsd.h (class Target_freebsd): Remove.
3343 (Target_selector_freebsd::do_recognize): Call set_osabi on
3344 Target.
3345 (Target_selector_freebsd::do_recognize_by_name): Likewise.
3346 (Target_selector_freebsd::set_osabi): Remove.
3347 * i386.cc (class Target_i386): Inherit from Sized_target rather
3348 than Target_freebsd.
3349 * x86_64.cc (class Target_x86_64): Likewise.
3350
3351 2011-06-28 Ian Lance Taylor <iant@google.com>
3352
3353 * target.h (Target::can_check_for_function_pointers): Rewrite.
3354 Make non-virtual.
3355 (Target::can_icf_inline_merge_sections): Likewise.
3356 (Target::section_may_have_icf_unsafe_poineters): Likewise.
3357 (Target::Target_info): Add can_icf_inline_merge_sections field.
3358 (Target::do_can_check_for_function_pointers): New virtual
3359 function.
3360 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3361 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3362 from can_check_for_function_pointers, move in file.
3363 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3364 section_may_have_icf_unsafe_poineters, move in file.
3365 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3366 * i386.cc (Target_i386::do_can_check_for_function_pointers):
3367 Rename from can_check_for_function_pointers, move in file.
3368 (Target_i386::can_icf_inline_merge_sections): Remove.
3369 (Target_i386::i386_info): Initialize
3370 can_icf_inline_merge_sections.
3371 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3372 Initialize can_icf_inline_merge_sections.
3373 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3374 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3375 Rename from can_check_for_function_pointers, move in file.
3376 (Target_x86_64::can_icf_inline_merge_sections): Remove.
3377 (Target_x86_64::x86_64_info): Initialize
3378 can_icf_inline_merge_sections.
3379 * testsuite/testfile.cc (Target_test::test_target_info):
3380 Likewise.
3381 * icf.cc (get_section_contents): Correct formatting.
3382
3383 2011-06-27 Ian Lance Taylor <iant@google.com>
3384
3385 * symtab.cc (Symbol::versioned_name): New function.
3386 (Symbol_table::add_to_final_symtab): Use versioned_name when
3387 appropriate.
3388 (Symbol_table::sized_write_symbol): Likewise.
3389 * symtab.h (class Symbol): Declare versioned_name.
3390 * stringpool.h (class Stringpool_template): Add variant of add
3391 which takes a std::basic_string.
3392 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3393 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3394 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3395 (ver_test_12.o): New target.
3396 * testsuite/Makefile.in: Rebuild.
3397
3398 2011-06-27 Doug Kwan <dougkwan@google.com>
3399
3400 * arm.cc (Arm_relocate_functions::thm_jump8,
3401 Arm_relocate_functions::thm_jump11): Use a wider signed
3402 type to compute offset.
3403 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3404 arm_thm_jump8.
3405 * testsuite/Makefile.in: Regenerate.
3406 * testsuite/arm_branch_in_range.sh: Check test results of
3407 arm_thm_jump11 and arm_thm_jump8.
3408 * testsuite/arm_thm_jump11.s: New test source file.
3409 * testsuite/arm_thm_jump11.t: New linker script.
3410 * testsuite/arm_thm_jump8.s: New test source file.
3411 * testsuite/arm_thm_jump8.t: New linker script.
3412
3413 2011-06-24 Ian Lance Taylor <iant@google.com>
3414
3415 * layout.cc: Include "object.h".
3416 (ctors_sections_in_init_array): New static variable.
3417 (Layout::is_ctors_in_init_array): New function.
3418 (Layout::layout): Add entry to ctors_sections_in_init_array if
3419 appropriate.
3420 * layout.h (class Layout): Declare is_ctors_in_init_array.
3421 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3422 is_ctors_reverse_view is set.
3423 (Sized_relobj_file::write_sections): Add layout parameter. Change
3424 all callers. Set is_ctors_reverse_view field of View_size.
3425 (Sized_relobj_file::reverse_words): New function.
3426 * object.h (Sized_relobj_file::View_size): Add
3427 is_ctors_reverse_view field.
3428 (class Sized_relobj_file): Update declarations.
3429 * testsuite/initpri3.c: New test.
3430 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3431 initpri3b.
3432 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3433 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3434 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3435 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3436 * testsuite/Makefile.in: Rebuild.
3437
3438 2011-06-24 Cary Coutant <ccoutant@google.com>
3439
3440 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3441 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3442 (debug_msg_cdebug.err): New targets.
3443 * testsuite/Makefile.in: Regenerate.
3444 * testsuite/debug_msg.sh: Check output of link with compressed debug.
3445 Fix checks for link with shared library.
3446
3447 2011-06-24 Doug Kwan <dougkwan@google.com>
3448
3449 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3450 skip empty text sections.
3451 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3452
3453 2011-06-22 Ian Lance Taylor <iant@google.com>
3454
3455 PR gold/12910
3456 * options.h (class General_options): Add --ctors-in-init-array.
3457 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3458 friends as SHT_PROGBITS for merging sections.
3459 (Layout::layout): Remove special handling of .init_array and
3460 friends. Don't sort if doing relocatable link. Sort for .ctors
3461 and .dtors if ctors_in_init_array.
3462 (Layout::make_output_section): Force correct section types for
3463 .init_array and friends. Don't sort if doing relocatable link,
3464 Don't sort .ctors and .dtors if ctors_in_init_array.
3465 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3466 (Layout::output_section_name): Add relobj parameter. Change all
3467 callers. Handle .ctors. and .dtors. in code rather than table.
3468 Handle .ctors and .dtors if ctors_in_init_array.
3469 (Layout::match_file_name): New function, moved from output.cc.
3470 * layout.h (class Layout): Update declarations.
3471 * output.cc: Include "layout.h".
3472 (Input_section_sort_entry::get_priority): New function.
3473 (Input_section_sort_entry::match_file_name): Just call
3474 Layout::match_file_name.
3475 (Output_section::Input_section_sort_init_fini_compare::operator()):
3476 Handle .ctors and .dtors. Sort by explicit priority rather than
3477 by name.
3478 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3479 * testsuite/initpri2.c: New test.
3480 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3481 (check_PROGRAMS): Add initpri2.
3482 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3483 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3484 * configure, testsuite/Makefile.in: Rebuild.
3485
3486 2011-06-19 Ian Lance Taylor <iant@google.com>
3487
3488 PR gold/12880
3489 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3490 .interp section to a PT_INTERP segment even if we have seen a
3491 --dynamic-linker option. Don't do it if we have seen a PHDRS
3492 clause in a linker script.
3493 (Layout::finalize): Don't create a .interp section if we've
3494 already create a PT_INTERP segment.
3495 (Layout::create_interp): Always call choose_output_section (revert
3496 patch of 2011-06-17). Don't create PT_INTERP segment.
3497 * script-sections.cc
3498 (Script_sections::create_note_and_tls_segments): Add a .interp
3499 section to a PT_INTERP segment even if we have seen a
3500 --dynamic-linker option.
3501
3502 2011-06-18 Ian Lance Taylor <iant@google.com>
3503
3504 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3505 merely because a non-PT_LOAD segment has a dynamic reloc.
3506
3507 2011-06-18 Ian Lance Taylor <iant@google.com>
3508
3509 * layout.cc (Layout::finish_dynamic_section): Don't create
3510 DT_FLAGS entry if not needed.
3511
3512 2011-06-18 Ian Lance Taylor <iant@google.com>
3513
3514 PR gold/12745
3515 * layout.cc (Layout::layout_eh_frame): Correct handling of
3516 writable .eh_frame section.
3517
3518 2011-06-17 Ian Lance Taylor <iant@google.com>
3519
3520 PR gold/12893
3521 * resolve.cc (Symbol_table::resolve): Don't give an error if a
3522 symbol is redefined with the exact same object and value.
3523
3524 2011-06-17 Ian Lance Taylor <iant@google.com>
3525
3526 PR gold/12880
3527 * layout.h (class Layout): Add interp_segment_ field.
3528 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3529 (Layout::attach_allocated_section_to_segment): If making shared
3530 library, put .interp section in PT_INTERP segment.
3531 (Layout::finalize): Also call create_interp if -dynamic-linker
3532 option was used.
3533 (Layout::create_interp): Assert that there is no PT_INTERP
3534 segment. If not using a SECTIONS clause, use make_output_section.
3535 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3536 * script-sections.cc
3537 (Script_sections::create_note_and_tls_segments): If making shared
3538 library, put .interp section in PT_INTERP segment.
3539
3540 2011-06-17 Ian Lance Taylor <iant@google.com>
3541
3542 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3543 when making a shared library.
3544
3545 2011-06-17 Ian Lance Taylor <iant@google.com>
3546
3547 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3548 parameter. Change all callers. Don't issue warning about PC32
3549 against locally defined symbol.
3550
3551 2011-06-16 Ian Lance Taylor <iant@google.com>
3552
3553 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3554 occurs in same object.
3555
3556 2011-06-14 Alan Modra <amodra@gmail.com>
3557
3558 * po/POTFILES.in: Regenerate.
3559
3560 2011-06-09 Ian Lance Taylor <iant@google.com>
3561
3562 * script-sections.cc
3563 (Orphan_output_section::set_section_addresses): For a relocatable
3564 link set address to 0.
3565
3566 2011-06-09 Cary Coutant <ccoutant@google.com>
3567
3568 PR gold/12804
3569 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3570 used with --compress-debug-sections.
3571 * gold/object.cc (Sized_relobj_file::do_layout): Report
3572 uncompressed size of compressed input sections.
3573
3574 2011-06-08 Cary Coutant <ccoutant@google.com>
3575
3576 PR gold/12804
3577 * testsuite/two_file_test_2_v1.cc: Change initialization of
3578 v2 to keep it in .data.
3579
3580 2011-06-07 Cary Coutant <ccoutant@google.com>
3581
3582 * common.cc (Symbol_table::do_allocate_commons_list): Call
3583 gold_fallback.
3584 * errors.cc (Errors::fatal): Adjust call to gold_exit.
3585 (Errors::fallback): New function.
3586 (gold_fallback): New function.
3587 * errors.h (Errors::fallback): New function.
3588 * gold.cc (gold_exit): Change status parameter to enum; adjust
3589 all callers.
3590 (queue_initial_tasks): Call gold_fallback.
3591 * gold.h: Include cstdlib.
3592 (Exit_status): New enum type.
3593 (gold_exit): Change status parameter to enum.
3594 (gold_fallback): New function.
3595 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3596 (Layout::create_symtab_sections): Likewise.
3597 (Layout::create_shdrs): Likewise.
3598 * main.cc (main): Adjust call to gold_exit.
3599 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3600 (Output_data_got::add_got_entry_pair): Likewise.
3601 (Output_section::add_input_section): Likewise.
3602 (Output_section::add_output_section_data): Likewise.
3603 (Output_segment::set_section_list_addresses): Likewise.
3604 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3605
3606 2011-06-07 Cary Coutant <ccoutant@google.com>
3607
3608 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3609 for incremental links.
3610 * output.cc (Output_segment::set_section_list_addresses): Remove
3611 FIXME and test for TLS or BSS.
3612
3613 2011-06-07 Cary Coutant <ccoutant@google.com>
3614
3615 * testsuite/Makefile.am: Add incremental_copy_test,
3616 incremental_common_test_1.
3617 * testsuite/Makefile.in: Regenerate.
3618 * testsuite/common_test_1_v1.c: New source file.
3619 * testsuite/common_test_1_v2.c: New source file.
3620 * testsuite/copy_test_v1.cc: New source file.
3621
3622 2011-06-07 Cary Coutant <ccoutant@google.com>
3623
3624 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3625 update, allocate common from bss section's free list.
3626 * incremental-dump.cc (dump_incremental_inputs): Print flag for
3627 linker-defined symbols.
3628 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3629 Skip GOT and PLT entries that are no longer referenced.
3630 (Output_section_incremental_inputs::write_info_blocks): Mark
3631 linker-defined symbols.
3632 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3633 * output.cc (Output_section::allocate): New function.
3634 * output.h (Output_section::allocate): New function.
3635 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3636 linker-defined symbols.
3637 (Symbol::override_base_with_special): Copy is_predefined_ flag.
3638 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3639 (Symbol::init_base_output_data): Likewise.
3640 (Symbol::init_base_output_segment): Likewise.
3641 (Symbol::init_base_constant): Likewise.
3642 (Sized_symbol::init_output_data): Likewise.
3643 (Sized_symbol::init_output_segment): Likewise.
3644 (Sized_symbol::init_constant): Likewise.
3645 (Symbol_table::do_define_in_output_data): Likewise.
3646 (Symbol_table::do_define_in_output_segment): Likewise.
3647 (Symbol_table::do_define_as_constant): Likewise.
3648 * symtab.h (Symbol::is_predefined): New function.
3649 (Symbol::init_base_output_data): Add is_predefined parameter.
3650 (Symbol::init_base_output_segment): Likewise.
3651 (Symbol::init_base_constant): Likewise.
3652 (Symbol::is_predefined_): New data member.
3653 (Sized_symbol::init_output_data): Add is_predefined parameter.
3654 (Sized_symbol::init_output_segment): Likewise.
3655 (Sized_symbol::init_constant): Likewise.
3656 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3657
3658 2011-06-07 Cary Coutant <ccoutant@google.com>
3659
3660 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3661 instead of emit_copy_reloc.
3662 (Copy_relocs::emit_copy_reloc): Refactor.
3663 (Copy_relocs::make_copy_reloc): New function.
3664 (Copy_relocs::add_copy_reloc): Remove.
3665 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3666 section.
3667 (Copy_relocs::make_copy_reloc): New function.
3668 (Copy_relocs::add_copy_reloc): Remove.
3669 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3670 unchanged input files.
3671 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3672 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3673 Reserve BSS space for COPY relocations.
3674 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3675 (Output_section_incremental_inputs::write_info_blocks): Record
3676 whether a symbol is copied from a shared object.
3677 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3678 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3679 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3680 (Incremental_input_entry_reader::get_output_symbol_index): Add
3681 is_copy parameter.
3682 (Incremental_binary::emit_copy_relocs): New function.
3683 (Incremental_binary::do_emit_copy_relocs): New function.
3684 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3685 new data member.
3686 (Sized_incremental_binary::add_copy_reloc): New function.
3687 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3688 (Sized_incremental_binary::Copy_reloc): New struct.
3689 (Sized_incremental_binary::Copy_relocs): New typedef.
3690 (Sized_incremental_binary::copy_relocs_): New data member.
3691 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3692 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3693 * target.h (Sized_target::emit_copy_reloc): New function.
3694 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3695
3696 2011-06-02 Cary Coutant <ccoutant@google.com>
3697
3698 PR gold/12163
3699 * gold/archive.cc (Archive::Archive): Initialize new data member.
3700 (Archive::include_all_members): Return if archive has already been
3701 included.
3702 * gold/archive.h (Archive::include_all_members_): New data member.
3703
3704 2011-06-02 Nick Clifton <nickc@redhat.com>
3705
3706 * dynobj.h: Fix spelling mistake in comment.
3707 * output.cc: Likewise.
3708
3709 2011-05-31 Doug Kwan <dougkwan@google.com>
3710 Asier Llano
3711
3712 PR gold/12826
3713 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3714 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3715 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
3716 redundant arm_exidx_test.so.
3717 * testsuite/Makefile.in: Regenerate.
3718 (check_SCRIPTS): Add pr12826.sh
3719 (check_DATA): Add pr12826.stdout
3720 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3721 * testsuite/pr12826.sh: New file.
3722 * testsuite/pr12826_1.s: Ditto.
3723 * testsuite/pr12826_1.s: Ditto.
3724
3725 2011-05-30 Ian Lance Taylor <iant@google.com>
3726
3727 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3728 sections.
3729
3730 2011-05-29 Ian Lance Taylor <iant@google.com>
3731
3732 PR gold/12804
3733 * testsuite/Makefile.am: Use different file name for two_file_test
3734 temporary file for each incremental test.
3735 * testsuite/Makefile.in: Rebuild.
3736
3737 2011-05-29 Ian Lance Taylor <iant@google.com>
3738
3739 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3740 binary input file is empty.
3741
3742 2011-05-27 Ian Lance Taylor <iant@google.com>
3743
3744 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3745 (ver_test_9.so): Likewise.
3746 * testsuite/Makefile.in: Rebuild.
3747
3748 2011-05-26 Cary Coutant <ccoutant@google.com>
3749
3750 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3751 * incremental.cc (Incremental_inputs::report_input_section): Fix
3752 comment, indentation.
3753 (Incremental_inputs::report_comdat_group): New function.
3754 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3755 of data for incremental input file entry.
3756 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3757 group count, COMDAT group signatures.
3758 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3759 an unchanged input file.
3760 * incremental.h (Incremental_object_entry::Incremental_object_entry):
3761 Initialize new data member.
3762 (Incremental_object_entry::add_comdat_group): New function.
3763 (Incremental_object_entry::get_comdat_group_count): New function.
3764 (Incremental_object_entry::get_comdat_signature_key): New function.
3765 (Incremental_object_entry::groups_): New data member.
3766 (Incremental_inputs::report_comdat_group): New function.
3767 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3768 data for incremental input file entry.
3769 (Incremental_input_entry_reader::get_comdat_group_count): New function.
3770 (Incremental_input_entry_reader::get_input_section): Adjust size of
3771 data for incremental input file entry.
3772 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3773 (Incremental_input_entry_reader::get_comdat_group_signature): New
3774 function.
3775 * object.cc (Sized_relobj::include_section_group): Report kept
3776 COMDAT groups for incremental links.
3777
3778 2011-05-24 David Meyer <pdox@google.com>
3779
3780 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3781 with name parameter. Add found_name parameter.
3782 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3783 * dirsearch.h (class Dirsearch): Update declaration.
3784
3785 2011-05-24 Ian Lance Taylor <iant@google.com>
3786
3787 * archive.cc (Library_base::should_include_member): Pull in object
3788 from archive if it defines the entry symbol.
3789 * parameters.cc (Parameters::entry): New function.
3790 * parameters.h (class Parameters): Declare entry.
3791 * output.h (class Output_file_header): Remove entry_ field.
3792 * output.cc (Output_file_header::Output_file_header): Remove entry
3793 parameter. Change all callers.
3794 (Output_file_header::entry): Use parameters->entry.
3795 * gold.cc (queue_middle_tasks): Likewise.
3796 * plugin.cc (Plugin_hook::run): Likewise.
3797
3798 2011-05-24 Cary Coutant <ccoutant@google.com>
3799
3800 * gold.cc (queue_initial_tasks): Pass incremental base filename
3801 to Output_file::open_base_file; don't print error message.
3802 * incremental-dump.cc (main): Adjust call to
3803 Output_file::open_for_modification.
3804 * incremental-dump.cc (main): Likewise.
3805 * incremental.cc (Incremental_inputs::report_command_line):
3806 Ignore --incremental-base option when comparing command lines.
3807 Ignore parameter when given as separate argument.
3808 * options.h (class General_options): Add --incremental-base.
3809 * output.cc (Output_file::Output_file):
3810 (Output_file::open_base_file): Add base_name and writable parameters;
3811 read base file into new file; print error message here.
3812 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3813 callers.
3814 * output.h (Output_file::open_for_modification): Rename to...
3815 (Output_file::open_base_file): ...this; add base_name and
3816 writable parameters; adjust all callers.
3817 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3818 callers.
3819 * testsuite/Makefile.am (incremental_test_4): Test
3820 --incremental-base.
3821 * testsuite/Makefile.in: Regenerate.
3822
3823 2011-05-24 Cary Coutant <ccoutant@google.com>
3824
3825 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3826 incremental_test_4.
3827 * testsuite/Makefile.in: Regenerate.
3828 * testsuite/two_file_test_1_v1.cc: New test source file.
3829 * testsuite/two_file_test_1b_v1.cc: New test source file.
3830 * testsuite/two_file_test_2_v1.cc: New test source file.
3831
3832 2011-05-24 Cary Coutant <ccoutant@google.com>
3833
3834 * dynobj.h (Dynobj::do_dynobj): New function.
3835 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3836 flag and soname for shared objects.
3837 * incremental.cc (Incremental_inputs::report_object): Make
3838 either Incremental_object_entry or Incremental_dynobj_entry; add
3839 soname to string table.
3840 (Incremental_inputs::report_input_section): Add assertion.
3841 (Output_section_incremental_inputs::set_final_data_size): Adjust
3842 type of input file entry for shared libraries; adjust size of
3843 shared library info entry.
3844 (Output_section_incremental_inputs::write_input_files): Write
3845 as_needed flag for shared libraries.
3846 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3847 of input file entry for shared libraries; write soname.
3848 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3849 soname from incremental info.
3850 * incremental.h (enum Incremental_input_flags): Add
3851 INCREMENTAL_INPUT_AS_NEEDED.
3852 (Incremental_input_entry::Incremental_input_entry): Initialize new
3853 data member.
3854 (Incremental_input_entry::set_as_needed): New function.
3855 (Incremental_input_entry::as_needed): New function.
3856 (Incremental_input_entry::do_dynobj_entry): New function.
3857 (Incremental_input_entry::as_needed_): New data member.
3858 (Incremental_object_entry::Incremental_object_entry): Don't check
3859 for shared library.
3860 (Incremental_object_entry::do_type): Likewise.
3861 (class Incremental_dynobj_entry): New class.
3862 (Incremental_input_entry_reader::as_needed): New function.
3863 (Incremental_input_entry_reader::get_soname): New function.
3864 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3865 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3866 size of shared library info entry.
3867 * layout.cc (Layout::finish_dynamic_section): Don't test for
3868 incremental link when adding DT_NEEDED entries.
3869 * object.h (Object::Object): Initialize new data member.
3870 (Object::dynobj): New function.
3871 (Object::set_as_needed): New function.
3872 (Object::as_needed): New function.
3873 (Object::do_dynobj): New function.
3874 (Object::as_needed_): New data member.
3875
3876 2011-05-24 Cary Coutant <ccoutant@google.com>
3877
3878 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3879 info; adjust display of GOT entries.
3880 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3881 vector of input objects; remove file_status_.
3882 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3883 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3884 got_plt reader; call target hooks to reserve GOT entries.
3885 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3886 of input file info header and GOT info entry.
3887 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3888 relocation info.
3889 (Got_plt_view_info::got_descriptor): Remove.
3890 (Got_plt_view_info::sym_index): New data member.
3891 (Got_plt_view_info::input_index): New data member.
3892 (Local_got_offset_visitor::visit): Write input file index.
3893 (Global_got_offset_visitor::visit): Write 0 for input file index.
3894 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3895 with sym_index and input_index.
3896 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3897 incremental info GOT entry; replace got_descriptor with input_index.
3898 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3899 map from input file index to object.
3900 (Sized_relobj_incr::do_layout): Replace direct data member reference
3901 with accessor function.
3902 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3903 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3904 Adjust size of input file info header.
3905 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3906 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3907 (Incremental_input_entry_reader::get_input_section): Adjust size of
3908 input file info header.
3909 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3910 of incremental info GOT entry.
3911 (Incremental_got_plt_reader::get_got_desc): Remove.
3912 (Incremental_got_plt_reader::get_got_symndx): New function.
3913 (Incremental_got_plt_reader::get_got_input_index): New function.
3914 (Sized_incremental_binary::Sized_incremental_binary): Remove
3915 file_status_; add input_objects_.
3916 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3917 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3918 (Sized_incremental_binary::file_is_unchanged): Remove.
3919 (Sized_incremental_binary::set_input_object): New function.
3920 (Sized_incremental_binary::input_object): New function.
3921 (Sized_incremental_binary::file_status_): Remove.
3922 (Sized_incremental_binary::input_objects_): New data member.
3923 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3924 references.
3925 (Sized_relobj_incr::invalid_address): Move to base class.
3926 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3927 class.
3928 (Sized_relobj_incr::do_output_section_offset): Likewise.
3929 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3930 (Sized_relobj_incr::section_offsets_): Likewise.
3931 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3932 function.
3933 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3934 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3935 with accessor function.
3936 (Sized_relobj_file::do_layout): Likewise.
3937 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3938 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3939 (Sized_relobj_file::compute_final_local_value): Replace refs to
3940 section_offsets_ with accessor function.
3941 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3942 * object.h (Relobj::Relobj): Initialize new data members.
3943 (Relobj::add_dyn_reloc): New function.
3944 (Relobj::first_dyn_reloc): New function.
3945 (Relobj::dyn_reloc_count): New function.
3946 (Relobj::first_dyn_reloc_): New data member.
3947 (Relobj::dyn_reloc_count_): New data member.
3948 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3949 references.
3950 (Sized_relobj::Address): New typedef.
3951 (Sized_relobj::invalid_address): Move here from child class.
3952 (Sized_relobj::Sized_relobj): Initialize new data members.
3953 (Sized_relobj::sized_relobj): New function.
3954 (Sized_relobj::is_output_section_offset_invalid): Move here from
3955 child class.
3956 (Sized_relobj::get_output_section_offset): Likewise.
3957 (Sized_relobj::local_has_got_offset): Likewise.
3958 (Sized_relobj::local_got_offset): Likewise.
3959 (Sized_relobj::set_local_got_offset): Likewise.
3960 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3961 (Sized_relobj::clear_got_offsets): New function.
3962 (Sized_relobj::section_offsets): Move here from child class.
3963 (Sized_relobj::do_output_section_offset): Likewise.
3964 (Sized_relobj::do_set_section_offset): Likewise.
3965 (Sized_relobj::Local_got_offsets): Likewise.
3966 (Sized_relobj::local_got_offsets_): Likewise.
3967 (Sized_relobj::section_offsets_): Likewise.
3968 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3969 references.
3970 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3971 class.
3972 (Sized_relobj_file::sized_relobj): New function
3973 (Sized_relobj_file::local_has_got_offset): Move to base class.
3974 (Sized_relobj_file::local_got_offset): Likewise.
3975 (Sized_relobj_file::set_local_got_offset): Likewise.
3976 (Sized_relobj_file::get_output_section_offset): Likewise.
3977 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3978 (Sized_relobj_file::do_output_section_offset): Likewise.
3979 (Sized_relobj_file::do_set_section_offset): Likewise.
3980 (Sized_relobj_file::Local_got_offsets): Likewise.
3981 (Sized_relobj_file::local_got_offsets_): Likewise.
3982 (Sized_relobj_file::section_offsets_): Likewise.
3983 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3984 (all constructors).
3985 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3986 (Output_reloc::get_symbol_index): Likewise.
3987 (Output_reloc::local_section_offset): Likewise.
3988 (Output_reloc::get_address): Likewise.
3989 (Output_reloc::symbol_value): Likewise.
3990 (Output_data_got::reserve_slot): Move to class definition.
3991 (Output_data_got::reserve_local): New function.
3992 (Output_data_got::reserve_slot_for_global): Remove.
3993 (Output_data_got::reserve_global): New function.
3994 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3995 (all constructors, two instantiations).
3996 (Output_reloc::get_relobj): New function (two instantiations).
3997 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3998 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3999 (Output_data_reloc::add_global): Adjust type of relobj.
4000 (Output_data_reloc::add_global_relative): Likewise.
4001 (Output_data_reloc::add_symbolless_global_addend): Likewise.
4002 (Output_data_reloc::add_local): Likewise.
4003 (Output_data_reloc::add_local_relative): Likewise.
4004 (Output_data_reloc::add_symbolless_local_addend): Likewise.
4005 (Output_data_reloc::add_local_section): Likewise.
4006 (Output_data_reloc::add_output_section): Likewise.
4007 (Output_data_reloc::add_absolute): Likewise.
4008 (Output_data_reloc::add_target_specific): Likewise.
4009 (Output_data_got::reserve_slot): Move definition here.
4010 (Output_data_got::reserve_local): New function.
4011 (Output_data_got::reserve_global): New function.
4012 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4013 section_offsets_ with accessor function.
4014 (Sized_relobj_file::write_sections): Likewise.
4015 (Sized_relobj_file::do_relocate_sections): Likewise.
4016 * target.h (Sized_target::reserve_local_got_entry): New function.
4017 (Sized_target::reserve_global_got_entry): New function.
4018 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4019 (Target_x86_64::reserve_global_got_entry): New function.
4020 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4021
4022 2011-05-23 Cary Coutant <ccoutant@google.com>
4023
4024 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4025 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4026 bit when checking got_type.
4027 * incremental.cc (Sized_incremental_binary::setup_readers):
4028 Store symbol table and string table locations; initialize bit vector
4029 of file status flags.
4030 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4031 unchanged files.
4032 (Sized_incremental_binary::do_process_got_plt): New function.
4033 (Sized_incremental_binary::get_symtab_view): Use stored locations.
4034 (Output_section_incremental_inputs::set_final_data_size): Record
4035 file index for each input file.
4036 (Output_section_incremental_inputs::write_got_plt): Store file index
4037 instead of input entry offset for each GOT entry.
4038 * incremental.h
4039 (Incremental_input_entry::Incremental_input_entry): Initialize new
4040 data member.
4041 (Incremental_input_entry::set_offset): Store file index.
4042 (Incremental_input_entry::get_file_index): New function.
4043 (Incremental_input_entry::file_index_): New data member.
4044 (Incremental_binary::process_got_plt): New function.
4045 (Incremental_binary::do_process_got_plt): New function.
4046 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4047 data members.
4048 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4049 (Sized_incremental_binary::set_file_is_unchanged): New function.
4050 (Sized_incremental_binary::file_is_unchanged): New function.
4051 (Sized_incremental_binary::do_process_got_plt): New function.
4052 (Sized_incremental_binary::file_status_): New data member.
4053 (Sized_incremental_binary::main_symtab_loc_): New data member.
4054 (Sized_incremental_binary::main_strtab_loc_): New data member.
4055 * output.cc (Output_data_got::Got_entry::write): Add case
4056 RESERVED_CODE.
4057 (Output_data_got::add_global): Call add_got_entry.
4058 (Output_data_got::add_global_plt): Likewise.
4059 (Output_data_got::add_global_with_rel): Likewise.
4060 (Output_data_got::add_global_with_rela): Likewise.
4061 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4062 (Output_data_got::add_global_pair_with_rela): Likewise.
4063 (Output_data_got::add_local): Call add_got_entry.
4064 (Output_data_got::add_local_plt): Likewise.
4065 (Output_data_got::add_local_with_rel): Likewise.
4066 (Output_data_got::add_local_with_rela): Likewise.
4067 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4068 (Output_data_got::add_local_pair_with_rela): Likewise.
4069 (Output_data_got::reserve_slot): New function.
4070 (Output_data_got::reserve_slot_for_global): New function.
4071 (Output_data_got::add_got_entry): New function.
4072 (Output_data_got::add_got_entry_pair): New function.
4073 (Output_section::add_output_section_data): Edit FIXME.
4074 * output.h
4075 (Output_section_data_build::Output_section_data_build): New
4076 constructor with size parameter.
4077 (Output_data_space::Output_data_space): Likewise.
4078 (Output_data_got::Output_data_got): Initialize new data member; new
4079 constructor with size parameter.
4080 (Output_data_got::add_constant): Call add_got_entry.
4081 (Output_data_got::reserve_slot): New function.
4082 (Output_data_got::reserve_slot_for_global): New function.
4083 (class Output_data_got::Got_entry): Add RESERVED_CODE.
4084 (Output_data_got::add_got_entry): New function.
4085 (Output_data_got::add_got_entry_pair): New function.
4086 (Output_data_got::free_list_): New data member.
4087 * target.h (Sized_target::init_got_plt_for_update): New function.
4088 (Sized_target::register_global_plt_entry): New function.
4089 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4090 Initialize new data member; call init; add constructor with PLT count.
4091 (Output_data_plt_x86_64::init): New function.
4092 (Output_data_plt_x86_64::add_relocation): New function.
4093 (Output_data_plt_x86_64::reserve_slot): New function.
4094 (Output_data_plt_x86_64::free_list_): New data member.
4095 (Target_x86_64::init_got_plt_for_update): New function.
4096 (Target_x86_64::register_global_plt_entry): New function.
4097 (Output_data_plt_x86_64::add_entry): Allocate from free list for
4098 incremental updates.
4099 (Output_data_plt_x86_64::add_relocation): New function.
4100 * testsuite/object_unittest.cc (Object_test): Set default options.
4101
4102 2011-05-16 Ian Lance Taylor <iant@google.com>
4103
4104 * options.h (class General_options): Make -i a synonym for -r.
4105
4106 2011-05-16 Ian Lance Taylor <iant@google.com>
4107
4108 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4109
4110 2011-05-10 Cary Coutant <ccoutant@google.com>
4111
4112 * object.cc (Sized_relobj::do_count_local_symbols): Check for
4113 strip_all (-s).
4114
4115 2011-05-06 Ian Lance Taylor <iant@google.com>
4116
4117 * layout.cc (Layout::layout): If the output section flags change,
4118 update the ordering.
4119
4120 2011-04-25 Cary Coutant <ccoutant@google.com>
4121
4122 * incremental-dump.cc (dump_incremental_inputs): Print local
4123 symbol info for each input file.
4124 * incremental.cc
4125 (Output_section_incremental_inputs::set_final_data_size): Add local
4126 symbol info to input file entries in incremental info.
4127 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4128 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4129 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4130 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4131 implementation.
4132 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4133 (Sized_incr_relobj::do_relocate): Write the local symbols.
4134 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4135 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4136 Adjust size of input file header.
4137 (Incremental_inputs_reader::get_local_symbol_offset): New function.
4138 (Incremental_inputs_reader::get_local_symbol_count): New function.
4139 (Incremental_inputs_reader::get_input_section): Adjust size of input
4140 file header.
4141 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4142 (Sized_incr_relobj::This): New typedef.
4143 (Sized_incr_relobj::sym_size): New const data member.
4144 (Sized_incr_relobj::Local_symbol): New struct.
4145 (Sized_incr_relobj::do_output_local_symbol_count): New function.
4146 (Sized_incr_relobj::do_local_symbol_offset): New function.
4147 (Sized_incr_relobj::local_symbol_count_): New data member.
4148 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4149 (Sized_incr_relobj::local_symbol_index_): New data member.
4150 (Sized_incr_relobj::local_symbol_offset_): New data member.
4151 (Sized_incr_relobj::local_dynsym_offset_): New data member.
4152 (Sized_incr_relobj::local_symbols_): New data member.
4153 * object.h (Relobj::output_local_symbol_count): New function.
4154 (Relobj::local_symbol_offset): New function.
4155 (Relobj::do_output_local_symbol_count): New function.
4156 (Relobj::do_local_symbol_offset): New function.
4157 (Sized_relobj::do_output_local_symbol_count): New function.
4158 (Sized_relobj::do_local_symbol_offset): New function.
4159
4160 2011-04-22 Vladimir Simonov <sv@sw.ru>
4161
4162 * descriptors.cc (set_close_on_exec): New function.
4163 (Descriptors::open): Use set_close_on_exec.
4164 * output.cc (S_ISLNK): Define if not defined.
4165
4166 2011-04-22 Cary Coutant <ccoutant@google.com>
4167
4168 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4169 global symbol map.
4170 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4171 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4172 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4173 relocations.
4174 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4175 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4176 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4177 * incremental.h
4178 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4179 function.
4180 (Incremental_binary::apply_incremental_relocs): New function.
4181 (Incremental_binary::do_apply_incremental_relocs): New function.
4182 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4183 data member.
4184 (Sized_incremental_binary::add_global_symbol): New function.
4185 (Sized_incremental_binary::global_symbol): New function.
4186 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4187 (Sized_incremental_binary::symbol_map_): New data member.
4188 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4189 * target.h (Sized_target::apply_relocation): New function.
4190 * target-reloc.h (apply_relocation): New function.
4191 * x86_64.cc (Target_x86_64::apply_relocation): New function.
4192
4193 2011-04-22 Doug Kwan <dougkwan@google.com>
4194
4195 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4196 flag of a SHT_ARM_EXIDX section.
4197 * testsuite/Makefile.am (arm_exidx_test): New test rules.
4198 * testsuite/Makefile.in: Regenerate.
4199 * testsuite/arm_exidx_test.s: New file.
4200 * testsuite/arm_exidx_test.sh: Same.
4201
4202 2011-04-20 Cary Coutant <ccoutant@google.com>
4203
4204 PR gold/12689
4205 * archive.h (Incremental_archive_entry::Archive_member):
4206 Initialize arg_serial_ (second constructor).
4207
4208 2011-04-17 Ian Lance Taylor <iant@google.com>
4209
4210 * object.cc (Relocate_info::location): Simplify location string.
4211 * errors.cc (Errors::error_at_location): Don't print program
4212 name.
4213 (Errors::warning_at_location): Likewise.
4214 (Errors::undefined_symbol): Likewise.
4215 * testsuite/debug_msg.sh: Update accordingly.
4216
4217 2011-04-14 Cary Coutant <ccoutant@google.com>
4218
4219 * gold/layout.cc (Layout::symtab_section_offset): New function.
4220 * gold/layout.h (Layout::symtab_section_offset): New function.
4221 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4222
4223 2011-04-12 Ian Lance Taylor <iant@google.com>
4224
4225 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
4226 with MREMAP_MAYMOVE.
4227 * output.h (class Output_file): Add map_is_allocated_ field.
4228 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
4229 not available, provide stubs. If mremap is not available, #define
4230 it to gold_mremap.
4231 (MREMAP_MAYMOVE): Define if not defined.
4232 (Output_file::Output_file): Initialize map_is_allocated_.
4233 (Output_file::resize): Check map_is_allocated_.
4234 (Output_file::map_anonymous): If mmap fails, use malloc.
4235 (Output_file::unmap): Don't do anything for an anonymous map.
4236 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
4237 is not available, provide stubs.
4238 (File_read::View::~View): Use free rather than delete[].
4239 (File_read::make_view): Use malloc rather than new[]. If mmap
4240 fails, use malloc.
4241 (File_read::find_or_make_view): Use malloc rather than new[].
4242 * gold.h: Remove HAVE_REMAP code.
4243 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
4244 exists. Rename mremap to gold_mremap. If mmap is not available
4245 don't do anything.
4246 * configure, config.in: Rebuild.
4247
4248 2011-04-11 Ian Lance Taylor <iant@google.com>
4249
4250 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4251 initialize local variable v.
4252
4253 2011-04-11 Cary Coutant <ccoutant@google.com>
4254
4255 * archive.cc (Archive::include_member): Adjust call to
4256 report_object.
4257 (Add_archive_symbols::run): Track argument serial numbers.
4258 (Lib_group::include_member): Likewise.
4259 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4260 * archive.h (Incremental_archive_entry::Archive_member):
4261 Initialize arg_serial_.
4262 (Archive_member::arg_serial_): New data member.
4263 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4264 (Sized_dynobj::do_add_symbols): Track symbols when doing an
4265 incremental link.
4266 (Sized_dynobj::do_for_all_local_got_entries): New function.
4267 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4268 function.
4269 * fileread.cc (get_mtime): New function.
4270 * fileread.h (get_mtime): New function.
4271 * gold.cc (queue_initial_tasks): Check for incremental update.
4272 (process_incremental_input): New function.
4273 (queue_middle_tasks): Don't force valid target for incremental
4274 update.
4275 * incremental-dump.cc (find_input_containing_global): Adjust
4276 size of symbol info entry.
4277 (dump_incremental_inputs): Dump argument serial number and
4278 in_system_directory flag; bias shndx by 1; print symbol names
4279 when dumping per-file symbol lists; use new symbol info readers.
4280 * incremental.cc
4281 (Output_section_incremental_inputs:update_data_size): New function.
4282 (Sized_incremental_binary::setup_readers): Setup input readers
4283 for each input file; build maps for files added from libraries
4284 and scripts.
4285 (Sized_incremental_binary::check_input_args): New function.
4286 (Sized_incremental_binary::do_check_inputs): Build map of argument
4287 serial numbers to input arguments.
4288 (Sized_incremental_binary::do_file_has_changed): Rename
4289 do_file_is_unchanged to this; compare file modification times.
4290 (Sized_incremental_binary::do_init_layout): New function.
4291 (Sized_incremental_binary::do_reserve_layout): New function.
4292 (Sized_incremental_binary::do_get_input_reader): Remove.
4293 (Sized_incremental_binary::get_symtab_view): New function.
4294 (Incremental_checker::can_incrementally_link_output_file): Remove.
4295 (Incremental_inputs::report_command_line): Exclude --debug options.
4296 (Incremental_inputs::report_archive_begin): Add parameter; track
4297 argument serial numbers; don't put input file entry for archive
4298 before archive members.
4299 (Incremental_inputs::report_archive_end): Put input file entry
4300 for archive after archive members.
4301 (Incremental_inputs::report_object): Add parameter; track argument
4302 serial numbers and in_system_directory flag.
4303 (Incremental_inputs::report_script): Add parameter; track argument
4304 serial numbers.
4305 (Output_section_incremental_inputs::set_final_data_size): Adjust
4306 size of symbol info entry; check for forwarding symbols.
4307 (Output_section_incremental_inputs::write_input_files): Write
4308 in_system_directory flag and argument serial number.
4309 (Output_section_incremental_inputs::write_info_blocks): Map section
4310 indices between incremental info and original input file; store
4311 input section index for each symbol.
4312 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4313 change operator() to visit().
4314 (class Global_got_offset_visitor): Likewise.
4315 (class Global_symbol_visitor_got_plt):
4316 (Output_section_incremental_inputs::write_got_plt): Use new visitor
4317 classes.
4318 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4319 (Sized_incr_relobj::do_read_symbols): New function.
4320 (Sized_incr_relobj::do_layout): New function.
4321 (Sized_incr_relobj::do_layout_deferred_sections): New function.
4322 (Sized_incr_relobj::do_add_symbols): New function.
4323 (Sized_incr_relobj::do_should_include_member): New function.
4324 (Sized_incr_relobj::do_for_all_global_symbols): New function.
4325 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4326 (Sized_incr_relobj::do_section_size): New function.
4327 (Sized_incr_relobj::do_section_name): New function.
4328 (Sized_incr_relobj::do_section_contents): New function.
4329 (Sized_incr_relobj::do_section_flags): New function.
4330 (Sized_incr_relobj::do_section_entsize): New function.
4331 (Sized_incr_relobj::do_section_address): New function.
4332 (Sized_incr_relobj::do_section_type): New function.
4333 (Sized_incr_relobj::do_section_link): New function.
4334 (Sized_incr_relobj::do_section_info): New function.
4335 (Sized_incr_relobj::do_section_addralign): New function.
4336 (Sized_incr_relobj::do_initialize_xindex): New function.
4337 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4338 (Sized_incr_relobj::do_read_relocs): New function.
4339 (Sized_incr_relobj::do_gc_process_relocs): New function.
4340 (Sized_incr_relobj::do_scan_relocs): New function.
4341 (Sized_incr_relobj::do_count_local_symbols): New function.
4342 (Sized_incr_relobj::do_finalize_local_symbols): New function.
4343 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4344 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4345 (Sized_incr_relobj::do_relocate): New function.
4346 (Sized_incr_relobj::do_set_section_offset): New function.
4347 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4348 (Sized_incr_dynobj::do_read_symbols): New function.
4349 (Sized_incr_dynobj::do_layout): New function.
4350 (Sized_incr_dynobj::do_add_symbols): New function.
4351 (Sized_incr_dynobj::do_should_include_member): New function.
4352 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4353 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4354 (Sized_incr_dynobj::do_section_size): New function.
4355 (Sized_incr_dynobj::do_section_name): New function.
4356 (Sized_incr_dynobj::do_section_contents): New function.
4357 (Sized_incr_dynobj::do_section_flags): New function.
4358 (Sized_incr_dynobj::do_section_entsize): New function.
4359 (Sized_incr_dynobj::do_section_address): New function.
4360 (Sized_incr_dynobj::do_section_type): New function.
4361 (Sized_incr_dynobj::do_section_link): New function.
4362 (Sized_incr_dynobj::do_section_info): New function.
4363 (Sized_incr_dynobj::do_section_addralign): New function.
4364 (Sized_incr_dynobj::do_initialize_xindex): New function.
4365 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4366 (make_sized_incremental_object): New function.
4367 (Incremental_library::copy_unused_symbols): New function.
4368 (Incremental_library::do_for_all_unused_symbols): New function.
4369 * incremental.h (enum Incremental_input_flags): New type.
4370 (class Incremental_checker): Remove.
4371 (Incremental_input_entry::Incremental_input_entry): Add argument
4372 serial number.
4373 (Incremental_input_entry::arg_serial): New function.
4374 (Incremental_input_entry::set_is_in_system_directory): New function.
4375 (Incremental_input_entry::is_in_system_directory): New function.
4376 (Incremental_input_entry::arg_serial_): New data member.
4377 (Incremental_input_entry::is_in_system_directory_): New data member.
4378 (class Script_info): Move here from script.h.
4379 (Script_info::Script_info): Add filename parameter.
4380 (Script_info::filename): New function.
4381 (Script_info::filename_): New data member.
4382 (Incremental_script_entry::Incremental_script_entry): Add argument
4383 serial number.
4384 (Incremental_object_entry::Incremental_object_entry): Likewise.
4385 (Incremental_object_entry::add_input_section): Build list of input
4386 sections with map to original shndx.
4387 (Incremental_object_entry::get_input_section_index): New function.
4388 (Incremental_object_entry::shndx_): New data member.
4389 (Incremental_object_entry::name_key_): Rename; adjust all refs.
4390 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4391 (Incremental_archive_entry::Incremental_archive_entry): Add argument
4392 serial number.
4393 (Incremental_inputs::report_archive_begin): Likewise.
4394 (Incremental_inputs::report_object): Likewise.
4395 (Incremental_inputs::report_script): Likewise.
4396 (class Incremental_global_symbol_reader): New class.
4397 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4398 and store flags and input file type.
4399 (Incremental_input_entry_reader::arg_serial): New function.
4400 (Incremental_input_entry_reader::type): Extract type from flags.
4401 (Incremental_input_entry_reader::is_in_system_directory): New function.
4402 (Incremental_input_entry_reader::get_input_section_count): Call
4403 accessor function for type.
4404 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4405 function for type; adjust size of global symbol entry.
4406 (Incremental_input_entry_reader::get_global_symbol_count): Call
4407 accessor function for type.
4408 (Incremental_input_entry_reader::get_object_count): Likewise.
4409 (Incremental_input_entry_reader::get_object_offset): Likewise.
4410 (Incremental_input_entry_reader::get_member_count): Likewise.
4411 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4412 (Incremental_input_entry_reader::get_member_offset): Likewise.
4413 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4414 (Incremental_input_entry_reader::Global_symbol_info): Remove.
4415 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4416 (Incremental_input_entry_reader::get_global_symbol_reader): New
4417 function.
4418 (Incremental_input_entry_reader::get_output_symbol_index): New
4419 function.
4420 (Incremental_input_entry_reader::type_): Remove.
4421 (Incremental_input_entry_reader::flags_): New data member.
4422 (Incremental_inputs_reader::input_file_offset): New function.
4423 (Incremental_inputs_reader::input_file_index): New function.
4424 (Incremental_inputs_reader::input_file): Call input_file_offset.
4425 (Incremental_inputs_reader::input_file_at_offset): New function.
4426 (Incremental_relocs_reader::get_r_type): Reformat.
4427 (Incremental_relocs_reader::get_r_shndx): Reformat.
4428 (Incremental_relocs_reader::get_r_offset): Reformat.
4429 (Incremental_relocs_reader::data): New function.
4430 (Incremental_binary::Incremental_binary): Initialize new data members.
4431 (Incremental_binary::check_inputs): Add cmdline parameter.
4432 (Incremental_binary::file_is_unchanged): Remove.
4433 (Input_reader::arg_serial): New function.
4434 (Input_reader::get_unused_symbol_count): New function.
4435 (Input_reader::get_unused_symbol): New function.
4436 (Input_reader::do_arg_serial): New function.
4437 (Input_reader::do_get_unused_symbol_count): New function.
4438 (Input_reader::do_get_unused_symbol): New function.
4439 (Incremental_binary::input_file_count): New function.
4440 (Incremental_binary::get_input_reader): Change signature to use
4441 index instead of filename.
4442 (Incremental_binary::file_has_changed): New function.
4443 (Incremental_binary::get_input_argument): New function.
4444 (Incremental_binary::get_library): New function.
4445 (Incremental_binary::get_script_info): New function.
4446 (Incremental_binary::init_layout): New function.
4447 (Incremental_binary::reserve_layout): New function.
4448 (Incremental_binary::output_file): New function.
4449 (Incremental_binary::do_check_inputs): New function.
4450 (Incremental_binary::do_file_is_unchanged): Remove.
4451 (Incremental_binary::do_file_has_changed): New function.
4452 (Incremental_binary::do_init_layout): New function.
4453 (Incremental_binary::do_reserve_layout): New function.
4454 (Incremental_binary::do_input_file_count): New function.
4455 (Incremental_binary::do_get_input_reader): Change signature.
4456 (Incremental_binary::input_args_map_): New data member.
4457 (Incremental_binary::library_map_): New data member.
4458 (Incremental_binary::script_map_): New data member.
4459 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4460 new data members.
4461 (Sized_incremental_binary::output_section): New function.
4462 (Sized_incremental_binary::inputs_reader): Add const.
4463 (Sized_incremental_binary::symtab_reader): Add const.
4464 (Sized_incremental_binary::relocs_reader): Add const.
4465 (Sized_incremental_binary::got_plt_reader): Add const.
4466 (Sized_incremental_binary::get_symtab_view): New function.
4467 (Sized_incremental_binary::Inputs_reader): New typedef.
4468 (Sized_incremental_binary::Input_entry_reader): New typedef.
4469 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4470 (Sized_incremental_binary::do_file_is_unchanged): Remove.
4471 (Sized_incremental_binary::do_file_has_changed): New function.
4472 (Sized_incremental_binary::do_init_layout): New function.
4473 (Sized_incremental_binary::do_reserve_layout): New function.
4474 (Sized_input_reader::Inputs_reader): Remove.
4475 (Sized_input_reader::Input_entry_reader): Remove.
4476 (Sized_input_reader::do_arg_serial): New function.
4477 (Sized_input_reader::do_get_unused_symbol_count): New function.
4478 (Sized_input_reader::do_get_unused_symbol): New function.
4479 (Sized_incremental_binary::do_input_file_count): New function.
4480 (Sized_incremental_binary::do_get_input_reader): Change signature;
4481 use index instead of filename.
4482 (Sized_incremental_binary::section_map_): New data member.
4483 (Sized_incremental_binary::input_entry_readers_): New data member.
4484 (class Sized_incr_relobj): New class.
4485 (class Sized_incr_dynobj): New class.
4486 (make_sized_incremental_object): New function.
4487 (class Incremental_library): New class.
4488 * layout.cc (Free_list::num_lists): New static data member.
4489 (Free_list::num_nodes): New static data member.
4490 (Free_list::num_removes): New static data member.
4491 (Free_list::num_remove_visits): New static data member.
4492 (Free_list::num_allocates): New static data member.
4493 (Free_list::num_allocate_visits): New static data member.
4494 (Free_list::init): New function.
4495 (Free_list::remove): New function.
4496 (Free_list::allocate): New function.
4497 (Free_list::dump): New function.
4498 (Free_list::print_stats): New function.
4499 (Layout_task_runner::run): Resize output file for incremental updates.
4500 (Layout::Layout): Initialize new data members.
4501 (Layout::set_incremental_base): New function.
4502 (Layout::init_fixed_output_section): New function.
4503 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4504 incremental updates.
4505 (Layout::create_gold_note): Do not create gold note section for
4506 incremental updates.
4507 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4508 for incremental updates.
4509 (Layout::set_section_offsets): For incremental updates, allocate space
4510 from free list.
4511 (Layout::create_symtab_sections): Layout with offsets relative to
4512 start of section; for incremental updates, allocate space from free
4513 list.
4514 (Layout::create_shdrs): For incremental updates, allocate space from
4515 free list.
4516 (Layout::finish_dynamic_section): For incremental updates, do not
4517 check --as-needed (fixed in subsequent patch).
4518 * layout.h (class Free_list): New class.
4519 (Layout::set_incremental_base): New function.
4520 (Layout::incremental_base): New function.
4521 (Layout::init_fixed_output_section): New function.
4522 (Layout::allocate): New function.
4523 (Layout::incremental_base_): New data member.
4524 (Layout::free_list_): New data member.
4525 * main.cc (main): Print Free_list statistics.
4526 * object.cc (Relobj::finalize_incremental_relocs): Add
4527 clear_counts parameter; clear counts only when clear_counts is set.
4528 (Sized_relobj::Sized_relobj): Initialize new base class.
4529 (Sized_relobj::do_layout): Don't report special sections.
4530 (Sized_relobj::do_for_all_local_got_entries): New function.
4531 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4532 symtab_off to all symbol table offsets.
4533 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4534 * object.h (class Got_offset_list): Move to top of file.
4535 (Object::Object): Allow case where input_file == NULL.
4536 (Object::~Object): Likewise.
4537 (Object::input_file): Assert that input_file != NULL.
4538 (Object::lock): Allow case where input_file == NULL.
4539 (Object::unlock): Likewise.
4540 (Object::is_locked): Likewise.
4541 (Object::token): Likewise.
4542 (Object::release): Likewise.
4543 (Object::is_incremental): New function.
4544 (Object::get_mtime): New function.
4545 (Object::for_all_local_got_entries): New function.
4546 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4547 (Object::set_is_in_system_directory): New function.
4548 (Object::is_in_system_directory): New function.
4549 (Object::do_is_incremental): New function.
4550 (Object::do_get_mtime): New function.
4551 (Object::do_for_all_local_got_entries): New function.
4552 (Object::is_in_system_directory_): New data member.
4553 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4554 (class Sized_relobj_base): New class.
4555 (class Sized_relobj): Derive from Sized_relobj_base.
4556 (class Sized_relobj::Symbols): Redeclare from base class.
4557 (class Sized_relobj::local_got_offset_list): Remove.
4558 (class Sized_relobj::Output_sections): Redeclare from base class.
4559 (class Sized_relobj::do_for_all_local_got_entries): New function.
4560 (class Sized_relobj::write_local_symbols): Add offset parameter.
4561 (class Sized_relobj::local_symbol_offset_): Update comment.
4562 (class Sized_relobj::local_dynsym_offset_): Update comment.
4563 * options.cc (Input_arguments::add_file): Remove const.
4564 * options.h (Input_file_argument::Input_file_argument):
4565 Initialize arg_serial_ (all constructors).
4566 (Input_file_argument::set_arg_serial): New function.
4567 (Input_file_argument::arg_serial): New function.
4568 (Input_file_argument::arg_serial_): New data member.
4569 (Input_arguments::Input_arguments): Initialize file_count_.
4570 (Input_arguments::add_file): Remove const.
4571 (Input_arguments::number_of_input_files): New function.
4572 (Input_arguments::file_count_): New data member.
4573 (Command_line::number_of_input_files): Call
4574 Input_arguments::number_of_input_files.
4575 * output.cc (Output_segment_headers::Output_segment_headers):
4576 Set current size.
4577 (Output_section::Input_section::current_data_size): New function.
4578 (Output_section::Output_section): Initialize new data members.
4579 (Output_section::add_input_section): Don't do merge sections for
4580 an incremental link; allocate space from free list for an
4581 incremental update.
4582 (Output_section::add_output_section_data): Allocate space from
4583 free list for an incremental update.
4584 (Output_section::update_data_size): New function.
4585 (Output_section::set_fixed_layout): New function.
4586 (Output_section::reserve): New function.
4587 (Output_segment::set_section_addresses): Remove const.
4588 (Output_segment::set_section_list_addresses): Remove const; allocate
4589 space from free list for an incremental update.
4590 (Output_segment::set_offset): Adjust size of RELRO segment for an
4591 incremental update.
4592 * output.h (Output_data::current_data_size): Move here from
4593 child classes.
4594 (Output_data::pre_finalize_data_size): New function.
4595 (Output_data::update_data_size): New function.
4596 (Output_section_headers::update_data_size): new function.
4597 (Output_section_data_build::current_data_size): Move to Output_data.
4598 (Output_data_strtab::update_data_size): New function.
4599 (Output_section::current_data_size): Move to Output_data.
4600 (Output_section::set_fixed_layout): New function.
4601 (Output_section::has_fixed_layout): New function.
4602 (Output_section::reserve): New function.
4603 (Output_section::update_data_size): New function.
4604 (Output_section::has_fixed_layout_): New data member.
4605 (Output_section::free_list_): New data member.
4606 (Output_segment::set_section_addresses): Remove const.
4607 (Output_segment::set_section_list_addresses): Remove const.
4608 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4609 New function.
4610 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4611 New function.
4612 * readsyms.cc (Read_symbols::do_read_symbols): Add library
4613 parameter when calling Add_symbols constructor; store argument
4614 serial number for members of a lib group.
4615 (Add_symbols::locks): Allow case where token == NULL.
4616 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4617 (Read_member::~Read_member): New function.
4618 (Read_member::is_runnable): New function.
4619 (Read_member::locks): New function.
4620 (Read_member::run): New function.
4621 (Check_script::~Check_script): New function.
4622 (Check_script::is_runnable): New function.
4623 (Check_script::locks): New function.
4624 (Check_script::run): New function.
4625 (Check_library::~Check_library): New function.
4626 (Check_library::is_runnable): New function.
4627 (Check_library::locks): New function.
4628 (Check_library::run): New function.
4629 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4630 (Add_symbols::library_): New data member.
4631 (class Read_member): New class.
4632 (class Check_script): New class.
4633 (class Check_library): New class.
4634 * reloc.cc (Read_relocs::is_runnable): Allow case where
4635 token == NULL.
4636 (Read_relocs::locks): Likewise.
4637 (Scan_relocs::locks): Likewise.
4638 (Relocate_task::locks): Likewise.
4639 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4640 to clear counters.
4641 (Sized_relobj::incremental_relocs_scan): Fix comment.
4642 (Sized_relobj::do_relocate): Pass output file offset to
4643 write_local_symbols.
4644 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4645 from class declaration.
4646 * script.cc (read_input_script): Allocate Script_info; pass
4647 argument serial number to report_script.
4648 * script.h (class Script_info): Move to incremental.h.
4649 * symtab.cc (Symbol_table::add_from_incrobj): New function.
4650 * symtab.h (Symbol_table::add_from_incrobj): New function.
4651 (Symbol_table::set_file_offset): New function.
4652
4653 2011-04-05 Cary Coutant <ccoutant@google.com>
4654
4655 * incremental-dump.cc (dump_incremental_inputs): Change signature
4656 to take a Sized_incremental_binary; change caller. Use readers
4657 in Sized_incremental_binary.
4658 * incremental.cc
4659 (Sized_incremental_binary::find_incremental_inputs_sections):
4660 Rename do_find_incremental_inputs_sections to this.
4661 (Sized_incremental_binary::setup_readers): New function.
4662 (Sized_incremental_binary::do_check_inputs): Check
4663 has_incremental_info_ flag; move setup code to setup_readers;
4664 use input readers.
4665 (Sized_incremental_binary::do_file_is_unchanged): New function.
4666 (Sized_incremental_binary::do_get_input_reader): New function.
4667 * incremental.h (class Incremental_binary): Move to end of file.
4668 (Incremental_binary::file_is_unchanged): New function.
4669 (Incremental_binary::do_file_is_unchanged): New function.
4670 (Incremental_binary::Input_reader): New class.
4671 (Incremental_binary::get_input_reader): New function.
4672 (class Sized_incremental_binary): Move to end of file.
4673 (Sized_incremental_binary::Sized_incremental_binary): Setup the
4674 input section reader classes.
4675 (Sized_incremental_binary::has_incremental_info): New function.
4676 (Sized_incremental_binary::inputs_reader): New function.
4677 (Sized_incremental_binary::symtab_reader): New function.
4678 (Sized_incremental_binary::relocs_reader): New function.
4679 (Sized_incremental_binary::got_plt_reader): New function.
4680 (Sized_incremental_binary::do_file_is_unchanged): New function.
4681 (Sized_incremental_binary::Sized_input_reader): New class.
4682 (Sized_incremental_binary::get_input_reader): New function.
4683 (Sized_incremental_binary::find_incremental_inputs_sections):
4684 Rename do_find_incremental_inputs_sections to this.
4685 (Sized_incremental_binary::setup_readers): New function.
4686 (Sized_incremental_binary::has_incremental_info_): New data member.
4687 (Sized_incremental_binary::inputs_reader_): New data member.
4688 (Sized_incremental_binary::symtab_reader_): New data member.
4689 (Sized_incremental_binary::relocs_reader_): New data member.
4690 (Sized_incremental_binary::got_plt_reader_): New data member.
4691 (Sized_incremental_binary::current_input_file_): New data member.
4692
4693 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
4694
4695 PR gold/12640
4696 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4697 violation.
4698
4699 2011-03-30 Cary Coutant <ccoutant@google.com>
4700
4701 * archive.cc (Archive::include_member): Adjust call to report_object.
4702 (Add_archive_symbols::run): Add script_info to call to
4703 report_archive_begin.
4704 (Lib_group::include_member): Adjust call to report_object.
4705 (Add_lib_group_symbols::run): Adjust call to report_object.
4706 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4707 blocks. Add object count for script input files.
4708 * incremental.cc (Incremental_inputs::report_archive_begin): Add
4709 script_info parameter; change all callers.
4710 (Incremental_inputs::report_object): Add script_info parameter;
4711 change all callers.
4712 (Incremental_inputs::report_script): Store backpointer to
4713 incremental info entry.
4714 (Output_section_incremental_inputs::set_final_data_size): Record
4715 additional information for scripts.
4716 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4717 * incremental.h (Incremental_script_entry::add_object): New function.
4718 (Incremental_script_entry::get_object_count): New function.
4719 (Incremental_script_entry::get_object): New function.
4720 (Incremental_script_entry::objects_): New data member; adjust
4721 constructor.
4722 (Incremental_inputs::report_archive_begin): Add script_info parameter.
4723 (Incremental_inputs::report_object): Add script_info parameter.
4724 (Incremental_inputs_reader::get_object_count): New function.
4725 (Incremental_inputs_reader::get_object_offset): New function.
4726 * options.cc (Input_arguments::add_file): Return reference to
4727 new input argument.
4728 * options.h (Input_argument::set_script_info): New function.
4729 (Input_argument::script_info): New function.
4730 (Input_argument::script_info_): New data member; adjust all
4731 constructors.
4732 (Input_file_group::add_file): Return reference to new input argument.
4733 (Input_file_lib::add_file): Likewise.
4734 (Input_arguments::add_file): Likewise.
4735 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4736 * script.cc (Parser_closure::Parser_closure): Add script_info
4737 parameter; adjust all callers.
4738 (Parser_closure::script_info): New function.
4739 (Parser_closure::script_info_): New data member.
4740 (read_input_script): Report scripts earlier to incremental info.
4741 (script_add_file): Set script_info in Input_argument.
4742 (script_add_library): Likewise.
4743 * script.h (Script_options::Script_info): Rewrite class.
4744
4745 2011-03-29 Cary Coutant <ccoutant@google.com>
4746
4747 * archive.cc (Library_base::should_include_member): Move
4748 method here from class Archive.
4749 (Archive::Archive): Initialize base class.
4750 (Archive::should_include_member): Move to base class.
4751 (Archive::do_for_all_unused_symbols): New function.
4752 (Add_archive_symbols::run): Remove redundant access to
4753 incremental_inputs.
4754 (Lib_group::Lib_group): Initialize base class.
4755 (Lib_group::do_filename): New function.
4756 (Lib_group::include_member): Pass pointer to Lib_group to
4757 report_object.
4758 (Lib_group::do_for_all_unused_symbols): New function.
4759 (Add_lib_group_symbols::run): Report archive information for
4760 incremental links.
4761 * archive.h (class Library_base): New base class.
4762 (class Archive): Derive from Library_base.
4763 (Archive::filename): Move to base class.
4764 (Archive::set_incremental_info): Likewise.
4765 (Archive::incremental_info): Likewise.
4766 (Archive::Should_include): Likewise.
4767 (Archive::should_include_member): Likewise.
4768 (Archive::Armap_entry): Remove.
4769 (Archive::Unused_symbol_iterator): Remove.
4770 (Archive::unused_symbols_begin): Remove.
4771 (Archive::unused_symbols_end): Remove.
4772 (Archive::do_filename): New function.
4773 (Archive::do_get_mtime): New function.
4774 (Archive::do_for_all_unused_symbols): New function.
4775 (Archive::task_): Move to base class.
4776 (Archive::incremental_info_): Likewise.
4777 (class Lib_group): Derive from Library_base.
4778 (Lib_group::do_filename): New function.
4779 (Lib_group::do_get_mtime): New function.
4780 (Lib_group::do_for_all_unused_symbols): New function.
4781 (Lib_group::task_): Move to base class.
4782 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4783 function.
4784 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4785 function.
4786 * incremental.cc (Incremental_inputs::report_archive_begin):
4787 Use Library_base; call library's get_mtime; add incremental inputs
4788 entry before members.
4789 (class Unused_symbol_visitor): New class.
4790 (Incremental_inputs::report_archive_end): Use Library_base; use
4791 visitor class to record unused symbols; don't add incremental inputs
4792 entry after members.
4793 (Incremental_inputs::report_object): Use Library_base.
4794 * incremental.h
4795 (Incremental_archive_entry::Incremental_archive_entry): Remove
4796 unused Archive parameter.
4797 (Incremental_inputs::report_archive_begin): Use Library_base.
4798 (Incremental_inputs::report_archive_end): Likewise.
4799 (Incremental_inputs::report_object): Likewise.
4800 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4801 function.
4802 * object.h (Object::for_all_global_symbols): New function.
4803 (Object::do_for_all_global_symbols): New function.
4804 (Sized_relobj::do_for_all_global_symbols): New function.
4805 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4806 function.
4807 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4808 function.
4809
4810 2011-03-27 Ian Lance Taylor <iant@google.com>
4811
4812 * archive.cc (Archive::interpret_header): Return -1 if something
4813 goes wrong. Change callers accordingly.
4814
4815 2011-03-25 Cary Coutant <ccoutant@google.com>
4816
4817 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4818 * testsuite/Makefile.in: Regenerate.
4819
4820 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4821
4822 * plugin.cc (get_view): New.
4823 (Plugin::load): Pass get_view to the plugin.
4824 (Plugin_manager::get_view): New.
4825
4826 2011-03-21 Ian Lance Taylor <iant@google.com>
4827
4828 * testsuite/final_layout.sh: Rewrite to not use dc.
4829 * testsuite/relro_test.sh: Fail if dc is not present.
4830
4831 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4832
4833 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4834 Change == to -eq.
4835 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4836 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4837 Change == to -eq.
4838 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4839 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4840
4841 2011-03-14 Ian Lance Taylor <iant@google.com>
4842
4843 * script-sections.cc (Sort_output_sections::script_compare):
4844 Rename from is_before, change return type.
4845 (Sort_output_sections::operator()): Adjust accordingly.
4846
4847 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4848
4849 PR gold/12572
4850 * testsuite/odr_violation2.cc: Add comment to make all error line
4851 numbers double digits.
4852 * testsuite/debug_msg.sh: Adjust expected errors.
4853
4854 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4855
4856 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4857 but mark earlier ones as non-canonical
4858 (offset_to_iterator): Update search target and example
4859 (do_addr2line): Return extra lines in a vector*
4860 (format_file_lineno): Extract from do_addr2line
4861 (one_addr2line): Add vector* out-param
4862 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4863 when a lineno entry appeared last for its instruction
4864 (Dwarf_line_info): Add vector* out-param
4865 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4866 * symtab.cc (Odr_violation_compare): Include the lineno in the
4867 comparison again.
4868 (linenos_from_loc): New. Combine the canonical line for an
4869 address with its other lines.
4870 (True_if_intersect): New. Helper functor to make
4871 std::set_intersection a query.
4872 (detect_odr_violations): Compare sets of lines instead of just
4873 one line for each function. This became less deterministic, but
4874 has fewer false positives.
4875 * symtab.h: Declarations.
4876 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4877 mix an optimized and non-optimized object in the same binary
4878 (odr_violation2.so): Same.
4879 * testsuite/Makefile.in: Regenerate from Makefile.am.
4880 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4881 * testsuite/debug_msg.sh: Update line numbers and add
4882 assertions.
4883 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4884 non-optimized context.
4885 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4886 isn't inlined, and use OdrDerived in an optimized context.
4887 * testsuite/odr_header1.h: Defines OdrDerived, where
4888 optimization will change the
4889 first-instruction-in-the-destructor's file and line number.
4890 * testsuite/odr_header2.h: Defines OdrBase.
4891
4892 2011-03-09 Ian Lance Taylor <iant@google.com>
4893
4894 * fileread.cc (File_read::clear_views): Don't delete the whole
4895 file view.
4896
4897 2011-03-08 Ian Lance Taylor <iant@google.com>
4898
4899 PR gold/12525
4900 * fileread.cc: #include <climits>.
4901 (GOLD_IOV_MAX): Define.
4902 (File_read::read_multiple): Limit number of entries by iov_max.
4903 * fileread.h (class File_read): Always set max_readv_entries to
4904 128.
4905
4906 2011-03-07 Ian Lance Taylor <iant@google.com>
4907
4908 PR gold/12525
4909 * options.h (class General_options): Add -dy and -dn.
4910
4911 2011-03-02 Cary Coutant <ccoutant@google.com>
4912
4913 * testsuite/script_test_9.t: Add TLS segment.
4914
4915 2011-03-02 Simon Baldwin <simonb@google.com>
4916
4917 * configure.ac: Add check for gnu_indirect_function support in
4918 the toolchain building binutils.
4919 * configure: Rebuild.
4920
4921 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4922
4923 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4924 plugin only symbols.
4925 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4926 in plugin files as not needed in the symbol table.
4927
4928 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4929
4930 * output.cc (Output_section::add_input_section): Delay fill
4931 generation for section ordering.
4932
4933 2011-02-09 Ian Lance Taylor <iant@google.com>
4934
4935 PR gold/12316
4936 * object.h (class Sized_relobj): Remove clear_local_symbols.
4937 * reloc.cc (Sized_relobj::do_relocate): Don't call
4938 clear_local_symbols.
4939
4940 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4941
4942 * plugin.cc (is_visible_from_outside): Return true for symbols
4943 in the -u option.
4944
4945 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4946
4947 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4948 filename.
4949
4950 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4951
4952 * icf.h (is_section_foldable_candidate): Change type of parameter
4953 to std::string.
4954 * icf.cc (Icf::find_identical_sections): Change type of local variable
4955 section_name to be std::string.
4956 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4957
4958 2011-01-25 Ian Lance Taylor <iant@google.com>
4959
4960 * script.cc (script_add_extern): Rewrite to use
4961 add_symbol_reference.
4962
4963 2011-01-25 Doug Kwan <dougkwan@google.com>
4964
4965 * icf.cc (get_section_contents): Always lock section's object.
4966
4967 2011-01-24 Ian Lance Taylor <iant@google.com>
4968
4969 * options.h (class General_options): Accept
4970 --no-detect-odr-violations.
4971
4972 2011-01-24 Ian Lance Taylor <iant@google.com>
4973
4974 * version.cc (version_string): Bump to 1.11.
4975
4976 2011-01-24 Ian Lance Taylor <iant@google.com>
4977
4978 * plugin.cc (class Plugin_rescan): Define new class.
4979 (Plugin_manager::claim_file): Set any_claimed_.
4980 (Plugin_manager::save_archive): New function.
4981 (Plugin_manager::save_input_group): New function.
4982 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4983 necessary.
4984 (Plugin_manager::new_undefined_symbol): New function.
4985 (Plugin_manager::rescan): New function.
4986 (Plugin_manager::rescannable_defines): New function.
4987 (Plugin_manager::add_input_file): Set any_added_.
4988 * plugin.h (class Plugin_manager): define new fields rescannable_,
4989 undefined_symbols_, any_claimed_, and any_added_. Declare
4990 Plugin_rescan as friend. Declare new functions.
4991 (Plugin_manager::Rescannable): Define type.
4992 (Plugin_manager::Rescannable_list): Define type.
4993 (Plugin_manager::Undefined_symbol_list): Define type.
4994 (Plugin_manager::Plugin_manager): Initialize new fields.
4995 * archive.cc (Archive::defines_symbol): New function.
4996 (Add_archive_symbols::run): Pass archive to plugins if any.
4997 * archive.h (class Archive): Declare defines_symbol.
4998 * readsyms.cc (Input_group::~Input_group): New function.
4999 (Finish_group::run): Pass input_group to plugins if any.
5000 * readsyms.h (class Input_group): Declare destructor.
5001 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5002 any.
5003
5004 2011-01-10 Ian Lance Taylor <iant@google.com>
5005
5006 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5007 section as relro.
5008 (Layout::set_segment_offsets): Reset increase_relro before calling
5009 set_section_addresses a second time.
5010
5011 2011-01-04 Cary Coutant <ccoutant@google.com>
5012
5013 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5014 sections before NOBITS sections.
5015
5016 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
5017
5018 * version.cc (print_version): Update copyright to 2011.
5019
5020 2010-12-23 Cary Coutant <ccoutant@google.com>
5021
5022 * output.h (Output_data_reloc::add_output_section): Pass OD instead
5023 of OS to this->add. Add OD parameter to second form of the function.
5024
5025 2010-12-20 Ian Lance Taylor <iant@google.com>
5026
5027 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5028 second of two consecutive entries with same offset.
5029
5030 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5031
5032 * testsuite/Makefile.am (ifuncmain2static_LDADD)
5033 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5034 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5035 to avoid unneeded links against $(LDADD).
5036 * testsuite/Makefile.in: Regenerate.
5037
5038 2010-12-15 Ian Lance Taylor <iant@google.com>
5039
5040 PR gold/12324
5041 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5042 for R_X86_64_32 and R_X86_64_PC32.
5043 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5044 ver_matching_def_pic.o.
5045 (ver_matching_def_pic.o): New target.
5046
5047 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5048
5049 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5050 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5051 Move definition before File_read::View member definitions.
5052 (File_read::View::~View): Initialize and hold lock before
5053 updating current_mapped_bytes.
5054
5055 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5056
5057 * dwarf_reader.cc: Remove outdated comment.
5058 * gold-threads.cc: Fix typo in error message.
5059 * archive.cc: Fix typos in comments.
5060 * archive.h: Likewise.
5061 * arm-reloc-property.cc: Likewise.
5062 * arm-reloc-property.h: Likewise.
5063 * arm-reloc.def: Likewise.
5064 * arm.cc: Likewise.
5065 * attributes.h: Likewise.
5066 * cref.cc: Likewise.
5067 * ehframe.cc: Likewise.
5068 * fileread.h: Likewise.
5069 * gold.h: Likewise.
5070 * i386.cc: Likewise.
5071 * icf.cc: Likewise.
5072 * incremental.h: Likewise.
5073 * int_encoding.cc: Likewise.
5074 * layout.h: Likewise.
5075 * main.cc: Likewise.
5076 * merge.h: Likewise.
5077 * object.cc: Likewise.
5078 * object.h: Likewise.
5079 * options.cc: Likewise.
5080 * readsyms.cc: Likewise.
5081 * reduced_debug_output.cc: Likewise.
5082 * reloc.cc: Likewise.
5083 * script-sections.cc: Likewise.
5084 * sparc.cc: Likewise.
5085 * symtab.h: Likewise.
5086 * target-reloc.h: Likewise.
5087 * target.cc: Likewise.
5088 * target.h: Likewise.
5089 * timer.cc: Likewise.
5090 * timer.h: Likewise.
5091 * x86_64.cc: Likewise.
5092
5093 2010-12-09 Cary Coutant <ccoutant@google.com>
5094
5095 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5096 stack.
5097 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5098 parameter; change all callers.
5099 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5100 * options.h (warn_execstack): New option.
5101
5102 2010-12-07 Doug Kwan <dougkwan@google.com>
5103
5104 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5105 like function call relocations.
5106
5107 2010-12-07 Ian Lance Taylor <iant@google.com>
5108
5109 * archive.cc (Archive::get_elf_object_for_member): Permit
5110 punconfigured to be NULL.
5111 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5112 (Archive::include_member): Pass NULL to get_elf_object_for_member
5113 if we searched for the archive and this is the first included
5114 object.
5115
5116 2010-12-01 Ian Lance Taylor <iant@google.com>
5117
5118 * dwarf_reader.h (class Sized_dwarf_line_info): Add
5119 track_relocs_type_ field.
5120 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5121 Set track_relocs_type_.
5122 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5123 contents when using RELA relocs.
5124 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5125 reloc_map_.
5126 * reloc.cc (Track_relocs::next_addend): New function.
5127 * reloc.h (class Track_relocs): Declare next_addend.
5128
5129 2010-12-01 Ian Lance Taylor <iant@google.com>
5130
5131 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5132 virtual destructor.
5133
5134 2010-12-01 Ian Lance Taylor <iant@google.com>
5135
5136 * README: Update compilers known to work and fail.
5137
5138 2010-11-23 Matthias Klose <doko@ubuntu.com>
5139
5140 * configure.in: For --enable-gold, handle value `default' instead of
5141 `both*'. Always install ld as ld.bfd, install as ld if gold is
5142 not the default.
5143 * configure: Regenerate.
5144
5145 2010-11-18 Doug Kwan <dougkwan@google.com>
5146
5147 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5148 and right_alignment to be zero. Store result alignment only if it is
5149 greater than existing alignment.
5150
5151 2010-11-16 Cary Coutant <ccoutant@google.com>
5152
5153 PR gold/12220
5154 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5155 Check for ".zdebug_line".
5156
5157 2010-11-16 Doug Kwan <dougkwan@google.com>
5158 Cary Coutant <ccoutant@google.com>
5159
5160 * output.h (Output_segment::set_section_addresses): Pass increase_relro
5161 by reference; adjust all callers.
5162 * output.cc (Output_segment::set_section_addresses): Adjust references
5163 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5164 list is empty.
5165 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5166 end at page boundary.
5167
5168 2010-11-16 Cary Coutant <ccoutant@google.com>
5169
5170 PR gold/12220
5171 * layout.cc (Layout::choose_output_section): Transform names of
5172 compressed sections even when using a script with a SECTIONS clause.
5173 (Layout::output_section_name): Remove code to transform
5174 compressed debug section names.
5175 * output.cc (Output_section::add_input_section): Use uncompressed
5176 section size when tracking input sections.
5177
5178 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
5179
5180 * symtab.h (Symbol::NON_PIC_REF): Remove.
5181 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5182 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
5183 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5184 (Symbol::use_plt_offset): Take a flags argument and pass it
5185 directly to needs_dynamic_reloc. Restrict check for undefined
5186 weak symbols to function calls.
5187 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5188 (Target_arm::Scan::global): Use it.
5189 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5190 (Target_arm::Relocate::relocate): Likewise.
5191 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5192 parameter with an r_type parameter. Use get_reference_flags
5193 to get the flags.
5194 (Target_arm::Relocate::relocate): Update accordingly.
5195 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5196 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5197 (Target_i386::Scan::global): Likewise.
5198 (Target_i386::Relocate::relocate): Likewise.
5199 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5200 parameter with an r_type parameter. Use get_reference_flags
5201 to get the flags.
5202 (Target_i386::Relocate::relocate): Update accordingly.
5203 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5204 (Target_powerpc::Scan::global): Use it.
5205 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5206 (Target_powerpc::Relocate::relocate): Likewise.
5207 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5208 (Target_sparc::Scan::global): Use it.
5209 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5210 (Target_sparc::Relocate::relocate): Likewise.
5211 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5212 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5213 (Target_x86_64::Scan::global): Likewise.
5214 (Target_x86_64::Relocate::relocate): Likewise.
5215
5216 2010-11-08 Doug Kwan <dougkwan@google.com>
5217 Cary Coutant <ccoutant@google.com>
5218
5219 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5220 (Arm_exidx_merge_section::section_contents_): New data member.
5221 (Arm_input_section::Arm_input_section): Initialize original_contents_.
5222 (Arm_input_section::~Arm_input_section): De-allocate memory.
5223 (Arm_input_section::original_contents_): New data member.
5224 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5225 in parameters instead of calling Object::section_contents without
5226 locking.
5227 (Arm_output_section::group_section): New parameter TASK. Pass it
5228 to callees that need locking objects.
5229 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
5230 to lock EXIDX input sections. Fix a formatting issue. Call
5231 Arm_exidx_merged_section::build_contents to create merged section
5232 contents.
5233 (Arm_output_section::create_stub_group): New parameter TASK. Use it
5234 to lock object of stub table owner.
5235 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5236 TEXT_SIZE to initialize data member TEXT_SIZE_.
5237 (Arm_exidx_input_section::addralign): Fix typo in comment.
5238 (Arm_exidx_input_section::text_size): New method.
5239 (Target_arm::do_relax): New parameter TASK. Pass it to callees
5240 that require locking objects. Lock objects before scanning for stubs
5241 and updating local symbols.
5242 (Arm_input_section<big_endian>::init): Copy contents of original
5243 input section.
5244 (Arm_input_section<big_endian>::do_write): Use saved contents of
5245 original input section instead of calling Object::section_contents
5246 without locking.
5247 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5248 size without calling Object::section_size().
5249 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5250 for size. Allocate a buffer for merged EXIDX entries.
5251 (Arm_exidx_merged_section::build_contents): New method.
5252 (Arm_exidx_merged_section::do_write): Move merge section contents
5253 building code to Arm_exidx_merged_section::build_contetns. Write
5254 out contetns in buffer instead of building it on the fly.
5255 (Arm_relobj::make_exidx_input_section): Also pass text section size
5256 to Arm_exidx_input_section constructor.
5257 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
5258 (Arm_dynobj::do_read_symbols): Fix memory leak.
5259 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5260 * target.h: (class Task): Add forward declaration.
5261 (Target::relax): Add new parameter TASK and pass it to
5262 Target::do_relax().
5263 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
5264
5265 2010-11-05 Cary Coutant <ccoutant@google.com>
5266
5267 PR gold/10708
5268 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5269 object when reading from the file.
5270 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5271 second layout pass.
5272 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5273 when reading section contents.
5274 (get_section_contents): Likewise.
5275 (icf::find_identical_sections): Likewise.
5276 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5277 object when reading from the file.
5278 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5279 the object when doing deferred section layout.
5280
5281 2010-11-03 Nick Clifton <nickc@redhat.com>
5282
5283 PR gold/12001
5284 * script.h (class Symbol_assignment: name): New member. Returns
5285 the name of the symbol.
5286 * scrfipt.cc (Script_options::is_pending_assignment): New member.
5287 Returns true if the given symbol name is on the list of
5288 assignments wating to be processed.
5289 * archive.cc (should_incldue_member): If the symbol is undefined,
5290 check to see if it is on the list of symbols pending assignment.
5291
5292 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
5293
5294 * script-sections.cc (Script_sections::find_memory_region): Check
5295 for a NULL output section pointer.
5296
5297 2010-10-29 Doug Kwan <dougkwan@google.com>
5298
5299 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5300 Output_section::add_relaxed_input_section.
5301 * output.cc (Output_section::add_relaxed_input_section): Add new
5302 arguments LAYOUT and NAME. Set section order index.
5303 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5304 Copy section order index.
5305 * output.h (Output_section::add_relaxed_input_section): Add new
5306 arguments LAYOUT and NAME.
5307
5308 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5309
5310 * testsuite/Makefile.am: Move gcctestdir/ld rule to
5311 NATIVE_OR_CROSS_LINKER.
5312 * testsuite/Makefile.in: Regenerate.
5313
5314 2010-10-20 Doug Kwan <dougkwan@google.com>
5315
5316 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5317 without SHF_LINK_ORDER flags.
5318 * layout.cc (Layout::choose_output_section): Do not filter
5319 SHF_LINK_ORDER flag in a relocatable link.
5320
5321 2010-10-17 Cary Coutant <ccoutant@google.com>
5322
5323 * output.h (Output_segment::set_section_addresses): Change function
5324 signature. Update all callers.
5325 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5326 sections.
5327 (Output_segment::set_section_addresses): Align after last TLS
5328 section. Add padding before last relro section instead of after.
5329
5330 2010-10-17 Doug Kwan <dougkwan@google.com>
5331
5332 * gold/arm.cc (Target_arm::got_section): Use correct order and set
5333 GOT output section to be writable.
5334
5335 2010-10-14 Cary Coutant <ccoutant@google.com>
5336
5337 * debug.h (DEBUG_INCREMENTAL): New flag.
5338 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5339 * gold.cc (queue_initial_tasks): Check parameters for incremental link
5340 mode.
5341 * incremental.cc (report_command_line): Ignore all forms of
5342 --incremental.
5343 * layout.cc (Layout::Layout): Check parameters for incremental link
5344 mode.
5345 * options.cc (General_options::parse_incremental): New function.
5346 (General_options::parse_no_incremental): New function.
5347 (General_options::parse_incremental_full): New function.
5348 (General_options::parse_incremental_update): New function.
5349 (General_options::incremental_mode_): New data member.
5350 (General_options::finalize): Check incremental_mode_.
5351 * options.h (General_options): Update help text for --incremental.
5352 Add --no-incremental, --incremental-full, --incremental-update.
5353 (General_options::Incremental_mode): New enum type.
5354 (General_options::incremental_mode): New function.
5355 (General_options::incremental_mode_): New data member.
5356 * parameters.cc (Parameters::incremental_mode_): New data member.
5357 (Parameters::set_options): Set incremental_mode_.
5358 (Parameters::set_incremental_full): New function.
5359 (Parameters::incremental): New function.
5360 (Parameters::incremental_update): New function.
5361 (set_parameters_incremental_full): New function.
5362 * parameters.h (Parameters::set_incremental_full): New function.
5363 (Parameters::incremental): New function.
5364 (Parameters::incremental_update): New function.
5365 (Parameters::incremental_mode_): New data member.
5366 (set_parameters_incremental_full): New function.
5367 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5368 incremental link mode.
5369 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5370 (Sized_relobj::do_relocate_sections): Likewise.
5371 * testsuite/Makefile.am (incremental_test): Use --incremental-full
5372 option.
5373 * testsuite/Makefile.in: Regenerate.
5374 * testsuite/incremental_test.sh: Filter all forms of --incremental.
5375
5376 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5377
5378 * script-sections.h (class Script_sections): Make
5379 Sections_elements typedef public.
5380 * script-sections.cc (class Sort_output_sections): Add elements_
5381 field. Add constructor which sets it; change all callers.
5382 (Sort_output_sections::is_before): New function.
5383 (Sort_output_sections::operator()): Call is_before.
5384 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5385 conditional.
5386 * testsuite/script_test_10.sh: New test. Test script section
5387 order.
5388 * testsuite/script_test_10.t: Likewise.
5389 * testsuite/script_test_10.s: Likewise.
5390 * testsuite/Makefile.am: Wrap the cross linker tests and the
5391 common tests into NATIVE_OR_CROSS_LINKER.
5392 (check_SCRIPTS): Add script_test_10.sh.
5393 (check_DATA): Add script_test_10.stdout.
5394 (script_test_10.o, script_test_10): New targets.
5395 (script_test_10.stdout): New target.
5396 * configure, testsuite/Makefile.in: Regenerate.
5397
5398 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5399
5400 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5401 error for the deprecated relocations.
5402 (Target_arm::Scan::global): Likewise.
5403 (Target_arm::Relocate::relocate): Likewise.
5404
5405 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
5406
5407 * fileread.cc (Input_file::find_file): Initialize *found_name
5408 and *namep when using the fallback search for case 4.
5409
5410 2010-10-11 Cary Coutant <ccoutant@google.com>
5411
5412 * options.h (class General_options): Redefine -z lazy as an alias for
5413 the negation of -z now.
5414
5415 2010-10-11 Ian Lance Taylor <iant@google.com>
5416
5417 * resolve.cc (symbol_to_bits): Report the value of the unsupported
5418 binding.
5419
5420 2010-10-06 Nick Clifton <nickc@redhat.com>
5421
5422 * script-sections.cc(class Memory_region): Remove
5423 current_lma_offset_ field. Rename current_vma_offset_ to
5424 current_offset_. Add last_section_ field.
5425 (Memory_region::get_current_vma_address): Rename to
5426 get_current_address.
5427 (Memory_region::get_current_lma_address): Delete.
5428 (Memory_region::increment_vma_offset): Rename to
5429 increment_offset.
5430 (Memory_region::increment_lma_offset): Delete.
5431 (Memory_region::attributes_compatible): New method. Returns
5432 true if the provided section is compatible with the region.
5433 (Memory_region::get_last_section): New method. Returns the last
5434 section to use the region.
5435 (Memory_region::set_last_section): New method. Stores the last
5436 section to use the region.
5437 (Script_sections::block_in_region): New method. Returns true if
5438 a block of memory is contained within a region.
5439 (Script_sections::find_memory_region): New method. Locates a
5440 memory region to be used to set a VMA or LMA address.
5441 (Output_section_definition::set_section_addresses): Add code to
5442 check for addresses set by memory regions.
5443 (Output_segment::set_section_addresses): Remove memory region
5444 walking code.
5445 (Script_sections::create_segment): Add a warning if a header
5446 segment is created outside of any region.
5447 * script-sections.h (class Script_sections): Add prototypes for
5448 find_memory_region and block_in_region methods.
5449 * testsuite/memory_test.s: Use .long instead of .word.
5450 * testsuite/memory_test.t: Add some more output sections.
5451 * testsuite/memory_test.sh: Update expected output.
5452
5453 2010-10-02 Doug Kwan <dougkwan@google.com>
5454
5455 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5456 defintion to symtab.h
5457 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5458 declaration to defintion.
5459
5460 2010-10-01 Nick Clifton <nickc@redhat.com>
5461
5462 * expression.cc (eval): Replace dummy argument with NULL.
5463 (eval_maybe_dot): Check for a NULL result section pointer.
5464 (Symbol_expression::value): Likewise.
5465 (Dot_expression::value): Likewise.
5466 (BINARY_EXPRESSION): Likewise.
5467 (Max_expression::value): Likewise.
5468 (Min_expression::value): Likewise.
5469 (Absolute_expression::value): Likewise.
5470 (Addr_expression::value_from_output_section): Likewise.
5471 (Loaddddr_expression::value_from_output_section): Likewise.
5472 (Segment_start_expression::value): Likewise.
5473 * script-sections.cc
5474 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5475 argument with NULL.
5476 (Sections_elememt_dot_assignment::set_section_addresses):
5477 Likewise.
5478 (Output_data_expression::do_write_to_buffer): Likewise.
5479 (Output_section_definition::finalize_symbols): Likewise.
5480 (Output_section_definition::set_section_addresses): Likewise.
5481
5482 2010-09-30 Doug Kwan <dougkwan@google.com>
5483
5484 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5485
5486 2010-09-28 Sriraman Tallam <tmsriram@google.com>
5487
5488 * target.h (Target::can_icf_inline_merge_sections): New virtual
5489 function.
5490 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5491 virtual function.
5492 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5493 virtual function.
5494 * icf.cc (get_section_contents): Inline merge sections only when
5495 target allows it.
5496
5497 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5498
5499 * configure: Regenerate.
5500
5501 2010-09-17 Ian Lance Taylor <iant@google.com>
5502
5503 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5504 * testsuite/Makefile.am (memory_test.o): New target.
5505 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5506 memory_test.t.
5507 * testsuite/Makefile.in: Rebuild.
5508
5509 2010-09-17 Doug Kwan <dougkwan@google.com>
5510
5511 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5512 defintion if relocation uses GOT entries of the symbol.
5513 * testsuite/icf_safe_test.sh: Fix test.
5514 * testsuite/icf_safe_so_test.sh: Fix test.
5515
5516 2010-09-16 Cary Coutant <ccoutant@google.com>
5517
5518 * script_sections.cc (class Memory_region): Remove "NULL" from
5519 vector initializations.
5520
5521 2010-09-15 Cary Coutant <ccoutant@google.com>
5522
5523 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5524 Resolve forwarding symbols.
5525
5526 2010-09-15 Doug Kwan <dougkwan@google.com>
5527
5528 * gold/testsuite/script_test_3.t: Add ARM special sections.
5529 * gold/testsuite/script_test_4.t: Same.
5530 * gold/testsuite/script_test_5.t: Same.
5531 * gold/testsuite/script_test_6.t: Same.
5532 * gold/testsuite/script_test_7.t: Same.
5533 * gold/testsuite/script_test_7.t: Same.
5534 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5535
5536 2010-09-14 Cary Coutant <ccoutant@google.com>
5537
5538 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5539 (Target_x86_64::Relocate::relocate_tls): Replace check for
5540 saw_tls_block_reloc_ with test for executable section.
5541
5542 2010-09-12 Cary Coutant <ccoutant@google.com>
5543
5544 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5545 position-independent executables to shared libraries need dynamic
5546 relocations.
5547 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5548 position-independent executables.
5549 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5550 * testsuite/Makefile.in: Regenerate.
5551
5552 2010-09-10 Nick Clifton <nickc@redhat.com>
5553
5554 PR gold/11997
5555 * testsuite/memory_test.t: Discard any sections that are not
5556 needed.
5557
5558 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
5559
5560 PR gold/11996
5561 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5562 "This::" to work around a bug in gcc 4.2.
5563
5564 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5565
5566 2010-09-09 Rafael Espindola <espindola@google.com>
5567
5568 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5569 sections with different PF_X flags in the same segment.
5570 (Layout::find_first_load_seg): Search all segments to find the first
5571 one.
5572 * options.h (rosegment): New.
5573
5574 2010-09-08 Rafael Espindola <espindola@google.com>
5575
5576 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5577
5578 2010-09-08 Doug Kwan <dougkwan@google.com>
5579
5580 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5581 (Arm_relobj::do_relocate_sections): Add new parameter for output
5582 file to match the parent.
5583 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5584 of local symbols instead of input values. Update code to track
5585 changes in gold::relocate_section.
5586 * object.cc (Sized_relobj::compute_final_local_value): New methods.
5587 (Sized_relobj::compute_final_local_value_internal): New methods.
5588 (Sized_relobj::do_finalize_local_symbols): Move code from loop
5589 body into private version of Sized_relobj::compute_final_local_value.
5590 Call the inline method.
5591 * object.h (Symbol_value::Symbol_value): Define destructor. Free
5592 merged symbol value if there is one.
5593 (Symbol_value::has_output_value): New method defintiion.
5594 (Sized_relobj::Compute_final_local_value_status): New enum type.
5595 (Sized_relobj::compute_final_local_value): New methods.
5596 (Sized_relobj::compute_final_local_value_internal): New methods.
5597 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5598 and arm_cortex_a8.sh.
5599 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5600 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5601 New tests.
5602 * Makefile.in: Regenerate.
5603 * testsuite/arm_bl_out_of_range.s: Update test.
5604 * testsuite/thumb_bl_out_of_range.s: Ditto.
5605 * testsuite/thumb_blx_out_of_range.s: Ditto.
5606 * testsuite/arm_branch_out_of_range.sh: New file.
5607 * testsuite/arm_cortex_a8.sh: Ditto.
5608 * testsuite/arm_cortex_a8_b.s: Ditto.
5609 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5610 * testsuite/arm_cortex_a8_b_local.s: Ditto.
5611 * testsuite/arm_cortex_a8_bl.s: Ditto.
5612 * testsuite/arm_cortex_a8_blx.s: Ditto.
5613 * testsuite/arm_cortex_a8_local.s: Ditto.
5614 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5615 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5616
5617 2010-09-08 Rafael Espindola <espindola@google.com>
5618
5619 * Makefile.am (memory_test.stdout): Run readelf with -W.
5620 * Makefile.in: Regenerate.
5621 * testsuite/memory_test.sh: Make the regexps accept both 32 and
5622 64 bit output.
5623
5624 2010-09-08 Rafael Espindola <espindola@google.com>
5625
5626 * script-sections.cc (Script_sections::add_memory_region): Convert
5627 field precision to int.
5628 * script.cc (script_set_section_region, script_set_section_region):
5629 Convert field precision to int.
5630
5631 2010-09-08 Rafael Espindola <espindola@google.com>
5632
5633 * arm.cc (do_finalize_sections): Create the __exidx_start and
5634 __exdix_end symbols even when the section is missing.
5635
5636 2010-09-08 Nick Clifton <nickc@redhat.com>
5637
5638 * README: Remove claim that MEMORY is not supported.
5639 * expression.cc (script_exp_function_origin)
5640 (script_exp_function_length): Move from here to ...
5641 * script.cc: ... here.
5642 (script_set_section_region, script_add_memory)
5643 (script_parse_memory_attr, script_include_directive): New
5644 functions.
5645 * script-sections.cc
5646 (class Memory_region): New class.
5647 (class Output_section_definition): Add set_memory_region,
5648 set_section_vma, set_section_lma and get_section_name methods.
5649 (class Script_Sections): Add add_memory_region,
5650 find_memory_region, find_memory_region_origin,
5651 find_memory_region_length and set_memory_region methods.
5652 Have set_section_addresses method walk the list of set memory
5653 regions.
5654 Extend the print methos to display memory regions.
5655 * script-sections.h: Add prototypes for new methods.
5656 Add enum for MEMORY region attributes.
5657 * yyscript.y: Add support for parsing MEMORY regions.
5658 * script-c.h: Add prototypes for new functions.
5659 * testsuite/Makefile.am: Add test of MEMORY region functionality.
5660 * testsuite/Makefile.in: Regenerate.
5661 * testsuite/memory_test.sh: New script.
5662 * testsuite/memory_test.s: New assembler source file.
5663 * testsuite/memory_test.t: New linker script.
5664
5665 2010-08-27 Doug Kwan <dougkwan@google.com>
5666
5667 * gold/resolve.cc (Symbol_table::should_override): Let a weak
5668 reference override an existing dynamic weak reference.
5669 * testsuite/Makefile.am: Add new test dyn_weak_ref.
5670 * testsuite/Makefile.in: Regenerate.
5671 * testsuite/dyn_weak_ref.sh: New file.
5672 * testsuite/dyn_weak_ref_1.c: Ditto.
5673 * testsuite/dyn_weak_ref_2.c: Ditto.
5674
5675 2010-08-27 Ian Lance Taylor <iant@google.com>
5676
5677 * incremental.h (class Incremental_input_entry): Add virtual
5678 destructor.
5679
5680 2010-08-27 Ian Lance Taylor <iant@google.com>
5681
5682 * testsuite/start_lib_test_3.c: Mark t3 as used.
5683
5684 2010-08-27 Nick Clifton <nickc@redhat.com>
5685
5686 * options.cc (version_script): Fix small typo in previous
5687 whitespace tidyup.
5688
5689 2010-08-25 Nick Clifton <nickc@redhat.com>
5690
5691 * archive.cc: Formatting fixes: Remove whitespace between
5692 typename and following asterisk. Remove whitespace between
5693 function name and opening parenthesis.
5694 * archive.h: Likewise.
5695 * arm.cc: Likewise.
5696 * attributes.cc: Likewise.
5697 * attributes.h: Likewise.
5698 * common.cc: Likewise.
5699 * copy-relocs.cc: Likewise.
5700 * dirsearch.h: Likewise.
5701 * dynobj.cc: Likewise.
5702 * ehframe.cc: Likewise.
5703 * ehframe.h: Likewise.
5704 * expression.cc: Likewise.
5705 * fileread.cc: Likewise.
5706 * fileread.h: Likewise.
5707 * gc.h: Likewise.
5708 * gold-threads.cc: Likewise.
5709 * gold.cc: Likewise.
5710 * i386.cc: Likewise.
5711 * icf.h: Likewise.
5712 * incremental-dump.cc: Likewise.
5713 * incremental.cc: Likewise.
5714 * layout.cc: Likewise.
5715 * layout.h: Likewise.
5716 * main.cc: Likewise.
5717 * merge.cc: Likewise.
5718 * merge.h: Likewise.
5719 * object.cc: Likewise.
5720 * object.h: Likewise.
5721 * options.cc: Likewise.
5722 * options.h: Likewise.
5723 * output.cc: Likewise.
5724 * output.h: Likewise.
5725 * plugin.cc: Likewise.
5726 * plugin.h: Likewise.
5727 * powerpc.cc: Likewise.
5728 * reloc.cc: Likewise.
5729 * script-c.h: Likewise.
5730 * script-sections.cc: Likewise.
5731 * script.cc: Likewise.
5732 * stringpool.cc: Likewise.
5733 * symtab.cc: Likewise.
5734 * symtab.h: Likewise.
5735 * target.cc: Likewise.
5736 * timer.cc: Likewise.
5737 * timer.h: Likewise.
5738 * version.cc: Likewise.
5739 * x86_64.cc: Likewise.
5740
5741 2010-08-24 Nick Clifton <nickc@redhat.com>
5742
5743 PR 11899
5744 * layout.cc (segment_precedes): Sort segments by their physical
5745 addresses, if they have been set.
5746
5747 2010-08-23 Cary Coutant <ccoutant@google.com>
5748
5749 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5750 symbols data.
5751 (Lib_group::include_member): Unlock object after deleting its
5752 symbols data.
5753 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5754 the bug fixed here.
5755
5756 2010-08-19 Neil Vachharajani <nvachhar@google.com>
5757 Cary Coutant <ccoutant@google.com>
5758
5759 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5760 constructor, and set_blocker.
5761 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5762 readsyms_blocker_.
5763 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5764 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5765 * testsuite/Makefile.am (start_lib_test): New test case.
5766 * testsuite/Makefile.in: Regenerate.
5767 * testsuite/start_lib_test_main.c: New file.
5768 * testsuite/start_lib_test_1.c: New file.
5769 * testsuite/start_lib_test_2.c: New file.
5770 * testsuite/start_lib_test_3.c: New file.
5771
5772 2010-08-19 Ian Lance Taylor <iant@google.com>
5773
5774 * Makefile.in: Rebuild with automake 1.11.1.
5775 * aclocal.m4: Likewise.
5776 * testsuite/Makefile.in: Likewise.
5777
5778 2010-08-19 Ian Lance Taylor <iant@google.com>
5779
5780 PR 10893
5781 * i386.cc (class Output_data_plt_i386): Update declarations.
5782 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5783 local_ifuncs_ fields.
5784 (Target_i386::do_plt_section_for_global): New function.
5785 (Target_i386::do_plt_section_for_local): New function.
5786 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5787 parameter; change all callers. Initialize global_ifuncs_ and
5788 local_ifuncs_. If doing a static link define __rel_iplt_start and
5789 __rel_iplt_end.
5790 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5791 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5792 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5793 symbols.
5794 (Target_i386::make_plt_section): New function, broken out of
5795 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5796 (Target_i386::make_plt_entry): Call make_plt_section.
5797 (Target_i386::make_local_ifunc_plt_entry): New function.
5798 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5799 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5800 R_386_IRELATIVE to switch.
5801 (Target_i386::Scan::global): Likewise.
5802 (Target_i386::Relocate::relocate): Likewise.
5803 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5804 switch.
5805 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5806 (Target_x86_64::do_plt_section_for_global): New function.
5807 (Target_x86_64::do_plt_section_for_local): New function.
5808 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5809 parameter; change all callers. If doing a static link define
5810 __rela_iplt_start and __rela_iplt_end.
5811 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5812 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5813 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5814 to point to .plt.
5815 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5816 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5817 switch.
5818 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5819 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5820 R_X86_64_IRELATIVE to switch.
5821 (Target_x86_64::Scan::global): Likewise.
5822 (Target_x86_64::Relocate::relocate): Likewise.
5823 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5824 switch.
5825 * target.h (class Target): Add plt_section_for_global and
5826 plt_section_for_local functions. Add do_plt_section_for_global
5827 and do_plt_section_for_local virtual functions.
5828 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5829 clarifying comments.
5830 (Symbol::use_plt_offset): Handle IFUNC symbol.
5831 * object.cc (Sized_relobj::Sized_relobj): Initialize
5832 local_plt_offsets_.
5833 (Sized_relobj::local_has_plt_offset): New function.
5834 (Sized_relobj::local_plt_offset): New function.
5835 (Sized_relobj::set_local_plt_offset): New function.
5836 (Sized_relobj::do_count): Handle IFUNC symbol.
5837 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5838 a bit away from input_shndx_ field. Add set_is_func_symbol and
5839 is_ifunc_symbol functions.
5840 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5841 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5842 local_plt_offsets_ field.
5843 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5844 * output.h (class Output_section_data): Add non-const
5845 output_section function.
5846 (class Output_data_got): Update declarations.
5847 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5848 Add use_plt_offset parameter to global and local constructors.
5849 Change all callers. Change local_sym_index_ field to 31 bits.
5850 Change GSYM_CODE and CONSTANT_CODE accordingly.
5851 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5852 doing a static link don't set sh_link field.
5853 (Output_data_got::Got_entry::write): Use PLT offset if
5854 appropriate.
5855 (Output_data_got::add_global_plt): New function.
5856 (Output_data_got::add_local_plt): New function.
5857 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5858 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5859 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5860 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5861 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5862 IFUNC conditional.
5863 * testsuite/ifunc-sel.h: New file.
5864 * testsuite/ifuncmain1.c: New file.
5865 * testsuite/ifuncmain1vis.c: New file.
5866 * testsuite/ifuncmod1.c: New file.
5867 * testsuite/ifuncdep2.c: New file.
5868 * testsuite/ifuncmain2.c: New file.
5869 * testsuite/ifuncmain3.c: New file.
5870 * testsuite/ifuncmod3.c: New file.
5871 * testsuite/ifuncmain4.c: New file.
5872 * testsuite/ifuncmain5.c: New file.
5873 * testsuite/ifuncmod5.c: New file.
5874 * testsuite/ifuncmain6pie.c: New file.
5875 * testsuite/ifuncmod6.c: New file.
5876 * testsuite/ifuncmain7.c: New file.
5877 * configure, testsuite/Makefile.in: Rebuild.
5878
5879 2010-08-18 Ian Lance Taylor <iant@google.com>
5880
5881 * incremental.cc
5882 (Output_section_incremental_inputs::write_input_files): Add cast
5883 to avoid signed/unsigned comparison warning.
5884 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5885
5886 2010-08-12 Cary Coutant <ccoutant@google.com>
5887
5888 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5889
5890 2010-08-13 Ian Lance Taylor <iant@google.com>
5891
5892 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5893
5894 2010-08-12 Cary Coutant <ccoutant@google.com>
5895 Doug Kwan <dougkwan@google.com>
5896
5897 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5898 defintion overrides non-weak undef, remember that the original undef
5899 is not weak.
5900 * symtab.cc (Symbol_table::sized_write_global): For undef without
5901 an original weak binding, set binding to global in output.
5902 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5903 * testsuite/Makefile.in: Regenerate.
5904 * testsuite/strong_ref_weak_def.sh: New file.
5905 * testsuite/strong_ref_weak_def_1.c: Ditto.
5906 * testsuite/strong_ref_weak_def_2.c: Ditto.
5907
5908 2010-08-12 Cary Coutant <ccoutant@google.com>
5909
5910 * testsuite/incremental_test.sh: Rewrite.
5911 * testsuite/incremental_test_1.c: Rewrite.
5912 * testsuite/incremental_test_2.c: Rewrite.
5913
5914 2010-08-12 Cary Coutant <ccoutant@google.com>
5915
5916 * arm.cc (Target_arm::got_size): Add const.
5917 (Target_arm::got_entry_count): New function.
5918 (Target_arm::plt_entry_count): New function.
5919 (Target_arm::first_plt_entry_offset): New function.
5920 (Target_arm::plt_entry_size): New function.
5921 (Output_data_plt_arm::entry_count): New function.
5922 (Output_data_plt_arm::first_plt_entry_offset): New function.
5923 (Output_data_plt_arm::get_plt_entry_size): New function.
5924 * i386.cc (Target_i386::got_size): Add const.
5925 (Target_i386::got_entry_count): New function.
5926 (Target_i386::plt_entry_count): New function.
5927 (Target_i386::first_plt_entry_offset): New function.
5928 (Target_i386::plt_entry_size): New function.
5929 (Output_data_plt_i386::entry_count): New function.
5930 (Output_data_plt_i386::first_plt_entry_offset): New function.
5931 (Output_data_plt_i386::get_plt_entry_size): New function.
5932 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5933 find_incremental_inputs_sections. Dump incremental_got_plt section.
5934 * incremental.cc: Include target.h.
5935 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5936 parameter. Adjust all callers. Find incremental_got_plt section.
5937 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5938 section.
5939 (Output_section_incremental_inputs::set_final_data_size): Calculate
5940 size of incremental_got_plt section.
5941 (Output_section_incremental_inputs::do_write): Write the
5942 incremental_got_plt section.
5943 (Got_plt_view_info): New struct.
5944 (Local_got_offset_visitor): New class.
5945 (Global_got_offset_visitor): New class.
5946 (Global_symbol_visitor_got_plt): New class.
5947 (Output_section_incremental_inputs::write_got_plt): New function.
5948 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5949 Add parameter. Adjust all callers.
5950 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5951 (Incremental_inputs::got_plt_section): New function.
5952 (Incremental_inputs::got_plt_section_): New data member.
5953 (Incremental_got_plt_reader): New class.
5954 * layout.cc (Layout::create_incremental_info_sections): Add the
5955 incremental_got_plt section.
5956 * object.h (Got_offset_list::get_list): New function.
5957 (Got offset_list::for_all_got_offsets): New function.
5958 (Sized_relobj::local_got_offset_list): New function.
5959 * powerpc.cc (Target_powerpc::got_size): Add const.
5960 (Target_powerpc::got_entry_count): New function.
5961 (Target_powerpc::plt_entry_count): New function.
5962 (Target_powerpc::first_plt_entry_offset): New function.
5963 (Target_powerpc::plt_entry_size): New function.
5964 (Output_data_plt_powerpc::entry_count): New function.
5965 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5966 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5967 * sparc.cc (Target_sparc::got_size): Add const.
5968 (Target_sparc::got_entry_count): New function.
5969 (Target_sparc::plt_entry_count): New function.
5970 (Target_sparc::first_plt_entry_offset): New function.
5971 (Target_sparc::plt_entry_size): New function.
5972 (Output_data_plt_sparc::entry_count): New function.
5973 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5974 (Output_data_plt_sparc::get_plt_entry_size): New function.
5975 * symtab.h (Symbol::got_offset_list): New function.
5976 (Symbol_table::for_all_symbols): New function.
5977 * target.h (Sized_target::got_entry_count): New function.
5978 (Sized_target::plt_entry_count): New function.
5979 (Sized_target::plt_entry_size): New function.
5980 * x86_64.cc (Target_x86_64::got_size): Add const.
5981 (Target_x86_64::got_entry_count): New function.
5982 (Target_x86_64::plt_entry_count): New function.
5983 (Target_x86_64::first_plt_entry_offset): New function.
5984 (Target_x86_64::plt_entry_size): New function.
5985 (Output_data_plt_x86_64::entry_count): New function.
5986 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5987 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5988
5989 2010-08-12 Cary Coutant <ccoutant@google.com>
5990
5991 * archive.cc: Include incremental.h.
5992 (Archive::Archive): Initialize incremental_info_.
5993 (Archive::include_member): Record archive members in incremental info.
5994 (Add_archive_symbols::run): Record begin and end of an archive in
5995 incremental info.
5996 (Lib_group::include_member): Record objects in incremental info.
5997 * archive.h (Incremental_archive_entry): Forward declaration.
5998 (Archive::set_incremental_info): New member function.
5999 (Archive::incremental_info): New member function.
6000 (Archive::Unused_symbol_iterator): New class.
6001 (Archive::unused_symbols_begin): New member function.
6002 (Archive::unused_symbols_end): New member function.
6003 (Archive::incremental_info_): New data member.
6004 * incremental-dump.cc (find_input_containing_global): New function.
6005 (dump_incremental_inputs): Dump new incremental info sections.
6006 * incremental.cc: Include symtab.h.
6007 (Output_section_incremental_inputs): New class.
6008 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6009 new incremental info sections.
6010 (Sized_incremental_binary::do_check_inputs): Likewise.
6011 (Incremental_inputs::report_archive): Remove.
6012 (Incremental_inputs::report_archive_begin): New function.
6013 (Incremental_inputs::report_archive_end): New function.
6014 (Incremental_inputs::report_object): New function.
6015 (Incremental_inputs::finalize_inputs): Remove.
6016 (Incremental_inputs::report_input_section): New function.
6017 (Incremental_inputs::report_script): Rewrite.
6018 (Incremental_inputs::finalize): Do nothing but finalize string table.
6019 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6020 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6021 (Incremental_inputs::create_data_sections): New function.
6022 (Incremental_inputs::relocs_entsize): New function.
6023 (Output_section_incremental_inputs::set_final_data_size): New function.
6024 (Output_section_incremental_inputs::do_write): New function.
6025 (Output_section_incremental_inputs::write_header): New function.
6026 (Output_section_incremental_inputs::write_input_files): New function.
6027 (Output_section_incremental_inputs::write_info_blocks): New function.
6028 (Output_section_incremental_inputs::write_symtab): New function.
6029 * incremental.h (Incremental_script_entry): Forward declaration.
6030 (Incremental_object_entry): Forward declaration.
6031 (Incremental_archive_entry): Forward declaration.
6032 (Incremental_inputs): Forward declaration.
6033 (Incremental_inputs_header_data): Remove.
6034 (Incremental_inputs_header): Remove.
6035 (Incremental_inputs_header_write): Remove.
6036 (Incremental_inputs_entry_data): Remove.
6037 (Incremental_inputs_entry): Remove.
6038 (Incremental_inputs_entry_write): Remove.
6039 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6040 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6041 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6042 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6043 Likewise.
6044 (Incremental_input_entry): New class.
6045 (Incremental_script_entry): New class.
6046 (Incremental_object_entry): New class.
6047 (Incremental_archive_entry): New class.
6048 (Incremental_inputs::Incremental_inputs): Initialize new data members.
6049 (Incremental_inputs::report_inputs): Remove.
6050 (Incremental_inputs::report_archive): Remove.
6051 (Incremental_inputs::report_archive_begin): New function.
6052 (Incremental_inputs::report_archive_end): New function.
6053 (Incremental_inputs::report_object): Change prototype.
6054 (Incremental_inputs::report_input_section): New function.
6055 (Incremental_inputs::report_script): Change prototype.
6056 (Incremental_inputs::get_reloc_count): New function.
6057 (Incremental_inputs::set_reloc_count): New function.
6058 (Incremental_inputs::create_data_sections): New function.
6059 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6060 (Incremental_inputs::inputs_section): New function.
6061 (Incremental_inputs::symtab_section): New function.
6062 (Incremental_inputs::relocs_section): New function.
6063 (Incremental_inputs::get_stringpool): Add const.
6064 (Incremental_inputs::command_line): Add const.
6065 (Incremental_inputs::inputs): Remove.
6066 (Incremental_inputs::command_line_key): New function.
6067 (Incremental_inputs::input_file_count): New function.
6068 (Incremental_inputs::input_files): New function.
6069 (Incremental_inputs::relocs_entsize): New function.
6070 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6071 (Incremental_inputs::finalize_inputs): Remove.
6072 (Incremental_inputs::Input_info): Remove.
6073 (Incremental_inputs::lock_): Remove.
6074 (Incremental_inputs::inputs_): Change type.
6075 (Incremental_inputs::inputs_map_): Remove.
6076 (Incremental_inputs::current_object_entry_): New data member.
6077 (Incremental_inputs::inputs_section_): New data member.
6078 (Incremental_inputs::symtab_section_): New data member.
6079 (Incremental_inputs::relocs_section_): New data member.
6080 (Incremental_inputs::reloc_count_): New data member.
6081 (Incremental_inputs_reader): New class.
6082 (Incremental_symtab_reader): New class.
6083 (Incremental_relocs_reader): New class.
6084 * layout.cc (Layout::finalize): Move finalization of incremental info
6085 and creation of incremental info sections to follow finalization of
6086 symbol table. Set offsets for postprocessing sections.
6087 (Layout::create_incremental_info_sections): Call
6088 Incremental_inputs::create_data_sections. Add incremental symtab
6089 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
6090 sections to layout after input sections.
6091 * layout.h (struct Timespec): Forward declaration.
6092 (Layout::incremental_inputs): Add const.
6093 (Layout::create_incremental_info_sections): Add parameter.
6094 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6095 * object.cc: Include incremental.h.
6096 (Relobj::finalize_incremental_relocs): New function.
6097 (Sized_relobj::do_layout): Record input sections in incremental info.
6098 * object.h (Object::output_section): New function.
6099 (Object::output_section_offset): Moved from Relobj.
6100 (Object::get_incremental_reloc_base): New function.
6101 (Object::get_incremental_reloc_count): New function.
6102 (Object::do_output_section): New function.
6103 (Object::do_output_section_offset): Moved from Relobj.
6104 (Object::do_get_incremental_reloc_base): New function.
6105 (Object::do_get_incremental_reloc_count): New function.
6106 (Object::Object): Initialize new data members.
6107 (Relobj::output_section): Renamed do_output_section and moved to
6108 protected.
6109 (Relobj::output_section_offset): Moved to Object.
6110 (Relobj::do_get_incremental_reloc_base): New function.
6111 (Relobj::do_get_incremental_reloc_count): New function.
6112 (Relobj::allocate_incremental_reloc_counts): New function.
6113 (Relobj::count_incremental_reloc): New function.
6114 (Relobj::finalize_incremental_relocs): New function.
6115 (Relobj::next_incremental_reloc_index): New function.
6116 (Relobj::reloc_counts_): New data member.
6117 (Relobj::reloc_bases_): New data member.
6118 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
6119 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
6120 (Sized_relobj::incremental_relocs_scan): New function.
6121 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6122 (Sized_relobj::incremental_relocs_write): New function.
6123 (Sized_relobj::incremental_relocs_write_reltype): New function.
6124 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6125 incremental link.
6126 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6127 archives and object files elsewhere.
6128 (Add_symbols::run): Report object files here.
6129 (Finish_group::run): Report end of archive at end of group.
6130 * reloc.cc: Include layout.h, incremental.h.
6131 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6132 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6133 (Sized_relobj::incremental_relocs_scan): New function.
6134 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6135 (Sized_relobj::do_relocate_sections): Write incremental relocations.
6136 (Sized_relobj::incremental_relocs_write): New function.
6137 (Sized_relobj::incremental_relocs_write_reltype): New function.
6138 * script.cc (read_input_script): Rewrite test for incremental link.
6139 Change call to Incremental_inputs::report_script.
6140 * symtab.h (Symbol_table::first_global_index): New function.
6141 (Symbol_table::output_count): New function.
6142
6143 2010-08-12 Doug Kwan <dougkwan@google.com>
6144
6145 * arm.cc (Target_arm::merge_object_attributes): Check command line
6146 options --no-wchar-size-warning and --no-enum-size-warning.
6147 * options.h (General_options): Add ld-compatible options
6148 --no-enum-size-warning and --no-wchar-size-warning.
6149
6150 2010-08-04 Ian Lance Taylor <iant@google.com>
6151
6152 * x86_64.cc (Target_x86_64::Scan::local): Use
6153 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6154 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6155 (Target_x86_64::Scan::global): Likewise.
6156 (Target_x86_64::Relocate::relocate): Likewise.
6157 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6158 Likewise.
6159
6160 2010-08-03 Cary Coutant <ccoutant@google.com>
6161
6162 * merge.cc (Output_merge_string::do_add_input_section): Count strings
6163 to reserve space in merged_strings vector. Keep total input size
6164 for stats.
6165 (Output_merge_string::do_print_merge_stats): Print total input size.
6166 * merge.h (Output_merge_string): Add input_size_ field.
6167 * stringpool.cc (Stringpool_template::string_length): Move
6168 implementations out of Stringpool_template class and place in
6169 stringpool.h.
6170 * stringpool.h (string_length): Move out of Stringpool_template.
6171
6172 2010-08-03 Ian Lance Taylor <iant@google.com>
6173
6174 PR 11712
6175 * layout.cc (relaxation_loop_body): If address of load segment is
6176 set, adjust address to include headers if possible.
6177
6178 2010-08-03 Ian Lance Taylor <iant@google.com>
6179
6180 * version.cc (version_string): Bump to 1.10.
6181
6182 2010-08-03 Ian Lance Taylor <iant@google.com>
6183
6184 PR 11805
6185 * layout.h (enum Output_section_order): Define.
6186 (class Layout): Update declarations.
6187 * layout.cc (Layout::get_output_section): Add order parameter.
6188 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6189 is_first_non_relro parameters. Change all callers.
6190 (Layout::choose_output_section): Likewise.
6191 (Layout::add_output_section_data): Likewise.
6192 (Layout::make_output_section): Likewise. Set order.
6193 (Layout::default_section_order): New function.
6194 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6195 * output.cc (Output_section::Output_section): Initialize order_.
6196 Don't initialize deleted fields.
6197 (Output_segment::Output_segment): Don't initialize deleted
6198 fields.
6199 (Output_segment::add_output_section_to_load): New function
6200 replacing add_output_section. Change all callers to call this or
6201 add_output_section_to_nonload.
6202 (Output_segment::add_output_section_to_nonload): New function.
6203 (Output_segment::remove_output_section): Rewrite.
6204 (Output_segment::add_initial_output_data): Likewise.
6205 (Output_segment::has_any_data_sections): Likewise.
6206 (Output_segment::is_first_section_relro): Likewise.
6207 (Output_segment::maximum_alignment): Likewise.
6208 (Output_segment::has_dynamic_reloc): New function replacing
6209 dynamic_reloc_count. Change all callers.
6210 (Output_segment::has_dynamic_reloc_list): New function replacing
6211 dynamic_reloc_count_list. Change all callers.
6212 (Output_segment::set_section_addresses): Rewrite.
6213 (Output_segment::set_offset): Rewrite.
6214 (Output_segment::find_first_and_last_list): Remove.
6215 (Output_segment::set_tls_offsets): Rewrite.
6216 (Output_segment::first_section_load_address): Likewise.
6217 (Output_segment::output_section_count): Likewise.
6218 (Output_segment::section_with_lowest_load_address): Likewise.
6219 (Output_segment::write_section_headers): Likewise.
6220 (Output_segment::print_sections_to_map): Likewise.
6221 * output.h (class Output_data): Remove dynamic_reloc_count_
6222 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
6223 (Output_data::add_dynamic_reloc): Rewrite.
6224 (Output_data::has_dynamic_reloc): New function.
6225 (Output_data::dynamic_reloc_count): Remove.
6226 (class Output_section): Add order_ field. Remvoe is_relro_local_,
6227 is_last_relro_, is_first_non_relro_, is_interp_,
6228 is_dynamic_linker_section_ fields. Add order and set_order
6229 functions. Remove is_relro_local, set_is_relro_local,
6230 is_last_relro, set_is_last_relro, is_first_non_relro,
6231 set_is_first_non_relro functions, is_interp, set_is_interp,
6232 is_dynamic_linker_section, and set_is_dynamic_linker_section
6233 functions.
6234 (class Output_segment): Change Output_data_list from std::list to
6235 std:;vector. Add output_lists_ field. Remove output_data_ and
6236 output_bss_ fields. Update declarations.
6237
6238 2010-08-02 Ian Lance Taylor <iant@google.com>
6239
6240 * arm.cc (Target_arm::gc_process_relocs): Use typename.
6241 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6242 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6243
6244 2010-08-02 Ian Lance Taylor <iant@google.com>
6245
6246 PR 11855
6247 * script.cc (Script_options::Script_options): Initialize
6248 symbol_definitions_ and symbol_references_.
6249 (Script_options::add_symbol_assignment): Update
6250 symbol_definitions_ and symbol_references_.
6251 (Script_options::add_symbol_reference): New function.
6252 (script_symbol): New function.
6253 * script.h (class Script_options): Add symbol_definitions_ and
6254 symbol_references_ fields.
6255 (Script_options::referenced_const_iterator): New type.
6256 (Script_options::referenced_begin): New function.
6257 (Script_options::referenced_end): New function.
6258 (Script_options::is_referenced): New function.
6259 (Script_options::any_unreferenced): New function.
6260 * script-c.h (script_symbol): Declare.
6261 * yyscript.y (exp): Call script_symbol.
6262 * symtab.cc: Include "script.h".
6263 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6264 Change all callers. Check symbols referenced by scripts.
6265 (Symbol_table::add_undefined_symbols_from_command_line): Add
6266 layout parameter. Change all callers.
6267 (Symbol_table::do_add_undefined_symbols_from_command_line):
6268 Likewise. Break out loop body. Check symbols referenced by
6269 scripts.
6270 (Symbol_table::add_undefined_symbol_from_command_line): New
6271 function broken out of
6272 do_add_undefined_symbols_from_command_line.
6273 * symtab.h (class Symbol_table): Update declarations.
6274 * archive.cc: Include "layout.h".
6275 (Archive::should_include_member): Add layout parameter. Change
6276 all callers. Check for symbol mentioned in expression.
6277 * archive.h (class Archive): Update declaration.
6278 * object.cc (Sized_relobj::do_should_include_member): Add layout
6279 parameter.
6280 * object.h (Object::should_include_member): Add layout parameter.
6281 Change all callers.
6282 (Object::do_should_include_member): Add layout parameter.
6283 (class Sized_relobj): Update declaration.
6284 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6285 parameter.
6286 * dynobj.h (class Sized_dynobj): Update declaration.
6287 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6288 layout parameter.
6289 * plugin.h (class Sized_pluginobj): Update declaration.
6290
6291 2010-08-02 Ian Lance Taylor <iant@google.com>
6292
6293 PR 11866
6294 * output.cc (Output_segment::set_offset): Search for the first and
6295 last sections rather than assuming that the list is in order.
6296 (Output_segment::find_first_and_last_list): New function.
6297 * output.h (class Output_segment): Update declarations.
6298 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6299 (relro_strip_test_SOURCES): New variable.
6300 (relro_strip_test_DEPENDENCIES): New variable.
6301 (relro_strip_test_LDFLAGS): New variable.
6302 (relro_strip_test_LDADD): New variable.
6303 (relro_strip_test.so): New target.
6304
6305 2010-08-02 Ian Lance Taylor <iant@google.com>
6306
6307 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6308 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6309 (Target_i386::got_tlsdesc_section): New function.
6310 (Target_i386::got_section): Create space for GOT entries for
6311 TLSDESC relocations.
6312 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6313 R_386_TLS_GOTDESC.
6314 (Target_i386::Scan::global): Likewise.
6315 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6316 using TLSDESC GOT.
6317 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6318 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6319 (Target_x86_64::got_tlsdesc_section): New function.
6320 (Target_x86_64::got_section): Create space for GOT entries for
6321 TLSDESC relocations.
6322 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6323 R_386_TLS_GOTDESC.
6324 (Target_x86_64::Scan::global): Likewise.
6325 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6326 using TLSDESC GOT.
6327
6328 2010-08-02 Ian Lance Taylor <iant@google.com>
6329
6330 * testsuite/final_layout.sh: Use dc to convert from hex to
6331 decimal.
6332
6333 2010-07-29 Sriraman Tallam <tmsriram@google.com>
6334
6335 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6336 paramter to the call to gold::gc_process_relocs.
6337 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6338 paramter to the call to gold::gc_process_relocs.
6339 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6340 parameter to the call to gold::gc_process_relocs.
6341 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6342 template parameter to the call to gold::gc_process_relocs.
6343 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6344 paramter to the call to gold::gc_process_relocs.
6345 * gc.h (get_embedded_addend_size): New function.
6346 (gc_process_relocs): Save the size of the reloc for use by ICF.
6347 * icf.cc (get_section_contents): Get the addend from the text section
6348 for SHT_REL relocation sections.
6349 * icf.h (Icf::Reloc_addend_size_info): New typedef.
6350 (Icf::Reloc_info): Add new member reloc_addend_size_info.
6351 * int_encoding.h (read_from_pointer): New overloaded function.
6352 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6353 * testsuite/icf_sht_rel_addend_test.sh: New file.
6354 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6355 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6356
6357 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6358
6359 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6360 * Makefile.in: Regenerate.
6361 * testsuite/Makefile.in: Regenerate.
6362
6363 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
6364
6365 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6366 * gold/testsuite/debug_msg.cc: Likewise.
6367 * gold/testsuite/odr_violation1.cc
6368 * gold/testsuite/odr_violation2.cc
6369
6370 2010-07-21 Cary Coutant <ccoutant@google.com>
6371
6372 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6373 string, and length fields.
6374 (Output_merge_string::Merged_strings_list): New type.
6375 (Output_merge_string::Merged_strings_lists): New typedef.
6376 (Output_merge_string): Replace merged_strings_ with
6377 merged_strings_lists_.
6378 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6379 Merged_strings_list per input object and section. Don't store pointer
6380 to the string. Don't store length with each merged string entry.
6381 (Output_merge_string::finalize_merged_data): Loop over list of merged
6382 strings lists. Recompute length of each merged string.
6383
6384 2010-07-15 Cary Coutant <ccoutant@google.com>
6385
6386 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6387 here.
6388
6389 2010-07-14 Ian Lance Taylor <iant@google.com>
6390
6391 * descriptors.cc (Descriptors::open): Report correct name in error
6392 message.
6393
6394 2010-07-13 Doug Kwan <dougkwan@google.com>
6395
6396 * arm.cc (Arm_input_section::Arm_input_section): For a
6397 SHT_ARM_EXIDX section, always keeps the input sections.
6398 (Arm_input_section::set_exidx_section_link): New method.
6399 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6400 has_errors_ to false.
6401 (Arm_exidx_input_section::has_errors,
6402 Arm_exidx_input_section::set_has_errors): New methods.
6403 (Arm_exidx_input_section::has_errors_): New data member.
6404 (Arm_relobj::get_exidx_shndx_list): New method.
6405 (Arm_output_section::append_text_sections_to_list): Do not skip
6406 section without SHF_EXECINSTR.
6407 (Arm_output_section::fix_exidx_coverage): Skip input sections with
6408 errors.
6409 (Arm_relobj::make_exidx_input_section): Add new parameter for text
6410 section header. Make error messages more verbose. Check for
6411 a non-executable section linked to an EXIDX section.
6412 (Arm_relobj::do_read_symbols): Remove error checking, which has been
6413 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
6414 check that there is no deferred EXIDX section if we exit early.
6415 Instead of not making an EXIDX section in case of an error, make one
6416 and set the has_errors flag of it.
6417 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6418 in a relocatable link.
6419 (Target_arm::do_relax): Look for the EXIDX output section instead of
6420 assuming that it is called .ARM.exidx.
6421 (Target_arm::fix_exidx_coverage): Add a new parameter for input
6422 section list. Do not check for SHF_EXECINSTR section flags but
6423 skip any input section with errors.
6424 * output.cc (Output_section::Output_section): Initialize
6425 always_keeps_input_sections_ to false.
6426 (Output_section::add_input_section): Check for
6427 always_keeps_input_sections_.
6428 * output.h (Output_section::always_keeps_input_sections,
6429 Output_section::set_always_keeps_input_sections): New methods.
6430 (Output_section::always_keeps_input_sections): New data member.
6431
6432 2010-07-13 Rafael Espindola <espindola@google.com>
6433
6434 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6435 * fileread.h (Input_file): Add try_extra_search_path and find_file.
6436
6437 2010-07-13 Philip Herron <herron.philip@googlemail.com>
6438 Ian Lance Taylor <iant@google.com>
6439
6440 * output.h (Output_section_lookup_maps::add_merge_section):
6441 Correct check of whether value was inserted.
6442 (Output_section_lookup_maps::add_merge_input_section): Likewise.
6443 (Output_section_lookup_maps::add_relaxed_input_section):
6444 Likewise.
6445 * arm.cc (Target_arm::got_section): Remove used local os.
6446 * i386.cc (Target_i386::got_section): Likewise.
6447 * x86_64.cc (Target_x86_64::got_section): Likewise.
6448 * sparc.cc (Target_sparc::got_section): Likewise.
6449 (Target_sparc::relocate): Remove unused local have_got_offset.
6450 * powerpc.cc (Target_powerpc::relocate): Likewise.
6451
6452 2010-07-13 Ian Lance Taylor <iant@google.com>
6453
6454 * compressed_output.cc (zlib_decompress): Fix signature in
6455 !HAVE_ZLIB_H case.
6456
6457 * archive.cc (Archive::include_member): Unlock an external member
6458 of a thin archive. Don't bother to delete an object we know is
6459 NULL.
6460
6461 2010-07-12 Cary Coutant <ccoutant@google.com>
6462
6463 * compressed_output.cc (zlib_decompress): New function.
6464 (get_uncompressed_size): New function.
6465 (decompress_input_section): New function.
6466 * compressed_output.h (get_uncompressed_size): New function.
6467 (decompress_input_section): New function.
6468 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6469 Handle compressed debug sections.
6470 * layout.cc (is_compressed_debug_section): New function.
6471 (Layout::output_section_name): Map compressed section names to
6472 canonical names.
6473 * layout.h (is_compressed_debug_section): New function.
6474 (is_debug_info_section): Recognize compressed debug sections.
6475 * merge.cc: Include compressed_output.h.
6476 (Output_merge_data::do_add_input_section): Handle compressed
6477 debug sections.
6478 (Output_merge_string::do_add_input_section): Handle compressed
6479 debug sections.
6480 * object.cc: Include compressed_output.h.
6481 (Sized_relobj::Sized_relobj): Initialize new data members.
6482 (build_compressed_section_map): New function.
6483 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6484 * object.h (Object::section_is_compressed): New method.
6485 (Object::do_section_is_compressed): New method.
6486 (Sized_relobj::Compressed_section_map): New type.
6487 (Sized_relobj::do_section_is_compressed): New method.
6488 (Sized_relobj::compressed_sections_): New data member.
6489 * output.cc (Output_section::add_input_section): Handle compressed
6490 debug sections.
6491 * reloc.cc: Include compressed_output.h.
6492 (Sized_relobj::write_sections): Handle compressed debug sections.
6493
6494 2010-07-08 Cary Coutant <ccoutant@google.com>
6495
6496 * resolve.cc (Symbol_table::resolve): Remember whether undef was
6497 weak when resolving to a dynamic def.
6498 (Symbol_table::should_override): Add adjust_dyndef flag; set it
6499 for weak undef/dynamic def cases. Adjust callers.
6500 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6501 undef_binding_weak_.
6502 (Symbol_table::sized_write_globals): Adjust symbol binding.
6503 (Symbol_table::sized_write_symbol): Add binding parameter.
6504 * symtab.h (Symbol::set_undef_binding): New method.
6505 (Symbol::is_undef_binding_weak): New method.
6506 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6507 (Symbol_table::should_override): Add new parameter.
6508 (Symbol_table::sized_write_symbol): Add new parameter.
6509
6510 * testsuite/weak_undef_file1.cc: Add new test case.
6511 * testsuite/weak_undef_file2.cc: Fix header comment.
6512 * testsuite/weak_undef_test.cc: Add new test case.
6513
6514 2010-06-29 Doug Kwan <dougkwan@google.com>
6515
6516 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6517 Initialize USE_SYMBOL_.
6518 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6519 definition.
6520 (Arm_reloc_property::uses_symbol_): New data member declaration.
6521 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6522 uses symbol value and symbol is undefined but not weakly undefined.
6523
6524 2010-06-28 Rafael Espindola <espindola@google.com>
6525
6526 * plugin.cc (Plugin::load): Use dlerror.
6527
6528 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
6529
6530 * symtab.cc (detect_odr_violations): When reporting an ODR
6531 violation, report an object where the symbol is defined.
6532
6533 2010-06-25 Doug Kwan <dougkwan@google.com>
6534
6535 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6536 (Target_arm::section_may_have_icf_unsafe_pointers): New method
6537 definition.
6538 (Target_arm::Scan::local_reloc_may_be_function_pointer,
6539 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6540 target hook to detect function points.
6541 (Target_arm::Scan::possible_function_pointer_reloc): New method.
6542 * icf.h (Icf::check_section_for_function_pointers): Change type of
6543 parameter SECTION_NAME to const reference to std::string. Use
6544 target hook to determine if section may have unsafe pointers.
6545 * target.h (Target::section_may_have_icf_unsafe_pointers): New
6546 method definition.
6547
6548 2010-06-21 Rafael Espindola <espindola@google.com>
6549
6550 * fileread.cc (Input_file::find_fie): New
6551 (Input_file::open): Use Input_file::find_fie.
6552 * fileread.h (Input_file::find_fie): New
6553 * plugin.cc (set_extra_library_path): New.
6554 (Plugin::load): Add set_extra_library_path to the transfer vector.
6555 (Plugin_manager::set_extra_library_path): New.
6556 (Plugin_manager::add_input_file): Use the extra search path if set.
6557 (set_extra_library_path(): New.
6558 * plugin.h (Plugin_manager): Add set_extra_library_path and
6559 extra_search_path_.
6560
6561 2010-06-19 Cary Coutant <ccoutant@google.com>
6562
6563 * layout.cc (gdb_sections): Add .debug_types.
6564 (lines_only_debug_sections): Likewise.
6565
6566 2010-06-18 Rafael Espindola <espindola@google.com>
6567
6568 * plugin.cc (add_input_file,add_input_library)
6569 (Plugin_manager::add_input_file): Make filename arguments const.
6570 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6571 const.
6572
6573 2010-06-16 Doug Kwan <dougkwan@google.com>
6574
6575 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6576 .ARM.attributes section if we have not merged any input
6577 attributes sections.
6578
6579 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6580
6581 * arm.cc: Allow combining objects with no EABI version
6582 information.
6583
6584 2010-06-15 Rafael Espindola <espindola@google.com>
6585
6586 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6587
6588 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6589
6590 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6591 (struct iovec): Correct !HAVE_READV definition.
6592
6593 2010-06-10 Cary Coutant <ccoutant@google.com>
6594
6595 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6596 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6597 reloc sections.
6598 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6599
6600 PR 11683
6601 * symtab.h (Symbol::is_placeholder): New member function.
6602 * target-reloc.h (relocate_section): Check for placeholder symbols.
6603
6604 * testsuite/Makefile.am (plugin_test_8): New test.
6605 (plugin_test_9): New test.
6606 * testsuite/Makefile.in: Regenerate.
6607
6608 2010-06-09 Nick Clifton <nickc@redhat.com>
6609
6610 * yyscript.y (input_list_element): Allow strings prefixed with
6611 the '-' character. Treat these as libraries.
6612 * script.cc (script_add_library): New function. Adds a library
6613 specified by "-l<name>" found in an input script.
6614 * script-c.h: Add prototype for script_add_library.
6615
6616 2010-06-07 Doug Kwan <dougkwan@google.com>
6617
6618 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6619 Restrict stub-group size to be within long conditional branch
6620 range when working around cortex-A8 erratum.
6621
6622 2010-06-07 Damien Diederen <dd@crosstwine.com>
6623
6624 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6625 #ifdef typo.
6626
6627 2010-06-03 Sriraman Tallam <tmsriram@google.com>
6628
6629 PR gold/11658
6630 * output.cc
6631 (Output_section::Input_section_sort_entry::compare_section_ordering):
6632 Change to return non-zero correctly.
6633 (Output_section::Input_section_sort_section_order_index_compare
6634 ::operator()): Change to fix ambiguity in comparisons.
6635
6636 2010-06-01 Sriraman Tallam <tmsriram@google.com>
6637
6638 * gold.h (is_wildcard_string): New function.
6639 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6640 (Layout::layout_eh_frame): Ditto.
6641 (Layout::find_section_order_index): New method.
6642 (Layout::read_layout_from_file): New method.
6643 * layout.h (Layout::find_section_order_index): New method.
6644 (Layout::read_layout_from_file): New method.
6645 (Layout::input_section_position_): New private member.
6646 (Layout::input_section_glob_): New private member.
6647 * main.cc (main): Call read_layout_from_file here.
6648 * options.h (--section-ordering-file): New option.
6649 * output.cc (Output_section::input_section_order_specified_): New
6650 member.
6651 (Output_section::Output_section): Initialize new member.
6652 (Output_section::add_input_section): Add new parameter.
6653 Keep input sections when --section-ordering-file is used.
6654 (Output_section::set_final_data_size): Sort input sections when
6655 section ordering file is specified.
6656 (Output_section::Input_section_sort_entry): Add new parameter.
6657 Check sorting type.
6658 (Output_section::Input_section_sort_entry::compare_section_ordering):
6659 New method.
6660 (Output_section::Input_section_sort_compare::operator()): Change to
6661 consider section_order_index.
6662 (Output_section::Input_section_sort_init_fini_compare::operator()):
6663 Change to consider section_order_index.
6664 (Output_section::Input_section_sort_section_order_index_compare
6665 ::operator()): New method.
6666 (Output_section::sort_attached_input_sections): Change to sort
6667 according to section order when specified.
6668 (Output_section::add_input_section<32, true>): Add new parameter.
6669 (Output_section::add_input_section<64, true>): Add new parameter.
6670 (Output_section::add_input_section<32, false>): Add new parameter.
6671 (Output_section::add_input_section<64, false>): Add new parameter.
6672 * output.h (Output_section::add_input_section): Add new parameter.
6673 (Output_section::input_section_order_specified): New
6674 method.
6675 (Output_section::set_input_section_order_specified): New method.
6676 (Input_section::Input_section): Initialize section_order_index_.
6677 (Input_section::section_order_index): New method.
6678 (Input_section::set_section_order_index): New method.
6679 (Input_section::section_order_index_): New member.
6680 (Input_section::Input_section_sort_section_order_index_compare): New
6681 struct.
6682 (Output_section::input_section_order_specified_): New member.
6683 * script-sections.cc (is_wildcard_string): Delete and move modified
6684 method to gold.h.
6685 (Output_section_element_input::Output_section_element_input): Modify
6686 call to is_wildcard_string.
6687 (Output_section_element_input::Input_section_pattern
6688 ::Input_section_pattern): Ditto.
6689 (Output_section_element_input::Output_section_element_input): Ditto.
6690 * testsuite/Makefile.am (final_layout): New test case.
6691 * testsuite/Makefile.in: Regenerate.
6692 * testsuite/final_layout.cc: New file.
6693 * testsuite/final_layout.sh: New file.
6694
6695 2010-06-01 Rafael Espindola <espindola@google.com>
6696
6697 * plugin.cc (Plugin::load): Pass the output name to the plugin.
6698
6699 2010-06-01 Rafael Espindola <espindola@google.com>
6700
6701 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6702 visibility of symbols.
6703
6704 2010-05-27 Doug Kwan <dougkwan@google.com>
6705
6706 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6707 from start of output section instead of address for a local symbol
6708 in a merged or relaxed section when doing a relocatable link.
6709
6710 2010-05-26 Rafael Espindola <espindola@google.com>
6711
6712 PR 11604
6713 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6714 adding sections the garbage collector removed.
6715 * gold/testsuite/Makefile.am: Add test.
6716 * gold/testsuite/Makefile.in: Regenerate.
6717 * gold/testsuite/plugin_test_7.sh: New.
6718 * gold/testsuite/plugin_test_7_1.c: New.
6719 * gold/testsuite/plugin_test_7_2.c: New.
6720
6721 2010-05-26 Rafael Espindola <espindola@google.com>
6722
6723 * script-sections.cc (Output_section_definition::set_section_addresses):
6724 Check for --section-start.
6725
6726 2010-05-26 Doug Kwan <dougkwan@google.com>
6727
6728 * arm.cc (Arm_scan_relocatable_relocs): New class.
6729 (Target_arm::relocate_special_relocatable): New method.
6730 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6731 (Arm_relocate_functions::thumb_branch_common): Same.
6732 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6733 instead of Default_scan_relocatable_relocs.
6734 * target-reloc.h (relocate_for_relocatable): Let target handle
6735 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6736 * target.h (Sized_target::relocate_special_relocatable): New method.
6737
6738 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6739
6740 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6741
6742 2010-05-23 Doug Kwan <dougkwan@google.com>
6743
6744 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6745 instead of a cast.
6746 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6747 with a direct branch, not a conditional branch, to a stub.
6748 * merge.cc (Output_merge_base::record_input_section): New method
6749 defintion.
6750 (Output_merge_data::do_add_input_section): Record input section if
6751 keeps-input-sections flag is set.
6752 (Output_merge_string::do_add_input_section): Ditto.
6753 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6754 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6755 INPUT_SECTIONS_.
6756 (Output_merge_base::keeps_input_sections,
6757 Output_merge_base::set_keeps_input_sections,
6758 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6759 method definitions.
6760 (Output_merge_base::Input_sections): New type declaration.
6761 (Output_merge_base::input_sections_begin,
6762 Output_merge_base::input_sections_end,
6763 Output_merge_base::do_set_keeps_input_sections): New method definitions.
6764 (Output_merge_base::bool keeps_input_sections_,
6765 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6766 Output_merge_base::input_sections_): New data members.
6767 (Output_merge_data::do_set_keeps_input_sections): New method
6768 defintion.
6769 (Output_merge_string::do_set_keeps_input_sections): Ditto.
6770 * output.cc (Output_section::Input_section::relobj): Move method
6771 defintion from class declaration to here and handle merge sections.
6772 (Output_section::Input_section::shndx): Ditto.
6773 (Output_section::Output_section): Remove initializations of removed
6774 data members and initialize new data member LOOKUP_MAPS_.
6775 (Output_section::add_input_section): Set keeps-input-sections flag
6776 for a newly created merge output section as appropriate. Adjust code
6777 to use Output_section_lookup_maps class.
6778 (Output_section::add_relaxed_input_section): Adjst code for lookup
6779 maps code refactoring.
6780 (Output_section::add_merge_input_section): Add a new parameter
6781 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6782 class. If adding input section to a newly created merge output
6783 section fails, remove the new merge section.
6784 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6785 Adjust code for use of the Output_section_lookup_maps class.
6786 (Output_section::find_merge_section): Ditto.
6787 (Output_section::build_lookup_maps): New method defintion.
6788 (Output_section::find_relaxed_input_section): Adjust code to use
6789 Output_section_lookup_maps class.
6790 (Output_section::get_input_sections): Export merge sections. Adjust
6791 code to use Output_section_lookup_maps class.
6792 (Output_section:::add_script_input_section): Adjust code to use
6793 Output_section_lookup_maps class. Update lookup maps for merge
6794 sections also.
6795 (Output_section::discard_states): Use Output_section_lookup_maps.
6796 (Output_section::restore_states): Same.
6797 * output.h (Merge_section_properties): Move class defintion out of
6798 Output_section.
6799 (Output_section_lookup_maps): New class.
6800 (Output_section::Input_section::is_merge_section): New method
6801 defintion.
6802 (Output_section::Input_section::relobj): Move defintion out of class
6803 defintion. Declare method only.
6804 (Output_section::Input_section::shndx): Ditto.
6805 (Output_section::Input_section::output_merge_base): New method defintion.
6806 (Output_section::Input_section::u2_.pomb): New union field.
6807 (Output_section::Merge_section_by_properties_map,
6808 Output_section::Output_section_data_by_input_section_map,
6809 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6810 Remove types.
6811 (Output_section::add_merge_input_section): Add new parameter
6812 KEEPS_INPUT_SECTIONS.
6813 (Output_section::build_lookup_maps): New method declaration.
6814 (Output_section::merge_section_map_,
6815 Output_section::merge_section_by_properties_map_,
6816 Output_section::relaxed_input_section_map_,
6817 Output_section::is_relaxed_input_section_map_valid_): Remove data
6818 members.
6819 (Output_section::lookup_maps_): New data member.
6820
6821 2010-05-21 Doug Kwan <dougkwan@google.com>
6822
6823 PR gold/11619
6824 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6825 avoid a compilation error.
6826
6827 2010-05-19 Rafael Espindola <espindola@google.com>
6828
6829 * script-sections.cc (Output_section_definition::allocate_to_segment):
6830 Update the phdrs_list even when the output section is NULL.
6831 * testsuite/Makefile.am: Add test.
6832 * testsuite/Makefile.in: Regenerate.
6833 * testsuite/script_test_9.cc: New.
6834 * testsuite/script_test_9.sh: New.
6835 * testsuite/script_test_9.t: New.
6836
6837 2010-05-19 Doug Kwan <dougkwan@google.com>
6838
6839 * arm.cc (Arm_input_section::original_size): New method.
6840 (Arm_input_section::do_addralign): Add a cast.
6841 (Arm_input_section::do_output_offset): Remove static cast.
6842 (Arm_input_section::original_addralign,
6843 Arm_input_section::original_size_): Change type to uint32_t.
6844 (Arm_input_section::init): Add safe casts for section alignment
6845 and size.
6846 (Arm_input_section::set_final_data_size): Do not set address and
6847 offset of stub table.
6848 (Arm_output_section::fix_exidx_coverage): Change use of of
6849 Output_section::Simple_input_section to that of
6850 Output_section::Input_section.
6851 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6852 except for the first pass.
6853 * output.cc (Output_section::get_input_sections): Change type of
6854 input_sections to std::list<Input_section>.
6855 (Output_section::add_script_input_section): Rename from
6856 Output_section::add_simple_input_section. Change type of SIS
6857 parameter from Simple_input_section to Input_section.
6858 * output.h (Output_section::Simple_input_section): Remove class.
6859 (Output_section::Input_section): Change class visibility to public.
6860 (Output_section::Input_section::addralign): Use stored alignments
6861 for special input sections if set.
6862 (Output_section::Input_section::set_addralign): New method.
6863 (Output_section::get_input_sections): Change parameter type from
6864 list of Simple_input_section to list of Input_section.
6865 (Output_section::add_script_input_section): Rename from
6866 Output_section::add_simple_input_section. Change first parameter's
6867 type from Simple_input_section to Input_section and remove the
6868 second and third parameters.
6869 * script-sections.cc (Input_section::Input_section_list): Change
6870 type to list of Output_section::Input_section/
6871 (Input_section_info::Input_section_info): Change parameter type of
6872 INPUT_SECTION to Output_section::Input_section.
6873 (Input_section_info::input_section): Change return type.
6874 (Input_section_info::input_section_): Change type to
6875 Output_section::Input_section.
6876 (Output_section_element_input::set_section_addresses): Adjust code
6877 to use Output_section::Input_section instead of
6878 Output_section::Simple_input_section. Adjust code for renaming
6879 of Output_section::add_simple_input_section.
6880 (Orphan_output_section::set_section_addresses): Ditto.
6881
6882 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6883
6884 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6885 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6886
6887 2010-05-18 Rafael Espindola <espindola@google.com>
6888
6889 * options.cc (General_options::finalize): Handle -nostdlib.
6890 * options.h (nostdlib): New option.
6891 * script.cc (script_add_search_dir): Handle -nostdlib.
6892
6893 2010-05-12 Doug Kwan <dougkwan@google.com>
6894
6895 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6896 attributes section only if there no attributes section after merging.
6897 (Target_arm::merge_object_attributes): Move value of
6898 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6899 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6900 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6901 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6902 and arm_attr_merge_7.stdout.
6903 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6904 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6905 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6906 arm_attr_merge_7b.o): New rules.
6907 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6908 arm_attr_merge_7
6909 * testsuite/Makefile.in: Regenerate.
6910 * testsuite/arm_attr_merge.sh: New file.
6911 * testsuite/arm_attr_merge_[67][ab].s: Same.
6912
6913 2010-05-05 Nick Clifton <nickc@redhat.com>
6914
6915 * po/es.po: Updated Spanish translation.
6916
6917 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6918
6919 * Makefile.am (install-exec-local): Properly install gold as
6920 default cross linker.
6921 * Makefile.in: Regenerated.
6922
6923 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6924 Nick Clifton <nickc@redhat.com>
6925
6926 * configure.ac (install_as_default): Define and set to false
6927 unless --enable-gold or --enable-gold=both/gold has been
6928 specified.
6929 * configure: Regenerate.
6930
6931 * Makefile.am (install-exec-local): Install the executable as
6932 'ld.gold'. If install_as_default is true then also install it as
6933 'ld'.
6934 * Makefile.in: Regenerated.
6935
6936 2010-04-24 Ian Lance Taylor <iant@google.com>
6937
6938 * layout.cc (Layout::layout_reloc): In relocatable link don't
6939 combine reloc sections for grouped sections.
6940
6941 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6942
6943 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6944 sections that are not ordinary to icf.
6945 * icf.cc (get_section_contents): Handle relocation pointing to section
6946 with no object or shndx information.
6947 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6948 * testsuite/Makefile.in: Regenerate.
6949 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6950 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6951
6952 2010-04-22 Ian Lance Taylor <iant@google.com>
6953
6954 * expression.cc (Expression::Expression_eval_info): Add
6955 result_alignment_pointer field.
6956 (Expression::eval_with_dot): Add result_alignment_pointer
6957 parameter. Change all callers.
6958 (Expression::eval_maybe_dot): Likewise.
6959 (class Binary_expression): Add alignment_pointer parameter to
6960 left_value and right_value. Change all callers.
6961 (BINARY_EXPRESSION): Set result alignment.
6962 (class Trinary_expression): Add alignment_pointer parameter to
6963 arg2_value and arg3_value. Change all callers.
6964 (Trinary_cond::value): Set result alignment.
6965 (Max_expression::value, Min_expression::value): Likewise.
6966 (Align_expression::value): Likewise.
6967 * script-sections.cc (class Sections_element): Add dot_alignment
6968 parameter to set_section_addresses virtual function. Update
6969 instantiations.
6970 (class Output_section_element): Likewise.
6971 (Script_sections::create_segments): Add dot_alignment parameter.
6972 Change all callers.
6973 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6974 (Script_sections::set_phdrs_clause_addresses): Likewise.
6975 * script-sections.h: Update declarations.
6976 * script.h: Update declarations.
6977 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6978 min_p_align.
6979 * testsuite/script_test_3.t: Set large alignment.
6980 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6981 segment has expected alignment.
6982
6983 2010-04-22 Nick Clifton <nickc@redhat.com>
6984
6985 * po/gold.pot: Updated by the Translation project.
6986 * po/vi.po: Updated Vietnamese translation.
6987
6988 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6989
6990 * testsuite/Makefile.am (check_PROGRAMS): Add
6991 icf_virtual_function_folding_test.
6992 * testsuite/Makefile.in: Regenerated.
6993
6994 2010-04-15 Andrew Haley <aph@redhat.com>
6995
6996 * options.h (merge_exidx_entries): New option.
6997 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6998 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6999 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7000 (Target_arm::merge_exidx_entries): New function.
7001 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7002 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7003 to Arm_exidx_fixup constructor.
7004 Add new arg, merge_exidx_entries.
7005 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7006 Arm_output_section::fix_exidx_coverage.
7007
7008 2010-04-18 Sriraman Tallam <tmsriram@google.com>
7009
7010 * icf.cc (get_section_contents): Check for preemptible functions.
7011 Ignore addend when appropriate.
7012 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
7013 section folded.
7014 (add_from_relobj): Check for section folded.
7015 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7016 * symtab.h (should_add_dynsym_entry): Add new parameter.
7017 * target-reloc.h (scan_relocs): Check for section folded.
7018 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7019 Check reloc types for function pointers in shared objects.
7020 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7021 case.
7022 (icf_preemptible_functions_test): New test case.
7023 (icf_string_merge_test): New test case.
7024 * testsuite.Makefile.in: Regenerate.
7025 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7026 bar_glob. Refactor code.
7027 * testsuite/icf_preemptible_functions_test.cc: New file.
7028 * testsuite/icf_preemptible_functions_test.sh: New file.
7029 * testsuite/icf_string_merge_test.cc: New file.
7030 * testsuite/icf_string_merge_test.sh: New file.
7031 * testsuite/icf_virtual_function_folding_test.cc: New file.
7032 * testsuite/icf_virtual_function_folding_test.sh: New file.
7033
7034 2010-04-14 Doug Kwan <dougkwan@google.com>
7035
7036 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7037 for local symbol recounting if we remove a section due to ICF.
7038 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7039 there are no regular objects in input.
7040
7041 2010-04-13 Doug Kwan <dougkwan@google.com>
7042
7043 * arm.cc (Arm_input_section::set_final_data_size): Compute
7044 accurate final data size instead of using current data size.
7045
7046 2010-04-09 Doug Kwan <dougkwan@google.com>
7047
7048 * layout.cc (Layout::choose_output_section): Handle script section
7049 types.
7050 (Layout::make_output_section_for_script): Add section type parameter.
7051 Handle script section types.
7052 * layout.h (Layout::make_output_section_for_script): Add section
7053 type parameter.
7054 * output.cc (Output_section::Output_section): Initialize data member
7055 is_noload_.
7056 (Output_section::do_reset_address_and_file_offset): Do not set address
7057 to 0 if section is a NOLOAD section.
7058 * output.h (Output_section::is_noload): New method.
7059 (Output_section::set_is_noload): Ditto.
7060 (Output_section::is_noload_): New data member.
7061 * script-c.h (Script_section_type): New enum type.
7062 (struct Parser_output_section_header): Add new file section_type.
7063 * script-sections.cc (Sections_element::output_section_name): Add
7064 parameter for returning script section type.
7065 (Output_section_definition::output_section_name): Ditto.
7066 (Output_section_definition::section_type)P; New method.
7067 (Output_section_definiton::script_section_type_name): Ditto.
7068 (Output_section_definition::script_section_type_): New data member.
7069 (Output_section_definition::Output_section_definition): Initialize
7070 data member Output_section_definition::script_section_type_.
7071 (Output_section_definition::create_sections): Pass script section type
7072 to Layout::make_output_section_for_script.
7073 (Output_section_definition::output_section_name): Return script
7074 section type to caller.
7075 (Output_section_definition::set_section_address): Do not advance
7076 dot value and load address if section type is NOLOAD. Set address
7077 of NOLOAD sections regardless of section flags.
7078 (Output_section_definition::print): Print section type if it is
7079 not SCRIPT_SECTION_TYPE_NONE.
7080 (Output_section_definition::section_type): New method.
7081 (Output_section_definition::script_section_type_name): Ditto.
7082 (Script_sections::output_section_name): Add new parameter
7083 PSECTION_TYPE for returning script section type. Pass it to
7084 section elements. Handle discard sections.
7085 (Sort_output_sections::operator()): Handle NOLOAD sections.
7086 * script-sections.h (Script_sections::Section_type): New enum type.
7087 (Script_sections::output_section_name): Add a new parameter for
7088 returning script section type.
7089 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7090 INFO and NOLOAD.
7091 * yyscript.y (union): Add new field SECTION_TYPE.
7092 (COPY, DSECT, INFO, NOLOAD): New tokens.
7093 (opt_address_and_section_type): Change type to output_section_header.
7094 (section_type): New non-terminal
7095 (section_header): Handle section type.
7096 (opt_address_and_section_type): Return section type value.
7097
7098 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
7099
7100 * testsuite/plugin_common_test_1.c (foo): Add prototype.
7101 * testsuite/plugin_common_test_2.c (foo): Likewise.
7102
7103 2010-04-08 Doug Kwan <dougkwan@google.com>
7104
7105 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7106 Output_merge_data.
7107 * output.cc (Output_section::add_merge_input_section): Simplify
7108 code and return status of Output_merge_base::add_input_section.
7109 Update merge section map only if Output_merge_base::add_input_section
7110 returns true.
7111
7112 2010-04-07 Doug Kwan <dougkwan@google.com>
7113
7114 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7115 if section is marked as containing instructions but has no mapping
7116 symbols.
7117 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7118 correct section index.
7119 (Arm_relobj::find_linked_text_section): Ditto.
7120
7121 2010-04-07 Cary Coutant <ccoutant@google.com>
7122
7123 * archive.cc (include_member): Destroy Read_symbols_data object before
7124 releasing file.
7125 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7126 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7127 (Read_symbols_data::~Read_symbols_data) New destructor.
7128 (Section_relocs::Section_relocs) New constructor.
7129 (Section_relocs::~Section_relocs) New destructor.
7130 (Read_relocs_data::Read_relocs_data) New constructor.
7131 (Read_relocs_data::~Read_relocs_data) New destructor.
7132 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7133 pointers to NULL after deleting.
7134
7135 2010-04-07 Doug Kwan <dougkwan@google.com>
7136
7137 * arm.cc: Replace "endianity" with "endianness" in comments.
7138 (Arm_exidx_cantunwind): Ditto.
7139 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7140 (Arm_relobj::merge_flags_and_attributes): New method.
7141 (Arm_relobj::merge_flags_and_attributes_): New data member.
7142 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7143 (Arm_relobj::scan_sections_for_stubs): Ditto.
7144 (Arm_relobj::do_read_symbols): Check to see if we really want to
7145 merge processor-specific flags and attributes. Exit early if
7146 an object is empty except for section names and the undefined symbol.
7147 (Target_arm::do_finalize_sections): Move check for ELF format to
7148 Arm_relobj::do_read_symbols. Merge processor specific flags and
7149 attributes from a regular object only when we have determined that
7150 it is aapropriate. Do not create an .ARM.attributes section in
7151 output if there is no regular input object.
7152 (Target_arm::merge_processor_specific_flags): Check
7153 --warn-mismatch before printing any error.
7154 (Target_arm::merge_object_attributes): Ditto.
7155 * gold.cc (queue_middle_tasks): Handle the case in which there is
7156 no regular object in input.
7157 * options.cc (General_options::parse_EB): New method.
7158 (General_options::parse_EL): Same.
7159 (General_options::General_options): Initialize endianness_.
7160 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7161 New options.
7162 (General_options::Endianness): New enum.
7163 (General_options::endianness): New method.
7164 (General_options::endianness_): New data member.
7165 * parameters.cc (Parameters::set_options): Check target endianness.
7166 (Parameters::set_target_once): Ditto.
7167 (Parameters::check_target_endianness): New method.
7168 (parameters_force_valid_target): If either -EL or -EB is specified,
7169 use it to define endianness of default target.
7170 * parameters.h (Parameters::check_target_endianness): New method
7171 declaration.
7172 * target.h (class Target): Change "endianity" to "endianness"
7173 in comments.
7174
7175 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7176
7177 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7178 * configure: Regenerate.
7179 * Makefile.in: Regenerate.
7180 * testsuite/Makefile.in: Regenerate.
7181
7182 2010-04-06 Cary Coutant <ccoutant@google.com>
7183
7184 gcc PR lto/42757
7185 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7186 prevailing definitions of common symbols.
7187 * testsuite/plugin_test_6.sh: New test case.
7188 * testsuite/plugin_common_test_1.c: New test case.
7189 * testsuite/plugin_common_test_2.c: New test case.
7190 * testsuite/Makefile.am (plugin_test_6): New test case.
7191 * testsuite/Makefile.in: Regenerate.
7192
7193 2010-04-06 Nick Clifton <nickc@redhat.com>
7194
7195 * po/vi.po: New Vietnamese translation.
7196
7197 2010-03-30 Doug Kwan <dougkwan@google.com>
7198
7199 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7200
7201 2010-03-25 Doug Kwan <dougkwan@google.com>
7202
7203 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7204 to avoid a conversion warning on a 32-bit host.
7205
7206 2010-03-24 Ian Lance Taylor <iant@google.com>
7207
7208 * testsuite/script_test_3.t: Add a TLS segment.
7209 * testsuite/Makefile.am (check_PROGRAMS): Add
7210 tls_phdrs_script_test.
7211 (tls_phdrs_script_test_SOURCES): Define.
7212 (tls_phdrs_script_test_DEPENDENCIES): Define.
7213 (tls_phdrs_script_test_LDFLAGS): Define.
7214 (tls_phdrs_script_test_LDADD): Define.
7215 * testsuite/Makefile.in: Rebuild.
7216
7217 2010-03-23 Cary Coutant <ccoutant@google.com>
7218
7219 * fileread.cc (find_or_make_view): Fix comment.
7220
7221 2010-03-23 Ian Lance Taylor <iant@google.com>
7222
7223 * script-sections.cc (class Orphan_section_placement): Define
7224 PLACE_TLS and PLACE_TLS_BSS.
7225 (Orphan_section_placement::Orphan_section_placement): Initialize
7226 new places.
7227 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7228 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7229 (tls_script_test_SOURCES): Define.
7230 (tls_script_test_DEPENDENCIES): Define.
7231 (tls_script_test_LDFLAGS): Define.
7232 (tls_script_test_LDADD): Define.
7233 * testsuite/Makefile.in: Rebuild.
7234
7235 2010-03-22 Doug Kwan <dougkwan@google.com>
7236
7237 * arm.cc (Arm_relocate_functions::abs8,
7238 Arm_relocate_functions::abs16): Use correct check for overflow
7239 specified in the ARM ELF specs.
7240 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
7241 target of a BLX instruction specially.
7242 (Reloc_stub::stub_type_for_reloc): Ditto.
7243 (Relocate::relocate): Use symbolic names instead of numeric relocation
7244 codes to report error.
7245 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7246 workaround.
7247 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7248 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7249 thumb2_blx_out_of_range.stdout
7250 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7251 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7252 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7253 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7254 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7255 thumb2_blx_in_range, thumb2_blx_in_range.o,
7256 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7257 thumb2_blx_out_of_range.o): New rules.
7258 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7259 thumb2_blx_in_range and thumb2_blx_out_of_range.
7260 * testsuite/Makefile.in: Regenerate.
7261 * arm_branch_in_range.sh: Add tests for THUMB BLX.
7262 * testsuite/thumb_blx_in_range.s: New file.
7263 * testsuite/thumb_blx_out_of_range.s: New file.
7264
7265 2010-03-22 Rafael Espindola <espindola@google.com>
7266
7267 * archive.cc (Should_include): Move to archive.h.
7268 (should_include_member): Make it a member of Archive.
7269 (Lib_group): New.
7270 (Add_lib_group_symbols): New.
7271 * archive.h: Include options.h.
7272 (Archive_member): Moved from Archive.
7273 (Should_include): Moved from archive.cc.
7274 (Lib_group): New.
7275 (Add_lib_group_symbols): New.
7276 * dynobj.cc (do_should_include_member): New.
7277 * dynobj.h (do_should_include_member): New.
7278 * gold.cc (queue_initial_tasks): Update call to queue.
7279 * main.cc (main): Print lib group stats.
7280 * object.cc (do_should_include_member): New.
7281 * object.h: Include archive.h.
7282 (Object::should_include_member): New.
7283 (Object::do_should_include_member): New.
7284 (Sized_relobj::do_should_include_member): New.
7285 * options.cc (General_options::parse_start_lib): New.
7286 (General_options::parse_end_lib): New.
7287 (Input_arguments::add_file): Handle lib groups.
7288 (Input_arguments::start_group): Check we are not in a lib.
7289 (Input_arguments::start_lib): New.
7290 (Input_arguments::end_lib): New.
7291 * options.h (General_options): Add start_lib and end_lib.
7292 (Input_argument::lib_): New.
7293 (Input_argument::lib): New.
7294 (Input_argument::is_lib): New.
7295 (Input_file_lib): New.
7296 (Input_arguments::in_lib_): New.
7297 (Input_arguments::in_lib): New.
7298 (Input_arguments::start_lib): New.
7299 (Input_arguments::end_lib_): New.
7300 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7301 in unused members as preempted.
7302 (Sized_pluginobj::do_should_include_member): New.
7303 * plugin.h (Sized_pluginobj::do_should_include_member): New.
7304 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7305 return the blocker.
7306 (Read_symbols::do_whole_lib_group): New.
7307 (Read_symbols::do_lib_group): New.
7308 (Read_symbols::do_read_symbols): Handle lib groups.
7309 (Read_symbols::get_name): Handle lib groups.
7310 * readsyms.h (Read_symbols): Add an archive member pointer.
7311 (Read_symbols::do_whole_lib_group): New.
7312 (Read_symbols::do_lib_group): New.
7313 (Read_symbols::member_): New.
7314 * script.cc (read_input_script): Update call to queue_soon.
7315
7316 2010-03-19 Doug Kwan <dougkwan@google.com>
7317
7318 * arm.cc (Stub_table::Stub_table): Initialize new data members
7319 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7320 (Stub_table::add_reloc_stub): Assign stub offset and update
7321 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7322 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7323 New data members.
7324 (Stub_table::update_data_size_and_addralign): Use
7325 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7326 instead of going over all reloc stubs.
7327 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7328 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7329 Stringpool_template::offset_ to size of Stringpool_char.
7330 (Stringpool_template::new_key_offset): Remove code to initialize
7331 Stringpool_template::offset_.
7332 * stringpool.h (Stringpool_template::set_no_zero_null): Set
7333 Stringpool_template::offset_ to zero.
7334
7335 2010-03-15 Doug Kwan <dougkwan@google.com>
7336
7337 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7338 offset_.
7339 (Stringpool_template::new_key_offset): New method.
7340 (Stringpool_template::add_string): Assign offsets when adding new
7341 strings.
7342 (Stringpool_template::set_string_offsets): Do not set string offsets
7343 when not optimizing.
7344 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7345 member size_.
7346 (Chunked_vector::clear): Clear size_.
7347 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7348 (Chunked_vector::size): Return size_.
7349 (Chunked_vector::push_back): Use size_ to find insert position.
7350 (Chunked_vector::size_): New data member.
7351 (Stringpool_template::set_no_zero_null): Assert string set is empty.
7352 (Stringpool_template::new_key_offset): New method declaration.
7353 (Stringpool_template::offset_): New data member.
7354
7355 2010-03-15 Rafael Espindola <espindola@google.com>
7356
7357 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7358 Add_symbols' constructor.
7359 * readsyms.h (Add_symbols): Remove the input_group member.
7360
7361 2010-03-10 Ian Lance Taylor <iant@google.com>
7362
7363 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7364 target to ask whether a reference to a symbol requires a stack
7365 split.
7366 * target.h (Target::is_call_to_non_split): New function.
7367 (Target::do_is_call_to_non_split): Declare virtual function.
7368 * target.cc: Include "symtab.h".
7369 (Target::do_is_call_to_non_split): New function.
7370 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7371
7372 2010-03-10 Cary Coutant <ccoutant@google.com>
7373
7374 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7375 (File_read::open[1]): Remove initial mapping of whole_file_view_.
7376 (File_read::open[2]): Add whole_file_view_ to list of views.
7377 (File_read::make_view): Remove test of whole_file_view_.
7378 (File_read::find_or_make_view): Create whole_file_view_ if
7379 necessary.
7380 (File_read::clear_views): Replace bool parameter with enum;
7381 adjust all callers. Don't delete views with permanent data;
7382 do delete cached views and views from archives if
7383 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
7384 if clearing the corresponding view.
7385 * fileread.h (File_read::Clear_views_mode): New enum.
7386 (File_read::View::is_permanent_view): New method.
7387 (File_read::clear_views): Replace bool parameter
7388 with enum; adjust all callers.
7389 * options.h (General_options): Change keep_files_mapped option;
7390 add map_whole_files.
7391 * readsyms.cc (Add_symbols::run): Delete sd_ object before
7392 releasing the file.
7393 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7394 the file.
7395
7396 2010-03-10 David S. Miller <davem@davemloft.net>
7397
7398 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7399
7400 2010-03-09 Sriraman Tallam <tmsriram@google.com>
7401
7402 * icf.cc (get_section_contents): Add '@' marker after processing the
7403 merge reloc.
7404
7405 2010-03-08 Doug Kwan <dougkwan@google.com>
7406
7407 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7408 due to a conversion warning.
7409 (Arm_relobj::update_output_local_symbol_count): Check for local
7410 symbol with unset output index.
7411
7412 2010-03-05 Ian Lance Taylor <iant@google.com>
7413
7414 * options.h (class General_options): Add --spare-dynamic-tags.
7415 * output.cc (Output_data_dynamic::set_final_data_size): Implement
7416 --spare-dynamic-tags.
7417
7418 2010-03-05 Ian Lance Taylor <iant@google.com>
7419
7420 * incremental.cc: Include "libiberty.h".
7421
7422 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
7423
7424 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7425 function, is_info_ member.
7426 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7427 (Versions::Versions): Update caller.
7428 (Versions::define_base_version): Likewise.
7429 (Versions::add_def): Likewise.
7430
7431 2010-03-03 Sriraman Tallam <tmsriram@google.com>
7432
7433 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7434 (Scan::possible_function_pointer_reloc): New function.
7435 (Scan::local_reloc_may_be_function_pointer): Change to call
7436 possible_function_pointer_reloc.
7437 (Scan::global_reloc_may_be_function_pointer): Ditto.
7438 * icf.h (Icf::check_section_for_function_pointers): Change to reject
7439 relocations in ".data.rel.ro._ZTV" section.
7440 * testsuite/icf_safe_so_test.sh: Change to pass i386.
7441 * testsuite/icf_safe_so_test.cc: Ditto.
7442 * testsuite/icf_safe_test.cc: Ditto.
7443 * testsuite/icf_safe_test.sh: Ditto.
7444
7445 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7446 Ian Lance Taylor <iant@google.com>
7447
7448 * target-reloc.h (relocate_section): Check the symbol table index
7449 for -1U before setting the local symbol index.
7450 (scan_relocatable_relocs): If copying the relocation, record that
7451 the local symbol is required.
7452 * object.h (Symbol_value::is_output_symtab_index_set): New
7453 function.
7454 (Symbol_value::may_be_discarded_from_output_symtab): New
7455 function.
7456 (Symbol_value::has_output_symtab_entry): New function.
7457 (Symbol_value::needs_output_symtab_entry): Remove.
7458 (Symbol_value::output_symtab_index): Make sure the symbol index is
7459 set.
7460 (Symbol_value::set_output_symtab_index): Make sure the symbol
7461 index is not set. Make sure the new index is valid.
7462 (Symbol_value::set_must_have_output_symtab_entry): New function.
7463 (Symbol_value::has_output_dynsym_entry): New function.
7464 (Symbol_value::set_output_dynsym_index): Make sure the new index
7465 is valid.
7466 (Sized_relobj::set_must_have_output_symtab_entry): New function.
7467 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7468 local symbol if permitted.
7469 (Sized_relobj::do_finalize_local_symbols): Call
7470 is_output_symtab_index_set rather than needs_output_symtab_entry.
7471 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7472 rather than needs_output_symtab_entry. Call
7473 has_output_dynsym_entry rather than needs_output_dynsym_entry.
7474 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7475 is_output_symtab_index_set rather than needs_output_symtab_entry.
7476 * testsuite/discard_locals_relocatable_test.c: New file.
7477 * testsuite/discard_locals_test.sh: Test -r.
7478 * testsuite/Makefile.am (check_DATA): Add
7479 discard_locals_relocatable_test1.syms,
7480 discard_local_relocatable_test2.syms.
7481 (MOSTLYCLEANFILES): Likewise. Also add
7482 discard_locals_relocatable_test1.lout and
7483 discard_locals_relocatable_test2.out.
7484 (discard_locals_relocatable_test1.syms): New target.
7485 (discard_locals_relocatable_test.o): New target.
7486 (discard_locals_relocatable_test1.out): New target.
7487 (discard_locals_relocatable_test2.syms): New target.
7488 (discard_locals_relocatable_test2.out): New target.
7489 (various): Add missing ../ld-new dependencies.
7490 * testsuite/Makefile.in: Rebuild.
7491
7492 2010-03-03 Nick Clifton <nickc@redhat.com>
7493
7494 * po/fi.po: New Finnish translation.
7495
7496 2010-03-01 Doug Kwan <dougkwan@google.com>
7497
7498 * layout.cc (Layout::Layout): Force section types of .init_array*,
7499 .preinit_array* and .fini_array* sections.
7500 * output.cc (Output_section::Input_section_sort_entry::has_priority):
7501 Fix check of return value of std::string::find.().
7502 (Output_section::Input_section_sort_compare::operator()): Remove
7503 comment about .init_array.
7504 (Output_section::Input_section_sort_init_fini_compare::operator()):
7505 New method.
7506 (Output_section::sort_attached_input_sections): Handle .init_array
7507 and .fini_array specially.
7508 * output.h (Output_section::Inut_section_sort_compare): Update
7509 comment.
7510 (Output_section::Input_section_sort_init_fini_compare): New struct.
7511
7512 2010-02-26 Doug Kwan <dougkwan@google.com>
7513
7514 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7515 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7516 * testsuite/debug_msg.sh: Avoid matching source line number for
7517 use of global variable undef_int.
7518
7519 2010-02-26 Doug Kwan <dougkwan@google.com>
7520
7521 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7522 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7523 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7524 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7525 * options.cc (General_options::General_options): Initialize member
7526 fix_v4bx_.
7527 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7528 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7529 and rm_no_fix_v4bx.stdout
7530 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7531 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7532 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7533 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7534 and arm_no_fix_v4bx.
7535 * Makefile.in: Regenerate.
7536 * testsuite/arm_fix_v4bx.s: New file.
7537 * testsuite/arm_fix_v4bx.sh: Ditto.
7538
7539 2010-02-24 Doug Kwan <dougkwan@google.com>
7540
7541 * arm.cc (Target_arm::got_section): Make the .got section the first
7542 non RELRO section in the data segment.
7543 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7544 suffixes of section names.
7545
7546 2010-02-24 Doug Kwan <dougkwan@google.com>
7547
7548 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7549 flags and attributes merging if an input file is a binary file.
7550 * fileread.cc (Input_file::open): Record format of original file.
7551 * fileread.h (Input_file::Format): New enum type.
7552 (Input_file::Input_file): Initialize data member format_.
7553 (Input_file::format): New method definition.
7554 (Input_file::format_):: New data member.
7555
7556 2010-02-24 Doug Kwan <dougkwan@google.com>
7557
7558 * arm.cc (Arm_output_data_got): New class.
7559 (ARM_TCB_SIZE): New constant
7560 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7561 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7562 If user uses a script with a SECTIONS clause, issue only a warning
7563 for a misplaced EXIDX input section. Otherwise, issue an error.
7564 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7565 garbage collection.
7566 (Target_arm::got_mode_index_entry): Handle static linking.
7567 (Target_arm::Scan::local): Ditto.
7568 (Target_arm::Scan::global): Ditto.
7569 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
7570 all incorrectly implemented relocations.
7571 (Target_arm::fix_exidx_coverage): Pass layout to
7572 Arm_output_section::fix_exidx_coverage.
7573 * layout.cc (Layout::section_name_mapping): Remove trailing dots
7574 from ".ARM.exidx." and ".ARM.extab.".
7575
7576 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7577
7578 * arm.cc (Target_arm::do_finalize_sections): Create attribute
7579 section if it does not already exist.
7580 * attributes.cc (Attributes_section_data::Attributes_section_data):
7581 Don't crash if size is zero.
7582
7583 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7584 Ian Lance Taylor <iant@google.com>
7585
7586 * gold.cc (queue_middle_tasks): If no input files were opened,
7587 exit.
7588 * workqueue.h (Task_function::Task_function): Assert that there is
7589 a blocker.
7590
7591 2010-02-22 Doug Kwan <dougkwan@google.com>
7592
7593 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7594 * icf.cc (get_section_contents): Cast snprintf arguments to long long
7595 types to avoid warnings due to different uint64_t implementations
7596 on different hosts.
7597
7598 2010-02-21 Doug Kwan <dougkwan@google.com>
7599
7600 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7601 handling of the maximum backward branch offset.
7602 (Arm_relocate_functions::thumb_branch_common): Ditto.
7603 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7604 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7605 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7606 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7607 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7608 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7609 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7610 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7611 thumb_bl_out_of_range thumb_bl_out_of_range.o,
7612 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7613 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7614 thumb2_bl_out_of_range.o): New rules.
7615 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7616 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7617 thumb2_bl_out_of_range
7618 * testsuite/Makefile.in: Regenerate.
7619 * testsuite/arm_bl_in_range.s: New file.
7620 * testsuite/arm_bl_out_of_range.s: Ditto.
7621 * testsuite/arm_branch_in_range.sh: Ditto.
7622 * testsuite/arm_branch_range.t: Ditto.
7623 * testsuite/thumb2_branch_range.t: Ditto.
7624 * testsuite/thumb_bl_in_range.s: Ditto.
7625 * testsuite/thumb_bl_out_of_range.s: Ditto.
7626 * testsuite/thumb_branch_range.t: Ditto.
7627
7628 2010-02-20 Sriraman Tallam <tmsriram@google.com>
7629
7630 * gc.h (gc_process_relocs): Change vectors to point to the new list.
7631 Add reloc offset information.
7632 * icf.cc (get_section_contents): Change iterators to point to the new
7633 vectors. Add reloc offset information to the contents.
7634 * icf.h (Icf::Sections_reachable_info): New typedef.
7635 (Icf::Sections_reachable_list): New typedef.
7636 (Icf::Offset_info): New typedef.
7637 (Icf::Reloc_info): New struct typedef.
7638 (Icf::Reloc_info_list): New typedef.
7639 (Icf::symbol_reloc_list): Delete method.
7640 (Icf::addend_reloc_list): Delete method.
7641 (Icf::section_reloc_list): Delete method.
7642 (Icf::reloc_info_list): New method.
7643 (Icf::reloc_info_list_): New member.
7644
7645 2010-02-19 Doug Kwan <dougkwan@google.com>
7646
7647 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7648 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7649 * arm.cc (Arm_relocation_functions): New forward declaration.
7650 (Target_arm::Target_arm): Initialize new data members
7651 got_mod_index_offset_ and tls_base_symbol_defined_.
7652 (Target_arm::Relocate::relocate_tls): New method.
7653 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7654 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7655 New methods.
7656 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7657 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7658 (Target_arm::got_mod_index_offset_,
7659 Target_arm::tls_base_symbol_defined_): New data members.
7660 (Target_arm::Scan::local, Target::Scan::global,
7661 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7662 relocations.
7663
7664 2010-02-18 Doug Kwan <dougkwan@google.com>
7665
7666 * arm.cc (Arm_relobj::find_linked_text_section): New method.
7667 (Arm_relobj::make_exidx_input_section): Pass section index of linked
7668 text section as a parameter becuase some broken tools may not set
7669 the link in section header.
7670 (Target_arm::has_got_section): New method.
7671 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7672 without any mapping symbol as data only. Remove warning.
7673 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7674 link in its section header, try to discover the link by inspecting the
7675 REL31 relocation at the beginning of the section.
7676 (Target_arm::Scan::check_non_pic): Report name of offending relocation
7677 in error message.
7678 (Target_arm::Scan::global): Treat any reference to the symbol
7679 _GLOBAL_OFFSET_TABLE_ as a GOT access.
7680
7681 2010-02-12 Sriraman Tallam <tmsriram@google.com>
7682
7683 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7684 (Scan::global_reloc_may_be_function_pointer): New function.
7685 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7686 (Scan::global_reloc_may_be_function_pointer): New function.
7687 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7688 (Scan::global_reloc_may_be_function_pointer): New function.
7689 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7690 (Scan::global_reloc_may_be_function_pointer): New function.
7691 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7692 (Scan::global_reloc_may_be_function_pointer): New function.
7693 (Scan::possible_function_pointer_reloc): New function.
7694 (Target_x86_64::can_check_for_function_pointers): New function.
7695 * gc.h (gc_process_relocs): Scan relocation types to determine if
7696 function pointers were taken for targets that support it.
7697 * icf.cc (Icf::find_identical_sections): Include functions for
7698 folding in safe ICF whose pointer is not taken.
7699 * icf.h (Secn_fptr_taken_set): New typedef.
7700 (fptr_section_id_): New member.
7701 (section_has_function_pointers): New function.
7702 (set_section_has_function_pointers): New function.
7703 (check_section_for_function_pointers): New function.
7704 * options.h: Fix comment for safe ICF option.
7705 * target.h (can_check_for_function_pointers): New function.
7706 * testsuite/Makefile.am: Add icf_safe_so_test test case.
7707 Modify icf_safe_test for X86-64.
7708 * testsuite/Makefile.in: Regenerate.
7709 * testsuite/icf_safe_so_test.cc: New file.
7710 * testsuite/icf_safe_so_test.sh: New file.
7711 * testsuite/icf_safe_test.cc (kept_func_3): New function.
7712 (main): Change to take pointer to function kept_func_3.
7713 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7714 folding is done correctly for X86-64.
7715
7716 2010-02-12 David S. Miller <davem@davemloft.net>
7717
7718 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7719 is_symbolless parameter.
7720 (Output_reloc<SHT_REL>::is_symbolless): New.
7721 (Output_reloc<SHT_REL>::is_symbolless_): New.
7722 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7723 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7724 (Output_reloc<SHT_RELA>::is_symbolless): New.
7725 (Output_data_reloc::add_global): Handle is_symbolless.
7726 (Output_data_reloc::add_global_relative): Likewise.
7727 (Output_data_reloc::add_local): Likewise.
7728 (Output_data_reloc::add_local_relative): Likewise.
7729 (Output_data_reloc::add_symbolless_global_addend): New.
7730 (Output_data_reloc::add_symbolless_local_addend): New.
7731 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7732 is_symbolless.
7733 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7734 instead of ->is_relative_
7735 (Output_reloc::write): Likewise.
7736 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7737 (Output_reloc::write_rel): Simplify.
7738
7739 * sparc.cc (Target_sparc::Scan::local): Use
7740 ->add_symbolless_local_addend as needed.
7741 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7742 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
7743 based upon relocation offset.
7744
7745 2010-02-11 Doug Kwan <dougkwan@google.com>
7746
7747 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7748 (Target_arm::Scan::global): Ditto. Also remove a comment before the
7749 beginning of function.
7750 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7751 and MOVT_ABS relocations. Those are non issued in scanning. Fix
7752 parameter is_32bit in calls to should_apply_static_reloc.
7753 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7754 (check_DATA): Add arm_abs_global.stdout.
7755 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7756 arm_abs_global.stdout): New rules.
7757 (MOSTLLYCLEANFILES): Add arm_abs_global
7758 * Makefile.in: Regenerate.
7759 * testsuite/arm_abs_global.s: New file.
7760 * testsuite/arm_abs_global.sh: Ditto.
7761 * testsuite/arm_abs_lib.s: Ditto.
7762
7763 2010-02-11 Ian Lance Taylor <iant@google.com>
7764
7765 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7766 Read_relocs task.
7767 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
7768 Allocate_commons_task first.
7769 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7770 task, rather than symtab_lock_.
7771 (Gc_process_relocs::~Gc_process_relocs): New function.
7772 (Gc_process_relocs::is_runnable): Check this_blocker_.
7773 (Gc_process_relocs::locks): Use next_blocker_ rather than
7774 blocker_.
7775 (Scan_relocs::~Scan_relocs): New function.
7776 (Scan_relocs::is_runnable): Check this_blocker_ rather than
7777 symtab_lock_.
7778 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7779 next_blocker_.
7780 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7781 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7782 constructor accordingly.
7783 (class Gc_process_relocs): Likewise.
7784 (class Scan_relocs): Likewise.
7785 * common.h (class Allocate_commons_task): Remove symtab_lock_
7786 field, and corresponding constructor parameter.
7787 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7788 symtab_lock_.
7789 (Allocate_commons_task::locks): Likewise.
7790
7791 2010-02-11 Ian Lance Taylor <iant@google.com>
7792
7793 * gold-threads.h (class Once): Define.
7794 (class Initialize_lock): Rewrite as child of Once.
7795 * gold-threads.cc (class Once_initialize): Define.
7796 (once_pointer_control): New static variable.
7797 (once_pointer, once_arg): New static variables.
7798 (c_run_once): New static function.
7799 (Once::Once, Once::run_once, Once::internal_run): New functions.
7800 (class Initialize_lock_once): Remove.
7801 (initialize_lock_control): Remove.
7802 (initialize_lock_pointer): Remove.
7803 (initialize_lock_once): Remove.
7804 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7805 (Initialize_lock::initialize): Rewrite.
7806 (Initialize_lock::do_run_once): New function.
7807 * archive.cc (Archive::interpret_header): Only clear name if it is
7808 not already empty.
7809 * fileread.cc: Include "gold-threads.h"
7810 (file_counts_lock): New static variable.
7811 (file_counts_initialize_lock): Likewise.
7812 (File_read::release): Only increment counts when using --stats.
7813 Use a lock around the increment.
7814 * parameters.cc (class Set_parameters_target_once): Define.
7815 (set_parameters_target_once): New static variable.
7816 (Parameters::Parameters): Move here from parameters.h.
7817 (Parameters::set_target): Rewrite.
7818 (Parameters::set_target_once): New function.
7819 (Parameters::clear_target): Move here and rewrite.
7820 * parameters.h (class Parameters): Update declarations. Add
7821 set_parameters_target_once_ field.
7822 (Parameters::Parameters): Move to parameters.cc.
7823 (Parameters::clear_target): Likewise.
7824 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7825 task.
7826 (Start_group::~Start_group): New function.
7827 (Start_group::is_runnable): New function.
7828 (Start_group::locks, Start_group::run): New functions.
7829 (Finish_group::run): Change saw_undefined to size_t.
7830 * readsyms.h (class Start_group): Define.
7831 (class Finish_group): Change saw_undefined_ field to size_t.
7832 (Finish_group::Finish_group): Remove saw_undefined and
7833 this_blocker parameters. Change all callers.
7834 (Finish_group::set_saw_undefined): New function.
7835 (Finish_group::set_blocker): New function.
7836 * symtab.h (class Symbol_table): Change saw_undefined to return
7837 size_t. Change saw_undefined_ field to size_t.
7838 * target-select.cc (Set_target_once::do_run_once): New function.
7839 (Target_selector::Target_selector): Initialize set_target_once_
7840 field. Don't initialize lock_ and initialize_lock_ fields.
7841 (Target_selector::instantiate_target): Rewrite.
7842 (Target_selector::set_target): New function.
7843 * target-select.h (class Set_target_once): Define.
7844 (class Target_selector): Update declarations. Make
7845 Set_target_once a friend. Remove lock_ and initialize_lock_
7846 fields. Add set_target_once_ field.
7847
7848 2010-02-10 Ian Lance Taylor <iant@google.com>
7849
7850 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7851 queueing any tasks.
7852 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7853 (queue_middle_tasks): Add all blockers before queueing any tasks.
7854 (queue_final_tasks): Likewise.
7855 * token.h (Task_token::add_blockers): New function.
7856 * object.h (Input_objects::number_of_relobjs): New function.
7857
7858 2010-02-10 Ian Lance Taylor <iant@google.com>
7859
7860 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7861 shared, not if not position independent.
7862 * x86_64.cc (Relocate::relocate_tls): Likewise.
7863 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7864 (tls_pie_pic_test): New target.
7865 * testsuite/Makefile.in: Rebuild.
7866
7867 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7868 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7869 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7870 * testsuite/Makefile.in: Rebuild.
7871
7872 2010-02-09 David S. Miller <davem@davemloft.net>
7873
7874 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7875 R_SPARC_RELATIVE using ->add_local_relative().
7876 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7877
7878 * output.h (Output_data_dynamic::add_section_size): New method
7879 that takes two Output_data objects.
7880 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7881 entry param. Handle it in initializers.
7882 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7883 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7884 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7885 arg.
7886 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7887 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7888 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7889 for dynrel_includes_plt.
7890 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7891 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7892 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7893 before .rela.plt
7894 (Target_sparc::do_finalize_sections): Update to pass true for
7895 dynrel_includes_plt.
7896 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7897 output before .rela.plt
7898 (Target_powerpc::do_finalize_sections): Update to pass true for
7899 dynrel_includes_plt when 32-bit.
7900
7901 2010-02-08 Doug Kwan <dougkwan@google.com>
7902
7903 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7904 method.
7905 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7906 Arm_relobj::scan_section_for_cortex_a8_stubs,
7907 Arm_relobj::do_relocation_section): Instead of calling
7908 Output_section::output_address, use faster
7909 Arm_relobj::simple_input_section_output_address.
7910
7911 2010-02-08 David S. Miller <davem@davemloft.net>
7912
7913 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7914 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7915 relocation helper function.
7916
7917 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7918 just like R_SPARC_GOT{10,13,22}.
7919 (Target_sparc::Scan::local): Likewise.
7920 (Target_sparc::Relocate:relocate): Likewise.
7921
7922 2010-02-06 Ian Lance Taylor <iant@google.com>
7923
7924 * configure.ac: Rewrite targetobjs duplicate removal code to use
7925 only shell constructs.
7926 * configure: Rebuild.
7927
7928 2010-02-05 Doug Kwan <dougkwan@google.com>
7929
7930 PR 11247
7931 * arm.cc (Arm_relobj::section_is_scannable): New method.
7932 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7933 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7934
7935 2010-02-04 Doug Kwan <dougkwan@google.com>
7936
7937 PR 11247
7938 * arm-reloc-property.cc (cstdio): Include.
7939 * configure.ac (targetobjs): Remove duplicates.
7940 * configure: Regenerate.
7941 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7942 big and little endian version for a given address size.
7943
7944 2010-02-03 Doug Kwan <dougkwan@google.com>
7945
7946 * arm-reloc-property.cc
7947 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7948 definition.
7949 * arm-reloc-property.h
7950 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7951 New method definition.
7952 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7953 declaration.
7954 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7955 overflow to N.
7956 (GOT_PREL): Change implemented to Y.
7957 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7958 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7959 (Arm_relocate_functions::movw_abs_nc): Remove method.
7960 (Arm_relocate_functions::movt_abs): Ditto.
7961 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7962 (Arm_relocate_functions::thm_movt_abs): Ditto.
7963 (Arm_relocate_functions::movw_rel_nc): Ditto.
7964 (Arm_relocate_functions::movw_rel): Ditto.
7965 (Arm_relocate_functions::movt_rel): Ditto.
7966 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7967 (Arm_relocate_functions:thm_movw_rel): Ditto.
7968 (Arm_relocate_functions:thm_movt_rel): Ditto.
7969 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7970 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7971 New method definitions.
7972 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7973 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7974 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7975 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7976 (Target_arm::Relocate::relocate): Check for non-static or
7977 unimplemented relocation code and exit early. Change calls to
7978 Target_arm::reloc_uses_thumb_bit and
7979 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7980 instead. Refactor code to handle similar relocations to increase
7981 code sharing. Remove check for unsupported relocation code in switch
7982 statement.
7983 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7984 relocation property table to find out size. Change error message to
7985 print out the name of a relocation code instead of the numeric value.
7986 (Target_arm::scan_reloc_for_stub): Use relocation property table
7987 instead of calling Target_arm::reloc_uses_thumb_bit().
7988
7989 2010-02-02 Doug Kwan <dougkwan@google.com>
7990
7991 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7992 types of relaxed input section.
7993
7994 2010-02-02 Doug Kwan <dougkwan@google.com>
7995
7996 * Makefile.am (HFILES): Add arm-reloc-property.h.
7997 (DEFFILES): New.
7998 (TARGETSOURCES): Add arm-reloc-property.cc
7999 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8000 (libgold_a_SOURCES): $(DEFFILES)
8001 * Makefile.in: Regenerate.
8002 * arm-reloc-property.cc: New file.
8003 * arm-reloc-property.h: New file.
8004 * arm-reloc.def: New file.
8005 * arm.cc: Update comments.
8006 (arm-reloc-property.h): New included header.
8007 (arm_reloc_property_table): New global variable.
8008 (Target_arm::do_select_as_default_target): New method definition.
8009 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8010 arm-reloc-property to targ_extra_obj.
8011 * parameters.cc (set_parameters_target): Call
8012 Target::select_as_default_target().
8013 * target.h (Target::select_as_default_target): New method definition.
8014 (Target::do_select_as_default_target): Same.
8015
8016 2010-02-01 Doug Kwan <dougkwan@google.com>
8017
8018 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8019 first_output_text_section_.
8020 (Arm_exidx_fixup::first_output_text_section): New method definition.
8021 (Arm_exidx_fixup::first_output_text_section_): New data member.
8022 (Arm_exidx_fixup::process_exidx_section): Record the first text
8023 output section seen.
8024 (Arm_output_section::fix_exidx_coverage): Set correct linked section
8025 and entsize in output section header.
8026
8027 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8028
8029 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8030 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8031 (Arm_relocate_functions::thm_alu11): New Method.
8032 (Arm_relocate_functions::thm_pc8): New Method.
8033 (Arm_relocate_functions::thm_pc12): New Method.
8034 (Target_arm::Scan::local): Handle the relocations.
8035 (Target_arm::Scan::global): Likewise.
8036 (Target_arm::Relocate::relocate): Likewise.
8037 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8038
8039 2010-01-29 Doug Kwan <dougkwan@google.com>
8040
8041 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8042 of relocation types as ld.
8043
8044 2010-01-29 Doug Kwan <dougkwan@google.com>
8045
8046 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8047 to public.
8048 (Arm_relocate_functions::thumb_branch_common): Ditto.
8049 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8050 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8051 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8052 Arm_relocate_functions::jump24): Remove.
8053 (Target_arm::Relocate::relocate): Adjust code to call
8054 Arm_relocation_functions::arm_branch_common and
8055 Arm_relocation_functions::thumb_branch_common instead of their removed
8056 wrappers. Merge switch-cases together to reduce source code size.
8057
8058 2010-01-29 Doug Kwan <dougkwan@google.com>
8059
8060 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8061 output_local_symbol_count_needs_update_.
8062 (Arm_relobj::output_local_symbol_count_needs_update,
8063 Arm_relobj::set_output_local_symbol_count_needs_update,
8064 Arm_relobj::update_output_local_symbol_count): New methods.
8065 (Arm_relobj::output_local_symbol_count_needs_update_): New data
8066 member.
8067 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8068 of pointed function as in a R_ARM_PREL31 relocation.
8069 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8070 for output local symbol count updating.
8071 (Target_arm::do_relax): Update output local symbol counts in objects
8072 if necessary.
8073 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8074
8075 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8076
8077 * arm.cc: Added support for the ARM relocations:
8078 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8079 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8080 (Arm_relocate_functions::movw_rel_nc): Renamed (was
8081 movw_prel_nc).
8082 (Arm_relocate_functions::movw_rel): New method.
8083 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8084 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8085 thm_movw_prel_nc).
8086 (Arm_relocate_functions::thm_movw_rel): New method.
8087 (Arm_relocate_functions::thm_movt_rel): Renamed (was
8088 thm_movt_prel).
8089 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8090 relocations.
8091 (Target_arm::Scan::global): Likewise.
8092 (Target_arm::Relocate::relocate): Likewise.
8093 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8094 Likewise.
8095
8096 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8097
8098 * arm.cc: Added support for ARM group relocations.
8099 (Target_arm::reloc_needs_sym_origin): New method.
8100 (Arm_relocate_functions::calc_grp_kn): New method.
8101 (Arm_relocate_functions::calc_grp_residual): New method.
8102 (Arm_relocate_functions::calc_grp_gn): New method.
8103 (Arm_relocate_functions::arm_grp_alu): New Method.
8104 (Arm_relocate_functions::arm_grp_ldr): New Method.
8105 (Arm_relocate_functions::arm_grp_ldrs): New Method.
8106 (Arm_relocate_functions::arm_grp_ldc): New Method.
8107 (Target_arm::Scan::local): Handle the ARM group relocations.
8108 (Target_arm::Scan::global): Likewise.
8109 (Target_arm::Relocate::relocate): Likewise.
8110 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8111 Likewise.
8112
8113 2010-01-26 Doug Kwan <dougkwan@google.com>
8114
8115 * arm.cc (set): Include.
8116 (class Arm_exidx_fixup): Change type of last_input_section_ to const
8117 pointer type.
8118 (Arm_output_section::Text_section_list): New type.
8119 (Arm_output_section::append_text_sections_to_list): New method.
8120 (Arm_output_section::fix_exidx_coverage): Ditto.
8121 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8122 (Arm_relobj::convert_input_section_to_relaxed_section): Use
8123 Relobj::set_section_offset() instead of
8124 Sized_relobj::invalidate_section_offset().
8125 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8126 parameter for section headers. Ignore relocation sections for
8127 unallocated sections and EXIDX sections.
8128 (Target_arm::fix_exidx_coverage): New method.
8129 (Target_arm::output_section_address_less_than): New type.
8130 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8131 linked text section instead of the EXIDX section.
8132 (Arm_output_section::create_stub_group): Add an assertion to check
8133 that this is not an EXIDX output section.
8134 (Arm_output_section::append_text_sections_to_list): New method.
8135 (Arm_output_section::fix_exidx_coverage): Ditto.
8136 (Arm_relobj::scan_sections_for_stubs): Adjust call to
8137 Arm_relobj::section_needs_reloc_stub_scanning.
8138 (Target_arm::do_relax): Fix EXIDX output section coverage in the
8139 first pass.
8140 (Target_arm::fix_exidx_coverage): New method.
8141 * object.h (Relobj::set_output_section): New method.
8142 (Sized_relobj::invalidate_section_offset): Remove method.
8143 (Sized_relobj::do_invalidate_section_offset): Remove method.
8144 (Sized_relobj::do_set_section_offset): Handle offset value -1.
8145
8146 2010-01-25 Doug Kwan <dougkwan@google.com>
8147
8148 * arm.cc (Arm_exidx_merged_section::do_output_offset):
8149 Fix warning due to signed and unsigned comparison on a 32-bit host.
8150
8151 2010-01-22 Doug Kwan <dougkwan@google.com>
8152
8153 * arm.cc (Target_arm::do_relax): Record an output section for section
8154 offset adjustment it contains any stub table that has changed.
8155 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8156 offsets in an output section if necessary.
8157 * output.cc (Output_section::Output_section): Initialize
8158 section_offsets_need_adjustments_.
8159 (Output_section::add_input_section_for_script): Renamed to
8160 Output_section::add_simple_input_section.
8161 (Output_section::save_states): Add a comment.
8162 (Output_section::discard_states): New method defintion.
8163 (Output_section::adjust_section_offsets): Same.
8164 * output.h (Output_section::add_input_section_for_script): Renamed to
8165 Output_section::add_simple_input_section.
8166 (Output_section::discard_states): New method declaration.
8167 (Output_section::adjust_section_offsets): Same.
8168 (Output_section::section_offsets_need_adjustment,
8169 Output_section::set_section_offsets_need_adjustment): New method
8170 definitions.
8171 (Output_section::section_offsets_need_adjustment_): New data member.
8172 * script-sections.cc
8173 (Output_section_element_input::set_section_address): Adjust code for
8174 renaming of Output_section::add_input_section_for_script.
8175 (Orphan_output_section::set_section_address): Same.
8176
8177 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8178
8179 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8180 Fix_v4bx enum values .
8181 * gold/options.h (General_options): New option definitions.
8182 (General_options::fix_v4bx): New method.
8183 (General_options::Fix_v4bx): New enum.
8184 * gold/options.cc (General_options::parse_fix_v4bx): New method.
8185 (General_options::parse_fix_v4bx_interworking): New method.
8186
8187 2010-01-22 Doug Kwan <dougkwan@google.com>
8188
8189 * arm.cc (Arm_exidx_fixup): New class.
8190
8191 2010-01-21 Doug Kwan <dougkwan@google.com>
8192
8193 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8194 classes.
8195 (Arm_exidx_section_offset_map): New type.
8196
8197 2010-01-21 Doug Kwan <dougkwan@google.com>
8198
8199 * arm.cc (Arm_exidx_input_section): New class.
8200 (Arm_relobj::exidx_input_section_by_link,
8201 Arm_relobj::exidx_input_section_by_shndx,
8202 Arm_relobj::make_exidx_input_section): New methods.
8203 (read_arm_attributes_section): Remove.
8204 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8205 information about them.
8206 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8207 to here.
8208
8209 2010-01-20 Doug Kwan <dougkwan@google.com>
8210
8211 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8212 Input_section_specifier to Section_id.
8213 (Target_arm::new_arm_input_section: Adjust code for change of key
8214 type.
8215 (Target_arm::find_arm_input_section): Ditto.
8216 * gc.h (object.h): Include for Section_id nand Section_id_hash.
8217 (Section_id): Remove.
8218 (Garbage_collection::Section_id_hash): Remove.
8219 * icf.h (object.h): Include for Section_id nand Section_id_hash.
8220 (Section_id): Remove.
8221 (Icf::Section_id_hash): Remove.
8222 * object.h (Section_id, Const_section_id, Section_id_hash,
8223 Const_section_id_hash): New type definitions.
8224 * output.cc (Output_section::add_relaxed_input_section): Change to
8225 use Const_section_id instead of Input_section_specifier as key type.
8226 (Output_section::add_merge_input_section): Ditto.
8227 (Output_section::build_relaxation_map): Change to use Section_id
8228 instead of Input_section_specifier as key type.
8229 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8230 Ditto.
8231 (Output_section::convert_input_sections_to_relaxed_sections): Change
8232 to use Const_section_id instead of Input_section_specifier as key type.
8233 (Output_section::find_merge_section): Ditto.
8234 (Output_section::find_relaxed_input_section): Ditto.
8235 * output.h (Input_section_specifier): Remove class.
8236 (Output_section::Output_section_data_by_input_section_map): Change
8237 key type to Const_section_id.
8238 (Output_section::Output_relaxed_input_section_by_input_section_map):
8239 Ditto.
8240 (Output_section::Relaxation_map): Change key type to Section_id.
8241
8242 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8243
8244 * gold/arm.cc: Added support for R_ARM_V4BX relocation
8245 (class Arm_v4bx_stub): New class.
8246 (DEF_STUBS): Updated definition to support v4_veneer_bx.
8247 (Stub_factory::make_arm_v4bx_stub): New method.
8248 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8249 (Stub_table::empty): Handle v4bx stubs.
8250 (Stub_table::add_arm_v4bx_stub): New method.
8251 (Stub_table::find_arm_v4bx_stub): New method.
8252 (Arm_relocate_functions::v4bx): New method.
8253 (Target_arm::fix_v4bx): New method.
8254 (Target_arm::Target_arm): Handle R_ARM_V4BX.
8255 (Stub_table::relocate_stubs): Likewise.
8256 (Stub_table::do_write): Likewise.
8257 (Stub_table::update_data_size_and_addralign): Likewise.
8258 (Stub_table::finalize_stubs): Likewise.
8259 (Target_arm::Scan::local): Likewise.
8260 (Target_arm::Scan::global): Likewise.
8261 (Target_arm::do_finalize_sections): Likewise.
8262 (Target_arm::Relocate::relocate): Likewise.
8263 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8264 Likewise.
8265 (Target_arm::scan_reloc_for_stub): Likewise.
8266 (Target_arm::scan_reloc_section_for_stubs): Likewise.
8267
8268 2010-01-19 Ian Lance Taylor <iant@google.com>
8269
8270 * output.cc (Output_section_headers::do_sized_write): Write large
8271 segment count to sh_info field.
8272 (Output_file_header::do_sized_write): For large segment count,
8273 write PN_XNUM to e_phnum field.
8274
8275 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8276
8277 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8278 (Arm_relocate_functions::thm_jump8): New function.
8279 (Arm_relocate_functions::thm_jump11): New function.
8280 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8281 R_ARM_THM_JUMP11.
8282 (Target_arm::Scan::global): Likewise.
8283 (Target_arm::Relocate::relocate): Likewise.
8284 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8285 Likewise.
8286
8287 2010-01-14 Doug Kwan <dougkwan@google.com>
8288
8289 * arm.cc (map, utility): Include headers.
8290 (Target_arm::apply_cortex_a8_workaround): New method.
8291 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8292 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8293 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8294 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8295 the --[no-]fix-cortex-a8 command line options.
8296 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8297 (Target_arm::relocate_stub): Use addend in instruction template.
8298 * options.h (DEFINE_bool): Set the user-set flag.
8299 (General_options): Add --[no-]-fix-cortex options.
8300 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8301 : Update fast look-up map after conversion.
8302
8303 2010-01-14 Sriraman Tallam <tmsriram@google.com>
8304
8305 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8306 in the first pass of do_layout.
8307
8308 2010-01-13 Doug Kwan <dougkwan@google.com>
8309
8310 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8311 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8312 apparent compiler problem of not folding static constant integral
8313 data members of elfcpp::Elf_sizes<32>.
8314
8315 2010-01-13 Doug Kwan <dougkwan@google.com>
8316
8317 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8318 Arm_relobj::section_needs_cortex_a8_stub_scanning,
8319 Arm_relobj::scan_section_for_cortex_a8_erratum,
8320 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8321 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8322 sections to scan for relocation stubs into a new method
8323 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
8324 relocation and Cortex-A8 stub scanning.
8325 (Target_arm::do_relax): Force stubs to be after stubbed sections
8326 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
8327 the beginning of a new relaxation pass. Update a comment.
8328 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8329
8330 2010-01-12 Ian Lance Taylor <iant@google.com>
8331
8332 * target-reloc.h (visibility_error): New inline function.
8333 (relocate_section): Call visibility_error.
8334 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8335 (MOSTLYCLEANFILES): Likewise.
8336 (protected_4_pic.o, protected_3.err): New targets.
8337 * testsuite/protected_4.cc: New file.
8338
8339 2010-01-12 Doug Kwan <dougkwan@google.com>
8340
8341 * arm.cc (Cortex_a8_reloc): New class.
8342 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8343 and cortex_a8_relocs_info_.
8344 (Target_arm::fix_cortex_a8): New method definition.
8345 (Target_arm::Cortex_a8_relocs_info): New type.
8346 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8347 New data member declarations.
8348 (Target_arm::scan_reloc_for_stub): Record information about
8349 relocations for THUMB branches that might be exempted from the
8350 Cortex-A8 workaround.
8351 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8352 at the beginning of a relaxation pass.
8353
8354 2010-01-12 Doug Kwan <dougkwan@google.com>
8355
8356 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8357 (Arm_relobj::Mapping_symbol_position,
8358 Arm_reloj::Mapping_symbol_position_less,
8359 Arm_relobj::Mapping_symbols_info): New types.
8360 (Target_arm::is_mapping_symbol_name): New method definition.
8361 (Arm_relobj::do_count_local_symbols): Save information about mapping
8362 symbols.
8363
8364 2010-01-11 Doug Kwan <dougkwan@google.com>
8365
8366 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8367 Arm_relocate_functions::thumb32_branch_upper,
8368 Arm_relocate_functions::thumb32_branch_lower,
8369 Arm_relocate_functions::thumb32_cond_branch_offset,
8370 Arm_relocate_functions::thumb32_cond_branch_upper,
8371 Arm_relocate_functions::thumb32_cond_branch_lower,
8372 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8373 branch offset encoding.
8374 (Arm_relocate_functions::thumb_branch_common): Use new branch
8375 offset encoding methods to avoid code duplication.
8376 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8377 (Stub_addend_reader::operator()): Use new branch encoding method
8378 to avoid code duplication.
8379
8380 2010-01-11 Doug Kwan <dougkwan@google.com>
8381
8382 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8383 (Target_arm::do_finalize_sections): Define special EXIDX section
8384 symbols only if referenced.
8385 * gc.h (Garbage_collection::add_reference): New method.
8386 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8387 code duplication.
8388
8389 2010-01-11 Ian Lance Taylor <iant@google.com>
8390
8391 * script.cc (Version_script_info::build_expression_list_lookup):
8392 Change complaing about duplicate wildcard match from error to
8393 warning.
8394
8395 * script.cc (class Lazy_demangler): Recreate--revert part of patch
8396 of 2009-12-30.
8397 (Version_script_info::Version_script_info): Initialize globs_,
8398 default_version_, default_is_global_, and exact_. Don't
8399 initialize globals_ or locals_.
8400 (Version_script_info::build_lookup_tables): Build local symbols
8401 first.
8402 (Version_script_info::unquote): New function.
8403 (Version_script_info::add_exact_match): New function.
8404 (Version_script_info::build_expression_list_lookup): Remove lookup
8405 parameter. Add is_global parameter. Change all callers. Handle
8406 wildcard pattern specially. Unquote pattern. Call
8407 add_exact_match.
8408 (Version_script_info::get_name_to_match): New function.
8409 (Version_script_info::get_symbol_version): New function.
8410 (Version_script_info::get_symbol_version_helper): Remove.
8411 (Version_script_info::check_unmatched_names): Call unquote.
8412 * script.h (class Version_script_info): Change get_symbol_version
8413 to be non-inline and add is_global parameter; change all callers.
8414 Rewrite symbol_is_local. Update declarations. Define struct
8415 Version_tree_match, Exact, Globs. Don't define struct Lookup.
8416 Remove globals_ and locals_ members. Add exact_, globs_,
8417 default_version_, is_global_.
8418 (Version_script_info::Glob): Remove pattern, add expression and
8419 is_global. Update constructor. Change all callers.
8420 * dynobj.cc (Versions::finalize): Mark the version symbol as the
8421 default version.
8422 (Versions::symbol_section_contents): If a symbol is undefined, or
8423 defined in a dynamic object, set the version index to
8424 VER_NDX_LOCAL.
8425 * symtab.cc (Symbol_table::add_from_relobj): Don't call
8426 symbol_is_local.
8427 (Symbol_table::add_from_pluginobj): Likewise.
8428 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8429
8430 2010-01-11 Doug Kwan <dougkwan@google.com>
8431
8432 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8433 (incremental_dump_LDADD): Add linking option for libintl.
8434 * Makefile.in: Regenerate.
8435
8436 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
8437
8438 PR gold/11144
8439 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8440 instead of -Ds.
8441 * testsuite/Makefile.in: Regenerated.
8442
8443 2010-01-10 Doug Kwan <dougkwan@google.com>
8444
8445 * options.h (DEFINE_var): Use parentheses around argument varname__
8446 in macro body to avoid any unintended subsequent substitutions.
8447
8448 2010-01-10 Ian Lance Taylor <iant@google.com>
8449
8450 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8451 candidates before doing symbol resolution.
8452
8453 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8454 ODR candidates if only one is weak.
8455
8456 2010-01-08 Ian Lance Taylor <iant@google.com>
8457
8458 * script.cc (Version_script_info::build_expression_list_lookup):
8459 Don't warn about ambiguous version, just record the ambiguity.
8460 (Version_script_info::get_symbol_version_helper): Give error if
8461 version is ambiguous.
8462
8463 2010-01-08 Doug Kwan <dougkwan@google.com>
8464
8465 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8466 prev_data_size_ and prev_addralign_. Remove initializer for
8467 deleted data member has_been_changed_.
8468 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8469 to determine if the table is empty.
8470 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8471 Remove.
8472 (Stub_table::add_reloc_stub): Define method in class definition
8473 instead of just declaring it there.
8474 (Stub_table::add_cortex_a8_stub): New method definition.
8475 (Stub_table::update_data_size_and_addralign): Ditto.
8476 (Stub_table::finalize_stubs): Ditto.
8477 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8478 (Stub_table::do_addralign_): Return address alignment in the
8479 (Stub_table::do_reset_address_and_file_offset): Define method in
8480 class definition instead of declaring it there. Set current data
8481 size to be the data size of the previous pass.
8482 (Stub_table::set_final_data_size): Use current data size as the
8483 final data size.
8484 (Stub_table::relocate_stub): Change parameter type of stub from
8485 Reloc_stub pointer to Stub pointer.
8486 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8487 (Stub_table::Cortex_a8_stub_list): New typedef.
8488 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8489 Stub_table::prev_addralign_): New data member.
8490 (Arm_relobj::Arm_relobj): Initialize data member
8491 section_has_cortex_a8_workaround_.
8492 (Arm_relobj::section_has_cortex_a8_workaround,
8493 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8494 definitions.
8495 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8496 declarations.
8497 (Target_arm::relocate_stub): Change parameter type of stub from
8498 Reloc_stub pointer to Stub pointer.
8499 (Insn_template::size, Insn_template::alignment): Handle
8500 THUMB16_SPECIAL_TYPE.
8501 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8502 Stub_table::update_data_size_and_addralign,
8503 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8504 definitions.
8505 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8506 (Stub_table::do_write): Ditto.
8507 (Target_arm::do_relax): Adjust code for changes in Stub_table.
8508
8509 2010-01-08 Ian Lance Taylor <iant@google.com>
8510
8511 PR 11108
8512 * symtab.h (class Symbol): Remove fields is_target_special_ and
8513 has_plt_offset_. Add field is_defined_in_discarded_section_.
8514 (Symbol::is_defined_in_discarded_section): New function.
8515 (Symbol::set_is_defined_in_discarded_section): New function.
8516 (Symbol::has_plt_offset): Rewrite.
8517 (Symbol::set_plt_offset): Verify that new offset is not -1U.
8518 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8519 Don't initialize is_target_special_ or has_plt_offset_.
8520 Initialize is_defined_in_discarded_section_.
8521 (Symbol_table::add_from_relobj): If appropriate, set
8522 is_defined_in_discarded_section.
8523 * resolve.cc (Symbol::override_base_with_special): Don't test
8524 is_target_special_. Change has_plt_offset_ to has_plt_offset().
8525 * target-reloc.h (relocate_section): Do special handling for
8526 symbols defined in discarded sections for global symbols as well
8527 as local symbols.
8528
8529 2010-01-08 Ian Lance Taylor <iant@google.com>
8530
8531 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8532 the SHT_SYMTAB case.
8533
8534 2010-01-08 Ian Lance Taylor <iant@google.com>
8535
8536 * object.cc (Sized_relobj::do_layout): Don't get confused if
8537 layout_eh_frame returns NULL.
8538
8539 2010-01-08 Ian Lance Taylor <iant@google.com>
8540
8541 PR 11084
8542 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8543 dynamic symbol table, use the normal symbol table.
8544 (Sized_dynobj::do_read_symbols): Remove assertion about type of
8545 symbol table.
8546
8547 2010-01-08 Ian Lance Taylor <iant@google.com>
8548
8549 PR 11072
8550 * layout.cc (Layout::include_section): Remove .gnu_debuglink
8551 sections.
8552
8553 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
8554
8555 * version.cc (print_version): Change to "Copyright 2010".
8556
8557 2010-01-08 Ian Lance Taylor <iant@google.com>
8558
8559 PR 10287
8560 PR 11063
8561 * i386.cc (class Target_i386): Change return type of plt_section
8562 to be non-const.
8563 (class Output_data_plt_i386): Add tls_desc_rel_ field.
8564 (Output_data_plt_i386::Output_data_plt_i386): Initialize
8565 tls_desc_rel_ field.
8566 (Output_data_plt_i386::rel_tls_desc): New function.
8567 (Target_i386::rel_tls_desc_section): New function.
8568 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8569 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8570 R_386_TLS_DESC reloc in rel_tls_desc_section.
8571 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8572 Define struct Tlsdesc_info.
8573 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8574 (Target_x86_64::do_reloc_symbol_index): New function.
8575 (Target_x86_64::add_tlsdesc_info): New function.
8576 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8577 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8578 tlsdesc_rel_ field.
8579 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
8580 all callers.
8581 (Output_data_plt_x86_64::rela_tlsdesc): New function.
8582 (Target_x86_64::rela_tlsdesc_section): New function.
8583 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8584 handling.
8585 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8586 (Target_x86_64::do_reloc_addend): New function.
8587 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8588 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8589 declarations. Define TARGET_CODE. Add arg field to u1_ union.
8590 (Output_reloc::type): New function.
8591 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8592 (Output_reloc::is_target_specific): New function.
8593 (Output_reloc::target_arg): New function.
8594 (class Output_reloc) [SHT_RELA]: Add four new constructors for
8595 absolute relocs and target specific relocs.
8596 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8597 add_target_specific.
8598 (class Output_data_reloc) [SHT_RELA]: Likewise.
8599 * output.cc (Output_reloc::Output_reloc): Add four new versions
8600 for absolute relocs and target specific relocs.
8601 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8602 (Output_reloc::get_symbol_index): Likewise.
8603 (Output_reloc::local_section_offset): Check that local_sym_index_
8604 is not TARGET_CODE or 0.
8605 (Output_reloc::symbol_value): Likewise.
8606 (Output_reloc::write) [SHT_RELA]: Call target for target specific
8607 reloc.
8608 * target.h (class Target): Add reloc_symbol_index and reloc_addend
8609 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
8610 functions.
8611 * layout.cc (add_target_dynamic_tags): Use output section for
8612 DT_PLTRELSZ and DT_JMPREL.
8613
8614 2010-01-07 Ian Lance Taylor <iant@google.com>
8615
8616 PR 11061
8617 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8618 function.
8619 (class Output_data_reloc_generic): Define.
8620 (class Output_data_reloc_base): Change base class to
8621 Output_data_reloc_generic. Change add() method to call
8622 bump_relative_reloc_count for a relative reloc. Remove
8623 sort_relocs_ field.
8624 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8625 to sort_relocs().
8626 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8627 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
8628 appropriate.
8629 * layout.h (class Layout): Update declaration.
8630
8631 2010-01-07 Ian Lance Taylor <iant@google.com>
8632
8633 * output.h (class Output_data): Add const version of
8634 output_section and do_output_section.
8635 (class Output_section_data): Add const version of
8636 do_output_section.
8637 (class Output_section): Likewise.
8638 * layout.cc (Layout::add_target_dynamic_tags): New function.
8639 * layout.h (class Layout): Update declarations.
8640 * arm.cc (Target_arm::do_finalize_sections): Use
8641 add_target_dynamic_tags.
8642 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8643 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8644 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8645 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8646
8647 2010-01-07 Ian Lance Taylor <iant@google.com>
8648
8649 PR 11042
8650 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8651 object as needed.
8652
8653 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
8654 Ian Lance Taylor <iant@google.com>
8655
8656 PR 11019
8657 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8658 Xindex::read_symtab_xindex.
8659
8660 2010-01-07 Doug Kwan <dougkwan@google.com>
8661
8662 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8663 (Insn_template::thumb16_bcond_insn): New method declaration.
8664 (Insn_template): Fix spelling.
8665 (Stub::thumb16_special): New method declaration.
8666 (Stub::do_write): Define virtual method which was previously pure
8667 virtual.
8668 (Stub::do_thumb16_special): New method declaration.
8669 (Stub::do_fixed_endian_write): New template member.
8670 (Reloc_stub::do_write): Remove.
8671 (Reloc_stub::do_fixed_endian_write): Remove.
8672 (Cortex_a8_stub): New class definition.
8673 (Stub_factory::make_cortex_a8_stub): New method definition.
8674 (Stub_factory::Stub_factory): Add missing static storage class
8675 qualifier for elf32_arm_stub_a8_veneer_blx.
8676
8677 2010-01-07 Ian Lance Taylor <iant@google.com>
8678
8679 PR 10980
8680 * options.h (class General_options): Add --warn-unresolved-symbols
8681 and --error-unresolved-symbols.
8682 * errors.cc (Errors::undefined_symbol): Implement
8683 --warn-unresolved-symbols.
8684
8685 * options.h (class General_options): Add -z text and -z textoff.
8686 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8687
8688 2010-01-06 Sriraman Tallam <tmsriram@google.com>
8689
8690 * gc.h (Garbage_collection::Cident_section_map): New typedef.
8691 (Garbage_collection::cident_sections): New function.
8692 (Garbage_collection::add_cident_section): New function.
8693 (Garbage_collection::cident_sections_): New member.
8694 (gc_process_relocs): Add references to sections whose names are C
8695 identifiers.
8696 * gold.h (cident_section_start_prefix): New constant.
8697 (cident_section_stop_prefix): New constant.
8698 (is_cident): New function.
8699 * layout.cc (Layout::define_section_symbols): Replace string constants
8700 with the newly defined constants.
8701 * object.cc (Sized_relobj::do_layout): Track sections whose names are
8702 C identifiers.
8703 * testsuite/Makefile.am: Add gc_orphan_section_test.
8704 * testsuite/Makefile.in: Regenerate.
8705 * testsuite/gc_orphan_section_test.cc: New file.
8706 * testsuite/gc_orphan_section_test.sh: New file.
8707
8708 2010-01-06 Ian Lance Taylor <iant@google.com>
8709
8710 PR 10980
8711 * options.h (class General_options): Add --warn-shared-textrel.
8712 * layout.cc (Layout::finish_dynamic_section): Implement
8713 --warn-shared-textrel.
8714
8715 PR 10980
8716 * options.h (class General_options): Add --warn-multiple-gp.
8717
8718 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8719
8720 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8721 $(THREADSLIB) and $(LIBDL).
8722 * Makefile.in: Rebuild.
8723
8724 2010-01-06 Ian Lance Taylor <iant@google.com>
8725
8726 PR 10980
8727 * options.cc (General_options::parse_section_start): New function.
8728 (General_options::section_start): New function.
8729 (General_options::General_options): Initialize all members.
8730 * options.h: Include <map>
8731 (class General_options): Add --section-start. Add section_starts_
8732 member.
8733 * layout.cc (Layout::attach_allocated_section_to_segment): If
8734 --section-start was used, set the address of the segment. Remove
8735 local sort_sections.
8736 (Layout::relaxation_loop_body): If the address of the load segment
8737 has been set by --section-start, don't use it.
8738 * output.h (Output_segment::update_flags_for_output_section): New
8739 function.
8740 * output.cc (Output_segment::add_output_section): Call
8741 update_flags_for_output_section.
8742
8743 2010-01-05 Ian Lance Taylor <iant@google.com>
8744
8745 PR 10980
8746 * options.h (class General_options): Add --undefined-version.
8747 * script.cc (struct Version_expression): Add was_matched_by_symbol
8748 field.
8749 (Version_script_info::matched_symbol): New function.
8750 (Version_script_info::get_symbol_version_helper): Call
8751 matched_symbol.
8752 (Version_script_info::check_unmatched_names): New function.
8753 * script.h (class Version_script_info): Update declarations.
8754 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8755
8756 * options.h (class General_options): Use DEFINE_bool_alias for
8757 allow_multiple_definition.
8758 * resolve.cc (Symbol_table::should_override): Don't test
8759 allow_multiple_definition.
8760
8761 PR 10980
8762 * options.h (class General_options): Add --cref.
8763 * main.cc (main): Print cref table if --cref. Don't close mapfile
8764 until after printing cref table.
8765 * cref.cc: Include "symtab.h".
8766 (class Cref_inputs): Define Cref_table_compare and Cref_table.
8767 (Cref_table_compare::operator()): New function.
8768 (Cref_inputs::gather_cref): New function.
8769 (filecol): New static const.
8770 (Cref_inputs::print_cref): New function.
8771 (Cref::print_cref): New function.
8772 * cref.h: Include <cstdio>.
8773 (class Cref): Update declarations.
8774 * mapfile.h (Mapfile::file): New function.
8775 * object.h (class Object): Define Symbols. Declare virtual
8776 do_get_global_symbols.
8777 (Object::get_global_symbols): New function.
8778 * object.cc (Input_objects::add_object): Pass object to cref_ if
8779 --cref.
8780 (Input_objects::archive_start): Likewise.
8781 (Input_objects::archive_stop): Likewise.
8782 (Input_objects::print_cref): New function.
8783 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8784 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8785 --cref.
8786 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8787 function.
8788 * plugin.h (class Sized_pluginobj): Update declarations.
8789
8790 2010-01-05 Ian Lance Taylor <iant@google.com>
8791
8792 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8793 to is_default_version. Rename insdef to insdefault.
8794 (Symbol_table::add_from_relobj): Rename def to is_default_version
8795 and local to is_forced_local.
8796 (Symbol_table::add_from_pluginobj): Likewise.
8797 (Symbol_table::add_from_dynobj): Likewise.
8798 (Symbol_table::define_special_symbol): Rename insdef to
8799 insdefault.
8800
8801 2010-01-04 Ian Lance Taylor <iant@google.com>
8802
8803 PR 10980
8804 * options.h (class General_options): Add
8805 --allow-multiple-definition and -z muldefs.
8806 * resolve.cc (Symbol_table::should_override): Don't warn about a
8807 multiple symbol definition if --allow-multiple-definition or -z
8808 muldefs.
8809
8810 PR 10980
8811 * options.h (class General_options): Add --add-needed and
8812 --copy-dt-needed-entries. Tweak --as-needed help entry.
8813 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8814 error if --copy-dt-needed-entries aka --add-needed is used and
8815 would cause a change in behaviour.
8816
8817 PR 10980
8818 * options.h (class General_options): Add -G as a short version of
8819 --shared. Add no-op options -assert, -g, and -i.
8820
8821 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8822
8823 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8824 check for .text or .gnu.linkonce.t sections.
8825 * icf.cc (Icf::find_identical_sections): Ditto.
8826 Change the detection for mangled function name within the section
8827 name.
8828 * icf.h (is_section_foldable_candidate): New function.
8829
8830 2009-12-30 Ian Lance Taylor <iant@google.com>
8831
8832 PR 10980
8833 * options.h (class General_options): Permit two dashes with
8834 --retain-symbols-file.
8835
8836 2009-12-30 Ian Lance Taylor <iant@google.com>
8837
8838 PR 10979
8839 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8840 don't put the file header and segment headers in the text
8841 segment.
8842
8843 PR 10979
8844 * common.cc (Sort_commons::operator()): Stabilize sort when both
8845 entries are NULL.
8846 (Symbol_table::do_allocate_commons_list): When allocating common
8847 symbols, skip a symbol which is no longer common.
8848 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8849 an object before checking its type.
8850 * testsuite/common_test_2.c: New file.
8851 * testsuite/common_test_3.c: New file.
8852 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8853 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8854 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8855 (common_test_2_pic.o, common_test_2.so): New targets.
8856 (common_test_3_pic.o, common_test_3.so): New targets.
8857 * testsuite/Makefile.in: Rebuild.
8858
8859 PR 10979
8860 * script.cc (read_input_script): If we see a new SECTIONS clause,
8861 and we have added an input section, give an error.
8862 * layout.h (class Layout): Add have_added_input_section function.
8863 Add have_added_input_section_ field.
8864 * layout.cc (Layout::Layout): Initialize
8865 have_added_input_section_.
8866 (Layout::layout): Set have_added_input_section_.
8867 (Layout::layout_eh_frame): Likewise.
8868
8869 2009-12-30 Ian Lance Taylor <iant@google.com>
8870
8871 PR 10931
8872 * options.h (class General_options): Add --sort-common option.
8873 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8874 * common.cc (Sort_common): Add sort_order parameter to
8875 constructor. Add sort_order_ field.
8876 (Sort_commons::operator): Check sort_order_.
8877 (Symbol_table::allocate_commons): Determine the sort order.
8878 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8879 Change all callers.
8880 (Symbol_table::do_allocate_commons_list): Likewise.
8881
8882 2009-12-30 Ian Lance Taylor <iant@google.com>
8883
8884 PR 10916
8885 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8886 symbols from this object, don't change the visibility of an
8887 undefined symbol.
8888 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8889
8890 2009-12-30 Ian Lance Taylor <iant@google.com>
8891
8892 PR 10861
8893 * script.h (class Version_script_info): Define Language enum.
8894 Update declarations. Define Glob, Exact, and Lookup types. Add
8895 new fields globals_, locals_, and is_finalized_.
8896 * script.cc: Various formatting fixes.
8897 (class Parser_closure): Change language_stack_ from a vector of
8898 std::string to one of Version_script_info::Language. Adjust all
8899 uses accordingly.
8900 (class Lazy_demangler): Remove.
8901 (struct Version_expression): Change language from std::string to
8902 Version_script_info::Language.
8903 (Version_script_info::Version_script_info): New function.
8904 (Version_script_info::~Version_script_info): Don't call clear.
8905 (Version_script_info::finalize): New function.
8906 (Version_script_info::build_lookup_tables): New function.
8907 (Version_script_info::build_expression_list_lookup): New
8908 function.
8909 (Version_script_info::get_symbol_version_helper): Rewrite to use
8910 lookup tables.
8911 (Version_script_info::print_expression_list): Adjust to use
8912 Version_script_info::Language.
8913 (script_push_lex_into_version_mode): Check that the version script
8914 has not been finalized.
8915 (version_script_push_lang): Change language string to
8916 Version_script_info::Language.
8917 * options.cc (Command_line::version_script): New function.
8918 * options.h (class General_options): Add finalize_dynamic_list
8919 function. Change version_script from declaration to definition.
8920 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8921 * testsuite/version_script.map: Remove duplicate def of foo.
8922 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8923 version_script.map.
8924 * testsuite/Makefile.in: Rebuild.
8925
8926 2009-12-30 Ian Lance Taylor <iant@google.com>
8927
8928 PR 10843
8929 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8930 if the input symbol index is 0, make the output symbol index 0.
8931
8932 2009-12-30 Ian Lance Taylor <iant@google.com>
8933
8934 PR 10670
8935 * options.h (class General_options): Add -x/--discard-all.
8936 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8937 --discard-all. If the local symbol needs a dynamic entry, check
8938 that before handling --discard-locals.
8939
8940 2009-12-30 Ian Lance Taylor <iant@google.com>
8941
8942 PR 10450
8943 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8944 flags to PF_R.
8945 (Output_segment::add_output_section): Don't change the flags if
8946 the type is PT_TLS.
8947
8948 PR 10450
8949 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8950 GNU hash table if they need a dynamic value. Otherwise, don't add
8951 them if they are defined in a dynamic object or are forced local.
8952
8953 2009-12-29 Ian Lance Taylor <iant@google.com>
8954
8955 PR 10450
8956 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8957 .gnu.hash table for a 32-bit target.
8958
8959 PR 10450
8960 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8961 regular and a dynamic object only needs a dynamic symbol table
8962 entry if it is externally visible.
8963
8964 PR 10450
8965 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8966 constructor. Add global_offset_table_ field.
8967 (Target_i386::got_section): Set global_offset_table_.
8968 (Target_i386::do_finalize_sections): Set global_offset_table_
8969 size.
8970 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8971 in constructor. Add global_offset_table_ field.
8972 (Target_x86_64::got_section): Set global_offset_table_.
8973 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8974 size.
8975
8976 * layout.cc (Layout::Layout): Initialize increase_relro_.
8977 (Layout::get_output_section): Add is_relro, is_last_relro, and
8978 is_first_non_relro parameters. Change all callers.
8979 (Layout::choose_output_section): Likewise.
8980 (Layout::add_output_section_data): Likewise.
8981 (Layout::make_output_section): Likewise.
8982 (Layout::set_segment_offsets): Clear increase_relro when using a
8983 linker script.
8984 * layout.h (class Layout): Add increase_relro method. Add
8985 increase_relro_ field. Update declarations.
8986 * output.cc (Output_section::Output_section): Initialize
8987 is_last_relro_ and is_first_non_relro_.
8988 (Output_segment::add_output_section): Group relro sections is
8989 do_sort is true. Handle is_last_relro and is_first_non_relro.
8990 (Output_segment::maximum_alignment): Remove relro handling.
8991 (Output_segment::set_section_addresses): Add increase_relro
8992 parameter. Change all callers. Add initial alignment to align
8993 relro sections on separate page. Remove old relro handling.
8994 (Output_segment::set_section_list_addresses): Remove in_relro
8995 parameter. Change all callers.
8996 (Output_segment::set_offset): Add increase parameter. Change all
8997 callers. Remove old relro handling.
8998 * output.h (class Output_section): Add new methods: is_last_relro,
8999 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9000 Add is_last_relro_ and is_first_non_relro_ fields.
9001 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9002 Create separate .got.plt section. Call increase_relro.
9003 * x86_64.cc (Target_x86_64::got_section): Likewise.
9004 * testsuite/relro_script_test.t: Add .got.plt.
9005
9006 PR 10450
9007 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9008 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9009 (Layout::finalize): Call set_dynamic_symbol_size.
9010 (Layout::set_dynamic_symbol_size): New function.
9011 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
9012 set_dynamic_symbol_size.
9013
9014 PR 10450
9015 * output.h (class Output_section): Add is_entsize_zero_ field.
9016 * output.cc (Output_section::Output_section): Initialize
9017 is_entsize_zero_.
9018 (Output_section::set_entsize): If two different entsizes are
9019 requested, force it to zero.
9020 (Output_section::add_input_section): Set flags for .debug_str
9021 before updating section flags. Set entsize.
9022 (Output_section::update_flags_for_input_section): Set SHF_MERGE
9023 and SHF_STRING if all input sections have those flags.
9024
9025 2009-12-29 Rafael Espindola <espindola@google.com>
9026
9027 * main.cc (main): Fix the sys time reporting.
9028 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9029 reporting.
9030
9031 2009-12-29 Sriraman Tallam <tmsriram@google.com>
9032
9033 * options.cc (General_options::parse_version): Allow -v to exit
9034 without an error if there is nothing to link.
9035
9036 2009-12-29 Ian Lance Taylor <iant@google.com>
9037
9038 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9039 using a version of gcc before 4.1.
9040 * configure: Rebuild.
9041
9042 2009-12-28 Chris Demetriou <cgd@google.com>
9043
9044 * attributes.cc (Output_attributes_section_data::do_write): Use
9045 std::vector::front rather than std::vector::data.
9046
9047 2009-12-28 Ian Lance Taylor <iant@google.com>
9048
9049 * symtab.h (class Symbol_table): Add enum Defined.
9050 * resolve.cc (Symbol_table::should_override): Add defined
9051 parameter. Change all callers. Test whether object is NULL
9052 before calling a method on it.
9053 (Symbol_table::report_resolve_problem): Add defined parameter.
9054 Change all callers.
9055 (Symbol_table::should_override_with_special): Likewise.
9056 * symtab.cc (Symbol_table::define_in_output_data): Add defined
9057 parameter. Change all callers.
9058 (Symbol_table::do_define_in_output_data): Likewise.
9059 (Symbol_table::define_in_output_segment): Likewise.
9060 (Symbol_table::do_define_in_output_segment): Likewise.
9061 (Symbol_table::define_as_constant): Likewise.
9062 (Symbol_table::do_define_as_constant): Likewise.
9063 * script.h (class Symbol_assignment): Add is_defsym parameter to
9064 constructor; change all callers.
9065 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9066 parameter. Change all callers. Add is_defsym_ field.
9067 (class Parser_closure): Add parsing_defsym parameter to
9068 constructor; change all callers. Add parsing_defsym accessor
9069 function. Add parsing_defsym_ field.
9070
9071 2009-12-28 Ian Lance Taylor <iant@google.com>
9072
9073 * gold.cc (queue_middle_tasks): Fix formatting.
9074 * object.cc (Relobj::is_section_name_included): Likewise.
9075
9076 2009-12-23 Ian Lance Taylor <iant@google.com>
9077
9078 * i386.cc (Target_i386::do_calls_non_split): Recognize
9079 -fsplit-stack prologue for a function with a static chain.
9080 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9081 -fsplit-stack prologue when using %r11.
9082
9083 2009-12-21 Sriraman Tallam <tmsriram@google.com>
9084
9085 * options.cc (General_options::parse_version): Make -v continue and do
9086 the link like GNU ld does.
9087
9088 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
9089
9090 * Makefile.am (CCFILES): Add timer.cc.
9091 (HFILES): Add timer.h.
9092 * configure.ac: Check for sysconf and times.
9093 * main.cc: include timer.h.
9094 (main): Use Timer instead of get_run_time.
9095 * timer.cc: New.
9096 * timer.h: New.
9097 * workqueue.cc: include timer.h.
9098 (Workqueue::find_and_run_task):
9099 Report user, sys and wall time.
9100 * Makefile.in: Regenerate.
9101 * config.in: Regenerate.
9102 * configure: Regenerate.
9103
9104 2009-12-16 Doug Kwan <dougkwan@google.com>
9105
9106 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9107 sections.
9108 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9109 relaxed input sections.
9110 * output.cc (Output_section::find_relaxed_input_section): Change
9111 return type to Output_relaxed_input_section pointer. Adjust code
9112 for new type of relaxed_input_section_map_.
9113 * output.h (Output_section::find_relaxed_input_section): Change
9114 return type to Output_relaxed_input_section pointer.
9115 (Output_section::Output_relaxed_input_section_by_input_section_map):
9116 New type.
9117 (Output_section::relaxed_input_section_map_): Change type to
9118 Output_section::Output_relaxed_input_section_by_input_section_map.
9119 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9120 input section.
9121
9122 2009-12-15 Ian Lance Taylor <iant@google.com>
9123
9124 * layout.cc (Layout::create_shstrtab): Only write out after input
9125 sections if we are compressing debug sections.
9126
9127 2009-12-15 Ian Lance Taylor <iant@google.com>
9128
9129 * archive.cc (Archive::add_symbols): Only look up a symbol without
9130 a version if there is, in fact, a version.
9131
9132 2009-12-14 Ian Lance Taylor <iant@google.com>
9133
9134 Revert -Wshadow changes, all changes from:
9135 2009-12-11 Doug Kwan <dougkwan@google.com>
9136 2009-12-11 Nick Clifton <nickc@redhat.com>
9137 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9138
9139 2009-12-11 Doug Kwan <dougkwan@google.com>
9140
9141 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9142 due to -Wshadow.
9143 * attributes.cc (Object_attribute::size): Ditto.
9144 (Attributes_section_data::size): Ditto.
9145 (Attributes_section_data::Attributes_section_data): Ditto.
9146 (Output_attributes_section_data::do_write): Ditto.
9147 * attributes.h (Object_attribute::set_type): Ditto.
9148 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9149
9150 2009-12-11 Nick Clifton <nickc@redhat.com>
9151
9152 * archive.cc: Fix shadowed variable warnings.
9153 * arm.cc: Likewise.
9154 * compressed_output.cc: Likewise.
9155 * compressed_output.h: Likewise.
9156 * configure: Likewise.
9157 * dwarf_reader.cc: Likewise.
9158 * dynobj.cc: Likewise.
9159 * dynobj.h: Likewise.
9160 * ehframe.cc: Likewise.
9161 * ehframe.h: Likewise.
9162 * errors.cc: Likewise.
9163 * expression.cc: Likewise.
9164 * fileread.cc: Likewise.
9165 * fileread.h: Likewise.
9166 * freebsd.h: Likewise.
9167 * i386.cc: Likewise.
9168 * icf.cc: Likewise.
9169 * incremental.h: Likewise.
9170 * layout.cc: Likewise.
9171 * layout.h: Likewise.
9172 * mapfile.cc: Likewise.
9173 * merge.cc: Likewise.
9174 * merge.h: Likewise.
9175 * object.cc: Likewise.
9176 * object.h: Likewise.
9177 * options.h: Likewise.
9178 * output.cc: Likewise.
9179 * output.h: Likewise.
9180 * parameters.cc: Likewise.
9181 * plugin.cc: Likewise.
9182 * powerpc.cc: Likewise.
9183 * reduced_debug_output.cc: Likewise.
9184 * reduced_debug_output.h: Likewise.
9185 * reloc.cc: Likewise.
9186 * reloc.h: Likewise.
9187 * resolve.cc: Likewise.
9188 * script-sections.cc: Likewise.
9189 * script.cc: Likewise.
9190 * script.h: Likewise.
9191 * sparc.cc: Likewise.
9192 * symtab.cc: Likewise.
9193 * symtab.h: Likewise.
9194 * target-select.cc: Likewise.
9195 * target-select.h: Likewise.
9196 * token.h: Likewise.
9197 * workqueue.cc: Likewise.
9198 * workqueue.h: Likewise.
9199 * x86_64.cc: Likewise.
9200
9201 2009-12-10 Doug Kwan <dougkwan@google.com>
9202
9203 * arm.cc (attributes.h): New include.
9204 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9205 (Arm_relobj::~Arm_relobj): Delete object pointed by
9206 attributes_section_data_.
9207 (Arm_relobj::attributes_section_data): New method definition.
9208 (Arm_relobj::attributes_section_data_): New data member declaration.
9209 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9210 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9211 attributes_section_data_.
9212 (Arm_dynobj::attributes_section_data): New method definition.
9213 (Arm_dynobj::attributes_section_data_): New data member declaration.
9214 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
9215 initialization value of may_use_blx_ to false.
9216 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9217 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9218 object attributes to compute results instead of hard-coding.
9219 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9220 Target_arm::get_secondary_compatible_arch,
9221 Target_arm::set_secondary_compatible_arch
9222 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9223 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9224 New method declarations.
9225 (Target_arm::get_aeabi_object_attribute): New method definition.
9226 (Target_arm::attributes_section_data_): New data member declaration.
9227 (read_arm_attributes_section): New template definition.
9228 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9229 (Arm_dynobj::do_read_symbols): Ditto.
9230 (Target_arm::do_finalize_sections): Merge attributes sections from
9231 input. Check for BLX use after attributes section merging.
9232 Fix __exidx_start and __exidx_end visibility. Create an
9233 .ARM.attributes section if necessary.
9234 (Target_arm::get_secondary_compatible_arch,
9235 Target_arm::set_secondary_compatible_arch,
9236 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9237 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9238 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9239 New method definitions.
9240
9241 2009-12-09 Ian Lance Taylor <iant@google.com>
9242
9243 * plugin.cc (Plugin::load): Don't cast from void* to a function
9244 pointer.
9245
9246 2009-12-09 Ian Lance Taylor <iant@google.com>
9247
9248 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9249 information fields.
9250
9251 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
9252
9253 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9254 Replace two_file_shared_1.so with two_file_shared_2.so.
9255 * testsuite/Makefile.in: Regenerated.
9256
9257 2009-12-08 Doug Kwan <dougkwan@google.com>
9258
9259 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9260 (HFILES): Add attributes.h and int_encoding.h.
9261 * Makefile.in: Regenerate.
9262 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9263 function definitions to int_encoding.cc
9264 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9265 prototypes to int_encoding.h
9266 * reduced_debug_output.cc (int_encoding.h): New include.
9267 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9268 function definitions to int_encoding.cc
9269 (insert_into_vector, read_from_pointer): Move template definitions to
9270 int_encoding.h
9271 * attributes.cc: New file.
9272 * attributes.h: New file.
9273 * int_encoding.cc: New file.
9274 * int_encoding.h: New file.
9275
9276 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
9277
9278 PR gold/11055
9279 * incremental-dump.cc (dump_incremental_inputs): New.
9280 (main): Use dump_incremental_inputs.
9281
9282 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
9283
9284 PR gold/10893
9285 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9286 checking elfcpp::STT_FUNC.
9287 (Target_i386::Relocate::relocate): Likewise.
9288 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9289
9290 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9291 symbols from shared libraries into normal FUNC symbols.
9292
9293 * symtab.h (Symbol): Add is_func and use it.
9294
9295 2009-12-05 Doug Kwan <dougkwan@google.com>
9296
9297 * arm.cc (Target_arm::arm_info): Initialize new fields
9298 attributes_section and attributes_vendor.
9299 * i386.cc (Target_i386::i386_info): Same.
9300 * object.cc (Sized_relobj::do_layout): Skip attribute section.
9301 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9302 fields attributes_section and attributes_vendor.
9303 * sparc.cc (Target_sparc::sparc_info): Same.
9304 * target.h (Target::attributes_section, Target::attributes_vendor,
9305 Target::is_attributes_section, Target::attribute_arg_type,
9306 Target::attributes_order): New method definitions.
9307 (Target::Target_info::attributes_section,
9308 Target::Target_info::attributes_vendor): New fields.
9309 (Target::do_attribute_arg_type, Target::do_attributes_order): New
9310 virtual method definitions.
9311 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9312 attributes_section and attributes_vendor.
9313 * testsuite/testfile.cc (Target_test::test_target_info): Same.
9314
9315 2009-12-05 Doug Kwan <dougkwan@google.com>
9316
9317 * arm.cc: Update comments about interworking and stub generation.
9318 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9319 considered as non-PIC.
9320 (Arm_relocate_functions::base_abs): Fix formatting.
9321 (Arm_relocate_functions::got_prel): Fix comment. Change interface
9322 of function to use GOT entry address instead of offset.
9323 (Target_arm::Scan::global): Issue an error if a symbol would need a
9324 PLT does not get one because it is untyped. Remove code to create
9325 dynamic symbols for relative branches.
9326 (Target_arm::Relocate::relocate: Use 0 instead of false since function
9327 takes unsigned integer instead of boolean.
9328
9329 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
9330
9331 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9332 (two_file_test_LDADD): Likewise.
9333 (common_test_1_LDADD): Likewise.
9334 (exception_test_LDADD) Likewise.
9335 (weak_test_LDADD): Likewise.
9336 (many_sections_test_LDADD): Likewise.
9337 (initpri1_LDADD): Likewise.
9338 (script_test_1_LDADD): Likewise.
9339 (script_test_2_LDADD): Likewise.
9340 (justsyms_LDADD): Likewise.
9341 (binary_test_LDADD): Likewise.
9342 (large_LDADD): Likewise.
9343 * testsuite/Makefile.in: Regenerated.
9344
9345 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
9346
9347 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9348 (Symbol_table::override_with_special): Likewise.
9349 (Symbol_table::add_from_object): Likewise.
9350
9351 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9352
9353 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9354 Don't set the data_offset twice.
9355
9356 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9357
9358 * testsuite/Makefile.in: Regenerate.
9359
9360 2009-12-03 Doug Kwan <dougkwan@google.com>
9361
9362 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9363 (Target_arm::do_finalize_sections): Add parameter for symbol table
9364 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
9365 * i386.cc (Target_i386::do_finalize_sections): Add an additional
9366 parameter for symbol table pointer.
9367 * layout.cc (Layout::finalize): Call Target::finalize_sections with
9368 an additional parameter for a pointer to symbol table.
9369 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9370 parameter for a symbol table pointer.
9371 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9372 * target.h (Target::finalize_sections, Target::do_finalize_sections):
9373 Ditto.
9374 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9375 parameter for a symbol table pointer.
9376
9377 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
9378
9379 * incremental.cc (Incremental_inputs_header)
9380 (Incremental_inputs_header_write, Incremental_inputs_entry)
9381 (Incremental_inputs_entry_write): Move ...
9382 * incremental.h (Incremental_inputs_header)
9383 (Incremental_inputs_header_write, Incremental_inputs_entry)
9384 (Incremental_inputs_entry_write): here.
9385
9386 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9387
9388 * incremental.cc (make_sized_incremental_binary): Set the target.
9389 Error if it is incompatible.
9390 * output.h (Output_file): Add filename method.
9391
9392 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9393
9394 * incremental.cc (Incremental_inputs_entry): Remove unused argument
9395 from the get_* methods.
9396
9397 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9398
9399 * incremental-dump.cc (main): Check that the offeset of a script is 0.
9400 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9401 Write 0 for the data_offset of scripts.
9402
9403 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9404
9405 * testsuite/Makefile.am: Add the incremental_test.sh test.
9406 * testsuite/incremental_test.sh: New.
9407 * testsuite/incremental_test_1.c: New.
9408 * testsuite/incremental_test_2.c: New.
9409
9410 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
9411
9412 * incremental-dump.cc (main): Fix typos.
9413
9414 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
9415
9416 PR gold/11025
9417 * incremental-dump.cc (main): Use llu to print 64 bit values.
9418
9419 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
9420 H.J. Lu <hongjiu.lu@intel.com>
9421
9422 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9423 $(LIBDL).
9424 (incremental_dump_LDADD): Likewise.
9425 * Makefile.in: Regenerated.
9426
9427 2009-11-25 Doug Kwan <dougkwan@google.com>
9428
9429 Revert:
9430
9431 2009-11-25 Doug Kwan <dougkwan@google.com>
9432
9433 * arm.cc (Target_arm::Target_arm): Move method definition
9434 outside of class definition. Add code to handle
9435 --target1-rel, --target1-abs and --target2= options.
9436 (Target_arm::get_reloc_reloc_type): Change method to be
9437 non-static and const.
9438 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9439 New data member declaration.
9440 (Target_arm::Scan::local, Target_arm::Scan::global,
9441 Target_arm::Relocate::relocate,
9442 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9443 Adjust call to Target_arm::get_real_reloc_type.
9444 (Target_arm::get_real_reloc_type): Use command line options
9445 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9446 * options.h (--target1-rel, --target1-abs, --target2): New
9447 ARM-only options.
9448
9449 2009-11-25 Doug Kwan <dougkwan@google.com>
9450
9451 * arm.cc (Target_arm::Target_arm): Move method definition outside of
9452 class definition. Add code to handle --target1-rel, --target1-abs
9453 and --target2= options.
9454 (Target_arm::get_reloc_reloc_type): Change method to be non-static
9455 and const.
9456 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9457 member declaration.
9458 (Target_arm::Scan::local, Target_arm::Scan::global,
9459 Target_arm::Relocate::relocate,
9460 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9461 call to Target_arm::get_real_reloc_type.
9462 (Target_arm::get_real_reloc_type): Use command line options to
9463 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9464 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9465 options.
9466
9467 2009-11-25 Doug Kwan <dougkwan@google.com>
9468
9469 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9470 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9471 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9472 formatting.
9473 (Arm_relocate_functions::thm_call): Replace body with a call to
9474 Arm_relocate_functions::thumb_branch_common.
9475 (Arm_relocate_functions::thm_jump24,
9476 Arm_relocate_functions::thm_xpc22): New method definitions.
9477 (Arm_relocate_functions::thumb_branch_common): New method definition.
9478 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9479 operator.
9480 (Target_arm::Relocate::relocate): Adjust call to thm_call.
9481 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9482
9483 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9484
9485 * Makefile.am: Build incremental-dump
9486 * Makefile.in: Regenerate.
9487 * incremental-dump.cc: New.
9488 * incremental.cc (Incremental_inputs_header_data,
9489 Incremental_inputs_entry_data): Move to incremental.h
9490 * incremental.h: (Incremental_inputs_header_data,
9491 Incremental_inputs_entry_data): Move from incremental.cc
9492
9493 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9494
9495 * incremental.cc (Incremental_inputs_header,
9496 Incremental_inputs_header_write, Incremental_inputs_entry,
9497 Incremental_inputs_entry_write): Add a typedef with the data type.
9498
9499 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9500
9501 * incremental.cc (Incremental_inputs_header,
9502 Incremental_inputs_header_write, Incremental_inputs_entry,
9503 Incremental_inputs_entry_write): Update comment about which
9504 type has the filed descriptions.
9505
9506 2009-11-15 Doug Kwan <dougkwan@google.com>
9507
9508 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9509 (Arm_relocate_functions::arm_branch_common): Change method defintion
9510 in class definition to a method declaration and update list of formal
9511 parameters.
9512 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9513 Arm_relocation_functions::jump24): Adjust call to
9514 Arm_relocate_functions::arm_branch_common. Update list of formal
9515 parameters.
9516 (Arm_relocate_functions::xpc25): New method definition.
9517 (Arm_relocate_functions::arm_branch_common): Move method defintion
9518 out from class definition. Use stubs for mode-switching and extending
9519 branch ranges.
9520 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9521 specially. Change code to enable use of stubs in ARM branches.
9522
9523 2009-11-10 Doug Kwan <dougkwan@google.com>
9524
9525 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9526 in method declaration.
9527 (Target_arm::relocate_stub): New method declaration.
9528 (Target_arm::default_target): Change to return a pointer instead of
9529 a const reference.
9530 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9531 Target_arm::default_target.
9532 (Arm_Relobj::do_relocate_sections): Remove options paramater in
9533 method definition.
9534 (Target_arm::relocate_section): Adjust view.
9535 (Target_arm::relocate_stub): New method definition.
9536
9537 2009-11-10 Doug Kwan <dougkwan@google.com>
9538
9539 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9540 a format warning.
9541 * incremental.cc (open_incremental_binary): Initialized local
9542 variables to avoid warnings.
9543 * object.cc (make_elf_object): Ditto.
9544 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9545 a format warning.
9546
9547 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
9548
9549 PR gold/10930
9550 * testsuite/plugin_test.c: Include "config.h".
9551
9552 2009-11-09 Doug Kwan <dougkwan@google.com>
9553
9554 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9555 (arm_symbol_value): Remove.
9556 (Arm_relocate_functions::arm_branch_common,
9557 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9558 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9559 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9560 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9561 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9562 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9563 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9564 Arm_relocate_functions::thm_mobw_abs_nc,
9565 Arm_relocate_functions::thm_mov_abs,
9566 Arm_relocate_functions::movw_prel_nc,
9567 Arm_relocate_functions::thm_movt_abs,
9568 Arm_relocate_functions::movt_prel,
9569 Arm_relocate_functions::thm_movw_prel_nc,
9570 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9571 (Target_arm::Relocate::relocate): Only decompose address into two
9572 parts if relocation type uses the thumb-bit and pass the actual
9573 bit instead of a flag indicating that the thumb-bit is used. Adjust
9574 calls to methods in Arm_relocate_functions for this change.
9575
9576 2009-11-08 Ian Lance Taylor <iant@google.com>
9577
9578 PR 10925
9579 * reloc.cc: Instantiate
9580 Sized_relobj::initialize_input_to_output_maps and
9581 Sized_relobj:free_input_to_output_maps.
9582
9583 2009-11-06 Ian Lance Taylor <iant@google.com>
9584
9585 PR 10876
9586 * defstd.cc (in_segment): Set only_if_ref true for "end".
9587
9588 2009-11-06 Doug Kwan <dougkwan@google.com>
9589
9590 * arm.cc (class Reloc_stub): Correct a comment.
9591 (Target_arm::Target_arm): Initialize arm_input_section_map_.
9592 (Target_arm::scan_section_for_stubs): New method declaration.
9593 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9594 Change methods from private to protected.
9595 (Target_arm::do_may_relax): New method definition.
9596 (Target_arm::do_relax, Target_arm::group_sections,
9597 Target_arm::scan_reloc_for_stub,
9598 Target_arm::scan_reloc_section_for_stubs): New method declarations.
9599 (Target_arm::arm_input_section_map_): New data member declaration.
9600 (Target_arm::scan_reloc_for_stub,
9601 Target_arm::scan_reloc_section_for_stubs,
9602 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9603 Target_arm::do_relax): New method definitions.
9604
9605 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
9606
9607 * configure.ac: Check for (struct stat)::st_mtim
9608 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9609 * config.in: Regenerate.
9610 * configure: Regenerate.
9611
9612 2009-11-05 Ian Lance Taylor <iant@google.com>
9613
9614 PR 10910
9615 * output.cc (Output_segment::add_output_section): Add missing
9616 return statement.
9617
9618 2009-11-04 Ian Lance Taylor <iant@google.com>
9619
9620 PR 10880
9621 * object.h (class Object): Add is_needed and set_is_needed
9622 methods. Add is_needed_ field. Make bool fields into bitfields.
9623 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9624 defined in a dynamic object and referenced by a regular object,
9625 set is_needed for the dynamic object.
9626 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9627 if the file is marked with as_needed and it is not needed.
9628
9629 2009-11-04 Ian Lance Taylor <iant@google.com>
9630
9631 PR 10887
9632 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9633 tags if data is discarded by linker script.
9634 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9635 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9636 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9637 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9638
9639 2009-11-04 Ian Lance Taylor <iant@google.com>
9640
9641 * layout.cc (Layout::get_output_section): Add is_interp and
9642 is_dynamic_linker_section parameters. Change all callers.
9643 (Layout::choose_output_section): Likewise.
9644 (Layout::make_output_section): Likewise.
9645 (Layout::add_output_section_data): Add is_dynamic_linker_section
9646 parameter. Change all callers.
9647 * layout.h (class Layout): Update declarations.
9648 * output.h (class Output_section): Add is_interp, set_is_interp,
9649 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9650 Add is_interp_, is_dynamic_linker_section_ fields. Change
9651 generate_code_fills_at_write_ to a bitfield.
9652 * output.cc (Output_section::Output_sections): Initialize new
9653 fields.
9654 (Output_segment::add_output_section): Add do_sort parameter.
9655 Change all callers.
9656
9657 2009-11-03 Ian Lance Taylor <iant@google.com>
9658
9659 PR 10860
9660 * options.h (class General_options): Add --warn-common.
9661 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9662 merging two common symbols.
9663 (Symbol_table::should_override): Handle --warn-common when merging
9664 a common symbol with a defined symbol. Use report_resolve_problem
9665 for multiple definitions.
9666 (Symbol_table::report_resolve_problem): New function.
9667 * symtab.h (class Symbol_table): Declare report_resolve_problem.
9668
9669 2009-11-03 Doug Kwan <dougkwan@google.com>
9670
9671 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9672 stub_factory_.
9673 (Target_arm::stub_factory): New method definition.
9674 (Target_arm::new_arm_input_section,
9675 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9676 Target_arm::reloc_uses_thumb_bit): New method declarations.
9677 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9678 New type definitions.
9679 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9680 member declarations.
9681 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9682 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9683 New method definitions.
9684
9685 2009-11-03 Ian Lance Taylor <iant@google.com>
9686
9687 * options.h (class General_options): Add --warn_constructors.
9688
9689 2009-11-03 Ian Lance Taylor <iant@google.com>
9690
9691 PR 10893
9692 * defstd.cc (in_section): Add entries for __rel_iplt_start,
9693 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9694
9695 2009-11-03 Ian Lance Taylor <iant@google.com>
9696
9697 PR 10895
9698 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9699 --msgid-bugs-address.
9700 (install-pdf): New target.
9701 (install-data_yes): Look up one directory to find mkinstalldirs.
9702
9703 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
9704
9705 * po/Make-in (.po.gmo): Don't generate .gmo files in source
9706 tree.
9707
9708 2009-10-30 Doug Kwan <dougkwan@google.com>
9709
9710 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9711
9712 2009-10-30 Doug Kwan <dougkwan@google.com>
9713
9714 * arm.cc (Stub_addend_reader): New struct template definition
9715 and partial specializations.
9716 (Stub_addend_reader::operator()): New method definition for a
9717 partially specialized template.
9718
9719 2009-10-30 Doug Kwan <dougkwan@google.com>
9720
9721 * arm.cc (Arm_relobj::processor_specific_flags): New method
9722 definition.
9723 (Arm_relobj::do_read_symbols): New method declaration.
9724 (Arm_relobj::processor_specific_flags_): New data member declaration.
9725 (Arm_dynobj): New class definition.
9726 (Target_arm::do_finalize_sections): Add input_objects parameter.
9727 (Target_arm::do_adjust_elf_header): New method declaration.
9728 (Target_arm::are_eabi_versions_compatible,
9729 (Target_arm::merge_processor_specific_flags): New method declaration.
9730 (Target_arm::do_make_elf_object): New overloaded method definitions
9731 and declaration.
9732 (Arm_relobj::do_read_symbols): New method definition.
9733 (Arm_dynobj::do_read_symbols): Ditto.
9734 (Target_arm::do_finalize_sections): Add input_objects parameters.
9735 Merge processor-specific flags from all input objects.
9736 (Target_arm::are_eabi_versions_compatible,
9737 Target_arm::merge_processor_specific_flags,
9738 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9739 New method definitions.
9740 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9741 Input_objects pointer type parameter.
9742 * layout.cc (Layout::finalize): Pass input objects to target's.
9743 finalize_sections function.
9744 * output.cc (Output_file_header::do_sized_write): Set ELF file
9745 header's processor-specific flags.
9746 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9747 Input_objects pointer type parameter.
9748 * sparc.cc (Target_sparc::do_finalize_sections): Same.
9749 * target.h (Input_objects): New forward class declaration.
9750 (Target::processor_specific_flags,
9751 Target::are_processor_specific_flags_sect): New method definitions.
9752 (Target::finalize_sections): Add input_objects parameter.
9753 (Target::Target): Initialize processor_specific_flags_ and
9754 are_processor_specific_flags_set_.
9755 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9756 parameter.
9757 (Target::set_processor_specific_flags): New method definition.
9758 (Target::processor_specific_flags_,
9759 Target::are_processor_specific_flags_set_): New data member
9760 declarations.
9761 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9762 Input_objects pointer type parameter.
9763
9764 2009-10-30 Doug Kwan <dougkwan@google.com>
9765
9766 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9767
9768 2009-10-28 Ian Lance Taylor <iant@google.com>
9769
9770 * object.h (class Relobj): Drop options parameter from
9771 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9772 do_scan_relocs, do_relocate. Change all callers.
9773 (class Sized_relobj): Drop options parameters from
9774 do_gc_process_relocs, do_scan_relocs, do_relocate,
9775 do_relocate_sections, relocate_sections, emit_relocs_scan,
9776 emit_relocs_scan_reltype. Change all callers.
9777 (struct Relocate_info): Remove options field and all references to
9778 it.
9779 * reloc.h (class Read_relocs): Remove options constructor
9780 parameter and options_ field. Change all callers.
9781 (class Gc_process_relocs, class Scan_relocs): Likewise.
9782 (class Relocate_task): Likewise.
9783 * target-reloc.h (scan_relocs): Remove options parameter. Change
9784 all callers.
9785 (scan_relocatable_relocs): Likewise.
9786 * target.h (class Sized_target): Remove options parameter from
9787 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9788 all callers.
9789 * gc.h (gc_process_relocs): Remove options parameter. Change all
9790 callers.
9791 * arm.cc: Update functions to remove options parameters.
9792 * i386.cc: Likewise.
9793 * powerpc.cc: Likewise.
9794 * sparc.cc: Likewise.
9795 * x86_64.cc: Likewise.
9796 * testsuite/testfile.cc: Likewise.
9797
9798 2009-10-28 Doug Kwan <dougkwan@google.com>
9799
9800 * arm.cc (Arm_relobj): New class definition.
9801 (Arm_relobj::scan_sections_for_stubs,
9802 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9803 New method definitions.
9804
9805 2009-10-28 Cary Coutant <ccoutant@google.com>
9806
9807 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9808 (Plugin::cleanup_done_): New member.
9809 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9810 (Plugin_manager::cleanup_done_): Remove.
9811 (Plugin_manager::add_input_file): Edit error message.
9812 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9813 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9814
9815 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9816
9817 * fileread.cc: (File_read::View::~View): Use the new
9818 data_ownership_ filed.
9819 (File_read::~File_read): Dispose the new whole_file_view_.
9820 (File_read::open): Mmap the whole file if needed.
9821 (File_read::open): Use whole_file_view_ instead of contents_.
9822 (File_read::find_view): Use whole_file_view_ if applicable.
9823 (File_read::do_read): Use whole_file_view_ instead of contents_.
9824 (File_read::make_view): Use whole_file_view_ instead of contents_,
9825 update File_read::View::View call.
9826 (File_read::find_or_make_view): Update File_read::View::View
9827 call.
9828 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9829 remove contents_
9830 (File_read::View::Data_ownership): New enum.
9831 (File_read::View::View): Replace bool mapped_ with Data_ownership
9832 argument.
9833 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9834 (File_read::View::data_ownership_): New field.
9835 (File_read::contents_): Remove (replaced by whole_file_view_).
9836 (File_read::whole_file_view_): New field.
9837 * options.h (class General_options): Add --keep-files-mapped.
9838
9839 2009-10-27 Cary Coutant <ccoutant@google.com>
9840
9841 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9842 * testsuite/Makefile.am (plugin_test_5): New test case.
9843 * testsuite/Makefile.in: Regenerate.
9844
9845 2009-10-25 Doug Kwan <dougkwan@google.com>
9846
9847 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9848 from private to protected to allow access by child class.
9849 (Sized_relobj::do_relocate_sections): New method declaration.
9850 (Sized_relobj::relocate_sections): Virtualize.
9851 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9852 Sized_relobj::relocate_sections. Instantiate template explicitly
9853 for different target sizes and endianity.
9854
9855 2009-10-24 Doug Kwan <dougkwan@google.com>
9856
9857 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9858 (Arm_input_section::as_arm_input_section): New method.
9859 (Arm_output_section): New class definition.
9860 (Arm_output_section::create_stub_group,
9861 Arm_output_section::group_sections): New method definitions.
9862
9863 2009-10-22 Doug Kwan <dougkwan@google.com>
9864
9865 * arm.cc (Arm_input_section): New class definition.
9866 (Arm_input_section::init, Arm_input_section:do_write,
9867 Arm_input_section::set_final_data_size,
9868 Arm_input_section::do_reset_address_and_file_offset): New method
9869 definitions.
9870
9871 2009-10-21 Doug Kwan <dougkwan@google.com>
9872
9873 * arm.cc (Stub_table, Arm_input_section): New forward class
9874 declarations.
9875 (Stub_table): New class defintion.
9876 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9877 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9878 New method definition.
9879
9880 2009-10-21 Doug Kwan <dougkwan@google.com>
9881
9882 * arm.cc: Update copyright comments.
9883 (Target_arm): New forward class template declaration.
9884 (Arm_address): New type.
9885 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9886 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9887 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9888 constants.
9889 (Insn_template): Same.
9890 (DEF_STUBS): New macro.
9891 (Stub_type): New enum type.
9892 (Stub_template): New class definition.
9893 (Stub): Same.
9894 (Reloc_stub): Same.
9895 (Stub_factory): Same.
9896 (Target_arm::Target_arm): Initialize may_use_blx_ and
9897 should_force_pic_veneer_.
9898 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9899 Target_arm::should_force_pic_veneer,
9900 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9901 Target_arm::using_thumb_only, Target_arm:;default_target): New
9902 method defintions.
9903 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9904 New data member declarations.
9905 (Insn_template::size, Insn_template::alignment): New method defintions.
9906 (Stub_template::Stub_template): New method definition.
9907 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9908 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9909 (Stub_factory::Stub_factory): New method definition.
9910 * gold.h (string_hash): New template.
9911 * output.h (Input_section_specifier::hash_value): Use
9912 gold::string_hash.
9913 (Input_section_specifier::string_hash): Remove.
9914 * stringpool.cc (Stringpool_template::string_hash): Use
9915 gold::string_hash.
9916
9917 2009-10-20 Doug Kwan <dougkwan@google.com>
9918
9919 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9920 symbols of relaxed input sections.
9921 * output.h (Output_section::find_relaxed_input_section): Make
9922 method public.
9923
9924 2009-10-16 Doug Kwan <dougkwan@google.com>
9925
9926 * dynobj.cc (Versions::Versions): Initialize version_script_.
9927 Only insert base version symbol definition for a shared object
9928 if version script defines any version versions.
9929 (Versions::define_base_version): New method definition.
9930 (Versions::add_def): Check that base version is not needed.
9931 (Versions::add_need): Define base version lazily.
9932 * dynobj.h (Versions::define_base_version): New method declaration.
9933 (Versions::needs_base_version_): New data member declaration.
9934 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9935 (check_DATA): Add no_version_test.stdout.
9936 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9937 New make rules.
9938 * testsuite/Makefile.in: Regenerate.
9939 * testsuite/no_version_test.c: New file.
9940 * testsuite/no_version_test.sh: Ditto.
9941
9942 2009-10-16 Doug Kwan <dougkwan@google.com>
9943
9944 * expression.cc (class Segment_start_expression): New class definition.
9945 (Segment_start_expression::value): New method definition.
9946 (script_exp_function_segment_start): Return a new
9947 Segment_start_expression.
9948 * gold/script-c.h (script_saw_segment_start_expression): New function
9949 prototype.
9950 * script-sections.cc (Script_sections::Script_sections): Initialize
9951 SAW_SEGMENT_START_EXPRESSION_ to false.
9952 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9953 and -Tbbs options to specify section addresses if given in
9954 command line and no SEGMENT_START expression is seen in a script.
9955 * script-sections.h (Script_sections::saw_segment_start_expression,
9956 Script_sections::set_saw_segment_start_expression): New method
9957 definition.
9958 (Script_sections::saw_segment_start_expression_): New data member
9959 declaration.
9960 * script.cc (script_saw_segment_start_expression): New function.
9961 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9962 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9963 script_test_7.sh and script_test_8.sh.
9964 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9965 script_test_8.stdout.
9966 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9967 (script_test_6, script_test_6.stdout, script_test_7,
9968 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9969 * Makefile.in: Regenerate.
9970 * testsuite/script_test_6.sh: New file.
9971 * testsuite/script_test_6.t: Same.
9972 * testsuite/script_test_7.sh: Same.
9973 * testsuite/script_test_7.t: Same.
9974 * testsuite/script_test_8.sh: Same.
9975
9976 2009-10-16 Doug Kwan <dougkwan@google.com>
9977
9978 * output.cc (Output_segment::set_section_list_address): Cast
9979 expressions to unsigned long long type to avoid format warnings.
9980
9981 2009-10-15 Ian Lance Taylor <iant@google.com>
9982
9983 * script.cc (Script_options::add_symbol_assignment): Always add a
9984 dot assignment to script_sections_.
9985 * script-sections.cc (Script_sections::add_dot_assignment):
9986 Initialize if necessary.
9987
9988 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9989 program headers with no load segment if there is a linker script.
9990
9991 * layout.cc (Layout::set_segment_offsets): Align the file offset
9992 to the segment aligment for -N or -n with no load segment.
9993 * output.cc (Output_segment::add_output_section): Don't crash if
9994 the first section is a TLS section.
9995 (Output_segment::set_section_list_addresses): Print an error
9996 message if the address moves backward in a linker script.
9997 * script-sections.cc
9998 (Output_section_element_input::set_section_addresses): Don't
9999 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10000 (Orphan_output_section::set_section_addresses): Likewise.
10001
10002 2009-10-15 Doug Kwan <dougkwan@google.com>
10003
10004 * layout.cc (Layout::finish_dynamic_section): Generate tags
10005 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10006 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10007 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10008
10009 2009-10-14 Ian Lance Taylor <iant@google.com>
10010
10011 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10012 fields.
10013 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10014 data_shdr fields of relinfo.
10015 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10016 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
10017 R_386_TLS_LDO_32, adjust based on section flags.
10018 (Target_i386::Relocate::fix_up_ldo): Remove.
10019
10020 2009-10-13 Ian Lance Taylor <iant@google.com>
10021
10022 Add support for -pie.
10023 * options.h (class General_options): Add -pie and
10024 --pic-executable.
10025 (General_options::output_is_position_independent): Test -pie.
10026 (General_options::output_is_executable): Return true if not shared
10027 and not relocatable.
10028 (General_options::output_is_pie): Remove.
10029 * options.cc (General_options::finalize): Reject incompatible uses
10030 of -pie.
10031 * gold.cc (queue_middle_tasks): A -pie link is not static.
10032 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10033 * symtab.cc (Symbol::final_value_is_known): Return false if
10034 output_is_position_independent.
10035 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10036 output_is_position_independent.
10037 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10038 output_is_position_independent.
10039 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10040 output_is_position_independent.
10041 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10042 two_file_pie_test.
10043 (basic_pie_test.o, basic_pie_test): New targets.
10044 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10045 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10046 (two_file_pie_test): New target.
10047 * testsuite/Makefile.in: Rebuild.
10048 * README: Remove note saying that -pie is not supported.
10049
10050 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
10051
10052 * options.h (class General_options): Add -init and -fini.
10053 * layout.cc (Layout::finish_dynamic_section): Emit
10054 given init and fini functions.
10055
10056 2009-10-13 Sriraman Tallam <tmsriram@google.com>
10057
10058 * gc.h (gc_process_relocs): Check if icf is enabled using new
10059 function.
10060 * gold.cc (queue_initial_tasks): Likewise.
10061 (queue_middle_tasks): Likewise.
10062 * object.cc (do_layout): Likewise.
10063 * symtab.cc (is_section_folded): Likewise.
10064 * main.cc (main): Likewise.
10065 * reloc.cc (Read_relocs::run): Likewise.
10066 (Sized_relobj::do_scan_relocs): Likewise.
10067 * icf.cc (is_function_ctor_or_dtor): New function.
10068 (Icf::find_identical_sections): Check if function is ctor or dtor when
10069 safe icf is chosen.
10070 * options.h (General_options::icf): Change option to be an enum.
10071 (Icf_status): New enum.
10072 (icf_enabled): New method.
10073 (icf_safe_folding): New method.
10074 (set_icf_status): New method.
10075 (icf_status_): New variable.
10076 * (options.cc) (General_options::finalize): Set icf_status_.
10077 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10078 icf_test and icf_keep_unique_test to use the --icf enum flag.
10079 * testsuite/icf_safe_test.sh: New file.
10080 * testsuite/icf_safe_test.cc: New file.
10081
10082 2009-10-12 Sriraman Tallam <tmsriram@google.com>
10083
10084 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10085 includes to gc.h and icf.h.
10086 * arm.cc: Include gc.h.
10087 * gold.cc: Likewise.
10088 * i386.cc: Likewise.
10089 * powerpc.cc: Likewise.
10090 * sparc.cc: Likewise.
10091 * x86_64.cc: Likewise.
10092 * gc.h: Include icf.h.
10093
10094 2009-10-11 Ian Lance Taylor <iant@google.com>
10095
10096 * plugin.cc: Include "gold.h" before other header files.
10097
10098 2009-10-10 Chris Demetriou <cgd@google.com>
10099
10100 * options.h (Input_file_argument::Input_file_type): New enum.
10101 (Input_file_argument::is_lib_): Replace with...
10102 (Input_file_argument::type_): New member.
10103 (Input_file_argument::Input_file_argument): Take Input_file_type
10104 'type' rather than boolean 'is_lib' as second argument.
10105 (Input_file_argument::is_lib): Use type_.
10106 (Input_file_argument::is_searched_file): New function.
10107 (Input_file_argument::may_need_search): Handle is_searched_file.
10108 * options.cc (General_options::parse_library): Support -l:filename.
10109 (General_options::parse_just_symbols): Update for Input_file_argument
10110 changes.
10111 (Command_line::process): Likewise.
10112 * archive.cc (Archive::get_file_and_offset): Likewise.
10113 * plugin.cc (Plugin_manager::release_input_file): Likewise.
10114 * script.cc (read_script_file, script_add_file): Likewise.
10115 * fileread.cc (Input_file::Input_file): Likewise.
10116 (Input_file::will_search_for): Handle is_searched_file.
10117 (Input_file::open): Likewise.
10118 * readsyms.cc (Read_symbols::get_name): Likewise.
10119 * testsuite/Makefile.am (searched_file_test): New test.
10120 * testsuite/Makefile.in: Regenerate.
10121 * testsuite/searched_file_test.cc: New file.
10122 * testsuite/searched_file_test_lib.cc: New file.
10123
10124 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10125 Ian Lance Taylor <iant@google.com>
10126
10127 * descriptor.cc: Include <cstdio> and "binary-io.h".
10128 (Descriptors::open): Open the files in binary mode always.
10129 * script.cc (Lex::get_token): Treat \r as whitespace.
10130
10131 2009-10-09 Ian Lance Taylor <iant@google.com>
10132
10133 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10134
10135 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10136 Ian Lance Taylor <iant@google.com>
10137
10138 * configure.ac: Check for readv function also.
10139 * fileread.cc (readv): Define if not HAVE_READV.
10140 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10141 does not exist.
10142 * config.in: Regenerate.
10143 * configure: Regenerate.
10144
10145 2009-10-09 Doug Kwan <dougkwan@google.com>
10146
10147 * layout.cc (Layout::make_output_section): Call target hook to make
10148 ordinary output section.
10149 (Layout::finalize): Adjust parameter list of call the
10150 Target::may_relax().
10151 * layout.h (class Layout::section_list): New method.
10152 * merge.h (Output_merge_base::entsize): Change visibility to public.
10153 (Output_merge_base::is_string, Output_merge_base::do_is_string):
10154 New methods.
10155 (Output_merge_string::do_is_string): New method.
10156 * object.cc (Sized_relobj::do_setup): renamed from
10157 Sized_relobj::set_up.
10158 * object.h (Sized_relobj::adjust_shndx,
10159 Sized_relobj::initializ_input_to_output_maps,
10160 Sized_relobj::free_input_to_output_maps): Change visibilities to
10161 protected.
10162 (Sized_relobj::setup): Virtualize.
10163 (Sized_relobj::do_setup): New method declaration.
10164 (Sized_relobj::invalidate_section_offset,
10165 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10166 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10167 * options.cc (parse_int): New function.
10168 * options.h (parse_int): New declaration.
10169 (DEFINE_int): New macro.
10170 (stub_group_size): New option.
10171 * output.cc (Output_section::Output_section): Initialize memebers
10172 merge_section_map_, merge_section_by_properties_map_,
10173 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10174 (Output_section::add_input_section): Handled deferred code-fill
10175 generation and remove an old comment.
10176 (Output_section::add_relaxed_input_section): New method definition.
10177 (Output_section::add_merge_input_section): Use merge section by
10178 properties map to speed to search. Update merge section maps
10179 as appropriate.
10180 (Output_section::build_relaxation_map): New method definition.
10181 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10182 Same.
10183 (Output_section::relax_input_section): Renamed to
10184 Output_section::convert_input_sections_to_relaxed_sections and change
10185 interface to take a vector of pointers to relaxed sections.
10186 (Output_section::find_merge_section,
10187 Output_section::find_relaxed_input_section): New method definitions.
10188 (Output_section::is_input_address_mapped,
10189 Output_section::output_offset, Output_section::output_address):
10190 Use output section data maps to speed up searching.
10191 (Output_section::find_starting_output_address): Add comments.
10192 (Output_section::do_write,
10193 Output_section::write_to_postprocessing_buffer): Do code-fill
10194 generation as appropriate.
10195 (Output_section::get_input_sections): Invalidate relaxed input section
10196 map.
10197 (Output_section::restore_states): Adjust type of checkpoint .
10198 Invalidate relaxed input section map.
10199 * output.h (Output_merge_base): New class declaration.
10200 (Input_section_specifier): New class defintion.
10201 (class Output_relaxed_input_section) Change base class to
10202 Output_section_data_build.
10203 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10204 base class initializer.
10205 (Output_section::add_relaxed_input_section): New method declaration.
10206 (Output_section::Input_section): Change visibility to protected.
10207 (Output_section::Input_section::relobj,
10208 Output_section::Input_section::shndx): Handle relaxed input sections.
10209 Output_section::input_sections) Change visibility to protected. Also
10210 define overload to return a non-const pointer.
10211 (Output_section::Merge_section_properties): New class defintion.
10212 (Output_section::Merge_section_by_properties_map,
10213 Output_section::Output_section_data_by_input_section_map,
10214 Output_section::Relaxation_map): New types.
10215 (Output_section::relax_input_section): Rename method to
10216 Output_section::convert_input_sections_to_relaxed_sections and change
10217 interface to take a vector of relaxed section pointers.
10218 (Output_section::find_merge_section,
10219 Output_section::find_relaxed_input_section,
10220 Output_section::build_relaxation_map,
10221 Output_section::convert_input_sections_in_list_to_relaxed_sections):
10222 New method declarations.
10223 (Output_section::merge_section_map_
10224 Output_section::merge_section_by_properties_map_,
10225 Output_section::relaxed_input_section_map_,
10226 Output_section::is_relaxed_input_section_map_valid_,
10227 Output_section::generate_code_fills_at_write_): New data members.
10228 * script-sections.cc
10229 (Output_section_element_input::set_section_addresses): Call
10230 current_data_size and addralign methods of relaxed input sections.
10231 (Orphan_output_section::set_section_addresses): Call current_data_size
10232 and addralign methods of relaxed input sections.
10233 * symtab.cc (Symbol_table::compute_final_value): Extract template
10234 from the body of Symbol_table::sized_finalize_symbol.
10235 (Symbol_table::sized_finalized_symbol): Call
10236 Symbol_table::compute_final_value.
10237 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10238 (Symbol_table::compute_final_value): New templated method declaration.
10239 * target.cc (Target::do_make_output_section): New method defintion.
10240 * target.h (Target::make_output_section): New method declaration.
10241 (Target::relax): Add more parameters for input objects, symbol table
10242 and layout. Adjust call to do_relax.
10243 (Target::do_make_output_section): New method declaration.
10244 (Target::do_relax): Add parameters for input objects, symbol table
10245 and layout.
10246
10247 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10248
10249 * pread.c: Include stdio.h.
10250
10251 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10252
10253 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10254 defined.
10255
10256 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10257
10258 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10259 Change read_shndx type to unsigned int.
10260 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10261 int.
10262 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10263 * dwarf_reader.h (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 * layout.cc (Layout::create_symtab_sections): Cast the result of
10269 local_symcount * symsize to off_t in the gold_assert.
10270
10271 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10272
10273 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10274 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10275 R_ARM_BASE_ABS.
10276 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10277 (Arm_relocate_functions::thm_abs5): New function.
10278 (Arm_relocate_functions::abs12): New function.
10279 (Arm_relocate_functions::abs16): New function.
10280 (Arm_relocate_functions::base_abs): New function.
10281 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10282 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
10283 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10284 R_ARM_BASE_ABS.
10285 (Scan::global): Likewise.
10286 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10287 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10288 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10289 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10290 R_ARM_BASE_ABS.
10291
10292 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10293
10294 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10295 (Arm_relocate_functions::movt_prel): New function.
10296 (Arm_relocate_functions::thm_movw_prel_nc): New function.
10297 (Arm_relocate_functions::thm_movt_prel): New function.
10298 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10299 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10300 (Scan::global, Relocate::relocate): Likewise.
10301 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10302
10303 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10304
10305 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10306 Incremental_checker.
10307 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10308 unsigned int.
10309 (class Incremental_inputs_header): New class.
10310 (Incremental_inputs_header_writer): Edit comment.
10311 (Incremental_inputs_entry): New class.
10312 (Incremental_inputs_entry_writer): Edit comment.
10313 (Sized_incremental_binary::do_find_incremental_inputs_section):
10314 Add *strtab_shndx parameter, fill it.
10315 (Sized_incremental_binary::do_check_inputs): New method.
10316 (Incremental_checker::can_incrementally_link_output_file): Use
10317 Sized_incremental_binary::check_inputs.
10318 (Incremental_inputs::report_command_line): Save command line in
10319 command_line_.
10320 * incremental.h:
10321 (Incremental_binary::find_incremental_inputs_section): New
10322 method.
10323 (Incremental_binary::do_find_incremental_inputs_section): Add
10324 strtab_shndx parameter.
10325 (Incremental_binary::do_check_inputs): New pure virtual method.
10326 (Sized_incremental_binary::do_check_inputs): Declare.
10327 (Incremental_checker::Incremental_checker): Add incremental_inputs
10328 parameter, use it to initialize incremental_inputs_.
10329 (Incremental_checker::incremental_inputs_): New field.
10330 (Incremental_checker::command_line): New method.
10331 (Incremental_checker::inputs): New method.
10332 (Incremental_checker::command_line_): New field.
10333
10334 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10335
10336 * incremental.cc: Include <cstdarg> and "target-select.h".
10337 (vexplain_no_incremental): New function.
10338 (explain_no_incremental): New function.
10339 (Incremental_binary::error): New method.
10340 (Sized_incremental_binary::do_find_incremental_inputs_section): New
10341 method.
10342 (make_sized_incremental_binary): New function.
10343 (open_incremental_binary): New function.
10344 (can_incrementally_link_file): Add checks if output is ELF and has
10345 inputs section.
10346 * incremental.h: Include "elfcpp_file.h" and "output.h".
10347 (Incremental_binary): New class.
10348 (Sized_incremental_binary): New class.
10349 (open_incremental_binary): Declare.
10350 * object.cc (is_elf_object): Use
10351 elfcpp::Elf_recognizer::is_elf_file.
10352 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10353 * output.h (Output_file::filesize): New method.
10354
10355 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10356
10357 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10358 New function.
10359 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10360 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10361 function.
10362 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10363 function.
10364 (Arm_relocate_functions::movw_abs_nc): New function.
10365 (Arm_relocate_functions::movt_abs): New function.
10366 (Arm_relocate_functions::thm_movw_abs_nc): New function.
10367 (Arm_relocate_functions::thm_movt_abs): New function.
10368 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10369 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10370 (Scan::global): Likewise.
10371 (Relocate::relocate): Likewise.
10372 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10373
10374 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10375
10376 * arm.cc (Arm_relocate_functions::got_prel) New function.
10377 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10378 (Relocate::relocate): Likewise.
10379 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10380
10381 2009-10-06 Ian Lance Taylor <iant@google.com>
10382
10383 * options.h (class General_options): Define
10384 split_stack_adjust_size parameter.
10385 * object.h (class Object): Add uses_split_stack_ and
10386 has_no_split_stack_ fields. Add uses_split_stack and
10387 has_no_split_stack accessor functions. Declare
10388 handle_split_stack_section.
10389 (class Reloc_symbol_changes): Define.
10390 (class Sized_relobj): Define Function_offsets. Declare
10391 split_stack_adjust, split_stack_adjust_reltype, and
10392 find_functions.
10393 * object.cc (Object::handle_split_stack_section): New function.
10394 (Sized_relobj::do_layout): Call handle_split_stack_section.
10395 * dynobj.cc (Sized_dynobj::do_layout): Call
10396 handle_split_stack_section.
10397 * reloc.cc (Sized_relobj::relocate_sections): Call
10398 split_stack_adjust for executable sections in split_stack
10399 objects. Pass reloc_map to relocate_section.
10400 (Sized_relobj::split_stack_adjust): New function.
10401 (Sized_relobj::split_stack_adjust_reltype): New function.
10402 (Sized_relobj::find_functions): New function.
10403 * target-reloc.h: Include "object.h".
10404 (relocate_section): Add reloc_symbol_changes parameter. Change
10405 all callers.
10406 * target.h (class Target): Add calls_non_split method. Declare
10407 do_calls_non_split virtual method. Declare match_view and
10408 set_view_to_nop.
10409 * target.cc: Include "elfcpp.h".
10410 (Target::do_calls_non_split): New function.
10411 (Target::match_view): New function.
10412 (Target::set_view_to_nop): New function.
10413 * gold.cc (queue_middle_tasks): Give an error if mixing
10414 split-stack and non-split-stack objects with -r.
10415 * i386.cc (Target_i386::relocate_section): Add
10416 reloc_symbol_changes parameter.
10417 (Target_i386::do_calls_non_split): New function.
10418 * x86_64.cc (Target_x86_64::relocate_section): Add
10419 reloc_symbol_changes parameter.
10420 (Target_x86_64::do_calls_non_split): New function.
10421 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10422 parameter.
10423 * powerpc.cc (Target_powerpc::relocate_section): Add
10424 reloc_symbol_changes parameter.
10425 * sparc.cc (Target_sparc::relocate_section): Add
10426 reloc_symbol_changes parameter.
10427 * configure.ac: Call AM_CONDITIONAL for the default target.
10428 * configure: Rebuild.
10429 * testsuite/Makefile.am (TEST_AS): New variable.
10430 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10431 (check_DATA): Add split_i386 and split_x86_64 files.
10432 (SPLIT_DEFSYMS): Define.
10433 (split_i386_[1234n].o): New targets.
10434 (split_i386_[124]): New targets.
10435 (split_i386_[1234r].stdout): New targets.
10436 (split_x86_64_[1234n].o): New targets.
10437 (split_x86_64_[124]): New targets.
10438 (split_x86_64_[1234r].stdout): New targets.
10439 (MOSTLYCLEANFILES): Add new executables.
10440 * testsuite/split_i386.sh: New file.
10441 * testsuite/split_x86_64.sh: New file.
10442 * testsuite/split_i386_1.s: New file.
10443 * testsuite/split_i386_2.s: New file.
10444 * testsuite/split_i386_3.s: New file.
10445 * testsuite/split_i386_4.s: New file.
10446 * testsuite/split_i386_n.s: New file.
10447 * testsuite/split_x86_64_1.s: New file.
10448 * testsuite/split_x86_64_2.s: New file.
10449 * testsuite/split_x86_64_3.s: New file.
10450 * testsuite/split_x86_64_4.s: New file.
10451 * testsuite/split_x86_64_n.s: New file.
10452 * testsuite/testfile.cc (Target_test): Update relocation_section
10453 function.
10454 * testsuite/Makefile.in: Rebuild.
10455
10456 2009-10-06 Ian Lance Taylor <iant@google.com>
10457
10458 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10459 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10460 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
10461 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10462 the address on ldo_addrs_.
10463 (Target_i386::Relocate::fix_up_ldo): New function.
10464
10465 2009-10-06 Rafael Espindola <espindola@google.com>
10466
10467 * plugin.cc (add_input_library): New.
10468 (Plugin::load): Add add_input_library to tv.
10469 (Plugin_manager::add_input_file): Add the is_lib argument.
10470 (add_input_file): Update call to Plugin_manager::add_input_file.
10471 (add_input_library): New.
10472 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10473
10474 2009-09-30 Doug Kwan <dougkwan@google.com>
10475
10476 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10477 symbol and call Symbol::may_need_copy_reloc to determine if
10478 a copy reloc is needed.
10479 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10480 nocopyreloc is given in command line.
10481 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10482 given in command line.
10483 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10484 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10485 of the removed Target_i386::may_need_copy_reloc.
10486 * options.h (copyreloc): New option with default value false.
10487 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10488 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10489 instead of the removed Target_powerpc::may_need_copy_reloc.
10490 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10491 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10492 instead of the removed Target_sparc::may_need_copy_reloc.
10493 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10494 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10495 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10496 instead of the removed Target_x86_64::may_need_copy_reloc.
10497
10498 2009-09-30 Ian Lance Taylor <iant@google.com>
10499
10500 * object.h (class Object): Remove target_ field, and target,
10501 sized_target, and set_target methods.
10502 (Object::sized_target): Remove.
10503 (class Sized_relobj): Update declarations. Remove sized_target.
10504 * object.cc (Sized_relobj::setup): Remove target parameter.
10505 Change all callers.
10506 (Input_objects::add_object): Don't do anything with the target.
10507 (make_elf_sized_object): Add punconfigured parameter. Change all
10508 callers. Set or test parameter target.
10509 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10510 Change all callers.
10511 * parameters.cc (Parameters::set_target): Change parameter type to
10512 be non-const.
10513 (Parameters::default_target): Remove.
10514 (set_parameters_target): Change parameter type to be non-const.
10515 (parameters_force_valid_target): New function.
10516 (parameters_clear_target): New function.
10517 * parameters.h (class Parameters): Update declarations. Remove
10518 default_target method. Add sized_target and clear_target
10519 methods. Change target_ to be non-const.
10520 (set_parameters_target): Update declaration.
10521 (parameters_force_valid_target): Declare.
10522 (parameters_clear_target): Declare.
10523 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10524 as NULL if we aren't searching.
10525 (Add_symbols::run): Don't check for compatible target.
10526 * fileread.cc (Input_file::open_binary): Call
10527 parameters_force_valid_target.
10528 * gold.cc (queue_middle_tasks): Likewise.
10529 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
10530 set_target on object.
10531 * dynobj.h (class Sized_dynobj): Update declarations.
10532 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10533 make_elf_object returns NULL.
10534 (Archive::include_member): Don't check whether object target is
10535 compatible.
10536 * output.cc (Output_section::add_input_section): Get target from
10537 parameters.
10538 (Output_section::relax_input_section): Likewise.
10539 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10540 parameters.
10541 (Sized_relobj::do_scan_relocs): Likewise.
10542 (Sized_relobj::relocate_sections): Likewise.
10543 * resolve.cc (Symbol_table::resolve): Likewise.
10544 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
10545 parameter. Change all callers.
10546 (Symbol_table::add_from_object): Get target from parameters.
10547 (Symbol_table::add_from_relobj): Don't check object target.
10548 (Symbol_table::add_from_dynobj): Likewise.
10549 (Symbol_table::define_special_symbol): Get target from
10550 parameters.
10551 * symtab.h (class Symbol_table): Update declaration.
10552 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10553 parameter. Change all callers. Clear parameter target.
10554 (Binary_test): Test target here.
10555 * testsuite/object_unittest.cc (gold_testsuite): Remove
10556 target_test_pointer parameter. Change all callers.
10557 (Object_test): Test target here.
10558
10559 2009-09-26 Ian Lance Taylor <iant@google.com>
10560
10561 * testsuite/initpri1.c: Don't try to use constructor priorities if
10562 compiling with gcc before 4.3.
10563
10564 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
10565
10566 * testsuite/retain_symbols_file_test.sh (check_present): Change
10567 output file name to retain_symbols_file_test.stdout.
10568 (check_absent): Likewise.
10569
10570 2009-09-18 Craig Silverstein <csilvers@google.com>
10571
10572 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10573 * options.cc: Include <cerrno> and <fstream>.
10574 (General_options::finalize): Parse -retain-symbols-file tag.
10575 * options.h: New flag.
10576 (General_options): New method should_retain_symbol, new
10577 variable symbols_to_retain.
10578 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10579 should_retain_symbol map.
10580 * testsuite/Makefile.am (retain_symbols_file_test): New test.
10581 * testsuite/Makefile.in: Regenerate.
10582 * testsuite/retain_symbols_file_test.sh: New file.
10583
10584 2009-09-18 Nick Clifton <nickc@redhat.com>
10585
10586 * po/es.po: Updated Spanish translation.
10587
10588 2009-09-17 Doug Kwan <dougkwan@google.com>
10589
10590 * debug.h (DEBUG_RELAXATION): New constant.
10591 (DEBUG_ALL): Add DEBUG_RELAXATION.
10592 (debug_string_to_enum): Add relaxation debug option.
10593 * layout.cc
10594 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10595 Layout::Relaxation_debug_check::read_sections,
10596 Layout::Relaxation_debug_check::read_sections): New method definitions.
10597 (Layout::Layout): Initialize data members
10598 record_output_section_data_from_scrips_,
10599 script_output_section_data_list_ and relaxation_debug_check_.
10600 (Layout::save_segments, Layout::restore_segments,
10601 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10602 Layout::relaxation_loop_body): New method definitions.
10603 (Layout::finalize): Support relaxation. Move section layout code to
10604 Layout::relaxation_loop_body.
10605 (Layout::set_asection_address_from_script): Move code for orphan
10606 section placement out.
10607 (Layout::place_orphan_sections_in_script): New method definition.
10608 * layout.h (Output_segment_headers, Output_file_header):
10609 New forward class declarations.
10610 (Layout::~Layout): Define.
10611 (Layout::new_output_section_data_from_script): New method definition.
10612 (Layout::place_orphan_sections_in_script): New method declaration.
10613 (Layout::Segment_states): New type declaration.
10614 (Layout::save_segments, Layout::restore_segments,
10615 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10616 Layout::relaxation_loop_body): New method declarations.
10617 (Layout::Output_section_data_list): New type declaration.
10618 (Layout::Relaxation_debug_check): New class definition.
10619 (Layout::record_output_section_data_from_script_,
10620 Layout::script_output_section_data_list_, Layout::segment_states_,
10621 Layout::relaxation_debug_check_): New data members.
10622 * output.cc: (Output_section_headers::do_size): New method definition.
10623 (Output_section_headers::Output_section_headers): Move size
10624 computation to Output_section_headers::do_size.
10625 (Output_segment_headers::do_size): New method definition.
10626 (Output_file_header::Output_file_header): Move size computation to
10627 Output_file_header::do_size and call it.
10628 (Output_file_header::do_size): New method definition.
10629 (Output_data_group::Output_data_group): Adjust call to
10630 Output_section_data.
10631 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10632 (Output_symtab_xindex::do_write): Add array bound check.
10633 (Output_section::Input_section::print_to_mapfile): Handle
10634 RELAXED_INPUT_SECTION_CODE.
10635 (Output_section::Output_section): Initialize data member checkpoint_.
10636 (Output_section::~Output_section): Delete checkpoint object pointed
10637 by checkpoint_.
10638 (Output_section::add_input_section): Always add an Input_section if
10639 relaxing.
10640 (Output_section::add_merge_input_section): Add assert.
10641 (Output_section::relax_input_section): New method definition.
10642 (Output_section::set_final_data_size): Set load address to zero for
10643 an unallocated section.
10644 (Output_section::do_address_and_file_offset_have_reset_values):
10645 New method definition.
10646 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10647 Handle relaxed input section.
10648 (Output_section::sort_attached_input_sections): Checkpoint input
10649 section list lazily.
10650 (Output_section::get_input_sections): Change type of input_sections to
10651 list of Simple_input_section pointers. Checkpoint input section list
10652 lazily. Also handle relaxed input sections.
10653 (Output_section::add_input_section_for_script): Take a reference to
10654 a Simple_input_section object instead of Relobj pointer and section
10655 index as parameter. Handle relaxed input sections.
10656 (Output_section::save_states, Output_section::restore_states): New
10657 method definitions.
10658 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10659 (Output_data::is_data_size_fixed): New method definition.
10660 (Output_data::reset_addresss_and_file_offset): Do not reset data size
10661 if it is fixed.
10662 (Output_data::address_and_file_offset_have_reset_values): New method
10663 definition.
10664 (Output_data::do_address_and_file_offset_have_reset_values): New method
10665 definition.
10666 (Output_data::set_data_size): Check that data size is not fixed.
10667 (Output_data::fix_data_size): New method definition.
10668 (Output_data::is_data_size_fixed_): New data member.
10669 (Output_section_headers::set_final_data_size): New method definition.
10670 (Output_section_headers::do_size): New method declaration.
10671 (Output_segment_headers::set_final_data_size): New method definition.
10672 (Output_segment_headers::do_size): New method declaration.
10673 (Output_file_header::set_final_data_size)::New method definition.
10674 (Output_file_header::do_size)::New method declaration.
10675 (Output_section_data::Output_section_data): Add new parameter
10676 is_data_size_fixed and use it to fix data size.
10677 (Output_data_const::Output_data_const): Adjust call to base class
10678 constructor and fix data size.
10679 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10680 base class constructor and fix data size.
10681 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10682 base class constructor and fix data size.
10683 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10684 class constructor and fix data size.
10685 (Output_data_group::set_final_data_size): New method definition.
10686 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10687 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10688 class constructor and fix data size.
10689 (Output_relaxed_input_section): New class definition.
10690 (Output_section::Simple_input_section): New class definition.
10691 (Output_section::get_input_sections): Adjust parameter list.
10692 (Output_section::add_input_section_for_script): Same.
10693 (Output_section::save_states, Output_section::restore_states,
10694 Output_section::do_address_and_file_offset_have_reset_values,
10695 (Output_section::Input_section::Input_section): Handle
10696 RELAXED_INPUT_SECTION_CODE. Add new overload for
10697 Output_relaxed_input_section.
10698 (Output_section::Input_section::is_input_section,
10699 Output_section::Input_section::set_output_section): Handle relaxed
10700 input section.
10701 (Output_section::Input_section::is_relaxed_input_section,
10702 Output_section::Input_section::output_section_data,
10703 Output_section::Input_section::relaxed_input_section): New method
10704 definitions.
10705 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10706 value.
10707 (Output_section::Input_section::u1_): Update comments.
10708 (Output_section::Input_section::u2_): Add new union member poris.
10709 (Output_section::Checkpoint_output_section): New classs definition.
10710 (Output_section::relax_input_section): New method declaration.
10711 (Output_section::checkpoint_): New data member.
10712 (Output_segment): Update comments.
10713 (Output_segment::Output_segment): Un-privatize copy constructor.
10714 (Output_segment::operator=): Un-privatize.
10715 * script-sections.cc (Output_section_element::Input_section_list):
10716 Change element type to Output_section::Simple_input_section.
10717 (Output_section_element_dot_assignment::set_section_addresses):
10718 Register output section data for relaxation clean up.
10719 (Output_data_exression::Output_data_expression): Adjust call to base
10720 constructor to fix data size.
10721 (Output_section_element_data::set_section_addresses): Register
10722 Output_data_expression object for relaxation clean up.
10723 (struct Input_section_info): Replace Relobj pointer and section index
10724 pair with Output_section::Simple_input_section and Convert struct to a
10725 class.
10726 (Input_section_sorter::operator()): Adjust access to
10727 Input_section_info data member to use accessors.
10728 (Output_section_element_input::set_section_addresses): Use layout
10729 parameter. Adjust code to use Output_section::Simple_input_section
10730 and Input_secction_info classes. Register filler for relaxation
10731 clean up.
10732 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10733 and section index pair with Output_section::Simple_input_section
10734 class. Adjust code accordingly.
10735 (Phdrs_element::release_segment): New method definition.
10736 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10737 segment list.
10738 (Script_sections::release_segments): New method definition.
10739 * gold/script-sections.h (Script_sections::release_segments): New
10740 method declaration.
10741 * gold/target.h (Target::may_relax, Target::relax,
10742 Target::do_may_relax, Target::do_relax): New method definitions.
10743
10744 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10745
10746 * arm.cc (has_signed_unsigned_overflow): New function.
10747 (Arm_relocate_functions::abs8): New function.
10748 (Target_arm::Scan::local): Handle R_ARM_ABS8.
10749 (Target_arm::Scan::global): Likewise.
10750 (Target_arm::relocate::relocate): Likewise.
10751 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10752 Likewise.
10753
10754 2009-09-16 Cary Coutant <ccoutant@google.com>
10755
10756 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10757 * testsuite/Makefile.in: Regenerate.
10758
10759 2009-09-11 Nick Clifton <nickc@redhat.com>
10760
10761 * po/gold.pot: Updated by the Translation project.
10762
10763 2009-09-08 Cary Coutant <ccoutant@google.com>
10764
10765 * output.cc (Output_file::open): Add execute permission to empty file.
10766 * testsuite/Makefile.am (permission_test): New test.
10767 * testsuite/Makefile.in: Regenerate.
10768
10769 2009-09-02 Ian Lance Taylor <iant@google.com>
10770
10771 * output.cc (Output_file::resize): Call map_no_anonymous rather
10772 than map.
10773
10774 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
10775
10776 * gold.cc: Include "incremental.h".
10777 (queue_initial_tasks): Call Incremental_checker methods.
10778 * incremental.cc: Include "output.h".
10779 (Incremental_checker::can_incrementally_link_output_file): New
10780 method.
10781 * incremental.h (Incremental_checker): New class.
10782
10783 * output.cc (Output_file::open_for_modification): New method.
10784 (Output_file::map_anonymous): Changed return type to bool. Record
10785 map in base_ field.
10786 (Output_file::map_no_anonymous): New method, broken out of map.
10787 (Output_file::map): Use map_no_anonymous and map_anonymous.
10788 * output.h (class Output_file): Update declarations.
10789
10790 2009-08-24 Cary Coutant <ccoutant@google.com>
10791
10792 * options.h (Command_line::Pre_options): New class.
10793 (Command_line::pre_options): New member.
10794 * options.cc (gold::options::ready_to_register): New variable.
10795 (One_option::register_option): Do nothing if not registering options.
10796 Assert if same short option registered twice.
10797 (General_options::General_options): Turn off option registration when
10798 done constructing.
10799 (Command_line::Pre_options::Pre_options): New constructor.
10800
10801 2009-08-24 Cary Coutant <ccoutant@google.com>
10802
10803 * options.h (General_options::no_keep_memory): Remove incorrect
10804 short option.
10805
10806 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10807
10808 * Makefile.am (am__skiplex, am__skipyacc): New.
10809 * Makefile.in: Regenerate.
10810
10811 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10812
10813 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10814 (INCLUDES): ... this.
10815 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10816 (AM_CPPFLAGS): Renamed from ...
10817 (INCLUDE): ... this.
10818 * Makefile.in, testsuite/Makefile.in: Regenerate.
10819
10820 * Makefile.in: Regenerate.
10821 * aclocal.m4: Likewise.
10822 * config.in: Likewise.
10823 * configure: Likewise.
10824 * testsuite/Makefile.in: Likewise.
10825
10826 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10827 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10828 * Makefile.in: Regenerate.
10829 * testsuite/Makefile.in: Regenerate.
10830
10831 2009-08-19 Cary Coutant <ccoutant@google.com>
10832
10833 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10834 symbols in shared libraries overridden by hidden or internal symbols
10835 in the main program.
10836
10837 2009-08-19 Chris Demetriou <cgd@google.com>
10838
10839 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10840 checking source file names in error messages.
10841
10842 2009-08-18 Doug Kwan <dougkwan@google.com>
10843
10844 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10845 an elcpp::Ehdr as parameter. Adjust call to set_target.
10846 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10847 an elfcpp::Ehdr as parameter.
10848 * object.cc (Object::set_target): Remove the version that looks up
10849 a target and sets it.
10850 (Sized_relobj::setup): Take a Target object instead of
10851 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10852 (make_elf_sized_object): Find target and ask target to
10853 make an ELF object.
10854 * object.h: (Object::set_target): Remove the version that looks up
10855 a target and sets it.
10856 (Sized_relobj::setup): Take a Target object instead of
10857 an elfcpp:Ehdr as parameter.
10858 * target.cc: Include dynobj.h.
10859 (Target::do_make_elf_object_implementation): New.
10860 (Target::do_make_elf_object): New.
10861 * target.h (Target::make_elf_object): New template declaration.
10862 (Target::do_make_elf_object): New method declarations.
10863 (Target::do_make_elf_object_implementation): New template declaration.
10864
10865 2009-08-14 Ian Lance Taylor <iant@google.com>
10866
10867 * gold.h (FUNCTION_NAME): Define.
10868 (gold_unreachable): Use FUNCTION_NAME.
10869
10870 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10871
10872 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10873 symbol in the --keep-unique list is not found.
10874
10875 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10876
10877 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10878 been maked as --keep-unique.
10879 (Icf::unfold_section): New function.
10880 * icf.h (Icf::unfold_section): New function.
10881 * options.h (General_options::keep_unique): New option.
10882 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10883 * testsuite/Makefile.in: Regenerate.
10884 * testsuite/icf_keep_unique_test.sh: New file.
10885 * testsuite/icf_keep_unique_test.cc: New file.
10886
10887 2009-08-12 Cary Coutant <ccoutant@google.com>
10888
10889 PR 10471
10890 * resolve.cc (Symbol_table::resolve): Check for references from
10891 dynamic objects to hidden and internal symbols.
10892 * testsuite/Makefile.am (hidden_test.sh): New test.
10893 * testsuite/Makefile.in: Regenerate.
10894 * testsuite/hidden_test.sh: New script.
10895 * testsuite/hidden_test_1.c: New test source.
10896 * testsuite/hidden_test_main.c: New test source.
10897
10898 2009-08-11 Doug Kwan <dougkwan@google.com>
10899
10900 * arm.cc: Update comments.
10901 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10902 segment to locate the .ARM.exidx section if present.
10903
10904 2009-08-09 Doug Kwan <dougkwan@google.com>
10905
10906 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10907 patch.
10908
10909 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10910 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10911 compiler warnings.
10912
10913 2009-08-06 Sriraman Tallam <tmsriram@google.com>
10914
10915 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10916 valid tls_segment only for non-debug-section relocations.
10917 * testsuite/Makefile.am: Add gc_tls_test.
10918 * testsuite/Makefile.in: Regenerate.
10919 * testsuite/gc_tls_test.cc: New file.
10920 * testsuite/gc_tls_test.sh: New file.
10921
10922 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10923
10924 * icf.cc: New file.
10925 * icf.h: New file.
10926 * Makefile.am (CCFILES): Add icf.cc.
10927 (HFILES): Add icf.h
10928 * Makefile.in: Regenerate.
10929 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10930 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10931 section, symbol and addend information for the relocs.
10932 * gold.cc (queue_middle_tasks): Call identical code folding.
10933 * gold.h: Add defines for multimap.
10934 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10935 to the call of finalize_local_symbols.
10936 * main.cc (main): Create object of class Icf.
10937 * object.cc (Sized_relobj::do_layout): Allow this function to be
10938 called twice during icf.
10939 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10940 to sections marked as identical by icf.
10941 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10942 when available.
10943 (Sized_relobj::do_section_entsize): New function.
10944 * object.h (Object::section_entsize): New function.
10945 (Object::do_section_entsize): New pure virtual function.
10946 (Relobj::finalize_local_symbols): Add new parameter.
10947 (Relobj::do_section_entsize): New function.
10948 * options.h (General_options::icf): New option.
10949 (General_options::icf_iterations): New option.
10950 (General_options::print_icf_sections): New option.
10951 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10952 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10953 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10954 icf.
10955 * symtab.cc (Symbol_table::is_section_folded): New function.
10956 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10957 to sections marked as identical by icf.
10958 * symtab.h (Symbol_table::set_icf): New function.
10959 (Symbol_table::icf): New function.
10960 (Symbol_table::is_section_folded): New function.
10961 (Symbol_table::icf_): New data member.
10962 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10963 * testsuite/Makefile.am: Add commands to build icf_test.
10964 * testsuite/Makefile.in: Regenerate.
10965 * testsuite/icf_test.sh: New file.
10966 * testsuite/icf_test.cc: New file.
10967
10968 2009-07-24 Chris Demetriou <cgd@google.com>
10969
10970 * layout.cc (is_compressible_debug_section): Fix incorrect
10971 comment about compressed section names.
10972
10973 2009-07-20 Ian Lance Taylor <ian@airs.com>
10974
10975 PR 10419
10976 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10977
10978 2009-07-16 Ian Lance Taylor <iant@google.com>
10979
10980 PR 10400
10981 * layout.h: #include <map>.
10982 (class Kept_section): Change from struct to class. Add accessors
10983 and setters. Add section size to Comdat_group mapping. Change
10984 Comdat_group to std::map. Add is_comdat_ field. Add
10985 linkonce_size field in union.
10986 (class Layout): Update declaration of find_or_add_kept_section.
10987 Don't declare find_kept_object.
10988 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10989 parameter. Add object, shndx, is_comdat, and is_group_name
10990 parameters. Change all callers. Adjust for new Kept_section.
10991 (Layout::find_kept_object): Remove.
10992 * object.cc (Sized_relobj::include_section_group): Update use of
10993 Kept_section. Rename secnum to shndx. Only record
10994 Kept_comdat_section if sections are the same size.
10995 (Sized_relobj::include_linkonce_section): Update use of
10996 Kept_section. Only record Kept_comdat_section if sections are the
10997 same size. Set size of linkonce section.
10998 (Sized_relobj::map_to_kept_section): Update call to
10999 get_kept_comdat_section.
11000 * object.h (class Sized_relobj): Rename fields in
11001 Kept_comdat_section to drop trailing underscores; change object
11002 field to Relobj*. Change Kept_comdat_section_table to store
11003 struct rather than pointer.
11004 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11005 Add kept_object and kept_shndx parameters. Change all callers.
11006 (Sized_relobj::get_kept_comdat_section): Change return type to
11007 bool. Add kept_object and kept_shndx parameters. Change all
11008 callers.
11009 * plugin.cc (Pluginobj::include_comdat_group): Update call to
11010 Layout::find_or_add_kept_section.
11011
11012 2009-07-09 Ian Lance Taylor <iant@google.com>
11013
11014 * merge.cc (Object_merge_map::initialize_input_to_output_map):
11015 Reserve space in the hash table.
11016
11017 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
11018
11019 * fileread.cc (File_read::get_mtime): New method.
11020 * fileread.h (Timespec): New structure.
11021 (File_read::get_mtime): New method.
11022 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11023 Renamed from timestamp_nsec.
11024 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11025 Elf_Xword.
11026 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11027 timestamp_nsec.
11028 (Incremental_inputs::report_archive): Save mtime; style fix.
11029 (Incremental_inputs::report_obejct): Save mtime; style fix.
11030 (Incremental_inputs::report_script): Save mtime; style fix.
11031 (Incremental_inputs::finalize_inputs): Style fix.
11032 (Incremental_inputs::finalize): Style fix.
11033 (Incremental_inputs::create_input_section_data): Store inputs
11034 mtime.
11035 * incremental.h (Incremental_inputs::report_script): Add mtime
11036 argument.
11037 (Incremental_inputs::Input_info::Input_info): Intialize only one
11038 union member.
11039 (Incremental_inputs::Input_info::archive): Move to nameless
11040 union.
11041 (Incremental_inputs::Input_info::obejct): Move to nameless union.
11042 (Incremental_inputs::Input_info::script): Move to nameless union.
11043 (Incremental_inputs::mtime): New field.
11044 * script.cc (read_input_script): Pass file mtime to
11045 Incremental_input.
11046 * script.h (Script_info::inputs): Style fix.
11047
11048 2009-07-01 Ian Lance Taylor <ian@airs.com>
11049
11050 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11051 instead of 32.
11052
11053 2009-06-24 Ian Lance Taylor <iant@google.com>
11054
11055 PR 10156
11056 * layout.cc (Layout::choose_output_section): If we find an
11057 existing section, update the flags.
11058 (Layout::create_notes): New function, broken out of
11059 Layout::finalize.
11060 (Layout::finalize): Don't create note sections.
11061 (Layout::create_note): Don't crash if linker script discards
11062 section.
11063 (Layout::create_gold_note): Likewise.
11064 (Layout::create_build_id): Likewise. Don't set
11065 after_input_sections on the section.
11066 (Layout::create_executable_stack_info): Remove target parameter.
11067 Change caller.
11068 * layout.h (class Layout): Declare create_notes. Update
11069 declaration of create_executable_stack_info.
11070 * gold.cc (queue_middle_tasks): Call create_notes.
11071 * output.cc (Output_section::update_flags_for_input_section): Move
11072 here from output.h. If SHF_ALLOC flag is newly set, mark address
11073 invalid.
11074 * output.h (Output_data::mark_address_invalid): New function.
11075 (class Output_section): Only declare, not define,
11076 update_flags_for_input_section. Remove set_flags.
11077
11078 2009-06-24 Ian Lance Taylor <iant@google.com>
11079
11080 * script-sections.cc (Output_section_definition::
11081 set_section_addresses): Rename shadowing local load_address to
11082 laddr.
11083
11084 2009-06-24 Ian Lance Taylor <iant@google.com>
11085
11086 PR 10244
11087 * reloc.cc (relocate_sections): Skip empty relocation sections.
11088
11089 2009-06-23 Ian Lance Taylor <iant@google.com>
11090
11091 PR 10156
11092 * layout.cc (Layout::create_note): Use choose_output_section
11093 rather than make_output_section.
11094
11095 2009-06-23 Ian Lance Taylor <iant@google.com>
11096
11097 PR 10237
11098 * options.cc (General_options::parse_V): Set printed_version_.
11099 (General_options::General_options): Initialize printed_version_.
11100 * options.h (class General_options): Add printed_version_ field.
11101 * gold.cc (queue_initial_tasks): If there are no input files,
11102 don't give a fatal error if we printed the version information.
11103 (queue_middle_tasks): If using -r with a shared object, give a
11104 fatal error rather than an ordinary error.
11105
11106 2009-06-23 Ian Lance Taylor <iant@google.com>
11107
11108 PR 10219
11109 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11110 (Layout::make_output_section): Set have_stabstr_section_ if we see
11111 a .stab*str section.
11112 (Layout::finalize): Call link_stabs_sections.
11113 (Layout::link_stabs_sections): New file.
11114 * layout.h (class Layout): Add have_stabstr_section_ field.
11115 Declare link_stabs_sections.
11116
11117 2009-06-23 Doug Kwan <dougkwan@google.com>
11118
11119 * Makefile.am (libgold_a_LIBADD): New.
11120 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11121 * Makefile.in: Regenerate.
11122 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11123 * configure: Regenerate.
11124 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11125 * fileread.cc: Include sys/state.h
11126 * gold.h: Declare memmem and strndup if found missing.
11127 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11128
11129 2009-06-23 Ian Lance Taylor <iant@google.com>
11130
11131 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11132 * configure: Rebuild.
11133
11134 2009-06-23 Ian Lance Taylor <iant@google.com>
11135
11136 PR 10147
11137 * object.cc (Object::section_contents): Don't try to get a view if
11138 the section has length zero.
11139 (Object::handle_gnu_warning_section): If the section is empty, use
11140 the name of the section as the warning.
11141
11142 2009-06-23 Ian Lance Taylor <iant@google.com>
11143
11144 PR 10133
11145 * stringpool.h (class Stringpool_template): Add optimize_ field.
11146 (Stringpool_template::set_optimize): New function.
11147 * stringpool.cc (Stringpool_template::Stringpool_template):
11148 Initialize optimize_ field.
11149 (Stringpool_template::set_string_offsets): Test local optimize
11150 fild rather than parameter.
11151 * layout.cc (Layout::Layout): Call set_optimize on the section
11152 name stringpool.
11153
11154 2009-06-22 Ian Lance Taylor <iant@google.com>
11155
11156 PR 10030
11157 * yyscript.y: Parse TARGET.
11158 * script.cc (script_set_target): New function.
11159 * script-c.h (script_set_target): Declare.
11160 * options.cc (General_options::string_to_object_format): Rename
11161 from string_to_object_format in anonymous namespace. Change
11162 callers.
11163 * options.h (class General_options): Declare
11164 string_to_object_format.
11165
11166 2009-06-22 Ian Lance Taylor <iant@google.com>
11167
11168 * script-sections.cc (Script_sections::create_segments): Don't put
11169 program headers in a PT_LOAD segment if -n or -N.
11170
11171 2009-06-22 Ian Lance Taylor <iant@google.com>
11172
11173 PR 10141
11174 * options.h (class General_options): Add -z lazy and -z now. Sort
11175 -z options into alphabetical order.
11176 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11177
11178 2009-06-21 Ian Lance Taylor <iant@google.com>
11179
11180 * layout.cc (Layout::make_output_section): Call
11181 Target::new_output_section.
11182 (Layout::attach_allocated_section_to_segment): Put large section
11183 sections in a separate load segment with the large segment flag
11184 set.
11185 (Layout::segment_precedes): Sort large data segments after other
11186 load segments.
11187 (align_file_offset): New static function.
11188 (Layout::set_segment_offsets): Use align_file_offset.
11189 * output.h (class Output_section): Add is_small_section_ and
11190 is_large_section_ fields.
11191 (Output_section::is_small_section): New function.
11192 (Output_section::set_is_small_section): New function.
11193 (Output_section::is_large_section): New function.
11194 (Output_section::set_is_large_section): New function.
11195 (Output_section::is_large_data_section): New function.
11196 (class Output_segment): Add is_large_data_segment_ field.
11197 (Output_segment::is_large_data_segment): New function.
11198 (Output_segment::set_is_large_data_segment): New function.
11199 * output.cc (Output_section::Output_section): Initialize new
11200 fields.
11201 (Output_segment::Output_segment): Likewise.
11202 (Output_segment::add_output_section): Add assertion that large
11203 data sections always go in large data segments. Force small data
11204 sections to the end of the list of data sections. Force small BSS
11205 sections to the start of the list of BSS sections. For large BSS
11206 sections to the end of the list of BSS sections.
11207 * symtab.h (class Symbol): Declare is_common_shndx.
11208 (Symbol::is_defined): Check Symbol::is_common_shndx.
11209 (Symbol::is_common): Likewise.
11210 (class Symbol_table): Define enum Commons_section_type. Update
11211 declarations. Add small_commons_ and large_commons_ fields.
11212 * symtab.cc (Symbol::is_common_shndx): New function.
11213 (Symbol_table::Symbol_table): Initialize new fields.
11214 (Symbol_table::add_from_object): Put small and large common
11215 symbols in the right list.
11216 (Symbol_table::sized_finalized_symbol): Check
11217 Symbol::is_common_shndx.
11218 (Symbol_table::sized_write_globals): Likewise.
11219 * common.cc (Symbol_table::do_allocate_commons): Allocate new
11220 common symbol lists. Don't call do_allocate_commons_list if the
11221 list is empty.
11222 (Symbol_table::do_allocate_commons_list): Remove is_tls
11223 parameter. Add comons_section_type parameter. Change all
11224 callers. Handle small and large common symbols.
11225 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11226 Symbol::is_common_shndx.
11227 * resolve.cc (symbol_to_bits): Likewise.
11228 * target.h (Target::small_common_shndx): New function.
11229 (Target::small_common_section_flags): New function.
11230 (Target::large_common_shndx): New function.
11231 (Target::large_common_section_flags): New function.
11232 (Target::new_output_section): New function.
11233 (Target::Target_info): Add small_common_shndx, large_common_shndx,
11234 small_common_section_flags, and large_common_section_flags
11235 fields.
11236 (Target::do_new_output_section): New virtual function.
11237 * arm.cc (Target_arm::arm_info): Initialize new fields.
11238 * i386.cc (Target_i386::i386_info): Likewise.
11239 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11240 Likewise.
11241 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11242 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11243 (Target_x86_64::do_new_output_section): New function.
11244 * configure.ac: Define conditional MCMODEL_MEDIUM.
11245 * testsuite/Makefile.am (check_PROGRAMS): Add large.
11246 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11247 (large_LDFLAGS): Define.
11248 * testsuite/large.c: New file.
11249 * testsuite/testfile.cc (Target_test::test_target_info):
11250 Initialize new fields.
11251 * configure, testsuite/Makefile.in: Rebuild.
11252
11253 2009-06-05 Doug Kwan <dougkwan@google.com>
11254
11255 * Makefile.am (CCFILES): Add target.cc.
11256 * Makefile.in: Regenerate.
11257 * i386.cc (class Target_i386): Define new virtual method to
11258 override do_is_local_label_name in parent.
11259 * object.cc (Sized_relobj::do_count_local_symbols): Discard
11260 local symbols if --discard-locals or -X is given.
11261 * options.h (class General_options): Declare new options
11262 '--discard-locals' and '-X' for discarding locals.
11263 * target.h (class Target): Define new methods is_local_label_name.
11264 Declare new virtual method do_is_local_label_name.
11265 * target.cc: New file.
11266 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11267 (check_SCRIPTS): Add discard_locals_test.sh.
11268 (check_DATA): Add discard_local_tests.syms.
11269 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11270 (discard_local_tests.syms, discard_locals_test.o): New make rules.
11271 * testsuite/Makefile.in: Regenerate.
11272 * testsuite/discard_locals_test.c: New file.
11273 * testsuite/discard_locals_test.sh: Same.
11274
11275 2009-06-05 Doug Kwan <dougkwan@google.com>
11276
11277 * object.cc (Sized_relobj::Sized_relobj): Initialize
11278 discarded_eh_frame_shndx_ to -1U.
11279 (Sized_relobj::do_layout): Record index of a discard .eh_frame
11280 section.
11281 (Sized_relobj::do_count_local_symbols): Skip local symbols in
11282 a discarded .eh_frame section.
11283 (Sized_relobj::do_finalize_local_symbols): Ditto.
11284 * object.h (class Sized_relobj): Declare new member
11285 discarded_eh_frame_shndx_.
11286 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11287 (local_labels_test.o, local_labels_test): New rules.
11288 * testsuite/Makefile.in: Regenerate.
11289
11290 2009-06-04 Doug Kwan <dougkwan@google.com>
11291
11292 * layout.cc (Layout::section_name_mapping): Add mapping for
11293 special ARM sections.
11294
11295 2009-06-03 Doug Kwan <dougkwan@google.com>
11296
11297 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11298 (utils::has_overflow): Same.
11299
11300 2009-06-03 Ian Lance Taylor <iant@google.com>
11301
11302 * layout.cc (Layout::section_name_mapping): New array, replacing
11303 Layout::linkonce_mapping.
11304 (Layout::section_name_mapping_count): New variable, replacing
11305 Layout::linkonce_mapping_count.
11306 (Layout::linkonce_output_name): Remove.
11307 (Layout::output_section_name): Rewrite.
11308 * layout.h (class Layout): Rename Linkonce_mapping to
11309 Section_name_mapping, linkonce_mapping to section_name_mapping,
11310 linkonce_mapping_count to section_name_mapping_count. Don't
11311 declare linkonce_output_name.
11312
11313 2009-06-03 Doug Kwan <dougkwan@google.com>
11314
11315 * gold/arm.cc (namespace utils): New.
11316 (Target_arm::reloc_is_non_pic): Define new method.
11317 (class Arm_relocate_functions): New.
11318 (Target_arm::Relocate::relocate): Handle relocation types used by
11319 Android.
11320
11321 2009-06-03 Ian Lance Taylor <iant@google.com>
11322
11323 * arm.cc (Target_arm::scan::global): Use || instead of |.
11324
11325 2009-06-02 Doug Kwan <dougkwan@google.com>
11326
11327 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
11328 issued_non_pic_error_.
11329 (class Target_arm::Scan): Declare new method check_non_pic.
11330 Define new method symbol_needs_plt_entry.
11331 Declare new data member issued_non_pic_error_.
11332 (class Target_arm::Relocate): Declare new method
11333 should_apply_static_reloc.
11334 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11335 (Target_arm::Scan::check_non_pic): Define new method.
11336 (Target_arm::Scan::local): Handle a small subset of reloc types used
11337 by Android.
11338 (Target_arm::Scan::local): Same.
11339 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11340
11341 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
11342
11343 * incremental.cc (Incremental_inputs::report_command_line): Filter
11344 out --incremental-* options.
11345
11346 2009-05-29 Doug Kwan <dougkwan@google.com>
11347
11348 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11349 template class.
11350 (class Target_arm): Update comment.
11351 (Target_arm::Target_arm): Initialize new data members GOT_,
11352 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11353 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11354 and Target_arm::rel_dyn_section.
11355 Declare new_enum Target_arm::Got_type.
11356 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11357 and DYNBSS_.
11358 Update commments for member do_dynsym_value.
11359 (Target_arm::got_size, Target_arm::plt_section,
11360 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11361 new methods inside class defintion.
11362 (Target_arm::got_section): Define new method.
11363 (Target_arm::rel_dyn_section): Same.
11364 (Output_data_plt_arm): New template class.
11365 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11366 (Output_data_plt_arm:do_adjust_output_section): Define new method.
11367 (Output_data_plt_arm::add_entry): Same.
11368 (Output_data_plt_arm::first_plt_entry): Define new
11369 static data member for PLT instruction template.
11370 (Output_data_plt_arm::plt_entry): Same.
11371 (Output_data_plt_arm::do_write): Define new method.
11372 (Target_arm::make_plt_entry): Same.
11373 (Target_arm::do_finalize_sections): Same.
11374 (Target_arm::do_dynsym_value): Same.
11375
11376 2009-05-28 Doug Kwan <dougkwan@google.com>
11377
11378 * Makefile.am (TARGETSOURCES): Add arm.cc.
11379 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11380 * Makefile.in: Regenerate.
11381 * arm.cc: New file.
11382 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11383
11384 2009-05-26 Doug Kwan <dougkwan@google.com>
11385
11386 * options.cc (General_options::parse_exclude_libs). Fix a comment.
11387 (General_options::check_excluded_libs): Strip off directories in
11388 archive name before matching like GNU ld does.
11389 * testsuite/Makefile.am (MOSTLYCLEANFILES,
11390 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11391 (exclude_libs_test_LDFLAGS): Add linker option
11392 -Wl,--exclude-libs,libexclude_libs_test_3
11393 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11394 an explicit archive without using -l.
11395 (alt/libexclude_libs_test_3.a): New make rule.
11396 * testsuite/Makefile.in: Regenerate.
11397 * testsuite/exclude_libs_test.c : Declare lib3_default().
11398 (main): Call it.
11399 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11400 * exclude_libs_test_3.c: New file.
11401
11402 2009-05-26 Nick Clifton <nickc@redhat.com>
11403
11404 * po/id.po: New Indonesian translation.
11405 * po/gold.pot: Updated template file.
11406
11407 2009-05-22 Sriraman Tallam <tmsriram@google.com>
11408
11409 * testsuite/Makefile.am: Add -ffunction-sections to compile
11410 gc_comdat_test files. Add -Wl,--gc-sections to build
11411 gc_comdat_test.
11412 * testsuite/Makefile.in: Regenerate.
11413 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11414
11415 2009-05-21 Sriraman Tallam <tmsriram@google.com>
11416
11417 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11418 kept comdat section was garbage collected.
11419 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11420 * testsuite/Makefile.in: Regenerate.
11421 * testsuite/gc_comdat_test.sh: New file.
11422 * testsuite/gc_comdat_test_1.cc: New file.
11423 * testsuite/gc_comdat_test_2.cc: New file.
11424
11425 2009-05-19 Doug Kwan <dougkwan@google.com>
11426
11427 * archive.cc (Archive::Archive): Move constructor from archive.h
11428 to here. Initialize no_export_.
11429 (Archive::get_elf_object_for_member): Set no_export flag of object.
11430 * archive.h (Archive::Archive): Move constructor body to
11431 archive.cc.
11432 (Archive::no_export): New method.
11433 (Archive::no_export_): New field.
11434 * object.h (Object::Object): Initialize no_export_ to false.
11435 (Object::no_export, Object::set_no_export): New methods.
11436 (Object::no_export_): New field.
11437 * options.cc (General_options::parse_exclude_libs): New method.
11438 (General_options::check_excluded_libs) Same.
11439 * options.h (exclude_libs): New option.
11440 (General_options::check_excluded_libs): New method declaration.
11441 (General_options::excluded_libs_): New field.
11442 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11443 default or protected visibility if an object has no-export flag set.
11444 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11445 (check_SCRIPTS): Add exclude_libs_test.sh.
11446 (check_DATA): Add exclude_libs_test.syms.
11447 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11448 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11449 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11450 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11451 (exclude_libs_test.syms, libexclude_libs_test_1.a,
11452 libexclude_libs_test_2.a): New rules.
11453 * testsuite/Makefile.in: Regenerate.
11454 * testsuite/exclude_libs_test.c: New file.
11455 * testsuite/exclude_libs_test.sh: Ditto.
11456 * testsuite/exclude_libs_test_1.c: Ditto.
11457 * testsuite/exclude_libs_test_2.c: Ditto.
11458
11459 2009-05-15 Ian Lance Taylor <iant@google.com>
11460
11461 * configure.ac: Check for declarations for cases where libiberty.h
11462 checks HAVE_DECL_xxx.
11463 * configure, config.in: Rebuild.
11464
11465 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
11466
11467 * gold.h (Incremental_argument_list): Remove (invalid) forward
11468 declaration.
11469 * incremental.cc (Incremental_inputs::report_achive): New method.
11470 (Incremental_inputs::report_object): New method.
11471 (Incremental_inputs::report_script): New method.
11472 (Incremental_inputs::finalize_inputs): New method.
11473 (Incremental_inputs::finalize): Call finalize_inputs().
11474 (Incremental_inputs::sized_create_incremental_inputs_section_data):
11475 Create inputs entries.
11476 * incremental.h (Incremental_input_type): New enum.
11477 (Incremental_inputs::Incremental_input): Initialize new fields.
11478 (Incremental_inputs::report_inputs): New method.
11479 (Incremental_inputs::report_achive): New method.
11480 (Incremental_inputs::report_object): New method.
11481 (Incremental_inputs::report_script): New method.
11482 (Incremental_inputs::finalize_inputs): New method.
11483 (Incremental_inputs::Input_info): New struct.
11484 (Incremental_inputs::Input_info_map): New typedef.
11485 (Incremental_inputs::lock_): New field.
11486 (Incremental_inputs::Inputs_): New field.
11487 (Incremental_inputs::Inputs_map): New field.
11488 * main.cc (main): Call Incremental_input::report_inputs.
11489 * options.h (Input_argument_list): Typedef moved from
11490 Input_arguments.
11491 (Input_file_group::Files): Remove, use ::Input_argument_list.
11492 (Input_file_group::Input_argument_list): Remove, use
11493 ::Input_argument_list.
11494 * plugin.cc (Plugin_manager::add_input_file): Add error in
11495 incremental build.
11496 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11497 functions.
11498 * script.cc (read_input_script): Call
11499 Incremental_input::report_script.
11500 * script.h (Script_info): New class.
11501
11502 2009-04-27 Ian Lance Taylor <iant@google.com>
11503
11504 * x86_64.cc (do_adjust_output_section): Set entsize to
11505 plt_entry_size.
11506
11507 2009-04-23 Elliott Hughes <enh@google.com>
11508
11509 * output.cc (Output_file::close): After short writes, continue
11510 writing from the correct offset in the buffer being written.
11511
11512 2009-04-23 Chris Demetriou <cgd@google.com>
11513
11514 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11515 * configure: Regenerate.
11516 * config.in: Regenerate.
11517 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11518 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11519
11520 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
11521
11522 * incremental.cc (Incremental_inputs_header_data): Renamed from
11523 Incremental_input_header_data.
11524 (Incremental_inputs_header_data::data_size): New field.
11525 (Incremental_inputs_header_data::put_input_file_count): Renamed
11526 from input_file_count.
11527 (Incremental_inputs_header_data::put_command_line_offset): Renamed
11528 from command_line_offset.
11529 (Incremental_inputs_header_data::put_reserved): Renamed from
11530 put_reserved.
11531 (Incremental_inputs_entry_data): Renamed from
11532 Incremental_input_entry_data.
11533 (Incremental_inputs_entry_data::data_size): New field.
11534 (Incremental_inputs::report_command_line): New method.
11535 (Incremental_inputs::finalize): New method.
11536 (Incremental_inputs::create_incremental_inputs_data): New method.
11537 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11538 * incremental.h: New file.
11539 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11540 (Layout::finalize): Create incremental inputs section in
11541 incremental builds.
11542 (Layout::create_incremental_info_sections): New method.
11543 * layout.h (Layout::incremental_inputs): New method.
11544 (Layout::create_incremental_info_sections): New method.
11545 (Layout::incremental_inputs_): New field.
11546 * main.cc (main): Notify Incremental_input of the command line.
11547
11548 2009-04-01 Ian Lance Taylor <iant@google.com>
11549 Mikolaj Zalewski <mikolajz@google.com>
11550
11551 * gold.h (reserve_unordered_map): Define, three versions, one for
11552 each version of Unordered_map.
11553 * layout.cc (Layout::Layout): Remove options parameter. Add
11554 number_of_input_files parameter. Don't initialize options_.
11555 Initialize number_of_input_files_ and resized_signatures_. Move
11556 sections_are_attached_.
11557 (Layout::layout_group): Reserve space for group_signatures_.
11558 (Layout::find_or_add_kept_section): Change name parameter to be a
11559 reference. Resize signatures_ map when it gets large enough.
11560 (Layout::layout_eh_frame): Use parameters->options() instead of
11561 this->options_.
11562 (Layout::make_output_section): Likewise.
11563 (Layout::attach_allocated_section_to_segment): Likewise.
11564 (Layout::finalize, Layout::create_executable_stack): Likewise.
11565 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11566 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11567 * layout.h (class Layout): Update declarations. Remove options_
11568 field. Add number_of_input_files_ and resized_signatures_
11569 fields. Move sections_are_attached_ field.
11570 * main.cc (main): Pass number of input files to Layout
11571 constructor. Don't pass options.
11572
11573 2009-03-30 Ian Lance Taylor <iant@google.com>
11574
11575 * ffsll.c (ffsll): Correct implementation.
11576
11577 2009-03-27 Ian Lance Taylor <iant@google.com>
11578
11579 * ffsll.c: New file.
11580 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11581 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11582 * ftruncate.c (ftruncate): Declare before definition.
11583 * mremap.c (mremap): Likewise.
11584 * pread.c (pread): Likewise.
11585 * configure, Makefile.in, config.in: Rebuild.
11586
11587 * mremap.c: New file.
11588 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11589 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11590 (mremap): Declare if HAVE_MREMAP is not defined.
11591 * configure, Makefile.in, config.in: Rebuild.
11592
11593 2009-03-27 Cary Coutant <ccoutant@google.com>
11594
11595 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11596 position independent.
11597 * sparc.cc (Target_sparc::check_non_pic): Likewise.
11598 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11599
11600 2009-03-24 Cary Coutant <ccoutant@google.com>
11601
11602 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11603 an executable.
11604 (needs_dynamic_reloc): Likewise.
11605
11606 2009-03-24 Ian Lance Taylor <iant@google.com>
11607
11608 * yyscript.y (file_cmd): Recognize EXTERN.
11609 (extern_name_list, extern_name_list_body): New nonterminals.
11610 * script.cc (script_add_extern): Define.
11611 * script-c.h (script_add_extern): Declare.
11612
11613 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
11614
11615 * object.cc (is_elf_object): Define.
11616 * object.h (is_elf_object): Declare.
11617 * archive.cc (Archive::get_elf_object_for_member): Call
11618 is_elf_object.
11619 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11620
11621 2009-03-24 Elliott Hughes <enh@google.com>
11622
11623 * output.cc (Output_file::map_anonymous): Define.
11624 (Output_file::map): Use map_anonymous. If the regular mmap fails,
11625 try an anonymous one. Report the size if the mmap fails.
11626 * output.h (class Output_file): Declare map_anonymous.
11627
11628 2009-03-24 Ian Lance Taylor <iant@google.com>
11629
11630 * target-select.cc (instantiate_target): Don't acquire the lock if
11631 the instantiated_target_ field has already been set.
11632
11633 2009-03-23 Ian Lance Taylor <iant@google.com>
11634
11635 * gold-threads.h (class Initialize_lock): Define.
11636 * gold-threads.cc (class Initialize_lock_once): Define.
11637 (initialize_lock_control): New static variable.
11638 (initialize_lock_pointer): New static variable.
11639 (initialize_lock_once): New static function.
11640 (Initialize_lock::Initialize_lock): Define.
11641 (Initialize_lock::initialize): Define.
11642 * target-select.h: Include "gold-threads.h".
11643 (class Target_selector): Add lock_ and initialize_lock_ fields.
11644 Don't define instantiate_target, just declare it.
11645 * target-select.cc (Target_selector::Target_selector): Initialize
11646 new fields.
11647 (Target_selector::instantiate_target): Define.
11648 * descriptors.h: Include "gold-threads.h".
11649 (class Descriptors): Add initialize_lock_ field.
11650 * descriptors.cc (Descriptors::Descriptors): Initialize new
11651 field.
11652 (Descriptors::open): Use initialize_lock_ field
11653 * errors.h (class Errors): Add initialize_lock_ field.
11654 * errors.cc (Errors::Errors): Initialize new field.
11655 (Errors::initialize_lock): Use initialize_lock_ field.
11656 * powerpc.cc (class Target_selector_powerpc): Remove
11657 instantiated_target_ field. In do_recognize call
11658 instantiate_target rather than do_instantiate_target. In
11659 do_instantiate_target just allocate a new target.
11660 * sparc.cc (class Target_selector_sparc): Likewise.
11661
11662 * freebsd.h: New file.
11663 * i386.cc: Include "freebsd.h".
11664 (Target_i386): Derive from Target_freebsd rather than
11665 Sized_target.
11666 (Target_selector_i386): Derive from Target_selector_freebsd rather
11667 than Target_selector.
11668 * x86_64.cc: Include "freebsd.h".
11669 (Target_x86_64): Derive from Target_freebsd rather than
11670 Sized_target.
11671 (Target_selector_x86_64): Derive from Target_selector_freebsd
11672 rather than Target_selector.
11673 * target.h (class Target): Add adjust_elf_header and
11674 do_adjust_elf_header.
11675 * output.cc (Output_file_header:: do_sized_write): Call target
11676 adjust_elf_header routine.
11677 * configure.tgt: Set targ_osabi.
11678 * configure.ac: Define GOLD_DEFAULT_OSABI.
11679 * parameters.cc (Parameters::default_target): Pass
11680 GOLD_DEFAULT_OSABI to select_target.
11681 * target-select.h (class Target_selector): Make instantiate_target
11682 protected rather than private.
11683 * Makefile.am (HFILES): Add freebsd.h.
11684 * configure, Makefile.in, config.in: Rebuild.
11685
11686 * merge.cc (do_add_input_section): Correct pend value. Change
11687 message about last entry not being null terminated from error to
11688 warning.
11689
11690 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
11691
11692 * incremental.cc: New file.
11693 * Makefile.am (CCFILES): Add incremental.cc.
11694 * Makefile.in: Rebuild.
11695
11696 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
11697
11698 * layout.cc (Layout::output_section_name): Preserve names
11699 of '.note.' sections.
11700
11701 2009-03-19 Ian Lance Taylor <iant@google.com>
11702
11703 * descriptors.cc (Descriptors::open): Check that the options are
11704 valid before using them.
11705
11706 2009-03-18 Ian Lance Taylor <iant@google.com>
11707
11708 * script-sections.h: Include <list>.
11709 (class Script_sections): Change Sections_elements from std::vector
11710 to std::list. Typedef public Elements_iterator. Add
11711 orphan_section_placement_, data_segment_align_start_, and
11712 saw_data_segment_align_ fields. Remove data_segment_align_index_
11713 field.
11714 * script-sections.cc (class Orphan_section_placement): New class.
11715 (class Sections_element): Add virtual functions is_relro and
11716 orphan_section_init. Remove virtual function place_orphan_here.
11717 (class Output_section_definition): Add is_relro and
11718 orphan_section_init. Remove place_orphan_here.
11719 (class Orphan_output_section): Likewise.
11720 (Script_sections::Script_sections): Update for field changes.
11721 (Script_sections::data_segment_align): Set saw_data_segment_align_
11722 and data_segment_align_start_, not data_segment_align_index.
11723 (Script_sections::data_segment_relro_end): Check
11724 saw_data_segment_align_. Use data_segment_align_start_ rather
11725 than data_segment_align_index_.
11726 (Script_sections::place_orphan): Rewrite to use
11727 Orphan_section_placement.
11728
11729 2009-03-17 Ian Lance Taylor <iant@google.com>
11730
11731 * archive.cc (Archive::add_symbols): Check for a version attached
11732 to the symbol name in the archive map.
11733 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11734 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11735 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11736 (ver_test_11.a): New target.
11737 * testsuite/Makefile.in: Rebuild.
11738
11739 * configure.ac: Check for chsize and posix_fallocate. Replace
11740 ftruncate.
11741 * ftruncate.c: New file, from gnulib.
11742 * output.cc (posix_fallocate): Define dummy version if not
11743 HAVE_POSIX_FALLOCATE.
11744 (Output_file::map): Call posix_fallocate rather than lseek and
11745 write.
11746 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11747 * configure, Makefile.in, config.in: Rebuild.
11748
11749 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
11750
11751 * layout.h (Layout::create_note): Add section_name parameter.
11752 * layout.cc (Layout::create_note): Likewise.
11753 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11754
11755 2009-03-17 Ian Lance Taylor <iant@google.com>
11756
11757 * descriptors.cc: Include "options.h".
11758 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11759 (Descriptors::open): Always use O_CLOEXEC when opening a new
11760 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
11761 then set FD_CLOEXEC.
11762
11763 * sparc.cc (class Target_sparc): Add has_got_section.
11764 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11765 make sure we have a GOT section.
11766
11767 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11768 (Target_sparc::Scan::local): Likewise.
11769 (Target_sparc::Scan::global): Likewise.
11770 (Target_sparc::Relocate::relocate): Likewise.
11771 (Target_sparc::Relocate::relocate_tls): Likewise.
11772
11773 * symtab.cc (Symbol_table::define_default_version): New function,
11774 broken out of add_from_object.
11775 (Symbol_table::add_from_object): Call define_default_version.
11776 (Symbol_table::define_special_symbol): Add resolve_oldsym
11777 parameter. Change all callers. If the version for a symbol comes
11778 from a version script, resolve it with the symbol with the same
11779 name with no version. Also add the symbol without a version if
11780 appropriate.
11781 (do_define_in_output_data): If resolving with oldsym, don't delete
11782 sym.
11783 (do_define_in_output_segment): Likewise.
11784 (do_define_as_constant): Likewise.
11785 * symtab.h (class Symbol_table): Update declarations.
11786
11787 2009-03-13 Ian Lance Taylor <iant@google.com>
11788
11789 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11790 (Read_symbols::requeue): New function.
11791 (Read_symbols::do_read_symbols): If make_elf_object fails because
11792 the target type is not configured, and the file was searched for,
11793 issue a warning and retry with the next directory.
11794 (Add_symbols::run): If the file has an incompatible format, and
11795 it was searched for, requeue the Read_symbols task. On error,
11796 release the object.
11797 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11798 dirindex parameter to constructor. Change all callers. Declare
11799 incompatible_warning and requeue.
11800 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11801 input_argument_ and input_group_ fields. Add them to
11802 constructor. Change all callers.
11803 (class Read_script): Add dirindex_ field. Add it to constructor.
11804 Change all callers.
11805 * archive.cc (Archive::setup): Remove input_objects parameter.
11806 Change all callers.
11807 (Archive::get_file_and_offset): Likewise.
11808 (Archive::read_all_symbols): Likewise.
11809 (Archive::read_symbols): Likewise.
11810 (Archive::get_elf_object_for_member): Remove input_objects
11811 parameter. Add punconfigured parameter. Change all callers.
11812 (Archive::add_symbols): Change return type to bool. Check return
11813 value of include_member.
11814 (Archive::include_all_members): Likewise.
11815 (Archive::include_member): Change return type to bool. Return
11816 false if first included object has incompatible target. Set
11817 included_member_ field.
11818 (Add_archive_symbols::run): If add_symbols returns false, requeue
11819 Read_symbols task.
11820 * archive.h (class Archive): Add included_member_ field.
11821 Initialize it in constructor. Add input_file and searched_for
11822 methods. Update declarations.
11823 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11824 input_argument_ fields. Add them to constructor. Change all
11825 callers.
11826 * script.cc: Include "target-select.h".
11827 (class Parser_closure): Add skip_on_incompatible_target_ and
11828 found_incompatible_target_ fields. Add
11829 skip_on_incompatible_target parameter to constructor. Change all
11830 callers. Add methods skip_on_incompatible_target,
11831 clear_skip_on_incompatible_target, found_incompatible_target, and
11832 set_found_incompatible_target.
11833 (read_input_script): Add dirindex parameter. Change all callers.
11834 If parser finds an incompatible target, requeue Read_symbols
11835 task.
11836 (script_set_symbol): Clear skip_on_incompatible_target in
11837 closure.
11838 (script_add_assertion, script_parse_option): Likewise.
11839 (script_start_sections, script_add_phdr): Likewise.
11840 (script_check_output_format): New function.
11841 * script.h (read_input_script): Update declaration.
11842 * script-c.h (script_check_output_format): Declare.
11843 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11844 (ignore_cmd): Remove OUTPUT_FORMAT.
11845 * fileread.cc (Input_file::Input_file): Add explicit this.
11846 (Input_file::will_search_for): New function.
11847 (Input_file::open): Add pindex parameter. Change all callers.
11848 * fileread.h (class Input_file): Add input_file_argument method.
11849 Declare will_search_for. Update declarations.
11850 * object.cc (make_elf_object): Add punconfigured parameter.
11851 Change all callers.
11852 * object.h (class Object): Make input_file public. Add
11853 searched_for method.
11854 (make_elf_object): Update declaration.
11855 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11856 restart search.
11857 * dirsearch.h (class Dirsearch): Update declaration.
11858 * options.h (class General_options): Add --warn-search-mismatch.
11859 * parameters.cc (Parameters::is_compatible_target): New function.
11860 * parameters.h (class Parameters): Declare is_compatible_target.
11861 * workqueue.cc (Workqueue::add_blocker): New function.
11862 * workqueue.h (class Workqueue): Declare add_blocker.
11863
11864 * fileread.cc (Input_file::open): Remove options parameter.
11865 Change all callers.
11866 (Input_file::open_binary): Likewise.
11867 * script.cc (read_input_script): Likewise.
11868 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11869 options parameter from constructor. Change all callers.
11870 (class Read_script): Likewise.
11871 * fileread.h (class Input_file): Update declarations.
11872 * script.h (read_input_script): Update declaration.
11873
11874 2009-03-10 Nick Clifton <nickc@redhat.com>
11875
11876 * po/es.po: New Spanish translation.
11877
11878 2009-03-06 Cary Coutant <ccoutant@google.com>
11879
11880 * options.cc (parse_short_option): Keep dash_z from registering itself.
11881
11882 2009-03-03 Ian Lance Taylor <iant@google.com>
11883
11884 PR 9918
11885 * target-reloc.h (relocate_section): Pass output_section to
11886 relocate.
11887 * i386.cc (Target_i386::should_apply_static_reloc): Add
11888 output_section parameter. Change all callers.
11889 (Target_i386::Relocate::relocate): Add output_section parameter.
11890 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11891 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11892 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11893 * testsuite/two_file_shared.sh: New script.
11894 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11895 (check_DATA): Add two_file_shared.dbg.
11896 (two_file_shared.dbg): New target.
11897 * testsuite/Makefile.in: Rebuild.
11898
11899 2009-03-01 Ian Lance Taylor <iant@google.com>
11900
11901 * configure.ac: Check for byteswap.h.
11902 * configure: Rebuild.
11903 * config.in: Rebuild.
11904
11905 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11906
11907 * layout.cc (Layout::find_or_add_kept_section): New function.
11908 (Layout::add_comdat): Removed.
11909 * layout.h (struct Kept_section): Move out of class Layout.
11910 Remove trailing underscores from field names. Add group_sections
11911 field. Rename group_ field to is_group. Change all uses.
11912 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11913 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11914 comdat_groups_ field.
11915 (Sized_relobj::include_section_group): Use
11916 find_or_add_kept_section and Kept_section::group_sections.
11917 (Sized_relobj::include_linkonce_section): Likewise.
11918 * object.cc (class Sized_relobj): Don't define Comdat_group or
11919 Comdat_group_table. Remove find_comdat_group and
11920 add_comdat_group. Remove comdat_groups_ field.
11921 * plugin.cc (include_comdat_group): Use
11922 Layout::find_or_add_kept_section.
11923
11924 2009-02-28 Ian Lance Taylor <iant@google.com>
11925
11926 * README: --gc-sections and map files are now supported. Document
11927 some build requirements.
11928
11929 PR 6992
11930 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11931 relocatable link set the value of the section symbol to zero.
11932 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11933 relocatable link don't include the section address in the local
11934 symbol value.
11935
11936 2009-02-27 Ian Lance Taylor <iant@google.com>
11937
11938 PR 6811
11939 * options.h (class Search_directory): Add is_system_directory.
11940 (class General_options): Declare is_in_system_directory.
11941 * options.cc (get_relative_sysroot): Make static.
11942 (get_default_sysroot): Make static.
11943 (General_optoins::is_in_system_directory): New function.
11944 * fileread.cc (Input_file::is_in_system_directory): New function.
11945 * fileread.h (class Input_file): Declare is_in_system_directory.
11946 * object.h (class Object): Add is_in_system_directory.
11947 (class Input_objects): Remove system_library_directory_ field.
11948 * object.cc (Input_objects::add_object): Don't set
11949 system_library_directory_.
11950 (input_objects::found_in_system_library_directory): Remove.
11951 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11952 parameter. Change all callers.
11953 (Symbol_table::sized_write_globals): Likewise.
11954 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11955 Call Object::is_in_system_directory.
11956 * symtab.h (class Symbol_table): Update declarations.
11957
11958 PR 5990
11959 * descriptors.h (Open_descriptor): Add is_on_stack field.
11960 * descriptors.cc (Descriptors::open): If the descriptor is on the
11961 top of the stack, remove it. Initialize is_on_stack field.
11962 (Descriptors::release): Only add pod to stack if it is not on the
11963 stack already.
11964 (Descriptors::close_some_descriptor): Clear stack_next and
11965 is_on_stack fields.
11966
11967 PR 7091
11968 * output.cc (Output_section::find_starting_output_address): Rename
11969 from starting_output_address; add PADDR parameter; change return
11970 type.
11971 * output.h (class Output_section): Declare
11972 find_starting_output_address instead of starting_output_address.
11973 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11974 section symbol for which we can't find a merge section.
11975
11976 PR 9836
11977 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11978 hidden or internal, force the symbol to be local.
11979 * resolve.cc (Symbol::override_visibility): Define.
11980 (Symbol::override_base): Use override_visibility.
11981 (Symbol_table::resolve): Likewise.
11982 (Symbol::override_base_with_special): Likewise.
11983 (Symbol_table::override_with_special): If the visibility is hidden
11984 or internal, force the symbol to be local.
11985 * symtab.h (class Symbol): Add set_visibility and
11986 override_visibility.
11987 * testsuite/ver_test_1.sh: New file.
11988 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11989 (check_DATA): Add ver_test_1.syms.
11990 (ver_test_1.syms): New target.
11991 * testsuite/Makefile.in: Rebuild.
11992
11993 2009-02-25 Cary Coutant <ccoutant@google.com>
11994
11995 * layout.cc (Layout::choose_output_section): Don't rename sections
11996 when using a linker script that has a SECTIONS clause.
11997 * Makefile.in: Regenerate.
11998
11999 * testsuite/Makefile.am (script_test_5.sh): New test case.
12000 * testsuite/Makefile.in: Regenerate.
12001 * testsuite/script_test_5.cc: New file.
12002 * testsuite/script_test_5.sh: New file.
12003 * testsuite/script_test_5.t: New file.
12004
12005 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
12006
12007 * archive.cc (Archive::include_member): Update calls to add_symbols.
12008 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12009 the Layout argument.
12010 * dynobj.h (do_add_symbols): Add the Layout argument.
12011 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12012 Layout argument.
12013 * object.h (Object::add_symbols): Add the Layout argument.
12014 (Object::do_add_symbols): Add the Layout argument.
12015 (Sized_relobj::do_add_symbols): Add the Layout argument.
12016 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12017 Unify the two versions.
12018 (Add_plugin_symbols): Remove.
12019 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12020 (Sized_pluginobj::do_add_symbols): Unify the two versions.
12021 (Add_plugin_symbols): Remove.
12022 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12023 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12024 (Add_symbols::run): Make it work with Pulginobj.
12025
12026 2009-02-06 Ian Lance Taylor <iant@google.com>
12027
12028 * object.cc (Sized_relobj::do_layout): Make info message start
12029 with lower case letter.
12030
12031 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
12032
12033 * binary.cc: Fix file comment.
12034
12035 * options.h (enum Incremental_disposition): Define.
12036 (class General_options): Add new options: --incremental,
12037 --incremental_changed, --incremental_unchanged,
12038 --incremental_unknown. Add incremental_disposition_ and
12039 implicit_incremental_ fields.
12040 (General_options::incremental_disposition): New function.
12041 (class Position_dependent_options): Add incremental_disposition
12042 option.
12043 (Position_dependent_options::copy_from_options): Set incremental
12044 dispositions.
12045 * options.cc (General_options::parse_incremental_changed): New
12046 function.
12047 (General_options::parse_incremental_unchanged): New function.
12048 (General_options::parse_incremental_unknown): New function.
12049 (General_options::General_options): Initialize new fields
12050 incremental_disposition_ and implicit_incremental_.
12051 (General_options::finalize): Check for uasge of --incremental-*
12052 without --incremental.
12053
12054 2009-02-06 Chris Demetriou <cgd@google.com>
12055
12056 * gold.h (gold_undefined_symbol): Change to take only a Symbol
12057 pointer and to report location as the file name associated with
12058 the symbol.
12059 (gold_undefined_symbol_at_location): New function to replace the
12060 old gold_undefined_symbol functionality.
12061 * target-reloc.h (relocate_section): Update to use
12062 gold_undefined_symbol_at_location.
12063 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12064 Call gold_undefined_symbol function rather than gold_error.
12065 * errors.h (Errors::undefined_symbol): Take location as a
12066 string, rather than calculating it from a relocation.
12067 * errors.cc (Errors::fatal): Print "fatal error:" before the
12068 formatted message.
12069 (Errors::error, Errors::error_at_location): Print "error: "
12070 before the formatted message.
12071 (Errors::undefined_symbol): Take location as a string, rather
12072 than calculating it from a relocation.
12073 (gold_undefined_symbol_at_location): New function akin to
12074 old gold_undefined_symbol, calculates location from relocation.
12075 (gold_undefined_symbol): Change to take only a Symbol pointer
12076 and to report location as the file name associated with the symbol.
12077 * testsuite/debug_msg.sh: Update for changed error messages.
12078 * testsuite/undef_symbol.sh: Likewise.
12079
12080 2009-02-04 Duncan Sands <baldrick@free.fr>
12081
12082 PR 9812
12083 * reduced_debug_output.h
12084 (Output_reduced_debug_abbrev_section::failed): Use format for
12085 gold_warning.
12086 (Output_reduced_debug_info_section::faild): Likewise.
12087
12088 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
12089
12090 * script.cc (Lazy_demangler): New class.
12091 (Version_script_info::get_symbol_version_helper): Demangle a
12092 symbol only once.
12093
12094 2009-01-29 Cary Coutant <ccoutant@google.com>
12095
12096 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12097 to __tls_get_addr.
12098 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12099
12100 2009-01-28 Ian Lance Taylor <iant@google.com>
12101
12102 * version.cc (version_string): Bump to 1.9.
12103
12104 * gold.h: Include <cstring> and <stdint.h>.
12105 * version.cc: Include <cstdio>.
12106 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12107 warning.
12108 * reduced_debug_output.cc (insert_into_vector): Rename from
12109 Insert_into_vector; change all callers. Use Swap_unaligned to
12110 avoid aliasing issue; remove union since it is unnecessary.
12111
12112 2009-01-27 Sriraman Tallam <tmsriram@google.com>
12113
12114 * Makefile.am (CCFILES): Add gc.cc.
12115 (HFILES): Add gc.h.
12116 * Makefile.in: Regenerate.
12117 * gold.cc (Gc_runner): New class.
12118 (queue_initial_tasks): Call garbage collection related tasks
12119 when corresponding options are invoked.
12120 (queue_middle_gc_tasks): New function.
12121 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12122 processed early before laying out sections during garbage collection.
12123 * gold.h (queue_middle_gc_tasks): New function.
12124 (is_prefix_of): Move from "layout.cc".
12125 * i386.cc (Target_i386::gc_process_relocs): New function.
12126 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12127 * main.cc (main): Create object of class "Garbage_collection".
12128 * object.cc (Relobj::copy_symbols_data): New function.
12129 (Relobj::is_section_name_included): New function.
12130 (Sized_relobj::do_layout): Allow this function to be called twice
12131 during garbage collection and defer layout of section during the
12132 first call.
12133 * object.h (Relobj::get_symbols_data): New function.
12134 (Relobj::is_section_name_included): New function.
12135 (Relobj::copy_symbols_data): New function.
12136 (Relobj::set_symbols_data): New function.
12137 (Relobj::get_relocs_data): New function.
12138 (Relobj::set_relocs_data): New function.
12139 (Relobj::is_output_section_offset_invalid): New pure virtual function.
12140 (Relobj::gc_process_relocs): New function.
12141 (Relobj::do_gc_process_relocs): New pure virtual function.
12142 (Relobj::sd_): New data member.
12143 (Sized_relobj::is_output_section_offset_invalid): New function.
12144 (Sized_relobj::do_gc_process_relocs): New function.
12145 * options.h (General_options::gc_sections): Modify to not be a no-op.
12146 (General_options::print_gc_sections): New option.
12147 * plugin.cc (Plugin_finish::run): Remove function call to
12148 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
12149 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12150 * reloc.cc (Read_relocs::run): Add task to process relocs and
12151 determine unreferenced sections when doing garbage collection.
12152 (Gc_process_relocs): New class.
12153 (Sized_relobj::do_gc_process_relocs): New function.
12154 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12155 sections that are garbage collected.
12156 * reloc.h (Gc_process_relocs): New class.
12157 * sparc.cc (Target_sparc::gc_process_relocs): New function.
12158 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12159 symbols whose corresponding sections are garbage collected.
12160 (Symbol_table::Symbol_table): Add new parameter for the garbage
12161 collection object.
12162 (Symbol_table::gc_mark_undef_symbols): New function.
12163 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12164 (Symbol_table::gc_mark_dyn_syms): New function.
12165 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12166 as garbage.
12167 (Symbol_table::add_from_object): Likewise.
12168 (Symbol_table::add_from_relobj): When building shared objects, do not
12169 treat externally visible symbols as garbage.
12170 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12171 table information for static and relocatable links.
12172 * symtab.h (Symbol_table::set_gc): New function.
12173 (Symbol_table::gc): New function.
12174 (Symbol_table::gc_mark_undef_symbols): New function.
12175 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12176 (Symbol_table::gc_mark_dyn_syms): New function.
12177 (Symbol_table::gc_): New data member.
12178 * target.h (Sized_target::gc_process_relocs): New pure virtual
12179 function.
12180 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12181 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12182
12183 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
12184
12185 * options.h (General_options::gc_sections): Define as a no-op for now.
12186 (General_options::no_keep_memory): Ditto.
12187 (General_options::Bshareable): Define.
12188 * options.cc (General_options::finalize): Honor -Bshareable.
12189
12190 2009-01-20 Andreas Schwab <schwab@suse.de>
12191
12192 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12193 read the value in the contents, since we don't use it. Use the
12194 template endianness when writing.
12195 (Relocate::relocate): Use it for R_PPC_REL16_HA.
12196
12197 2009-01-19 Andreas Schwab <schwab@suse.de>
12198
12199 * configure.tgt (powerpc64-*): Fix targ_obj.
12200
12201 2009-01-15 Ian Lance Taylor <iant@google.com>
12202
12203 * object.cc (Sized_relobj::write_local_symbols): Don't write out
12204 local symbols when stripping all symbols.
12205
12206 2009-01-14 Cary Coutant <ccoutant@google.com>
12207
12208 * output.cc (Output_reloc): Add explicit instantiations.
12209
12210 2009-01-14 Cary Coutant <ccoutant@google.com>
12211
12212 * archive.cc (Archive::get_elf_object_for_member): Remove call
12213 to File_read::claim_for_plugin.
12214 * descriptors.cc (Descriptors::open): Remove reference to
12215 is_claimed.
12216 (Descriptors::claim_for_plugin): Remove.
12217 * descriptors.h (Descriptors::claim_for_plugin): Remove.
12218 (Descriptors::is_claimed): Remove.
12219 (claim_descriptor_for_plugin): Remove.
12220 * fileread.cc (File_read::claim_for_plugin): Remove.
12221 * fileread.h (File_read::claim_for_plugin): Remove.
12222 (File_read::descriptor): Reopen descriptor if necessary.
12223 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
12224 (Plugin_manager::all_symbols_read): Add task parameter. Change
12225 all callers.
12226 (Plugin_manager::get_input_file): New function.
12227 (Plugin_manager::release_input_file): New function.
12228 (Pluginobj::Pluginobj): Add filesize parameter and initialize
12229 corresponding data member.
12230 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12231 and pass to base constructor. Change all callers.
12232 (get_input_file, release_input_file): New functions.
12233 (make_sized_plugin_object): Add filesize parameter. Change all callers.
12234 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12235 (Plugin_manager::all_symbols_read): Add task parameter.
12236 (Plugin_manager::get_input_file): New function.
12237 (Plugin_manager::release_input_file): New function.
12238 (Plugin_manager::task_): New data member.
12239 (Pluginobj::Pluginobj): Add filesize parameter.
12240 (Pluginobj::filename): New function.
12241 (Pluginobj::descriptor): New function.
12242 (Pluginobj::filesize): New function.
12243 (Pluginobj::filesize_): New data member.
12244 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12245 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12246 File_read::claim_for_plugin; use Object::unlock to unlock the file.
12247
12248 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12249 with archive libraries.
12250 * testsuite/Makefile.in: Regenerate.
12251 * testsuite/plugin_test.c (struct sym_info): New type.
12252 (get_input_file, release_input_file): New static variables.
12253 (onload): Capture new transfer vector entries.
12254 (claim_file_hook): Stop reading at end of file according to filesize.
12255 Factor out parsing of readelf output into separate function.
12256 (all_symbols_read_hook): Exercise get_input_file and release_input_file
12257 APIs and get the source file name from the symbol table. Convert
12258 source file name to corresponding object file name. Print info
12259 message when adding new input files.
12260 (parse_readelf_line): New function.
12261 * testsuite/plugin_test_1.sh: Add checks for new info messages.
12262 * testsuite/plugin_test_2.sh: Likewise.
12263 * testsuite/plugin_test_3.sh: Likewise.
12264 * testsuite/plugin_test_4.sh: New test case.
12265
12266 2009-01-07 Ian Lance Taylor <iant@google.com>
12267
12268 * version.cc (version_string): Bump to 1.8.
12269
12270 2008-12-23 Cary Coutant <ccoutant@google.com>
12271
12272 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12273 * plugin.cc (Plugin_manager::finish): Rename as
12274 layout_deferred_objects. Move cleanup to separate function.
12275 (Plugin_manager::cleanup): New function.
12276 (Plugin_finish::run): Call layout_deferred_objects and cleanup
12277 separately.
12278 * plugin.h (Plugin_manager::finish): Rename as
12279 layout_deferred_objects.
12280 (Plugin_manager::cleanup): New function.
12281 (Plugin_manager::cleanup_done): New field.
12282
12283 2008-12-23 Cary Coutant <ccoutant@google.com>
12284
12285 * plugin.cc (is_visible_from_outside): New function.
12286 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12287 so we don't return "IR only" status for exported symbols or -r links.
12288
12289 * testsuite/Makefile.am (plugin_test_3): New test case.
12290 * testsuite/Makefile.in: Regenerate.
12291 * testsuite/plugin_test_3.sh: New file.
12292
12293 2008-12-22 Cary Coutant <ccoutant@google.com>
12294
12295 * object.cc (Sized_relobj::layout_section): New function.
12296 (Sized_relobj::do_layout): Defer layout of input sections until after
12297 plugin has provided replacement files.
12298 (Sized_relobj::do_layout_deferred_sections): New function.
12299 * object.h (Relobj::set_section_offset): Remove virtual keyword.
12300 (Relobj::layout_deferred_sections): New function.
12301 (Relobj::do_layout_deferred_sections): New function.
12302 (Sized_relobj::do_layout_deferred_sections): New function.
12303 (Sized_relobj::layout_section): New function.
12304 (Sized_relobj::Deferred_layout): New structure.
12305 (Sized_relobj::deferred_layout_): New field.
12306 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12307 Change all callers. Layout deferred sections.
12308 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
12309 references.
12310 (Plugin_hook::run): Move code from do_plugin_hook inline.
12311 (Plugin_hook::do_plugin_hook): Remove.
12312 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12313 (Plugin_manager::finish): Renamed, was cleanup.
12314 (Plugin_manager::should_defer_layout): New function.
12315 (Plugin_manager::add_deferred_layout_object): New function.
12316 (Plugin_manager::Deferred_layout_list): New type.
12317 (Plugin_manager::deferred_layout_objects_): New field.
12318 (Plugin_hook::do_plugin_hook): Remove.
12319
12320 2008-12-17 Ian Lance Taylor <iant@google.com>
12321
12322 * options.h (class General_options): Add --no case for
12323 --export-dynamic.
12324
12325 2008-12-16 Cary Coutant <ccoutant@google.com>
12326
12327 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12328 vector.
12329 (Plugin_manager::claim_file): Create plugin object even if
12330 plugin did not call the add_symbols callback.
12331 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12332 asking for more symbols than were added.
12333 * testsuite/Makefile.am (plugin_test_1): Add test case with
12334 no global symbols.
12335 (empty.syms): New target.
12336 * testsuite/Makefile.in: Regenerate.
12337 * testsuite/plugin_test.c (claim_file_hook): Add new debug
12338 message. Don't call add_symbols if no globals.
12339 (all_symbols_read_hook): Don't provide replacement for empty
12340 claimed file.
12341
12342 2008-12-12 Ian Lance Taylor <iant@google.com>
12343
12344 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12345 r_type == 0 for a local symbol with r_sym == 0.
12346 (scan_relocatable_relocs): Pass r_sym to
12347 local_non_section_strategy.
12348 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12349 r_sym parameter.
12350
12351 * configure.ac: Update test for TLS descriptors: they are
12352 supported as of glibc 2.9.
12353 * configure: Rebuild.
12354
12355 2008-12-11 Ian Lance Taylor <iant@google.com>
12356
12357 PR 7091
12358 * target-reloc.h (Default_scan_relocatable_relocs): For each
12359 function, map r_type == 0 to RELOC_DISCARD.
12360
12361 2008-12-10 Cary Coutant <ccoutant@google.com>
12362
12363 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12364 object to override a kept COMDAT group from a plugin object.
12365
12366 2008-12-09 Ian Lance Taylor <iant@google.com>
12367
12368 PR 7088
12369 * yyscript.y (file_cmd): Handle INPUT.
12370
12371 * testsuite/initpri1.c: Change all declarations to be full
12372 prototypes by adding void, to avoid compiler warnings.
12373
12374 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
12375
12376 * options.cc (General_options::parse_plugin_opt): New.
12377 (General_options::add_plugin): The argument now is just the filename.
12378 (General_options::add_plugin_option): New.
12379 * options.h (plugin_opt): New.
12380 (add_plugin): Change argument name.
12381 (add_plugin_option): New.
12382 * plugin.cc (Plugin::load): Don't parse the plugin option.
12383 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12384 (Plugin::add_option): New.
12385 (Plugin::args_): Change type.
12386 (Plugin::filename_): New.
12387 (Plugin_manager::add_plugin_option): New.
12388 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12389 * testsuite/Makefile.in: Regenerate.
12390
12391 2008-12-05 Cary Coutant <ccoutant@google.com>
12392
12393 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12394 Handle --strip-lto-sections option.
12395 * options.h (strip_lto_sections): New option.
12396
12397 2008-12-01 Cary Coutant <ccoutant@google.com>
12398
12399 * plugin.cc (ld_plugin_message): Change format parameter to const.
12400 Fix mismatch between new[] and delete.
12401
12402 2008-11-14 Cary Coutant <ccoutant@google.com>
12403
12404 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12405 instead of -1U.
12406
12407 2008-11-05 Craig Silverstein <csilvers@google.com>
12408
12409 * options.cc (General_options::parse_dynamic_list): New function.
12410 * options.h (General_options): New flags dynamic_list,
12411 dynamic_list_data, dynamic_list_cpp_new, and
12412 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
12413 (General_options::in_dynamic_list): New function.
12414 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12415 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12416 (Lex::can_continue_name): Likewise.
12417 (yylex): Likewise.
12418 (read_script_file): New parameter script_options.
12419 (read_dynamic_list): New function.
12420 (Script_options::define_dynamic_list): New function.
12421 (dynamic_list_keyword_parsecodes): New variable.
12422 (dynamic_list_keywords): New variable.
12423 * script.h (Script_options::define_dynamic_list): New function
12424 prototype.
12425 (read_dynamic_list): New function prototype.
12426 * symtab.cc (strprefix): New macro.
12427 (Symbol::should_add_dynsym_entry): Support dynamic_list,
12428 dynamic_list_data, dynamic_list_cpp_new, and
12429 dynamic_list_cpp_typeinfo.
12430 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12431 (dynamic_list_expr): New rule.
12432 (dynamic_list_nodes): Likewise.
12433 (dynamic_list_node): Likewise.
12434 * testsuite/Makefile.am (dynamic_list): New test.
12435 * testsuite/Makefile.in: Regenerated.
12436 * testsuite/dynamic_list.t: New file.
12437 * testsuite/dynamic_list.sh: New file.
12438
12439 2008-11-05 Craig Silverstein <csilvers@google.com>
12440
12441 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12442 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12443 (t11_last): Likewise.
12444 * testsuite/ver_test_6.c (main): Likewise.
12445
12446 2008-10-07 Cary Coutant <ccoutant@google.com>
12447
12448 * options.c (General_options::finalize): Add check for -static and
12449 -shared.
12450 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12451 is not empty.
12452
12453 2008-10-02 Cary Coutant <ccoutant@google.com>
12454
12455 * plugin.cc (make_sized_plugin_object): Fix conditional
12456 compilation to work when not all targets are enabled.
12457
12458 2008-09-29 Cary Coutant <ccoutant@google.com>
12459
12460 * archive.cc (Archive::get_file_and_offset): Use filename instead
12461 of name to get library path.
12462 (Archive::include_member): Unlock external member of a thin archive.
12463
12464 * testsuite/Makefile.am (TEST_AR): New variable.
12465 (thin_archive_test_1): New test.
12466 (thin_archive_test_2): New test.
12467 * testsuite/Makefile.in: Regenerate.
12468 * testsuite/thin_archive_main.cc: New file.
12469 * testsuite/thin_archive_test_1.cc: New file.
12470 * testsuite/thin_archive_test_2.cc: New file.
12471 * testsuite/thin_archive_test_3.cc: New file.
12472 * testsuite/thin_archive_test_4.cc: New file.
12473
12474 2008-09-29 Cary Coutant <ccoutant@google.com>
12475
12476 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12477 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12478 instead of -1U.
12479 (Sized_relobj::do_finalize_local_symbols): Likewise.
12480 (Sized_relobj::map_to_kept_section): Likewise.
12481 * object.h (Sized_relobj::invalid_address): New constant.
12482 (Sized_relobj::do_output_section_offset): Check for invalid_address
12483 and return -1ULL.
12484 * output.cc (Output_reloc::local_section_offset): Use constant
12485 invalid_address instead of -1U.
12486 (Output_reloc::get_address): Likewise.
12487 (Output_section::output_address): Change -1U to -1ULL.
12488 * output.h (Output_reloc::invalid_address): New constant.
12489 * reloc.cc (Sized_relobj::write_sections): Use constant
12490 invalid_address instead of -1U.
12491 (Sized_relobj::relocate_sections): Likewise.
12492 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12493 values for merge sections.
12494 * target-reloc.h (relocate_for_relocatable): Use constant
12495 invalid_address instead of -1U.
12496
12497 2008-09-19 Cary Coutant <ccoutant@google.com>
12498
12499 Add plugin functionality for link-time optimization (LTO).
12500 * configure.ac (plugins): Add --enable-plugins option.
12501 * configure: Regenerate.
12502 * config.in: Regenerate.
12503 * Makefile.am (LIBDL): New variable.
12504 (CCFILES): Add plugin.cc.
12505 (HFILES): Add plugin.h.
12506 (ldadd_var): Add LIBDL.
12507 * Makefile.in: Regenerate.
12508
12509 * archive.cc: Include "plugin.h".
12510 (Archive::setup): Don't preread archive symbols when using a plugin.
12511 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
12512 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12513 files.
12514 (Archive::include_member): Add symbols from plugin objects.
12515 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12516 * descriptors.cc (Descriptors::open): Check for file descriptors
12517 abandoned by plugins.
12518 (Descriptors::claim_for_plugin): New function.
12519 * descriptors.h (Descriptors::claim_for_plugin): New function.
12520 (Open_descriptor::is_claimed): New field.
12521 (claim_descriptor_for_plugin): New function.
12522 * fileread.cc (File_read::claim_for_plugin): New function.
12523 * fileread.h (File_read::claim_for_plugin): New function.
12524 (File_read::descriptor): New function.
12525 * gold.cc: Include "plugin.h".
12526 (queue_initial_tasks): Add task to call plugin hooks for generating
12527 new object files.
12528 * main.cc: Include "plugin.h".
12529 (main): Load plugin libraries.
12530 * object.h (Pluginobj): Declare.
12531 (Object::pluginobj): New function.
12532 (Object::do_pluginobj): New function.
12533 (Object::set_target): New function.
12534 * options.cc: Include "plugin.h".
12535 (General_options::parse_plugin): New function.
12536 (General_options::General_options): Initialize plugins_ field.
12537 (General_options::add_plugin): New function.
12538 * options.h (Plugin_manager): Declare.
12539 (General_options): Add --plugin option.
12540 (General_options::has_plugins): New function.
12541 (General_options::plugins): New function.
12542 (General_options::add_plugin): New function.
12543 (General_options::plugins_): New field.
12544 * plugin.cc: New file.
12545 * plugin.h: New file.
12546 * readsyms.cc: Include "plugin.h".
12547 (Read_symbols::do_read_symbols): Check for archive before checking
12548 for ELF file. Call plugin hooks to claim files.
12549 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12550 from a real object file; force override when processing replacement
12551 files.
12552 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12553 (Symbol::init_base_object): Likewise.
12554 (Symbol::init_base_output_data): Likewise.
12555 (Symbol::init_base_output_segment): Likewise.
12556 (Symbol::init_base_constant): Likewise.
12557 (Symbol::init_base_undefined): Likewise.
12558 (Symbol::output_section): Assert that object is not a plugin.
12559 (Symbol_table::add_from_pluginobj): New function.
12560 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12561 undefined.
12562 (Symbol_table::sized_write_globals): Likewise.
12563 (Symbol_table::add_from_pluginobj): Instantiate template.
12564 * symtab.h (Sized_pluginobj): Declare.
12565 (Symbol::in_real_elf): New function.
12566 (Symbol::set_in_real_elf): New function.
12567 (Symbol::in_real_elf_): New field.
12568 (Symbol_table::add_from_pluginobj): New function.
12569
12570 * testsuite/Makefile.am (AM_CFLAGS): New variable.
12571 (LIBDL): New variable.
12572 (LDADD): Add LIBDL.
12573 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12574 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12575 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12576 (MOSTLYCLEANFILES): Likewise.
12577 * testsuite/Makefile.in: Regenerate.
12578 * testsuite/plugin_test.c: New file.
12579 * testsuite/plugin_test_1.sh: New file.
12580 * testsuite/plugin_test_2.sh: New file.
12581
12582 2008-09-16 Ian Lance Taylor <iant@google.com>
12583
12584 * target-reloc.h (relocate_section): Check whether a symbol is
12585 defined by the ABI before reporting an undefined symbol error.
12586 * target.h (Target::is_defined_by_abi): Make parameter const.
12587 (Target::do_is_defined_by_abi): Likewise.
12588 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12589 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12590 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12591 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12592 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12593 * testsuite/Makefile.in: Rebuild.
12594
12595 * fileread.cc (make_view): Add casts to avoid warning.
12596
12597 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12598
12599 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12600 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12601
12602 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12603
12604 * options.h (General_options::output_is_executable): New.
12605 (General_options::output_is_pie): New.
12606 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12607 for shared libraries.
12608 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12609
12610 2008-09-11 Chris Demetriou <cgd@google.com>
12611
12612 * options.h (origin): New -z option.
12613 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12614 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12615 in DT_FLAGS_1.
12616
12617 2008-09-05 Cary Coutant <ccoutant@google.com>
12618
12619 * fileread.cc (File_read::make_view): Add check for attempt to map
12620 beyond end of file.
12621
12622 2008-09-05 Cary Coutant <ccoutant@google.com>
12623
12624 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12625 explicit instantiations.
12626
12627 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
12628
12629 PR gold/6858
12630 * options.cc (General_options::finalize): Allow undefined symbols
12631 in shlibs if linking -shared.
12632
12633 PR gold/6859
12634 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12635 symbols as not needing a dynsym entry.
12636
12637 2008-08-20 Craig Silverstein <csilvers@google.com>
12638
12639 * fileread.cc (File_read::open): Do not lock the file unless it
12640 was successfully opened.
12641
12642 2008-08-14 Cary Coutant <ccoutant@google.com>
12643
12644 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12645 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12646 * testsuite/tls_test.cc (struct int128): 128-bit struct
12647 for testing TLS relocs with non-zero addend.
12648 (v12): New TLS variable.
12649 (t12): New test.
12650 (t_last): Add check for v12.
12651 * testsuite/tls_test.h (t12): New function.
12652 * testsuite/tls_test_main.cc (thread_routine): Call new test.
12653
12654 2008-08-13 Ian Lance Taylor <iant@google.com>
12655
12656 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12657 set tls_segment_ or relro_segment_.
12658 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12659 when appropriate.
12660 * output.h (Output_section::clear_is_relro): New function.
12661 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12662 sections specially even when output_data_ is empty.
12663 (Output_segment::maximum_alignment): When first section is relro,
12664 only force alignment for PT_LOAD segments.
12665 * script.cc (script_data_segment_align): New function.
12666 (script_data_segment_relro_end): New function.
12667 * script-c.h (script_data_segment_align): Declare.
12668 (script_data_segment_relro_end): Declare.
12669 * script-sections.h (class Script_sections): Declare
12670 data_segment_align and data_segment_relro_end. Add fields
12671 segment_align_index_ and saw_relro_end_.
12672 * script-sections.cc (class Sections_element): Add set_is_relro
12673 virtual function. Add new bool* parameter to place_orphan_here.
12674 Add get_output_section virtual function.
12675 (class Output_section_definition): Add set_is_relro. Add new
12676 bool* parameter to place_orphan_here. Add get_output_section.
12677 Add is_relro_ field.
12678 (Output_section_definition::Output_section_definition): Initialize
12679 evaluated_address_, evaluated_load_address, evaluated_addralign_,
12680 and is_relro_ fields.
12681 (Output_section_definition::place_orphan_here): Add is_relro
12682 parameter.
12683 (Output_section_definition::set_section_addresses): Set relro for
12684 output section.
12685 (Output_section_definition::alternate_constraint): Likewise.
12686 (class Orphan_output_section): Add new bool* parameter to
12687 place_orphan_here. Add get_output_section.
12688 (Orphan_output_section::place_orphan_here): Add is_relro
12689 parameter.
12690 (Script_sections::Script_sections): Initialize
12691 data_segment_align_index_ and saw_relro_end_.
12692 (Script_sections::data_segment_align): New function.
12693 (Script_sections::data_segment_relro_end): New function.
12694 (Script_sections::place_orphan): Set or clear is_relro.
12695 (Script_sections::set_section_addresses): Force alignment of first
12696 TLS section.
12697 * yyscript.y (exp): Call script_data_segment_align and
12698 script_data_segment_relro_end.
12699 * testsuite/relro_script_test.t: New file.
12700 * testsuite/relro_test.cc (using_script): Declare.
12701 (t1, t2): Test using_script.
12702 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12703 (relro_script_test_SOURCES): Define.
12704 (relro_script_test_DEPENDENCIES): Define.
12705 (relro_script_test_LDFLAGS): Define.
12706 (relro_script_test_LDADD): Define.
12707 (relro_script_test.so): New target.
12708 * testsuite/Makefile.in: Rebuild.
12709
12710 2008-08-06 Cary Coutant <ccoutant@google.com>
12711
12712 * archive.cc (Archive::total_archives, Archive::total_members)
12713 (Archive::total_members_loaded): New variables.
12714 (Archive::setup): Add parameter. Add option to preread
12715 archive symbols.
12716 (Archive::read_armap): Add counter.
12717 (Archive::get_file_and_offset): New function.
12718 (Archive::get_elf_object_for_member): New function.
12719 (Archive::read_all_symbols): New function.
12720 (Archive::read_symbols): New function.
12721 (Archive::add_symbols): Add counters.
12722 (Archive::include_all_members): Use armap to find members if it's
12723 already built.
12724 (Archive::include_member): Skip reading symbols if already read.
12725 Factored code into Archive::get_file_and_offset and
12726 Archive::get_elf_object_for_member. Changed call to
12727 Mapfile::report_include_archive_member.
12728 (Archive::print_stats): New function.
12729 * archive.h: Declare Object and Read_symbols_data classes.
12730 (Archive::Archive): Add initializers for new members.
12731 (Archive::setup): Add parameter.
12732 (Archive::print_stats): New function.
12733 (Archive::total_archives, Archive::total_members)
12734 (Archive::total_members_loaded): New variables.
12735 (Archive::get_file_and_offset): New function.
12736 (Archive::get_elf_object_for_member): New function.
12737 (Archive::read_all_symbols): New function.
12738 (Archive::read_symbols): New function.
12739 (Archive::Archive_member): New class.
12740 (Archive::members_): New member.
12741 (Archive::num_members_): New member.
12742 * main.cc: Include archive.h.
12743 (main): Call Archive::print_stats.
12744 * mapfile.cc (Mapfile::report_include_archive_member): Delete
12745 archive parameter; member_name is now the fully-decorated name.
12746 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12747 * options.h: (General_options): Add --preread-archive-symbols option.
12748 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12749 Archive::setup.
12750
12751 2008-08-04 Ian Lance Taylor <iant@google.com>
12752
12753 * symtab.h (Symbol::use_plt_offset): New function.
12754 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12755 * powerpc.cc (Relocate::relocate): Likewise.
12756 * sparc.cc (Relocate::relocate): Likewise.
12757 * x86_64.cc (Relocate::relocate): Likewise.
12758 * testsuite/weak_plt.sh: New test.
12759 * testsuite/weak_plt_main.cc: New test.
12760 * testsuite/weak_plt_shared.cc: New test.
12761 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12762 (check_PROGRAMS): Add weak_plt.
12763 (check_DATA): Add weak_plt_shared.so.
12764 (weak_plt_main_pic.o, weak_plt): New targets.
12765 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12766 * testsuite/Makefile.in: Rebuild.
12767
12768 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12769 gcctestdir/ld.
12770 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12771 * testsuite/Makefile.in: Rebuild.
12772
12773 2008-08-04 Alan Modra <amodra@bigpond.net.au>
12774
12775 * Makefile.am (POTFILES.in): Set LC_ALL=C.
12776 * Makefile.in: Regenerate.
12777 * po/POTFILES.in: Regenerate.
12778
12779 2008-07-29 Ian Lance Taylor <iant@google.com>
12780
12781 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12782 symbols before other symbols.
12783 * testsuite/script_test_2.cc (test_addr): Declare.
12784 (test_addr_alias): Declare.
12785 (main): Check that test_addr and test_addr_alias have the right
12786 values.
12787 * testsuite/script_test_2.t: Define test_addr_alias and
12788 test_addr.
12789
12790 2008-07-24 Ian Lance Taylor <iant@google.com>
12791
12792 PR 5990
12793 * descriptors.cc: New file.
12794 * descriptors.h: New file.
12795 * gold-threads.h (class Hold_optional_lock): New class.
12796 * fileread.cc: Include "descriptors.h".
12797 (File_read::~File_read): Release descriptor rather than closing
12798 it.
12799 (File_read::open) [file]: Call open_descriptor rather than open.
12800 Set is_descriptor_opened_.
12801 (File_read::open) [memory]: Assert that descriptor is not open.
12802 (File_read::reopen_descriptor): New function.
12803 (File_read::release): Release descriptor.
12804 (File_read::do_read): Make non-const. Reopen descriptor.
12805 (File_read::read): Make non-const.
12806 (File_read::make_view): Reopen descriptor.
12807 (File_read::do_readv): Likewise.
12808 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12809 Update declarations.
12810 * layout.cc: Include "descriptors.h".
12811 (Layout::create_build_id): Use open_descriptor rather than open.
12812 * output.cc: Include "descriptors.h".
12813 (Output_file::open): Use open_descriptor rather than open.
12814 * archive.cc (Archive::const_iterator): Change Archive to be
12815 non-const.
12816 (Archive::begin, Archive::end): Make non-const.
12817 (Archive::count_members): Likewise.
12818 * archive.h (class Archive): Update declarations.
12819 * object.h (Object::read): Make non-const.
12820 * Makefile.am (CCFILES): Add descriptors.cc.
12821 (HFILES): Add descriptors.h.
12822 * Makefile.in: Rebuild.
12823
12824 PR 6716
12825 * gold.h: Always include <clocale>. Add Solaris workarounds
12826 following code in binutils/sysdep.h.
12827
12828 PR 6048
12829 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12830 this->eh_frame_hdr_ is NULL before using it.
12831
12832 * dynobj.cc (Versions::Versions): Update comment.
12833
12834 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12835 the base version name.
12836
12837 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12838 array size plus one.
12839 (Stringpool_template::set_string_offsets): Subtract one from key
12840 before using it as an array index.
12841 (Stringpool_template::get_offset_with_length): Likewise.
12842 (Stringpool_template::write_to_buffer): Likewise.
12843 * stringpool.h (Stringpool_template::get_offset_from_key):
12844 Likewise.
12845
12846 2008-07-23 Ian Lance Taylor <iant@google.com>
12847
12848 PR 6658
12849 * object.h (Merged_symbol_value::value): Do our best to handle a
12850 negative addend.
12851
12852 PR 6647
12853 * script.cc (Version_script_info::get_versions): Don't add empty
12854 version tag to return value.
12855 (Version_script_info::get_symbol_version_helper): Change return
12856 type to bool. Add pversion parameter. Change all callers.
12857 (script_register_vers_node): Don't require a non-NULL tag.
12858 * script.h (class Version_script_info): Update declarations.
12859 (Version_script_info::get_symbol_version): Change return type to
12860 bool. Add version parameter. Change all callers.
12861 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12862 handling. Handle an empty version from a version script.
12863 (Symbol_table::define_special_symbol): Likewise.
12864 * testsuite/ver_test_10.script: New file.
12865 * testsuite/ver_test_10.sh: New file.
12866 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12867 (check_DATA): Add ver_test_10.syms.
12868 (ver_test_10.syms, ver_test_10.so): New target.
12869 * testsuite/Makefile.in: Rebuild.
12870
12871 2008-07-23 Simon Baldwin <simonb@google.com>
12872
12873 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12874 to zero for undefined symbols from dynamic libraries.
12875
12876 2008-07-23 Ian Lance Taylor <iant@google.com>
12877
12878 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12879 Change all callers.
12880 * symtab.h (class Symbol_table): Update declaration.
12881 * testsuite/ver_test_9.cc: New file.
12882 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12883 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12884 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12885 (ver_test_9.so, ver_test_9.o): New targets.
12886 * testsuite/Makefile.in: Rebuild.
12887
12888 2008-07-22 Ian Lance Taylor <iant@google.com>
12889
12890 * options.h (class General_options): Define --check-sections.
12891 * layout.cc (Layout::set_segment_offsets): Handle
12892 --check-sections.
12893
12894 * options.h (class General_options): Define -n/--nmagic and
12895 -N/--omagic.
12896 * options.cc (General_options::finalize): For -n/--nmagic or
12897 -N/--omagic, set -static.
12898 * layout.cc (Layout::attach_allocated_section_to_segment): If
12899 -N/--omagic, don't put read-only and read-write sections in
12900 different segments.
12901 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12902 finding a read-only segment.
12903 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12904 don't set the minimum segment alignment to the common page size,
12905 and don't set the file offset to the address modulo the page size.
12906 * script-sections.cc (Script_sections::create_segments): If
12907 -n/--omagic, don't put read-only and read-write sections in
12908 different segments.
12909
12910 * cref.cc: New file.
12911 * cref.h: New file.
12912 * options.h (class General_options): Add --print-symbol-counts.
12913 * main.cc (main): Issue defined symbol report if requested.
12914 * archive.cc (Archive::interpret_header): Make into a const member
12915 function.
12916 (Archive::add_symbols): Call Input_objects::archive_start and
12917 archive_stop.
12918 (Archive::const_iterator): Define new class.
12919 (Archive::begin, Archive::end): New functions.
12920 (Archive::include_all_members): Rewrite to use iterator.
12921 (Archive::count_members): New function.
12922 * archive.h (class Archive): Update declarations.
12923 (Archive::filename): New function.
12924 * object.cc: Include "cref.h".
12925 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12926 (Sized_relobj::do_get_global_symbol_counts): New function.
12927 (Input_objects::add_object): Add object to cross-referencer.
12928 (Input_objects::archive_start): New function.
12929 (Input_objects::archive_stop): New function.
12930 (Input_objects::print_symbol_counts): New function.
12931 * object.h: Declare Cref and Archive.
12932 (Object::get_global_symbol_counts): New function.
12933 (Object::do_get_global_symbol_counts): New pure virtual function.
12934 (class Sized_relobj): Add defined_count_ field. Update
12935 declarations.
12936 (class Input_objects): Add cref_ field. Update constructor.
12937 Update declarations.
12938 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12939 defined_count_.
12940 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12941 symbol counts.
12942 (Sized_dynobj::do_get_global_symbol_counts): New function.
12943 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12944 defined_count_. Update declarations. Define Symbols typedef.
12945 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12946 parameter. Change all callers.
12947 (Symbol_table::add_from_dynobj): Add sympointers and defined
12948 parameters. Change all callers.
12949 * symtab.h (class Symbol_table): Update declarations.
12950 * Makefile.am (CCFILES): Add cref.cc.
12951 (HFILES): Add cref.h.
12952 * Makefile.in: Rebuild.
12953
12954 2008-07-22 Simon Baldwin <simonb@google.com>
12955
12956 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12957 to zero when writing undefined symbols.
12958
12959 2008-07-22 Ian Lance Taylor <iant@google.com>
12960
12961 * output.cc (Output_section::add_input_section): Don't try to
12962 merge empty merge sections.
12963
12964 2008-07-21 Craig Silverstein <csilvers@google.com>
12965
12966 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12967 Include symbol version in error message.
12968
12969 2008-07-20 Chris Demetriou <cgd@google.com>
12970
12971 * configure.ac (gold_cv_c_random_seed): New configured variable.
12972 (RANDOM_SEED_CFLAGS): New substituted variable.
12973 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12974 * configure: Rebuild.
12975 * Makefile.in: Likewise.
12976 * testsuite/Makefile.in: Likewise.
12977
12978 2008-07-18 Ian Lance Taylor <iant@google.com>
12979
12980 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12981 where we see NAME/NULL and NAME/VERSION as separate symbols.
12982 * testsuite/ver_test_main.cc (main): Call t4.
12983 (t4, t4_2a): Define.
12984 * testsuite/ver_test_2.cc (t4_2): Define.
12985 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12986 * testsuite/ver_test_4.cc (t4_2a): Define.
12987 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12988 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12989
12990 2008-07-17 Ian Lance Taylor <iant@google.com>
12991
12992 * dynobj.cc (Versions::add_def): If we give an error about a
12993 missing version, go ahead and create the version anyhow.
12994
12995 2008-07-10 Ian Lance Taylor <iant@google.com>
12996
12997 Handle output sections with more than 0x7fffffff bytes.
12998 * object.h (class Relobj): Change map_to_output_ to
12999 output_sections_, and just keep a section pointer. Change all
13000 uses. Move comdat group support to Sized_relobj.
13001 (Relobj::is_section_specially_mapped): Remove.
13002 (Relobj::output_section): Remove poff parameter. Change all
13003 callers.
13004 (Relobj::output_section_offset): New function.
13005 (Relobj::set_section_offset): Rewrite.
13006 (Relobj::map_to_output): Remove.
13007 (Relobj::output_sections): New function.
13008 (Relobj::do_output_section_offset): New pure virtual function.
13009 (Relobj::do_set_section_offset): Likewise.
13010 (class Sized_relobj): Add section_offsets_ field. Add comdat
13011 group support from Relobj. Update declarations.
13012 (Sized_relobj::get_output_section_offset): New function.
13013 (Sized_relobj::do_output_section_offset): New function.
13014 (Sized_relobj::do_set_section_offset): New function.
13015 * object.cc (Relobj::output_section_address): Remove.
13016 (Sized_relobj::Sized_relobj): Initialize new fields.
13017 (Sized_relobj::include_section_group): Cast find_kept_object to
13018 Sized_relobj.
13019 (Sized_relobj::include_linkonce_section): Likewise.
13020 (Sized_relobj::do_layout): Use separate arrays for output section
13021 and output offset.
13022 (Sized_relobj::do_count_local_symbols): Change map_to_output to
13023 output_sections.
13024 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13025 output_sections and section_offsets.
13026 (Sized_relobj::write_local_symbols): Likewise.
13027 (map_to_kept_section): Compute output address directly.
13028 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13029 output_sections and section_offsets.
13030 (Sized_relobj::write_sections): Likewise.
13031 (Sized_relobj::relocate_sections): Likewise.
13032 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13033 * output.h (class Output_reloc): Update declarations. Change
13034 u2_.relobj to Sized_relobj*.
13035 (class Output_data_reloc): Change add functions to use
13036 Sized_relobj*.
13037 * output.cc (Output_reloc::Output_reloc): Change relobj to
13038 Sized_relobj*.
13039 (Output_reloc::local_section_offset): Change return type to
13040 Elf_Addr. Use get_output_section_offset.
13041 (Output_reloc::get_address): Likewise.
13042 (Output_section::is_input_address_mapped): Don't call
13043 is_section_specially_mapped.
13044 (Output_section::output_offset): Likewise.
13045 (Output_section::output_address): Likewise.
13046 (Output_section::starting_output_address): Likewise.
13047 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13048 parameter to Sized_relobj*.
13049 (Copy_relocs::need_copy_reloc): Likewise.
13050 (Copy_relocs::save): Likewise.
13051 * copy-relocs.h (class Copy_relocs): Update declarations.
13052 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13053 Sized_relobj*. Change relobj_ field to Sized_relobj*.
13054 * target-reloc.h (relocate_for_relocatable): Change
13055 offset_in_output_section type to Elf_Addr. Change code that uses
13056 it as well.
13057 * layout.cc (Layout::layout): Always set *off.
13058 * mapfile.cc (Mapfile::print_input_section): Use
13059 output_section_offset.
13060 * i386.cc (Target_i386::copy_reloc): Change object parameter to
13061 Sized_relobj*.
13062 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13063 * sparc.cc (Target_sparc::copy_reloc): Likewise.
13064 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13065
13066 2008-07-03 Ian Lance Taylor <iant@google.com>
13067
13068 * layout.cc (Layout::include_section): Do not discard unrecognized
13069 SHT_STRTAB sections.
13070
13071 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
13072
13073 * script.cc (Lex::can_continue_name): Make '?' allowable in
13074 version-script names.
13075 * testsuite/version_script.map: Change glob pattern to use '?'
13076
13077 2008-06-30 Manish Singh <yosh@gimp.org>
13078
13079 PR 6585
13080 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13081 Correct typo.
13082
13083 2008-06-30 Ian Lance Taylor <iant@google.com>
13084
13085 PR 6660
13086 PR 6682
13087 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13088 versions]: Don't try to read the value in the contents, since we
13089 don't use it. Use the template endianness when writing.
13090
13091 2008-06-25 Cary Coutant <ccoutant@google.com>
13092
13093 * fileread.cc (File_read::make_view): Assert on zero-length view.
13094 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13095 symbol table when there are no symbols to read.
13096
13097 2008-06-23 Craig Silverstein <csilvers@google.com>
13098
13099 * version.cc (version_string): Bump to 1.7
13100
13101 2008-06-18 Craig Silverstein <csilvers@google.com>
13102
13103 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13104 constant 0xFFFF to type Valtype.
13105 (Powerpc_relocate_functions::rel16_ha): Likewise.
13106
13107 2008-06-17 Ian Lance Taylor <iant@google.com>
13108
13109 * output.h (Output_section::Input_section): Initialize p2align_ to
13110 zero for Output_section_data constructors.
13111 (Output_section::Input_section::addralign): If not an input
13112 section, return the alignment of the Output_section_data.
13113 * testsuite/copy_test.cc: New file.
13114 * testsuite/copy_test_1.cc: New file.
13115 * testsuite/copy_test_2.cc: New file.
13116 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13117 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13118 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13119 (copy_test_1_pic.o, copy_test_1.so): New targets.
13120 (copy_test_2_pic.o, copy_test_2.so): New targets.
13121 * testsuite/Makefile.in: Rebuild.
13122
13123 * script-sections.cc (Script_sections::place_orphan): Initialize
13124 local variable exact.
13125
13126 2008-06-13 David Edelsohn <edelsohn@gnu.org>
13127
13128 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13129
13130 2008-06-12 David Edelsohn <edelsohn@gnu.org>
13131 David S. Miller <davem@davemloft.net>
13132
13133 * powerpc.cc: New file.
13134 * Makefile.am (TARGETSOURCES): Add powerpc.cc
13135 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13136 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13137 * Makefile.in: Rebuild.
13138
13139 2008-06-09 Ian Lance Taylor <iant@google.com>
13140
13141 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13142 <exception>.
13143 (throwing, orig_terminate): New static variables.
13144 (terminate_handler): New static function.
13145 (t2): Set terminate handler.
13146
13147 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
13148
13149 PR 6584
13150 * binary.cc (Binary_to_elf::sized_convert): Fix .data
13151 alignment.
13152
13153 2008-05-30 Cary Coutant <ccoutant@google.com>
13154
13155 * archive.cc (Archive::include_all_members) Correct to step
13156 over symbol table and extended name table in thin archives.
13157
13158 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
13159
13160 PR 6407
13161 * target-reloc.h (relocate_for_relocatable): Fix new_offset
13162 calculation.
13163
13164 2008-05-28 Caleb Howe <cshowe@google.com>
13165
13166 * reduced_debug_output.cc: New file.
13167 * reduced_debug_output.h: New file.
13168 * options.h (class General_options): Add --strip-debug-non-line.
13169 * options.cc (General_options::finalize): Add strip_debug_non_line
13170 to the strip heirarchy.
13171 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13172 fields.
13173 * layout.cc: Include "reduced_debug_output.h".
13174 (Layout::Layout): Initialize new fields.
13175 (line_only_debug_sections): New static array.
13176 (is_lines_only_debug_sections): New static inline function.
13177 (Layout::include_section): Handle --strip-debug-non-line.
13178 (Layout::make_output_section): If --strip-debug-non-line, build
13179 new output sections for .debug_abbrev and .debug_info.
13180 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13181 gold. Warn about possible overflow.
13182 (read_signed_LEB_128): Likewise.
13183 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13184 (read_signed_LEB_128): Declare.
13185 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13186 (HFILES): Add reduced_debug_output.h.
13187 * Makefile.in: Rebuild.
13188
13189 2008-05-21 Ian Lance Taylor <iant@google.com>
13190
13191 * mapfile.cc: New file.
13192 * mapfile.h: New file.
13193 * options.h (class General_options): Add -M/--print-map and -Map.
13194 * options.cc (General_options::finalize): Make -M equivalent to
13195 -Map -.
13196 * main.cc: Include <cstdio> and "mapfile.h".
13197 (main): Open mapfile if requested.
13198 * gold.cc (class Middle_runner): Add mapfile_ field. Update
13199 constructor. Change caller.
13200 (queue_initial_tasks): Add mapfile parameter. Change caller.
13201 (queue_middle_tasks): Likewise.
13202 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13203 declarations.
13204 * archive.cc: Include "mapfile.h".
13205 (Archive::add_symbols): Add mapfile parameter. Change all
13206 callers. Pass mapfile, symbol, and reason to include_member.
13207 (Archive::include_all_members): Add mapfile parameter. Change all
13208 callers.
13209 (Archive::include_member): Add mapfile, sym, and why parameters.
13210 Change all callers. Report inclusion to map file.
13211 * archive.h: Include "fileread.h".
13212 (class Archive): Update declarations.
13213 (Archive::file): New const method.
13214 (class Add_archive_symbols): Add mapfile_ field. Update
13215 constructor. Change all callers.
13216 * readsyms.h (class Read_symbols): Likewise.
13217 (class Finish_group): Likewise.
13218 (class Read_script): Likewise.
13219 * common.cc: Include "mapfile.h".
13220 (Symbol_table::allocate_commons): Add mapfile parameter. Change
13221 all callers.
13222 (Symbol_table::do_allocate_commons): Likewise.
13223 (Symbol_table::do_allocate_commons_list): Likewise. Report common
13224 symbol allocation to mapfile.
13225 * common.h (class Allocate_commons_task): Add mapfile_ field.
13226 Update constructor. Change all callers.
13227 * symtab.h (class Symbol_table): Update declarations.
13228 * layout.cc: Include "mapfile.h".
13229 (Layout_task_runner::run): Print information to mapfile.
13230 (Layout::create_gold_note): Change Output_data_fixed_space to
13231 Output_data_zero_fill.
13232 (Layout::create_build_id): Likewise.
13233 (Layout::print_to_mapfile): New function.
13234 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
13235 constructor. Change caller.
13236 (class Layout): Declare print_to_mapfile.
13237 * output.cc (Output_section::Input_section::print_to_mapfile): New
13238 function.
13239 (Output_section::add_input_section): If producing a map, always
13240 add to input_sections_ list.
13241 (Output_section::do_print_to_mapfile): New function.
13242 (Output_segment::print_sections_to_mapfile): New function.
13243 (Output_segment::print_section_list_to_mapfile): New function.
13244 * output.h: Include "mapfile.h".
13245 (Output_data::print_to_mapfile): New function.
13246 (Output_data::do_print_to_mapfile): New virtual function.
13247 (Output_segment_headers::do_print_to_mapfile): New function.
13248 (Output_file_header::do_print_to_mapfile): New function.
13249 (Output_data_const::do_print_to_mapfile): New function.
13250 (class Output_data_const_buffer): Add map_name_ field. Update
13251 constructor. Change all callers. Add do_print_to_mapfile
13252 function.
13253 (class Output_data_fixed_space): Likewise.
13254 (class Output_data_space): Likewise.
13255 (class Output_data_zero_fill): New class.
13256 (Output_data_strtab::do_print_to_mapfile): New function.
13257 (Output_data_reloc_base::do_print_to_mapfile): New function.
13258 (Output_relocatable_relocs::do_print_to_mapfile): New function.
13259 (Output_data_group::do_print_to_mapfile): New function.
13260 (Output_data_got::do_print_to_mapfile): New function.
13261 (Output_data_dynamic::do_print_to_mapfile): New function.
13262 (Output_symtab_xindex::do_print_to_mapfile): New function.
13263 (class Output_section): Declare do_print_to_mapflie. Declare
13264 print_to_mapfile in Input_section.
13265 (class Output_segment): Declare new functions.
13266 * object.h (Sized_relobj::symbol_count): New function.
13267 * script-sections.cc
13268 (Output_section_element_dot_assignment::set_section_addresses):
13269 Change Output_data_fixed_space to Output_data_zero_fill.
13270 (Output_data_expression::do_print_to_mapfile): New function.
13271 * script.cc (read_input_script): Add mapfile parameter. Change
13272 all callers.
13273 * script.h (read_input_script): Update declaration.
13274 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13275 (Eh_frame::do_print_to_mapfile): New function.
13276 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13277 (Output_merge_string::do_print_to_mapfile): New function.
13278 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13279 function.
13280 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13281 function.
13282 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13283 function.
13284 * Makefile.am (CCFILES): Add mapfile.cc.
13285 (HFILES): Add mapfile.h.
13286 * Makefile.in: Rebuild.
13287
13288 2008-05-19 Ian Lance Taylor <iant@google.com>
13289
13290 * options.h (class General_options): Add -z relro.
13291 * layout.cc (Layout::Layout): Initialize relro_segment_.
13292 (Layout::add_output_section_data): Return the output section.
13293 (Layout::make_output_section): Rcognize relro sections and mark
13294 them appropriately.
13295 (Layout::attach_allocated_section_to_segment): Put relro sections
13296 in a PT_GNU_RELRO segment.
13297 (Layout::create_initial_dynamic_sections): Mark the .dynamic
13298 section as relro.
13299 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13300 PT_TLS segments.
13301 (Layout::linkonce_mapping): Map d.rel.ro.local to
13302 .data.rel.ro.local.
13303 (Layout::output_section_name): Us .data.rel.ro.local for any
13304 section which begins with that.
13305 * layout.h (class Layout): Update add_output_section_data
13306 declaration. Add relro_segment_ field.
13307 * output.cc (Output_section::Output_section): Initialize is_relro_
13308 and is_relro_local_ fields.
13309 (Output_segment::add_output_section): Group relro sections.
13310 (Output_segment::is_first_section_relro): New function.
13311 (Output_segment::maximum_alignment): If there is a relro section,
13312 align the segment to the common page size.
13313 (Output_segment::set_section_addresses): Track whether we are
13314 looking at relro sections. If the last section is a relro
13315 section, align to the common page size.
13316 (Output_segment::set_section_list_addresses): Add in_relro
13317 parameter. Change all callers. Align to the page size when
13318 moving from relro to non-relro section.
13319 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13320 segment.
13321 * output.h (class Output_section): Add is_relro_ and
13322 is_relro_local_ fields.
13323 (Output_section::is_relro): New function.
13324 (Output_section::set_is_relro): New function.
13325 (Output_section::is_relro_local): New function.
13326 (Output_section::set_is_relro_local): New function.
13327 (class Output_segment): Update declarations.
13328 * i386.cc (Target_i386::got_section): Mark .got section as relro.
13329 * sparc.cc (Target_sparc::got_section): Likewise.
13330 * x86_64.cc (Target_x86_64::got_section): Likewise.
13331 * testsuite/relro_test_main.cc: New file.
13332 * testsuite/relro_test.cc: New file.
13333 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13334 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13335 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13336 (relro_test.so, relro_test_pic.o): New targets.
13337 * testsuite/Makefile.in: Rebuild.
13338
13339 2008-05-16 Ian Lance Taylor <iant@google.com>
13340
13341 * output.cc (Output_segment::add_output_section): Remove front
13342 parameter.
13343 * output.h (class Output_segment): Remove
13344 add_initial_output_section and overloaded add_output_section.
13345 Update declaration of remaining add_output_section.
13346 * layout.cc (Layout::create_interp): Call add_output_section
13347 rather than add_initial_output_section.
13348 (Layout::finish_dynamic_section): Likewise.
13349
13350 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13351 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
13352 know the dynamic type.
13353 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13354 field. Initialize it in constructor.
13355 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13356 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13357 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13358 reloc.
13359
13360 * output.cc (Output_reloc::get_address): Change return type to
13361 Elf_Addr.
13362 * output.h (class Output_reloc): Update get_address declaration.
13363 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13364 for section addresses.
13365
13366 2008-05-09 Ian Lance Taylor <iant@google.com>
13367
13368 PR 6493
13369 * gold.cc (gold_nomem): Use return value of write.
13370
13371 2008-05-08 Ian Lance Taylor <iant@google.com>
13372
13373 * symtab.c (Symbol::init_base_output_data): Add version
13374 parameter. Change all callers.
13375 (Symbol::init_base_output_segment): Likewise.
13376 (Symbol::init_base_constant): Likewise.
13377 (Symbol::init_base_undefined): Likewise.
13378 (Sized_symbol::init_output_data): Likewise.
13379 (Sized_symbol::init_output_segment): Likewise.
13380 (Sized_symbol::init_constant): Likewise.
13381 (Sized_symbol::init_undefined): Likewise.
13382 (Symbol_table::do_define_in_output_data): If the new symbol has a
13383 version, mark it as the default.
13384 (Symbol_table::do_define_in_output_segment): Likewise.
13385 (Symbol_table::do_define_as_constant): Likewise.
13386 * symtab.h (class Symbol): Update declarations.
13387 (class Sized_symbol): Likewise.
13388 * resolve.cc (Symbol::override_version): New function.
13389 (Symbol::override_base): Call override_version.
13390 (Symbol::override_base_with_special): Likewise.
13391 * testsuite/ver_script_8.script: New file.
13392 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13393 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13394 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13395 (ver_test_8_1.so, ver_test_8_2.so): New targets.
13396
13397 2008-05-06 Ian Lance Taylor <iant@google.com>
13398
13399 PR 6049
13400 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13401 functions.
13402 (class General_options): Remove existing --undefined, and add
13403 --no-undefined instead. Add new --undefined as synonym for -u.
13404 * archive.cc (Archive::add_symbols): Check whether symbol was
13405 named with -u.
13406 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13407 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13408 all uses. Add IS_UNDEFINED. Update declarations to split
13409 different versions of init_base. Declare init_base_undefined.
13410 (Symbol::is_defined): Handle IS_UNDEFINED.
13411 (Symbol::is_undefined): Likewise.
13412 (Symbol::is_weak_undefined): Call is_undefined.
13413 (Symbol::is_absolute): Handle IS_CONSTANT.
13414 (class Sized_symbol): Update declarations to split different
13415 versions of init. Declare init_undefined.
13416 (class Symbol_table): Declare new functions.
13417 * symtab.cc (Symbol::init_base_object): Rename from init_base.
13418 Change all callers.
13419 (Symbol::init_base_output_data): Likewise.
13420 (Symbol::init_base_output_segment): Likewise.
13421 (Symbol::init_base_constant): Likewise.
13422 (Symbol::init_base_undefined): New function.
13423 (Sized_symbol::init_object): Rename from init. Change all
13424 callers.
13425 (Sized_symbol::init_output_data): Likewise.
13426 (Sized_symbol::init_output_segment): Likewise.
13427 (Sized_symbol::init_constant): Likewise.
13428 (Sized_symbol::init_undefined): New function.
13429 (Symbol_table::add_undefined_symbols_from_command_line): New
13430 function.
13431 (Symbol_table::do_add_undefined_symbols_from_command_line): New
13432 function.
13433 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13434 (Symbol::output_section): Likewise.
13435 (Symbol::set_output_section): Likewise.
13436 (Symbol_table::sized_finalize_symbol): Likewise.
13437 (Symbol_table::sized_write_globals): Likewise.
13438 * resolve.cc (Symbol_table::should_override): Likewise.
13439 (Symbol::override_base_with_special): Likewise.
13440
13441 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13442 symbol, change it to have default visibility.
13443 * testsuite/protected_1.cc: New file.
13444 * testsuite/protected_2.cc: New file.
13445 * testsuite/protected_3.cc: New file.
13446 * testsuite/protected_main_1.cc: New file.
13447 * testsuite/protected_main_2.cc: New file.
13448 * testsuite/protected_main_3.cc: New file.
13449 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13450 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13451 (protected_1_LDFLAGS, protected_1_LDADD): Define.
13452 (protected_1.so): New target.
13453 (protected_1_pic.o, protected_2_pic.o): New targets.
13454 (protected_3_pic.o): New target.
13455 (check_PROGRAMS): Add protected_2.
13456 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13457 (protected_2_LDFLAGS, protected_2_LDADD): Define.
13458 * testsuite/Makefile.in: Rebuild.
13459
13460 * options.h (DEFINE_var): Add set_user_set_##varname__.
13461 (DEFINE_bool_alias): New macro.
13462 (class General_options): Define -Bstatic using DEFINE_bool_alias
13463 rather than DEFINE_special. Add --undefined as an alias for -z
13464 defs.
13465 * options.cc (General_options::parse_Bstatic): Remove.
13466
13467 * options.h (class General_options): Add --fatal-warnings.
13468 * main.cc (main): Implement --fatal-warnings.
13469 * errors.h (Errors::warning_count): New function.
13470
13471 * options.h (class General_options): Add -Bsymbolic-functions.
13472 * symtab.h (Symbol::is_preemptible): Check for
13473 -Bsymbolic-functions.
13474
13475 2008-05-05 Ian Lance Taylor <iant@google.com>
13476
13477 * options.h (DEFINE_bool): For DASH_Z, create the negative option
13478 as noVARNAME rather than no-VARNAME.
13479 (class General_options): Add option -z combreloc.
13480 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13481 get_address.
13482 (Output_reloc::sort_before) [SHT_REL]: New function.
13483 (Output_reloc::sort_before) [SHT_RELA]: New function.
13484 (class Output_data_reloc_base): Add sort_relocs_ field. Define
13485 Sort_relocs_comparison.
13486 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13487 parameter. Change all callers.
13488 (Output_data_reloc::Output_data_reloc) [both versions]: Add
13489 sort_relocs parameter. Change all callers.
13490 * output.cc (Output_reloc::get_address): New function, broken out
13491 of write_rel.
13492 (Output_reloc::write_rel): Call it.
13493 (Output_reloc::compare): New function.
13494 (Output_data_reloc_base::do_write): Optionally sort relocs.
13495
13496 * configure.ac: If targ_extra_obj is set, link it in.
13497 * configure.tgt: Initialize all variables.
13498 (x86_64*): Set targ_extra_obj and targ_extra_size.
13499 * configure: Rebuild.
13500
13501 * object.cc (Sized_relobj::include_section_group): Adjust section
13502 indexes read from group data. Build vector to pass to
13503 layout_group.
13504 * layout.cc (Layout::layout_group): Add flags and shndxes
13505 parameters. Remove contents parameter. Change caller. Update
13506 explicit instantiations.
13507 * layout.h (class Layout): Update layout_group declaration.
13508 * output.cc (Output_data_group::Output_data_group): Add flags and
13509 input_shndxes parameters. Remove contents parameter. Change
13510 caller.
13511 (Output_data_group::do_write): Change input_sections_ to
13512 input_shndxes_.
13513 * output.h (class Output_data_group): Update constructor
13514 declaration. Rename input_sections_ to input_shndxes_.
13515 * testsuite/many_sections_test.cc: Add template.
13516
13517 2008-04-30 Cary Coutant <ccoutant@google.com>
13518
13519 * target-reloc.h (relocate_section): Fix dead-pointer bug.
13520
13521 * layout.cc (Layout::include_section): Refactored check for debug
13522 info section.
13523 (Layout::add_comdat): Add new parameters. Change type
13524 of signature parameter. Add object and shndx to signatures table.
13525 (Layout::find_kept_object): New function.
13526 * layout.h: Include <cstring>.
13527 (Layout::is_debug_info_section): New function.
13528 (Layout::add_comdat): Add new parameters.
13529 (Layout::find_kept_object): New function.
13530 (Layout::Kept_section): New struct.
13531 (Layout::Signatures): Change type of map range.
13532 * object.cc (Relobj::output_section_address): New function.
13533 (Sized_relobj::include_section_group): Add new parameters. Change
13534 calls to Layout::add_comdat. Change to build table of kept comdat
13535 groups and table mapping discarded sections to kept sections.
13536 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
13537 (Sized_relobj::do_layout): Change calls to include_section_group and
13538 include_linkonce_section.
13539 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13540 value to zero when section is discarded.
13541 (Sized_relobj::map_to_kept_section): New function.
13542 * object.h (Relobj::output_section_address): New function.
13543 (Relobj::Comdat_group): New type.
13544 (Relobj::find_comdat_group): New function.
13545 (Relobj::Comdat_group_table): New type.
13546 (Relobj::Kept_comdat_section): New type.
13547 (Relobj::Kept_comdat_section_table): New type.
13548 (Relobj::add_comdat_group): New function.
13549 (Relobj::set_kept_comdat_section): New function.
13550 (Relobj::get_kept_comdat_section): New function.
13551 (Relobj::comdat_groups_): New field.
13552 (Relobj::kept_comdat_sections_): New field.
13553 (Symbol_value::input_value): Update comment.
13554 (Sized_relobj::map_to_kept_section) New function.
13555 (Sized_relobj::include_linkonce_section): Add new parameter.
13556 * target-reloc.h (Comdat_behavior): New type.
13557 (get_comdat_behavior): New function.
13558 (relocate_section): Add code to map a discarded section to the
13559 corresponding kept section when applying a relocation.
13560
13561 2008-04-30 Craig Silverstein <csilvers@google.com>
13562
13563 * dwarf_reader.cc (next_generation_count): New static var.
13564 (Addr2line_cache_entry): New struct.
13565 (addr2line_cache): New static var.
13566 (Dwarf_line_info::one_addr2line): Added caching.
13567 (Dwarf_line_info::clear_addr2line_cache): New function.
13568 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13569 cache-size parameter.
13570 (Dwarf_line_info::one_addr2line_cache): New function.
13571 * symtab.cc (Symbol_table::detect_odr_violations): Pass
13572 new cache-size argument to one_addr2line(), and clear cache.
13573
13574 2008-04-28 Cary Coutant <ccoutant@google.com>
13575
13576 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13577 R_386_PC8 relocations.
13578
13579 2008-04-23 Ian Lance Taylor <iant@google.com>
13580
13581 * object.cc (Sized_relobj::include_section_group): Check for
13582 invalid section group.
13583
13584 * object.cc (make_elf_object): Correct test for 64-bit ELF file
13585 header size.
13586
13587 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13588 than read for file header.
13589 * archive.cc (Archive::include_member): Likewise.
13590
13591 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
13592
13593 * aclocal.m4: Regenerate.
13594 * configure: Regenerate.
13595
13596 2008-04-19 Ian Lance Taylor <iant@google.com>
13597
13598 * version.cc (version_string): Bump to 1.6.
13599
13600 * testsuite/Makefile.am (many_sections_r_test): New target.
13601 (many_sections_r_test_SOURCES): Remove.
13602 (many_sections_r_test_DEPENDENCIES): Remove.
13603 (many_sections_r_test_LDFLAGS): Remove.
13604 (many_sections_r_test_LDADD): Remove.
13605
13606 * object.cc (Sized_relobj::do_add_symbols): Always pass
13607 local_symbol_count_ to add_from_relobj.
13608
13609 * testsuite/Makefile.am (many_sections_check.h): Only check one in
13610 every thousand variables.
13611 * testsuite/Makefile.in: Rebuild.
13612
13613 * object.cc (Xindex::initialize_symtab_xindex): New function.
13614 (Xindex::read_symtab_xindex): New function.
13615 (Xindex::sym_xindex_to_shndx): New function.
13616 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13617 available.
13618 (Sized_relobj::do_initialize_xindex): New function.
13619 (Sized_relobj::do_read_symbols): Adjust section links.
13620 (Sized_relobj::symbol_section_and_value): Add is_ordinary
13621 parameter. Change all callers.
13622 (Sized_relobj::include_section_group): Adjust section links and
13623 symbol section indexes.
13624 (Sized_relobj::do_layout): Adjust section links.
13625 (Sized_relobj::do_count_local_symbols): Adjust section links and
13626 symbol section indexes.
13627 (Sized_relobj::do_finalize_local_symbols): Distinguish between
13628 ordinary and special symbols.
13629 (Sized_relobj::write_local_symbols): Add symtab_xindex and
13630 dynsym_xindex parameters. Change all callers. Adjust section
13631 links. Use SHN_XINDEX when needed.
13632 (Sized_relobj::get_symbol_location_info): Adjust section links.
13633 Don't get fooled by special symbols.
13634 * object.h (class Xindex): Define.
13635 (class Object): Add xindex_ parameter. Declare virtual functoin
13636 do_initialize_xindex.
13637 (Object::adjust_sym_shndx): New function.
13638 (Object::set_xindex): New protected function.
13639 (class Symbol_value): Add is_ordinary_shndx_ field.
13640 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13641 (Symbol_value::value): Assert ordinary section.
13642 (Symbol_value::initialize_input_to_output_map): Likewise.
13643 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13644 Change all callers.
13645 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
13646 all callers.
13647 (class Sized_relobj): Update declarations.
13648 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13649 parameter. Change all callers.
13650 (Sized_relobj::adjust_shndx): New function.
13651 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13652 field.
13653 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13654 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
13655 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
13656 (Sized_dynobj::read_dynsym_section): Adjust section links.
13657 (Sized_dynobj::read_dynamic): Likewise.
13658 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
13659 section links.
13660 (Sized_dynobj::do_initialize_xindex): New function.
13661 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
13662 do_initialize_xindex.
13663 (Sized_dynobj::adjust_shndx): New function.
13664 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13665 dynsym_xindex_ fields.
13666 (Layout::finalize): Add a call to set_section_indexes before
13667 creating the symtab sections.
13668 (Layout::set_section_indexes): Don't do anything if the section
13669 already has a section index.
13670 (Layout::create_symtab_sections): Add shnum parameter. Change
13671 caller. Create .symtab_shndx section if needed.
13672 (Layout::create_shdrs): Add shstrtab_section parameter. Change
13673 caller.
13674 (Layout::allocated_output_section_count): New function.
13675 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13676 needed.
13677 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13678 fields. Update declarations.
13679 (Layout::symtab_xindex): New function.
13680 (Layout::dynsym_xindex): New function.
13681 (class Write_symbols_task): Add layout_ field.
13682 (Write_symbols_task::Write_symbols_task): Add layout parameter.
13683 Change caller.
13684 * output.cc (Output_section_headers::Output_section_headers): Add
13685 shstrtab_section parameter. Change all callers.
13686 (Output_section_headers::do_sized_write): Store overflow values
13687 for section count and section string table section index in
13688 section header zero.
13689 (Output_file_header::do_sized_write): Check for overflow of
13690 section count and section string table section index.
13691 (Output_symtab_xindex::do_write): New function.
13692 (Output_symtab_xindex::endian_do_write): New function.
13693 * output.h (class Output_section_headers): Add shstrtab_section_.
13694 Update declarations.
13695 (class Output_symtab_xindex): Define.
13696 (Output_section::has_out_shndx): New function.
13697 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13698 field.
13699 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13700 Change all callers.
13701 (Sized_symbol::init): Likewise.
13702 (Symbol::output_section): Check for ordinary symbol.
13703 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
13704 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
13705 callers.
13706 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13707 Change all callers. Simplify handling of symbols from sections
13708 not included in the link.
13709 (Symbol_table::add_from_dynobj): Handle ordinary symbol
13710 distinction.
13711 (Weak_alias_sorter::operator()): Assert that symbols are
13712 ordinary.
13713 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13714 distinction.
13715 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13716 parameters. Change all callers.
13717 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
13718 symbol distinction. Use SHN_XINDEX when needed.
13719 (Symbol_table::write_section_symbol): Add symtab_xindex
13720 parameter. Change all callers.
13721 (Symbol_table::sized_write_section_symbol): Likewise. Use
13722 SHN_XINDEX when needed.
13723 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
13724 declarations.
13725 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
13726 (Symbol::is_defined): Check is_ordinary.
13727 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13728 (Symbol::is_absolute, Symbol::is_common): Likewise.
13729 (class Sized_symbol): Update declarations.
13730 (class Symbol_table): Update declarations.
13731 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13732 parameters. Change all callers.
13733 (Sized_symbol::override): Likewise.
13734 (Symbol_table::override): Likewise.
13735 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
13736 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
13737 is_ordinary, and orig_st_shndx parameters. Change all callers.
13738 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13739 to be in an ordinary section.
13740 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13741 object and is_ordinary parameters. Change all callers.
13742 (Sized_dwarf_line_info::read_relocs): Add object parameter.
13743 Change all callers. Don't add undefined or non-ordinary symbols
13744 to reloc_map_.
13745 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13746 Change all callers.
13747 * dwarf_reader.h (class Sized_dwarf_line_info): Update
13748 declarations.
13749 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13750 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13751 (Sized_relobj::relocate_sections): Likewise.
13752 * target-reloc.h (scan_relocs): Adjust section symbol index.
13753 (scan_relocatable_relocs): Likewise.
13754 * i386.cc (Scan::local): Check for ordinary symbols.
13755 * sparc.cc (Scan::local): Likewise.
13756 * x86_64.cc (Scan::local): Likewise.
13757 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13758 to symbol_section_and_value.
13759 * testsuite/many_sections_test.cc: New file.
13760 * testsuite/Makefile.am (BUILT_SOURCES): Define.
13761 (check_PROGRAMS): Add many_sections_test.
13762 (many_sections_test_SOURCES): Define.
13763 (many_sections_test_DEPENDENCIES): Define.
13764 (many_sections_test_LDFLAGS): Define.
13765 (BUILT_SOURCES): Add many_sections_define.h.
13766 (many_sections_define.h): New target.
13767 (BUILT_SOURCES): Add many_sections_check.h.
13768 (many_sections_check.h): New target.
13769 (check_PROGRAMS): Add many_sections_r_test.
13770 (many_sections_r_test_SOURCES): Define.
13771 (many_sections_r_test_DEPENDENCIES): Define.
13772 (many_sections_r_test_LDFLAGS): Define.
13773 (many_sections_r_test_LDADD): Define.
13774 (many_sections_r_test.o): New target.
13775 * testsuite/Makefile.in: Rebuild.
13776
13777 2008-04-17 Cary Coutant <ccoutant@google.com>
13778
13779 * errors.cc (Errors::info): New function.
13780 (gold_info): New function.
13781 * errors.h (Errors::info): New function.
13782 * gold.h (gold_info): New function.
13783 * object.cc (Input_objects::add_object): Print trace output.
13784 * options.cc (options::parse_set): New function.
13785 (General_options::parse_wrap): Deleted.
13786 (General_options::General_options): Deleted initializer.
13787 * options.h (options::String_set): New typedef.
13788 (options::parse_set): New function.
13789 (DEFINE_set): New macro.
13790 (General_options::wrap): Changed to use DEFINE_set. Changed
13791 callers of any_wrap_symbols and is_wrap_symbol.
13792 (General_options::trace, General_options::trace_symbol):
13793 New options.
13794 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13795 (General_options::wrap_symbols_): Deleted.
13796 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13797
13798 2008-04-17 David S. Miller <davem@davemloft.net>
13799
13800 * options.cc (General_options::parse_V): New function.
13801 * options.h: Add entries for -V and -Qy.
13802
13803 2008-04-17 Ian Lance Taylor <iant@google.com>
13804
13805 * common.cc (Symbol_table::allocate_commons): Remove options
13806 parameter. Change caller.
13807 (Symbol_table::do_allocate_commons): Remove options parameter.
13808 Change caller. Just call do_allocate_commons_list twice.
13809 (Symbol_table::do_allocate_commons_list): New function, broken out
13810 of do_allocate_commons.
13811 * common.h (class Allocate_commons_task): Remove options_ field.
13812 Update constructor.
13813 * symtab.cc (Symbol_table::Symbol_table): Initialize
13814 tls_commons_.
13815 (Symbol_table::add_from_object): Put TLS common symbols on
13816 tls_commons_ list.
13817 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13818 which are IN_OUTPUT_DATA.
13819 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13820 allocate_commons and do_allocate_commons declarations. Declare
13821 do_allocate_commons_list.
13822 * gold.cc (queue_middle_tasks): Update creation of
13823 Allocate_commons_task to not pass options.
13824 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13825 (TLS_TEST_C_FLAGS): New variable.
13826 (tls_test_c_pic.o): New target.
13827 (tls_test_shared.so): Link in tls_test_c_pic.o.
13828 (tls_test_c_pic_ie.o): New target.
13829 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13830 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13831 (tls_test_c.o): New target.
13832 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13833 (tls_pic_test_LDADD): Likewise.
13834 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13835 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13836 (tls_test_c_gnu2.o): New target.
13837 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13838 tls_test_c_gnu2.o.
13839 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13840 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13841 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13842 * testsuite/tls_test.cc: Include "config.h".
13843 (t_last): Call t11_last.
13844 * testsuite/tls_test.h (t11, t11_last): Declare.
13845 * testsuite/tls_test_c.c: New file.
13846 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13847 * configure.ac: Check for OpenMP support.
13848 * configure, config.in, Makefile.in: Rebuild.
13849 * testsuite/Makefile.in: Rebuild.
13850
13851 2008-04-16 Cary Coutant <ccoutant@google.com>
13852
13853 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13854 (Target_i386::tls_base_symbol_defined_): New field.
13855 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13856 (Target_i386::Scan::global): Likewise.
13857 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13858 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13859 (Target_x86_64::tls_base_symbol_defined_): New field.
13860 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13861 (Target_x86_64::Scan::global): Likewise.
13862
13863 2008-04-16 Cary Coutant <ccoutant@google.com>
13864
13865 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13866 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13867 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13868 building shared libraries.
13869 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13870 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13871 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13872 * testsuite/Makefile.in: Rebuild.
13873 * testsuite/weak_undef.h: New file.
13874 * testsuite/weak_undef_file1.cc: Add extra test cases.
13875 * testsuite/weak_undef_file2.cc: Likewise.
13876 * testsuite/weak_undef_test.cc: Likewise.
13877
13878 2008-04-16 David S. Miller <davem@davemloft.net>
13879
13880 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13881 Add issued_non_pic_error_ field. Declare check_non_pic.
13882 (Target_sparc::Scan::check_non_pic): New function.
13883 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13884 (Target_sparc::Scan::global): Likewise.
13885
13886 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13887 * configure: Rebuild.
13888
13889 * options.h (DEFINE_enable): New macro.
13890 (new_dtags): New enable option.
13891 (initfirst, interpose, loadfltr, nodefaultlib,
13892 nodelete, nodlopen, nodump): New -z options.
13893 * layout.cc (Layout:finish_dynamic_section): If new
13894 dtags enabled, emit DT_RUNPATH. Also, emit a
13895 DT_FLAGS_1 containing any specified -z flags.
13896
13897 2008-04-16 Ian Lance Taylor <iant@google.com>
13898
13899 * copy-relocs.cc: New file.
13900 * copy-relocs.h: New file.
13901 * reloc.cc: Remove Copy_relocs code.
13902 * reloc.h: Likewise.
13903 * reloc-types.h (struct Reloc_types) [both versions]: Add
13904 get_reloc_addend_noerror.
13905 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13906 variants of add_global which take an addend which must be zero.
13907 * i386.cc: Include "copy-relocs.h".
13908 (class Target_i386): Change type of copy_relocs_ to variable,
13909 update initializer.
13910 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13911 Change all callers.
13912 (Target_i386::do_finalize_sections): Change handling of
13913 copy_relocs_.
13914 * sparc.cc: Include "copy-relocs.h".
13915 (class Target_sparc): Change type of copy_relocs_ to variable,
13916 update initializer.
13917 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13918 Change all callers.
13919 (Target_sparc::do_finalize_sections): Change handling of
13920 copy_relocs_.
13921 * x86_64.cc: Include "copy-relocs.h".
13922 (class Target_x86_64): Change type of copy_relocs_ to variable,
13923 update initializer.
13924 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13925 class. Change all callers.
13926 (Target_x86_64::do_finalize_sections): Change handling of
13927 copy_relocs_.
13928 * Makefile.am (CCFILES): Add copy-relocs.cc.
13929 (HFILES): Add copy-relocs.h.
13930
13931 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13932
13933 * testsuite/script_test_4.sh: Permit leading zeroes.
13934
13935 2008-04-15 Ian Lance Taylor <iant@google.com>
13936
13937 * script-sections.cc (Script_sections::create_segments): Use
13938 header_size_adjustment even when there is enough room for the
13939 headers.
13940 * testsuite/script_test_4.sh: New file.
13941 * testsuite/script_test_4.t: New file.
13942 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13943 (check_DATA): Add script_test_4.stdout.
13944 (MOSTLYCLEANFILES): Likewise.
13945 (script_test_4): New target.
13946 (script_test_4.stdout): New target.
13947 * testsuite/Makefile.in: Rebuild.
13948
13949 * sparc.cc: Add definitions for Output_data_plt_sparc class
13950 constants.
13951
13952 2008-04-14 David S. Miller <davem@davemloft.net>
13953
13954 * sparc.cc: New file.
13955 * Makefile.am (TARGETSOURCES): Add sparc.cc
13956 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13957 * configure.tgt: Document targ_extra_size and
13958 targ_extra_big_endian. Add entries for sparc-* and
13959 sparc64-*.
13960 * configure.ac: Handle targ_extra_size and
13961 targ_extra_big_endian.
13962 * Makefile.in: Rebuild.
13963 * configure: Likewise.
13964 * po/POTFILES.in: Likewise.
13965 * po/gold.pot: Likewise.
13966
13967 2008-04-14 Ian Lance Taylor <iant@google.com>
13968
13969 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13970 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13971 in the name/type/flags to section mapping. Don't call
13972 allocate_output_section.
13973 (Layout::choose_output_section): Change parameter from adjust_name
13974 to is_input_section. Don't permit input sections after sections
13975 are attached to segments. Don't call allocate_output_section.
13976 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13977 not write_enable_output_section.
13978 (Layout::make_output_section): Don't push to
13979 unattached_section_list_ nor call attach_to_segment. Call
13980 attach_section_to_segment if sections are attached.
13981 (Layout::attach_sections_to_segments): New function.
13982 (Layout::attach_section_to_segment): New function.
13983 (Layout::attach_allocated_section_to_segment): Rename from
13984 attach_to_segment. Remove flags parameter.
13985 (Layout::allocate_output_section): Remove function.
13986 (Layout::write_enable_output_section): Remove function.
13987 * layout.h (class Layout): Update for above changes. Add new
13988 field sections_are_attached_.
13989 * output.h (Output_section::update_flags_for_input_section): New
13990 function.
13991 * output.cc (Output_section::add_input_section): Call
13992 update_flags_for_input_section.
13993 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13994
13995 2008-04-11 Cary Coutant <ccoutant@google.com>
13996
13997 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13998 thought unnecessary.
13999 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14000
14001 2008-04-11 Ian Lance Taylor <iant@google.com>
14002
14003 * output.h (class Output_section_data): Remove inline definition
14004 of set_addralign.
14005 * output.cc (Output_section_data::set_addralign): New function.
14006
14007 2008-04-11 Cary Coutant <ccoutant@google.com>
14008
14009 Add support for TLS descriptors for i386 and x86_64.
14010 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14011 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14012 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14013 GOT_TYPE_TLS_DESC.
14014 (Target_i386::got_mod_index_entry): Remove unnecessary code.
14015 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14016 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
14017 relocations.
14018 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14019 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14020 Fix problem with initial-exec relocations.
14021 (Target_i386::Relocate::relocate_tls): Likewise.
14022 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14023 relaxation.
14024 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14025 support for section-plus-offset dynamic table entries.
14026 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14027 (Output_data_dynamic::Dynamic_entry): Add support for
14028 section-plus-offset dynamic table entries.
14029 (Output_data_dynamic::Classification): Likewise.
14030 (Output_data_dynamic::classification_): Renamed offset_.
14031 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14032 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14033 (Target_x86_64::make_plt_section): New function.
14034 (Target_x86_64::reserve_tlsdesc_entries): New function.
14035 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14036 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14037 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14038 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14039 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14040 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14041 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14042 add extra PLT entry for TLS descriptors.
14043 (Output_data_plt_x86_64::got_): New field.
14044 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14045 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14046 fields.
14047 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14048 descriptors.
14049 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14050 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14051 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14052 R_386_TLS_DESC_CALL relocations.
14053 (Target_x86_64::Scan::global): Likewise.
14054 (Target_x86_64::do_finalize_sections): Add dynamic table entries
14055 for TLS descriptors.
14056 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14057 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14058 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14059 GD-to-IE relaxation.
14060 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14061 and TLS_DESCRIPTORS.
14062 * Makefile.in: Rebuild.
14063 * configure: Rebuild.
14064 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14065 (tls_test_shared2.so): New target.
14066 (tls_shared_gd_to_ie_test_SOURCES): New variable.
14067 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14068 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14069 (tls_shared_gd_to_ie_test_LDADD): New variable.
14070 (tls_shared_gnu2_gd_to_ie_test): New target.
14071 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14072 New targets.
14073 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14074 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14075 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14076 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14077 (tls_shared_gnu2_test): New target.
14078 (tls_test_gnu2_shared.so): New target.
14079 (tls_shared_gnu2_test_SOURCES): New variable.
14080 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14081 (tls_shared_gnu2_test_LDFLAGS): New variable.
14082 (tls_shared_gnu2_test_LDADD): New variable.
14083 * testsuite/Makefile.in: Rebuild.
14084 * testsuite/Makefile.
14085
14086 2008-04-11 Ian Lance Taylor <iant@google.com>
14087
14088 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14089 justsyms.t.
14090 * testsuite/Makefile.in: Rebuild.
14091
14092 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14093 long.
14094 * testsuite/script_test_2.cc (main): Adjust test.
14095
14096 2008-04-11 David S. Miller <davem@davemloft.net>
14097 Ian Lance Taylor <iant@google.com>
14098
14099 * options.h (General_options): Add entries for '-Y' and
14100 '-relax'.
14101 * options.cc (General_options:finalize): If -Y was used, add those
14102 entries to the library path instead of the default "/lib" and
14103 "/usr/lib".
14104
14105 2008-04-11 David S. Miller <davem@davemloft.net>
14106
14107 * testsuite/justsyms.t: Start at 0x100.
14108 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14109 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14110 long.
14111 * testsuite/script_test_2.cc: Adjust string and section length
14112 checks.
14113
14114 2008-04-09 Ian Lance Taylor <iant@google.com>
14115
14116 PR gold/5996
14117 * script-sections.cc (Sections_element::allocate_to_segment): Add
14118 orphan parameter.
14119 (Output_section_definition::allocate_to_segment): Likewise.
14120 (Orphan_output_section::allocate_to_segment): Likewise.
14121 (Script_sections::attach_sections_using_phdrs_clause): Don't
14122 propagate non-PT_LOAD segments to orphan sections.
14123 * testsuite/Makefile.am (script_test_3.stdout): Generate using
14124 readelf rather than objdump.
14125 * testsuite/script_test_3.sh: Adjust accordingly. Test that
14126 .interp section and PT_INTERP segment are the same size.
14127 * testsuite/Makefile.in: Rebuild.
14128
14129 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14130 aliases for symbols defined in the same object.
14131 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14132 (weak_alias_test_SOURCES): New variable.
14133 (weak_alias_test_DEPENDENCIES): New variable.
14134 (weak_alias_test_LDFLAGS): New variable.
14135 (weak_alias_test_LDADD): New variable.
14136 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14137 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14138 (weak_alias_test_3.o): New target.
14139 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14140 * testsuite/weak_alias_test_main.cc: New file.
14141 * testsuite/weak_alias_test_1.cc: New file.
14142 * testsuite/weak_alias_test_2.cc: New file.
14143 * testsuite/weak_alias_test_3.cc: New file.
14144
14145 2008-04-08 Ian Lance Taylor <iant@google.com>
14146
14147 * options.h (class General_options): Add --noinhibit-exec option.
14148 * main.cc (main): Check --noinhibit-exec.
14149
14150 * options.h (class General_options): Define --wrap as a special
14151 option. Add wrap_symbols_ field.
14152 (General_options::any_wrap_symbols): New function.
14153 (General_options::is_wrap_symbol): New function.
14154 * options.cc (General_options::parse_wrap): New function.
14155 (General_options::General_options): Initialize wrap_symbols_.
14156 * symtab.cc (Symbol_table::wrap_symbol): New function.
14157 (Symbol_table::add_from_object): Handle --wrap.
14158 * symtab.h (class Symbol_table): Declare wrap_symbol.
14159 * target.h (Target::wrap_char): New function.
14160 (Target::Target_info): Add wrap_char field.
14161 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14162 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14163 * testsuite/testfile.cc (Target_test::test_target_info):
14164 Likewise.
14165
14166 * errors.cc (Errors::undefined_symbol): Mention symbol version if
14167 there is one.
14168
14169 * layout.h (class Layout): Add added_eh_frame_data_ field.
14170 * layout.cc (Layout::Layout): Initialize new field.
14171 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14172 output section until we find a section we merged successfully.
14173 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14174 that the size be non-zero.
14175
14176 * merge.cc (Object_merge_map::get_output_offset): Remove inline
14177 qualifier.
14178
14179 2008-04-08 Craig Silverstein <csilvers@google.com>
14180
14181 * configure.ac: Export new conditional variable HAVE_ZLIB.
14182 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14183 on HAVE_ZLIB.
14184 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14185 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14186
14187 2008-04-07 Ian Lance Taylor <iant@google.com>
14188
14189 * version.cc (version_string): Set to "1.5".
14190
14191 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14192 Add issued_non_pic_error_ field. Declare check_non_pic.
14193 (Target_x86_64::Scan::check_non_pic): New function.
14194 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14195 (Target_x86_64::Scan::global): Likewise.
14196
14197 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14198 addend parameter. Change caller. Handle merge sections.
14199 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14200 Address to Addend. Don't add in the result of
14201 local_section_offset, pass down the addend and use the returned
14202 value.
14203 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14204 Update declarations of local_section_offset and symbol_value.
14205 * testsuite/two_file_test_1.cc (t18): New function.
14206 * testsuite/two_file_test_2.cc (f18): New function.
14207 * testsuite/two_file_test_main.cc (main): Call t18.
14208 * testsuite/two_file_test.h (t18, f18): Declare.
14209
14210 * configure.ac: Don't test for objdump, c++filt, or readelf.
14211 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14212 conditionals.
14213 (TEST_READELF): New variable.
14214 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14215 (check_PROGRAMS): Add two_file_strip_test.
14216 (two_file_strip_test): New target.
14217 (check_PROGRAMS): Add two_file_same_shared_strip_test.
14218 (two_file_same_shared_strip_test_SOURCES): New variable.
14219 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14220 (two_file_same_shared_strip_test_LDFLAGS): New variable.
14221 (two_file_same_shared_strip_test_LDADD): New variable.
14222 (two_file_shared_strip.so): New target.
14223 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14224 (ver_test_5.syms, ver_test_7.syms): Likewise.
14225 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14226 (strip_test_3.stdout): Use TEST_OBJDUMP.
14227 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14228
14229 2008-04-04 Cary Coutant <ccoutant@google.com>
14230
14231 * symtab.h (Symbol::is_weak_undefined): New function.
14232 (Symbol::is_strong_undefined): New function.
14233 (Symbol::is_absolute): New function.
14234 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14235 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14236 absolute symbols.
14237 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14238 (weak_undef_test): New target.
14239 * testsuite/Makefile.in: Rebuild.
14240 * testsuite/weak_undef_file1.cc: New file.
14241 * testsuite/weak_undef_file2.cc: New file.
14242 * testsuite/weak_undef_test.cc: New file.
14243
14244 2008-04-03 Craig Silverstein <csilvers@google.com>
14245
14246 * compressed_output.h (class Output_compressed_section): Use
14247 unsigned buffer.
14248 * compressed_output.cc (zlib_compress): Use unsigned buffers,
14249 add zlib header.
14250 (zlib_compressed_suffix): Removed.
14251 (Output_compressed_section::set_final_data_size): Use unsigned
14252 buffers.
14253 * testsuite/Makefile.am (flagstest_compress_debug_sections):
14254 Fix linker invocation.
14255 (flagstest_o_specialfile_and_compress_debug_sections):
14256 Likewise.
14257 * testsuite/Makefile.in: Regenerated.
14258
14259 2008-04-02 David S. Miller <davem@davemloft.net>
14260
14261 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14262 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14263
14264 2008-04-02 Craig Silverstein <csilvers@google.com>
14265
14266 * TODO: New file.
14267
14268 2008-04-02 Ian Lance Taylor <iant@google.com>
14269
14270 * fileread.cc (File_read::find_view): Add byteshift and vshifted
14271 parameters. Update for new key type to views_. Change all
14272 callers.
14273 (File_read::read): Adjust for byteshift in returned view.
14274 (File_read::add_view): New function, broken out of
14275 find_and_make_view.
14276 (File_read::make_view): New function, broken out of
14277 find_and_make_view.
14278 (File_read::find_or_make_view): Add offset and aligned
14279 parameters. Rewrite accordingly. Change all callers.
14280 (File_read::get_view): Add offset and aligned parameters. Adjust
14281 for byteshift in return value.
14282 (File_read::get_lasting_view): Likewise.
14283 * fileread.h (class File_read): Update declarations.
14284 (class File_read::View): Add byteshift_ field. Add byteshift to
14285 constructor. Add byteshift method.
14286 * archive.h (Archive::clear_uncached_views): New function.
14287 (Archive::get_view): Add aligned parameter. Change all callers.
14288 * object.h (Object::get_view): Add aligned parameter. Change all
14289 callers.
14290 (Object::get_lasting_view): Likewise.
14291
14292 * fileread.cc (File_read::release): Don't call clear_views if
14293 there are multiple objects.
14294 * fileread.h (File_read::clear_uncached_views): New function.
14295 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14296 on the archive.
14297
14298 2008-03-31 Cary Coutant <ccoutant@google.com>
14299
14300 Add thin archive support.
14301 * archive.cc (Archive::armagt): New const.
14302 (Archive::setup): Remove task parameter and calls to unlock.
14303 (Archive::unlock_nested_archives): New function.
14304 (Archive::read_header): Add nested_off parameter. Change
14305 all callers.
14306 (Archive::interpret_header): Likewise.
14307 (Archive::include_all_members): Change to handle thin
14308 archives.
14309 (Archive::include_member): Likewise.
14310 * archive.h (Archive::Archive): Add new parameters and
14311 initializers.
14312 (Archive::armagt): New const.
14313 (Archive::setup): Remove task parameter.
14314 (Archive::unlock_nested_archives): New function.
14315 (Archive::read_header): Add nested_off parameter.
14316 (Archive::interpret_header): Likewise.
14317 (Archive::Nested_archive_table): New typedef.
14318 (Archive::is_thin_archive_): New field.
14319 (Archive::nested_archives_): New field.
14320 (Archive::options_): New field.
14321 (Archive::dirpath_): New field.
14322 (Archive::task_): New field.
14323 * readsyms.cc (Read_symbols::do_read_symbols): Add check
14324 for thin archives. Pass additional parameters to
14325 Archive::Archive. Unlock the archive file after calling
14326 Archive::setup.
14327
14328 2008-03-29 Ian Lance Taylor <iant@google.com>
14329
14330 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14331 version symbol to be local.
14332 * testsuite/ver_test_4.sh: New file.
14333 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14334 (check_DATA): Add ver_test_4.syms.
14335 (ver_test_4.syms): New target.
14336 * testsuite/Makefile.in: Rebuild.
14337
14338 * output.cc
14339 (Output_section::Input_section_sort_entry::has_priority): New
14340 function.
14341 (Output_section::Input_section_sort_entry::match_file_name): New
14342 function.
14343 (Output_section::Input_section_sort_entry::match_section_name):
14344 Remove.
14345 (Output_section::Input_section_sort_entry::match_section_name_prefix):
14346 Remove.
14347 (Output_section::Input_section_sort_entry::match_section_file):
14348 Remove.
14349 (Output_section::Input_section_sort_compare::operator()): Rewrite
14350 using new Input_section_sort_entry functions. Sort crtbegin and
14351 crtend first. Sort sections with no priority before sections with
14352 a priority.
14353 * testsuite/initpri1.c (d3): Check j != 4.
14354 (cd5): New constructor/destructor function.
14355 (main): Check j != 2.
14356
14357 * symtab.cc (Symbol_table::add_from_object): If we don't use the
14358 new symbol when resolving, don't call set_is_default.
14359 * testsuite/ver_test_7.cc: New file.
14360 * testsuite/ver_test_7.sh: New file.
14361 * testsuite/Makefile.am (ver_test_7.so): New target.
14362 (ver_test_7.o): New target.
14363 (check_SCRIPTS): Add ver_test_7.sh.
14364 (check_DATA): Add ver_test_7.syms.
14365 (ver_test_7.syms): New target.
14366
14367 2008-03-28 Ian Lance Taylor <iant@google.com>
14368
14369 * layout.cc (Layout::layout): If we see an input section with a
14370 name that needs sorting, set the must_sort flag for the output
14371 section.
14372 (Layout::make_output_section): If the name of the output section
14373 indicates that it might require sorting, set the may_sort flag.
14374 * output.h (Output_section::may_sort_attached_input_sections): New
14375 function.
14376 (Output_section::set_may_sort_attached_input_sections): New
14377 function.
14378 (Output_section::must_sort_attached_input_sections): New
14379 function.
14380 (Output_section::set_must_sort_attached_input_sections): New
14381 function.
14382 (class Output_section): Declare Input_section_sort_entry. Define
14383 Input_section_sort_compare. Declare
14384 sort_attached_input_sections. Add new fields:
14385 may_sort_attached_input_sections_,
14386 must_sort_attached_input_sections_,
14387 attached_input_sections_are_sorted_.
14388 * output.cc (Output_section::Output_section): Initialize new
14389 fields.
14390 (Output_section::add_input_section): Add an entry to
14391 input_sections_ if may_sort or must_sort are true.
14392 (Output_section::set_final_data_size): Call
14393 sort_attached_input_sections if necessary.
14394 (Output_section::Input_section_sort_entry): Define new class.
14395 (Output_section::Input_section_sort_compare::operator()): New
14396 function.
14397 (Output_section::sort_attached_input_sections): New function.
14398 * configure.ac: Check whether the compiler supports constructor
14399 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
14400 * testsuite/initpri1.c: New file.
14401 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14402 CONSTRUCTOR_PRIORITY.
14403 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14404 (initpri1_LDFLAGS): New variable.
14405 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14406
14407 2008-03-27 Ian Lance Taylor <iant@google.com>
14408
14409 * common.cc (Sort_commons::operator): Correct sorting algorithm.
14410 * testsuite/common_test_1.c: New file.
14411 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14412 (common_test_1_SOURCES): New variable.
14413 (common_test_1_DEPENDENCIES): New variable.
14414 (common_test_1_LDFLAGS): New variable.
14415
14416 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14417 and commons_ correctly when NAME/VERSION does not override
14418 NAME/NULL.
14419 * testsuite/ver_test_6.c: New file.
14420 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14421 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14422 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14423
14424 2008-03-26 Ian Lance Taylor <iant@google.com>
14425
14426 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14427 of an undefined symbol from a version script.
14428 * testsuite/Makefile.am (ver_test_5.so): New target.
14429 (ver_test_5.o): New target.
14430 (check_SCRIPTS): Add ver_test_5.sh.
14431 (check_DATA): Add ver_test_5.syms.
14432 (ver_test_5.syms): New target.
14433 * testsuite/ver_test_5.cc: New file.
14434 * testsuite/ver_test_5.script: New file.
14435 * testsuite/ver_test_5.sh: New file.
14436 * Makefile.in, testsuite/Makefile.in: Rebuild.
14437
14438 PR gold/5986
14439 Fix problems building gold with gcc 4.3.0.
14440 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14441 (gold_error_at_location, gold_warning_at_location): Use it.
14442 * configure.ac: Check whether we can compile and use a template
14443 function with a printf attribute.
14444 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14445 when jumping over bytes.
14446 * object.cc: Instantiate Object::read_section_data.
14447 * debug.h: Include <cstring>
14448 * dwarf_reader.cc: Include <algorithm>
14449 * main.cc: Include <cstring>.
14450 * options.cc: Include <cstring>.
14451 * output.cc: Include <cstring>.
14452 * script.cc: Include <cstring>.
14453 * script.h: Include <string>.
14454 * symtab.cc: Include <cstring> and <algorithm>.
14455 * target-select.cc: Include <cstring>.
14456 * version.cc: Include <string>.
14457 * testsuite/testmain.cc: Include <cstdlib>.
14458 * configure, config.in: Rebuild.
14459
14460 2008-03-25 Ian Lance Taylor <iant@google.com>
14461
14462 * options.cc: Include "../bfd/bfdver.h".
14463 (options::help): Print bug reporting address.
14464
14465 * version.cc (print_version): Adjust output for current value of
14466 BFD_VERSION_STRING.
14467
14468 * NEWS: New file.
14469
14470 * options.cc (options::help): Print list of supported targets.
14471 * target-select.h: Include <vector>.
14472 (class Target_selector): Make machine_, size_, and is_big_endian_
14473 fields const. Add bfd_name_ and instantiated_target_ fields.
14474 (Target_selector::Target_selector): Add bfd_name parameter.
14475 (Target_selector::recognize): Make non-virtual, call
14476 do_recognize.
14477 (Target_selector::recognize_by_name): Make non-virtual, call
14478 do_recognize_by_name.
14479 (Target_selector::supported_names): New function.
14480 (Target_selector::bfd_name): New function.
14481 (Target_selector::do_instantiate_target): New pure virtual
14482 function.
14483 (Target_selector::do_recognize): New virtual function.
14484 (Target_selector::do_recognize_by_name): New virtual function.
14485 (Target_selector::instantiate_target): New private function.
14486 (supported_target_names): Declare.
14487 * target-select.cc (Target_selector::Target_selector): Update for
14488 new parameter and fields.
14489 (select_target_by_name): Check that the name matches before
14490 calling recognize_by_name.
14491 (supported_target_names): New function.
14492 * i386.cc (class Target_selector_i386): Update Target_selector
14493 constructor call. Remove recognize and recognize_by_name. Add
14494 do_instantiate_target.
14495 * x86_64.cc (class Target_selector_x86_64): Likewise.
14496 * testsuite/testfile.cc (class Target_selector_test): Update for
14497 changes to Target_selector.
14498
14499 * README: Rewrite, with some notes on unsupported features.
14500
14501 2008-03-24 Cary Coutant <ccoutant@google.com>
14502
14503 * i386.cc (Target_i386::Got_type): New enum declaration.
14504 (Target_i386::Scan::local): Updated callers of Output_data_got
14505 member functions.
14506 (Target_i386::Scan::global): Likewise.
14507 (Target_i386::Relocate::relocate): Likewise.
14508 (Target_i386::Relocate::relocate_tls): Likewise.
14509 * object.h (Got_offset_list): New class.
14510 (Sized_relobj::local_has_got_offset): Added got_type parameter.
14511 (Sized_relobj::local_got_offset): Likewise.
14512 (Sized_relobj::set_local_got_offset): Likewise.
14513 (Sized_relobj::local_has_tls_got_offset): Removed.
14514 (Sized_relobj::local_tls_got_offset): Removed.
14515 (Sized_relobj::set_local_tls_got_offset): Removed.
14516 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14517 * output.cc (Output_data_got::add_global): Added got_type parameter.
14518 (Output_data_got::add_global_with_rel): Likewise.
14519 (Output_data_got::add_global_with_rela): Likewise.
14520 (Output_data_got::add_global_pair_with_rel): New function.
14521 (Output_data_got::add_global_pair_with_rela): New function.
14522 (Output_data_got::add_local): Added got_type parameter.
14523 (Output_data_got::add_local_with_rel): Likewise.
14524 (Output_data_got::add_local_with_rela): Likewise.
14525 (Output_data_got::add_local_pair_with_rel): New function.
14526 (Output_data_got::add_local_pair_with_rela): New function.
14527 (Output_data_got::add_global_tls): Removed.
14528 (Output_data_got::add_global_tls_with_rel): Removed.
14529 (Output_data_got::add_global_tls_with_rela): Removed.
14530 (Output_data_got::add_local_tls): Removed.
14531 (Output_data_got::add_local_tls_with_rel): Removed.
14532 (Output_data_got::add_local_tls_with_rela): Removed.
14533 * output.h (Output_data_got::add_global): Added got_type parameter.
14534 (Output_data_got::add_global_with_rel): Likewise.
14535 (Output_data_got::add_global_with_rela): Likewise.
14536 (Output_data_got::add_global_pair_with_rel): New function.
14537 (Output_data_got::add_global_pair_with_rela): New function.
14538 (Output_data_got::add_local): Added got_type parameter.
14539 (Output_data_got::add_local_with_rel): Likewise.
14540 (Output_data_got::add_local_with_rela): Likewise.
14541 (Output_data_got::add_local_pair_with_rel): New function.
14542 (Output_data_got::add_local_pair_with_rela): New function.
14543 (Output_data_got::add_global_tls): Removed.
14544 (Output_data_got::add_global_tls_with_rel): Removed.
14545 (Output_data_got::add_global_tls_with_rela): Removed.
14546 (Output_data_got::add_local_tls): Removed.
14547 (Output_data_got::add_local_tls_with_rel): Removed.
14548 (Output_data_got::add_local_tls_with_rela): Removed.
14549 * resolve.cc (Symbol::override_base_with_special): Removed
14550 reference to has_got_offset_ field.
14551 * symtab.cc (Symbol::init_fields): Replaced initialization
14552 of got_offset_ with got_offsets_. Removed initialization
14553 of has_got_offset_
14554 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14555 (Symbol::got_offset): Likewise.
14556 (Symbol::set_got_offset): Likewise.
14557 (Symbol::has_tls_got_offset): Removed.
14558 (Symbol::tls_got_offset): Removed.
14559 (Symbol::set_tls_got_offset): Removed.
14560 (Symbol::got_offset_): Removed.
14561 (Symbol::tls_mod_got_offset_): Removed.
14562 (Symbol::tls_pair_got_offset_): Removed.
14563 (Symbol::got_offsets_): New field.
14564 (Symbol::has_got_offset): Removed.
14565 (Symbol::has_tls_mod_got_offset): Removed.
14566 (Symbol::has_tls_pair_got_offset): Removed.
14567 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14568 (Target_x86_64::Scan::local): Updated callers of Output_data_got
14569 member functions.
14570 (Target_x86_64::Scan::global): Likewise.
14571 (Target_x86_64::Relocate::relocate): Likewise.
14572 (Target_x86_64::Relocate::relocate_tls): Likewise.
14573
14574 2008-03-25 Ben Elliston <bje@au.ibm.com>
14575
14576 * yyscript.y: Fix spelling error in comment.
14577
14578 2008-03-24 Ian Lance Taylor <iant@google.com>
14579
14580 * options.h (class General_options): Define build_id option.
14581 * layout.h (class Layout): Declare write_build_id, create_note,
14582 create_build_id. Add build_id_note_ member.
14583 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14584 "libiberty.h", "md5.h", "sha1.h".
14585 (Layout::Layout): Initialize eh_frame_data_,
14586 eh_frame_hdr_section_, and build_id_note_.
14587 (Layout::finalize): Call create_build_id.
14588 (Layout::create_note): New function, broken out of
14589 Layout::create_gold_note.
14590 (Layout::create_gold_note): Call create_note.
14591 (Layout::create_build_id): New function.
14592 (Layout::write_build_id): New function.
14593 (Close_task_runner::run): Call write_build_id.
14594
14595 * x86_64.cc: Correct license to GPLv3.
14596
14597 2008-03-23 Ian Lance Taylor <iant@google.com>
14598
14599 * options.cc: Include "demangle.h".
14600 (parse_optional_string): New function.
14601 (parse_long_option): Handle takes_optional_argument.
14602 (parse_short_option): Update dash_z initializer. Handle
14603 takes_optional_argument.
14604 (General_options::General_options): Initialize do_demangle_.
14605 (General_options::finalize): Set do_demangle_. Handle demangling
14606 style.
14607 * options.h (parse_optional_string): Declare.
14608 (struct One_option): Add optional_arg field. Update constructor.
14609 Update call constructor calls. Add takes_optional_argument
14610 function.
14611 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
14612 (DEFINE_optional_string): Define.
14613 (General_options::demangle): Change from DEFINE_bool to
14614 DEFINE_optional_string.
14615 (General_options::no_demangle): New function.
14616 (General_options::do_demangle): New function.
14617 (General_options::set_do_demangle): New function.
14618 (General_options::execstack_status_): Move definition to end of
14619 class definition.
14620 (General_options::static_): Likewise.
14621 (General_options::do_demangle_): New field.
14622 * object.cc (big_endian>::get_symbol_location_info): Call
14623 Options::do_demangle, not Options::demangle.
14624 * symtab.cc (demangle): Likewise.
14625
14626 2008-03-22 Ian Lance Taylor <iant@google.com>
14627
14628 * gold.h: Include <cstddef> and <sys/types.h>
14629 * options.h: Include <cstring>.
14630
14631 2008-03-21 Ian Lance Taylor <iant@google.com>
14632
14633 * Added source code to GNU binutils.
14634 \f
14635 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14636
14637 Copying and distribution of this file, with or without modification,
14638 are permitted in any medium without royalty provided the copyright
14639 notice and this notice are preserved.
14640
14641 Local Variables:
14642 mode: change-log
14643 left-margin: 8
14644 fill-column: 74
14645 version-control: never
14646 End:
This page took 0.345405 seconds and 4 git commands to generate.