* timer.cc: #include <unistd.h>.
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2012-04-06 Ian Lance Taylor <iant@google.com>
2
3 * timer.cc: #include <unistd.h>.
4
5 2012-04-06 Roland McGrath <mcgrathr@google.com>
6
7 * configure.in (AC_CHECK_HEADERS): Add locale.h.
8 * config.in: Regenerate.
9 * configure: Regenerate.
10
11 2012-04-05 Nick Clifton <nickc@redhat.com>
12
13 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
14 (AM_LC_MESSAGES): Add.
15 * aclocal.m4: Regenerate.
16 * config.in: Regenerate.
17 * configure: Regenerate.
18
19 2012-03-21 Cary Coutant <ccoutant@google.com>
20
21 * Makefile.am: Add gdb-index.cc, gdb-index.h.
22 * Makefile.in: Regenerate.
23 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
24 (Sized_elf_reloc_mapper::symbol_section): New function.
25 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
26 (make_elf_reloc_mapper): New function.
27 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
28 (Dwarf_abbrev_table::do_read_abbrevs): New function.
29 (Dwarf_abbrev_table::do_get_abbrev): New function.
30 (Dwarf_ranges_table::read_ranges_table): New function.
31 (Dwarf_ranges_table::read_range_list): New function.
32 (Dwarf_pubnames_table::read_section): New function.
33 (Dwarf_pubnames_table::read_header): New function.
34 (Dwarf_pubnames_table::next_name): New function.
35 (Dwarf_die::Dwarf_die): New function.
36 (Dwarf_die::read_attributes): New function.
37 (Dwarf_die::skip_attributes): New function.
38 (Dwarf_die::set_name): New function.
39 (Dwarf_die::set_linkage_name): New function.
40 (Dwarf_die::attribute): New function.
41 (Dwarf_die::string_attribute): New function.
42 (Dwarf_die::int_attribute): New function.
43 (Dwarf_die::uint_attribute): New function.
44 (Dwarf_die::ref_attribute): New function.
45 (Dwarf_die::child_offset): New function.
46 (Dwarf_die::sibling_offset): New function.
47 (Dwarf_info_reader::check_buffer): New function.
48 (Dwarf_info_reader::parse): New function.
49 (Dwarf_info_reader::do_parse): New function.
50 (Dwarf_info_reader::do_read_string_table): New function.
51 (Dwarf_info_reader::lookup_reloc): New function.
52 (Dwarf_info_reader::get_string): New function.
53 (Dwarf_info_reader::visit_compilation_unit): New function.
54 (Dwarf_info_reader::visit_type_unit): New function.
55 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
56 Sized_elf_reloc_mapper.
57 (Sized_dwarf_line_info::symbol_section): Remove function.
58 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
59 (Sized_dwarf_line_info::read_line_mappings): Remove object
60 parameter, adjust callers.
61 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
62 * dwarf_reader.h: Include <sys/types.h>.
63 (class Track_relocs): Remove forward declaration.
64 (class Elf_reloc_mapper): New class.
65 (class Sized_elf_reloc_mapper): New class.
66 (class Dwarf_abbrev_table): New class.
67 (class Dwarf_range_list): New class.
68 (class Dwarf_ranges_table): New class.
69 (class Dwarf_pubnames_table): New class.
70 (class Dwarf_die): New class.
71 (class Dwarf_info_reader): New class.
72 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
73 (Sized_dwarf_line_info::symbol_section): Remove member function.
74 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
75 base class.
76 * gdb-index.cc: New source file.
77 * gdb-index.h: New source file.
78 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
79 and .debug_types sections, call Layout::add_to_gdb_index.
80 (Sized_relobj_incr::do_section_name): Implement.
81 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
82 return type; Implement.
83 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
84 return type.
85 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
86 parameter list and return type.
87 (Sized_incr_dynobj::do_section_contents): Likewise.
88 * layout.cc: Include gdb-index.h.
89 (Layout::Layout): Initialize gdb_index_data_.
90 (Layout::init_fixed_output_section): Check for .gdb_index section.
91 (Layout::add_to_gdb_index): New function. Instantiate.
92 * layout.h: Add forward declaration for class Gdb_index.
93 (Layout::add_to_gdb_index): New member function.
94 (Layout::gdb_index_data_): New data member.
95 * main.cc: Include gdb-index.h.
96 (main): Print statistics for gdb index.
97 * object.cc (Object::section_contents): Move code into
98 do_section_contents.
99 (need_decompressed_section): Check for sections needed when building
100 gdb index.
101 (build_compressed_section_map): Likewise.
102 (Sized_relobj_file::do_read_symbols): Need local symbols when building
103 gdb index.
104 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
105 sections; call Layout::add_to_gdb_index.
106 (Sized_relobj_file::do_decompressed_section_contents): Call
107 do_section_contents directly.
108 * object.h (Object::do_section_contents): Adjust parameter list and
109 return type.
110 (Object::do_decompressed_section_contents): Call do_section_contents
111 directly.
112 (Sized_relobj_file::do_section_contents): Adjust parameter list and
113 return type.
114 * options.h (class General_options): Add --gdb-index option.
115 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
116 list and return type.
117 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
118 * reloc.h (Track_relocs::checkpoint): New function.
119 (Track_relocs::reset): New function.
120
121 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
122 New test cases.
123 * testsuite/Makefile.in: Regenerate.
124 * testsuite/gdb_index_test.cc: New test source file.
125 * testsuite/gdb_index_test_1.sh: New test source file.
126 * testsuite/gdb_index_test_2.sh: New test source file.
127
128 2012-03-19 Doug Kwan <dougkwan@google.com>
129
130 * arm.cc (Target_arm::do_define_standard_symbols): New method.
131 (Target_arm::do_finalize_sections): Remove code which defines
132 __exidx_start and __exidx_end. Make symbol table parameter
133 anonymous as it is not used.
134 * gold.cc (queue_middle_tasks): Call target hook to define any
135 target-specific symbols.
136 * target.h (Target::define_standard_symbols): New method.
137 (Target::do_define_standard_symbols): Same.
138 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
139 * testsuite/Makefile.in: Regenerate.
140 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
141 and __exidx_end.
142 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
143 relocations are generated for __exidx_start and __exidx_end.
144
145 2012-03-16 Doug Kwan <dougkwan@google.com>
146
147 * testsuite/Makefile.am: Disable test initpri3b.
148 * testsuite/Makefile.in: Regenerate.
149
150 2012-03-15 Doug Kwan <dougkwan@google.com>
151
152 * arm.cc (Target_arm::got_section): Make .got section read-only
153 if -z now is given.
154
155 2012-03-15 Ian Lance Taylor <iant@google.com>
156
157 PR gold/13850
158 * layout.cc (Layout::make_output_section): Correctly mark
159 SHT_INIT_ARRAY, et. al., as relro.
160
161 2012-03-14 Doug Kwan <dougkwan@google.com>
162
163 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
164 dynamic relocations for protected symbols in shared objects.
165
166 2012-03-13 Ian Lance Taylor <iant@google.com>
167
168 * resolve.cc (Symbol_table::resolve): When merging common symbols,
169 keep the larger alignment.
170
171 2012-03-12 Cary Coutant <ccoutant@google.com>
172
173 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
174 handling of DW_LNE_define_file.
175
176 2012-03-12 Cary Coutant <ccoutant@google.com>
177
178 * reduced_debug_output.cc
179 (Output_reduced_debug_info_section::get_die_end): Add new FORM
180 codes to switch.
181
182 2012-02-29 Cary Coutant <ccoutant@google.com>
183
184 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
185
186 2012-02-29 Cary Coutant <ccoutant@google.com>
187
188 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
189 Call Object::decompressed_section_contents.
190 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
191 New dtor.
192 (Sized_dwarf_line_info::buffer_start_): New data member.
193 * merge.cc (Output_merge_data::do_add_input_section): Call
194 Object::decompressed_section_contents.
195 (Output_merge_string::do_add_input_section): Likewise.
196 * object.cc (need_decompressed_section): New function.
197 (build_compressed_section_map): Decompress sections needed later.
198 (Sized_relobj_file::do_decompressed_section_contents): New function.
199 (Sized_relobj_file::do_discard_decompressed_sections): New function.
200 * object.h (Object::decompressed_section_contents): New function.
201 (Object::discard_decompressed_sections): New function.
202 (Object::do_decompressed_section_contents): New function.
203 (Object::do_discard_decompressed_sections): New function.
204 (Compressed_section_info): New type.
205 (Compressed_section_map): Include decompressed section contents.
206 (Sized_relobj_file::do_decompressed_section_contents): New function.
207 (Sized_relobj_file::do_discard_decompressed_sections): New function.
208
209 2012-02-16 Cary Coutant <ccoutant@google.com>
210
211 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
212 * testsuite/Makefile.in: Regenerate.
213
214 2012-02-14 Cary Coutant <ccoutant@google.com>
215
216 * options.cc (General_options::finalize): Disallow -pie and -static.
217
218 2012-02-03 Doug Kwan <dougkwan@google.com>
219
220 * arm.cc (Arm_relocate_functions::abs8,
221 Arm_relocate_functions::abs16): Use
222 Bits::has_signed_unsigned_overflow32.
223 (Arm_relocate_functions::thm_abs8): Correct range of
224 overflow check.
225 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
226 in assertions.
227
228 2012-02-02 Doug Kwan <dougkwan@google.com>
229
230 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
231 position independent outputs, not just shared objects.
232
233 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
234
235 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
236 * configure: Regenerated.
237
238 2012-01-27 Ian Lance Taylor <iant@google.com>
239
240 * reloc.h (Bits): New class with static functions, copied from
241 namespace utils in arm.cc.
242 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
243 instead.
244
245 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
246
247 * incremental.cc (write_info_blocks): Correct relocation offset.
248
249 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
250
251 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
252 (Relocate::tls_gd_to_le): Likewise.
253
254 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
255
256 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
257
258 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
259
260 * configure.ac: Check if -mcmodel=medium works.
261 * configure: Regenerated.
262
263 2012-01-24 Cary Coutant <ccoutant@google.com>
264
265 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
266 definition and ...
267 (read_unsigned_LEB_128_x): ... this new function.
268 (read_signed_LEB_128): Replaced with inline definition and ...
269 (read_signed_LEB_128_x): ... this new function.
270 * int_encoding.h (read_unsigned_LEB_128_x): New function.
271 (read_unsigned_LEB_128): Add inline definition.
272 (read_signed_LEB_128_x): New function.
273 (read_signed_LEB_128): Add inline definition.
274 * testsuite/Makefile.am (leb128_unittest): New unit test.
275 * testsuite/Makefile.in: Regenerate.
276 * testsuite/leb128_unittest.cc: New unit test.
277
278 2012-01-23 Ian Lance Taylor <iant@google.com>
279
280 PR gold/13617
281 * i386.cc (Target_i386::do_code_fill): When using a jmp
282 instruction, pad with nop instructions.
283 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
284
285 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
286
287 * x86_64.cc (gc_process_relocs): Add typename on types used in
288 template.
289 (scan_relocs): Likewise.
290 (relocate_section): Likewise.
291 (apply_relocation): Likewise.
292
293 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
294
295 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
296 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
297 under x32.
298
299 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
300
301 * x86_64.cc: Initial support for x32.
302
303 2012-01-03 Cary Coutant <ccoutant@google.com>
304
305 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
306 Use abstract base class for GOT.
307 * gold/output.h (class Output_data_got_base): New abstract base class.
308 (class Output_data_got): Derive from new base class, adjust ctors.
309 (Output_data_got::reserve_slot): Make virtual; rename to
310 do_reserve_slot; Adjust callers.
311 * gold/target.h (Sized_target::init_got_plt_for_update): Return
312 pointer to abstract base class.
313 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
314
315 2011-12-18 Ian Lance Taylor <iant@google.com>
316
317 * object.h (Relobj::local_symbol_value): New function.
318 (Relobj::local_plt_offset): New function.
319 (Relobj::local_has_got_offset): New function.
320 (Relobj::local_got_offset): New function.
321 (Relobj::set_local_got_offset): New function.
322 (Relobj::do_local_symbol_value): New pure virtual function.
323 (Relobj::do_local_plt_offset): Likewise.
324 (Relobj::do_local_has_got_offset): Likewise.
325 (Relobj::do_local_got_offset): Likewise.
326 (Relobj::do_set_local_got_offset): Likewise.
327 (Sized_relobj::do_local_has_got_offset): Rename from
328 local_has_got_offset.
329 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
330 (Sized_relobj::do_set_local_got_offset): Rename from
331 set_local_got_offset.
332 (Sized_relobj_file::do_local_plt_offset): Rename from
333 local_plt_offset.
334 (Sized_relobj_file::do_local_symbol_value): New function.
335 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
336 local_plt_offset.
337 * output.cc (Output_data_got::Got_entry::write): Change object to
338 Relobj. Use local_symbol_value.
339 (Output_data_got::add_global_with_rel): Change rel_dyn to
340 Output_data_reloc_generic*. Use add_global_generic.
341 (Output_data_got::add_global_with_rela): Remove. Change all
342 callers to use add_global_with_rel.
343 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
344 Output_data_reloc_generic*. Use add_global_generic.
345 (Output_data_got::add_global_pair_with_rela): Remove. Change all
346 callers to use add_global_pair_with_rel.
347 (Output_data_got::add_local): Change object to Relobj*.
348 (Output_data_got::add_local_plt): Likewise.
349 (Output_data_got::add_local_with_rel): Change object to Relobj*,
350 change rel_dyn to Output_data_reloc_generic*. Use
351 add_local_generic.
352 (Output_data_got::add_local_with_rela): Remove. Change all
353 callers to use all_local_with_rel.
354 (Output_data_got::add_local_pair_with_rel): Change object to
355 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
356 add_output_section_generic.
357 (Output_data_got::add_local_pair_with_rela): Remove. Change all
358 callers to use add_local_pair_with_rel.
359 (Output_data_got::reserve_local): Change object to Relobj*.
360 * output.h: (class Output_data_reloc_generic): Add pure virtual
361 declarations for add_global_generic, add_local_generic,
362 add_output_section_generic.
363 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
364 functions for Output_data_reloc_generic. Update declarations for
365 changes listed in output.cc.
366 (class Output_data_got): Change template parameter to got_size.
367 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
368 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
369 function.
370 (Sized_relobj_incr::do_local_plt_offset): New function.
371 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
372 add_global_generic.
373
374 2011-12-17 Cary Coutant <ccoutant@google.com>
375
376 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
377 * resolve.cc (Symbol_table::resolve): Likewise.
378 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
379 arrays.
380 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
381
382 2011-12-16 Ian Lance Taylor <iant@google.com>
383
384 * output.h (Output_data_reloc_generic::add): Only call
385 add_dynamic_reloc if this is a dynamic reloc section.
386
387 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
388
389 PR gold/13505
390 * target-reloc.h (apply_relocation): Replace <64, false> with
391 <size, big_endian>.
392
393 2011-11-25 Nick Clifton <nickc@redhat.com>
394
395 * po/it.po: New Italian translation.
396
397 2011-11-17 Sterling Augustine <saugustine@google.com>
398
399 * script.cc (script_include_directive): Implement.
400 (read_script_file): New local variables name and search_path. Update
401 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
402 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
403 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
404
405 2011-11-11 Sterling Augustine <saugustine@google.com>
406
407 * yyscript.y (section_cmd): Add support for INCLUDE directive.
408 (file_or_sections_cmd): Likewise.
409
410 2011-11-11 Doug Kwan <dougkwan@google.com>
411
412 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
413 if --just-symbols is given.
414
415 2011-11-10 Doug Kwan <dougkwan@google.com>
416
417 PR gold/13362
418 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
419 when processing data relocs.
420 * reloc.h (Relocate_functions::rel_unaligned): New method.
421 (Relocate_functions::pcrel_unaligned): Ditto.
422 (Relocate_functions::rel32_unaligned): Ditto.
423 (Relocate_functions::pcrel32_unaligned): Ditto.
424
425 2011-11-09 Doug Kwan <dougkwan@google.com>
426
427 PR gold/13362
428 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
429 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
430 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
431 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
432 (Relocate_functions::rel_unaligned): New.
433 (Relocate_functions::rel32_unaligned): New.
434 * target-reloc.h (relocate_for_relocatable): Add code to handle
435 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
436 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
437 arm_unaligned_reloc_r): New targets.
438 * testsuite/Makefile.in: Regenerate.
439 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
440 linking.
441
442 2011-11-02 Ian Lance Taylor <iant@google.com>
443
444 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
445 NATIVE_LINKER.
446 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
447 * options.cc (General_options::finalize): Use library search path
448 from configure script if specified. If not native and no sysroot,
449 only search TOOLLIBDIR.
450 * options.h (Search_directory::Search_directory): Change name to
451 const std::string&.
452 (General_options::add_to_library_path_with_sysroot): Change arg to
453 const std::string&.
454 * configure, Makefile.in, config.in: Rebuild.
455
456 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
457
458 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
459 we are working around the ARM1176 Erratum.
460 * options.h (General_options::fix_arm1176): Add option.
461 * testsuite/Makefile.am: Add testcases, and keep current ones
462 working.
463 * testsuite/Makefile.in: Regenerate.
464 * testsuite/arm_fix_1176.s: New file.
465 * testsuite/arm_fix_1176.sh: Likewise.
466
467 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
468
469 * arm.cc (Target_arm::Target_arm): Remove initialisation of
470 may_use_blx_.
471 (Target_arm::may_use_blx): Remove method.
472 (Target_arm::set_may_use_blx): Likewise.
473 (Target_arm::may_use_v4t_interworking): New method.
474 (Target_arm::may_use_v5t_interworking): Likewise.
475 (Target_arm::may_use_blx_): Remove member variable.
476 (Arm_relocate_functions::arm_branch_common): Check for v5T
477 interworking.
478 (Arm_relocate_functions::thumb_branch_common): Likewise.
479 (Reloc_stub::stub_type_for_reloc): Likewise.
480 (Target_arm::do_finalize_sections): Correct interworking checks.
481 * testsuite/Makefile.am: Add new tests.
482 * testsuite/Makefile.in: Regenerate.
483 * testsuite/arm_farcall_arm_arm.s: New test.
484 * testsuite/arm_farcall_arm_arm.sh: Likewise.
485 * testsuite/arm_farcall_arm_thumb.s: Likewise.
486 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
487 * testsuite/arm_farcall_thumb_arm.s: Likewise.
488 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
489 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
490 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
491
492 2011-10-31 Cary Coutant <ccoutant@google.com>
493
494 PR gold/13023
495 * expression.cc (Expression::eval_with_dot): Add
496 is_section_dot_assignment parameter.
497 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
498 absolute and assigning to dot within a section.
499 * script-sections.cc
500 (Output_section_element_assignment::set_section_addresses): Pass
501 dot_section to set_if_absolute.
502 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
503 as is_section_dot_assignment flag to eval_with_dot.
504 (Output_section_element_dot_assignment::set_section_addresses):
505 Likewise.
506 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
507 parameter. Also set value if relative to dot_section; set the
508 symbol's output_section.
509 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
510 parameter. Adjust all callers.
511 (Expression::eval_maybe_dot): Likewise.
512 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
513 Adjust all callers.
514 * testsuite/script_test_2.t: Test assignment of an absolute value
515 to dot within an output section element.
516
517 2011-10-31 Cary Coutant <ccoutant@google.com>
518
519 * options.h (class General_options): Add --[no-]gnu-unique options.
520 * symtab.cc (Symbol_table::sized_write_globals): Convert
521 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
522
523 2011-10-31 Cary Coutant <ccoutant@google.com>
524
525 PR gold/13359
526 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
527 unnecessary assertion.
528 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
529
530 2011-10-31 Sriraman Tallam <tmsriram@google.com>
531
532 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
533 gc_mark_symbol.
534 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
535 gc_mark_symbol.
536 Change to just keep the section associated with symbol.
537 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
538 they are externally visible and --export-dynamic is turned on.
539 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
540
541 2011-10-19 Ian Lance Taylor <iant@google.com>
542
543 PR gold/13163
544 * script-sections.cc
545 (Output_section_element_dot_assignment::needs_output_section): New
546 function.
547
548 2011-10-19 Ian Lance Taylor <iant@google.com>
549
550 PR gold/13204
551 * layout.cc (Layout::segment_precedes): Don't assert failure if a
552 --section-start option was seen.
553 * options.h (General_options::any_section_start): New function.
554
555 2011-10-18 David S. Miller <davem@davemloft.net>
556
557 PR binutils/13301
558 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
559 member to track relocation locations that have moved during TLS
560 reloc optimizations.
561 (Target_sparc::Relocate::Relocate): Initialize to NULL.
562 (Target_sparc::Relocate::relocate): Adjust view down by 4
563 bytes if it matches reloc_adjust_addr_.
564 (Target_sparc::Relocate::relocate_tls): Always move the
565 __tls_get_addr call delay slot instruction forward 4 bytes when
566 performing relaxation.
567
568 2011-10-18 Cary Coutant <ccoutant@google.com>
569
570 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
571 (Output_file::map_no_anonymous): Check for non-zero
572 return code from posix_fallocate.
573
574 2011-10-17 Cary Coutant <ccoutant@google.com>
575
576 PR gold/13245
577 * plugin.cc (is_visible_from_outside): Check for symbols
578 referenced from dynamic objects.
579 * resolve.cc (Symbol_table::resolve): Don't count references
580 from dynamic objects as references from real ELF files.
581 * testsuite/plugin_test_2.sh: Adjust expected result.
582
583 2011-10-17 Cary Coutant <ccoutant@google.com>
584
585 * gold.cc: Include timer.h.
586 (queue_middle_tasks): Stamp time.
587 (queue_final_tasks): Likewise.
588 * main.cc (main): Store timer in parameters. Print timers
589 for each pass.
590 * parameters.cc (Parameters::Parameters): Initialize timer_.
591 (Parameters::set_timer): New function.
592 (set_parameters_timer): New function.
593 * parameters.h (Parameters::set_timer): New function.
594 (Parameters::timer): New function.
595 (Parameters::timer_): New data member.
596 (set_parameters_timer): New function.
597 * timer.cc (Timer::stamp): New function.
598 (Timer::get_pass_time): New function.
599 * timer.h (Timer::stamp): New function.
600 (Timer::get_pass_time): New function.
601 (Timer::pass_times_): New data member.
602
603 2011-10-17 Cary Coutant <ccoutant@google.com>
604
605 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
606 task for members of lib groups.
607
608 2011-10-17 Cary Coutant <ccoutant@google.com>
609
610 PR gold/13288
611 * fileread.cc (File_read::find_view): Add assert.
612 (File_read::make_view): Move bounds check (replace with assert)...
613 (File_read::find_or_make_view): ... to here.
614
615 2011-10-12 Cary Coutant <ccoutant@google.com>
616
617 * output.cc (Output_file::open_base_file): Handle case where
618 ::read returns less than requested size.
619
620 2011-10-10 Cary Coutant <ccoutant@google.com>
621
622 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
623 Initialize defined_count_.
624 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
625 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
626 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
627 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
628 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
629 * incremental.h (Sized_relobj_incr::defined_count_): New data
630 member.
631 (Sized_incr_dynobj::defined_count_): New data member.
632 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
633 Return zeroes instead of internal error.
634
635 2011-10-10 Cary Coutant <ccoutant@google.com>
636
637 PR gold/13249
638 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
639 (Output_reloc::symbol_value): Return PLT offset if flag is set.
640 * output.h (class Output_reloc): Add use_plt_offset flag.
641 (Output_reloc::type_): Adjust size of bit field.
642 (Output_reloc::use_plt_offset_): New bit field.
643 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
644 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
645 flag. Adjust all callers.
646 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
647 creating RELATIVE relocations.
648
649 2011-10-10 Nick Clifton <nickc@redhat.com>
650
651 * po/es.po: Updated Spanish translation.
652 * po/fi.po: Updated Finnish translation.
653
654 2011-10-03 Diego Novillo <dnovillo@google.com>
655
656 * options.cc (parse_uint): Fix dereference of RETVAL.
657
658 2011-09-29 Sriraman Tallam <tmsriram@google.com>
659
660 * layout.h (section_order_map_): New member.
661 (get_section_order_map): New member function.
662 * output.cc (Output_section::add_input_section): Check for patterns
663 only when --section-ordering-file is specified.
664 * gold.cc (queue_middle_tasks): Delay updating order of sections till
665 output_sections have been formed.
666 * layout.cc (Layout_Layout): Initialize section_order_map_.
667 * plugin.cc (update_section_order): Store order in order_map. Do not
668 update the order.
669 * testsuite/Makefile.am: Add test case for plugin_final_layout.
670 * testsuite/Makefile.in: Regenerate.
671 * testsuite/plugin_section_order.c: New file.
672 * testsuite/plugin_final_layout.cc: New file.
673 * testsuite/plugin_final_layout.sh: New file.
674
675 2011-09-29 Cary Coutant <ccoutant@google.com>
676
677 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
678 Check for NULL.
679 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
680 symbols during incremental update.
681 (Symbol_table::add_from_dynobj): Likewise.
682
683 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
684 Ian Lance Taylor <iant@google.com>
685
686 * symtab.cc (Symbol_table::define_special_symbol): Always
687 canonicalize version string.
688
689 2011-09-26 Cary Coutant <ccoutant@google.com>
690
691 * gold.cc (queue_initial_tasks): Move option checks ...
692 * options.cc (General_options::finalize): ... to here. Disable
693 some options; make others fatal.
694
695 2011-09-26 Cary Coutant <ccoutant@google.com>
696
697 gcc PR lto/47247
698 * plugin.cc (get_symbols_v2): New function.
699 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
700 (is_referenced_from_outside): New function.
701 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
702 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
703 (get_symbols): Pass version parameter.
704 (get_symbols_v2): New function.
705 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
706 parameter.
707 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
708 (onload): Add LDPT_GET_SYMBOLS_V2.
709 (all_symbols_read_hook): Use get_symbols_v2; check for
710 LDPR_PREVAILING_DEF_IRONLY_EXP.
711 * testsuite/plugin_test_3.sh: Update expected results.
712
713 2011-09-23 Simon Baldwin <simonb@google.com>
714
715 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
716 configuration options.
717 * configure: Regenerate.
718 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
719 * Makefile.in: Regenerate.
720 * testsuite/Makefile.in: Regenerate.
721
722 2011-09-19 Sriraman Tallam <tmsriram@google.com>
723
724 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
725
726 2011-09-19 Cary Coutant <ccoutant@google.com>
727
728 * incremental.cc (can_incremental_update): Fix typo in comment.
729 * incremental.h (can_incremental_update): Likewise.
730
731 2011-09-18 Cary Coutant <ccoutant@google.com>
732
733 * incremental.cc (can_incremental_update): New function.
734 * incremental.h (can_incremental_update): New function.
735 * layout.cc (Layout::init_fixed_output_section): Call it.
736 (Layout::make_output_section): Don't allow patch space in .eh_frame.
737 * object.cc (Sized_relobj_file::do_layout): Call
738 can_incremental_update.
739
740 2011-09-13 Cary Coutant <ccoutant@google.com>
741
742 * configure.ac: Check for glibc support for gnu_indirect_function
743 support with static linking, setting automake conditional
744 IFUNC_STATIC.
745 * Makefile.in: Regenerate.
746 * configure: Regenerate.
747
748 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
749 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
750 for IFUNC_STATIC.
751 * testsuite/Makefile.in: Regenerate.
752
753 2011-09-13 Cary Coutant <ccoutant@google.com>
754
755 * incremental.cc (Sized_relobj_incr::do_layout): Call
756 report_comdat_group for kept comdat sections.
757 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
758 * testsuite/Makefile.in: Regenerate.
759 * testsuite/incr_comdat_test_1.cc: New source file.
760 * testsuite/incr_comdat_test_2_v1.cc: New source file.
761 * testsuite/incr_comdat_test_2_v2.cc: New source file.
762 * testsuite/incr_comdat_test_2_v3.cc: New source file.
763
764 2011-09-13 Ian Lance Taylor <iant@google.com>
765
766 * object.cc (Sized_relobj_file::do_layout): Remove unused local
767 variable external_symbols_offset.
768
769 2011-09-12 Ian Lance Taylor <iant@google.com>
770
771 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
772 triggered if object has no symbols.
773
774 2011-09-09 David S. Miller <davem@davemloft.net>
775
776 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
777 (Output_fill_debug_line::do_write): Likewise.
778
779 2011-08-29 Cary Coutant <ccoutant@google.com>
780
781 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
782 casts to match formatting specs.
783 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
784
785 2011-08-26 Cary Coutant <ccoutant@google.com>
786
787 * layout.cc (Free_list::allocate): Provide guarantee of minimum
788 remaining hole size when allocating.
789 (Layout::make_output_section): Set fill methods for debug sections.
790 * layout.h (Free_list::Free_list_node): Move from private to
791 public.
792 (Free_list::set_min_hole_size): New function.
793 (Free_list::begin, Free_list::end): New functions.
794 (Free_list::min_hole_): New data member.
795 * output.cc: Include dwarf.h.
796 (Output_fill_debug_info::do_minimum_hole_size): New function.
797 (Output_fill_debug_info::do_write): New function.
798 (Output_fill_debug_line::do_minimum_hole_size): New function.
799 (Output_fill_debug_line::do_write): New function.
800 (Output_section::Output_section): Initialize new data member.
801 (Output_section::set_final_data_size): Ensure patch space is larger
802 than minimum hole size.
803 (Output_section::do_write): Fill holes in debug sections.
804 * output.h (Output_fill): New class.
805 (Output_fill_debug_info): New class.
806 (Output_fill_debug_line): New class.
807 (Output_section::set_free_space_fill): New function.
808 (Output_section::free_space_fill_): New data member.
809 * testsuite/Makefile.am (incremental_test_3): Add
810 --incremental-patch option.
811 (incremental_test_4): Likewise.
812 (incremental_test_5): Likewise.
813 (incremental_test_6): Likewise.
814 (incremental_copy_test): Likewise.
815 (incremental_common_test_1): Likewise.
816 * testsuite/Makefile.in: Regenerate.
817
818 2011-08-26 Nick Clifton <nickc@redhat.com>
819
820 * po/es.po: Updated Spanish translation.
821
822 2011-08-01 Cary Coutant <ccoutant@google.com>
823
824 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
825 * gold/testsuite/Makefile.in: Regenerate.
826 * gold/testsuite/justsyms_exec.c: New source file.
827 * gold/testsuite/justsyms_lib.c: New source file.
828
829 2011-08-01 Cary Coutant <ccoutant@google.com>
830
831 * layout.cc (Layout::set_segment_offsets): Don't realign text
832 segment if -Ttext was specified.
833 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
834 file type.
835 * object.h (Sized_relobj_file::e_type): New function.
836 (Sized_relobj_file::e_type_): New data member.
837 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
838 base address for ET_EXEC files.
839 * target.cc (Target::do_make_elf_object_implementation): Allow
840 ET_EXEC files with --just-symbols option.
841
842 2011-07-28 Cary Coutant <ccoutant@google.com>
843
844 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
845 Add thread_number parameter.
846 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
847 * workqueue-threads.cc
848 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
849 current thread if its thread number is greater than desired thread
850 count.
851 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
852 Add thread_number parameter.
853 (Workqueue::should_cancel_thread): Likewise.
854 (Workqueue::find_runnable_or_wait): Pass thread_number to
855 should_cancel_thread.
856 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
857 parameter.
858
859 2011-07-22 Sriraman Tallam <tmsriram@google.com>
860
861 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
862 only after checking if it cannot be forced local.
863 * symtab.h (is_externally_visible): Check if the symbol is not forced
864 local.
865
866 2011-07-15 Ian Lance Taylor <iant@google.com>
867
868 * options.h (class General_options): Add --print-output-format.
869 Move -EL next to -EB, for better --help output.
870 * target-select.cc: Include <cstdio>, "options.h", and
871 "parameters.h".
872 (Target_selector::do_target_bfd_name): New function.
873 (print_output_format): New function.
874 * target-select.h (class Target_selector): Update declarations.
875 (Target_selector::target_bfd_name): New function.
876 (print_output_format): Declare.
877 * main.cc: Include "target-select.h".
878 (main): Handle --print-output-format.
879 * gold.cc: Include "target-select.h".
880 (queue_initial_tasks): Handle --print-output-format when there are
881 no input files.
882 * parameters.cc (parameters_force_valid_target): Give a better
883 error message if -EB/-EL does not match target.
884 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
885 function.
886
887 2011-07-15 Ian Lance Taylor <iant@google.com>
888
889 * i386.cc (class Output_data_plt_i386): Add layout_ field.
890 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
891 (Output_data_plt_i386::do_write): Write address of .dynamic
892 section to first entry in .got.plt section.
893 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
894 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
895 Initialize layout_.
896 (Output_data_plt_x86_64::do_write): Write address of .dynamic
897 section to first entry in .got.plt section.
898 * layout.h (Layout::dynamic_section): New function.
899
900 2011-07-13 Sriraman Tallam <tmsriram@google.com>
901
902 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
903 to claim_file call.
904 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
905 input_section_position_, and input_section_glob_.
906 (read_layout_from_file): Call function section_ordering_specified.
907 * layout.h (is_section_ordering_specified): New function.
908 (section_ordering_specified): New function.
909 (section_ordering_specified_): New boolean member.
910 * main.cc(main): Call load_plugins after layout object is defined.
911 * output.cc (Output_section::add_input_section): Use
912 function section_ordering_specified to check if section ordering is
913 needed.
914 * output.cc (Output_section::add_relaxed_input_section): Use
915 function section_ordering_specified to check if section ordering is
916 needed.
917 (Output_section::update_section_layout): New function.
918 (Output_section::sort_attached_input_sections): Check if input section
919 must be reordered.
920 * output.h (Output_section::update_section_layout): New function.
921 * plugin.cc (get_section_count): New function.
922 (get_section_type): New function.
923 (get_section_name): New function.
924 (get_section_contents): New function.
925 (update_section_order): New function.
926 (allow_section_ordering): New function.
927 (Plugin::load): Add the new interfaces to the transfer vector.
928 (Plugin_manager::load_plugins): New parameter.
929 (Plugin_manager::all_symbols_read): New parameter.
930 (Plugin_manager::claim_file): New parameter. Save the elf object for
931 unclaimed objects.
932 (Plugin_manager::get_elf_object): New function.
933 (Plugin_manager::get_view): Change to directly use the bool to check
934 if get_view is called from claim_file_hook.
935 * plugin.h (input_objects): New function
936 (Plugin__manager::load_plugins): New parameter.
937 (Plugin_manager::claim_file): New parameter.
938 (Plugin_manager::get_elf_object): New function.
939 (Plugin_manager::in_claim_file_handler): New function.
940 (Plugin_manager::in_claim_file_handler_): New member.
941 (layout): New function.
942 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
943 handler with an extra parameter. Make the elf object before calling
944 claim_file handler.
945 * testsuite/plugin_test.c (get_section_count): New function pointer.
946 (get_section_type): New function pointer.
947 (get_section_name): New function pointer.
948 (get_section_contents): New function pointer.
949 (update_section_order): New function pointer.
950 (allow_section_ordering): New function pointer.
951 (onload): Check if the new interfaces exist.
952
953 2011-07-13 Ian Lance Taylor <iant@google.com>
954
955 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
956 relro section.
957 * x86_64.cc (Target_x86_64::got_section): Likewise.
958 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
959 (relro_now_test_SOURCES): New variable.
960 (relro_now_test_DEPENDENCIES): New variable.
961 (relro_now_test_LDFLAGS): New variable.
962 (relro_now_test_LDADD): New variable.
963 (relro_now_test.so): New target.
964 * testsuite/Makefile.in: Rebuild.
965
966 2011-07-12 Ian Lance Taylor <iant@google.com>
967
968 PR gold/12980
969 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
970 GLOB_DAT relocation rather than a RELATIVE relocation for a
971 protected symbol when creating a shared library.
972 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
973 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
974 * testsuite/protected_main_1.cc (main): Test that protected
975 function has same address.
976
977 2011-07-11 Ian Lance Taylor <iant@google.com>
978
979 PR gold/12979
980 * options.h (class General_options): Add -Bgroup.
981 * options.cc (General_options::finalize): If -Bgroup is set,
982 default to --unresolved-symbols=report-all.
983 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
984 * target-reloc.h (issue_undefined_symbol_error): Handle
985 --unresolved-symbols=report-all.
986
987 2011-07-08 Ian Lance Taylor <iant@google.com>
988
989 PR gold/11985
990 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
991 if linker script discards key sections.
992 (Layout::create_dynamic_symtab): Likewise.
993 (Layout::assign_local_dynsym_offsets): Likewise.
994 (Layout::sized_create_version_sections): Likewise.
995 (Layout::create_interp): Likewise.
996 (Layout::finish_dynamic_section): Likewise.
997 (Layout::set_dynamic_symbol_size): Likewise.
998
999 2011-07-08 Ian Lance Taylor <iant@google.com>
1000
1001 PR gold/12386
1002 * options.h (class General_options): Add --unresolved-symbols.
1003 * target-reloc.h (issue_undefined_symbol_error): Check
1004 --unresolved-symbols. Add comments.
1005
1006 2011-07-08 Ian Lance Taylor <iant@google.com>
1007
1008 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1009 expression more complex.
1010
1011 2011-07-08 Ian Lance Taylor <iant@google.com>
1012
1013 PR gold/11317
1014 * target-reloc.h (issue_undefined_symbol_error): New inline
1015 function, broken out of relocate_section.
1016 (relocate_section): Call issue_undefined_symbol_error.
1017 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1018 there is no TLS segment if we are about to issue an undefined
1019 symbol error.
1020 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1021
1022 2011-07-08 Ian Lance Taylor <iant@google.com>
1023
1024 PR gold/12279
1025 * resolve.cc (Symbol_table::should_override): Add fromtype
1026 parameter. Change all callers. Give error when linking together
1027 TLS and non-TLS symbol.
1028 (Symbol_table::should_override_with_special): Add fromtype
1029 parameter. Change all callers.
1030 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1031 there is no TLS segment if we have reported some errors.
1032 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1033
1034 2011-07-08 Ian Lance Taylor <iant@google.com>
1035
1036 PR gold/12372
1037 * target.h (Target::plt_address_for_global): New function.
1038 (Target::plt_address_for_local): New function.
1039 (Target::plt_section_for_global): Remove.
1040 (Target::plt_section_for_local): Remove.
1041 (Target::do_plt_address_for_global): New virtual function.
1042 (Target::do_plt_address_for_local): New virtual function.
1043 (Target::do_plt_section_for_global): Remove.
1044 (Target::do_plt_section_for_local): Remove.
1045 (Target::register_global_plt_entry): Add Symbol_table and Layout
1046 parameters.
1047 * output.cc (Output_data_got::Got_entry::write): Use
1048 plt_address_for_global and plt_address_for_local.
1049 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1050 address of output section.
1051 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1052 got_irelative_, and irelative_count_ fields. Update
1053 declarations.
1054 (Output_data_plt_i386::has_irelative_section): New function.
1055 (Output_data_plt_i386::entry_count): Add irelative_count_.
1056 (Output_data_plt_i386::set_final_data_size): Likewise.
1057 (class Target_i386): Add got_irelative_ and rel_irelative_
1058 fields. Update declarations.
1059 (Target_i386::Target_i386): Initialize new fields.
1060 (Target_i386::do_plt_address_for_global): New function replacing
1061 do_plt_section_for_global.
1062 (Target_i386::do_plt_address_for_local): New function replacing
1063 do_plt_section_for_local.
1064 (Target_i386::got_section): Create got_irelative_.
1065 (Target_i386::rel_irelative_section): New function.
1066 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1067 fields. Don't define __rel_iplt_{start,end}.
1068 (Output_data_plt_i386::add_entry): Add symtab and layout
1069 parameters. Change all callers. Use different PLT and GOT for
1070 IFUNC symbols.
1071 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1072 layout parameters. Change all callers. Use different PLT and
1073 GOT.
1074 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1075 (Output_data_plt_i386::rel_irelative): New function.
1076 (Output_data_plt_i386::address_for_global): New function.
1077 (Output_data_plt_i386::address_for_local): New function.
1078 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1079 IRELATIVE GOT when changing IFUNC GOT entries.
1080 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1081 reloc.
1082 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1083 if we didn't create an IRELATIVE GOT.
1084 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1085 plt_address_for_local.
1086 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1087 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1088 got_irelative_, and irelative_count_ fields. Update
1089 declarations.
1090 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1091 Initialize new fields. Remove symtab parameter. Change all
1092 callers.
1093 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1094 irelative_count_.
1095 (Output_data_plt_x86_64::has_irelative_section): New function.
1096 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1097 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1098 fields. Update declarations.
1099 (Target_x86_64::Target_x86_64): Initialize new fields.
1100 (Target_x86_64::do_plt_address_for_global): New function replacing
1101 do_plt_section_for_global.
1102 (Target_x86_64::do_plt_address_for_local): New function replacing
1103 do_plt_section_for_local.
1104 (Target_x86_64::got_section): Create got_irelative_.
1105 (Target_x86_64::rela_irelative_section): New function.
1106 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1107 all callers. Don't create __rel_iplt_{start,end}.
1108 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1109 parameters. Change all callers. Use different PLT and GOT for
1110 IFUNC symbols.
1111 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1112 layout parameters. Change all callers. Use different PLT and
1113 GOT.
1114 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1115 parameters. Change all callers. Use different PLT and GOT for
1116 IFUNC symbols.
1117 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1118 (Output_data_plt_x86_64::rela_irelative): New function.
1119 (Output_data_plt_x86_64::address_for_global): New function.
1120 (Output_data_plt_x86_64::address_for_local): New function.
1121 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1122 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1123 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1124 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1125 parameters.
1126 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1127 reloc.
1128 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1129 symbols if we didn't create an IRELATIVE GOT.
1130 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1131 plt_address_for_local.
1132 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1133 * testsuite/ifuncvar1.c: New test file.
1134 * testsuite/ifuncvar2.c: New test file.
1135 * testsuite/ifuncvar3.c: New test file.
1136 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1137 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1138 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1139 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1140 * testsuite/Makefile.in: Rebuild.
1141
1142 2011-07-07 Cary Coutant <ccoutant@google.com>
1143
1144 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1145 (two_file_test_1_ndebug.o): Likewise.
1146 (two_file_test_1b_ndebug.o): Likewise.
1147 (two_file_test_2_ndebug.o): Likewise.
1148 (two_file_test_main_ndebug.o): Likewise.
1149 (incremental_test_2): Link with no-debug versions.
1150
1151 2011-07-06 Cary Coutant <ccoutant@google.com>
1152
1153 * gold/incremental.cc
1154 (Output_section_incremental_inputs::write_info_blocks): Check for
1155 hidden and internal symbols.
1156
1157 2011-07-06 Cary Coutant <ccoutant@google.com>
1158
1159 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1160 Check disposition for startup file.
1161 (Incremental_inputs::report_command_line): Ignore
1162 --incremental-startup-unchanged option.
1163 * options.cc (General_options::parse_incremental_startup_unchanged):
1164 New function.
1165 (General_options::General_options): Initialize new data member.
1166 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1167 (General_options): Add --incremental-startup-unchanged option.
1168 (General_options::incremental_startup_disposition): New function.
1169 (General_options::incremental_startup_disposition_): New data member.
1170
1171 2011-07-06 Cary Coutant <ccoutant@google.com>
1172
1173 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1174 input file index to Script_info ctor.
1175 (Sized_incremental_binary::do_file_has_changed): Find the
1176 command-line argument for files named in scripts.
1177 * incremental.h (Script_info::Script_info): New ctor
1178 with input file index.
1179 (Script_info::input_file_index): New function.
1180 (Script_info::input_file_index_): New data member.
1181 (Incremental_binary::get_library): Add const.
1182 (Incremental_binary::get_script_info): Add const.
1183 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1184 * testsuite/Makefile.am (incremental_test_5): New test case.
1185 (incremental_test_6): New test case.
1186 * testsuite/Makefile.in: Regenerate.
1187
1188 2011-07-06 Cary Coutant <ccoutant@google.com>
1189
1190 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1191 debug output when command lines differ.
1192
1193 2011-07-06 Cary Coutant <ccoutant@google.com>
1194
1195 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1196 --incremental-patch option.
1197 * layout.cc (Free_list::allocate): Extend allocation beyond original
1198 end if enabled.
1199 (Layout::make_output_section): Mark sections that should get
1200 patch space.
1201 * options.cc (parse_percent): New function.
1202 * options.h (parse_percent): New function.
1203 (DEFINE_percent): New macro.
1204 (General_options): Add --incremental-patch option.
1205 * output.cc (Output_section::Output_section): Initialize new data
1206 members.
1207 (Output_section::add_input_section): Print section name when out
1208 of patch space.
1209 (Output_section::add_output_section_data): Likewise.
1210 (Output_section::set_final_data_size): Add patch space when
1211 doing --incremental-full.
1212 (Output_section::do_reset_address_and_file_offset): Remove patch
1213 space.
1214 (Output_segment::set_section_list_addresses): Print debug output
1215 only if --incremental-update.
1216 * output.h (Output_section::set_is_patch_space_allowed): New function.
1217 (Output_section::is_patch_space_allowed_): New data member.
1218 (Output_section::patch_space_): New data member.
1219 * parameters.cc (Parameters::incremental_full): New function.
1220 * parameters.h (Parameters::incremental_full): New function
1221 * testsuite/Makefile.am (incremental_test_2): Add test for
1222 --incremental-patch option.
1223 * testsuite/Makefile.in: Regenerate.
1224 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1225 (t18): Remove function body.
1226
1227 2011-07-05 Doug Kwan <dougkwan@google.com>
1228
1229 PR gold/12771
1230 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1231 Arm_Address type for relocation result.
1232 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1233 overflow check.
1234 (Arm_relocate_functions::abs32): Use unaligned access.
1235 (Arm_relocate_functions::rel32): Ditto.
1236 (Arm_relocate_functions::prel31): Ditto.
1237 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1238 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1239 static data relocations.
1240 * testsuite/Makefile.in: Regnerate.
1241 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1242
1243 2011-07-05 Ian Lance Taylor <iant@google.com>
1244
1245 PR gold/12392
1246 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1247 symbols if necessary.
1248 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1249
1250 2011-07-05 Ian Lance Taylor <iant@google.com>
1251
1252 PR gold/12952
1253 * resolve.cc (Symbol::override_base_with_special): Simply override
1254 version with special symbol version, ignoring previous version.
1255
1256 2011-07-05 Ian Lance Taylor <iant@google.com>
1257
1258 * object.cc (Sized_relobj_file::include_section_group): Add
1259 information to comment about signature location.
1260
1261 2011-07-02 Ian Lance Taylor <iant@google.com>
1262
1263 PR gold/12957
1264 * options.h (class General_options): Add -f and -F.
1265 * options.cc (General_options::finalize): Fatal error if -f/-F
1266 are used without -shared.
1267 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1268
1269 2011-07-02 Ian Lance Taylor <iant@google.com>
1270
1271 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1272
1273 2011-07-01 Ian Lance Taylor <iant@google.com>
1274
1275 PR gold/12525
1276 PR gold/12952
1277 * resolve.cc (Symbol::override_base_with_special): Don't override
1278 the version if the overriding symbol has a different name.
1279 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1280 all callers. If we give an error about an undefined version,
1281 define the base version if necessary.
1282 * dynobj.h (class Versions): Update declaration.
1283 * testsuite/weak_alias_test_5.cc: New file.
1284 * testsuite/weak_alias_test.script: New file.
1285 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1286 and versioned_alias have the right value, and call t2.
1287 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1288 weak_alias_test_5.so.
1289 (weak_alias_test_LDADD): Likewise.
1290 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1291 * testsuite/Makefile.in: Rebuild.
1292
1293 2011-07-01 Ian Lance Taylor <iant@google.com>
1294
1295 PR gold/12525
1296 * options.h (class General_options): Support -z notext.
1297 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1298 -Wl,-z,notext.
1299 (two_file_shared_nonpic.so): Likewise.
1300 (two_file_shared_mixed.so): Likewise.
1301 (two_file_shared_mixed_1.so): Likewise.
1302 (weak_undef_lib_nonpic.so): Likewise.
1303 (alt/weak_undef_lib_nonpic.so): Likewise.
1304 (tls_test_shared_nonpic.so): Likewise.
1305 * testsuite/Makefile.in: Rebuild.
1306
1307 2011-07-01 Ian Lance Taylor <iant@google.com>
1308
1309 PR gold/12525
1310 * configure.ac: Test whether static linking works, setting
1311 the automake conditional HAVE_STATIC.
1312 * testsuite/Makefile.am: Disable tests using -static if
1313 HAVE_STATIC is not true.
1314 * configure, testsuite/Makefile.in: Rebuild.
1315
1316 2011-07-01 Ian Lance Taylor <iant@google.com>
1317
1318 PR gold/12525
1319 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1320 Assert if we see DW_EH_PE_indirect.
1321 * target.h (Target::ehframe_datarel_base): New function.
1322 (Target::do_ehframe_datarel_base): New target function.
1323 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1324 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1325 function.
1326
1327 2011-07-01 Ian Lance Taylor <iant@google.com>
1328
1329 PR gold/12571
1330 * options.h (class General_options): Add
1331 --ld-generated-unwind-info.
1332 * ehframe.cc (Fde::write): Add address parameter. Change all
1333 callers. If associated with PLT, fill in address and size.
1334 (Cie::set_output_offset): Only add merge mapping if there is an
1335 object.
1336 (Cie::write): Add address parameter. Change all callers.
1337 (Eh_frame::add_ehframe_for_plt): New function.
1338 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1339 input_offset_ fields into union u_, with new plt field.
1340 (Fde::Fde): Adjust for new union field.
1341 (Fde::Fde) [Output_data version]: New constructor.
1342 (Fde::add_mapping): Only add merge mapping if there is an object.
1343 (class Cie): Update declarations.
1344 (class Eh_frame): Declare add_ehframe_for_plt.
1345 * layout.cc (Layout::layout_eh_frame): Break out code into
1346 make_eh_frame_section, and call it.
1347 (Layout::make_eh_frame_section): New function.
1348 (Layout::add_eh_frame_for_plt): New function.
1349 * layout.h (class Layout): Update declarations.
1350 * merge.cc (Merge_map::add_mapping): Add assertion.
1351 * i386.cc: Include "dwarf.h".
1352 (class Output_data_plt_i386): Make first_plt_entry,
1353 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1354 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1355 and plt_eh_frame_fde.
1356 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1357 boundary. Call add_eh_frame_for_plt if appropriate.
1358 * x86_64.cc: Include "dwarf.h".
1359 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1360 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1361 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1362 and plt_eh_frame_fde.
1363 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1364 appropriate.
1365
1366 2011-06-29 Ian Lance Taylor <iant@google.com>
1367
1368 PR gold/12629
1369 * object.cc (Sized_relobj_file::layout_section): Change shdr
1370 parameter to be const.
1371 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1372 out of do_layout.
1373 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1374 appropriate. Call layout_eh_frame_section.
1375 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1376 sections.
1377 * object.h (class Sized_relobj_file): Update declarations.
1378
1379 2011-06-29 Ian Lance Taylor <iant@google.com>
1380
1381 PR gold/12652
1382 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1383 modifier.
1384 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1385
1386 2011-06-29 Ian Lance Taylor <iant@google.com>
1387
1388 PR gold/12675
1389 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1390 SHT_X86_64_UNWIND.
1391 * layout.cc (Layout::layout_eh_frame): Likewise.
1392
1393 2011-06-29 Ian Lance Taylor <iant@google.com>
1394
1395 PR gold/12695
1396 * layout.cc (Layout::symtab_section_shndx): New function.
1397 * layout.h (class Layout): Declare symtab_section_shndx.
1398 * output.cc (Output_section::write_header): Call it.
1399
1400 2011-06-29 Ian Lance Taylor <iant@google.com>
1401
1402 PR gold/12818
1403 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1404 symbols which are not used in a relocation.
1405
1406 2011-06-28 Ian Lance Taylor <iant@google.com>
1407
1408 PR gold/12898
1409 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1410 script create indistinguishable segments.
1411 (Layout::set_segment_offsets): Use stable_sort when sorting
1412 segments. Pass this to Compare_segments constructor.
1413 * layout.h (class Layout): Make segment_precedes non-static.
1414 (class Compare_segments): Change from struct to class. Add
1415 layout_ field. Add constructor.
1416 * script-sections.cc
1417 (Script_sections::attach_sections_using_phdrs_clause): Rename
1418 local orphan to is_orphan. Don't report failure to put empty
1419 section in segment. On attachment failure, report name of
1420 section, and attach to first PT_LOAD segment.
1421
1422 2011-06-28 Ian Lance Taylor <iant@google.com>
1423
1424 PR gold/12934
1425 * target-select.cc (Target_selector::Target_selector): Add
1426 emulation parameter. Change all callers.
1427 (select_target_by_bfd_name): Rename from select_target_by_name.
1428 Change all callers.
1429 (select_target_by_emulation): New function.
1430 (supported_emulation_names): New function.
1431 * target-select.h (class Target_selector): Add emulation_ field.
1432 Update declarations.
1433 (Target_selector::recognize_by_bfd_name): Rename from
1434 recognize_by_name. Change all callers.
1435 (Target_selector::supported_bfd_names): Rename from
1436 supported_names. Change all callers.
1437 (Target_selector::recognize_by_emulation): New function.
1438 (Target_selector::supported_emulations): New function.
1439 (Target_selector::emulation): New function.
1440 (Target_selector::do_recognize_by_bfd_name): Rename from
1441 do_recognize_by_name. Change all callers.
1442 (Target_selector::do_supported_bfd_names): Rename from
1443 do_supported_names. Change all callers.
1444 (Target_selector::do_recognize_by_emulation): New function.
1445 (Target_selector::do_supported_emulations): New function.
1446 (select_target_by_bfd_name): Change name in declaration.
1447 (select_target_by_emulation): Declare.
1448 (supported_emulation_names): Declare.
1449 * parameters.cc (parameters_force_valid_target): Try to find
1450 target based on emulation from -m option.
1451 * options.h (class General_options): Change doc string for -m.
1452 * options.cc (help): Print emulations.
1453 (General_options::parse_V): Likewise.
1454 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1455 Add emulation parameter. Change all callers.
1456
1457 2011-06-28 Ian Lance Taylor <iant@google.com>
1458
1459 * target.h (class Target): Add osabi_ field.
1460 (Target::osabi): New function.
1461 (Target::set_osabi): New function.
1462 (Target::Target): Initialize osabi_.
1463 (Target::do_adjust_elf_header): Make pure virtual.
1464 (Sized_target::do_adjust_elf_header): Declare.
1465 * target.cc (Sized_target::do_adjust_elf_header): New function.
1466 (class Sized_target): Instantiate all versions.
1467 * freebsd.h (class Target_freebsd): Remove.
1468 (Target_selector_freebsd::do_recognize): Call set_osabi on
1469 Target.
1470 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1471 (Target_selector_freebsd::set_osabi): Remove.
1472 * i386.cc (class Target_i386): Inherit from Sized_target rather
1473 than Target_freebsd.
1474 * x86_64.cc (class Target_x86_64): Likewise.
1475
1476 2011-06-28 Ian Lance Taylor <iant@google.com>
1477
1478 * target.h (Target::can_check_for_function_pointers): Rewrite.
1479 Make non-virtual.
1480 (Target::can_icf_inline_merge_sections): Likewise.
1481 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1482 (Target::Target_info): Add can_icf_inline_merge_sections field.
1483 (Target::do_can_check_for_function_pointers): New virtual
1484 function.
1485 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1486 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1487 from can_check_for_function_pointers, move in file.
1488 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1489 section_may_have_icf_unsafe_poineters, move in file.
1490 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1491 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1492 Rename from can_check_for_function_pointers, move in file.
1493 (Target_i386::can_icf_inline_merge_sections): Remove.
1494 (Target_i386::i386_info): Initialize
1495 can_icf_inline_merge_sections.
1496 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1497 Initialize can_icf_inline_merge_sections.
1498 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1499 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1500 Rename from can_check_for_function_pointers, move in file.
1501 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1502 (Target_x86_64::x86_64_info): Initialize
1503 can_icf_inline_merge_sections.
1504 * testsuite/testfile.cc (Target_test::test_target_info):
1505 Likewise.
1506 * icf.cc (get_section_contents): Correct formatting.
1507
1508 2011-06-27 Ian Lance Taylor <iant@google.com>
1509
1510 * symtab.cc (Symbol::versioned_name): New function.
1511 (Symbol_table::add_to_final_symtab): Use versioned_name when
1512 appropriate.
1513 (Symbol_table::sized_write_symbol): Likewise.
1514 * symtab.h (class Symbol): Declare versioned_name.
1515 * stringpool.h (class Stringpool_template): Add variant of add
1516 which takes a std::basic_string.
1517 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1518 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1519 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1520 (ver_test_12.o): New target.
1521 * testsuite/Makefile.in: Rebuild.
1522
1523 2011-06-27 Doug Kwan <dougkwan@google.com>
1524
1525 * arm.cc (Arm_relocate_functions::thm_jump8,
1526 Arm_relocate_functions::thm_jump11): Use a wider signed
1527 type to compute offset.
1528 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1529 arm_thm_jump8.
1530 * testsuite/Makefile.in: Regenerate.
1531 * testsuite/arm_branch_in_range.sh: Check test results of
1532 arm_thm_jump11 and arm_thm_jump8.
1533 * testsuite/arm_thm_jump11.s: New test source file.
1534 * testsuite/arm_thm_jump11.t: New linker script.
1535 * testsuite/arm_thm_jump8.s: New test source file.
1536 * testsuite/arm_thm_jump8.t: New linker script.
1537
1538 2011-06-24 Ian Lance Taylor <iant@google.com>
1539
1540 * layout.cc: Include "object.h".
1541 (ctors_sections_in_init_array): New static variable.
1542 (Layout::is_ctors_in_init_array): New function.
1543 (Layout::layout): Add entry to ctors_sections_in_init_array if
1544 appropriate.
1545 * layout.h (class Layout): Declare is_ctors_in_init_array.
1546 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1547 is_ctors_reverse_view is set.
1548 (Sized_relobj_file::write_sections): Add layout parameter. Change
1549 all callers. Set is_ctors_reverse_view field of View_size.
1550 (Sized_relobj_file::reverse_words): New function.
1551 * object.h (Sized_relobj_file::View_size): Add
1552 is_ctors_reverse_view field.
1553 (class Sized_relobj_file): Update declarations.
1554 * testsuite/initpri3.c: New test.
1555 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1556 initpri3b.
1557 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1558 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1559 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1560 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1561 * testsuite/Makefile.in: Rebuild.
1562
1563 2011-06-24 Cary Coutant <ccoutant@google.com>
1564
1565 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1566 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1567 (debug_msg_cdebug.err): New targets.
1568 * testsuite/Makefile.in: Regenerate.
1569 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1570 Fix checks for link with shared library.
1571
1572 2011-06-24 Doug Kwan <dougkwan@google.com>
1573
1574 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1575 skip empty text sections.
1576 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1577
1578 2011-06-22 Ian Lance Taylor <iant@google.com>
1579
1580 PR gold/12910
1581 * options.h (class General_options): Add --ctors-in-init-array.
1582 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1583 friends as SHT_PROGBITS for merging sections.
1584 (Layout::layout): Remove special handling of .init_array and
1585 friends. Don't sort if doing relocatable link. Sort for .ctors
1586 and .dtors if ctors_in_init_array.
1587 (Layout::make_output_section): Force correct section types for
1588 .init_array and friends. Don't sort if doing relocatable link,
1589 Don't sort .ctors and .dtors if ctors_in_init_array.
1590 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1591 (Layout::output_section_name): Add relobj parameter. Change all
1592 callers. Handle .ctors. and .dtors. in code rather than table.
1593 Handle .ctors and .dtors if ctors_in_init_array.
1594 (Layout::match_file_name): New function, moved from output.cc.
1595 * layout.h (class Layout): Update declarations.
1596 * output.cc: Include "layout.h".
1597 (Input_section_sort_entry::get_priority): New function.
1598 (Input_section_sort_entry::match_file_name): Just call
1599 Layout::match_file_name.
1600 (Output_section::Input_section_sort_init_fini_compare::operator()):
1601 Handle .ctors and .dtors. Sort by explicit priority rather than
1602 by name.
1603 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1604 * testsuite/initpri2.c: New test.
1605 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1606 (check_PROGRAMS): Add initpri2.
1607 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1608 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1609 * configure, testsuite/Makefile.in: Rebuild.
1610
1611 2011-06-19 Ian Lance Taylor <iant@google.com>
1612
1613 PR gold/12880
1614 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1615 .interp section to a PT_INTERP segment even if we have seen a
1616 --dynamic-linker option. Don't do it if we have seen a PHDRS
1617 clause in a linker script.
1618 (Layout::finalize): Don't create a .interp section if we've
1619 already create a PT_INTERP segment.
1620 (Layout::create_interp): Always call choose_output_section (revert
1621 patch of 2011-06-17). Don't create PT_INTERP segment.
1622 * script-sections.cc
1623 (Script_sections::create_note_and_tls_segments): Add a .interp
1624 section to a PT_INTERP segment even if we have seen a
1625 --dynamic-linker option.
1626
1627 2011-06-18 Ian Lance Taylor <iant@google.com>
1628
1629 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1630 merely because a non-PT_LOAD segment has a dynamic reloc.
1631
1632 2011-06-18 Ian Lance Taylor <iant@google.com>
1633
1634 * layout.cc (Layout::finish_dynamic_section): Don't create
1635 DT_FLAGS entry if not needed.
1636
1637 2011-06-18 Ian Lance Taylor <iant@google.com>
1638
1639 PR gold/12745
1640 * layout.cc (Layout::layout_eh_frame): Correct handling of
1641 writable .eh_frame section.
1642
1643 2011-06-17 Ian Lance Taylor <iant@google.com>
1644
1645 PR gold/12893
1646 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1647 symbol is redefined with the exact same object and value.
1648
1649 2011-06-17 Ian Lance Taylor <iant@google.com>
1650
1651 PR gold/12880
1652 * layout.h (class Layout): Add interp_segment_ field.
1653 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1654 (Layout::attach_allocated_section_to_segment): If making shared
1655 library, put .interp section in PT_INTERP segment.
1656 (Layout::finalize): Also call create_interp if -dynamic-linker
1657 option was used.
1658 (Layout::create_interp): Assert that there is no PT_INTERP
1659 segment. If not using a SECTIONS clause, use make_output_section.
1660 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1661 * script-sections.cc
1662 (Script_sections::create_note_and_tls_segments): If making shared
1663 library, put .interp section in PT_INTERP segment.
1664
1665 2011-06-17 Ian Lance Taylor <iant@google.com>
1666
1667 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1668 when making a shared library.
1669
1670 2011-06-17 Ian Lance Taylor <iant@google.com>
1671
1672 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1673 parameter. Change all callers. Don't issue warning about PC32
1674 against locally defined symbol.
1675
1676 2011-06-16 Ian Lance Taylor <iant@google.com>
1677
1678 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1679 occurs in same object.
1680
1681 2011-06-14 Alan Modra <amodra@gmail.com>
1682
1683 * po/POTFILES.in: Regenerate.
1684
1685 2011-06-09 Ian Lance Taylor <iant@google.com>
1686
1687 * script-sections.cc
1688 (Orphan_output_section::set_section_addresses): For a relocatable
1689 link set address to 0.
1690
1691 2011-06-09 Cary Coutant <ccoutant@google.com>
1692
1693 PR gold/12804
1694 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1695 used with --compress-debug-sections.
1696 * gold/object.cc (Sized_relobj_file::do_layout): Report
1697 uncompressed size of compressed input sections.
1698
1699 2011-06-08 Cary Coutant <ccoutant@google.com>
1700
1701 PR gold/12804
1702 * testsuite/two_file_test_2_v1.cc: Change initialization of
1703 v2 to keep it in .data.
1704
1705 2011-06-07 Cary Coutant <ccoutant@google.com>
1706
1707 * common.cc (Symbol_table::do_allocate_commons_list): Call
1708 gold_fallback.
1709 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1710 (Errors::fallback): New function.
1711 (gold_fallback): New function.
1712 * errors.h (Errors::fallback): New function.
1713 * gold.cc (gold_exit): Change status parameter to enum; adjust
1714 all callers.
1715 (queue_initial_tasks): Call gold_fallback.
1716 * gold.h: Include cstdlib.
1717 (Exit_status): New enum type.
1718 (gold_exit): Change status parameter to enum.
1719 (gold_fallback): New function.
1720 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1721 (Layout::create_symtab_sections): Likewise.
1722 (Layout::create_shdrs): Likewise.
1723 * main.cc (main): Adjust call to gold_exit.
1724 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1725 (Output_data_got::add_got_entry_pair): Likewise.
1726 (Output_section::add_input_section): Likewise.
1727 (Output_section::add_output_section_data): Likewise.
1728 (Output_segment::set_section_list_addresses): Likewise.
1729 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1730
1731 2011-06-07 Cary Coutant <ccoutant@google.com>
1732
1733 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1734 for incremental links.
1735 * output.cc (Output_segment::set_section_list_addresses): Remove
1736 FIXME and test for TLS or BSS.
1737
1738 2011-06-07 Cary Coutant <ccoutant@google.com>
1739
1740 * testsuite/Makefile.am: Add incremental_copy_test,
1741 incremental_common_test_1.
1742 * testsuite/Makefile.in: Regenerate.
1743 * testsuite/common_test_1_v1.c: New source file.
1744 * testsuite/common_test_1_v2.c: New source file.
1745 * testsuite/copy_test_v1.cc: New source file.
1746
1747 2011-06-07 Cary Coutant <ccoutant@google.com>
1748
1749 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1750 update, allocate common from bss section's free list.
1751 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1752 linker-defined symbols.
1753 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1754 Skip GOT and PLT entries that are no longer referenced.
1755 (Output_section_incremental_inputs::write_info_blocks): Mark
1756 linker-defined symbols.
1757 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1758 * output.cc (Output_section::allocate): New function.
1759 * output.h (Output_section::allocate): New function.
1760 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1761 linker-defined symbols.
1762 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1763 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1764 (Symbol::init_base_output_data): Likewise.
1765 (Symbol::init_base_output_segment): Likewise.
1766 (Symbol::init_base_constant): Likewise.
1767 (Sized_symbol::init_output_data): Likewise.
1768 (Sized_symbol::init_output_segment): Likewise.
1769 (Sized_symbol::init_constant): Likewise.
1770 (Symbol_table::do_define_in_output_data): Likewise.
1771 (Symbol_table::do_define_in_output_segment): Likewise.
1772 (Symbol_table::do_define_as_constant): Likewise.
1773 * symtab.h (Symbol::is_predefined): New function.
1774 (Symbol::init_base_output_data): Add is_predefined parameter.
1775 (Symbol::init_base_output_segment): Likewise.
1776 (Symbol::init_base_constant): Likewise.
1777 (Symbol::is_predefined_): New data member.
1778 (Sized_symbol::init_output_data): Add is_predefined parameter.
1779 (Sized_symbol::init_output_segment): Likewise.
1780 (Sized_symbol::init_constant): Likewise.
1781 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1782
1783 2011-06-07 Cary Coutant <ccoutant@google.com>
1784
1785 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1786 instead of emit_copy_reloc.
1787 (Copy_relocs::emit_copy_reloc): Refactor.
1788 (Copy_relocs::make_copy_reloc): New function.
1789 (Copy_relocs::add_copy_reloc): Remove.
1790 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1791 section.
1792 (Copy_relocs::make_copy_reloc): New function.
1793 (Copy_relocs::add_copy_reloc): Remove.
1794 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1795 unchanged input files.
1796 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1797 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1798 Reserve BSS space for COPY relocations.
1799 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1800 (Output_section_incremental_inputs::write_info_blocks): Record
1801 whether a symbol is copied from a shared object.
1802 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1803 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1804 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1805 (Incremental_input_entry_reader::get_output_symbol_index): Add
1806 is_copy parameter.
1807 (Incremental_binary::emit_copy_relocs): New function.
1808 (Incremental_binary::do_emit_copy_relocs): New function.
1809 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1810 new data member.
1811 (Sized_incremental_binary::add_copy_reloc): New function.
1812 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1813 (Sized_incremental_binary::Copy_reloc): New struct.
1814 (Sized_incremental_binary::Copy_relocs): New typedef.
1815 (Sized_incremental_binary::copy_relocs_): New data member.
1816 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1817 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1818 * target.h (Sized_target::emit_copy_reloc): New function.
1819 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1820
1821 2011-06-02 Cary Coutant <ccoutant@google.com>
1822
1823 PR gold/12163
1824 * gold/archive.cc (Archive::Archive): Initialize new data member.
1825 (Archive::include_all_members): Return if archive has already been
1826 included.
1827 * gold/archive.h (Archive::include_all_members_): New data member.
1828
1829 2011-06-02 Nick Clifton <nickc@redhat.com>
1830
1831 * dynobj.h: Fix spelling mistake in comment.
1832 * output.cc: Likewise.
1833
1834 2011-05-31 Doug Kwan <dougkwan@google.com>
1835 Asier Llano
1836
1837 PR gold/12826
1838 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1839 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1840 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1841 redundant arm_exidx_test.so.
1842 * testsuite/Makefile.in: Regenerate.
1843 (check_SCRIPTS): Add pr12826.sh
1844 (check_DATA): Add pr12826.stdout
1845 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1846 * testsuite/pr12826.sh: New file.
1847 * testsuite/pr12826_1.s: Ditto.
1848 * testsuite/pr12826_1.s: Ditto.
1849
1850 2011-05-30 Ian Lance Taylor <iant@google.com>
1851
1852 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1853 sections.
1854
1855 2011-05-29 Ian Lance Taylor <iant@google.com>
1856
1857 PR gold/12804
1858 * testsuite/Makefile.am: Use different file name for two_file_test
1859 temporary file for each incremental test.
1860 * testsuite/Makefile.in: Rebuild.
1861
1862 2011-05-29 Ian Lance Taylor <iant@google.com>
1863
1864 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1865 binary input file is empty.
1866
1867 2011-05-27 Ian Lance Taylor <iant@google.com>
1868
1869 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1870 (ver_test_9.so): Likewise.
1871 * testsuite/Makefile.in: Rebuild.
1872
1873 2011-05-26 Cary Coutant <ccoutant@google.com>
1874
1875 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1876 * incremental.cc (Incremental_inputs::report_input_section): Fix
1877 comment, indentation.
1878 (Incremental_inputs::report_comdat_group): New function.
1879 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1880 of data for incremental input file entry.
1881 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1882 group count, COMDAT group signatures.
1883 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1884 an unchanged input file.
1885 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1886 Initialize new data member.
1887 (Incremental_object_entry::add_comdat_group): New function.
1888 (Incremental_object_entry::get_comdat_group_count): New function.
1889 (Incremental_object_entry::get_comdat_signature_key): New function.
1890 (Incremental_object_entry::groups_): New data member.
1891 (Incremental_inputs::report_comdat_group): New function.
1892 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1893 data for incremental input file entry.
1894 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1895 (Incremental_input_entry_reader::get_input_section): Adjust size of
1896 data for incremental input file entry.
1897 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1898 (Incremental_input_entry_reader::get_comdat_group_signature): New
1899 function.
1900 * object.cc (Sized_relobj::include_section_group): Report kept
1901 COMDAT groups for incremental links.
1902
1903 2011-05-24 David Meyer <pdox@google.com>
1904
1905 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1906 with name parameter. Add found_name parameter.
1907 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1908 * dirsearch.h (class Dirsearch): Update declaration.
1909
1910 2011-05-24 Ian Lance Taylor <iant@google.com>
1911
1912 * archive.cc (Library_base::should_include_member): Pull in object
1913 from archive if it defines the entry symbol.
1914 * parameters.cc (Parameters::entry): New function.
1915 * parameters.h (class Parameters): Declare entry.
1916 * output.h (class Output_file_header): Remove entry_ field.
1917 * output.cc (Output_file_header::Output_file_header): Remove entry
1918 parameter. Change all callers.
1919 (Output_file_header::entry): Use parameters->entry.
1920 * gold.cc (queue_middle_tasks): Likewise.
1921 * plugin.cc (Plugin_hook::run): Likewise.
1922
1923 2011-05-24 Cary Coutant <ccoutant@google.com>
1924
1925 * gold.cc (queue_initial_tasks): Pass incremental base filename
1926 to Output_file::open_base_file; don't print error message.
1927 * incremental-dump.cc (main): Adjust call to
1928 Output_file::open_for_modification.
1929 * incremental-dump.cc (main): Likewise.
1930 * incremental.cc (Incremental_inputs::report_command_line):
1931 Ignore --incremental-base option when comparing command lines.
1932 Ignore parameter when given as separate argument.
1933 * options.h (class General_options): Add --incremental-base.
1934 * output.cc (Output_file::Output_file):
1935 (Output_file::open_base_file): Add base_name and writable parameters;
1936 read base file into new file; print error message here.
1937 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1938 callers.
1939 * output.h (Output_file::open_for_modification): Rename to...
1940 (Output_file::open_base_file): ...this; add base_name and
1941 writable parameters; adjust all callers.
1942 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1943 callers.
1944 * testsuite/Makefile.am (incremental_test_4): Test
1945 --incremental-base.
1946 * testsuite/Makefile.in: Regenerate.
1947
1948 2011-05-24 Cary Coutant <ccoutant@google.com>
1949
1950 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1951 incremental_test_4.
1952 * testsuite/Makefile.in: Regenerate.
1953 * testsuite/two_file_test_1_v1.cc: New test source file.
1954 * testsuite/two_file_test_1b_v1.cc: New test source file.
1955 * testsuite/two_file_test_2_v1.cc: New test source file.
1956
1957 2011-05-24 Cary Coutant <ccoutant@google.com>
1958
1959 * dynobj.h (Dynobj::do_dynobj): New function.
1960 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1961 flag and soname for shared objects.
1962 * incremental.cc (Incremental_inputs::report_object): Make
1963 either Incremental_object_entry or Incremental_dynobj_entry; add
1964 soname to string table.
1965 (Incremental_inputs::report_input_section): Add assertion.
1966 (Output_section_incremental_inputs::set_final_data_size): Adjust
1967 type of input file entry for shared libraries; adjust size of
1968 shared library info entry.
1969 (Output_section_incremental_inputs::write_input_files): Write
1970 as_needed flag for shared libraries.
1971 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1972 of input file entry for shared libraries; write soname.
1973 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1974 soname from incremental info.
1975 * incremental.h (enum Incremental_input_flags): Add
1976 INCREMENTAL_INPUT_AS_NEEDED.
1977 (Incremental_input_entry::Incremental_input_entry): Initialize new
1978 data member.
1979 (Incremental_input_entry::set_as_needed): New function.
1980 (Incremental_input_entry::as_needed): New function.
1981 (Incremental_input_entry::do_dynobj_entry): New function.
1982 (Incremental_input_entry::as_needed_): New data member.
1983 (Incremental_object_entry::Incremental_object_entry): Don't check
1984 for shared library.
1985 (Incremental_object_entry::do_type): Likewise.
1986 (class Incremental_dynobj_entry): New class.
1987 (Incremental_input_entry_reader::as_needed): New function.
1988 (Incremental_input_entry_reader::get_soname): New function.
1989 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1990 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1991 size of shared library info entry.
1992 * layout.cc (Layout::finish_dynamic_section): Don't test for
1993 incremental link when adding DT_NEEDED entries.
1994 * object.h (Object::Object): Initialize new data member.
1995 (Object::dynobj): New function.
1996 (Object::set_as_needed): New function.
1997 (Object::as_needed): New function.
1998 (Object::do_dynobj): New function.
1999 (Object::as_needed_): New data member.
2000
2001 2011-05-24 Cary Coutant <ccoutant@google.com>
2002
2003 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2004 info; adjust display of GOT entries.
2005 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2006 vector of input objects; remove file_status_.
2007 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2008 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2009 got_plt reader; call target hooks to reserve GOT entries.
2010 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2011 of input file info header and GOT info entry.
2012 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2013 relocation info.
2014 (Got_plt_view_info::got_descriptor): Remove.
2015 (Got_plt_view_info::sym_index): New data member.
2016 (Got_plt_view_info::input_index): New data member.
2017 (Local_got_offset_visitor::visit): Write input file index.
2018 (Global_got_offset_visitor::visit): Write 0 for input file index.
2019 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2020 with sym_index and input_index.
2021 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2022 incremental info GOT entry; replace got_descriptor with input_index.
2023 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2024 map from input file index to object.
2025 (Sized_relobj_incr::do_layout): Replace direct data member reference
2026 with accessor function.
2027 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2028 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2029 Adjust size of input file info header.
2030 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2031 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2032 (Incremental_input_entry_reader::get_input_section): Adjust size of
2033 input file info header.
2034 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2035 of incremental info GOT entry.
2036 (Incremental_got_plt_reader::get_got_desc): Remove.
2037 (Incremental_got_plt_reader::get_got_symndx): New function.
2038 (Incremental_got_plt_reader::get_got_input_index): New function.
2039 (Sized_incremental_binary::Sized_incremental_binary): Remove
2040 file_status_; add input_objects_.
2041 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2042 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2043 (Sized_incremental_binary::file_is_unchanged): Remove.
2044 (Sized_incremental_binary::set_input_object): New function.
2045 (Sized_incremental_binary::input_object): New function.
2046 (Sized_incremental_binary::file_status_): Remove.
2047 (Sized_incremental_binary::input_objects_): New data member.
2048 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2049 references.
2050 (Sized_relobj_incr::invalid_address): Move to base class.
2051 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2052 class.
2053 (Sized_relobj_incr::do_output_section_offset): Likewise.
2054 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2055 (Sized_relobj_incr::section_offsets_): Likewise.
2056 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2057 function.
2058 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2059 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2060 with accessor function.
2061 (Sized_relobj_file::do_layout): Likewise.
2062 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2063 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2064 (Sized_relobj_file::compute_final_local_value): Replace refs to
2065 section_offsets_ with accessor function.
2066 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2067 * object.h (Relobj::Relobj): Initialize new data members.
2068 (Relobj::add_dyn_reloc): New function.
2069 (Relobj::first_dyn_reloc): New function.
2070 (Relobj::dyn_reloc_count): New function.
2071 (Relobj::first_dyn_reloc_): New data member.
2072 (Relobj::dyn_reloc_count_): New data member.
2073 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2074 references.
2075 (Sized_relobj::Address): New typedef.
2076 (Sized_relobj::invalid_address): Move here from child class.
2077 (Sized_relobj::Sized_relobj): Initialize new data members.
2078 (Sized_relobj::sized_relobj): New function.
2079 (Sized_relobj::is_output_section_offset_invalid): Move here from
2080 child class.
2081 (Sized_relobj::get_output_section_offset): Likewise.
2082 (Sized_relobj::local_has_got_offset): Likewise.
2083 (Sized_relobj::local_got_offset): Likewise.
2084 (Sized_relobj::set_local_got_offset): Likewise.
2085 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2086 (Sized_relobj::clear_got_offsets): New function.
2087 (Sized_relobj::section_offsets): Move here from child class.
2088 (Sized_relobj::do_output_section_offset): Likewise.
2089 (Sized_relobj::do_set_section_offset): Likewise.
2090 (Sized_relobj::Local_got_offsets): Likewise.
2091 (Sized_relobj::local_got_offsets_): Likewise.
2092 (Sized_relobj::section_offsets_): Likewise.
2093 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2094 references.
2095 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2096 class.
2097 (Sized_relobj_file::sized_relobj): New function
2098 (Sized_relobj_file::local_has_got_offset): Move to base class.
2099 (Sized_relobj_file::local_got_offset): Likewise.
2100 (Sized_relobj_file::set_local_got_offset): Likewise.
2101 (Sized_relobj_file::get_output_section_offset): Likewise.
2102 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2103 (Sized_relobj_file::do_output_section_offset): Likewise.
2104 (Sized_relobj_file::do_set_section_offset): Likewise.
2105 (Sized_relobj_file::Local_got_offsets): Likewise.
2106 (Sized_relobj_file::local_got_offsets_): Likewise.
2107 (Sized_relobj_file::section_offsets_): Likewise.
2108 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2109 (all constructors).
2110 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2111 (Output_reloc::get_symbol_index): Likewise.
2112 (Output_reloc::local_section_offset): Likewise.
2113 (Output_reloc::get_address): Likewise.
2114 (Output_reloc::symbol_value): Likewise.
2115 (Output_data_got::reserve_slot): Move to class definition.
2116 (Output_data_got::reserve_local): New function.
2117 (Output_data_got::reserve_slot_for_global): Remove.
2118 (Output_data_got::reserve_global): New function.
2119 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2120 (all constructors, two instantiations).
2121 (Output_reloc::get_relobj): New function (two instantiations).
2122 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2123 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2124 (Output_data_reloc::add_global): Adjust type of relobj.
2125 (Output_data_reloc::add_global_relative): Likewise.
2126 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2127 (Output_data_reloc::add_local): Likewise.
2128 (Output_data_reloc::add_local_relative): Likewise.
2129 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2130 (Output_data_reloc::add_local_section): Likewise.
2131 (Output_data_reloc::add_output_section): Likewise.
2132 (Output_data_reloc::add_absolute): Likewise.
2133 (Output_data_reloc::add_target_specific): Likewise.
2134 (Output_data_got::reserve_slot): Move definition here.
2135 (Output_data_got::reserve_local): New function.
2136 (Output_data_got::reserve_global): New function.
2137 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2138 section_offsets_ with accessor function.
2139 (Sized_relobj_file::write_sections): Likewise.
2140 (Sized_relobj_file::do_relocate_sections): Likewise.
2141 * target.h (Sized_target::reserve_local_got_entry): New function.
2142 (Sized_target::reserve_global_got_entry): New function.
2143 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2144 (Target_x86_64::reserve_global_got_entry): New function.
2145 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2146
2147 2011-05-23 Cary Coutant <ccoutant@google.com>
2148
2149 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2150 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2151 bit when checking got_type.
2152 * incremental.cc (Sized_incremental_binary::setup_readers):
2153 Store symbol table and string table locations; initialize bit vector
2154 of file status flags.
2155 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2156 unchanged files.
2157 (Sized_incremental_binary::do_process_got_plt): New function.
2158 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2159 (Output_section_incremental_inputs::set_final_data_size): Record
2160 file index for each input file.
2161 (Output_section_incremental_inputs::write_got_plt): Store file index
2162 instead of input entry offset for each GOT entry.
2163 * incremental.h
2164 (Incremental_input_entry::Incremental_input_entry): Initialize new
2165 data member.
2166 (Incremental_input_entry::set_offset): Store file index.
2167 (Incremental_input_entry::get_file_index): New function.
2168 (Incremental_input_entry::file_index_): New data member.
2169 (Incremental_binary::process_got_plt): New function.
2170 (Incremental_binary::do_process_got_plt): New function.
2171 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2172 data members.
2173 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2174 (Sized_incremental_binary::set_file_is_unchanged): New function.
2175 (Sized_incremental_binary::file_is_unchanged): New function.
2176 (Sized_incremental_binary::do_process_got_plt): New function.
2177 (Sized_incremental_binary::file_status_): New data member.
2178 (Sized_incremental_binary::main_symtab_loc_): New data member.
2179 (Sized_incremental_binary::main_strtab_loc_): New data member.
2180 * output.cc (Output_data_got::Got_entry::write): Add case
2181 RESERVED_CODE.
2182 (Output_data_got::add_global): Call add_got_entry.
2183 (Output_data_got::add_global_plt): Likewise.
2184 (Output_data_got::add_global_with_rel): Likewise.
2185 (Output_data_got::add_global_with_rela): Likewise.
2186 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2187 (Output_data_got::add_global_pair_with_rela): Likewise.
2188 (Output_data_got::add_local): Call add_got_entry.
2189 (Output_data_got::add_local_plt): Likewise.
2190 (Output_data_got::add_local_with_rel): Likewise.
2191 (Output_data_got::add_local_with_rela): Likewise.
2192 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2193 (Output_data_got::add_local_pair_with_rela): Likewise.
2194 (Output_data_got::reserve_slot): New function.
2195 (Output_data_got::reserve_slot_for_global): New function.
2196 (Output_data_got::add_got_entry): New function.
2197 (Output_data_got::add_got_entry_pair): New function.
2198 (Output_section::add_output_section_data): Edit FIXME.
2199 * output.h
2200 (Output_section_data_build::Output_section_data_build): New
2201 constructor with size parameter.
2202 (Output_data_space::Output_data_space): Likewise.
2203 (Output_data_got::Output_data_got): Initialize new data member; new
2204 constructor with size parameter.
2205 (Output_data_got::add_constant): Call add_got_entry.
2206 (Output_data_got::reserve_slot): New function.
2207 (Output_data_got::reserve_slot_for_global): New function.
2208 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2209 (Output_data_got::add_got_entry): New function.
2210 (Output_data_got::add_got_entry_pair): New function.
2211 (Output_data_got::free_list_): New data member.
2212 * target.h (Sized_target::init_got_plt_for_update): New function.
2213 (Sized_target::register_global_plt_entry): New function.
2214 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2215 Initialize new data member; call init; add constructor with PLT count.
2216 (Output_data_plt_x86_64::init): New function.
2217 (Output_data_plt_x86_64::add_relocation): New function.
2218 (Output_data_plt_x86_64::reserve_slot): New function.
2219 (Output_data_plt_x86_64::free_list_): New data member.
2220 (Target_x86_64::init_got_plt_for_update): New function.
2221 (Target_x86_64::register_global_plt_entry): New function.
2222 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2223 incremental updates.
2224 (Output_data_plt_x86_64::add_relocation): New function.
2225 * testsuite/object_unittest.cc (Object_test): Set default options.
2226
2227 2011-05-16 Ian Lance Taylor <iant@google.com>
2228
2229 * options.h (class General_options): Make -i a synonym for -r.
2230
2231 2011-05-16 Ian Lance Taylor <iant@google.com>
2232
2233 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2234
2235 2011-05-10 Cary Coutant <ccoutant@google.com>
2236
2237 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2238 strip_all (-s).
2239
2240 2011-05-06 Ian Lance Taylor <iant@google.com>
2241
2242 * layout.cc (Layout::layout): If the output section flags change,
2243 update the ordering.
2244
2245 2011-04-25 Cary Coutant <ccoutant@google.com>
2246
2247 * incremental-dump.cc (dump_incremental_inputs): Print local
2248 symbol info for each input file.
2249 * incremental.cc
2250 (Output_section_incremental_inputs::set_final_data_size): Add local
2251 symbol info to input file entries in incremental info.
2252 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2253 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2254 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2255 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2256 implementation.
2257 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2258 (Sized_incr_relobj::do_relocate): Write the local symbols.
2259 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2260 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2261 Adjust size of input file header.
2262 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2263 (Incremental_inputs_reader::get_local_symbol_count): New function.
2264 (Incremental_inputs_reader::get_input_section): Adjust size of input
2265 file header.
2266 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2267 (Sized_incr_relobj::This): New typedef.
2268 (Sized_incr_relobj::sym_size): New const data member.
2269 (Sized_incr_relobj::Local_symbol): New struct.
2270 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2271 (Sized_incr_relobj::do_local_symbol_offset): New function.
2272 (Sized_incr_relobj::local_symbol_count_): New data member.
2273 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2274 (Sized_incr_relobj::local_symbol_index_): New data member.
2275 (Sized_incr_relobj::local_symbol_offset_): New data member.
2276 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2277 (Sized_incr_relobj::local_symbols_): New data member.
2278 * object.h (Relobj::output_local_symbol_count): New function.
2279 (Relobj::local_symbol_offset): New function.
2280 (Relobj::do_output_local_symbol_count): New function.
2281 (Relobj::do_local_symbol_offset): New function.
2282 (Sized_relobj::do_output_local_symbol_count): New function.
2283 (Sized_relobj::do_local_symbol_offset): New function.
2284
2285 2011-04-22 Vladimir Simonov <sv@sw.ru>
2286
2287 * descriptors.cc (set_close_on_exec): New function.
2288 (Descriptors::open): Use set_close_on_exec.
2289 * output.cc (S_ISLNK): Define if not defined.
2290
2291 2011-04-22 Cary Coutant <ccoutant@google.com>
2292
2293 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2294 global symbol map.
2295 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2296 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2297 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2298 relocations.
2299 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2300 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2301 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2302 * incremental.h
2303 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2304 function.
2305 (Incremental_binary::apply_incremental_relocs): New function.
2306 (Incremental_binary::do_apply_incremental_relocs): New function.
2307 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2308 data member.
2309 (Sized_incremental_binary::add_global_symbol): New function.
2310 (Sized_incremental_binary::global_symbol): New function.
2311 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2312 (Sized_incremental_binary::symbol_map_): New data member.
2313 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2314 * target.h (Sized_target::apply_relocation): New function.
2315 * target-reloc.h (apply_relocation): New function.
2316 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2317
2318 2011-04-22 Doug Kwan <dougkwan@google.com>
2319
2320 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2321 flag of a SHT_ARM_EXIDX section.
2322 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2323 * testsuite/Makefile.in: Regenerate.
2324 * testsuite/arm_exidx_test.s: New file.
2325 * testsuite/arm_exidx_test.sh: Same.
2326
2327 2011-04-20 Cary Coutant <ccoutant@google.com>
2328
2329 PR gold/12689
2330 * archive.h (Incremental_archive_entry::Archive_member):
2331 Initialize arg_serial_ (second constructor).
2332
2333 2011-04-17 Ian Lance Taylor <iant@google.com>
2334
2335 * object.cc (Relocate_info::location): Simplify location string.
2336 * errors.cc (Errors::error_at_location): Don't print program
2337 name.
2338 (Errors::warning_at_location): Likewise.
2339 (Errors::undefined_symbol): Likewise.
2340 * testsuite/debug_msg.sh: Update accordingly.
2341
2342 2011-04-14 Cary Coutant <ccoutant@google.com>
2343
2344 * gold/layout.cc (Layout::symtab_section_offset): New function.
2345 * gold/layout.h (Layout::symtab_section_offset): New function.
2346 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2347
2348 2011-04-12 Ian Lance Taylor <iant@google.com>
2349
2350 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2351 with MREMAP_MAYMOVE.
2352 * output.h (class Output_file): Add map_is_allocated_ field.
2353 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2354 not available, provide stubs. If mremap is not available, #define
2355 it to gold_mremap.
2356 (MREMAP_MAYMOVE): Define if not defined.
2357 (Output_file::Output_file): Initialize map_is_allocated_.
2358 (Output_file::resize): Check map_is_allocated_.
2359 (Output_file::map_anonymous): If mmap fails, use malloc.
2360 (Output_file::unmap): Don't do anything for an anonymous map.
2361 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2362 is not available, provide stubs.
2363 (File_read::View::~View): Use free rather than delete[].
2364 (File_read::make_view): Use malloc rather than new[]. If mmap
2365 fails, use malloc.
2366 (File_read::find_or_make_view): Use malloc rather than new[].
2367 * gold.h: Remove HAVE_REMAP code.
2368 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2369 exists. Rename mremap to gold_mremap. If mmap is not available
2370 don't do anything.
2371 * configure, config.in: Rebuild.
2372
2373 2011-04-11 Ian Lance Taylor <iant@google.com>
2374
2375 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2376 initialize local variable v.
2377
2378 2011-04-11 Cary Coutant <ccoutant@google.com>
2379
2380 * archive.cc (Archive::include_member): Adjust call to
2381 report_object.
2382 (Add_archive_symbols::run): Track argument serial numbers.
2383 (Lib_group::include_member): Likewise.
2384 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2385 * archive.h (Incremental_archive_entry::Archive_member):
2386 Initialize arg_serial_.
2387 (Archive_member::arg_serial_): New data member.
2388 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2389 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2390 incremental link.
2391 (Sized_dynobj::do_for_all_local_got_entries): New function.
2392 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2393 function.
2394 * fileread.cc (get_mtime): New function.
2395 * fileread.h (get_mtime): New function.
2396 * gold.cc (queue_initial_tasks): Check for incremental update.
2397 (process_incremental_input): New function.
2398 (queue_middle_tasks): Don't force valid target for incremental
2399 update.
2400 * incremental-dump.cc (find_input_containing_global): Adjust
2401 size of symbol info entry.
2402 (dump_incremental_inputs): Dump argument serial number and
2403 in_system_directory flag; bias shndx by 1; print symbol names
2404 when dumping per-file symbol lists; use new symbol info readers.
2405 * incremental.cc
2406 (Output_section_incremental_inputs:update_data_size): New function.
2407 (Sized_incremental_binary::setup_readers): Setup input readers
2408 for each input file; build maps for files added from libraries
2409 and scripts.
2410 (Sized_incremental_binary::check_input_args): New function.
2411 (Sized_incremental_binary::do_check_inputs): Build map of argument
2412 serial numbers to input arguments.
2413 (Sized_incremental_binary::do_file_has_changed): Rename
2414 do_file_is_unchanged to this; compare file modification times.
2415 (Sized_incremental_binary::do_init_layout): New function.
2416 (Sized_incremental_binary::do_reserve_layout): New function.
2417 (Sized_incremental_binary::do_get_input_reader): Remove.
2418 (Sized_incremental_binary::get_symtab_view): New function.
2419 (Incremental_checker::can_incrementally_link_output_file): Remove.
2420 (Incremental_inputs::report_command_line): Exclude --debug options.
2421 (Incremental_inputs::report_archive_begin): Add parameter; track
2422 argument serial numbers; don't put input file entry for archive
2423 before archive members.
2424 (Incremental_inputs::report_archive_end): Put input file entry
2425 for archive after archive members.
2426 (Incremental_inputs::report_object): Add parameter; track argument
2427 serial numbers and in_system_directory flag.
2428 (Incremental_inputs::report_script): Add parameter; track argument
2429 serial numbers.
2430 (Output_section_incremental_inputs::set_final_data_size): Adjust
2431 size of symbol info entry; check for forwarding symbols.
2432 (Output_section_incremental_inputs::write_input_files): Write
2433 in_system_directory flag and argument serial number.
2434 (Output_section_incremental_inputs::write_info_blocks): Map section
2435 indices between incremental info and original input file; store
2436 input section index for each symbol.
2437 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2438 change operator() to visit().
2439 (class Global_got_offset_visitor): Likewise.
2440 (class Global_symbol_visitor_got_plt):
2441 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2442 classes.
2443 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2444 (Sized_incr_relobj::do_read_symbols): New function.
2445 (Sized_incr_relobj::do_layout): New function.
2446 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2447 (Sized_incr_relobj::do_add_symbols): New function.
2448 (Sized_incr_relobj::do_should_include_member): New function.
2449 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2450 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2451 (Sized_incr_relobj::do_section_size): New function.
2452 (Sized_incr_relobj::do_section_name): New function.
2453 (Sized_incr_relobj::do_section_contents): New function.
2454 (Sized_incr_relobj::do_section_flags): New function.
2455 (Sized_incr_relobj::do_section_entsize): New function.
2456 (Sized_incr_relobj::do_section_address): New function.
2457 (Sized_incr_relobj::do_section_type): New function.
2458 (Sized_incr_relobj::do_section_link): New function.
2459 (Sized_incr_relobj::do_section_info): New function.
2460 (Sized_incr_relobj::do_section_addralign): New function.
2461 (Sized_incr_relobj::do_initialize_xindex): New function.
2462 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2463 (Sized_incr_relobj::do_read_relocs): New function.
2464 (Sized_incr_relobj::do_gc_process_relocs): New function.
2465 (Sized_incr_relobj::do_scan_relocs): New function.
2466 (Sized_incr_relobj::do_count_local_symbols): New function.
2467 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2468 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2469 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2470 (Sized_incr_relobj::do_relocate): New function.
2471 (Sized_incr_relobj::do_set_section_offset): New function.
2472 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2473 (Sized_incr_dynobj::do_read_symbols): New function.
2474 (Sized_incr_dynobj::do_layout): New function.
2475 (Sized_incr_dynobj::do_add_symbols): New function.
2476 (Sized_incr_dynobj::do_should_include_member): New function.
2477 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2478 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2479 (Sized_incr_dynobj::do_section_size): New function.
2480 (Sized_incr_dynobj::do_section_name): New function.
2481 (Sized_incr_dynobj::do_section_contents): New function.
2482 (Sized_incr_dynobj::do_section_flags): New function.
2483 (Sized_incr_dynobj::do_section_entsize): New function.
2484 (Sized_incr_dynobj::do_section_address): New function.
2485 (Sized_incr_dynobj::do_section_type): New function.
2486 (Sized_incr_dynobj::do_section_link): New function.
2487 (Sized_incr_dynobj::do_section_info): New function.
2488 (Sized_incr_dynobj::do_section_addralign): New function.
2489 (Sized_incr_dynobj::do_initialize_xindex): New function.
2490 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2491 (make_sized_incremental_object): New function.
2492 (Incremental_library::copy_unused_symbols): New function.
2493 (Incremental_library::do_for_all_unused_symbols): New function.
2494 * incremental.h (enum Incremental_input_flags): New type.
2495 (class Incremental_checker): Remove.
2496 (Incremental_input_entry::Incremental_input_entry): Add argument
2497 serial number.
2498 (Incremental_input_entry::arg_serial): New function.
2499 (Incremental_input_entry::set_is_in_system_directory): New function.
2500 (Incremental_input_entry::is_in_system_directory): New function.
2501 (Incremental_input_entry::arg_serial_): New data member.
2502 (Incremental_input_entry::is_in_system_directory_): New data member.
2503 (class Script_info): Move here from script.h.
2504 (Script_info::Script_info): Add filename parameter.
2505 (Script_info::filename): New function.
2506 (Script_info::filename_): New data member.
2507 (Incremental_script_entry::Incremental_script_entry): Add argument
2508 serial number.
2509 (Incremental_object_entry::Incremental_object_entry): Likewise.
2510 (Incremental_object_entry::add_input_section): Build list of input
2511 sections with map to original shndx.
2512 (Incremental_object_entry::get_input_section_index): New function.
2513 (Incremental_object_entry::shndx_): New data member.
2514 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2515 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2516 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2517 serial number.
2518 (Incremental_inputs::report_archive_begin): Likewise.
2519 (Incremental_inputs::report_object): Likewise.
2520 (Incremental_inputs::report_script): Likewise.
2521 (class Incremental_global_symbol_reader): New class.
2522 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2523 and store flags and input file type.
2524 (Incremental_input_entry_reader::arg_serial): New function.
2525 (Incremental_input_entry_reader::type): Extract type from flags.
2526 (Incremental_input_entry_reader::is_in_system_directory): New function.
2527 (Incremental_input_entry_reader::get_input_section_count): Call
2528 accessor function for type.
2529 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2530 function for type; adjust size of global symbol entry.
2531 (Incremental_input_entry_reader::get_global_symbol_count): Call
2532 accessor function for type.
2533 (Incremental_input_entry_reader::get_object_count): Likewise.
2534 (Incremental_input_entry_reader::get_object_offset): Likewise.
2535 (Incremental_input_entry_reader::get_member_count): Likewise.
2536 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2537 (Incremental_input_entry_reader::get_member_offset): Likewise.
2538 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2539 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2540 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2541 (Incremental_input_entry_reader::get_global_symbol_reader): New
2542 function.
2543 (Incremental_input_entry_reader::get_output_symbol_index): New
2544 function.
2545 (Incremental_input_entry_reader::type_): Remove.
2546 (Incremental_input_entry_reader::flags_): New data member.
2547 (Incremental_inputs_reader::input_file_offset): New function.
2548 (Incremental_inputs_reader::input_file_index): New function.
2549 (Incremental_inputs_reader::input_file): Call input_file_offset.
2550 (Incremental_inputs_reader::input_file_at_offset): New function.
2551 (Incremental_relocs_reader::get_r_type): Reformat.
2552 (Incremental_relocs_reader::get_r_shndx): Reformat.
2553 (Incremental_relocs_reader::get_r_offset): Reformat.
2554 (Incremental_relocs_reader::data): New function.
2555 (Incremental_binary::Incremental_binary): Initialize new data members.
2556 (Incremental_binary::check_inputs): Add cmdline parameter.
2557 (Incremental_binary::file_is_unchanged): Remove.
2558 (Input_reader::arg_serial): New function.
2559 (Input_reader::get_unused_symbol_count): New function.
2560 (Input_reader::get_unused_symbol): New function.
2561 (Input_reader::do_arg_serial): New function.
2562 (Input_reader::do_get_unused_symbol_count): New function.
2563 (Input_reader::do_get_unused_symbol): New function.
2564 (Incremental_binary::input_file_count): New function.
2565 (Incremental_binary::get_input_reader): Change signature to use
2566 index instead of filename.
2567 (Incremental_binary::file_has_changed): New function.
2568 (Incremental_binary::get_input_argument): New function.
2569 (Incremental_binary::get_library): New function.
2570 (Incremental_binary::get_script_info): New function.
2571 (Incremental_binary::init_layout): New function.
2572 (Incremental_binary::reserve_layout): New function.
2573 (Incremental_binary::output_file): New function.
2574 (Incremental_binary::do_check_inputs): New function.
2575 (Incremental_binary::do_file_is_unchanged): Remove.
2576 (Incremental_binary::do_file_has_changed): New function.
2577 (Incremental_binary::do_init_layout): New function.
2578 (Incremental_binary::do_reserve_layout): New function.
2579 (Incremental_binary::do_input_file_count): New function.
2580 (Incremental_binary::do_get_input_reader): Change signature.
2581 (Incremental_binary::input_args_map_): New data member.
2582 (Incremental_binary::library_map_): New data member.
2583 (Incremental_binary::script_map_): New data member.
2584 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2585 new data members.
2586 (Sized_incremental_binary::output_section): New function.
2587 (Sized_incremental_binary::inputs_reader): Add const.
2588 (Sized_incremental_binary::symtab_reader): Add const.
2589 (Sized_incremental_binary::relocs_reader): Add const.
2590 (Sized_incremental_binary::got_plt_reader): Add const.
2591 (Sized_incremental_binary::get_symtab_view): New function.
2592 (Sized_incremental_binary::Inputs_reader): New typedef.
2593 (Sized_incremental_binary::Input_entry_reader): New typedef.
2594 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2595 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2596 (Sized_incremental_binary::do_file_has_changed): New function.
2597 (Sized_incremental_binary::do_init_layout): New function.
2598 (Sized_incremental_binary::do_reserve_layout): New function.
2599 (Sized_input_reader::Inputs_reader): Remove.
2600 (Sized_input_reader::Input_entry_reader): Remove.
2601 (Sized_input_reader::do_arg_serial): New function.
2602 (Sized_input_reader::do_get_unused_symbol_count): New function.
2603 (Sized_input_reader::do_get_unused_symbol): New function.
2604 (Sized_incremental_binary::do_input_file_count): New function.
2605 (Sized_incremental_binary::do_get_input_reader): Change signature;
2606 use index instead of filename.
2607 (Sized_incremental_binary::section_map_): New data member.
2608 (Sized_incremental_binary::input_entry_readers_): New data member.
2609 (class Sized_incr_relobj): New class.
2610 (class Sized_incr_dynobj): New class.
2611 (make_sized_incremental_object): New function.
2612 (class Incremental_library): New class.
2613 * layout.cc (Free_list::num_lists): New static data member.
2614 (Free_list::num_nodes): New static data member.
2615 (Free_list::num_removes): New static data member.
2616 (Free_list::num_remove_visits): New static data member.
2617 (Free_list::num_allocates): New static data member.
2618 (Free_list::num_allocate_visits): New static data member.
2619 (Free_list::init): New function.
2620 (Free_list::remove): New function.
2621 (Free_list::allocate): New function.
2622 (Free_list::dump): New function.
2623 (Free_list::print_stats): New function.
2624 (Layout_task_runner::run): Resize output file for incremental updates.
2625 (Layout::Layout): Initialize new data members.
2626 (Layout::set_incremental_base): New function.
2627 (Layout::init_fixed_output_section): New function.
2628 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2629 incremental updates.
2630 (Layout::create_gold_note): Do not create gold note section for
2631 incremental updates.
2632 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2633 for incremental updates.
2634 (Layout::set_section_offsets): For incremental updates, allocate space
2635 from free list.
2636 (Layout::create_symtab_sections): Layout with offsets relative to
2637 start of section; for incremental updates, allocate space from free
2638 list.
2639 (Layout::create_shdrs): For incremental updates, allocate space from
2640 free list.
2641 (Layout::finish_dynamic_section): For incremental updates, do not
2642 check --as-needed (fixed in subsequent patch).
2643 * layout.h (class Free_list): New class.
2644 (Layout::set_incremental_base): New function.
2645 (Layout::incremental_base): New function.
2646 (Layout::init_fixed_output_section): New function.
2647 (Layout::allocate): New function.
2648 (Layout::incremental_base_): New data member.
2649 (Layout::free_list_): New data member.
2650 * main.cc (main): Print Free_list statistics.
2651 * object.cc (Relobj::finalize_incremental_relocs): Add
2652 clear_counts parameter; clear counts only when clear_counts is set.
2653 (Sized_relobj::Sized_relobj): Initialize new base class.
2654 (Sized_relobj::do_layout): Don't report special sections.
2655 (Sized_relobj::do_for_all_local_got_entries): New function.
2656 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2657 symtab_off to all symbol table offsets.
2658 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2659 * object.h (class Got_offset_list): Move to top of file.
2660 (Object::Object): Allow case where input_file == NULL.
2661 (Object::~Object): Likewise.
2662 (Object::input_file): Assert that input_file != NULL.
2663 (Object::lock): Allow case where input_file == NULL.
2664 (Object::unlock): Likewise.
2665 (Object::is_locked): Likewise.
2666 (Object::token): Likewise.
2667 (Object::release): Likewise.
2668 (Object::is_incremental): New function.
2669 (Object::get_mtime): New function.
2670 (Object::for_all_local_got_entries): New function.
2671 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2672 (Object::set_is_in_system_directory): New function.
2673 (Object::is_in_system_directory): New function.
2674 (Object::do_is_incremental): New function.
2675 (Object::do_get_mtime): New function.
2676 (Object::do_for_all_local_got_entries): New function.
2677 (Object::is_in_system_directory_): New data member.
2678 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2679 (class Sized_relobj_base): New class.
2680 (class Sized_relobj): Derive from Sized_relobj_base.
2681 (class Sized_relobj::Symbols): Redeclare from base class.
2682 (class Sized_relobj::local_got_offset_list): Remove.
2683 (class Sized_relobj::Output_sections): Redeclare from base class.
2684 (class Sized_relobj::do_for_all_local_got_entries): New function.
2685 (class Sized_relobj::write_local_symbols): Add offset parameter.
2686 (class Sized_relobj::local_symbol_offset_): Update comment.
2687 (class Sized_relobj::local_dynsym_offset_): Update comment.
2688 * options.cc (Input_arguments::add_file): Remove const.
2689 * options.h (Input_file_argument::Input_file_argument):
2690 Initialize arg_serial_ (all constructors).
2691 (Input_file_argument::set_arg_serial): New function.
2692 (Input_file_argument::arg_serial): New function.
2693 (Input_file_argument::arg_serial_): New data member.
2694 (Input_arguments::Input_arguments): Initialize file_count_.
2695 (Input_arguments::add_file): Remove const.
2696 (Input_arguments::number_of_input_files): New function.
2697 (Input_arguments::file_count_): New data member.
2698 (Command_line::number_of_input_files): Call
2699 Input_arguments::number_of_input_files.
2700 * output.cc (Output_segment_headers::Output_segment_headers):
2701 Set current size.
2702 (Output_section::Input_section::current_data_size): New function.
2703 (Output_section::Output_section): Initialize new data members.
2704 (Output_section::add_input_section): Don't do merge sections for
2705 an incremental link; allocate space from free list for an
2706 incremental update.
2707 (Output_section::add_output_section_data): Allocate space from
2708 free list for an incremental update.
2709 (Output_section::update_data_size): New function.
2710 (Output_section::set_fixed_layout): New function.
2711 (Output_section::reserve): New function.
2712 (Output_segment::set_section_addresses): Remove const.
2713 (Output_segment::set_section_list_addresses): Remove const; allocate
2714 space from free list for an incremental update.
2715 (Output_segment::set_offset): Adjust size of RELRO segment for an
2716 incremental update.
2717 * output.h (Output_data::current_data_size): Move here from
2718 child classes.
2719 (Output_data::pre_finalize_data_size): New function.
2720 (Output_data::update_data_size): New function.
2721 (Output_section_headers::update_data_size): new function.
2722 (Output_section_data_build::current_data_size): Move to Output_data.
2723 (Output_data_strtab::update_data_size): New function.
2724 (Output_section::current_data_size): Move to Output_data.
2725 (Output_section::set_fixed_layout): New function.
2726 (Output_section::has_fixed_layout): New function.
2727 (Output_section::reserve): New function.
2728 (Output_section::update_data_size): New function.
2729 (Output_section::has_fixed_layout_): New data member.
2730 (Output_section::free_list_): New data member.
2731 (Output_segment::set_section_addresses): Remove const.
2732 (Output_segment::set_section_list_addresses): Remove const.
2733 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2734 New function.
2735 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2736 New function.
2737 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2738 parameter when calling Add_symbols constructor; store argument
2739 serial number for members of a lib group.
2740 (Add_symbols::locks): Allow case where token == NULL.
2741 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2742 (Read_member::~Read_member): New function.
2743 (Read_member::is_runnable): New function.
2744 (Read_member::locks): New function.
2745 (Read_member::run): New function.
2746 (Check_script::~Check_script): New function.
2747 (Check_script::is_runnable): New function.
2748 (Check_script::locks): New function.
2749 (Check_script::run): New function.
2750 (Check_library::~Check_library): New function.
2751 (Check_library::is_runnable): New function.
2752 (Check_library::locks): New function.
2753 (Check_library::run): New function.
2754 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2755 (Add_symbols::library_): New data member.
2756 (class Read_member): New class.
2757 (class Check_script): New class.
2758 (class Check_library): New class.
2759 * reloc.cc (Read_relocs::is_runnable): Allow case where
2760 token == NULL.
2761 (Read_relocs::locks): Likewise.
2762 (Scan_relocs::locks): Likewise.
2763 (Relocate_task::locks): Likewise.
2764 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2765 to clear counters.
2766 (Sized_relobj::incremental_relocs_scan): Fix comment.
2767 (Sized_relobj::do_relocate): Pass output file offset to
2768 write_local_symbols.
2769 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2770 from class declaration.
2771 * script.cc (read_input_script): Allocate Script_info; pass
2772 argument serial number to report_script.
2773 * script.h (class Script_info): Move to incremental.h.
2774 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2775 * symtab.h (Symbol_table::add_from_incrobj): New function.
2776 (Symbol_table::set_file_offset): New function.
2777
2778 2011-04-05 Cary Coutant <ccoutant@google.com>
2779
2780 * incremental-dump.cc (dump_incremental_inputs): Change signature
2781 to take a Sized_incremental_binary; change caller. Use readers
2782 in Sized_incremental_binary.
2783 * incremental.cc
2784 (Sized_incremental_binary::find_incremental_inputs_sections):
2785 Rename do_find_incremental_inputs_sections to this.
2786 (Sized_incremental_binary::setup_readers): New function.
2787 (Sized_incremental_binary::do_check_inputs): Check
2788 has_incremental_info_ flag; move setup code to setup_readers;
2789 use input readers.
2790 (Sized_incremental_binary::do_file_is_unchanged): New function.
2791 (Sized_incremental_binary::do_get_input_reader): New function.
2792 * incremental.h (class Incremental_binary): Move to end of file.
2793 (Incremental_binary::file_is_unchanged): New function.
2794 (Incremental_binary::do_file_is_unchanged): New function.
2795 (Incremental_binary::Input_reader): New class.
2796 (Incremental_binary::get_input_reader): New function.
2797 (class Sized_incremental_binary): Move to end of file.
2798 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2799 input section reader classes.
2800 (Sized_incremental_binary::has_incremental_info): New function.
2801 (Sized_incremental_binary::inputs_reader): New function.
2802 (Sized_incremental_binary::symtab_reader): New function.
2803 (Sized_incremental_binary::relocs_reader): New function.
2804 (Sized_incremental_binary::got_plt_reader): New function.
2805 (Sized_incremental_binary::do_file_is_unchanged): New function.
2806 (Sized_incremental_binary::Sized_input_reader): New class.
2807 (Sized_incremental_binary::get_input_reader): New function.
2808 (Sized_incremental_binary::find_incremental_inputs_sections):
2809 Rename do_find_incremental_inputs_sections to this.
2810 (Sized_incremental_binary::setup_readers): New function.
2811 (Sized_incremental_binary::has_incremental_info_): New data member.
2812 (Sized_incremental_binary::inputs_reader_): New data member.
2813 (Sized_incremental_binary::symtab_reader_): New data member.
2814 (Sized_incremental_binary::relocs_reader_): New data member.
2815 (Sized_incremental_binary::got_plt_reader_): New data member.
2816 (Sized_incremental_binary::current_input_file_): New data member.
2817
2818 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2819
2820 PR gold/12640
2821 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2822 violation.
2823
2824 2011-03-30 Cary Coutant <ccoutant@google.com>
2825
2826 * archive.cc (Archive::include_member): Adjust call to report_object.
2827 (Add_archive_symbols::run): Add script_info to call to
2828 report_archive_begin.
2829 (Lib_group::include_member): Adjust call to report_object.
2830 (Add_lib_group_symbols::run): Adjust call to report_object.
2831 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2832 blocks. Add object count for script input files.
2833 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2834 script_info parameter; change all callers.
2835 (Incremental_inputs::report_object): Add script_info parameter;
2836 change all callers.
2837 (Incremental_inputs::report_script): Store backpointer to
2838 incremental info entry.
2839 (Output_section_incremental_inputs::set_final_data_size): Record
2840 additional information for scripts.
2841 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2842 * incremental.h (Incremental_script_entry::add_object): New function.
2843 (Incremental_script_entry::get_object_count): New function.
2844 (Incremental_script_entry::get_object): New function.
2845 (Incremental_script_entry::objects_): New data member; adjust
2846 constructor.
2847 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2848 (Incremental_inputs::report_object): Add script_info parameter.
2849 (Incremental_inputs_reader::get_object_count): New function.
2850 (Incremental_inputs_reader::get_object_offset): New function.
2851 * options.cc (Input_arguments::add_file): Return reference to
2852 new input argument.
2853 * options.h (Input_argument::set_script_info): New function.
2854 (Input_argument::script_info): New function.
2855 (Input_argument::script_info_): New data member; adjust all
2856 constructors.
2857 (Input_file_group::add_file): Return reference to new input argument.
2858 (Input_file_lib::add_file): Likewise.
2859 (Input_arguments::add_file): Likewise.
2860 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2861 * script.cc (Parser_closure::Parser_closure): Add script_info
2862 parameter; adjust all callers.
2863 (Parser_closure::script_info): New function.
2864 (Parser_closure::script_info_): New data member.
2865 (read_input_script): Report scripts earlier to incremental info.
2866 (script_add_file): Set script_info in Input_argument.
2867 (script_add_library): Likewise.
2868 * script.h (Script_options::Script_info): Rewrite class.
2869
2870 2011-03-29 Cary Coutant <ccoutant@google.com>
2871
2872 * archive.cc (Library_base::should_include_member): Move
2873 method here from class Archive.
2874 (Archive::Archive): Initialize base class.
2875 (Archive::should_include_member): Move to base class.
2876 (Archive::do_for_all_unused_symbols): New function.
2877 (Add_archive_symbols::run): Remove redundant access to
2878 incremental_inputs.
2879 (Lib_group::Lib_group): Initialize base class.
2880 (Lib_group::do_filename): New function.
2881 (Lib_group::include_member): Pass pointer to Lib_group to
2882 report_object.
2883 (Lib_group::do_for_all_unused_symbols): New function.
2884 (Add_lib_group_symbols::run): Report archive information for
2885 incremental links.
2886 * archive.h (class Library_base): New base class.
2887 (class Archive): Derive from Library_base.
2888 (Archive::filename): Move to base class.
2889 (Archive::set_incremental_info): Likewise.
2890 (Archive::incremental_info): Likewise.
2891 (Archive::Should_include): Likewise.
2892 (Archive::should_include_member): Likewise.
2893 (Archive::Armap_entry): Remove.
2894 (Archive::Unused_symbol_iterator): Remove.
2895 (Archive::unused_symbols_begin): Remove.
2896 (Archive::unused_symbols_end): Remove.
2897 (Archive::do_filename): New function.
2898 (Archive::do_get_mtime): New function.
2899 (Archive::do_for_all_unused_symbols): New function.
2900 (Archive::task_): Move to base class.
2901 (Archive::incremental_info_): Likewise.
2902 (class Lib_group): Derive from Library_base.
2903 (Lib_group::do_filename): New function.
2904 (Lib_group::do_get_mtime): New function.
2905 (Lib_group::do_for_all_unused_symbols): New function.
2906 (Lib_group::task_): Move to base class.
2907 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2908 function.
2909 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2910 function.
2911 * incremental.cc (Incremental_inputs::report_archive_begin):
2912 Use Library_base; call library's get_mtime; add incremental inputs
2913 entry before members.
2914 (class Unused_symbol_visitor): New class.
2915 (Incremental_inputs::report_archive_end): Use Library_base; use
2916 visitor class to record unused symbols; don't add incremental inputs
2917 entry after members.
2918 (Incremental_inputs::report_object): Use Library_base.
2919 * incremental.h
2920 (Incremental_archive_entry::Incremental_archive_entry): Remove
2921 unused Archive parameter.
2922 (Incremental_inputs::report_archive_begin): Use Library_base.
2923 (Incremental_inputs::report_archive_end): Likewise.
2924 (Incremental_inputs::report_object): Likewise.
2925 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2926 function.
2927 * object.h (Object::for_all_global_symbols): New function.
2928 (Object::do_for_all_global_symbols): New function.
2929 (Sized_relobj::do_for_all_global_symbols): New function.
2930 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2931 function.
2932 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2933 function.
2934
2935 2011-03-27 Ian Lance Taylor <iant@google.com>
2936
2937 * archive.cc (Archive::interpret_header): Return -1 if something
2938 goes wrong. Change callers accordingly.
2939
2940 2011-03-25 Cary Coutant <ccoutant@google.com>
2941
2942 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2943 * testsuite/Makefile.in: Regenerate.
2944
2945 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2946
2947 * plugin.cc (get_view): New.
2948 (Plugin::load): Pass get_view to the plugin.
2949 (Plugin_manager::get_view): New.
2950
2951 2011-03-21 Ian Lance Taylor <iant@google.com>
2952
2953 * testsuite/final_layout.sh: Rewrite to not use dc.
2954 * testsuite/relro_test.sh: Fail if dc is not present.
2955
2956 2011-03-21 Sriraman Tallam <tmsriram@google.com>
2957
2958 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2959 Change == to -eq.
2960 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2961 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2962 Change == to -eq.
2963 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2964 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2965
2966 2011-03-14 Ian Lance Taylor <iant@google.com>
2967
2968 * script-sections.cc (Sort_output_sections::script_compare):
2969 Rename from is_before, change return type.
2970 (Sort_output_sections::operator()): Adjust accordingly.
2971
2972 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2973
2974 PR gold/12572
2975 * testsuite/odr_violation2.cc: Add comment to make all error line
2976 numbers double digits.
2977 * testsuite/debug_msg.sh: Adjust expected errors.
2978
2979 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2980
2981 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2982 but mark earlier ones as non-canonical
2983 (offset_to_iterator): Update search target and example
2984 (do_addr2line): Return extra lines in a vector*
2985 (format_file_lineno): Extract from do_addr2line
2986 (one_addr2line): Add vector* out-param
2987 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2988 when a lineno entry appeared last for its instruction
2989 (Dwarf_line_info): Add vector* out-param
2990 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2991 * symtab.cc (Odr_violation_compare): Include the lineno in the
2992 comparison again.
2993 (linenos_from_loc): New. Combine the canonical line for an
2994 address with its other lines.
2995 (True_if_intersect): New. Helper functor to make
2996 std::set_intersection a query.
2997 (detect_odr_violations): Compare sets of lines instead of just
2998 one line for each function. This became less deterministic, but
2999 has fewer false positives.
3000 * symtab.h: Declarations.
3001 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3002 mix an optimized and non-optimized object in the same binary
3003 (odr_violation2.so): Same.
3004 * testsuite/Makefile.in: Regenerate from Makefile.am.
3005 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3006 * testsuite/debug_msg.sh: Update line numbers and add
3007 assertions.
3008 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3009 non-optimized context.
3010 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3011 isn't inlined, and use OdrDerived in an optimized context.
3012 * testsuite/odr_header1.h: Defines OdrDerived, where
3013 optimization will change the
3014 first-instruction-in-the-destructor's file and line number.
3015 * testsuite/odr_header2.h: Defines OdrBase.
3016
3017 2011-03-09 Ian Lance Taylor <iant@google.com>
3018
3019 * fileread.cc (File_read::clear_views): Don't delete the whole
3020 file view.
3021
3022 2011-03-08 Ian Lance Taylor <iant@google.com>
3023
3024 PR gold/12525
3025 * fileread.cc: #include <climits>.
3026 (GOLD_IOV_MAX): Define.
3027 (File_read::read_multiple): Limit number of entries by iov_max.
3028 * fileread.h (class File_read): Always set max_readv_entries to
3029 128.
3030
3031 2011-03-07 Ian Lance Taylor <iant@google.com>
3032
3033 PR gold/12525
3034 * options.h (class General_options): Add -dy and -dn.
3035
3036 2011-03-02 Cary Coutant <ccoutant@google.com>
3037
3038 * testsuite/script_test_9.t: Add TLS segment.
3039
3040 2011-03-02 Simon Baldwin <simonb@google.com>
3041
3042 * configure.ac: Add check for gnu_indirect_function support in
3043 the toolchain building binutils.
3044 * configure: Rebuild.
3045
3046 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3047
3048 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3049 plugin only symbols.
3050 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3051 in plugin files as not needed in the symbol table.
3052
3053 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3054
3055 * output.cc (Output_section::add_input_section): Delay fill
3056 generation for section ordering.
3057
3058 2011-02-09 Ian Lance Taylor <iant@google.com>
3059
3060 PR gold/12316
3061 * object.h (class Sized_relobj): Remove clear_local_symbols.
3062 * reloc.cc (Sized_relobj::do_relocate): Don't call
3063 clear_local_symbols.
3064
3065 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3066
3067 * plugin.cc (is_visible_from_outside): Return true for symbols
3068 in the -u option.
3069
3070 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3071
3072 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3073 filename.
3074
3075 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3076
3077 * icf.h (is_section_foldable_candidate): Change type of parameter
3078 to std::string.
3079 * icf.cc (Icf::find_identical_sections): Change type of local variable
3080 section_name to be std::string.
3081 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3082
3083 2011-01-25 Ian Lance Taylor <iant@google.com>
3084
3085 * script.cc (script_add_extern): Rewrite to use
3086 add_symbol_reference.
3087
3088 2011-01-25 Doug Kwan <dougkwan@google.com>
3089
3090 * icf.cc (get_section_contents): Always lock section's object.
3091
3092 2011-01-24 Ian Lance Taylor <iant@google.com>
3093
3094 * options.h (class General_options): Accept
3095 --no-detect-odr-violations.
3096
3097 2011-01-24 Ian Lance Taylor <iant@google.com>
3098
3099 * version.cc (version_string): Bump to 1.11.
3100
3101 2011-01-24 Ian Lance Taylor <iant@google.com>
3102
3103 * plugin.cc (class Plugin_rescan): Define new class.
3104 (Plugin_manager::claim_file): Set any_claimed_.
3105 (Plugin_manager::save_archive): New function.
3106 (Plugin_manager::save_input_group): New function.
3107 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3108 necessary.
3109 (Plugin_manager::new_undefined_symbol): New function.
3110 (Plugin_manager::rescan): New function.
3111 (Plugin_manager::rescannable_defines): New function.
3112 (Plugin_manager::add_input_file): Set any_added_.
3113 * plugin.h (class Plugin_manager): define new fields rescannable_,
3114 undefined_symbols_, any_claimed_, and any_added_. Declare
3115 Plugin_rescan as friend. Declare new functions.
3116 (Plugin_manager::Rescannable): Define type.
3117 (Plugin_manager::Rescannable_list): Define type.
3118 (Plugin_manager::Undefined_symbol_list): Define type.
3119 (Plugin_manager::Plugin_manager): Initialize new fields.
3120 * archive.cc (Archive::defines_symbol): New function.
3121 (Add_archive_symbols::run): Pass archive to plugins if any.
3122 * archive.h (class Archive): Declare defines_symbol.
3123 * readsyms.cc (Input_group::~Input_group): New function.
3124 (Finish_group::run): Pass input_group to plugins if any.
3125 * readsyms.h (class Input_group): Declare destructor.
3126 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3127 any.
3128
3129 2011-01-10 Ian Lance Taylor <iant@google.com>
3130
3131 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3132 section as relro.
3133 (Layout::set_segment_offsets): Reset increase_relro before calling
3134 set_section_addresses a second time.
3135
3136 2011-01-04 Cary Coutant <ccoutant@google.com>
3137
3138 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3139 sections before NOBITS sections.
3140
3141 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3142
3143 * version.cc (print_version): Update copyright to 2011.
3144
3145 2010-12-23 Cary Coutant <ccoutant@google.com>
3146
3147 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3148 of OS to this->add. Add OD parameter to second form of the function.
3149
3150 2010-12-20 Ian Lance Taylor <iant@google.com>
3151
3152 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3153 second of two consecutive entries with same offset.
3154
3155 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3156
3157 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3158 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3159 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3160 to avoid unneeded links against $(LDADD).
3161 * testsuite/Makefile.in: Regenerate.
3162
3163 2010-12-15 Ian Lance Taylor <iant@google.com>
3164
3165 PR gold/12324
3166 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3167 for R_X86_64_32 and R_X86_64_PC32.
3168 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3169 ver_matching_def_pic.o.
3170 (ver_matching_def_pic.o): New target.
3171
3172 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3173
3174 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3175 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3176 Move definition before File_read::View member definitions.
3177 (File_read::View::~View): Initialize and hold lock before
3178 updating current_mapped_bytes.
3179
3180 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3181
3182 * dwarf_reader.cc: Remove outdated comment.
3183 * gold-threads.cc: Fix typo in error message.
3184 * archive.cc: Fix typos in comments.
3185 * archive.h: Likewise.
3186 * arm-reloc-property.cc: Likewise.
3187 * arm-reloc-property.h: Likewise.
3188 * arm-reloc.def: Likewise.
3189 * arm.cc: Likewise.
3190 * attributes.h: Likewise.
3191 * cref.cc: Likewise.
3192 * ehframe.cc: Likewise.
3193 * fileread.h: Likewise.
3194 * gold.h: Likewise.
3195 * i386.cc: Likewise.
3196 * icf.cc: Likewise.
3197 * incremental.h: Likewise.
3198 * int_encoding.cc: Likewise.
3199 * layout.h: Likewise.
3200 * main.cc: Likewise.
3201 * merge.h: Likewise.
3202 * object.cc: Likewise.
3203 * object.h: Likewise.
3204 * options.cc: Likewise.
3205 * readsyms.cc: Likewise.
3206 * reduced_debug_output.cc: Likewise.
3207 * reloc.cc: Likewise.
3208 * script-sections.cc: Likewise.
3209 * sparc.cc: Likewise.
3210 * symtab.h: Likewise.
3211 * target-reloc.h: Likewise.
3212 * target.cc: Likewise.
3213 * target.h: Likewise.
3214 * timer.cc: Likewise.
3215 * timer.h: Likewise.
3216 * x86_64.cc: Likewise.
3217
3218 2010-12-09 Cary Coutant <ccoutant@google.com>
3219
3220 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3221 stack.
3222 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3223 parameter; change all callers.
3224 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3225 * options.h (warn_execstack): New option.
3226
3227 2010-12-07 Doug Kwan <dougkwan@google.com>
3228
3229 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3230 like function call relocations.
3231
3232 2010-12-07 Ian Lance Taylor <iant@google.com>
3233
3234 * archive.cc (Archive::get_elf_object_for_member): Permit
3235 punconfigured to be NULL.
3236 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3237 (Archive::include_member): Pass NULL to get_elf_object_for_member
3238 if we searched for the archive and this is the first included
3239 object.
3240
3241 2010-12-01 Ian Lance Taylor <iant@google.com>
3242
3243 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3244 track_relocs_type_ field.
3245 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3246 Set track_relocs_type_.
3247 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3248 contents when using RELA relocs.
3249 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3250 reloc_map_.
3251 * reloc.cc (Track_relocs::next_addend): New function.
3252 * reloc.h (class Track_relocs): Declare next_addend.
3253
3254 2010-12-01 Ian Lance Taylor <iant@google.com>
3255
3256 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3257 virtual destructor.
3258
3259 2010-12-01 Ian Lance Taylor <iant@google.com>
3260
3261 * README: Update compilers known to work and fail.
3262
3263 2010-11-23 Matthias Klose <doko@ubuntu.com>
3264
3265 * configure.in: For --enable-gold, handle value `default' instead of
3266 `both*'. Always install ld as ld.bfd, install as ld if gold is
3267 not the default.
3268 * configure: Regenerate.
3269
3270 2010-11-18 Doug Kwan <dougkwan@google.com>
3271
3272 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3273 and right_alignment to be zero. Store result alignment only if it is
3274 greater than existing alignment.
3275
3276 2010-11-16 Cary Coutant <ccoutant@google.com>
3277
3278 PR gold/12220
3279 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3280 Check for ".zdebug_line".
3281
3282 2010-11-16 Doug Kwan <dougkwan@google.com>
3283 Cary Coutant <ccoutant@google.com>
3284
3285 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3286 by reference; adjust all callers.
3287 * output.cc (Output_segment::set_section_addresses): Adjust references
3288 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3289 list is empty.
3290 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3291 end at page boundary.
3292
3293 2010-11-16 Cary Coutant <ccoutant@google.com>
3294
3295 PR gold/12220
3296 * layout.cc (Layout::choose_output_section): Transform names of
3297 compressed sections even when using a script with a SECTIONS clause.
3298 (Layout::output_section_name): Remove code to transform
3299 compressed debug section names.
3300 * output.cc (Output_section::add_input_section): Use uncompressed
3301 section size when tracking input sections.
3302
3303 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3304
3305 * symtab.h (Symbol::NON_PIC_REF): Remove.
3306 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3307 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3308 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3309 (Symbol::use_plt_offset): Take a flags argument and pass it
3310 directly to needs_dynamic_reloc. Restrict check for undefined
3311 weak symbols to function calls.
3312 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3313 (Target_arm::Scan::global): Use it.
3314 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3315 (Target_arm::Relocate::relocate): Likewise.
3316 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3317 parameter with an r_type parameter. Use get_reference_flags
3318 to get the flags.
3319 (Target_arm::Relocate::relocate): Update accordingly.
3320 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3321 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3322 (Target_i386::Scan::global): Likewise.
3323 (Target_i386::Relocate::relocate): Likewise.
3324 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3325 parameter with an r_type parameter. Use get_reference_flags
3326 to get the flags.
3327 (Target_i386::Relocate::relocate): Update accordingly.
3328 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3329 (Target_powerpc::Scan::global): Use it.
3330 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3331 (Target_powerpc::Relocate::relocate): Likewise.
3332 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3333 (Target_sparc::Scan::global): Use it.
3334 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3335 (Target_sparc::Relocate::relocate): Likewise.
3336 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3337 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3338 (Target_x86_64::Scan::global): Likewise.
3339 (Target_x86_64::Relocate::relocate): Likewise.
3340
3341 2010-11-08 Doug Kwan <dougkwan@google.com>
3342 Cary Coutant <ccoutant@google.com>
3343
3344 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3345 (Arm_exidx_merge_section::section_contents_): New data member.
3346 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3347 (Arm_input_section::~Arm_input_section): De-allocate memory.
3348 (Arm_input_section::original_contents_): New data member.
3349 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3350 in parameters instead of calling Object::section_contents without
3351 locking.
3352 (Arm_output_section::group_section): New parameter TASK. Pass it
3353 to callees that need locking objects.
3354 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3355 to lock EXIDX input sections. Fix a formatting issue. Call
3356 Arm_exidx_merged_section::build_contents to create merged section
3357 contents.
3358 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3359 to lock object of stub table owner.
3360 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3361 TEXT_SIZE to initialize data member TEXT_SIZE_.
3362 (Arm_exidx_input_section::addralign): Fix typo in comment.
3363 (Arm_exidx_input_section::text_size): New method.
3364 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3365 that require locking objects. Lock objects before scanning for stubs
3366 and updating local symbols.
3367 (Arm_input_section<big_endian>::init): Copy contents of original
3368 input section.
3369 (Arm_input_section<big_endian>::do_write): Use saved contents of
3370 original input section instead of calling Object::section_contents
3371 without locking.
3372 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3373 size without calling Object::section_size().
3374 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3375 for size. Allocate a buffer for merged EXIDX entries.
3376 (Arm_exidx_merged_section::build_contents): New method.
3377 (Arm_exidx_merged_section::do_write): Move merge section contents
3378 building code to Arm_exidx_merged_section::build_contetns. Write
3379 out contetns in buffer instead of building it on the fly.
3380 (Arm_relobj::make_exidx_input_section): Also pass text section size
3381 to Arm_exidx_input_section constructor.
3382 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3383 (Arm_dynobj::do_read_symbols): Fix memory leak.
3384 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3385 * target.h: (class Task): Add forward declaration.
3386 (Target::relax): Add new parameter TASK and pass it to
3387 Target::do_relax().
3388 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3389
3390 2010-11-05 Cary Coutant <ccoutant@google.com>
3391
3392 PR gold/10708
3393 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3394 object when reading from the file.
3395 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3396 second layout pass.
3397 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3398 when reading section contents.
3399 (get_section_contents): Likewise.
3400 (icf::find_identical_sections): Likewise.
3401 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3402 object when reading from the file.
3403 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3404 the object when doing deferred section layout.
3405
3406 2010-11-03 Nick Clifton <nickc@redhat.com>
3407
3408 PR gold/12001
3409 * script.h (class Symbol_assignment: name): New member. Returns
3410 the name of the symbol.
3411 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3412 Returns true if the given symbol name is on the list of
3413 assignments wating to be processed.
3414 * archive.cc (should_incldue_member): If the symbol is undefined,
3415 check to see if it is on the list of symbols pending assignment.
3416
3417 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3418
3419 * script-sections.cc (Script_sections::find_memory_region): Check
3420 for a NULL output section pointer.
3421
3422 2010-10-29 Doug Kwan <dougkwan@google.com>
3423
3424 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3425 Output_section::add_relaxed_input_section.
3426 * output.cc (Output_section::add_relaxed_input_section): Add new
3427 arguments LAYOUT and NAME. Set section order index.
3428 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3429 Copy section order index.
3430 * output.h (Output_section::add_relaxed_input_section): Add new
3431 arguments LAYOUT and NAME.
3432
3433 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3434
3435 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3436 NATIVE_OR_CROSS_LINKER.
3437 * testsuite/Makefile.in: Regenerate.
3438
3439 2010-10-20 Doug Kwan <dougkwan@google.com>
3440
3441 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3442 without SHF_LINK_ORDER flags.
3443 * layout.cc (Layout::choose_output_section): Do not filter
3444 SHF_LINK_ORDER flag in a relocatable link.
3445
3446 2010-10-17 Cary Coutant <ccoutant@google.com>
3447
3448 * output.h (Output_segment::set_section_addresses): Change function
3449 signature. Update all callers.
3450 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3451 sections.
3452 (Output_segment::set_section_addresses): Align after last TLS
3453 section. Add padding before last relro section instead of after.
3454
3455 2010-10-17 Doug Kwan <dougkwan@google.com>
3456
3457 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3458 GOT output section to be writable.
3459
3460 2010-10-14 Cary Coutant <ccoutant@google.com>
3461
3462 * debug.h (DEBUG_INCREMENTAL): New flag.
3463 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3464 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3465 mode.
3466 * incremental.cc (report_command_line): Ignore all forms of
3467 --incremental.
3468 * layout.cc (Layout::Layout): Check parameters for incremental link
3469 mode.
3470 * options.cc (General_options::parse_incremental): New function.
3471 (General_options::parse_no_incremental): New function.
3472 (General_options::parse_incremental_full): New function.
3473 (General_options::parse_incremental_update): New function.
3474 (General_options::incremental_mode_): New data member.
3475 (General_options::finalize): Check incremental_mode_.
3476 * options.h (General_options): Update help text for --incremental.
3477 Add --no-incremental, --incremental-full, --incremental-update.
3478 (General_options::Incremental_mode): New enum type.
3479 (General_options::incremental_mode): New function.
3480 (General_options::incremental_mode_): New data member.
3481 * parameters.cc (Parameters::incremental_mode_): New data member.
3482 (Parameters::set_options): Set incremental_mode_.
3483 (Parameters::set_incremental_full): New function.
3484 (Parameters::incremental): New function.
3485 (Parameters::incremental_update): New function.
3486 (set_parameters_incremental_full): New function.
3487 * parameters.h (Parameters::set_incremental_full): New function.
3488 (Parameters::incremental): New function.
3489 (Parameters::incremental_update): New function.
3490 (Parameters::incremental_mode_): New data member.
3491 (set_parameters_incremental_full): New function.
3492 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3493 incremental link mode.
3494 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3495 (Sized_relobj::do_relocate_sections): Likewise.
3496 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3497 option.
3498 * testsuite/Makefile.in: Regenerate.
3499 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3500
3501 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3502
3503 * script-sections.h (class Script_sections): Make
3504 Sections_elements typedef public.
3505 * script-sections.cc (class Sort_output_sections): Add elements_
3506 field. Add constructor which sets it; change all callers.
3507 (Sort_output_sections::is_before): New function.
3508 (Sort_output_sections::operator()): Call is_before.
3509 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3510 conditional.
3511 * testsuite/script_test_10.sh: New test. Test script section
3512 order.
3513 * testsuite/script_test_10.t: Likewise.
3514 * testsuite/script_test_10.s: Likewise.
3515 * testsuite/Makefile.am: Wrap the cross linker tests and the
3516 common tests into NATIVE_OR_CROSS_LINKER.
3517 (check_SCRIPTS): Add script_test_10.sh.
3518 (check_DATA): Add script_test_10.stdout.
3519 (script_test_10.o, script_test_10): New targets.
3520 (script_test_10.stdout): New target.
3521 * configure, testsuite/Makefile.in: Regenerate.
3522
3523 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3524
3525 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3526 error for the deprecated relocations.
3527 (Target_arm::Scan::global): Likewise.
3528 (Target_arm::Relocate::relocate): Likewise.
3529
3530 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3531
3532 * fileread.cc (Input_file::find_file): Initialize *found_name
3533 and *namep when using the fallback search for case 4.
3534
3535 2010-10-11 Cary Coutant <ccoutant@google.com>
3536
3537 * options.h (class General_options): Redefine -z lazy as an alias for
3538 the negation of -z now.
3539
3540 2010-10-11 Ian Lance Taylor <iant@google.com>
3541
3542 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3543 binding.
3544
3545 2010-10-06 Nick Clifton <nickc@redhat.com>
3546
3547 * script-sections.cc(class Memory_region): Remove
3548 current_lma_offset_ field. Rename current_vma_offset_ to
3549 current_offset_. Add last_section_ field.
3550 (Memory_region::get_current_vma_address): Rename to
3551 get_current_address.
3552 (Memory_region::get_current_lma_address): Delete.
3553 (Memory_region::increment_vma_offset): Rename to
3554 increment_offset.
3555 (Memory_region::increment_lma_offset): Delete.
3556 (Memory_region::attributes_compatible): New method. Returns
3557 true if the provided section is compatible with the region.
3558 (Memory_region::get_last_section): New method. Returns the last
3559 section to use the region.
3560 (Memory_region::set_last_section): New method. Stores the last
3561 section to use the region.
3562 (Script_sections::block_in_region): New method. Returns true if
3563 a block of memory is contained within a region.
3564 (Script_sections::find_memory_region): New method. Locates a
3565 memory region to be used to set a VMA or LMA address.
3566 (Output_section_definition::set_section_addresses): Add code to
3567 check for addresses set by memory regions.
3568 (Output_segment::set_section_addresses): Remove memory region
3569 walking code.
3570 (Script_sections::create_segment): Add a warning if a header
3571 segment is created outside of any region.
3572 * script-sections.h (class Script_sections): Add prototypes for
3573 find_memory_region and block_in_region methods.
3574 * testsuite/memory_test.s: Use .long instead of .word.
3575 * testsuite/memory_test.t: Add some more output sections.
3576 * testsuite/memory_test.sh: Update expected output.
3577
3578 2010-10-02 Doug Kwan <dougkwan@google.com>
3579
3580 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3581 defintion to symtab.h
3582 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3583 declaration to defintion.
3584
3585 2010-10-01 Nick Clifton <nickc@redhat.com>
3586
3587 * expression.cc (eval): Replace dummy argument with NULL.
3588 (eval_maybe_dot): Check for a NULL result section pointer.
3589 (Symbol_expression::value): Likewise.
3590 (Dot_expression::value): Likewise.
3591 (BINARY_EXPRESSION): Likewise.
3592 (Max_expression::value): Likewise.
3593 (Min_expression::value): Likewise.
3594 (Absolute_expression::value): Likewise.
3595 (Addr_expression::value_from_output_section): Likewise.
3596 (Loaddddr_expression::value_from_output_section): Likewise.
3597 (Segment_start_expression::value): Likewise.
3598 * script-sections.cc
3599 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3600 argument with NULL.
3601 (Sections_elememt_dot_assignment::set_section_addresses):
3602 Likewise.
3603 (Output_data_expression::do_write_to_buffer): Likewise.
3604 (Output_section_definition::finalize_symbols): Likewise.
3605 (Output_section_definition::set_section_addresses): Likewise.
3606
3607 2010-09-30 Doug Kwan <dougkwan@google.com>
3608
3609 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3610
3611 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3612
3613 * target.h (Target::can_icf_inline_merge_sections): New virtual
3614 function.
3615 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3616 virtual function.
3617 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3618 virtual function.
3619 * icf.cc (get_section_contents): Inline merge sections only when
3620 target allows it.
3621
3622 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3623
3624 * configure: Regenerate.
3625
3626 2010-09-17 Ian Lance Taylor <iant@google.com>
3627
3628 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3629 * testsuite/Makefile.am (memory_test.o): New target.
3630 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3631 memory_test.t.
3632 * testsuite/Makefile.in: Rebuild.
3633
3634 2010-09-17 Doug Kwan <dougkwan@google.com>
3635
3636 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3637 defintion if relocation uses GOT entries of the symbol.
3638 * testsuite/icf_safe_test.sh: Fix test.
3639 * testsuite/icf_safe_so_test.sh: Fix test.
3640
3641 2010-09-16 Cary Coutant <ccoutant@google.com>
3642
3643 * script_sections.cc (class Memory_region): Remove "NULL" from
3644 vector initializations.
3645
3646 2010-09-15 Cary Coutant <ccoutant@google.com>
3647
3648 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3649 Resolve forwarding symbols.
3650
3651 2010-09-15 Doug Kwan <dougkwan@google.com>
3652
3653 * gold/testsuite/script_test_3.t: Add ARM special sections.
3654 * gold/testsuite/script_test_4.t: Same.
3655 * gold/testsuite/script_test_5.t: Same.
3656 * gold/testsuite/script_test_6.t: Same.
3657 * gold/testsuite/script_test_7.t: Same.
3658 * gold/testsuite/script_test_7.t: Same.
3659 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3660
3661 2010-09-14 Cary Coutant <ccoutant@google.com>
3662
3663 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3664 (Target_x86_64::Relocate::relocate_tls): Replace check for
3665 saw_tls_block_reloc_ with test for executable section.
3666
3667 2010-09-12 Cary Coutant <ccoutant@google.com>
3668
3669 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3670 position-independent executables to shared libraries need dynamic
3671 relocations.
3672 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3673 position-independent executables.
3674 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3675 * testsuite/Makefile.in: Regenerate.
3676
3677 2010-09-10 Nick Clifton <nickc@redhat.com>
3678
3679 PR gold/11997
3680 * testsuite/memory_test.t: Discard any sections that are not
3681 needed.
3682
3683 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3684
3685 PR gold/11996
3686 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3687 "This::" to work around a bug in gcc 4.2.
3688
3689 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3690
3691 2010-09-09 Rafael Espindola <espindola@google.com>
3692
3693 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3694 sections with different PF_X flags in the same segment.
3695 (Layout::find_first_load_seg): Search all segments to find the first
3696 one.
3697 * options.h (rosegment): New.
3698
3699 2010-09-08 Rafael Espindola <espindola@google.com>
3700
3701 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3702
3703 2010-09-08 Doug Kwan <dougkwan@google.com>
3704
3705 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3706 (Arm_relobj::do_relocate_sections): Add new parameter for output
3707 file to match the parent.
3708 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3709 of local symbols instead of input values. Update code to track
3710 changes in gold::relocate_section.
3711 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3712 (Sized_relobj::compute_final_local_value_internal): New methods.
3713 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3714 body into private version of Sized_relobj::compute_final_local_value.
3715 Call the inline method.
3716 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3717 merged symbol value if there is one.
3718 (Symbol_value::has_output_value): New method defintiion.
3719 (Sized_relobj::Compute_final_local_value_status): New enum type.
3720 (Sized_relobj::compute_final_local_value): New methods.
3721 (Sized_relobj::compute_final_local_value_internal): New methods.
3722 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3723 and arm_cortex_a8.sh.
3724 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3725 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3726 New tests.
3727 * Makefile.in: Regenerate.
3728 * testsuite/arm_bl_out_of_range.s: Update test.
3729 * testsuite/thumb_bl_out_of_range.s: Ditto.
3730 * testsuite/thumb_blx_out_of_range.s: Ditto.
3731 * testsuite/arm_branch_out_of_range.sh: New file.
3732 * testsuite/arm_cortex_a8.sh: Ditto.
3733 * testsuite/arm_cortex_a8_b.s: Ditto.
3734 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3735 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3736 * testsuite/arm_cortex_a8_bl.s: Ditto.
3737 * testsuite/arm_cortex_a8_blx.s: Ditto.
3738 * testsuite/arm_cortex_a8_local.s: Ditto.
3739 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3740 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3741
3742 2010-09-08 Rafael Espindola <espindola@google.com>
3743
3744 * Makefile.am (memory_test.stdout): Run readelf with -W.
3745 * Makefile.in: Regenerate.
3746 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3747 64 bit output.
3748
3749 2010-09-08 Rafael Espindola <espindola@google.com>
3750
3751 * script-sections.cc (Script_sections::add_memory_region): Convert
3752 field precision to int.
3753 * script.cc (script_set_section_region, script_set_section_region):
3754 Convert field precision to int.
3755
3756 2010-09-08 Rafael Espindola <espindola@google.com>
3757
3758 * arm.cc (do_finalize_sections): Create the __exidx_start and
3759 __exdix_end symbols even when the section is missing.
3760
3761 2010-09-08 Nick Clifton <nickc@redhat.com>
3762
3763 * README: Remove claim that MEMORY is not supported.
3764 * expression.cc (script_exp_function_origin)
3765 (script_exp_function_length): Move from here to ...
3766 * script.cc: ... here.
3767 (script_set_section_region, script_add_memory)
3768 (script_parse_memory_attr, script_include_directive): New
3769 functions.
3770 * script-sections.cc
3771 (class Memory_region): New class.
3772 (class Output_section_definition): Add set_memory_region,
3773 set_section_vma, set_section_lma and get_section_name methods.
3774 (class Script_Sections): Add add_memory_region,
3775 find_memory_region, find_memory_region_origin,
3776 find_memory_region_length and set_memory_region methods.
3777 Have set_section_addresses method walk the list of set memory
3778 regions.
3779 Extend the print methos to display memory regions.
3780 * script-sections.h: Add prototypes for new methods.
3781 Add enum for MEMORY region attributes.
3782 * yyscript.y: Add support for parsing MEMORY regions.
3783 * script-c.h: Add prototypes for new functions.
3784 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3785 * testsuite/Makefile.in: Regenerate.
3786 * testsuite/memory_test.sh: New script.
3787 * testsuite/memory_test.s: New assembler source file.
3788 * testsuite/memory_test.t: New linker script.
3789
3790 2010-08-27 Doug Kwan <dougkwan@google.com>
3791
3792 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3793 reference override an existing dynamic weak reference.
3794 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3795 * testsuite/Makefile.in: Regenerate.
3796 * testsuite/dyn_weak_ref.sh: New file.
3797 * testsuite/dyn_weak_ref_1.c: Ditto.
3798 * testsuite/dyn_weak_ref_2.c: Ditto.
3799
3800 2010-08-27 Ian Lance Taylor <iant@google.com>
3801
3802 * incremental.h (class Incremental_input_entry): Add virtual
3803 destructor.
3804
3805 2010-08-27 Ian Lance Taylor <iant@google.com>
3806
3807 * testsuite/start_lib_test_3.c: Mark t3 as used.
3808
3809 2010-08-27 Nick Clifton <nickc@redhat.com>
3810
3811 * options.cc (version_script): Fix small typo in previous
3812 whitespace tidyup.
3813
3814 2010-08-25 Nick Clifton <nickc@redhat.com>
3815
3816 * archive.cc: Formatting fixes: Remove whitespace between
3817 typename and following asterisk. Remove whitespace between
3818 function name and opening parenthesis.
3819 * archive.h: Likewise.
3820 * arm.cc: Likewise.
3821 * attributes.cc: Likewise.
3822 * attributes.h: Likewise.
3823 * common.cc: Likewise.
3824 * copy-relocs.cc: Likewise.
3825 * dirsearch.h: Likewise.
3826 * dynobj.cc: Likewise.
3827 * ehframe.cc: Likewise.
3828 * ehframe.h: Likewise.
3829 * expression.cc: Likewise.
3830 * fileread.cc: Likewise.
3831 * fileread.h: Likewise.
3832 * gc.h: Likewise.
3833 * gold-threads.cc: Likewise.
3834 * gold.cc: Likewise.
3835 * i386.cc: Likewise.
3836 * icf.h: Likewise.
3837 * incremental-dump.cc: Likewise.
3838 * incremental.cc: Likewise.
3839 * layout.cc: Likewise.
3840 * layout.h: Likewise.
3841 * main.cc: Likewise.
3842 * merge.cc: Likewise.
3843 * merge.h: Likewise.
3844 * object.cc: Likewise.
3845 * object.h: Likewise.
3846 * options.cc: Likewise.
3847 * options.h: Likewise.
3848 * output.cc: Likewise.
3849 * output.h: Likewise.
3850 * plugin.cc: Likewise.
3851 * plugin.h: Likewise.
3852 * powerpc.cc: Likewise.
3853 * reloc.cc: Likewise.
3854 * script-c.h: Likewise.
3855 * script-sections.cc: Likewise.
3856 * script.cc: Likewise.
3857 * stringpool.cc: Likewise.
3858 * symtab.cc: Likewise.
3859 * symtab.h: Likewise.
3860 * target.cc: Likewise.
3861 * timer.cc: Likewise.
3862 * timer.h: Likewise.
3863 * version.cc: Likewise.
3864 * x86_64.cc: Likewise.
3865
3866 2010-08-24 Nick Clifton <nickc@redhat.com>
3867
3868 PR 11899
3869 * layout.cc (segment_precedes): Sort segments by their physical
3870 addresses, if they have been set.
3871
3872 2010-08-23 Cary Coutant <ccoutant@google.com>
3873
3874 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3875 symbols data.
3876 (Lib_group::include_member): Unlock object after deleting its
3877 symbols data.
3878 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3879 the bug fixed here.
3880
3881 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3882 Cary Coutant <ccoutant@google.com>
3883
3884 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3885 constructor, and set_blocker.
3886 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3887 readsyms_blocker_.
3888 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3889 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3890 * testsuite/Makefile.am (start_lib_test): New test case.
3891 * testsuite/Makefile.in: Regenerate.
3892 * testsuite/start_lib_test_main.c: New file.
3893 * testsuite/start_lib_test_1.c: New file.
3894 * testsuite/start_lib_test_2.c: New file.
3895 * testsuite/start_lib_test_3.c: New file.
3896
3897 2010-08-19 Ian Lance Taylor <iant@google.com>
3898
3899 * Makefile.in: Rebuild with automake 1.11.1.
3900 * aclocal.m4: Likewise.
3901 * testsuite/Makefile.in: Likewise.
3902
3903 2010-08-19 Ian Lance Taylor <iant@google.com>
3904
3905 PR 10893
3906 * i386.cc (class Output_data_plt_i386): Update declarations.
3907 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3908 local_ifuncs_ fields.
3909 (Target_i386::do_plt_section_for_global): New function.
3910 (Target_i386::do_plt_section_for_local): New function.
3911 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3912 parameter; change all callers. Initialize global_ifuncs_ and
3913 local_ifuncs_. If doing a static link define __rel_iplt_start and
3914 __rel_iplt_end.
3915 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3916 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3917 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3918 symbols.
3919 (Target_i386::make_plt_section): New function, broken out of
3920 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3921 (Target_i386::make_plt_entry): Call make_plt_section.
3922 (Target_i386::make_local_ifunc_plt_entry): New function.
3923 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3924 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3925 R_386_IRELATIVE to switch.
3926 (Target_i386::Scan::global): Likewise.
3927 (Target_i386::Relocate::relocate): Likewise.
3928 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3929 switch.
3930 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3931 (Target_x86_64::do_plt_section_for_global): New function.
3932 (Target_x86_64::do_plt_section_for_local): New function.
3933 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3934 parameter; change all callers. If doing a static link define
3935 __rela_iplt_start and __rela_iplt_end.
3936 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3937 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3938 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3939 to point to .plt.
3940 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3941 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3942 switch.
3943 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3944 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3945 R_X86_64_IRELATIVE to switch.
3946 (Target_x86_64::Scan::global): Likewise.
3947 (Target_x86_64::Relocate::relocate): Likewise.
3948 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3949 switch.
3950 * target.h (class Target): Add plt_section_for_global and
3951 plt_section_for_local functions. Add do_plt_section_for_global
3952 and do_plt_section_for_local virtual functions.
3953 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3954 clarifying comments.
3955 (Symbol::use_plt_offset): Handle IFUNC symbol.
3956 * object.cc (Sized_relobj::Sized_relobj): Initialize
3957 local_plt_offsets_.
3958 (Sized_relobj::local_has_plt_offset): New function.
3959 (Sized_relobj::local_plt_offset): New function.
3960 (Sized_relobj::set_local_plt_offset): New function.
3961 (Sized_relobj::do_count): Handle IFUNC symbol.
3962 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3963 a bit away from input_shndx_ field. Add set_is_func_symbol and
3964 is_ifunc_symbol functions.
3965 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3966 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3967 local_plt_offsets_ field.
3968 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3969 * output.h (class Output_section_data): Add non-const
3970 output_section function.
3971 (class Output_data_got): Update declarations.
3972 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3973 Add use_plt_offset parameter to global and local constructors.
3974 Change all callers. Change local_sym_index_ field to 31 bits.
3975 Change GSYM_CODE and CONSTANT_CODE accordingly.
3976 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3977 doing a static link don't set sh_link field.
3978 (Output_data_got::Got_entry::write): Use PLT offset if
3979 appropriate.
3980 (Output_data_got::add_global_plt): New function.
3981 (Output_data_got::add_local_plt): New function.
3982 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3983 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3984 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3985 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3986 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3987 IFUNC conditional.
3988 * testsuite/ifunc-sel.h: New file.
3989 * testsuite/ifuncmain1.c: New file.
3990 * testsuite/ifuncmain1vis.c: New file.
3991 * testsuite/ifuncmod1.c: New file.
3992 * testsuite/ifuncdep2.c: New file.
3993 * testsuite/ifuncmain2.c: New file.
3994 * testsuite/ifuncmain3.c: New file.
3995 * testsuite/ifuncmod3.c: New file.
3996 * testsuite/ifuncmain4.c: New file.
3997 * testsuite/ifuncmain5.c: New file.
3998 * testsuite/ifuncmod5.c: New file.
3999 * testsuite/ifuncmain6pie.c: New file.
4000 * testsuite/ifuncmod6.c: New file.
4001 * testsuite/ifuncmain7.c: New file.
4002 * configure, testsuite/Makefile.in: Rebuild.
4003
4004 2010-08-18 Ian Lance Taylor <iant@google.com>
4005
4006 * incremental.cc
4007 (Output_section_incremental_inputs::write_input_files): Add cast
4008 to avoid signed/unsigned comparison warning.
4009 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4010
4011 2010-08-12 Cary Coutant <ccoutant@google.com>
4012
4013 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4014
4015 2010-08-13 Ian Lance Taylor <iant@google.com>
4016
4017 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4018
4019 2010-08-12 Cary Coutant <ccoutant@google.com>
4020 Doug Kwan <dougkwan@google.com>
4021
4022 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4023 defintion overrides non-weak undef, remember that the original undef
4024 is not weak.
4025 * symtab.cc (Symbol_table::sized_write_global): For undef without
4026 an original weak binding, set binding to global in output.
4027 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4028 * testsuite/Makefile.in: Regenerate.
4029 * testsuite/strong_ref_weak_def.sh: New file.
4030 * testsuite/strong_ref_weak_def_1.c: Ditto.
4031 * testsuite/strong_ref_weak_def_2.c: Ditto.
4032
4033 2010-08-12 Cary Coutant <ccoutant@google.com>
4034
4035 * testsuite/incremental_test.sh: Rewrite.
4036 * testsuite/incremental_test_1.c: Rewrite.
4037 * testsuite/incremental_test_2.c: Rewrite.
4038
4039 2010-08-12 Cary Coutant <ccoutant@google.com>
4040
4041 * arm.cc (Target_arm::got_size): Add const.
4042 (Target_arm::got_entry_count): New function.
4043 (Target_arm::plt_entry_count): New function.
4044 (Target_arm::first_plt_entry_offset): New function.
4045 (Target_arm::plt_entry_size): New function.
4046 (Output_data_plt_arm::entry_count): New function.
4047 (Output_data_plt_arm::first_plt_entry_offset): New function.
4048 (Output_data_plt_arm::get_plt_entry_size): New function.
4049 * i386.cc (Target_i386::got_size): Add const.
4050 (Target_i386::got_entry_count): New function.
4051 (Target_i386::plt_entry_count): New function.
4052 (Target_i386::first_plt_entry_offset): New function.
4053 (Target_i386::plt_entry_size): New function.
4054 (Output_data_plt_i386::entry_count): New function.
4055 (Output_data_plt_i386::first_plt_entry_offset): New function.
4056 (Output_data_plt_i386::get_plt_entry_size): New function.
4057 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4058 find_incremental_inputs_sections. Dump incremental_got_plt section.
4059 * incremental.cc: Include target.h.
4060 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4061 parameter. Adjust all callers. Find incremental_got_plt section.
4062 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4063 section.
4064 (Output_section_incremental_inputs::set_final_data_size): Calculate
4065 size of incremental_got_plt section.
4066 (Output_section_incremental_inputs::do_write): Write the
4067 incremental_got_plt section.
4068 (Got_plt_view_info): New struct.
4069 (Local_got_offset_visitor): New class.
4070 (Global_got_offset_visitor): New class.
4071 (Global_symbol_visitor_got_plt): New class.
4072 (Output_section_incremental_inputs::write_got_plt): New function.
4073 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4074 Add parameter. Adjust all callers.
4075 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4076 (Incremental_inputs::got_plt_section): New function.
4077 (Incremental_inputs::got_plt_section_): New data member.
4078 (Incremental_got_plt_reader): New class.
4079 * layout.cc (Layout::create_incremental_info_sections): Add the
4080 incremental_got_plt section.
4081 * object.h (Got_offset_list::get_list): New function.
4082 (Got offset_list::for_all_got_offsets): New function.
4083 (Sized_relobj::local_got_offset_list): New function.
4084 * powerpc.cc (Target_powerpc::got_size): Add const.
4085 (Target_powerpc::got_entry_count): New function.
4086 (Target_powerpc::plt_entry_count): New function.
4087 (Target_powerpc::first_plt_entry_offset): New function.
4088 (Target_powerpc::plt_entry_size): New function.
4089 (Output_data_plt_powerpc::entry_count): New function.
4090 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4091 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4092 * sparc.cc (Target_sparc::got_size): Add const.
4093 (Target_sparc::got_entry_count): New function.
4094 (Target_sparc::plt_entry_count): New function.
4095 (Target_sparc::first_plt_entry_offset): New function.
4096 (Target_sparc::plt_entry_size): New function.
4097 (Output_data_plt_sparc::entry_count): New function.
4098 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4099 (Output_data_plt_sparc::get_plt_entry_size): New function.
4100 * symtab.h (Symbol::got_offset_list): New function.
4101 (Symbol_table::for_all_symbols): New function.
4102 * target.h (Sized_target::got_entry_count): New function.
4103 (Sized_target::plt_entry_count): New function.
4104 (Sized_target::plt_entry_size): New function.
4105 * x86_64.cc (Target_x86_64::got_size): Add const.
4106 (Target_x86_64::got_entry_count): New function.
4107 (Target_x86_64::plt_entry_count): New function.
4108 (Target_x86_64::first_plt_entry_offset): New function.
4109 (Target_x86_64::plt_entry_size): New function.
4110 (Output_data_plt_x86_64::entry_count): New function.
4111 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4112 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4113
4114 2010-08-12 Cary Coutant <ccoutant@google.com>
4115
4116 * archive.cc: Include incremental.h.
4117 (Archive::Archive): Initialize incremental_info_.
4118 (Archive::include_member): Record archive members in incremental info.
4119 (Add_archive_symbols::run): Record begin and end of an archive in
4120 incremental info.
4121 (Lib_group::include_member): Record objects in incremental info.
4122 * archive.h (Incremental_archive_entry): Forward declaration.
4123 (Archive::set_incremental_info): New member function.
4124 (Archive::incremental_info): New member function.
4125 (Archive::Unused_symbol_iterator): New class.
4126 (Archive::unused_symbols_begin): New member function.
4127 (Archive::unused_symbols_end): New member function.
4128 (Archive::incremental_info_): New data member.
4129 * incremental-dump.cc (find_input_containing_global): New function.
4130 (dump_incremental_inputs): Dump new incremental info sections.
4131 * incremental.cc: Include symtab.h.
4132 (Output_section_incremental_inputs): New class.
4133 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4134 new incremental info sections.
4135 (Sized_incremental_binary::do_check_inputs): Likewise.
4136 (Incremental_inputs::report_archive): Remove.
4137 (Incremental_inputs::report_archive_begin): New function.
4138 (Incremental_inputs::report_archive_end): New function.
4139 (Incremental_inputs::report_object): New function.
4140 (Incremental_inputs::finalize_inputs): Remove.
4141 (Incremental_inputs::report_input_section): New function.
4142 (Incremental_inputs::report_script): Rewrite.
4143 (Incremental_inputs::finalize): Do nothing but finalize string table.
4144 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4145 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4146 (Incremental_inputs::create_data_sections): New function.
4147 (Incremental_inputs::relocs_entsize): New function.
4148 (Output_section_incremental_inputs::set_final_data_size): New function.
4149 (Output_section_incremental_inputs::do_write): New function.
4150 (Output_section_incremental_inputs::write_header): New function.
4151 (Output_section_incremental_inputs::write_input_files): New function.
4152 (Output_section_incremental_inputs::write_info_blocks): New function.
4153 (Output_section_incremental_inputs::write_symtab): New function.
4154 * incremental.h (Incremental_script_entry): Forward declaration.
4155 (Incremental_object_entry): Forward declaration.
4156 (Incremental_archive_entry): Forward declaration.
4157 (Incremental_inputs): Forward declaration.
4158 (Incremental_inputs_header_data): Remove.
4159 (Incremental_inputs_header): Remove.
4160 (Incremental_inputs_header_write): Remove.
4161 (Incremental_inputs_entry_data): Remove.
4162 (Incremental_inputs_entry): Remove.
4163 (Incremental_inputs_entry_write): Remove.
4164 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4165 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4166 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4167 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4168 Likewise.
4169 (Incremental_input_entry): New class.
4170 (Incremental_script_entry): New class.
4171 (Incremental_object_entry): New class.
4172 (Incremental_archive_entry): New class.
4173 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4174 (Incremental_inputs::report_inputs): Remove.
4175 (Incremental_inputs::report_archive): Remove.
4176 (Incremental_inputs::report_archive_begin): New function.
4177 (Incremental_inputs::report_archive_end): New function.
4178 (Incremental_inputs::report_object): Change prototype.
4179 (Incremental_inputs::report_input_section): New function.
4180 (Incremental_inputs::report_script): Change prototype.
4181 (Incremental_inputs::get_reloc_count): New function.
4182 (Incremental_inputs::set_reloc_count): New function.
4183 (Incremental_inputs::create_data_sections): New function.
4184 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4185 (Incremental_inputs::inputs_section): New function.
4186 (Incremental_inputs::symtab_section): New function.
4187 (Incremental_inputs::relocs_section): New function.
4188 (Incremental_inputs::get_stringpool): Add const.
4189 (Incremental_inputs::command_line): Add const.
4190 (Incremental_inputs::inputs): Remove.
4191 (Incremental_inputs::command_line_key): New function.
4192 (Incremental_inputs::input_file_count): New function.
4193 (Incremental_inputs::input_files): New function.
4194 (Incremental_inputs::relocs_entsize): New function.
4195 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4196 (Incremental_inputs::finalize_inputs): Remove.
4197 (Incremental_inputs::Input_info): Remove.
4198 (Incremental_inputs::lock_): Remove.
4199 (Incremental_inputs::inputs_): Change type.
4200 (Incremental_inputs::inputs_map_): Remove.
4201 (Incremental_inputs::current_object_entry_): New data member.
4202 (Incremental_inputs::inputs_section_): New data member.
4203 (Incremental_inputs::symtab_section_): New data member.
4204 (Incremental_inputs::relocs_section_): New data member.
4205 (Incremental_inputs::reloc_count_): New data member.
4206 (Incremental_inputs_reader): New class.
4207 (Incremental_symtab_reader): New class.
4208 (Incremental_relocs_reader): New class.
4209 * layout.cc (Layout::finalize): Move finalization of incremental info
4210 and creation of incremental info sections to follow finalization of
4211 symbol table. Set offsets for postprocessing sections.
4212 (Layout::create_incremental_info_sections): Call
4213 Incremental_inputs::create_data_sections. Add incremental symtab
4214 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4215 sections to layout after input sections.
4216 * layout.h (struct Timespec): Forward declaration.
4217 (Layout::incremental_inputs): Add const.
4218 (Layout::create_incremental_info_sections): Add parameter.
4219 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4220 * object.cc: Include incremental.h.
4221 (Relobj::finalize_incremental_relocs): New function.
4222 (Sized_relobj::do_layout): Record input sections in incremental info.
4223 * object.h (Object::output_section): New function.
4224 (Object::output_section_offset): Moved from Relobj.
4225 (Object::get_incremental_reloc_base): New function.
4226 (Object::get_incremental_reloc_count): New function.
4227 (Object::do_output_section): New function.
4228 (Object::do_output_section_offset): Moved from Relobj.
4229 (Object::do_get_incremental_reloc_base): New function.
4230 (Object::do_get_incremental_reloc_count): New function.
4231 (Object::Object): Initialize new data members.
4232 (Relobj::output_section): Renamed do_output_section and moved to
4233 protected.
4234 (Relobj::output_section_offset): Moved to Object.
4235 (Relobj::do_get_incremental_reloc_base): New function.
4236 (Relobj::do_get_incremental_reloc_count): New function.
4237 (Relobj::allocate_incremental_reloc_counts): New function.
4238 (Relobj::count_incremental_reloc): New function.
4239 (Relobj::finalize_incremental_relocs): New function.
4240 (Relobj::next_incremental_reloc_index): New function.
4241 (Relobj::reloc_counts_): New data member.
4242 (Relobj::reloc_bases_): New data member.
4243 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4244 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4245 (Sized_relobj::incremental_relocs_scan): New function.
4246 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4247 (Sized_relobj::incremental_relocs_write): New function.
4248 (Sized_relobj::incremental_relocs_write_reltype): New function.
4249 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4250 incremental link.
4251 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4252 archives and object files elsewhere.
4253 (Add_symbols::run): Report object files here.
4254 (Finish_group::run): Report end of archive at end of group.
4255 * reloc.cc: Include layout.h, incremental.h.
4256 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4257 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4258 (Sized_relobj::incremental_relocs_scan): New function.
4259 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4260 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4261 (Sized_relobj::incremental_relocs_write): New function.
4262 (Sized_relobj::incremental_relocs_write_reltype): New function.
4263 * script.cc (read_input_script): Rewrite test for incremental link.
4264 Change call to Incremental_inputs::report_script.
4265 * symtab.h (Symbol_table::first_global_index): New function.
4266 (Symbol_table::output_count): New function.
4267
4268 2010-08-12 Doug Kwan <dougkwan@google.com>
4269
4270 * arm.cc (Target_arm::merge_object_attributes): Check command line
4271 options --no-wchar-size-warning and --no-enum-size-warning.
4272 * options.h (General_options): Add ld-compatible options
4273 --no-enum-size-warning and --no-wchar-size-warning.
4274
4275 2010-08-04 Ian Lance Taylor <iant@google.com>
4276
4277 * x86_64.cc (Target_x86_64::Scan::local): Use
4278 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4279 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4280 (Target_x86_64::Scan::global): Likewise.
4281 (Target_x86_64::Relocate::relocate): Likewise.
4282 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4283 Likewise.
4284
4285 2010-08-03 Cary Coutant <ccoutant@google.com>
4286
4287 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4288 to reserve space in merged_strings vector. Keep total input size
4289 for stats.
4290 (Output_merge_string::do_print_merge_stats): Print total input size.
4291 * merge.h (Output_merge_string): Add input_size_ field.
4292 * stringpool.cc (Stringpool_template::string_length): Move
4293 implementations out of Stringpool_template class and place in
4294 stringpool.h.
4295 * stringpool.h (string_length): Move out of Stringpool_template.
4296
4297 2010-08-03 Ian Lance Taylor <iant@google.com>
4298
4299 PR 11712
4300 * layout.cc (relaxation_loop_body): If address of load segment is
4301 set, adjust address to include headers if possible.
4302
4303 2010-08-03 Ian Lance Taylor <iant@google.com>
4304
4305 * version.cc (version_string): Bump to 1.10.
4306
4307 2010-08-03 Ian Lance Taylor <iant@google.com>
4308
4309 PR 11805
4310 * layout.h (enum Output_section_order): Define.
4311 (class Layout): Update declarations.
4312 * layout.cc (Layout::get_output_section): Add order parameter.
4313 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4314 is_first_non_relro parameters. Change all callers.
4315 (Layout::choose_output_section): Likewise.
4316 (Layout::add_output_section_data): Likewise.
4317 (Layout::make_output_section): Likewise. Set order.
4318 (Layout::default_section_order): New function.
4319 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4320 * output.cc (Output_section::Output_section): Initialize order_.
4321 Don't initialize deleted fields.
4322 (Output_segment::Output_segment): Don't initialize deleted
4323 fields.
4324 (Output_segment::add_output_section_to_load): New function
4325 replacing add_output_section. Change all callers to call this or
4326 add_output_section_to_nonload.
4327 (Output_segment::add_output_section_to_nonload): New function.
4328 (Output_segment::remove_output_section): Rewrite.
4329 (Output_segment::add_initial_output_data): Likewise.
4330 (Output_segment::has_any_data_sections): Likewise.
4331 (Output_segment::is_first_section_relro): Likewise.
4332 (Output_segment::maximum_alignment): Likewise.
4333 (Output_segment::has_dynamic_reloc): New function replacing
4334 dynamic_reloc_count. Change all callers.
4335 (Output_segment::has_dynamic_reloc_list): New function replacing
4336 dynamic_reloc_count_list. Change all callers.
4337 (Output_segment::set_section_addresses): Rewrite.
4338 (Output_segment::set_offset): Rewrite.
4339 (Output_segment::find_first_and_last_list): Remove.
4340 (Output_segment::set_tls_offsets): Rewrite.
4341 (Output_segment::first_section_load_address): Likewise.
4342 (Output_segment::output_section_count): Likewise.
4343 (Output_segment::section_with_lowest_load_address): Likewise.
4344 (Output_segment::write_section_headers): Likewise.
4345 (Output_segment::print_sections_to_map): Likewise.
4346 * output.h (class Output_data): Remove dynamic_reloc_count_
4347 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4348 (Output_data::add_dynamic_reloc): Rewrite.
4349 (Output_data::has_dynamic_reloc): New function.
4350 (Output_data::dynamic_reloc_count): Remove.
4351 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4352 is_last_relro_, is_first_non_relro_, is_interp_,
4353 is_dynamic_linker_section_ fields. Add order and set_order
4354 functions. Remove is_relro_local, set_is_relro_local,
4355 is_last_relro, set_is_last_relro, is_first_non_relro,
4356 set_is_first_non_relro functions, is_interp, set_is_interp,
4357 is_dynamic_linker_section, and set_is_dynamic_linker_section
4358 functions.
4359 (class Output_segment): Change Output_data_list from std::list to
4360 std:;vector. Add output_lists_ field. Remove output_data_ and
4361 output_bss_ fields. Update declarations.
4362
4363 2010-08-02 Ian Lance Taylor <iant@google.com>
4364
4365 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4366 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4367 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4368
4369 2010-08-02 Ian Lance Taylor <iant@google.com>
4370
4371 PR 11855
4372 * script.cc (Script_options::Script_options): Initialize
4373 symbol_definitions_ and symbol_references_.
4374 (Script_options::add_symbol_assignment): Update
4375 symbol_definitions_ and symbol_references_.
4376 (Script_options::add_symbol_reference): New function.
4377 (script_symbol): New function.
4378 * script.h (class Script_options): Add symbol_definitions_ and
4379 symbol_references_ fields.
4380 (Script_options::referenced_const_iterator): New type.
4381 (Script_options::referenced_begin): New function.
4382 (Script_options::referenced_end): New function.
4383 (Script_options::is_referenced): New function.
4384 (Script_options::any_unreferenced): New function.
4385 * script-c.h (script_symbol): Declare.
4386 * yyscript.y (exp): Call script_symbol.
4387 * symtab.cc: Include "script.h".
4388 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4389 Change all callers. Check symbols referenced by scripts.
4390 (Symbol_table::add_undefined_symbols_from_command_line): Add
4391 layout parameter. Change all callers.
4392 (Symbol_table::do_add_undefined_symbols_from_command_line):
4393 Likewise. Break out loop body. Check symbols referenced by
4394 scripts.
4395 (Symbol_table::add_undefined_symbol_from_command_line): New
4396 function broken out of
4397 do_add_undefined_symbols_from_command_line.
4398 * symtab.h (class Symbol_table): Update declarations.
4399 * archive.cc: Include "layout.h".
4400 (Archive::should_include_member): Add layout parameter. Change
4401 all callers. Check for symbol mentioned in expression.
4402 * archive.h (class Archive): Update declaration.
4403 * object.cc (Sized_relobj::do_should_include_member): Add layout
4404 parameter.
4405 * object.h (Object::should_include_member): Add layout parameter.
4406 Change all callers.
4407 (Object::do_should_include_member): Add layout parameter.
4408 (class Sized_relobj): Update declaration.
4409 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4410 parameter.
4411 * dynobj.h (class Sized_dynobj): Update declaration.
4412 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4413 layout parameter.
4414 * plugin.h (class Sized_pluginobj): Update declaration.
4415
4416 2010-08-02 Ian Lance Taylor <iant@google.com>
4417
4418 PR 11866
4419 * output.cc (Output_segment::set_offset): Search for the first and
4420 last sections rather than assuming that the list is in order.
4421 (Output_segment::find_first_and_last_list): New function.
4422 * output.h (class Output_segment): Update declarations.
4423 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4424 (relro_strip_test_SOURCES): New variable.
4425 (relro_strip_test_DEPENDENCIES): New variable.
4426 (relro_strip_test_LDFLAGS): New variable.
4427 (relro_strip_test_LDADD): New variable.
4428 (relro_strip_test.so): New target.
4429
4430 2010-08-02 Ian Lance Taylor <iant@google.com>
4431
4432 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4433 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4434 (Target_i386::got_tlsdesc_section): New function.
4435 (Target_i386::got_section): Create space for GOT entries for
4436 TLSDESC relocations.
4437 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4438 R_386_TLS_GOTDESC.
4439 (Target_i386::Scan::global): Likewise.
4440 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4441 using TLSDESC GOT.
4442 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4443 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4444 (Target_x86_64::got_tlsdesc_section): New function.
4445 (Target_x86_64::got_section): Create space for GOT entries for
4446 TLSDESC relocations.
4447 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4448 R_386_TLS_GOTDESC.
4449 (Target_x86_64::Scan::global): Likewise.
4450 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4451 using TLSDESC GOT.
4452
4453 2010-08-02 Ian Lance Taylor <iant@google.com>
4454
4455 * testsuite/final_layout.sh: Use dc to convert from hex to
4456 decimal.
4457
4458 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4459
4460 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4461 paramter to the call to gold::gc_process_relocs.
4462 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4463 paramter to the call to gold::gc_process_relocs.
4464 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4465 parameter to the call to gold::gc_process_relocs.
4466 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4467 template parameter to the call to gold::gc_process_relocs.
4468 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4469 paramter to the call to gold::gc_process_relocs.
4470 * gc.h (get_embedded_addend_size): New function.
4471 (gc_process_relocs): Save the size of the reloc for use by ICF.
4472 * icf.cc (get_section_contents): Get the addend from the text section
4473 for SHT_REL relocation sections.
4474 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4475 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4476 * int_encoding.h (read_from_pointer): New overloaded function.
4477 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4478 * testsuite/icf_sht_rel_addend_test.sh: New file.
4479 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4480 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4481
4482 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4483
4484 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4485 * Makefile.in: Regenerate.
4486 * testsuite/Makefile.in: Regenerate.
4487
4488 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4489
4490 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4491 * gold/testsuite/debug_msg.cc: Likewise.
4492 * gold/testsuite/odr_violation1.cc
4493 * gold/testsuite/odr_violation2.cc
4494
4495 2010-07-21 Cary Coutant <ccoutant@google.com>
4496
4497 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4498 string, and length fields.
4499 (Output_merge_string::Merged_strings_list): New type.
4500 (Output_merge_string::Merged_strings_lists): New typedef.
4501 (Output_merge_string): Replace merged_strings_ with
4502 merged_strings_lists_.
4503 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4504 Merged_strings_list per input object and section. Don't store pointer
4505 to the string. Don't store length with each merged string entry.
4506 (Output_merge_string::finalize_merged_data): Loop over list of merged
4507 strings lists. Recompute length of each merged string.
4508
4509 2010-07-15 Cary Coutant <ccoutant@google.com>
4510
4511 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4512 here.
4513
4514 2010-07-14 Ian Lance Taylor <iant@google.com>
4515
4516 * descriptors.cc (Descriptors::open): Report correct name in error
4517 message.
4518
4519 2010-07-13 Doug Kwan <dougkwan@google.com>
4520
4521 * arm.cc (Arm_input_section::Arm_input_section): For a
4522 SHT_ARM_EXIDX section, always keeps the input sections.
4523 (Arm_input_section::set_exidx_section_link): New method.
4524 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4525 has_errors_ to false.
4526 (Arm_exidx_input_section::has_errors,
4527 Arm_exidx_input_section::set_has_errors): New methods.
4528 (Arm_exidx_input_section::has_errors_): New data member.
4529 (Arm_relobj::get_exidx_shndx_list): New method.
4530 (Arm_output_section::append_text_sections_to_list): Do not skip
4531 section without SHF_EXECINSTR.
4532 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4533 errors.
4534 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4535 section header. Make error messages more verbose. Check for
4536 a non-executable section linked to an EXIDX section.
4537 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4538 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4539 check that there is no deferred EXIDX section if we exit early.
4540 Instead of not making an EXIDX section in case of an error, make one
4541 and set the has_errors flag of it.
4542 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4543 in a relocatable link.
4544 (Target_arm::do_relax): Look for the EXIDX output section instead of
4545 assuming that it is called .ARM.exidx.
4546 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4547 section list. Do not check for SHF_EXECINSTR section flags but
4548 skip any input section with errors.
4549 * output.cc (Output_section::Output_section): Initialize
4550 always_keeps_input_sections_ to false.
4551 (Output_section::add_input_section): Check for
4552 always_keeps_input_sections_.
4553 * output.h (Output_section::always_keeps_input_sections,
4554 Output_section::set_always_keeps_input_sections): New methods.
4555 (Output_section::always_keeps_input_sections): New data member.
4556
4557 2010-07-13 Rafael Espindola <espindola@google.com>
4558
4559 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4560 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4561
4562 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4563 Ian Lance Taylor <iant@google.com>
4564
4565 * output.h (Output_section_lookup_maps::add_merge_section):
4566 Correct check of whether value was inserted.
4567 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4568 (Output_section_lookup_maps::add_relaxed_input_section):
4569 Likewise.
4570 * arm.cc (Target_arm::got_section): Remove used local os.
4571 * i386.cc (Target_i386::got_section): Likewise.
4572 * x86_64.cc (Target_x86_64::got_section): Likewise.
4573 * sparc.cc (Target_sparc::got_section): Likewise.
4574 (Target_sparc::relocate): Remove unused local have_got_offset.
4575 * powerpc.cc (Target_powerpc::relocate): Likewise.
4576
4577 2010-07-13 Ian Lance Taylor <iant@google.com>
4578
4579 * compressed_output.cc (zlib_decompress): Fix signature in
4580 !HAVE_ZLIB_H case.
4581
4582 * archive.cc (Archive::include_member): Unlock an external member
4583 of a thin archive. Don't bother to delete an object we know is
4584 NULL.
4585
4586 2010-07-12 Cary Coutant <ccoutant@google.com>
4587
4588 * compressed_output.cc (zlib_decompress): New function.
4589 (get_uncompressed_size): New function.
4590 (decompress_input_section): New function.
4591 * compressed_output.h (get_uncompressed_size): New function.
4592 (decompress_input_section): New function.
4593 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4594 Handle compressed debug sections.
4595 * layout.cc (is_compressed_debug_section): New function.
4596 (Layout::output_section_name): Map compressed section names to
4597 canonical names.
4598 * layout.h (is_compressed_debug_section): New function.
4599 (is_debug_info_section): Recognize compressed debug sections.
4600 * merge.cc: Include compressed_output.h.
4601 (Output_merge_data::do_add_input_section): Handle compressed
4602 debug sections.
4603 (Output_merge_string::do_add_input_section): Handle compressed
4604 debug sections.
4605 * object.cc: Include compressed_output.h.
4606 (Sized_relobj::Sized_relobj): Initialize new data members.
4607 (build_compressed_section_map): New function.
4608 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4609 * object.h (Object::section_is_compressed): New method.
4610 (Object::do_section_is_compressed): New method.
4611 (Sized_relobj::Compressed_section_map): New type.
4612 (Sized_relobj::do_section_is_compressed): New method.
4613 (Sized_relobj::compressed_sections_): New data member.
4614 * output.cc (Output_section::add_input_section): Handle compressed
4615 debug sections.
4616 * reloc.cc: Include compressed_output.h.
4617 (Sized_relobj::write_sections): Handle compressed debug sections.
4618
4619 2010-07-08 Cary Coutant <ccoutant@google.com>
4620
4621 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4622 weak when resolving to a dynamic def.
4623 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4624 for weak undef/dynamic def cases. Adjust callers.
4625 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4626 undef_binding_weak_.
4627 (Symbol_table::sized_write_globals): Adjust symbol binding.
4628 (Symbol_table::sized_write_symbol): Add binding parameter.
4629 * symtab.h (Symbol::set_undef_binding): New method.
4630 (Symbol::is_undef_binding_weak): New method.
4631 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4632 (Symbol_table::should_override): Add new parameter.
4633 (Symbol_table::sized_write_symbol): Add new parameter.
4634
4635 * testsuite/weak_undef_file1.cc: Add new test case.
4636 * testsuite/weak_undef_file2.cc: Fix header comment.
4637 * testsuite/weak_undef_test.cc: Add new test case.
4638
4639 2010-06-29 Doug Kwan <dougkwan@google.com>
4640
4641 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4642 Initialize USE_SYMBOL_.
4643 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4644 definition.
4645 (Arm_reloc_property::uses_symbol_): New data member declaration.
4646 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4647 uses symbol value and symbol is undefined but not weakly undefined.
4648
4649 2010-06-28 Rafael Espindola <espindola@google.com>
4650
4651 * plugin.cc (Plugin::load): Use dlerror.
4652
4653 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4654
4655 * symtab.cc (detect_odr_violations): When reporting an ODR
4656 violation, report an object where the symbol is defined.
4657
4658 2010-06-25 Doug Kwan <dougkwan@google.com>
4659
4660 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4661 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4662 definition.
4663 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4664 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4665 target hook to detect function points.
4666 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4667 * icf.h (Icf::check_section_for_function_pointers): Change type of
4668 parameter SECTION_NAME to const reference to std::string. Use
4669 target hook to determine if section may have unsafe pointers.
4670 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4671 method definition.
4672
4673 2010-06-21 Rafael Espindola <espindola@google.com>
4674
4675 * fileread.cc (Input_file::find_fie): New
4676 (Input_file::open): Use Input_file::find_fie.
4677 * fileread.h (Input_file::find_fie): New
4678 * plugin.cc (set_extra_library_path): New.
4679 (Plugin::load): Add set_extra_library_path to the transfer vector.
4680 (Plugin_manager::set_extra_library_path): New.
4681 (Plugin_manager::add_input_file): Use the extra search path if set.
4682 (set_extra_library_path(): New.
4683 * plugin.h (Plugin_manager): Add set_extra_library_path and
4684 extra_search_path_.
4685
4686 2010-06-19 Cary Coutant <ccoutant@google.com>
4687
4688 * layout.cc (gdb_sections): Add .debug_types.
4689 (lines_only_debug_sections): Likewise.
4690
4691 2010-06-18 Rafael Espindola <espindola@google.com>
4692
4693 * plugin.cc (add_input_file,add_input_library)
4694 (Plugin_manager::add_input_file): Make filename arguments const.
4695 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4696 const.
4697
4698 2010-06-16 Doug Kwan <dougkwan@google.com>
4699
4700 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4701 .ARM.attributes section if we have not merged any input
4702 attributes sections.
4703
4704 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4705
4706 * arm.cc: Allow combining objects with no EABI version
4707 information.
4708
4709 2010-06-15 Rafael Espindola <espindola@google.com>
4710
4711 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4712
4713 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4714
4715 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4716 (struct iovec): Correct !HAVE_READV definition.
4717
4718 2010-06-10 Cary Coutant <ccoutant@google.com>
4719
4720 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4721 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4722 reloc sections.
4723 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4724
4725 PR 11683
4726 * symtab.h (Symbol::is_placeholder): New member function.
4727 * target-reloc.h (relocate_section): Check for placeholder symbols.
4728
4729 * testsuite/Makefile.am (plugin_test_8): New test.
4730 (plugin_test_9): New test.
4731 * testsuite/Makefile.in: Regenerate.
4732
4733 2010-06-09 Nick Clifton <nickc@redhat.com>
4734
4735 * yyscript.y (input_list_element): Allow strings prefixed with
4736 the '-' character. Treat these as libraries.
4737 * script.cc (script_add_library): New function. Adds a library
4738 specified by "-l<name>" found in an input script.
4739 * script-c.h: Add prototype for script_add_library.
4740
4741 2010-06-07 Doug Kwan <dougkwan@google.com>
4742
4743 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4744 Restrict stub-group size to be within long conditional branch
4745 range when working around cortex-A8 erratum.
4746
4747 2010-06-07 Damien Diederen <dd@crosstwine.com>
4748
4749 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4750 #ifdef typo.
4751
4752 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4753
4754 PR gold/11658
4755 * output.cc
4756 (Output_section::Input_section_sort_entry::compare_section_ordering):
4757 Change to return non-zero correctly.
4758 (Output_section::Input_section_sort_section_order_index_compare
4759 ::operator()): Change to fix ambiguity in comparisons.
4760
4761 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4762
4763 * gold.h (is_wildcard_string): New function.
4764 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4765 (Layout::layout_eh_frame): Ditto.
4766 (Layout::find_section_order_index): New method.
4767 (Layout::read_layout_from_file): New method.
4768 * layout.h (Layout::find_section_order_index): New method.
4769 (Layout::read_layout_from_file): New method.
4770 (Layout::input_section_position_): New private member.
4771 (Layout::input_section_glob_): New private member.
4772 * main.cc (main): Call read_layout_from_file here.
4773 * options.h (--section-ordering-file): New option.
4774 * output.cc (Output_section::input_section_order_specified_): New
4775 member.
4776 (Output_section::Output_section): Initialize new member.
4777 (Output_section::add_input_section): Add new parameter.
4778 Keep input sections when --section-ordering-file is used.
4779 (Output_section::set_final_data_size): Sort input sections when
4780 section ordering file is specified.
4781 (Output_section::Input_section_sort_entry): Add new parameter.
4782 Check sorting type.
4783 (Output_section::Input_section_sort_entry::compare_section_ordering):
4784 New method.
4785 (Output_section::Input_section_sort_compare::operator()): Change to
4786 consider section_order_index.
4787 (Output_section::Input_section_sort_init_fini_compare::operator()):
4788 Change to consider section_order_index.
4789 (Output_section::Input_section_sort_section_order_index_compare
4790 ::operator()): New method.
4791 (Output_section::sort_attached_input_sections): Change to sort
4792 according to section order when specified.
4793 (Output_section::add_input_section<32, true>): Add new parameter.
4794 (Output_section::add_input_section<64, true>): Add new parameter.
4795 (Output_section::add_input_section<32, false>): Add new parameter.
4796 (Output_section::add_input_section<64, false>): Add new parameter.
4797 * output.h (Output_section::add_input_section): Add new parameter.
4798 (Output_section::input_section_order_specified): New
4799 method.
4800 (Output_section::set_input_section_order_specified): New method.
4801 (Input_section::Input_section): Initialize section_order_index_.
4802 (Input_section::section_order_index): New method.
4803 (Input_section::set_section_order_index): New method.
4804 (Input_section::section_order_index_): New member.
4805 (Input_section::Input_section_sort_section_order_index_compare): New
4806 struct.
4807 (Output_section::input_section_order_specified_): New member.
4808 * script-sections.cc (is_wildcard_string): Delete and move modified
4809 method to gold.h.
4810 (Output_section_element_input::Output_section_element_input): Modify
4811 call to is_wildcard_string.
4812 (Output_section_element_input::Input_section_pattern
4813 ::Input_section_pattern): Ditto.
4814 (Output_section_element_input::Output_section_element_input): Ditto.
4815 * testsuite/Makefile.am (final_layout): New test case.
4816 * testsuite/Makefile.in: Regenerate.
4817 * testsuite/final_layout.cc: New file.
4818 * testsuite/final_layout.sh: New file.
4819
4820 2010-06-01 Rafael Espindola <espindola@google.com>
4821
4822 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4823
4824 2010-06-01 Rafael Espindola <espindola@google.com>
4825
4826 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4827 visibility of symbols.
4828
4829 2010-05-27 Doug Kwan <dougkwan@google.com>
4830
4831 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4832 from start of output section instead of address for a local symbol
4833 in a merged or relaxed section when doing a relocatable link.
4834
4835 2010-05-26 Rafael Espindola <espindola@google.com>
4836
4837 PR 11604
4838 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4839 adding sections the garbage collector removed.
4840 * gold/testsuite/Makefile.am: Add test.
4841 * gold/testsuite/Makefile.in: Regenerate.
4842 * gold/testsuite/plugin_test_7.sh: New.
4843 * gold/testsuite/plugin_test_7_1.c: New.
4844 * gold/testsuite/plugin_test_7_2.c: New.
4845
4846 2010-05-26 Rafael Espindola <espindola@google.com>
4847
4848 * script-sections.cc (Output_section_definition::set_section_addresses):
4849 Check for --section-start.
4850
4851 2010-05-26 Doug Kwan <dougkwan@google.com>
4852
4853 * arm.cc (Arm_scan_relocatable_relocs): New class.
4854 (Target_arm::relocate_special_relocatable): New method.
4855 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4856 (Arm_relocate_functions::thumb_branch_common): Same.
4857 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4858 instead of Default_scan_relocatable_relocs.
4859 * target-reloc.h (relocate_for_relocatable): Let target handle
4860 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4861 * target.h (Sized_target::relocate_special_relocatable): New method.
4862
4863 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4864
4865 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4866
4867 2010-05-23 Doug Kwan <dougkwan@google.com>
4868
4869 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4870 instead of a cast.
4871 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4872 with a direct branch, not a conditional branch, to a stub.
4873 * merge.cc (Output_merge_base::record_input_section): New method
4874 defintion.
4875 (Output_merge_data::do_add_input_section): Record input section if
4876 keeps-input-sections flag is set.
4877 (Output_merge_string::do_add_input_section): Ditto.
4878 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4879 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4880 INPUT_SECTIONS_.
4881 (Output_merge_base::keeps_input_sections,
4882 Output_merge_base::set_keeps_input_sections,
4883 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4884 method definitions.
4885 (Output_merge_base::Input_sections): New type declaration.
4886 (Output_merge_base::input_sections_begin,
4887 Output_merge_base::input_sections_end,
4888 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4889 (Output_merge_base::bool keeps_input_sections_,
4890 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4891 Output_merge_base::input_sections_): New data members.
4892 (Output_merge_data::do_set_keeps_input_sections): New method
4893 defintion.
4894 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4895 * output.cc (Output_section::Input_section::relobj): Move method
4896 defintion from class declaration to here and handle merge sections.
4897 (Output_section::Input_section::shndx): Ditto.
4898 (Output_section::Output_section): Remove initializations of removed
4899 data members and initialize new data member LOOKUP_MAPS_.
4900 (Output_section::add_input_section): Set keeps-input-sections flag
4901 for a newly created merge output section as appropriate. Adjust code
4902 to use Output_section_lookup_maps class.
4903 (Output_section::add_relaxed_input_section): Adjst code for lookup
4904 maps code refactoring.
4905 (Output_section::add_merge_input_section): Add a new parameter
4906 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4907 class. If adding input section to a newly created merge output
4908 section fails, remove the new merge section.
4909 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4910 Adjust code for use of the Output_section_lookup_maps class.
4911 (Output_section::find_merge_section): Ditto.
4912 (Output_section::build_lookup_maps): New method defintion.
4913 (Output_section::find_relaxed_input_section): Adjust code to use
4914 Output_section_lookup_maps class.
4915 (Output_section::get_input_sections): Export merge sections. Adjust
4916 code to use Output_section_lookup_maps class.
4917 (Output_section:::add_script_input_section): Adjust code to use
4918 Output_section_lookup_maps class. Update lookup maps for merge
4919 sections also.
4920 (Output_section::discard_states): Use Output_section_lookup_maps.
4921 (Output_section::restore_states): Same.
4922 * output.h (Merge_section_properties): Move class defintion out of
4923 Output_section.
4924 (Output_section_lookup_maps): New class.
4925 (Output_section::Input_section::is_merge_section): New method
4926 defintion.
4927 (Output_section::Input_section::relobj): Move defintion out of class
4928 defintion. Declare method only.
4929 (Output_section::Input_section::shndx): Ditto.
4930 (Output_section::Input_section::output_merge_base): New method defintion.
4931 (Output_section::Input_section::u2_.pomb): New union field.
4932 (Output_section::Merge_section_by_properties_map,
4933 Output_section::Output_section_data_by_input_section_map,
4934 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4935 Remove types.
4936 (Output_section::add_merge_input_section): Add new parameter
4937 KEEPS_INPUT_SECTIONS.
4938 (Output_section::build_lookup_maps): New method declaration.
4939 (Output_section::merge_section_map_,
4940 Output_section::merge_section_by_properties_map_,
4941 Output_section::relaxed_input_section_map_,
4942 Output_section::is_relaxed_input_section_map_valid_): Remove data
4943 members.
4944 (Output_section::lookup_maps_): New data member.
4945
4946 2010-05-21 Doug Kwan <dougkwan@google.com>
4947
4948 PR gold/11619
4949 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4950 avoid a compilation error.
4951
4952 2010-05-19 Rafael Espindola <espindola@google.com>
4953
4954 * script-sections.cc (Output_section_definition::allocate_to_segment):
4955 Update the phdrs_list even when the output section is NULL.
4956 * testsuite/Makefile.am: Add test.
4957 * testsuite/Makefile.in: Regenerate.
4958 * testsuite/script_test_9.cc: New.
4959 * testsuite/script_test_9.sh: New.
4960 * testsuite/script_test_9.t: New.
4961
4962 2010-05-19 Doug Kwan <dougkwan@google.com>
4963
4964 * arm.cc (Arm_input_section::original_size): New method.
4965 (Arm_input_section::do_addralign): Add a cast.
4966 (Arm_input_section::do_output_offset): Remove static cast.
4967 (Arm_input_section::original_addralign,
4968 Arm_input_section::original_size_): Change type to uint32_t.
4969 (Arm_input_section::init): Add safe casts for section alignment
4970 and size.
4971 (Arm_input_section::set_final_data_size): Do not set address and
4972 offset of stub table.
4973 (Arm_output_section::fix_exidx_coverage): Change use of of
4974 Output_section::Simple_input_section to that of
4975 Output_section::Input_section.
4976 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4977 except for the first pass.
4978 * output.cc (Output_section::get_input_sections): Change type of
4979 input_sections to std::list<Input_section>.
4980 (Output_section::add_script_input_section): Rename from
4981 Output_section::add_simple_input_section. Change type of SIS
4982 parameter from Simple_input_section to Input_section.
4983 * output.h (Output_section::Simple_input_section): Remove class.
4984 (Output_section::Input_section): Change class visibility to public.
4985 (Output_section::Input_section::addralign): Use stored alignments
4986 for special input sections if set.
4987 (Output_section::Input_section::set_addralign): New method.
4988 (Output_section::get_input_sections): Change parameter type from
4989 list of Simple_input_section to list of Input_section.
4990 (Output_section::add_script_input_section): Rename from
4991 Output_section::add_simple_input_section. Change first parameter's
4992 type from Simple_input_section to Input_section and remove the
4993 second and third parameters.
4994 * script-sections.cc (Input_section::Input_section_list): Change
4995 type to list of Output_section::Input_section/
4996 (Input_section_info::Input_section_info): Change parameter type of
4997 INPUT_SECTION to Output_section::Input_section.
4998 (Input_section_info::input_section): Change return type.
4999 (Input_section_info::input_section_): Change type to
5000 Output_section::Input_section.
5001 (Output_section_element_input::set_section_addresses): Adjust code
5002 to use Output_section::Input_section instead of
5003 Output_section::Simple_input_section. Adjust code for renaming
5004 of Output_section::add_simple_input_section.
5005 (Orphan_output_section::set_section_addresses): Ditto.
5006
5007 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5008
5009 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5010 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5011
5012 2010-05-18 Rafael Espindola <espindola@google.com>
5013
5014 * options.cc (General_options::finalize): Handle -nostdlib.
5015 * options.h (nostdlib): New option.
5016 * script.cc (script_add_search_dir): Handle -nostdlib.
5017
5018 2010-05-12 Doug Kwan <dougkwan@google.com>
5019
5020 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5021 attributes section only if there no attributes section after merging.
5022 (Target_arm::merge_object_attributes): Move value of
5023 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5024 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5025 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5026 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5027 and arm_attr_merge_7.stdout.
5028 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5029 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5030 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5031 arm_attr_merge_7b.o): New rules.
5032 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5033 arm_attr_merge_7
5034 * testsuite/Makefile.in: Regenerate.
5035 * testsuite/arm_attr_merge.sh: New file.
5036 * testsuite/arm_attr_merge_[67][ab].s: Same.
5037
5038 2010-05-05 Nick Clifton <nickc@redhat.com>
5039
5040 * po/es.po: Updated Spanish translation.
5041
5042 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5043
5044 * Makefile.am (install-exec-local): Properly install gold as
5045 default cross linker.
5046 * Makefile.in: Regenerated.
5047
5048 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5049 Nick Clifton <nickc@redhat.com>
5050
5051 * configure.ac (install_as_default): Define and set to false
5052 unless --enable-gold or --enable-gold=both/gold has been
5053 specified.
5054 * configure: Regenerate.
5055
5056 * Makefile.am (install-exec-local): Install the executable as
5057 'ld.gold'. If install_as_default is true then also install it as
5058 'ld'.
5059 * Makefile.in: Regenerated.
5060
5061 2010-04-24 Ian Lance Taylor <iant@google.com>
5062
5063 * layout.cc (Layout::layout_reloc): In relocatable link don't
5064 combine reloc sections for grouped sections.
5065
5066 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5067
5068 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5069 sections that are not ordinary to icf.
5070 * icf.cc (get_section_contents): Handle relocation pointing to section
5071 with no object or shndx information.
5072 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5073 * testsuite/Makefile.in: Regenerate.
5074 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5075 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5076
5077 2010-04-22 Ian Lance Taylor <iant@google.com>
5078
5079 * expression.cc (Expression::Expression_eval_info): Add
5080 result_alignment_pointer field.
5081 (Expression::eval_with_dot): Add result_alignment_pointer
5082 parameter. Change all callers.
5083 (Expression::eval_maybe_dot): Likewise.
5084 (class Binary_expression): Add alignment_pointer parameter to
5085 left_value and right_value. Change all callers.
5086 (BINARY_EXPRESSION): Set result alignment.
5087 (class Trinary_expression): Add alignment_pointer parameter to
5088 arg2_value and arg3_value. Change all callers.
5089 (Trinary_cond::value): Set result alignment.
5090 (Max_expression::value, Min_expression::value): Likewise.
5091 (Align_expression::value): Likewise.
5092 * script-sections.cc (class Sections_element): Add dot_alignment
5093 parameter to set_section_addresses virtual function. Update
5094 instantiations.
5095 (class Output_section_element): Likewise.
5096 (Script_sections::create_segments): Add dot_alignment parameter.
5097 Change all callers.
5098 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5099 (Script_sections::set_phdrs_clause_addresses): Likewise.
5100 * script-sections.h: Update declarations.
5101 * script.h: Update declarations.
5102 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5103 min_p_align.
5104 * testsuite/script_test_3.t: Set large alignment.
5105 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5106 segment has expected alignment.
5107
5108 2010-04-22 Nick Clifton <nickc@redhat.com>
5109
5110 * po/gold.pot: Updated by the Translation project.
5111 * po/vi.po: Updated Vietnamese translation.
5112
5113 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5114
5115 * testsuite/Makefile.am (check_PROGRAMS): Add
5116 icf_virtual_function_folding_test.
5117 * testsuite/Makefile.in: Regenerated.
5118
5119 2010-04-15 Andrew Haley <aph@redhat.com>
5120
5121 * options.h (merge_exidx_entries): New option.
5122 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5123 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5124 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5125 (Target_arm::merge_exidx_entries): New function.
5126 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5127 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5128 to Arm_exidx_fixup constructor.
5129 Add new arg, merge_exidx_entries.
5130 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5131 Arm_output_section::fix_exidx_coverage.
5132
5133 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5134
5135 * icf.cc (get_section_contents): Check for preemptible functions.
5136 Ignore addend when appropriate.
5137 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5138 section folded.
5139 (add_from_relobj): Check for section folded.
5140 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5141 * symtab.h (should_add_dynsym_entry): Add new parameter.
5142 * target-reloc.h (scan_relocs): Check for section folded.
5143 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5144 Check reloc types for function pointers in shared objects.
5145 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5146 case.
5147 (icf_preemptible_functions_test): New test case.
5148 (icf_string_merge_test): New test case.
5149 * testsuite.Makefile.in: Regenerate.
5150 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5151 bar_glob. Refactor code.
5152 * testsuite/icf_preemptible_functions_test.cc: New file.
5153 * testsuite/icf_preemptible_functions_test.sh: New file.
5154 * testsuite/icf_string_merge_test.cc: New file.
5155 * testsuite/icf_string_merge_test.sh: New file.
5156 * testsuite/icf_virtual_function_folding_test.cc: New file.
5157 * testsuite/icf_virtual_function_folding_test.sh: New file.
5158
5159 2010-04-14 Doug Kwan <dougkwan@google.com>
5160
5161 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5162 for local symbol recounting if we remove a section due to ICF.
5163 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5164 there are no regular objects in input.
5165
5166 2010-04-13 Doug Kwan <dougkwan@google.com>
5167
5168 * arm.cc (Arm_input_section::set_final_data_size): Compute
5169 accurate final data size instead of using current data size.
5170
5171 2010-04-09 Doug Kwan <dougkwan@google.com>
5172
5173 * layout.cc (Layout::choose_output_section): Handle script section
5174 types.
5175 (Layout::make_output_section_for_script): Add section type parameter.
5176 Handle script section types.
5177 * layout.h (Layout::make_output_section_for_script): Add section
5178 type parameter.
5179 * output.cc (Output_section::Output_section): Initialize data member
5180 is_noload_.
5181 (Output_section::do_reset_address_and_file_offset): Do not set address
5182 to 0 if section is a NOLOAD section.
5183 * output.h (Output_section::is_noload): New method.
5184 (Output_section::set_is_noload): Ditto.
5185 (Output_section::is_noload_): New data member.
5186 * script-c.h (Script_section_type): New enum type.
5187 (struct Parser_output_section_header): Add new file section_type.
5188 * script-sections.cc (Sections_element::output_section_name): Add
5189 parameter for returning script section type.
5190 (Output_section_definition::output_section_name): Ditto.
5191 (Output_section_definition::section_type)P; New method.
5192 (Output_section_definiton::script_section_type_name): Ditto.
5193 (Output_section_definition::script_section_type_): New data member.
5194 (Output_section_definition::Output_section_definition): Initialize
5195 data member Output_section_definition::script_section_type_.
5196 (Output_section_definition::create_sections): Pass script section type
5197 to Layout::make_output_section_for_script.
5198 (Output_section_definition::output_section_name): Return script
5199 section type to caller.
5200 (Output_section_definition::set_section_address): Do not advance
5201 dot value and load address if section type is NOLOAD. Set address
5202 of NOLOAD sections regardless of section flags.
5203 (Output_section_definition::print): Print section type if it is
5204 not SCRIPT_SECTION_TYPE_NONE.
5205 (Output_section_definition::section_type): New method.
5206 (Output_section_definition::script_section_type_name): Ditto.
5207 (Script_sections::output_section_name): Add new parameter
5208 PSECTION_TYPE for returning script section type. Pass it to
5209 section elements. Handle discard sections.
5210 (Sort_output_sections::operator()): Handle NOLOAD sections.
5211 * script-sections.h (Script_sections::Section_type): New enum type.
5212 (Script_sections::output_section_name): Add a new parameter for
5213 returning script section type.
5214 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5215 INFO and NOLOAD.
5216 * yyscript.y (union): Add new field SECTION_TYPE.
5217 (COPY, DSECT, INFO, NOLOAD): New tokens.
5218 (opt_address_and_section_type): Change type to output_section_header.
5219 (section_type): New non-terminal
5220 (section_header): Handle section type.
5221 (opt_address_and_section_type): Return section type value.
5222
5223 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5224
5225 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5226 * testsuite/plugin_common_test_2.c (foo): Likewise.
5227
5228 2010-04-08 Doug Kwan <dougkwan@google.com>
5229
5230 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5231 Output_merge_data.
5232 * output.cc (Output_section::add_merge_input_section): Simplify
5233 code and return status of Output_merge_base::add_input_section.
5234 Update merge section map only if Output_merge_base::add_input_section
5235 returns true.
5236
5237 2010-04-07 Doug Kwan <dougkwan@google.com>
5238
5239 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5240 if section is marked as containing instructions but has no mapping
5241 symbols.
5242 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5243 correct section index.
5244 (Arm_relobj::find_linked_text_section): Ditto.
5245
5246 2010-04-07 Cary Coutant <ccoutant@google.com>
5247
5248 * archive.cc (include_member): Destroy Read_symbols_data object before
5249 releasing file.
5250 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5251 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5252 (Read_symbols_data::~Read_symbols_data) New destructor.
5253 (Section_relocs::Section_relocs) New constructor.
5254 (Section_relocs::~Section_relocs) New destructor.
5255 (Read_relocs_data::Read_relocs_data) New constructor.
5256 (Read_relocs_data::~Read_relocs_data) New destructor.
5257 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5258 pointers to NULL after deleting.
5259
5260 2010-04-07 Doug Kwan <dougkwan@google.com>
5261
5262 * arm.cc: Replace "endianity" with "endianness" in comments.
5263 (Arm_exidx_cantunwind): Ditto.
5264 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5265 (Arm_relobj::merge_flags_and_attributes): New method.
5266 (Arm_relobj::merge_flags_and_attributes_): New data member.
5267 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5268 (Arm_relobj::scan_sections_for_stubs): Ditto.
5269 (Arm_relobj::do_read_symbols): Check to see if we really want to
5270 merge processor-specific flags and attributes. Exit early if
5271 an object is empty except for section names and the undefined symbol.
5272 (Target_arm::do_finalize_sections): Move check for ELF format to
5273 Arm_relobj::do_read_symbols. Merge processor specific flags and
5274 attributes from a regular object only when we have determined that
5275 it is aapropriate. Do not create an .ARM.attributes section in
5276 output if there is no regular input object.
5277 (Target_arm::merge_processor_specific_flags): Check
5278 --warn-mismatch before printing any error.
5279 (Target_arm::merge_object_attributes): Ditto.
5280 * gold.cc (queue_middle_tasks): Handle the case in which there is
5281 no regular object in input.
5282 * options.cc (General_options::parse_EB): New method.
5283 (General_options::parse_EL): Same.
5284 (General_options::General_options): Initialize endianness_.
5285 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5286 New options.
5287 (General_options::Endianness): New enum.
5288 (General_options::endianness): New method.
5289 (General_options::endianness_): New data member.
5290 * parameters.cc (Parameters::set_options): Check target endianness.
5291 (Parameters::set_target_once): Ditto.
5292 (Parameters::check_target_endianness): New method.
5293 (parameters_force_valid_target): If either -EL or -EB is specified,
5294 use it to define endianness of default target.
5295 * parameters.h (Parameters::check_target_endianness): New method
5296 declaration.
5297 * target.h (class Target): Change "endianity" to "endianness"
5298 in comments.
5299
5300 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5301
5302 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5303 * configure: Regenerate.
5304 * Makefile.in: Regenerate.
5305 * testsuite/Makefile.in: Regenerate.
5306
5307 2010-04-06 Cary Coutant <ccoutant@google.com>
5308
5309 gcc PR lto/42757
5310 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5311 prevailing definitions of common symbols.
5312 * testsuite/plugin_test_6.sh: New test case.
5313 * testsuite/plugin_common_test_1.c: New test case.
5314 * testsuite/plugin_common_test_2.c: New test case.
5315 * testsuite/Makefile.am (plugin_test_6): New test case.
5316 * testsuite/Makefile.in: Regenerate.
5317
5318 2010-04-06 Nick Clifton <nickc@redhat.com>
5319
5320 * po/vi.po: New Vietnamese translation.
5321
5322 2010-03-30 Doug Kwan <dougkwan@google.com>
5323
5324 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5325
5326 2010-03-25 Doug Kwan <dougkwan@google.com>
5327
5328 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5329 to avoid a conversion warning on a 32-bit host.
5330
5331 2010-03-24 Ian Lance Taylor <iant@google.com>
5332
5333 * testsuite/script_test_3.t: Add a TLS segment.
5334 * testsuite/Makefile.am (check_PROGRAMS): Add
5335 tls_phdrs_script_test.
5336 (tls_phdrs_script_test_SOURCES): Define.
5337 (tls_phdrs_script_test_DEPENDENCIES): Define.
5338 (tls_phdrs_script_test_LDFLAGS): Define.
5339 (tls_phdrs_script_test_LDADD): Define.
5340 * testsuite/Makefile.in: Rebuild.
5341
5342 2010-03-23 Cary Coutant <ccoutant@google.com>
5343
5344 * fileread.cc (find_or_make_view): Fix comment.
5345
5346 2010-03-23 Ian Lance Taylor <iant@google.com>
5347
5348 * script-sections.cc (class Orphan_section_placement): Define
5349 PLACE_TLS and PLACE_TLS_BSS.
5350 (Orphan_section_placement::Orphan_section_placement): Initialize
5351 new places.
5352 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5353 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5354 (tls_script_test_SOURCES): Define.
5355 (tls_script_test_DEPENDENCIES): Define.
5356 (tls_script_test_LDFLAGS): Define.
5357 (tls_script_test_LDADD): Define.
5358 * testsuite/Makefile.in: Rebuild.
5359
5360 2010-03-22 Doug Kwan <dougkwan@google.com>
5361
5362 * arm.cc (Arm_relocate_functions::abs8,
5363 Arm_relocate_functions::abs16): Use correct check for overflow
5364 specified in the ARM ELF specs.
5365 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5366 target of a BLX instruction specially.
5367 (Reloc_stub::stub_type_for_reloc): Ditto.
5368 (Relocate::relocate): Use symbolic names instead of numeric relocation
5369 codes to report error.
5370 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5371 workaround.
5372 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5373 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5374 thumb2_blx_out_of_range.stdout
5375 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5376 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5377 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5378 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5379 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5380 thumb2_blx_in_range, thumb2_blx_in_range.o,
5381 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5382 thumb2_blx_out_of_range.o): New rules.
5383 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5384 thumb2_blx_in_range and thumb2_blx_out_of_range.
5385 * testsuite/Makefile.in: Regenerate.
5386 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5387 * testsuite/thumb_blx_in_range.s: New file.
5388 * testsuite/thumb_blx_out_of_range.s: New file.
5389
5390 2010-03-22 Rafael Espindola <espindola@google.com>
5391
5392 * archive.cc (Should_include): Move to archive.h.
5393 (should_include_member): Make it a member of Archive.
5394 (Lib_group): New.
5395 (Add_lib_group_symbols): New.
5396 * archive.h: Include options.h.
5397 (Archive_member): Moved from Archive.
5398 (Should_include): Moved from archive.cc.
5399 (Lib_group): New.
5400 (Add_lib_group_symbols): New.
5401 * dynobj.cc (do_should_include_member): New.
5402 * dynobj.h (do_should_include_member): New.
5403 * gold.cc (queue_initial_tasks): Update call to queue.
5404 * main.cc (main): Print lib group stats.
5405 * object.cc (do_should_include_member): New.
5406 * object.h: Include archive.h.
5407 (Object::should_include_member): New.
5408 (Object::do_should_include_member): New.
5409 (Sized_relobj::do_should_include_member): New.
5410 * options.cc (General_options::parse_start_lib): New.
5411 (General_options::parse_end_lib): New.
5412 (Input_arguments::add_file): Handle lib groups.
5413 (Input_arguments::start_group): Check we are not in a lib.
5414 (Input_arguments::start_lib): New.
5415 (Input_arguments::end_lib): New.
5416 * options.h (General_options): Add start_lib and end_lib.
5417 (Input_argument::lib_): New.
5418 (Input_argument::lib): New.
5419 (Input_argument::is_lib): New.
5420 (Input_file_lib): New.
5421 (Input_arguments::in_lib_): New.
5422 (Input_arguments::in_lib): New.
5423 (Input_arguments::start_lib): New.
5424 (Input_arguments::end_lib_): New.
5425 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5426 in unused members as preempted.
5427 (Sized_pluginobj::do_should_include_member): New.
5428 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5429 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5430 return the blocker.
5431 (Read_symbols::do_whole_lib_group): New.
5432 (Read_symbols::do_lib_group): New.
5433 (Read_symbols::do_read_symbols): Handle lib groups.
5434 (Read_symbols::get_name): Handle lib groups.
5435 * readsyms.h (Read_symbols): Add an archive member pointer.
5436 (Read_symbols::do_whole_lib_group): New.
5437 (Read_symbols::do_lib_group): New.
5438 (Read_symbols::member_): New.
5439 * script.cc (read_input_script): Update call to queue_soon.
5440
5441 2010-03-19 Doug Kwan <dougkwan@google.com>
5442
5443 * arm.cc (Stub_table::Stub_table): Initialize new data members
5444 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5445 (Stub_table::add_reloc_stub): Assign stub offset and update
5446 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5447 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5448 New data members.
5449 (Stub_table::update_data_size_and_addralign): Use
5450 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5451 instead of going over all reloc stubs.
5452 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5453 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5454 Stringpool_template::offset_ to size of Stringpool_char.
5455 (Stringpool_template::new_key_offset): Remove code to initialize
5456 Stringpool_template::offset_.
5457 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5458 Stringpool_template::offset_ to zero.
5459
5460 2010-03-15 Doug Kwan <dougkwan@google.com>
5461
5462 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5463 offset_.
5464 (Stringpool_template::new_key_offset): New method.
5465 (Stringpool_template::add_string): Assign offsets when adding new
5466 strings.
5467 (Stringpool_template::set_string_offsets): Do not set string offsets
5468 when not optimizing.
5469 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5470 member size_.
5471 (Chunked_vector::clear): Clear size_.
5472 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5473 (Chunked_vector::size): Return size_.
5474 (Chunked_vector::push_back): Use size_ to find insert position.
5475 (Chunked_vector::size_): New data member.
5476 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5477 (Stringpool_template::new_key_offset): New method declaration.
5478 (Stringpool_template::offset_): New data member.
5479
5480 2010-03-15 Rafael Espindola <espindola@google.com>
5481
5482 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5483 Add_symbols' constructor.
5484 * readsyms.h (Add_symbols): Remove the input_group member.
5485
5486 2010-03-10 Ian Lance Taylor <iant@google.com>
5487
5488 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5489 target to ask whether a reference to a symbol requires a stack
5490 split.
5491 * target.h (Target::is_call_to_non_split): New function.
5492 (Target::do_is_call_to_non_split): Declare virtual function.
5493 * target.cc: Include "symtab.h".
5494 (Target::do_is_call_to_non_split): New function.
5495 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5496
5497 2010-03-10 Cary Coutant <ccoutant@google.com>
5498
5499 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5500 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5501 (File_read::open[2]): Add whole_file_view_ to list of views.
5502 (File_read::make_view): Remove test of whole_file_view_.
5503 (File_read::find_or_make_view): Create whole_file_view_ if
5504 necessary.
5505 (File_read::clear_views): Replace bool parameter with enum;
5506 adjust all callers. Don't delete views with permanent data;
5507 do delete cached views and views from archives if
5508 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5509 if clearing the corresponding view.
5510 * fileread.h (File_read::Clear_views_mode): New enum.
5511 (File_read::View::is_permanent_view): New method.
5512 (File_read::clear_views): Replace bool parameter
5513 with enum; adjust all callers.
5514 * options.h (General_options): Change keep_files_mapped option;
5515 add map_whole_files.
5516 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5517 releasing the file.
5518 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5519 the file.
5520
5521 2010-03-10 David S. Miller <davem@davemloft.net>
5522
5523 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5524
5525 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5526
5527 * icf.cc (get_section_contents): Add '@' marker after processing the
5528 merge reloc.
5529
5530 2010-03-08 Doug Kwan <dougkwan@google.com>
5531
5532 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5533 due to a conversion warning.
5534 (Arm_relobj::update_output_local_symbol_count): Check for local
5535 symbol with unset output index.
5536
5537 2010-03-05 Ian Lance Taylor <iant@google.com>
5538
5539 * options.h (class General_options): Add --spare-dynamic-tags.
5540 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5541 --spare-dynamic-tags.
5542
5543 2010-03-05 Ian Lance Taylor <iant@google.com>
5544
5545 * incremental.cc: Include "libiberty.h".
5546
5547 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5548
5549 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5550 function, is_info_ member.
5551 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5552 (Versions::Versions): Update caller.
5553 (Versions::define_base_version): Likewise.
5554 (Versions::add_def): Likewise.
5555
5556 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5557
5558 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5559 (Scan::possible_function_pointer_reloc): New function.
5560 (Scan::local_reloc_may_be_function_pointer): Change to call
5561 possible_function_pointer_reloc.
5562 (Scan::global_reloc_may_be_function_pointer): Ditto.
5563 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5564 relocations in ".data.rel.ro._ZTV" section.
5565 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5566 * testsuite/icf_safe_so_test.cc: Ditto.
5567 * testsuite/icf_safe_test.cc: Ditto.
5568 * testsuite/icf_safe_test.sh: Ditto.
5569
5570 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5571 Ian Lance Taylor <iant@google.com>
5572
5573 * target-reloc.h (relocate_section): Check the symbol table index
5574 for -1U before setting the local symbol index.
5575 (scan_relocatable_relocs): If copying the relocation, record that
5576 the local symbol is required.
5577 * object.h (Symbol_value::is_output_symtab_index_set): New
5578 function.
5579 (Symbol_value::may_be_discarded_from_output_symtab): New
5580 function.
5581 (Symbol_value::has_output_symtab_entry): New function.
5582 (Symbol_value::needs_output_symtab_entry): Remove.
5583 (Symbol_value::output_symtab_index): Make sure the symbol index is
5584 set.
5585 (Symbol_value::set_output_symtab_index): Make sure the symbol
5586 index is not set. Make sure the new index is valid.
5587 (Symbol_value::set_must_have_output_symtab_entry): New function.
5588 (Symbol_value::has_output_dynsym_entry): New function.
5589 (Symbol_value::set_output_dynsym_index): Make sure the new index
5590 is valid.
5591 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5592 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5593 local symbol if permitted.
5594 (Sized_relobj::do_finalize_local_symbols): Call
5595 is_output_symtab_index_set rather than needs_output_symtab_entry.
5596 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5597 rather than needs_output_symtab_entry. Call
5598 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5599 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5600 is_output_symtab_index_set rather than needs_output_symtab_entry.
5601 * testsuite/discard_locals_relocatable_test.c: New file.
5602 * testsuite/discard_locals_test.sh: Test -r.
5603 * testsuite/Makefile.am (check_DATA): Add
5604 discard_locals_relocatable_test1.syms,
5605 discard_local_relocatable_test2.syms.
5606 (MOSTLYCLEANFILES): Likewise. Also add
5607 discard_locals_relocatable_test1.lout and
5608 discard_locals_relocatable_test2.out.
5609 (discard_locals_relocatable_test1.syms): New target.
5610 (discard_locals_relocatable_test.o): New target.
5611 (discard_locals_relocatable_test1.out): New target.
5612 (discard_locals_relocatable_test2.syms): New target.
5613 (discard_locals_relocatable_test2.out): New target.
5614 (various): Add missing ../ld-new dependencies.
5615 * testsuite/Makefile.in: Rebuild.
5616
5617 2010-03-03 Nick Clifton <nickc@redhat.com>
5618
5619 * po/fi.po: New Finnish translation.
5620
5621 2010-03-01 Doug Kwan <dougkwan@google.com>
5622
5623 * layout.cc (Layout::Layout): Force section types of .init_array*,
5624 .preinit_array* and .fini_array* sections.
5625 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5626 Fix check of return value of std::string::find.().
5627 (Output_section::Input_section_sort_compare::operator()): Remove
5628 comment about .init_array.
5629 (Output_section::Input_section_sort_init_fini_compare::operator()):
5630 New method.
5631 (Output_section::sort_attached_input_sections): Handle .init_array
5632 and .fini_array specially.
5633 * output.h (Output_section::Inut_section_sort_compare): Update
5634 comment.
5635 (Output_section::Input_section_sort_init_fini_compare): New struct.
5636
5637 2010-02-26 Doug Kwan <dougkwan@google.com>
5638
5639 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5640 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5641 * testsuite/debug_msg.sh: Avoid matching source line number for
5642 use of global variable undef_int.
5643
5644 2010-02-26 Doug Kwan <dougkwan@google.com>
5645
5646 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5647 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5648 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5649 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5650 * options.cc (General_options::General_options): Initialize member
5651 fix_v4bx_.
5652 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5653 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5654 and rm_no_fix_v4bx.stdout
5655 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5656 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5657 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5658 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5659 and arm_no_fix_v4bx.
5660 * Makefile.in: Regenerate.
5661 * testsuite/arm_fix_v4bx.s: New file.
5662 * testsuite/arm_fix_v4bx.sh: Ditto.
5663
5664 2010-02-24 Doug Kwan <dougkwan@google.com>
5665
5666 * arm.cc (Target_arm::got_section): Make the .got section the first
5667 non RELRO section in the data segment.
5668 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5669 suffixes of section names.
5670
5671 2010-02-24 Doug Kwan <dougkwan@google.com>
5672
5673 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5674 flags and attributes merging if an input file is a binary file.
5675 * fileread.cc (Input_file::open): Record format of original file.
5676 * fileread.h (Input_file::Format): New enum type.
5677 (Input_file::Input_file): Initialize data member format_.
5678 (Input_file::format): New method definition.
5679 (Input_file::format_):: New data member.
5680
5681 2010-02-24 Doug Kwan <dougkwan@google.com>
5682
5683 * arm.cc (Arm_output_data_got): New class.
5684 (ARM_TCB_SIZE): New constant
5685 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5686 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5687 If user uses a script with a SECTIONS clause, issue only a warning
5688 for a misplaced EXIDX input section. Otherwise, issue an error.
5689 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5690 garbage collection.
5691 (Target_arm::got_mode_index_entry): Handle static linking.
5692 (Target_arm::Scan::local): Ditto.
5693 (Target_arm::Scan::global): Ditto.
5694 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5695 all incorrectly implemented relocations.
5696 (Target_arm::fix_exidx_coverage): Pass layout to
5697 Arm_output_section::fix_exidx_coverage.
5698 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5699 from ".ARM.exidx." and ".ARM.extab.".
5700
5701 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5702
5703 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5704 section if it does not already exist.
5705 * attributes.cc (Attributes_section_data::Attributes_section_data):
5706 Don't crash if size is zero.
5707
5708 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5709 Ian Lance Taylor <iant@google.com>
5710
5711 * gold.cc (queue_middle_tasks): If no input files were opened,
5712 exit.
5713 * workqueue.h (Task_function::Task_function): Assert that there is
5714 a blocker.
5715
5716 2010-02-22 Doug Kwan <dougkwan@google.com>
5717
5718 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5719 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5720 types to avoid warnings due to different uint64_t implementations
5721 on different hosts.
5722
5723 2010-02-21 Doug Kwan <dougkwan@google.com>
5724
5725 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5726 handling of the maximum backward branch offset.
5727 (Arm_relocate_functions::thumb_branch_common): Ditto.
5728 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5729 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5730 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5731 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5732 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5733 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5734 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5735 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5736 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5737 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5738 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5739 thumb2_bl_out_of_range.o): New rules.
5740 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5741 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5742 thumb2_bl_out_of_range
5743 * testsuite/Makefile.in: Regenerate.
5744 * testsuite/arm_bl_in_range.s: New file.
5745 * testsuite/arm_bl_out_of_range.s: Ditto.
5746 * testsuite/arm_branch_in_range.sh: Ditto.
5747 * testsuite/arm_branch_range.t: Ditto.
5748 * testsuite/thumb2_branch_range.t: Ditto.
5749 * testsuite/thumb_bl_in_range.s: Ditto.
5750 * testsuite/thumb_bl_out_of_range.s: Ditto.
5751 * testsuite/thumb_branch_range.t: Ditto.
5752
5753 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5754
5755 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5756 Add reloc offset information.
5757 * icf.cc (get_section_contents): Change iterators to point to the new
5758 vectors. Add reloc offset information to the contents.
5759 * icf.h (Icf::Sections_reachable_info): New typedef.
5760 (Icf::Sections_reachable_list): New typedef.
5761 (Icf::Offset_info): New typedef.
5762 (Icf::Reloc_info): New struct typedef.
5763 (Icf::Reloc_info_list): New typedef.
5764 (Icf::symbol_reloc_list): Delete method.
5765 (Icf::addend_reloc_list): Delete method.
5766 (Icf::section_reloc_list): Delete method.
5767 (Icf::reloc_info_list): New method.
5768 (Icf::reloc_info_list_): New member.
5769
5770 2010-02-19 Doug Kwan <dougkwan@google.com>
5771
5772 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5773 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5774 * arm.cc (Arm_relocation_functions): New forward declaration.
5775 (Target_arm::Target_arm): Initialize new data members
5776 got_mod_index_offset_ and tls_base_symbol_defined_.
5777 (Target_arm::Relocate::relocate_tls): New method.
5778 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5779 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5780 New methods.
5781 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5782 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5783 (Target_arm::got_mod_index_offset_,
5784 Target_arm::tls_base_symbol_defined_): New data members.
5785 (Target_arm::Scan::local, Target::Scan::global,
5786 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5787 relocations.
5788
5789 2010-02-18 Doug Kwan <dougkwan@google.com>
5790
5791 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5792 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5793 text section as a parameter becuase some broken tools may not set
5794 the link in section header.
5795 (Target_arm::has_got_section): New method.
5796 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5797 without any mapping symbol as data only. Remove warning.
5798 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5799 link in its section header, try to discover the link by inspecting the
5800 REL31 relocation at the beginning of the section.
5801 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5802 in error message.
5803 (Target_arm::Scan::global): Treat any reference to the symbol
5804 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5805
5806 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5807
5808 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5809 (Scan::global_reloc_may_be_function_pointer): New function.
5810 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5811 (Scan::global_reloc_may_be_function_pointer): New function.
5812 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5813 (Scan::global_reloc_may_be_function_pointer): New function.
5814 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5815 (Scan::global_reloc_may_be_function_pointer): New function.
5816 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5817 (Scan::global_reloc_may_be_function_pointer): New function.
5818 (Scan::possible_function_pointer_reloc): New function.
5819 (Target_x86_64::can_check_for_function_pointers): New function.
5820 * gc.h (gc_process_relocs): Scan relocation types to determine if
5821 function pointers were taken for targets that support it.
5822 * icf.cc (Icf::find_identical_sections): Include functions for
5823 folding in safe ICF whose pointer is not taken.
5824 * icf.h (Secn_fptr_taken_set): New typedef.
5825 (fptr_section_id_): New member.
5826 (section_has_function_pointers): New function.
5827 (set_section_has_function_pointers): New function.
5828 (check_section_for_function_pointers): New function.
5829 * options.h: Fix comment for safe ICF option.
5830 * target.h (can_check_for_function_pointers): New function.
5831 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5832 Modify icf_safe_test for X86-64.
5833 * testsuite/Makefile.in: Regenerate.
5834 * testsuite/icf_safe_so_test.cc: New file.
5835 * testsuite/icf_safe_so_test.sh: New file.
5836 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5837 (main): Change to take pointer to function kept_func_3.
5838 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5839 folding is done correctly for X86-64.
5840
5841 2010-02-12 David S. Miller <davem@davemloft.net>
5842
5843 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5844 is_symbolless parameter.
5845 (Output_reloc<SHT_REL>::is_symbolless): New.
5846 (Output_reloc<SHT_REL>::is_symbolless_): New.
5847 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5848 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5849 (Output_reloc<SHT_RELA>::is_symbolless): New.
5850 (Output_data_reloc::add_global): Handle is_symbolless.
5851 (Output_data_reloc::add_global_relative): Likewise.
5852 (Output_data_reloc::add_local): Likewise.
5853 (Output_data_reloc::add_local_relative): Likewise.
5854 (Output_data_reloc::add_symbolless_global_addend): New.
5855 (Output_data_reloc::add_symbolless_local_addend): New.
5856 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5857 is_symbolless.
5858 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5859 instead of ->is_relative_
5860 (Output_reloc::write): Likewise.
5861 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5862 (Output_reloc::write_rel): Simplify.
5863
5864 * sparc.cc (Target_sparc::Scan::local): Use
5865 ->add_symbolless_local_addend as needed.
5866 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5867 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5868 based upon relocation offset.
5869
5870 2010-02-11 Doug Kwan <dougkwan@google.com>
5871
5872 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5873 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5874 beginning of function.
5875 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5876 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5877 parameter is_32bit in calls to should_apply_static_reloc.
5878 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5879 (check_DATA): Add arm_abs_global.stdout.
5880 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5881 arm_abs_global.stdout): New rules.
5882 (MOSTLLYCLEANFILES): Add arm_abs_global
5883 * Makefile.in: Regenerate.
5884 * testsuite/arm_abs_global.s: New file.
5885 * testsuite/arm_abs_global.sh: Ditto.
5886 * testsuite/arm_abs_lib.s: Ditto.
5887
5888 2010-02-11 Ian Lance Taylor <iant@google.com>
5889
5890 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5891 Read_relocs task.
5892 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5893 Allocate_commons_task first.
5894 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5895 task, rather than symtab_lock_.
5896 (Gc_process_relocs::~Gc_process_relocs): New function.
5897 (Gc_process_relocs::is_runnable): Check this_blocker_.
5898 (Gc_process_relocs::locks): Use next_blocker_ rather than
5899 blocker_.
5900 (Scan_relocs::~Scan_relocs): New function.
5901 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5902 symtab_lock_.
5903 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5904 next_blocker_.
5905 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5906 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5907 constructor accordingly.
5908 (class Gc_process_relocs): Likewise.
5909 (class Scan_relocs): Likewise.
5910 * common.h (class Allocate_commons_task): Remove symtab_lock_
5911 field, and corresponding constructor parameter.
5912 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5913 symtab_lock_.
5914 (Allocate_commons_task::locks): Likewise.
5915
5916 2010-02-11 Ian Lance Taylor <iant@google.com>
5917
5918 * gold-threads.h (class Once): Define.
5919 (class Initialize_lock): Rewrite as child of Once.
5920 * gold-threads.cc (class Once_initialize): Define.
5921 (once_pointer_control): New static variable.
5922 (once_pointer, once_arg): New static variables.
5923 (c_run_once): New static function.
5924 (Once::Once, Once::run_once, Once::internal_run): New functions.
5925 (class Initialize_lock_once): Remove.
5926 (initialize_lock_control): Remove.
5927 (initialize_lock_pointer): Remove.
5928 (initialize_lock_once): Remove.
5929 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5930 (Initialize_lock::initialize): Rewrite.
5931 (Initialize_lock::do_run_once): New function.
5932 * archive.cc (Archive::interpret_header): Only clear name if it is
5933 not already empty.
5934 * fileread.cc: Include "gold-threads.h"
5935 (file_counts_lock): New static variable.
5936 (file_counts_initialize_lock): Likewise.
5937 (File_read::release): Only increment counts when using --stats.
5938 Use a lock around the increment.
5939 * parameters.cc (class Set_parameters_target_once): Define.
5940 (set_parameters_target_once): New static variable.
5941 (Parameters::Parameters): Move here from parameters.h.
5942 (Parameters::set_target): Rewrite.
5943 (Parameters::set_target_once): New function.
5944 (Parameters::clear_target): Move here and rewrite.
5945 * parameters.h (class Parameters): Update declarations. Add
5946 set_parameters_target_once_ field.
5947 (Parameters::Parameters): Move to parameters.cc.
5948 (Parameters::clear_target): Likewise.
5949 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5950 task.
5951 (Start_group::~Start_group): New function.
5952 (Start_group::is_runnable): New function.
5953 (Start_group::locks, Start_group::run): New functions.
5954 (Finish_group::run): Change saw_undefined to size_t.
5955 * readsyms.h (class Start_group): Define.
5956 (class Finish_group): Change saw_undefined_ field to size_t.
5957 (Finish_group::Finish_group): Remove saw_undefined and
5958 this_blocker parameters. Change all callers.
5959 (Finish_group::set_saw_undefined): New function.
5960 (Finish_group::set_blocker): New function.
5961 * symtab.h (class Symbol_table): Change saw_undefined to return
5962 size_t. Change saw_undefined_ field to size_t.
5963 * target-select.cc (Set_target_once::do_run_once): New function.
5964 (Target_selector::Target_selector): Initialize set_target_once_
5965 field. Don't initialize lock_ and initialize_lock_ fields.
5966 (Target_selector::instantiate_target): Rewrite.
5967 (Target_selector::set_target): New function.
5968 * target-select.h (class Set_target_once): Define.
5969 (class Target_selector): Update declarations. Make
5970 Set_target_once a friend. Remove lock_ and initialize_lock_
5971 fields. Add set_target_once_ field.
5972
5973 2010-02-10 Ian Lance Taylor <iant@google.com>
5974
5975 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5976 queueing any tasks.
5977 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5978 (queue_middle_tasks): Add all blockers before queueing any tasks.
5979 (queue_final_tasks): Likewise.
5980 * token.h (Task_token::add_blockers): New function.
5981 * object.h (Input_objects::number_of_relobjs): New function.
5982
5983 2010-02-10 Ian Lance Taylor <iant@google.com>
5984
5985 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5986 shared, not if not position independent.
5987 * x86_64.cc (Relocate::relocate_tls): Likewise.
5988 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5989 (tls_pie_pic_test): New target.
5990 * testsuite/Makefile.in: Rebuild.
5991
5992 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5993 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5994 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5995 * testsuite/Makefile.in: Rebuild.
5996
5997 2010-02-09 David S. Miller <davem@davemloft.net>
5998
5999 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6000 R_SPARC_RELATIVE using ->add_local_relative().
6001 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6002
6003 * output.h (Output_data_dynamic::add_section_size): New method
6004 that takes two Output_data objects.
6005 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6006 entry param. Handle it in initializers.
6007 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6008 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6009 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6010 arg.
6011 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6012 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6013 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6014 for dynrel_includes_plt.
6015 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6016 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6017 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6018 before .rela.plt
6019 (Target_sparc::do_finalize_sections): Update to pass true for
6020 dynrel_includes_plt.
6021 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6022 output before .rela.plt
6023 (Target_powerpc::do_finalize_sections): Update to pass true for
6024 dynrel_includes_plt when 32-bit.
6025
6026 2010-02-08 Doug Kwan <dougkwan@google.com>
6027
6028 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6029 method.
6030 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6031 Arm_relobj::scan_section_for_cortex_a8_stubs,
6032 Arm_relobj::do_relocation_section): Instead of calling
6033 Output_section::output_address, use faster
6034 Arm_relobj::simple_input_section_output_address.
6035
6036 2010-02-08 David S. Miller <davem@davemloft.net>
6037
6038 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6039 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6040 relocation helper function.
6041
6042 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6043 just like R_SPARC_GOT{10,13,22}.
6044 (Target_sparc::Scan::local): Likewise.
6045 (Target_sparc::Relocate:relocate): Likewise.
6046
6047 2010-02-06 Ian Lance Taylor <iant@google.com>
6048
6049 * configure.ac: Rewrite targetobjs duplicate removal code to use
6050 only shell constructs.
6051 * configure: Rebuild.
6052
6053 2010-02-05 Doug Kwan <dougkwan@google.com>
6054
6055 PR 11247
6056 * arm.cc (Arm_relobj::section_is_scannable): New method.
6057 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6058 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6059
6060 2010-02-04 Doug Kwan <dougkwan@google.com>
6061
6062 PR 11247
6063 * arm-reloc-property.cc (cstdio): Include.
6064 * configure.ac (targetobjs): Remove duplicates.
6065 * configure: Regenerate.
6066 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6067 big and little endian version for a given address size.
6068
6069 2010-02-03 Doug Kwan <dougkwan@google.com>
6070
6071 * arm-reloc-property.cc
6072 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6073 definition.
6074 * arm-reloc-property.h
6075 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6076 New method definition.
6077 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6078 declaration.
6079 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6080 overflow to N.
6081 (GOT_PREL): Change implemented to Y.
6082 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6083 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6084 (Arm_relocate_functions::movw_abs_nc): Remove method.
6085 (Arm_relocate_functions::movt_abs): Ditto.
6086 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6087 (Arm_relocate_functions::thm_movt_abs): Ditto.
6088 (Arm_relocate_functions::movw_rel_nc): Ditto.
6089 (Arm_relocate_functions::movw_rel): Ditto.
6090 (Arm_relocate_functions::movt_rel): Ditto.
6091 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6092 (Arm_relocate_functions:thm_movw_rel): Ditto.
6093 (Arm_relocate_functions:thm_movt_rel): Ditto.
6094 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6095 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6096 New method definitions.
6097 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6098 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6099 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6100 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6101 (Target_arm::Relocate::relocate): Check for non-static or
6102 unimplemented relocation code and exit early. Change calls to
6103 Target_arm::reloc_uses_thumb_bit and
6104 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6105 instead. Refactor code to handle similar relocations to increase
6106 code sharing. Remove check for unsupported relocation code in switch
6107 statement.
6108 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6109 relocation property table to find out size. Change error message to
6110 print out the name of a relocation code instead of the numeric value.
6111 (Target_arm::scan_reloc_for_stub): Use relocation property table
6112 instead of calling Target_arm::reloc_uses_thumb_bit().
6113
6114 2010-02-02 Doug Kwan <dougkwan@google.com>
6115
6116 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6117 types of relaxed input section.
6118
6119 2010-02-02 Doug Kwan <dougkwan@google.com>
6120
6121 * Makefile.am (HFILES): Add arm-reloc-property.h.
6122 (DEFFILES): New.
6123 (TARGETSOURCES): Add arm-reloc-property.cc
6124 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6125 (libgold_a_SOURCES): $(DEFFILES)
6126 * Makefile.in: Regenerate.
6127 * arm-reloc-property.cc: New file.
6128 * arm-reloc-property.h: New file.
6129 * arm-reloc.def: New file.
6130 * arm.cc: Update comments.
6131 (arm-reloc-property.h): New included header.
6132 (arm_reloc_property_table): New global variable.
6133 (Target_arm::do_select_as_default_target): New method definition.
6134 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6135 arm-reloc-property to targ_extra_obj.
6136 * parameters.cc (set_parameters_target): Call
6137 Target::select_as_default_target().
6138 * target.h (Target::select_as_default_target): New method definition.
6139 (Target::do_select_as_default_target): Same.
6140
6141 2010-02-01 Doug Kwan <dougkwan@google.com>
6142
6143 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6144 first_output_text_section_.
6145 (Arm_exidx_fixup::first_output_text_section): New method definition.
6146 (Arm_exidx_fixup::first_output_text_section_): New data member.
6147 (Arm_exidx_fixup::process_exidx_section): Record the first text
6148 output section seen.
6149 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6150 and entsize in output section header.
6151
6152 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6153
6154 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6155 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6156 (Arm_relocate_functions::thm_alu11): New Method.
6157 (Arm_relocate_functions::thm_pc8): New Method.
6158 (Arm_relocate_functions::thm_pc12): New Method.
6159 (Target_arm::Scan::local): Handle the relocations.
6160 (Target_arm::Scan::global): Likewise.
6161 (Target_arm::Relocate::relocate): Likewise.
6162 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6163
6164 2010-01-29 Doug Kwan <dougkwan@google.com>
6165
6166 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6167 of relocation types as ld.
6168
6169 2010-01-29 Doug Kwan <dougkwan@google.com>
6170
6171 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6172 to public.
6173 (Arm_relocate_functions::thumb_branch_common): Ditto.
6174 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6175 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6176 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6177 Arm_relocate_functions::jump24): Remove.
6178 (Target_arm::Relocate::relocate): Adjust code to call
6179 Arm_relocation_functions::arm_branch_common and
6180 Arm_relocation_functions::thumb_branch_common instead of their removed
6181 wrappers. Merge switch-cases together to reduce source code size.
6182
6183 2010-01-29 Doug Kwan <dougkwan@google.com>
6184
6185 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6186 output_local_symbol_count_needs_update_.
6187 (Arm_relobj::output_local_symbol_count_needs_update,
6188 Arm_relobj::set_output_local_symbol_count_needs_update,
6189 Arm_relobj::update_output_local_symbol_count): New methods.
6190 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6191 member.
6192 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6193 of pointed function as in a R_ARM_PREL31 relocation.
6194 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6195 for output local symbol count updating.
6196 (Target_arm::do_relax): Update output local symbol counts in objects
6197 if necessary.
6198 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6199
6200 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6201
6202 * arm.cc: Added support for the ARM relocations:
6203 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6204 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6205 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6206 movw_prel_nc).
6207 (Arm_relocate_functions::movw_rel): New method.
6208 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6209 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6210 thm_movw_prel_nc).
6211 (Arm_relocate_functions::thm_movw_rel): New method.
6212 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6213 thm_movt_prel).
6214 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6215 relocations.
6216 (Target_arm::Scan::global): Likewise.
6217 (Target_arm::Relocate::relocate): Likewise.
6218 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6219 Likewise.
6220
6221 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6222
6223 * arm.cc: Added support for ARM group relocations.
6224 (Target_arm::reloc_needs_sym_origin): New method.
6225 (Arm_relocate_functions::calc_grp_kn): New method.
6226 (Arm_relocate_functions::calc_grp_residual): New method.
6227 (Arm_relocate_functions::calc_grp_gn): New method.
6228 (Arm_relocate_functions::arm_grp_alu): New Method.
6229 (Arm_relocate_functions::arm_grp_ldr): New Method.
6230 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6231 (Arm_relocate_functions::arm_grp_ldc): New Method.
6232 (Target_arm::Scan::local): Handle the ARM group relocations.
6233 (Target_arm::Scan::global): Likewise.
6234 (Target_arm::Relocate::relocate): Likewise.
6235 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6236 Likewise.
6237
6238 2010-01-26 Doug Kwan <dougkwan@google.com>
6239
6240 * arm.cc (set): Include.
6241 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6242 pointer type.
6243 (Arm_output_section::Text_section_list): New type.
6244 (Arm_output_section::append_text_sections_to_list): New method.
6245 (Arm_output_section::fix_exidx_coverage): Ditto.
6246 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6247 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6248 Relobj::set_section_offset() instead of
6249 Sized_relobj::invalidate_section_offset().
6250 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6251 parameter for section headers. Ignore relocation sections for
6252 unallocated sections and EXIDX sections.
6253 (Target_arm::fix_exidx_coverage): New method.
6254 (Target_arm::output_section_address_less_than): New type.
6255 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6256 linked text section instead of the EXIDX section.
6257 (Arm_output_section::create_stub_group): Add an assertion to check
6258 that this is not an EXIDX output section.
6259 (Arm_output_section::append_text_sections_to_list): New method.
6260 (Arm_output_section::fix_exidx_coverage): Ditto.
6261 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6262 Arm_relobj::section_needs_reloc_stub_scanning.
6263 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6264 first pass.
6265 (Target_arm::fix_exidx_coverage): New method.
6266 * object.h (Relobj::set_output_section): New method.
6267 (Sized_relobj::invalidate_section_offset): Remove method.
6268 (Sized_relobj::do_invalidate_section_offset): Remove method.
6269 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6270
6271 2010-01-25 Doug Kwan <dougkwan@google.com>
6272
6273 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6274 Fix warning due to signed and unsigned comparison on a 32-bit host.
6275
6276 2010-01-22 Doug Kwan <dougkwan@google.com>
6277
6278 * arm.cc (Target_arm::do_relax): Record an output section for section
6279 offset adjustment it contains any stub table that has changed.
6280 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6281 offsets in an output section if necessary.
6282 * output.cc (Output_section::Output_section): Initialize
6283 section_offsets_need_adjustments_.
6284 (Output_section::add_input_section_for_script): Renamed to
6285 Output_section::add_simple_input_section.
6286 (Output_section::save_states): Add a comment.
6287 (Output_section::discard_states): New method defintion.
6288 (Output_section::adjust_section_offsets): Same.
6289 * output.h (Output_section::add_input_section_for_script): Renamed to
6290 Output_section::add_simple_input_section.
6291 (Output_section::discard_states): New method declaration.
6292 (Output_section::adjust_section_offsets): Same.
6293 (Output_section::section_offsets_need_adjustment,
6294 Output_section::set_section_offsets_need_adjustment): New method
6295 definitions.
6296 (Output_section::section_offsets_need_adjustment_): New data member.
6297 * script-sections.cc
6298 (Output_section_element_input::set_section_address): Adjust code for
6299 renaming of Output_section::add_input_section_for_script.
6300 (Orphan_output_section::set_section_address): Same.
6301
6302 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6303
6304 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6305 Fix_v4bx enum values .
6306 * gold/options.h (General_options): New option definitions.
6307 (General_options::fix_v4bx): New method.
6308 (General_options::Fix_v4bx): New enum.
6309 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6310 (General_options::parse_fix_v4bx_interworking): New method.
6311
6312 2010-01-22 Doug Kwan <dougkwan@google.com>
6313
6314 * arm.cc (Arm_exidx_fixup): New class.
6315
6316 2010-01-21 Doug Kwan <dougkwan@google.com>
6317
6318 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6319 classes.
6320 (Arm_exidx_section_offset_map): New type.
6321
6322 2010-01-21 Doug Kwan <dougkwan@google.com>
6323
6324 * arm.cc (Arm_exidx_input_section): New class.
6325 (Arm_relobj::exidx_input_section_by_link,
6326 Arm_relobj::exidx_input_section_by_shndx,
6327 Arm_relobj::make_exidx_input_section): New methods.
6328 (read_arm_attributes_section): Remove.
6329 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6330 information about them.
6331 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6332 to here.
6333
6334 2010-01-20 Doug Kwan <dougkwan@google.com>
6335
6336 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6337 Input_section_specifier to Section_id.
6338 (Target_arm::new_arm_input_section: Adjust code for change of key
6339 type.
6340 (Target_arm::find_arm_input_section): Ditto.
6341 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6342 (Section_id): Remove.
6343 (Garbage_collection::Section_id_hash): Remove.
6344 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6345 (Section_id): Remove.
6346 (Icf::Section_id_hash): Remove.
6347 * object.h (Section_id, Const_section_id, Section_id_hash,
6348 Const_section_id_hash): New type definitions.
6349 * output.cc (Output_section::add_relaxed_input_section): Change to
6350 use Const_section_id instead of Input_section_specifier as key type.
6351 (Output_section::add_merge_input_section): Ditto.
6352 (Output_section::build_relaxation_map): Change to use Section_id
6353 instead of Input_section_specifier as key type.
6354 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6355 Ditto.
6356 (Output_section::convert_input_sections_to_relaxed_sections): Change
6357 to use Const_section_id instead of Input_section_specifier as key type.
6358 (Output_section::find_merge_section): Ditto.
6359 (Output_section::find_relaxed_input_section): Ditto.
6360 * output.h (Input_section_specifier): Remove class.
6361 (Output_section::Output_section_data_by_input_section_map): Change
6362 key type to Const_section_id.
6363 (Output_section::Output_relaxed_input_section_by_input_section_map):
6364 Ditto.
6365 (Output_section::Relaxation_map): Change key type to Section_id.
6366
6367 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6368
6369 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6370 (class Arm_v4bx_stub): New class.
6371 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6372 (Stub_factory::make_arm_v4bx_stub): New method.
6373 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6374 (Stub_table::empty): Handle v4bx stubs.
6375 (Stub_table::add_arm_v4bx_stub): New method.
6376 (Stub_table::find_arm_v4bx_stub): New method.
6377 (Arm_relocate_functions::v4bx): New method.
6378 (Target_arm::fix_v4bx): New method.
6379 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6380 (Stub_table::relocate_stubs): Likewise.
6381 (Stub_table::do_write): Likewise.
6382 (Stub_table::update_data_size_and_addralign): Likewise.
6383 (Stub_table::finalize_stubs): Likewise.
6384 (Target_arm::Scan::local): Likewise.
6385 (Target_arm::Scan::global): Likewise.
6386 (Target_arm::do_finalize_sections): Likewise.
6387 (Target_arm::Relocate::relocate): Likewise.
6388 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6389 Likewise.
6390 (Target_arm::scan_reloc_for_stub): Likewise.
6391 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6392
6393 2010-01-19 Ian Lance Taylor <iant@google.com>
6394
6395 * output.cc (Output_section_headers::do_sized_write): Write large
6396 segment count to sh_info field.
6397 (Output_file_header::do_sized_write): For large segment count,
6398 write PN_XNUM to e_phnum field.
6399
6400 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6401
6402 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6403 (Arm_relocate_functions::thm_jump8): New function.
6404 (Arm_relocate_functions::thm_jump11): New function.
6405 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6406 R_ARM_THM_JUMP11.
6407 (Target_arm::Scan::global): Likewise.
6408 (Target_arm::Relocate::relocate): Likewise.
6409 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6410 Likewise.
6411
6412 2010-01-14 Doug Kwan <dougkwan@google.com>
6413
6414 * arm.cc (map, utility): Include headers.
6415 (Target_arm::apply_cortex_a8_workaround): New method.
6416 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6417 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6418 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6419 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6420 the --[no-]fix-cortex-a8 command line options.
6421 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6422 (Target_arm::relocate_stub): Use addend in instruction template.
6423 * options.h (DEFINE_bool): Set the user-set flag.
6424 (General_options): Add --[no-]-fix-cortex options.
6425 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6426 : Update fast look-up map after conversion.
6427
6428 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6429
6430 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6431 in the first pass of do_layout.
6432
6433 2010-01-13 Doug Kwan <dougkwan@google.com>
6434
6435 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6436 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6437 apparent compiler problem of not folding static constant integral
6438 data members of elfcpp::Elf_sizes<32>.
6439
6440 2010-01-13 Doug Kwan <dougkwan@google.com>
6441
6442 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6443 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6444 Arm_relobj::scan_section_for_cortex_a8_erratum,
6445 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6446 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6447 sections to scan for relocation stubs into a new method
6448 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6449 relocation and Cortex-A8 stub scanning.
6450 (Target_arm::do_relax): Force stubs to be after stubbed sections
6451 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6452 the beginning of a new relaxation pass. Update a comment.
6453 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6454
6455 2010-01-12 Ian Lance Taylor <iant@google.com>
6456
6457 * target-reloc.h (visibility_error): New inline function.
6458 (relocate_section): Call visibility_error.
6459 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6460 (MOSTLYCLEANFILES): Likewise.
6461 (protected_4_pic.o, protected_3.err): New targets.
6462 * testsuite/protected_4.cc: New file.
6463
6464 2010-01-12 Doug Kwan <dougkwan@google.com>
6465
6466 * arm.cc (Cortex_a8_reloc): New class.
6467 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6468 and cortex_a8_relocs_info_.
6469 (Target_arm::fix_cortex_a8): New method definition.
6470 (Target_arm::Cortex_a8_relocs_info): New type.
6471 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6472 New data member declarations.
6473 (Target_arm::scan_reloc_for_stub): Record information about
6474 relocations for THUMB branches that might be exempted from the
6475 Cortex-A8 workaround.
6476 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6477 at the beginning of a relaxation pass.
6478
6479 2010-01-12 Doug Kwan <dougkwan@google.com>
6480
6481 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6482 (Arm_relobj::Mapping_symbol_position,
6483 Arm_reloj::Mapping_symbol_position_less,
6484 Arm_relobj::Mapping_symbols_info): New types.
6485 (Target_arm::is_mapping_symbol_name): New method definition.
6486 (Arm_relobj::do_count_local_symbols): Save information about mapping
6487 symbols.
6488
6489 2010-01-11 Doug Kwan <dougkwan@google.com>
6490
6491 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6492 Arm_relocate_functions::thumb32_branch_upper,
6493 Arm_relocate_functions::thumb32_branch_lower,
6494 Arm_relocate_functions::thumb32_cond_branch_offset,
6495 Arm_relocate_functions::thumb32_cond_branch_upper,
6496 Arm_relocate_functions::thumb32_cond_branch_lower,
6497 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6498 branch offset encoding.
6499 (Arm_relocate_functions::thumb_branch_common): Use new branch
6500 offset encoding methods to avoid code duplication.
6501 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6502 (Stub_addend_reader::operator()): Use new branch encoding method
6503 to avoid code duplication.
6504
6505 2010-01-11 Doug Kwan <dougkwan@google.com>
6506
6507 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6508 (Target_arm::do_finalize_sections): Define special EXIDX section
6509 symbols only if referenced.
6510 * gc.h (Garbage_collection::add_reference): New method.
6511 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6512 code duplication.
6513
6514 2010-01-11 Ian Lance Taylor <iant@google.com>
6515
6516 * script.cc (Version_script_info::build_expression_list_lookup):
6517 Change complaing about duplicate wildcard match from error to
6518 warning.
6519
6520 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6521 of 2009-12-30.
6522 (Version_script_info::Version_script_info): Initialize globs_,
6523 default_version_, default_is_global_, and exact_. Don't
6524 initialize globals_ or locals_.
6525 (Version_script_info::build_lookup_tables): Build local symbols
6526 first.
6527 (Version_script_info::unquote): New function.
6528 (Version_script_info::add_exact_match): New function.
6529 (Version_script_info::build_expression_list_lookup): Remove lookup
6530 parameter. Add is_global parameter. Change all callers. Handle
6531 wildcard pattern specially. Unquote pattern. Call
6532 add_exact_match.
6533 (Version_script_info::get_name_to_match): New function.
6534 (Version_script_info::get_symbol_version): New function.
6535 (Version_script_info::get_symbol_version_helper): Remove.
6536 (Version_script_info::check_unmatched_names): Call unquote.
6537 * script.h (class Version_script_info): Change get_symbol_version
6538 to be non-inline and add is_global parameter; change all callers.
6539 Rewrite symbol_is_local. Update declarations. Define struct
6540 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6541 Remove globals_ and locals_ members. Add exact_, globs_,
6542 default_version_, is_global_.
6543 (Version_script_info::Glob): Remove pattern, add expression and
6544 is_global. Update constructor. Change all callers.
6545 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6546 default version.
6547 (Versions::symbol_section_contents): If a symbol is undefined, or
6548 defined in a dynamic object, set the version index to
6549 VER_NDX_LOCAL.
6550 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6551 symbol_is_local.
6552 (Symbol_table::add_from_pluginobj): Likewise.
6553 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6554
6555 2010-01-11 Doug Kwan <dougkwan@google.com>
6556
6557 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6558 (incremental_dump_LDADD): Add linking option for libintl.
6559 * Makefile.in: Regenerate.
6560
6561 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6562
6563 PR gold/11144
6564 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6565 instead of -Ds.
6566 * testsuite/Makefile.in: Regenerated.
6567
6568 2010-01-10 Doug Kwan <dougkwan@google.com>
6569
6570 * options.h (DEFINE_var): Use parentheses around argument varname__
6571 in macro body to avoid any unintended subsequent substitutions.
6572
6573 2010-01-10 Ian Lance Taylor <iant@google.com>
6574
6575 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6576 candidates before doing symbol resolution.
6577
6578 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6579 ODR candidates if only one is weak.
6580
6581 2010-01-08 Ian Lance Taylor <iant@google.com>
6582
6583 * script.cc (Version_script_info::build_expression_list_lookup):
6584 Don't warn about ambiguous version, just record the ambiguity.
6585 (Version_script_info::get_symbol_version_helper): Give error if
6586 version is ambiguous.
6587
6588 2010-01-08 Doug Kwan <dougkwan@google.com>
6589
6590 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6591 prev_data_size_ and prev_addralign_. Remove initializer for
6592 deleted data member has_been_changed_.
6593 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6594 to determine if the table is empty.
6595 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6596 Remove.
6597 (Stub_table::add_reloc_stub): Define method in class definition
6598 instead of just declaring it there.
6599 (Stub_table::add_cortex_a8_stub): New method definition.
6600 (Stub_table::update_data_size_and_addralign): Ditto.
6601 (Stub_table::finalize_stubs): Ditto.
6602 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6603 (Stub_table::do_addralign_): Return address alignment in the
6604 (Stub_table::do_reset_address_and_file_offset): Define method in
6605 class definition instead of declaring it there. Set current data
6606 size to be the data size of the previous pass.
6607 (Stub_table::set_final_data_size): Use current data size as the
6608 final data size.
6609 (Stub_table::relocate_stub): Change parameter type of stub from
6610 Reloc_stub pointer to Stub pointer.
6611 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6612 (Stub_table::Cortex_a8_stub_list): New typedef.
6613 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6614 Stub_table::prev_addralign_): New data member.
6615 (Arm_relobj::Arm_relobj): Initialize data member
6616 section_has_cortex_a8_workaround_.
6617 (Arm_relobj::section_has_cortex_a8_workaround,
6618 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6619 definitions.
6620 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6621 declarations.
6622 (Target_arm::relocate_stub): Change parameter type of stub from
6623 Reloc_stub pointer to Stub pointer.
6624 (Insn_template::size, Insn_template::alignment): Handle
6625 THUMB16_SPECIAL_TYPE.
6626 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6627 Stub_table::update_data_size_and_addralign,
6628 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6629 definitions.
6630 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6631 (Stub_table::do_write): Ditto.
6632 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6633
6634 2010-01-08 Ian Lance Taylor <iant@google.com>
6635
6636 PR 11108
6637 * symtab.h (class Symbol): Remove fields is_target_special_ and
6638 has_plt_offset_. Add field is_defined_in_discarded_section_.
6639 (Symbol::is_defined_in_discarded_section): New function.
6640 (Symbol::set_is_defined_in_discarded_section): New function.
6641 (Symbol::has_plt_offset): Rewrite.
6642 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6643 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6644 Don't initialize is_target_special_ or has_plt_offset_.
6645 Initialize is_defined_in_discarded_section_.
6646 (Symbol_table::add_from_relobj): If appropriate, set
6647 is_defined_in_discarded_section.
6648 * resolve.cc (Symbol::override_base_with_special): Don't test
6649 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6650 * target-reloc.h (relocate_section): Do special handling for
6651 symbols defined in discarded sections for global symbols as well
6652 as local symbols.
6653
6654 2010-01-08 Ian Lance Taylor <iant@google.com>
6655
6656 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6657 the SHT_SYMTAB case.
6658
6659 2010-01-08 Ian Lance Taylor <iant@google.com>
6660
6661 * object.cc (Sized_relobj::do_layout): Don't get confused if
6662 layout_eh_frame returns NULL.
6663
6664 2010-01-08 Ian Lance Taylor <iant@google.com>
6665
6666 PR 11084
6667 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6668 dynamic symbol table, use the normal symbol table.
6669 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6670 symbol table.
6671
6672 2010-01-08 Ian Lance Taylor <iant@google.com>
6673
6674 PR 11072
6675 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6676 sections.
6677
6678 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6679
6680 * version.cc (print_version): Change to "Copyright 2010".
6681
6682 2010-01-08 Ian Lance Taylor <iant@google.com>
6683
6684 PR 10287
6685 PR 11063
6686 * i386.cc (class Target_i386): Change return type of plt_section
6687 to be non-const.
6688 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6689 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6690 tls_desc_rel_ field.
6691 (Output_data_plt_i386::rel_tls_desc): New function.
6692 (Target_i386::rel_tls_desc_section): New function.
6693 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6694 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6695 R_386_TLS_DESC reloc in rel_tls_desc_section.
6696 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6697 Define struct Tlsdesc_info.
6698 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6699 (Target_x86_64::do_reloc_symbol_index): New function.
6700 (Target_x86_64::add_tlsdesc_info): New function.
6701 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6702 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6703 tlsdesc_rel_ field.
6704 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6705 all callers.
6706 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6707 (Target_x86_64::rela_tlsdesc_section): New function.
6708 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6709 handling.
6710 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6711 (Target_x86_64::do_reloc_addend): New function.
6712 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6713 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6714 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6715 (Output_reloc::type): New function.
6716 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6717 (Output_reloc::is_target_specific): New function.
6718 (Output_reloc::target_arg): New function.
6719 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6720 absolute relocs and target specific relocs.
6721 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6722 add_target_specific.
6723 (class Output_data_reloc) [SHT_RELA]: Likewise.
6724 * output.cc (Output_reloc::Output_reloc): Add four new versions
6725 for absolute relocs and target specific relocs.
6726 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6727 (Output_reloc::get_symbol_index): Likewise.
6728 (Output_reloc::local_section_offset): Check that local_sym_index_
6729 is not TARGET_CODE or 0.
6730 (Output_reloc::symbol_value): Likewise.
6731 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6732 reloc.
6733 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6734 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6735 functions.
6736 * layout.cc (add_target_dynamic_tags): Use output section for
6737 DT_PLTRELSZ and DT_JMPREL.
6738
6739 2010-01-07 Ian Lance Taylor <iant@google.com>
6740
6741 PR 11061
6742 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6743 function.
6744 (class Output_data_reloc_generic): Define.
6745 (class Output_data_reloc_base): Change base class to
6746 Output_data_reloc_generic. Change add() method to call
6747 bump_relative_reloc_count for a relative reloc. Remove
6748 sort_relocs_ field.
6749 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6750 to sort_relocs().
6751 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6752 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6753 appropriate.
6754 * layout.h (class Layout): Update declaration.
6755
6756 2010-01-07 Ian Lance Taylor <iant@google.com>
6757
6758 * output.h (class Output_data): Add const version of
6759 output_section and do_output_section.
6760 (class Output_section_data): Add const version of
6761 do_output_section.
6762 (class Output_section): Likewise.
6763 * layout.cc (Layout::add_target_dynamic_tags): New function.
6764 * layout.h (class Layout): Update declarations.
6765 * arm.cc (Target_arm::do_finalize_sections): Use
6766 add_target_dynamic_tags.
6767 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6768 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6769 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6770 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6771
6772 2010-01-07 Ian Lance Taylor <iant@google.com>
6773
6774 PR 11042
6775 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6776 object as needed.
6777
6778 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6779 Ian Lance Taylor <iant@google.com>
6780
6781 PR 11019
6782 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6783 Xindex::read_symtab_xindex.
6784
6785 2010-01-07 Doug Kwan <dougkwan@google.com>
6786
6787 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6788 (Insn_template::thumb16_bcond_insn): New method declaration.
6789 (Insn_template): Fix spelling.
6790 (Stub::thumb16_special): New method declaration.
6791 (Stub::do_write): Define virtual method which was previously pure
6792 virtual.
6793 (Stub::do_thumb16_special): New method declaration.
6794 (Stub::do_fixed_endian_write): New template member.
6795 (Reloc_stub::do_write): Remove.
6796 (Reloc_stub::do_fixed_endian_write): Remove.
6797 (Cortex_a8_stub): New class definition.
6798 (Stub_factory::make_cortex_a8_stub): New method definition.
6799 (Stub_factory::Stub_factory): Add missing static storage class
6800 qualifier for elf32_arm_stub_a8_veneer_blx.
6801
6802 2010-01-07 Ian Lance Taylor <iant@google.com>
6803
6804 PR 10980
6805 * options.h (class General_options): Add --warn-unresolved-symbols
6806 and --error-unresolved-symbols.
6807 * errors.cc (Errors::undefined_symbol): Implement
6808 --warn-unresolved-symbols.
6809
6810 * options.h (class General_options): Add -z text and -z textoff.
6811 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6812
6813 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6814
6815 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6816 (Garbage_collection::cident_sections): New function.
6817 (Garbage_collection::add_cident_section): New function.
6818 (Garbage_collection::cident_sections_): New member.
6819 (gc_process_relocs): Add references to sections whose names are C
6820 identifiers.
6821 * gold.h (cident_section_start_prefix): New constant.
6822 (cident_section_stop_prefix): New constant.
6823 (is_cident): New function.
6824 * layout.cc (Layout::define_section_symbols): Replace string constants
6825 with the newly defined constants.
6826 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6827 C identifiers.
6828 * testsuite/Makefile.am: Add gc_orphan_section_test.
6829 * testsuite/Makefile.in: Regenerate.
6830 * testsuite/gc_orphan_section_test.cc: New file.
6831 * testsuite/gc_orphan_section_test.sh: New file.
6832
6833 2010-01-06 Ian Lance Taylor <iant@google.com>
6834
6835 PR 10980
6836 * options.h (class General_options): Add --warn-shared-textrel.
6837 * layout.cc (Layout::finish_dynamic_section): Implement
6838 --warn-shared-textrel.
6839
6840 PR 10980
6841 * options.h (class General_options): Add --warn-multiple-gp.
6842
6843 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6844
6845 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6846 $(THREADSLIB) and $(LIBDL).
6847 * Makefile.in: Rebuild.
6848
6849 2010-01-06 Ian Lance Taylor <iant@google.com>
6850
6851 PR 10980
6852 * options.cc (General_options::parse_section_start): New function.
6853 (General_options::section_start): New function.
6854 (General_options::General_options): Initialize all members.
6855 * options.h: Include <map>
6856 (class General_options): Add --section-start. Add section_starts_
6857 member.
6858 * layout.cc (Layout::attach_allocated_section_to_segment): If
6859 --section-start was used, set the address of the segment. Remove
6860 local sort_sections.
6861 (Layout::relaxation_loop_body): If the address of the load segment
6862 has been set by --section-start, don't use it.
6863 * output.h (Output_segment::update_flags_for_output_section): New
6864 function.
6865 * output.cc (Output_segment::add_output_section): Call
6866 update_flags_for_output_section.
6867
6868 2010-01-05 Ian Lance Taylor <iant@google.com>
6869
6870 PR 10980
6871 * options.h (class General_options): Add --undefined-version.
6872 * script.cc (struct Version_expression): Add was_matched_by_symbol
6873 field.
6874 (Version_script_info::matched_symbol): New function.
6875 (Version_script_info::get_symbol_version_helper): Call
6876 matched_symbol.
6877 (Version_script_info::check_unmatched_names): New function.
6878 * script.h (class Version_script_info): Update declarations.
6879 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6880
6881 * options.h (class General_options): Use DEFINE_bool_alias for
6882 allow_multiple_definition.
6883 * resolve.cc (Symbol_table::should_override): Don't test
6884 allow_multiple_definition.
6885
6886 PR 10980
6887 * options.h (class General_options): Add --cref.
6888 * main.cc (main): Print cref table if --cref. Don't close mapfile
6889 until after printing cref table.
6890 * cref.cc: Include "symtab.h".
6891 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6892 (Cref_table_compare::operator()): New function.
6893 (Cref_inputs::gather_cref): New function.
6894 (filecol): New static const.
6895 (Cref_inputs::print_cref): New function.
6896 (Cref::print_cref): New function.
6897 * cref.h: Include <cstdio>.
6898 (class Cref): Update declarations.
6899 * mapfile.h (Mapfile::file): New function.
6900 * object.h (class Object): Define Symbols. Declare virtual
6901 do_get_global_symbols.
6902 (Object::get_global_symbols): New function.
6903 * object.cc (Input_objects::add_object): Pass object to cref_ if
6904 --cref.
6905 (Input_objects::archive_start): Likewise.
6906 (Input_objects::archive_stop): Likewise.
6907 (Input_objects::print_cref): New function.
6908 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6909 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6910 --cref.
6911 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6912 function.
6913 * plugin.h (class Sized_pluginobj): Update declarations.
6914
6915 2010-01-05 Ian Lance Taylor <iant@google.com>
6916
6917 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6918 to is_default_version. Rename insdef to insdefault.
6919 (Symbol_table::add_from_relobj): Rename def to is_default_version
6920 and local to is_forced_local.
6921 (Symbol_table::add_from_pluginobj): Likewise.
6922 (Symbol_table::add_from_dynobj): Likewise.
6923 (Symbol_table::define_special_symbol): Rename insdef to
6924 insdefault.
6925
6926 2010-01-04 Ian Lance Taylor <iant@google.com>
6927
6928 PR 10980
6929 * options.h (class General_options): Add
6930 --allow-multiple-definition and -z muldefs.
6931 * resolve.cc (Symbol_table::should_override): Don't warn about a
6932 multiple symbol definition if --allow-multiple-definition or -z
6933 muldefs.
6934
6935 PR 10980
6936 * options.h (class General_options): Add --add-needed and
6937 --copy-dt-needed-entries. Tweak --as-needed help entry.
6938 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6939 error if --copy-dt-needed-entries aka --add-needed is used and
6940 would cause a change in behaviour.
6941
6942 PR 10980
6943 * options.h (class General_options): Add -G as a short version of
6944 --shared. Add no-op options -assert, -g, and -i.
6945
6946 2010-01-04 Sriraman Tallam <tmsriram@google.com>
6947
6948 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6949 check for .text or .gnu.linkonce.t sections.
6950 * icf.cc (Icf::find_identical_sections): Ditto.
6951 Change the detection for mangled function name within the section
6952 name.
6953 * icf.h (is_section_foldable_candidate): New function.
6954
6955 2009-12-30 Ian Lance Taylor <iant@google.com>
6956
6957 PR 10980
6958 * options.h (class General_options): Permit two dashes with
6959 --retain-symbols-file.
6960
6961 2009-12-30 Ian Lance Taylor <iant@google.com>
6962
6963 PR 10979
6964 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6965 don't put the file header and segment headers in the text
6966 segment.
6967
6968 PR 10979
6969 * common.cc (Sort_commons::operator()): Stabilize sort when both
6970 entries are NULL.
6971 (Symbol_table::do_allocate_commons_list): When allocating common
6972 symbols, skip a symbol which is no longer common.
6973 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6974 an object before checking its type.
6975 * testsuite/common_test_2.c: New file.
6976 * testsuite/common_test_3.c: New file.
6977 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6978 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6979 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6980 (common_test_2_pic.o, common_test_2.so): New targets.
6981 (common_test_3_pic.o, common_test_3.so): New targets.
6982 * testsuite/Makefile.in: Rebuild.
6983
6984 PR 10979
6985 * script.cc (read_input_script): If we see a new SECTIONS clause,
6986 and we have added an input section, give an error.
6987 * layout.h (class Layout): Add have_added_input_section function.
6988 Add have_added_input_section_ field.
6989 * layout.cc (Layout::Layout): Initialize
6990 have_added_input_section_.
6991 (Layout::layout): Set have_added_input_section_.
6992 (Layout::layout_eh_frame): Likewise.
6993
6994 2009-12-30 Ian Lance Taylor <iant@google.com>
6995
6996 PR 10931
6997 * options.h (class General_options): Add --sort-common option.
6998 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6999 * common.cc (Sort_common): Add sort_order parameter to
7000 constructor. Add sort_order_ field.
7001 (Sort_commons::operator): Check sort_order_.
7002 (Symbol_table::allocate_commons): Determine the sort order.
7003 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7004 Change all callers.
7005 (Symbol_table::do_allocate_commons_list): Likewise.
7006
7007 2009-12-30 Ian Lance Taylor <iant@google.com>
7008
7009 PR 10916
7010 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7011 symbols from this object, don't change the visibility of an
7012 undefined symbol.
7013 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7014
7015 2009-12-30 Ian Lance Taylor <iant@google.com>
7016
7017 PR 10861
7018 * script.h (class Version_script_info): Define Language enum.
7019 Update declarations. Define Glob, Exact, and Lookup types. Add
7020 new fields globals_, locals_, and is_finalized_.
7021 * script.cc: Various formatting fixes.
7022 (class Parser_closure): Change language_stack_ from a vector of
7023 std::string to one of Version_script_info::Language. Adjust all
7024 uses accordingly.
7025 (class Lazy_demangler): Remove.
7026 (struct Version_expression): Change language from std::string to
7027 Version_script_info::Language.
7028 (Version_script_info::Version_script_info): New function.
7029 (Version_script_info::~Version_script_info): Don't call clear.
7030 (Version_script_info::finalize): New function.
7031 (Version_script_info::build_lookup_tables): New function.
7032 (Version_script_info::build_expression_list_lookup): New
7033 function.
7034 (Version_script_info::get_symbol_version_helper): Rewrite to use
7035 lookup tables.
7036 (Version_script_info::print_expression_list): Adjust to use
7037 Version_script_info::Language.
7038 (script_push_lex_into_version_mode): Check that the version script
7039 has not been finalized.
7040 (version_script_push_lang): Change language string to
7041 Version_script_info::Language.
7042 * options.cc (Command_line::version_script): New function.
7043 * options.h (class General_options): Add finalize_dynamic_list
7044 function. Change version_script from declaration to definition.
7045 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7046 * testsuite/version_script.map: Remove duplicate def of foo.
7047 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7048 version_script.map.
7049 * testsuite/Makefile.in: Rebuild.
7050
7051 2009-12-30 Ian Lance Taylor <iant@google.com>
7052
7053 PR 10843
7054 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7055 if the input symbol index is 0, make the output symbol index 0.
7056
7057 2009-12-30 Ian Lance Taylor <iant@google.com>
7058
7059 PR 10670
7060 * options.h (class General_options): Add -x/--discard-all.
7061 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7062 --discard-all. If the local symbol needs a dynamic entry, check
7063 that before handling --discard-locals.
7064
7065 2009-12-30 Ian Lance Taylor <iant@google.com>
7066
7067 PR 10450
7068 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7069 flags to PF_R.
7070 (Output_segment::add_output_section): Don't change the flags if
7071 the type is PT_TLS.
7072
7073 PR 10450
7074 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7075 GNU hash table if they need a dynamic value. Otherwise, don't add
7076 them if they are defined in a dynamic object or are forced local.
7077
7078 2009-12-29 Ian Lance Taylor <iant@google.com>
7079
7080 PR 10450
7081 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7082 .gnu.hash table for a 32-bit target.
7083
7084 PR 10450
7085 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7086 regular and a dynamic object only needs a dynamic symbol table
7087 entry if it is externally visible.
7088
7089 PR 10450
7090 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7091 constructor. Add global_offset_table_ field.
7092 (Target_i386::got_section): Set global_offset_table_.
7093 (Target_i386::do_finalize_sections): Set global_offset_table_
7094 size.
7095 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7096 in constructor. Add global_offset_table_ field.
7097 (Target_x86_64::got_section): Set global_offset_table_.
7098 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7099 size.
7100
7101 * layout.cc (Layout::Layout): Initialize increase_relro_.
7102 (Layout::get_output_section): Add is_relro, is_last_relro, and
7103 is_first_non_relro parameters. Change all callers.
7104 (Layout::choose_output_section): Likewise.
7105 (Layout::add_output_section_data): Likewise.
7106 (Layout::make_output_section): Likewise.
7107 (Layout::set_segment_offsets): Clear increase_relro when using a
7108 linker script.
7109 * layout.h (class Layout): Add increase_relro method. Add
7110 increase_relro_ field. Update declarations.
7111 * output.cc (Output_section::Output_section): Initialize
7112 is_last_relro_ and is_first_non_relro_.
7113 (Output_segment::add_output_section): Group relro sections is
7114 do_sort is true. Handle is_last_relro and is_first_non_relro.
7115 (Output_segment::maximum_alignment): Remove relro handling.
7116 (Output_segment::set_section_addresses): Add increase_relro
7117 parameter. Change all callers. Add initial alignment to align
7118 relro sections on separate page. Remove old relro handling.
7119 (Output_segment::set_section_list_addresses): Remove in_relro
7120 parameter. Change all callers.
7121 (Output_segment::set_offset): Add increase parameter. Change all
7122 callers. Remove old relro handling.
7123 * output.h (class Output_section): Add new methods: is_last_relro,
7124 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7125 Add is_last_relro_ and is_first_non_relro_ fields.
7126 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7127 Create separate .got.plt section. Call increase_relro.
7128 * x86_64.cc (Target_x86_64::got_section): Likewise.
7129 * testsuite/relro_script_test.t: Add .got.plt.
7130
7131 PR 10450
7132 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7133 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7134 (Layout::finalize): Call set_dynamic_symbol_size.
7135 (Layout::set_dynamic_symbol_size): New function.
7136 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7137 set_dynamic_symbol_size.
7138
7139 PR 10450
7140 * output.h (class Output_section): Add is_entsize_zero_ field.
7141 * output.cc (Output_section::Output_section): Initialize
7142 is_entsize_zero_.
7143 (Output_section::set_entsize): If two different entsizes are
7144 requested, force it to zero.
7145 (Output_section::add_input_section): Set flags for .debug_str
7146 before updating section flags. Set entsize.
7147 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7148 and SHF_STRING if all input sections have those flags.
7149
7150 2009-12-29 Rafael Espindola <espindola@google.com>
7151
7152 * main.cc (main): Fix the sys time reporting.
7153 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7154 reporting.
7155
7156 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7157
7158 * options.cc (General_options::parse_version): Allow -v to exit
7159 without an error if there is nothing to link.
7160
7161 2009-12-29 Ian Lance Taylor <iant@google.com>
7162
7163 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7164 using a version of gcc before 4.1.
7165 * configure: Rebuild.
7166
7167 2009-12-28 Chris Demetriou <cgd@google.com>
7168
7169 * attributes.cc (Output_attributes_section_data::do_write): Use
7170 std::vector::front rather than std::vector::data.
7171
7172 2009-12-28 Ian Lance Taylor <iant@google.com>
7173
7174 * symtab.h (class Symbol_table): Add enum Defined.
7175 * resolve.cc (Symbol_table::should_override): Add defined
7176 parameter. Change all callers. Test whether object is NULL
7177 before calling a method on it.
7178 (Symbol_table::report_resolve_problem): Add defined parameter.
7179 Change all callers.
7180 (Symbol_table::should_override_with_special): Likewise.
7181 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7182 parameter. Change all callers.
7183 (Symbol_table::do_define_in_output_data): Likewise.
7184 (Symbol_table::define_in_output_segment): Likewise.
7185 (Symbol_table::do_define_in_output_segment): Likewise.
7186 (Symbol_table::define_as_constant): Likewise.
7187 (Symbol_table::do_define_as_constant): Likewise.
7188 * script.h (class Symbol_assignment): Add is_defsym parameter to
7189 constructor; change all callers.
7190 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7191 parameter. Change all callers. Add is_defsym_ field.
7192 (class Parser_closure): Add parsing_defsym parameter to
7193 constructor; change all callers. Add parsing_defsym accessor
7194 function. Add parsing_defsym_ field.
7195
7196 2009-12-28 Ian Lance Taylor <iant@google.com>
7197
7198 * gold.cc (queue_middle_tasks): Fix formatting.
7199 * object.cc (Relobj::is_section_name_included): Likewise.
7200
7201 2009-12-23 Ian Lance Taylor <iant@google.com>
7202
7203 * i386.cc (Target_i386::do_calls_non_split): Recognize
7204 -fsplit-stack prologue for a function with a static chain.
7205 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7206 -fsplit-stack prologue when using %r11.
7207
7208 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7209
7210 * options.cc (General_options::parse_version): Make -v continue and do
7211 the link like GNU ld does.
7212
7213 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7214
7215 * Makefile.am (CCFILES): Add timer.cc.
7216 (HFILES): Add timer.h.
7217 * configure.ac: Check for sysconf and times.
7218 * main.cc: include timer.h.
7219 (main): Use Timer instead of get_run_time.
7220 * timer.cc: New.
7221 * timer.h: New.
7222 * workqueue.cc: include timer.h.
7223 (Workqueue::find_and_run_task):
7224 Report user, sys and wall time.
7225 * Makefile.in: Regenerate.
7226 * config.in: Regenerate.
7227 * configure: Regenerate.
7228
7229 2009-12-16 Doug Kwan <dougkwan@google.com>
7230
7231 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7232 sections.
7233 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7234 relaxed input sections.
7235 * output.cc (Output_section::find_relaxed_input_section): Change
7236 return type to Output_relaxed_input_section pointer. Adjust code
7237 for new type of relaxed_input_section_map_.
7238 * output.h (Output_section::find_relaxed_input_section): Change
7239 return type to Output_relaxed_input_section pointer.
7240 (Output_section::Output_relaxed_input_section_by_input_section_map):
7241 New type.
7242 (Output_section::relaxed_input_section_map_): Change type to
7243 Output_section::Output_relaxed_input_section_by_input_section_map.
7244 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7245 input section.
7246
7247 2009-12-15 Ian Lance Taylor <iant@google.com>
7248
7249 * layout.cc (Layout::create_shstrtab): Only write out after input
7250 sections if we are compressing debug sections.
7251
7252 2009-12-15 Ian Lance Taylor <iant@google.com>
7253
7254 * archive.cc (Archive::add_symbols): Only look up a symbol without
7255 a version if there is, in fact, a version.
7256
7257 2009-12-14 Ian Lance Taylor <iant@google.com>
7258
7259 Revert -Wshadow changes, all changes from:
7260 2009-12-11 Doug Kwan <dougkwan@google.com>
7261 2009-12-11 Nick Clifton <nickc@redhat.com>
7262 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7263
7264 2009-12-11 Doug Kwan <dougkwan@google.com>
7265
7266 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7267 due to -Wshadow.
7268 * attributes.cc (Object_attribute::size): Ditto.
7269 (Attributes_section_data::size): Ditto.
7270 (Attributes_section_data::Attributes_section_data): Ditto.
7271 (Output_attributes_section_data::do_write): Ditto.
7272 * attributes.h (Object_attribute::set_type): Ditto.
7273 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7274
7275 2009-12-11 Nick Clifton <nickc@redhat.com>
7276
7277 * archive.cc: Fix shadowed variable warnings.
7278 * arm.cc: Likewise.
7279 * compressed_output.cc: Likewise.
7280 * compressed_output.h: Likewise.
7281 * configure: Likewise.
7282 * dwarf_reader.cc: Likewise.
7283 * dynobj.cc: Likewise.
7284 * dynobj.h: Likewise.
7285 * ehframe.cc: Likewise.
7286 * ehframe.h: Likewise.
7287 * errors.cc: Likewise.
7288 * expression.cc: Likewise.
7289 * fileread.cc: Likewise.
7290 * fileread.h: Likewise.
7291 * freebsd.h: Likewise.
7292 * i386.cc: Likewise.
7293 * icf.cc: Likewise.
7294 * incremental.h: Likewise.
7295 * layout.cc: Likewise.
7296 * layout.h: Likewise.
7297 * mapfile.cc: Likewise.
7298 * merge.cc: Likewise.
7299 * merge.h: Likewise.
7300 * object.cc: Likewise.
7301 * object.h: Likewise.
7302 * options.h: Likewise.
7303 * output.cc: Likewise.
7304 * output.h: Likewise.
7305 * parameters.cc: Likewise.
7306 * plugin.cc: Likewise.
7307 * powerpc.cc: Likewise.
7308 * reduced_debug_output.cc: Likewise.
7309 * reduced_debug_output.h: Likewise.
7310 * reloc.cc: Likewise.
7311 * reloc.h: Likewise.
7312 * resolve.cc: Likewise.
7313 * script-sections.cc: Likewise.
7314 * script.cc: Likewise.
7315 * script.h: Likewise.
7316 * sparc.cc: Likewise.
7317 * symtab.cc: Likewise.
7318 * symtab.h: Likewise.
7319 * target-select.cc: Likewise.
7320 * target-select.h: Likewise.
7321 * token.h: Likewise.
7322 * workqueue.cc: Likewise.
7323 * workqueue.h: Likewise.
7324 * x86_64.cc: Likewise.
7325
7326 2009-12-10 Doug Kwan <dougkwan@google.com>
7327
7328 * arm.cc (attributes.h): New include.
7329 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7330 (Arm_relobj::~Arm_relobj): Delete object pointed by
7331 attributes_section_data_.
7332 (Arm_relobj::attributes_section_data): New method definition.
7333 (Arm_relobj::attributes_section_data_): New data member declaration.
7334 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7335 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7336 attributes_section_data_.
7337 (Arm_dynobj::attributes_section_data): New method definition.
7338 (Arm_dynobj::attributes_section_data_): New data member declaration.
7339 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7340 initialization value of may_use_blx_ to false.
7341 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7342 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7343 object attributes to compute results instead of hard-coding.
7344 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7345 Target_arm::get_secondary_compatible_arch,
7346 Target_arm::set_secondary_compatible_arch
7347 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7348 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7349 New method declarations.
7350 (Target_arm::get_aeabi_object_attribute): New method definition.
7351 (Target_arm::attributes_section_data_): New data member declaration.
7352 (read_arm_attributes_section): New template definition.
7353 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7354 (Arm_dynobj::do_read_symbols): Ditto.
7355 (Target_arm::do_finalize_sections): Merge attributes sections from
7356 input. Check for BLX use after attributes section merging.
7357 Fix __exidx_start and __exidx_end visibility. Create an
7358 .ARM.attributes section if necessary.
7359 (Target_arm::get_secondary_compatible_arch,
7360 Target_arm::set_secondary_compatible_arch,
7361 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7362 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7363 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7364 New method definitions.
7365
7366 2009-12-09 Ian Lance Taylor <iant@google.com>
7367
7368 * plugin.cc (Plugin::load): Don't cast from void* to a function
7369 pointer.
7370
7371 2009-12-09 Ian Lance Taylor <iant@google.com>
7372
7373 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7374 information fields.
7375
7376 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7377
7378 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7379 Replace two_file_shared_1.so with two_file_shared_2.so.
7380 * testsuite/Makefile.in: Regenerated.
7381
7382 2009-12-08 Doug Kwan <dougkwan@google.com>
7383
7384 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7385 (HFILES): Add attributes.h and int_encoding.h.
7386 * Makefile.in: Regenerate.
7387 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7388 function definitions to int_encoding.cc
7389 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7390 prototypes to int_encoding.h
7391 * reduced_debug_output.cc (int_encoding.h): New include.
7392 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7393 function definitions to int_encoding.cc
7394 (insert_into_vector, read_from_pointer): Move template definitions to
7395 int_encoding.h
7396 * attributes.cc: New file.
7397 * attributes.h: New file.
7398 * int_encoding.cc: New file.
7399 * int_encoding.h: New file.
7400
7401 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7402
7403 PR gold/11055
7404 * incremental-dump.cc (dump_incremental_inputs): New.
7405 (main): Use dump_incremental_inputs.
7406
7407 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7408
7409 PR gold/10893
7410 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7411 checking elfcpp::STT_FUNC.
7412 (Target_i386::Relocate::relocate): Likewise.
7413 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7414
7415 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7416 symbols from shared libraries into normal FUNC symbols.
7417
7418 * symtab.h (Symbol): Add is_func and use it.
7419
7420 2009-12-05 Doug Kwan <dougkwan@google.com>
7421
7422 * arm.cc (Target_arm::arm_info): Initialize new fields
7423 attributes_section and attributes_vendor.
7424 * i386.cc (Target_i386::i386_info): Same.
7425 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7426 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7427 fields attributes_section and attributes_vendor.
7428 * sparc.cc (Target_sparc::sparc_info): Same.
7429 * target.h (Target::attributes_section, Target::attributes_vendor,
7430 Target::is_attributes_section, Target::attribute_arg_type,
7431 Target::attributes_order): New method definitions.
7432 (Target::Target_info::attributes_section,
7433 Target::Target_info::attributes_vendor): New fields.
7434 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7435 virtual method definitions.
7436 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7437 attributes_section and attributes_vendor.
7438 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7439
7440 2009-12-05 Doug Kwan <dougkwan@google.com>
7441
7442 * arm.cc: Update comments about interworking and stub generation.
7443 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7444 considered as non-PIC.
7445 (Arm_relocate_functions::base_abs): Fix formatting.
7446 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7447 of function to use GOT entry address instead of offset.
7448 (Target_arm::Scan::global): Issue an error if a symbol would need a
7449 PLT does not get one because it is untyped. Remove code to create
7450 dynamic symbols for relative branches.
7451 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7452 takes unsigned integer instead of boolean.
7453
7454 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7455
7456 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7457 (two_file_test_LDADD): Likewise.
7458 (common_test_1_LDADD): Likewise.
7459 (exception_test_LDADD) Likewise.
7460 (weak_test_LDADD): Likewise.
7461 (many_sections_test_LDADD): Likewise.
7462 (initpri1_LDADD): Likewise.
7463 (script_test_1_LDADD): Likewise.
7464 (script_test_2_LDADD): Likewise.
7465 (justsyms_LDADD): Likewise.
7466 (binary_test_LDADD): Likewise.
7467 (large_LDADD): Likewise.
7468 * testsuite/Makefile.in: Regenerated.
7469
7470 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7471
7472 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7473 (Symbol_table::override_with_special): Likewise.
7474 (Symbol_table::add_from_object): Likewise.
7475
7476 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7477
7478 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7479 Don't set the data_offset twice.
7480
7481 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7482
7483 * testsuite/Makefile.in: Regenerate.
7484
7485 2009-12-03 Doug Kwan <dougkwan@google.com>
7486
7487 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7488 (Target_arm::do_finalize_sections): Add parameter for symbol table
7489 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7490 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7491 parameter for symbol table pointer.
7492 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7493 an additional parameter for a pointer to symbol table.
7494 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7495 parameter for a symbol table pointer.
7496 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7497 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7498 Ditto.
7499 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7500 parameter for a symbol table pointer.
7501
7502 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7503
7504 * incremental.cc (Incremental_inputs_header)
7505 (Incremental_inputs_header_write, Incremental_inputs_entry)
7506 (Incremental_inputs_entry_write): Move ...
7507 * incremental.h (Incremental_inputs_header)
7508 (Incremental_inputs_header_write, Incremental_inputs_entry)
7509 (Incremental_inputs_entry_write): here.
7510
7511 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7512
7513 * incremental.cc (make_sized_incremental_binary): Set the target.
7514 Error if it is incompatible.
7515 * output.h (Output_file): Add filename method.
7516
7517 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7518
7519 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7520 from the get_* methods.
7521
7522 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7523
7524 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7525 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7526 Write 0 for the data_offset of scripts.
7527
7528 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7529
7530 * testsuite/Makefile.am: Add the incremental_test.sh test.
7531 * testsuite/incremental_test.sh: New.
7532 * testsuite/incremental_test_1.c: New.
7533 * testsuite/incremental_test_2.c: New.
7534
7535 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7536
7537 * incremental-dump.cc (main): Fix typos.
7538
7539 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7540
7541 PR gold/11025
7542 * incremental-dump.cc (main): Use llu to print 64 bit values.
7543
7544 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7545 H.J. Lu <hongjiu.lu@intel.com>
7546
7547 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7548 $(LIBDL).
7549 (incremental_dump_LDADD): Likewise.
7550 * Makefile.in: Regenerated.
7551
7552 2009-11-25 Doug Kwan <dougkwan@google.com>
7553
7554 Revert:
7555
7556 2009-11-25 Doug Kwan <dougkwan@google.com>
7557
7558 * arm.cc (Target_arm::Target_arm): Move method definition
7559 outside of class definition. Add code to handle
7560 --target1-rel, --target1-abs and --target2= options.
7561 (Target_arm::get_reloc_reloc_type): Change method to be
7562 non-static and const.
7563 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7564 New data member declaration.
7565 (Target_arm::Scan::local, Target_arm::Scan::global,
7566 Target_arm::Relocate::relocate,
7567 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7568 Adjust call to Target_arm::get_real_reloc_type.
7569 (Target_arm::get_real_reloc_type): Use command line options
7570 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7571 * options.h (--target1-rel, --target1-abs, --target2): New
7572 ARM-only options.
7573
7574 2009-11-25 Doug Kwan <dougkwan@google.com>
7575
7576 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7577 class definition. Add code to handle --target1-rel, --target1-abs
7578 and --target2= options.
7579 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7580 and const.
7581 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7582 member declaration.
7583 (Target_arm::Scan::local, Target_arm::Scan::global,
7584 Target_arm::Relocate::relocate,
7585 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7586 call to Target_arm::get_real_reloc_type.
7587 (Target_arm::get_real_reloc_type): Use command line options to
7588 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7589 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7590 options.
7591
7592 2009-11-25 Doug Kwan <dougkwan@google.com>
7593
7594 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7595 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7596 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7597 formatting.
7598 (Arm_relocate_functions::thm_call): Replace body with a call to
7599 Arm_relocate_functions::thumb_branch_common.
7600 (Arm_relocate_functions::thm_jump24,
7601 Arm_relocate_functions::thm_xpc22): New method definitions.
7602 (Arm_relocate_functions::thumb_branch_common): New method definition.
7603 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7604 operator.
7605 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7606 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7607
7608 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7609
7610 * Makefile.am: Build incremental-dump
7611 * Makefile.in: Regenerate.
7612 * incremental-dump.cc: New.
7613 * incremental.cc (Incremental_inputs_header_data,
7614 Incremental_inputs_entry_data): Move to incremental.h
7615 * incremental.h: (Incremental_inputs_header_data,
7616 Incremental_inputs_entry_data): Move from incremental.cc
7617
7618 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7619
7620 * incremental.cc (Incremental_inputs_header,
7621 Incremental_inputs_header_write, Incremental_inputs_entry,
7622 Incremental_inputs_entry_write): Add a typedef with the data type.
7623
7624 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7625
7626 * incremental.cc (Incremental_inputs_header,
7627 Incremental_inputs_header_write, Incremental_inputs_entry,
7628 Incremental_inputs_entry_write): Update comment about which
7629 type has the filed descriptions.
7630
7631 2009-11-15 Doug Kwan <dougkwan@google.com>
7632
7633 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7634 (Arm_relocate_functions::arm_branch_common): Change method defintion
7635 in class definition to a method declaration and update list of formal
7636 parameters.
7637 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7638 Arm_relocation_functions::jump24): Adjust call to
7639 Arm_relocate_functions::arm_branch_common. Update list of formal
7640 parameters.
7641 (Arm_relocate_functions::xpc25): New method definition.
7642 (Arm_relocate_functions::arm_branch_common): Move method defintion
7643 out from class definition. Use stubs for mode-switching and extending
7644 branch ranges.
7645 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7646 specially. Change code to enable use of stubs in ARM branches.
7647
7648 2009-11-10 Doug Kwan <dougkwan@google.com>
7649
7650 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7651 in method declaration.
7652 (Target_arm::relocate_stub): New method declaration.
7653 (Target_arm::default_target): Change to return a pointer instead of
7654 a const reference.
7655 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7656 Target_arm::default_target.
7657 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7658 method definition.
7659 (Target_arm::relocate_section): Adjust view.
7660 (Target_arm::relocate_stub): New method definition.
7661
7662 2009-11-10 Doug Kwan <dougkwan@google.com>
7663
7664 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7665 a format warning.
7666 * incremental.cc (open_incremental_binary): Initialized local
7667 variables to avoid warnings.
7668 * object.cc (make_elf_object): Ditto.
7669 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7670 a format warning.
7671
7672 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7673
7674 PR gold/10930
7675 * testsuite/plugin_test.c: Include "config.h".
7676
7677 2009-11-09 Doug Kwan <dougkwan@google.com>
7678
7679 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7680 (arm_symbol_value): Remove.
7681 (Arm_relocate_functions::arm_branch_common,
7682 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7683 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7684 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7685 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7686 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7687 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7688 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7689 Arm_relocate_functions::thm_mobw_abs_nc,
7690 Arm_relocate_functions::thm_mov_abs,
7691 Arm_relocate_functions::movw_prel_nc,
7692 Arm_relocate_functions::thm_movt_abs,
7693 Arm_relocate_functions::movt_prel,
7694 Arm_relocate_functions::thm_movw_prel_nc,
7695 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7696 (Target_arm::Relocate::relocate): Only decompose address into two
7697 parts if relocation type uses the thumb-bit and pass the actual
7698 bit instead of a flag indicating that the thumb-bit is used. Adjust
7699 calls to methods in Arm_relocate_functions for this change.
7700
7701 2009-11-08 Ian Lance Taylor <iant@google.com>
7702
7703 PR 10925
7704 * reloc.cc: Instantiate
7705 Sized_relobj::initialize_input_to_output_maps and
7706 Sized_relobj:free_input_to_output_maps.
7707
7708 2009-11-06 Ian Lance Taylor <iant@google.com>
7709
7710 PR 10876
7711 * defstd.cc (in_segment): Set only_if_ref true for "end".
7712
7713 2009-11-06 Doug Kwan <dougkwan@google.com>
7714
7715 * arm.cc (class Reloc_stub): Correct a comment.
7716 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7717 (Target_arm::scan_section_for_stubs): New method declaration.
7718 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7719 Change methods from private to protected.
7720 (Target_arm::do_may_relax): New method definition.
7721 (Target_arm::do_relax, Target_arm::group_sections,
7722 Target_arm::scan_reloc_for_stub,
7723 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7724 (Target_arm::arm_input_section_map_): New data member declaration.
7725 (Target_arm::scan_reloc_for_stub,
7726 Target_arm::scan_reloc_section_for_stubs,
7727 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7728 Target_arm::do_relax): New method definitions.
7729
7730 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7731
7732 * configure.ac: Check for (struct stat)::st_mtim
7733 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7734 * config.in: Regenerate.
7735 * configure: Regenerate.
7736
7737 2009-11-05 Ian Lance Taylor <iant@google.com>
7738
7739 PR 10910
7740 * output.cc (Output_segment::add_output_section): Add missing
7741 return statement.
7742
7743 2009-11-04 Ian Lance Taylor <iant@google.com>
7744
7745 PR 10880
7746 * object.h (class Object): Add is_needed and set_is_needed
7747 methods. Add is_needed_ field. Make bool fields into bitfields.
7748 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7749 defined in a dynamic object and referenced by a regular object,
7750 set is_needed for the dynamic object.
7751 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7752 if the file is marked with as_needed and it is not needed.
7753
7754 2009-11-04 Ian Lance Taylor <iant@google.com>
7755
7756 PR 10887
7757 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7758 tags if data is discarded by linker script.
7759 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7760 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7761 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7762 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7763
7764 2009-11-04 Ian Lance Taylor <iant@google.com>
7765
7766 * layout.cc (Layout::get_output_section): Add is_interp and
7767 is_dynamic_linker_section parameters. Change all callers.
7768 (Layout::choose_output_section): Likewise.
7769 (Layout::make_output_section): Likewise.
7770 (Layout::add_output_section_data): Add is_dynamic_linker_section
7771 parameter. Change all callers.
7772 * layout.h (class Layout): Update declarations.
7773 * output.h (class Output_section): Add is_interp, set_is_interp,
7774 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7775 Add is_interp_, is_dynamic_linker_section_ fields. Change
7776 generate_code_fills_at_write_ to a bitfield.
7777 * output.cc (Output_section::Output_sections): Initialize new
7778 fields.
7779 (Output_segment::add_output_section): Add do_sort parameter.
7780 Change all callers.
7781
7782 2009-11-03 Ian Lance Taylor <iant@google.com>
7783
7784 PR 10860
7785 * options.h (class General_options): Add --warn-common.
7786 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7787 merging two common symbols.
7788 (Symbol_table::should_override): Handle --warn-common when merging
7789 a common symbol with a defined symbol. Use report_resolve_problem
7790 for multiple definitions.
7791 (Symbol_table::report_resolve_problem): New function.
7792 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7793
7794 2009-11-03 Doug Kwan <dougkwan@google.com>
7795
7796 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7797 stub_factory_.
7798 (Target_arm::stub_factory): New method definition.
7799 (Target_arm::new_arm_input_section,
7800 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7801 Target_arm::reloc_uses_thumb_bit): New method declarations.
7802 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7803 New type definitions.
7804 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7805 member declarations.
7806 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7807 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7808 New method definitions.
7809
7810 2009-11-03 Ian Lance Taylor <iant@google.com>
7811
7812 * options.h (class General_options): Add --warn_constructors.
7813
7814 2009-11-03 Ian Lance Taylor <iant@google.com>
7815
7816 PR 10893
7817 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7818 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7819
7820 2009-11-03 Ian Lance Taylor <iant@google.com>
7821
7822 PR 10895
7823 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7824 --msgid-bugs-address.
7825 (install-pdf): New target.
7826 (install-data_yes): Look up one directory to find mkinstalldirs.
7827
7828 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7829
7830 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7831 tree.
7832
7833 2009-10-30 Doug Kwan <dougkwan@google.com>
7834
7835 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7836
7837 2009-10-30 Doug Kwan <dougkwan@google.com>
7838
7839 * arm.cc (Stub_addend_reader): New struct template definition
7840 and partial specializations.
7841 (Stub_addend_reader::operator()): New method definition for a
7842 partially specialized template.
7843
7844 2009-10-30 Doug Kwan <dougkwan@google.com>
7845
7846 * arm.cc (Arm_relobj::processor_specific_flags): New method
7847 definition.
7848 (Arm_relobj::do_read_symbols): New method declaration.
7849 (Arm_relobj::processor_specific_flags_): New data member declaration.
7850 (Arm_dynobj): New class definition.
7851 (Target_arm::do_finalize_sections): Add input_objects parameter.
7852 (Target_arm::do_adjust_elf_header): New method declaration.
7853 (Target_arm::are_eabi_versions_compatible,
7854 (Target_arm::merge_processor_specific_flags): New method declaration.
7855 (Target_arm::do_make_elf_object): New overloaded method definitions
7856 and declaration.
7857 (Arm_relobj::do_read_symbols): New method definition.
7858 (Arm_dynobj::do_read_symbols): Ditto.
7859 (Target_arm::do_finalize_sections): Add input_objects parameters.
7860 Merge processor-specific flags from all input objects.
7861 (Target_arm::are_eabi_versions_compatible,
7862 Target_arm::merge_processor_specific_flags,
7863 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7864 New method definitions.
7865 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7866 Input_objects pointer type parameter.
7867 * layout.cc (Layout::finalize): Pass input objects to target's.
7868 finalize_sections function.
7869 * output.cc (Output_file_header::do_sized_write): Set ELF file
7870 header's processor-specific flags.
7871 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7872 Input_objects pointer type parameter.
7873 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7874 * target.h (Input_objects): New forward class declaration.
7875 (Target::processor_specific_flags,
7876 Target::are_processor_specific_flags_sect): New method definitions.
7877 (Target::finalize_sections): Add input_objects parameter.
7878 (Target::Target): Initialize processor_specific_flags_ and
7879 are_processor_specific_flags_set_.
7880 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7881 parameter.
7882 (Target::set_processor_specific_flags): New method definition.
7883 (Target::processor_specific_flags_,
7884 Target::are_processor_specific_flags_set_): New data member
7885 declarations.
7886 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7887 Input_objects pointer type parameter.
7888
7889 2009-10-30 Doug Kwan <dougkwan@google.com>
7890
7891 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7892
7893 2009-10-28 Ian Lance Taylor <iant@google.com>
7894
7895 * object.h (class Relobj): Drop options parameter from
7896 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7897 do_scan_relocs, do_relocate. Change all callers.
7898 (class Sized_relobj): Drop options parameters from
7899 do_gc_process_relocs, do_scan_relocs, do_relocate,
7900 do_relocate_sections, relocate_sections, emit_relocs_scan,
7901 emit_relocs_scan_reltype. Change all callers.
7902 (struct Relocate_info): Remove options field and all references to
7903 it.
7904 * reloc.h (class Read_relocs): Remove options constructor
7905 parameter and options_ field. Change all callers.
7906 (class Gc_process_relocs, class Scan_relocs): Likewise.
7907 (class Relocate_task): Likewise.
7908 * target-reloc.h (scan_relocs): Remove options parameter. Change
7909 all callers.
7910 (scan_relocatable_relocs): Likewise.
7911 * target.h (class Sized_target): Remove options parameter from
7912 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7913 all callers.
7914 * gc.h (gc_process_relocs): Remove options parameter. Change all
7915 callers.
7916 * arm.cc: Update functions to remove options parameters.
7917 * i386.cc: Likewise.
7918 * powerpc.cc: Likewise.
7919 * sparc.cc: Likewise.
7920 * x86_64.cc: Likewise.
7921 * testsuite/testfile.cc: Likewise.
7922
7923 2009-10-28 Doug Kwan <dougkwan@google.com>
7924
7925 * arm.cc (Arm_relobj): New class definition.
7926 (Arm_relobj::scan_sections_for_stubs,
7927 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7928 New method definitions.
7929
7930 2009-10-28 Cary Coutant <ccoutant@google.com>
7931
7932 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7933 (Plugin::cleanup_done_): New member.
7934 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7935 (Plugin_manager::cleanup_done_): Remove.
7936 (Plugin_manager::add_input_file): Edit error message.
7937 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7938 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7939
7940 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7941
7942 * fileread.cc: (File_read::View::~View): Use the new
7943 data_ownership_ filed.
7944 (File_read::~File_read): Dispose the new whole_file_view_.
7945 (File_read::open): Mmap the whole file if needed.
7946 (File_read::open): Use whole_file_view_ instead of contents_.
7947 (File_read::find_view): Use whole_file_view_ if applicable.
7948 (File_read::do_read): Use whole_file_view_ instead of contents_.
7949 (File_read::make_view): Use whole_file_view_ instead of contents_,
7950 update File_read::View::View call.
7951 (File_read::find_or_make_view): Update File_read::View::View
7952 call.
7953 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7954 remove contents_
7955 (File_read::View::Data_ownership): New enum.
7956 (File_read::View::View): Replace bool mapped_ with Data_ownership
7957 argument.
7958 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7959 (File_read::View::data_ownership_): New field.
7960 (File_read::contents_): Remove (replaced by whole_file_view_).
7961 (File_read::whole_file_view_): New field.
7962 * options.h (class General_options): Add --keep-files-mapped.
7963
7964 2009-10-27 Cary Coutant <ccoutant@google.com>
7965
7966 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7967 * testsuite/Makefile.am (plugin_test_5): New test case.
7968 * testsuite/Makefile.in: Regenerate.
7969
7970 2009-10-25 Doug Kwan <dougkwan@google.com>
7971
7972 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7973 from private to protected to allow access by child class.
7974 (Sized_relobj::do_relocate_sections): New method declaration.
7975 (Sized_relobj::relocate_sections): Virtualize.
7976 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7977 Sized_relobj::relocate_sections. Instantiate template explicitly
7978 for different target sizes and endianity.
7979
7980 2009-10-24 Doug Kwan <dougkwan@google.com>
7981
7982 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7983 (Arm_input_section::as_arm_input_section): New method.
7984 (Arm_output_section): New class definition.
7985 (Arm_output_section::create_stub_group,
7986 Arm_output_section::group_sections): New method definitions.
7987
7988 2009-10-22 Doug Kwan <dougkwan@google.com>
7989
7990 * arm.cc (Arm_input_section): New class definition.
7991 (Arm_input_section::init, Arm_input_section:do_write,
7992 Arm_input_section::set_final_data_size,
7993 Arm_input_section::do_reset_address_and_file_offset): New method
7994 definitions.
7995
7996 2009-10-21 Doug Kwan <dougkwan@google.com>
7997
7998 * arm.cc (Stub_table, Arm_input_section): New forward class
7999 declarations.
8000 (Stub_table): New class defintion.
8001 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8002 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8003 New method definition.
8004
8005 2009-10-21 Doug Kwan <dougkwan@google.com>
8006
8007 * arm.cc: Update copyright comments.
8008 (Target_arm): New forward class template declaration.
8009 (Arm_address): New type.
8010 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8011 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8012 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8013 constants.
8014 (Insn_template): Same.
8015 (DEF_STUBS): New macro.
8016 (Stub_type): New enum type.
8017 (Stub_template): New class definition.
8018 (Stub): Same.
8019 (Reloc_stub): Same.
8020 (Stub_factory): Same.
8021 (Target_arm::Target_arm): Initialize may_use_blx_ and
8022 should_force_pic_veneer_.
8023 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8024 Target_arm::should_force_pic_veneer,
8025 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8026 Target_arm::using_thumb_only, Target_arm:;default_target): New
8027 method defintions.
8028 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8029 New data member declarations.
8030 (Insn_template::size, Insn_template::alignment): New method defintions.
8031 (Stub_template::Stub_template): New method definition.
8032 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8033 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8034 (Stub_factory::Stub_factory): New method definition.
8035 * gold.h (string_hash): New template.
8036 * output.h (Input_section_specifier::hash_value): Use
8037 gold::string_hash.
8038 (Input_section_specifier::string_hash): Remove.
8039 * stringpool.cc (Stringpool_template::string_hash): Use
8040 gold::string_hash.
8041
8042 2009-10-20 Doug Kwan <dougkwan@google.com>
8043
8044 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8045 symbols of relaxed input sections.
8046 * output.h (Output_section::find_relaxed_input_section): Make
8047 method public.
8048
8049 2009-10-16 Doug Kwan <dougkwan@google.com>
8050
8051 * dynobj.cc (Versions::Versions): Initialize version_script_.
8052 Only insert base version symbol definition for a shared object
8053 if version script defines any version versions.
8054 (Versions::define_base_version): New method definition.
8055 (Versions::add_def): Check that base version is not needed.
8056 (Versions::add_need): Define base version lazily.
8057 * dynobj.h (Versions::define_base_version): New method declaration.
8058 (Versions::needs_base_version_): New data member declaration.
8059 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8060 (check_DATA): Add no_version_test.stdout.
8061 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8062 New make rules.
8063 * testsuite/Makefile.in: Regenerate.
8064 * testsuite/no_version_test.c: New file.
8065 * testsuite/no_version_test.sh: Ditto.
8066
8067 2009-10-16 Doug Kwan <dougkwan@google.com>
8068
8069 * expression.cc (class Segment_start_expression): New class definition.
8070 (Segment_start_expression::value): New method definition.
8071 (script_exp_function_segment_start): Return a new
8072 Segment_start_expression.
8073 * gold/script-c.h (script_saw_segment_start_expression): New function
8074 prototype.
8075 * script-sections.cc (Script_sections::Script_sections): Initialize
8076 SAW_SEGMENT_START_EXPRESSION_ to false.
8077 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8078 and -Tbbs options to specify section addresses if given in
8079 command line and no SEGMENT_START expression is seen in a script.
8080 * script-sections.h (Script_sections::saw_segment_start_expression,
8081 Script_sections::set_saw_segment_start_expression): New method
8082 definition.
8083 (Script_sections::saw_segment_start_expression_): New data member
8084 declaration.
8085 * script.cc (script_saw_segment_start_expression): New function.
8086 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8087 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8088 script_test_7.sh and script_test_8.sh.
8089 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8090 script_test_8.stdout.
8091 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8092 (script_test_6, script_test_6.stdout, script_test_7,
8093 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8094 * Makefile.in: Regenerate.
8095 * testsuite/script_test_6.sh: New file.
8096 * testsuite/script_test_6.t: Same.
8097 * testsuite/script_test_7.sh: Same.
8098 * testsuite/script_test_7.t: Same.
8099 * testsuite/script_test_8.sh: Same.
8100
8101 2009-10-16 Doug Kwan <dougkwan@google.com>
8102
8103 * output.cc (Output_segment::set_section_list_address): Cast
8104 expressions to unsigned long long type to avoid format warnings.
8105
8106 2009-10-15 Ian Lance Taylor <iant@google.com>
8107
8108 * script.cc (Script_options::add_symbol_assignment): Always add a
8109 dot assignment to script_sections_.
8110 * script-sections.cc (Script_sections::add_dot_assignment):
8111 Initialize if necessary.
8112
8113 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8114 program headers with no load segment if there is a linker script.
8115
8116 * layout.cc (Layout::set_segment_offsets): Align the file offset
8117 to the segment aligment for -N or -n with no load segment.
8118 * output.cc (Output_segment::add_output_section): Don't crash if
8119 the first section is a TLS section.
8120 (Output_segment::set_section_list_addresses): Print an error
8121 message if the address moves backward in a linker script.
8122 * script-sections.cc
8123 (Output_section_element_input::set_section_addresses): Don't
8124 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8125 (Orphan_output_section::set_section_addresses): Likewise.
8126
8127 2009-10-15 Doug Kwan <dougkwan@google.com>
8128
8129 * layout.cc (Layout::finish_dynamic_section): Generate tags
8130 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8131 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8132 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8133
8134 2009-10-14 Ian Lance Taylor <iant@google.com>
8135
8136 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8137 fields.
8138 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8139 data_shdr fields of relinfo.
8140 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8141 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8142 R_386_TLS_LDO_32, adjust based on section flags.
8143 (Target_i386::Relocate::fix_up_ldo): Remove.
8144
8145 2009-10-13 Ian Lance Taylor <iant@google.com>
8146
8147 Add support for -pie.
8148 * options.h (class General_options): Add -pie and
8149 --pic-executable.
8150 (General_options::output_is_position_independent): Test -pie.
8151 (General_options::output_is_executable): Return true if not shared
8152 and not relocatable.
8153 (General_options::output_is_pie): Remove.
8154 * options.cc (General_options::finalize): Reject incompatible uses
8155 of -pie.
8156 * gold.cc (queue_middle_tasks): A -pie link is not static.
8157 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8158 * symtab.cc (Symbol::final_value_is_known): Return false if
8159 output_is_position_independent.
8160 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8161 output_is_position_independent.
8162 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8163 output_is_position_independent.
8164 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8165 output_is_position_independent.
8166 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8167 two_file_pie_test.
8168 (basic_pie_test.o, basic_pie_test): New targets.
8169 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8170 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8171 (two_file_pie_test): New target.
8172 * testsuite/Makefile.in: Rebuild.
8173 * README: Remove note saying that -pie is not supported.
8174
8175 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8176
8177 * options.h (class General_options): Add -init and -fini.
8178 * layout.cc (Layout::finish_dynamic_section): Emit
8179 given init and fini functions.
8180
8181 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8182
8183 * gc.h (gc_process_relocs): Check if icf is enabled using new
8184 function.
8185 * gold.cc (queue_initial_tasks): Likewise.
8186 (queue_middle_tasks): Likewise.
8187 * object.cc (do_layout): Likewise.
8188 * symtab.cc (is_section_folded): Likewise.
8189 * main.cc (main): Likewise.
8190 * reloc.cc (Read_relocs::run): Likewise.
8191 (Sized_relobj::do_scan_relocs): Likewise.
8192 * icf.cc (is_function_ctor_or_dtor): New function.
8193 (Icf::find_identical_sections): Check if function is ctor or dtor when
8194 safe icf is chosen.
8195 * options.h (General_options::icf): Change option to be an enum.
8196 (Icf_status): New enum.
8197 (icf_enabled): New method.
8198 (icf_safe_folding): New method.
8199 (set_icf_status): New method.
8200 (icf_status_): New variable.
8201 * (options.cc) (General_options::finalize): Set icf_status_.
8202 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8203 icf_test and icf_keep_unique_test to use the --icf enum flag.
8204 * testsuite/icf_safe_test.sh: New file.
8205 * testsuite/icf_safe_test.cc: New file.
8206
8207 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8208
8209 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8210 includes to gc.h and icf.h.
8211 * arm.cc: Include gc.h.
8212 * gold.cc: Likewise.
8213 * i386.cc: Likewise.
8214 * powerpc.cc: Likewise.
8215 * sparc.cc: Likewise.
8216 * x86_64.cc: Likewise.
8217 * gc.h: Include icf.h.
8218
8219 2009-10-11 Ian Lance Taylor <iant@google.com>
8220
8221 * plugin.cc: Include "gold.h" before other header files.
8222
8223 2009-10-10 Chris Demetriou <cgd@google.com>
8224
8225 * options.h (Input_file_argument::Input_file_type): New enum.
8226 (Input_file_argument::is_lib_): Replace with...
8227 (Input_file_argument::type_): New member.
8228 (Input_file_argument::Input_file_argument): Take Input_file_type
8229 'type' rather than boolean 'is_lib' as second argument.
8230 (Input_file_argument::is_lib): Use type_.
8231 (Input_file_argument::is_searched_file): New function.
8232 (Input_file_argument::may_need_search): Handle is_searched_file.
8233 * options.cc (General_options::parse_library): Support -l:filename.
8234 (General_options::parse_just_symbols): Update for Input_file_argument
8235 changes.
8236 (Command_line::process): Likewise.
8237 * archive.cc (Archive::get_file_and_offset): Likewise.
8238 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8239 * script.cc (read_script_file, script_add_file): Likewise.
8240 * fileread.cc (Input_file::Input_file): Likewise.
8241 (Input_file::will_search_for): Handle is_searched_file.
8242 (Input_file::open): Likewise.
8243 * readsyms.cc (Read_symbols::get_name): Likewise.
8244 * testsuite/Makefile.am (searched_file_test): New test.
8245 * testsuite/Makefile.in: Regenerate.
8246 * testsuite/searched_file_test.cc: New file.
8247 * testsuite/searched_file_test_lib.cc: New file.
8248
8249 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8250 Ian Lance Taylor <iant@google.com>
8251
8252 * descriptor.cc: Include <cstdio> and "binary-io.h".
8253 (Descriptors::open): Open the files in binary mode always.
8254 * script.cc (Lex::get_token): Treat \r as whitespace.
8255
8256 2009-10-09 Ian Lance Taylor <iant@google.com>
8257
8258 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8259
8260 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8261 Ian Lance Taylor <iant@google.com>
8262
8263 * configure.ac: Check for readv function also.
8264 * fileread.cc (readv): Define if not HAVE_READV.
8265 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8266 does not exist.
8267 * config.in: Regenerate.
8268 * configure: Regenerate.
8269
8270 2009-10-09 Doug Kwan <dougkwan@google.com>
8271
8272 * layout.cc (Layout::make_output_section): Call target hook to make
8273 ordinary output section.
8274 (Layout::finalize): Adjust parameter list of call the
8275 Target::may_relax().
8276 * layout.h (class Layout::section_list): New method.
8277 * merge.h (Output_merge_base::entsize): Change visibility to public.
8278 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8279 New methods.
8280 (Output_merge_string::do_is_string): New method.
8281 * object.cc (Sized_relobj::do_setup): renamed from
8282 Sized_relobj::set_up.
8283 * object.h (Sized_relobj::adjust_shndx,
8284 Sized_relobj::initializ_input_to_output_maps,
8285 Sized_relobj::free_input_to_output_maps): Change visibilities to
8286 protected.
8287 (Sized_relobj::setup): Virtualize.
8288 (Sized_relobj::do_setup): New method declaration.
8289 (Sized_relobj::invalidate_section_offset,
8290 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8291 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8292 * options.cc (parse_int): New function.
8293 * options.h (parse_int): New declaration.
8294 (DEFINE_int): New macro.
8295 (stub_group_size): New option.
8296 * output.cc (Output_section::Output_section): Initialize memebers
8297 merge_section_map_, merge_section_by_properties_map_,
8298 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8299 (Output_section::add_input_section): Handled deferred code-fill
8300 generation and remove an old comment.
8301 (Output_section::add_relaxed_input_section): New method definition.
8302 (Output_section::add_merge_input_section): Use merge section by
8303 properties map to speed to search. Update merge section maps
8304 as appropriate.
8305 (Output_section::build_relaxation_map): New method definition.
8306 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8307 Same.
8308 (Output_section::relax_input_section): Renamed to
8309 Output_section::convert_input_sections_to_relaxed_sections and change
8310 interface to take a vector of pointers to relaxed sections.
8311 (Output_section::find_merge_section,
8312 Output_section::find_relaxed_input_section): New method definitions.
8313 (Output_section::is_input_address_mapped,
8314 Output_section::output_offset, Output_section::output_address):
8315 Use output section data maps to speed up searching.
8316 (Output_section::find_starting_output_address): Add comments.
8317 (Output_section::do_write,
8318 Output_section::write_to_postprocessing_buffer): Do code-fill
8319 generation as appropriate.
8320 (Output_section::get_input_sections): Invalidate relaxed input section
8321 map.
8322 (Output_section::restore_states): Adjust type of checkpoint .
8323 Invalidate relaxed input section map.
8324 * output.h (Output_merge_base): New class declaration.
8325 (Input_section_specifier): New class defintion.
8326 (class Output_relaxed_input_section) Change base class to
8327 Output_section_data_build.
8328 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8329 base class initializer.
8330 (Output_section::add_relaxed_input_section): New method declaration.
8331 (Output_section::Input_section): Change visibility to protected.
8332 (Output_section::Input_section::relobj,
8333 Output_section::Input_section::shndx): Handle relaxed input sections.
8334 Output_section::input_sections) Change visibility to protected. Also
8335 define overload to return a non-const pointer.
8336 (Output_section::Merge_section_properties): New class defintion.
8337 (Output_section::Merge_section_by_properties_map,
8338 Output_section::Output_section_data_by_input_section_map,
8339 Output_section::Relaxation_map): New types.
8340 (Output_section::relax_input_section): Rename method to
8341 Output_section::convert_input_sections_to_relaxed_sections and change
8342 interface to take a vector of relaxed section pointers.
8343 (Output_section::find_merge_section,
8344 Output_section::find_relaxed_input_section,
8345 Output_section::build_relaxation_map,
8346 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8347 New method declarations.
8348 (Output_section::merge_section_map_
8349 Output_section::merge_section_by_properties_map_,
8350 Output_section::relaxed_input_section_map_,
8351 Output_section::is_relaxed_input_section_map_valid_,
8352 Output_section::generate_code_fills_at_write_): New data members.
8353 * script-sections.cc
8354 (Output_section_element_input::set_section_addresses): Call
8355 current_data_size and addralign methods of relaxed input sections.
8356 (Orphan_output_section::set_section_addresses): Call current_data_size
8357 and addralign methods of relaxed input sections.
8358 * symtab.cc (Symbol_table::compute_final_value): Extract template
8359 from the body of Symbol_table::sized_finalize_symbol.
8360 (Symbol_table::sized_finalized_symbol): Call
8361 Symbol_table::compute_final_value.
8362 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8363 (Symbol_table::compute_final_value): New templated method declaration.
8364 * target.cc (Target::do_make_output_section): New method defintion.
8365 * target.h (Target::make_output_section): New method declaration.
8366 (Target::relax): Add more parameters for input objects, symbol table
8367 and layout. Adjust call to do_relax.
8368 (Target::do_make_output_section): New method declaration.
8369 (Target::do_relax): Add parameters for input objects, symbol table
8370 and layout.
8371
8372 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8373
8374 * pread.c: Include stdio.h.
8375
8376 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8377
8378 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8379 defined.
8380
8381 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8382
8383 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8384 Change read_shndx type to unsigned int.
8385 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8386 int.
8387 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8388 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8389 Change read_shndx type to unsigned int.
8390 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8391 int.
8392 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8393 * layout.cc (Layout::create_symtab_sections): Cast the result of
8394 local_symcount * symsize to off_t in the gold_assert.
8395
8396 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8397
8398 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8399 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8400 R_ARM_BASE_ABS.
8401 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8402 (Arm_relocate_functions::thm_abs5): New function.
8403 (Arm_relocate_functions::abs12): New function.
8404 (Arm_relocate_functions::abs16): New function.
8405 (Arm_relocate_functions::base_abs): New function.
8406 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8407 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8408 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8409 R_ARM_BASE_ABS.
8410 (Scan::global): Likewise.
8411 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8412 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8413 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8414 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8415 R_ARM_BASE_ABS.
8416
8417 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8418
8419 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8420 (Arm_relocate_functions::movt_prel): New function.
8421 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8422 (Arm_relocate_functions::thm_movt_prel): New function.
8423 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8424 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8425 (Scan::global, Relocate::relocate): Likewise.
8426 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8427
8428 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8429
8430 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8431 Incremental_checker.
8432 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8433 unsigned int.
8434 (class Incremental_inputs_header): New class.
8435 (Incremental_inputs_header_writer): Edit comment.
8436 (Incremental_inputs_entry): New class.
8437 (Incremental_inputs_entry_writer): Edit comment.
8438 (Sized_incremental_binary::do_find_incremental_inputs_section):
8439 Add *strtab_shndx parameter, fill it.
8440 (Sized_incremental_binary::do_check_inputs): New method.
8441 (Incremental_checker::can_incrementally_link_output_file): Use
8442 Sized_incremental_binary::check_inputs.
8443 (Incremental_inputs::report_command_line): Save command line in
8444 command_line_.
8445 * incremental.h:
8446 (Incremental_binary::find_incremental_inputs_section): New
8447 method.
8448 (Incremental_binary::do_find_incremental_inputs_section): Add
8449 strtab_shndx parameter.
8450 (Incremental_binary::do_check_inputs): New pure virtual method.
8451 (Sized_incremental_binary::do_check_inputs): Declare.
8452 (Incremental_checker::Incremental_checker): Add incremental_inputs
8453 parameter, use it to initialize incremental_inputs_.
8454 (Incremental_checker::incremental_inputs_): New field.
8455 (Incremental_checker::command_line): New method.
8456 (Incremental_checker::inputs): New method.
8457 (Incremental_checker::command_line_): New field.
8458
8459 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8460
8461 * incremental.cc: Include <cstdarg> and "target-select.h".
8462 (vexplain_no_incremental): New function.
8463 (explain_no_incremental): New function.
8464 (Incremental_binary::error): New method.
8465 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8466 method.
8467 (make_sized_incremental_binary): New function.
8468 (open_incremental_binary): New function.
8469 (can_incrementally_link_file): Add checks if output is ELF and has
8470 inputs section.
8471 * incremental.h: Include "elfcpp_file.h" and "output.h".
8472 (Incremental_binary): New class.
8473 (Sized_incremental_binary): New class.
8474 (open_incremental_binary): Declare.
8475 * object.cc (is_elf_object): Use
8476 elfcpp::Elf_recognizer::is_elf_file.
8477 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8478 * output.h (Output_file::filesize): New method.
8479
8480 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8481
8482 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8483 New function.
8484 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8485 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8486 function.
8487 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8488 function.
8489 (Arm_relocate_functions::movw_abs_nc): New function.
8490 (Arm_relocate_functions::movt_abs): New function.
8491 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8492 (Arm_relocate_functions::thm_movt_abs): New function.
8493 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8494 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8495 (Scan::global): Likewise.
8496 (Relocate::relocate): Likewise.
8497 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8498
8499 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8500
8501 * arm.cc (Arm_relocate_functions::got_prel) New function.
8502 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8503 (Relocate::relocate): Likewise.
8504 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8505
8506 2009-10-06 Ian Lance Taylor <iant@google.com>
8507
8508 * options.h (class General_options): Define
8509 split_stack_adjust_size parameter.
8510 * object.h (class Object): Add uses_split_stack_ and
8511 has_no_split_stack_ fields. Add uses_split_stack and
8512 has_no_split_stack accessor functions. Declare
8513 handle_split_stack_section.
8514 (class Reloc_symbol_changes): Define.
8515 (class Sized_relobj): Define Function_offsets. Declare
8516 split_stack_adjust, split_stack_adjust_reltype, and
8517 find_functions.
8518 * object.cc (Object::handle_split_stack_section): New function.
8519 (Sized_relobj::do_layout): Call handle_split_stack_section.
8520 * dynobj.cc (Sized_dynobj::do_layout): Call
8521 handle_split_stack_section.
8522 * reloc.cc (Sized_relobj::relocate_sections): Call
8523 split_stack_adjust for executable sections in split_stack
8524 objects. Pass reloc_map to relocate_section.
8525 (Sized_relobj::split_stack_adjust): New function.
8526 (Sized_relobj::split_stack_adjust_reltype): New function.
8527 (Sized_relobj::find_functions): New function.
8528 * target-reloc.h: Include "object.h".
8529 (relocate_section): Add reloc_symbol_changes parameter. Change
8530 all callers.
8531 * target.h (class Target): Add calls_non_split method. Declare
8532 do_calls_non_split virtual method. Declare match_view and
8533 set_view_to_nop.
8534 * target.cc: Include "elfcpp.h".
8535 (Target::do_calls_non_split): New function.
8536 (Target::match_view): New function.
8537 (Target::set_view_to_nop): New function.
8538 * gold.cc (queue_middle_tasks): Give an error if mixing
8539 split-stack and non-split-stack objects with -r.
8540 * i386.cc (Target_i386::relocate_section): Add
8541 reloc_symbol_changes parameter.
8542 (Target_i386::do_calls_non_split): New function.
8543 * x86_64.cc (Target_x86_64::relocate_section): Add
8544 reloc_symbol_changes parameter.
8545 (Target_x86_64::do_calls_non_split): New function.
8546 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8547 parameter.
8548 * powerpc.cc (Target_powerpc::relocate_section): Add
8549 reloc_symbol_changes parameter.
8550 * sparc.cc (Target_sparc::relocate_section): Add
8551 reloc_symbol_changes parameter.
8552 * configure.ac: Call AM_CONDITIONAL for the default target.
8553 * configure: Rebuild.
8554 * testsuite/Makefile.am (TEST_AS): New variable.
8555 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8556 (check_DATA): Add split_i386 and split_x86_64 files.
8557 (SPLIT_DEFSYMS): Define.
8558 (split_i386_[1234n].o): New targets.
8559 (split_i386_[124]): New targets.
8560 (split_i386_[1234r].stdout): New targets.
8561 (split_x86_64_[1234n].o): New targets.
8562 (split_x86_64_[124]): New targets.
8563 (split_x86_64_[1234r].stdout): New targets.
8564 (MOSTLYCLEANFILES): Add new executables.
8565 * testsuite/split_i386.sh: New file.
8566 * testsuite/split_x86_64.sh: New file.
8567 * testsuite/split_i386_1.s: New file.
8568 * testsuite/split_i386_2.s: New file.
8569 * testsuite/split_i386_3.s: New file.
8570 * testsuite/split_i386_4.s: New file.
8571 * testsuite/split_i386_n.s: New file.
8572 * testsuite/split_x86_64_1.s: New file.
8573 * testsuite/split_x86_64_2.s: New file.
8574 * testsuite/split_x86_64_3.s: New file.
8575 * testsuite/split_x86_64_4.s: New file.
8576 * testsuite/split_x86_64_n.s: New file.
8577 * testsuite/testfile.cc (Target_test): Update relocation_section
8578 function.
8579 * testsuite/Makefile.in: Rebuild.
8580
8581 2009-10-06 Ian Lance Taylor <iant@google.com>
8582
8583 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8584 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8585 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8586 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8587 the address on ldo_addrs_.
8588 (Target_i386::Relocate::fix_up_ldo): New function.
8589
8590 2009-10-06 Rafael Espindola <espindola@google.com>
8591
8592 * plugin.cc (add_input_library): New.
8593 (Plugin::load): Add add_input_library to tv.
8594 (Plugin_manager::add_input_file): Add the is_lib argument.
8595 (add_input_file): Update call to Plugin_manager::add_input_file.
8596 (add_input_library): New.
8597 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8598
8599 2009-09-30 Doug Kwan <dougkwan@google.com>
8600
8601 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8602 symbol and call Symbol::may_need_copy_reloc to determine if
8603 a copy reloc is needed.
8604 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8605 nocopyreloc is given in command line.
8606 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8607 given in command line.
8608 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8609 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8610 of the removed Target_i386::may_need_copy_reloc.
8611 * options.h (copyreloc): New option with default value false.
8612 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8613 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8614 instead of the removed Target_powerpc::may_need_copy_reloc.
8615 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8616 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8617 instead of the removed Target_sparc::may_need_copy_reloc.
8618 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8619 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8620 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8621 instead of the removed Target_x86_64::may_need_copy_reloc.
8622
8623 2009-09-30 Ian Lance Taylor <iant@google.com>
8624
8625 * object.h (class Object): Remove target_ field, and target,
8626 sized_target, and set_target methods.
8627 (Object::sized_target): Remove.
8628 (class Sized_relobj): Update declarations. Remove sized_target.
8629 * object.cc (Sized_relobj::setup): Remove target parameter.
8630 Change all callers.
8631 (Input_objects::add_object): Don't do anything with the target.
8632 (make_elf_sized_object): Add punconfigured parameter. Change all
8633 callers. Set or test parameter target.
8634 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8635 Change all callers.
8636 * parameters.cc (Parameters::set_target): Change parameter type to
8637 be non-const.
8638 (Parameters::default_target): Remove.
8639 (set_parameters_target): Change parameter type to be non-const.
8640 (parameters_force_valid_target): New function.
8641 (parameters_clear_target): New function.
8642 * parameters.h (class Parameters): Update declarations. Remove
8643 default_target method. Add sized_target and clear_target
8644 methods. Change target_ to be non-const.
8645 (set_parameters_target): Update declaration.
8646 (parameters_force_valid_target): Declare.
8647 (parameters_clear_target): Declare.
8648 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8649 as NULL if we aren't searching.
8650 (Add_symbols::run): Don't check for compatible target.
8651 * fileread.cc (Input_file::open_binary): Call
8652 parameters_force_valid_target.
8653 * gold.cc (queue_middle_tasks): Likewise.
8654 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8655 set_target on object.
8656 * dynobj.h (class Sized_dynobj): Update declarations.
8657 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8658 make_elf_object returns NULL.
8659 (Archive::include_member): Don't check whether object target is
8660 compatible.
8661 * output.cc (Output_section::add_input_section): Get target from
8662 parameters.
8663 (Output_section::relax_input_section): Likewise.
8664 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8665 parameters.
8666 (Sized_relobj::do_scan_relocs): Likewise.
8667 (Sized_relobj::relocate_sections): Likewise.
8668 * resolve.cc (Symbol_table::resolve): Likewise.
8669 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8670 parameter. Change all callers.
8671 (Symbol_table::add_from_object): Get target from parameters.
8672 (Symbol_table::add_from_relobj): Don't check object target.
8673 (Symbol_table::add_from_dynobj): Likewise.
8674 (Symbol_table::define_special_symbol): Get target from
8675 parameters.
8676 * symtab.h (class Symbol_table): Update declaration.
8677 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8678 parameter. Change all callers. Clear parameter target.
8679 (Binary_test): Test target here.
8680 * testsuite/object_unittest.cc (gold_testsuite): Remove
8681 target_test_pointer parameter. Change all callers.
8682 (Object_test): Test target here.
8683
8684 2009-09-26 Ian Lance Taylor <iant@google.com>
8685
8686 * testsuite/initpri1.c: Don't try to use constructor priorities if
8687 compiling with gcc before 4.3.
8688
8689 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8690
8691 * testsuite/retain_symbols_file_test.sh (check_present): Change
8692 output file name to retain_symbols_file_test.stdout.
8693 (check_absent): Likewise.
8694
8695 2009-09-18 Craig Silverstein <csilvers@google.com>
8696
8697 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8698 * options.cc: Include <cerrno> and <fstream>.
8699 (General_options::finalize): Parse -retain-symbols-file tag.
8700 * options.h: New flag.
8701 (General_options): New method should_retain_symbol, new
8702 variable symbols_to_retain.
8703 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8704 should_retain_symbol map.
8705 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8706 * testsuite/Makefile.in: Regenerate.
8707 * testsuite/retain_symbols_file_test.sh: New file.
8708
8709 2009-09-18 Nick Clifton <nickc@redhat.com>
8710
8711 * po/es.po: Updated Spanish translation.
8712
8713 2009-09-17 Doug Kwan <dougkwan@google.com>
8714
8715 * debug.h (DEBUG_RELAXATION): New constant.
8716 (DEBUG_ALL): Add DEBUG_RELAXATION.
8717 (debug_string_to_enum): Add relaxation debug option.
8718 * layout.cc
8719 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8720 Layout::Relaxation_debug_check::read_sections,
8721 Layout::Relaxation_debug_check::read_sections): New method definitions.
8722 (Layout::Layout): Initialize data members
8723 record_output_section_data_from_scrips_,
8724 script_output_section_data_list_ and relaxation_debug_check_.
8725 (Layout::save_segments, Layout::restore_segments,
8726 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8727 Layout::relaxation_loop_body): New method definitions.
8728 (Layout::finalize): Support relaxation. Move section layout code to
8729 Layout::relaxation_loop_body.
8730 (Layout::set_asection_address_from_script): Move code for orphan
8731 section placement out.
8732 (Layout::place_orphan_sections_in_script): New method definition.
8733 * layout.h (Output_segment_headers, Output_file_header):
8734 New forward class declarations.
8735 (Layout::~Layout): Define.
8736 (Layout::new_output_section_data_from_script): New method definition.
8737 (Layout::place_orphan_sections_in_script): New method declaration.
8738 (Layout::Segment_states): New type declaration.
8739 (Layout::save_segments, Layout::restore_segments,
8740 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8741 Layout::relaxation_loop_body): New method declarations.
8742 (Layout::Output_section_data_list): New type declaration.
8743 (Layout::Relaxation_debug_check): New class definition.
8744 (Layout::record_output_section_data_from_script_,
8745 Layout::script_output_section_data_list_, Layout::segment_states_,
8746 Layout::relaxation_debug_check_): New data members.
8747 * output.cc: (Output_section_headers::do_size): New method definition.
8748 (Output_section_headers::Output_section_headers): Move size
8749 computation to Output_section_headers::do_size.
8750 (Output_segment_headers::do_size): New method definition.
8751 (Output_file_header::Output_file_header): Move size computation to
8752 Output_file_header::do_size and call it.
8753 (Output_file_header::do_size): New method definition.
8754 (Output_data_group::Output_data_group): Adjust call to
8755 Output_section_data.
8756 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8757 (Output_symtab_xindex::do_write): Add array bound check.
8758 (Output_section::Input_section::print_to_mapfile): Handle
8759 RELAXED_INPUT_SECTION_CODE.
8760 (Output_section::Output_section): Initialize data member checkpoint_.
8761 (Output_section::~Output_section): Delete checkpoint object pointed
8762 by checkpoint_.
8763 (Output_section::add_input_section): Always add an Input_section if
8764 relaxing.
8765 (Output_section::add_merge_input_section): Add assert.
8766 (Output_section::relax_input_section): New method definition.
8767 (Output_section::set_final_data_size): Set load address to zero for
8768 an unallocated section.
8769 (Output_section::do_address_and_file_offset_have_reset_values):
8770 New method definition.
8771 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8772 Handle relaxed input section.
8773 (Output_section::sort_attached_input_sections): Checkpoint input
8774 section list lazily.
8775 (Output_section::get_input_sections): Change type of input_sections to
8776 list of Simple_input_section pointers. Checkpoint input section list
8777 lazily. Also handle relaxed input sections.
8778 (Output_section::add_input_section_for_script): Take a reference to
8779 a Simple_input_section object instead of Relobj pointer and section
8780 index as parameter. Handle relaxed input sections.
8781 (Output_section::save_states, Output_section::restore_states): New
8782 method definitions.
8783 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8784 (Output_data::is_data_size_fixed): New method definition.
8785 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8786 if it is fixed.
8787 (Output_data::address_and_file_offset_have_reset_values): New method
8788 definition.
8789 (Output_data::do_address_and_file_offset_have_reset_values): New method
8790 definition.
8791 (Output_data::set_data_size): Check that data size is not fixed.
8792 (Output_data::fix_data_size): New method definition.
8793 (Output_data::is_data_size_fixed_): New data member.
8794 (Output_section_headers::set_final_data_size): New method definition.
8795 (Output_section_headers::do_size): New method declaration.
8796 (Output_segment_headers::set_final_data_size): New method definition.
8797 (Output_segment_headers::do_size): New method declaration.
8798 (Output_file_header::set_final_data_size)::New method definition.
8799 (Output_file_header::do_size)::New method declaration.
8800 (Output_section_data::Output_section_data): Add new parameter
8801 is_data_size_fixed and use it to fix data size.
8802 (Output_data_const::Output_data_const): Adjust call to base class
8803 constructor and fix data size.
8804 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8805 base class constructor and fix data size.
8806 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8807 base class constructor and fix data size.
8808 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8809 class constructor and fix data size.
8810 (Output_data_group::set_final_data_size): New method definition.
8811 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8812 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8813 class constructor and fix data size.
8814 (Output_relaxed_input_section): New class definition.
8815 (Output_section::Simple_input_section): New class definition.
8816 (Output_section::get_input_sections): Adjust parameter list.
8817 (Output_section::add_input_section_for_script): Same.
8818 (Output_section::save_states, Output_section::restore_states,
8819 Output_section::do_address_and_file_offset_have_reset_values,
8820 (Output_section::Input_section::Input_section): Handle
8821 RELAXED_INPUT_SECTION_CODE. Add new overload for
8822 Output_relaxed_input_section.
8823 (Output_section::Input_section::is_input_section,
8824 Output_section::Input_section::set_output_section): Handle relaxed
8825 input section.
8826 (Output_section::Input_section::is_relaxed_input_section,
8827 Output_section::Input_section::output_section_data,
8828 Output_section::Input_section::relaxed_input_section): New method
8829 definitions.
8830 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8831 value.
8832 (Output_section::Input_section::u1_): Update comments.
8833 (Output_section::Input_section::u2_): Add new union member poris.
8834 (Output_section::Checkpoint_output_section): New classs definition.
8835 (Output_section::relax_input_section): New method declaration.
8836 (Output_section::checkpoint_): New data member.
8837 (Output_segment): Update comments.
8838 (Output_segment::Output_segment): Un-privatize copy constructor.
8839 (Output_segment::operator=): Un-privatize.
8840 * script-sections.cc (Output_section_element::Input_section_list):
8841 Change element type to Output_section::Simple_input_section.
8842 (Output_section_element_dot_assignment::set_section_addresses):
8843 Register output section data for relaxation clean up.
8844 (Output_data_exression::Output_data_expression): Adjust call to base
8845 constructor to fix data size.
8846 (Output_section_element_data::set_section_addresses): Register
8847 Output_data_expression object for relaxation clean up.
8848 (struct Input_section_info): Replace Relobj pointer and section index
8849 pair with Output_section::Simple_input_section and Convert struct to a
8850 class.
8851 (Input_section_sorter::operator()): Adjust access to
8852 Input_section_info data member to use accessors.
8853 (Output_section_element_input::set_section_addresses): Use layout
8854 parameter. Adjust code to use Output_section::Simple_input_section
8855 and Input_secction_info classes. Register filler for relaxation
8856 clean up.
8857 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8858 and section index pair with Output_section::Simple_input_section
8859 class. Adjust code accordingly.
8860 (Phdrs_element::release_segment): New method definition.
8861 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8862 segment list.
8863 (Script_sections::release_segments): New method definition.
8864 * gold/script-sections.h (Script_sections::release_segments): New
8865 method declaration.
8866 * gold/target.h (Target::may_relax, Target::relax,
8867 Target::do_may_relax, Target::do_relax): New method definitions.
8868
8869 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8870
8871 * arm.cc (has_signed_unsigned_overflow): New function.
8872 (Arm_relocate_functions::abs8): New function.
8873 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8874 (Target_arm::Scan::global): Likewise.
8875 (Target_arm::relocate::relocate): Likewise.
8876 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8877 Likewise.
8878
8879 2009-09-16 Cary Coutant <ccoutant@google.com>
8880
8881 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8882 * testsuite/Makefile.in: Regenerate.
8883
8884 2009-09-11 Nick Clifton <nickc@redhat.com>
8885
8886 * po/gold.pot: Updated by the Translation project.
8887
8888 2009-09-08 Cary Coutant <ccoutant@google.com>
8889
8890 * output.cc (Output_file::open): Add execute permission to empty file.
8891 * testsuite/Makefile.am (permission_test): New test.
8892 * testsuite/Makefile.in: Regenerate.
8893
8894 2009-09-02 Ian Lance Taylor <iant@google.com>
8895
8896 * output.cc (Output_file::resize): Call map_no_anonymous rather
8897 than map.
8898
8899 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8900
8901 * gold.cc: Include "incremental.h".
8902 (queue_initial_tasks): Call Incremental_checker methods.
8903 * incremental.cc: Include "output.h".
8904 (Incremental_checker::can_incrementally_link_output_file): New
8905 method.
8906 * incremental.h (Incremental_checker): New class.
8907
8908 * output.cc (Output_file::open_for_modification): New method.
8909 (Output_file::map_anonymous): Changed return type to bool. Record
8910 map in base_ field.
8911 (Output_file::map_no_anonymous): New method, broken out of map.
8912 (Output_file::map): Use map_no_anonymous and map_anonymous.
8913 * output.h (class Output_file): Update declarations.
8914
8915 2009-08-24 Cary Coutant <ccoutant@google.com>
8916
8917 * options.h (Command_line::Pre_options): New class.
8918 (Command_line::pre_options): New member.
8919 * options.cc (gold::options::ready_to_register): New variable.
8920 (One_option::register_option): Do nothing if not registering options.
8921 Assert if same short option registered twice.
8922 (General_options::General_options): Turn off option registration when
8923 done constructing.
8924 (Command_line::Pre_options::Pre_options): New constructor.
8925
8926 2009-08-24 Cary Coutant <ccoutant@google.com>
8927
8928 * options.h (General_options::no_keep_memory): Remove incorrect
8929 short option.
8930
8931 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8932
8933 * Makefile.am (am__skiplex, am__skipyacc): New.
8934 * Makefile.in: Regenerate.
8935
8936 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8937
8938 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8939 (INCLUDES): ... this.
8940 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8941 (AM_CPPFLAGS): Renamed from ...
8942 (INCLUDE): ... this.
8943 * Makefile.in, testsuite/Makefile.in: Regenerate.
8944
8945 * Makefile.in: Regenerate.
8946 * aclocal.m4: Likewise.
8947 * config.in: Likewise.
8948 * configure: Likewise.
8949 * testsuite/Makefile.in: Likewise.
8950
8951 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8952 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8953 * Makefile.in: Regenerate.
8954 * testsuite/Makefile.in: Regenerate.
8955
8956 2009-08-19 Cary Coutant <ccoutant@google.com>
8957
8958 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8959 symbols in shared libraries overridden by hidden or internal symbols
8960 in the main program.
8961
8962 2009-08-19 Chris Demetriou <cgd@google.com>
8963
8964 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8965 checking source file names in error messages.
8966
8967 2009-08-18 Doug Kwan <dougkwan@google.com>
8968
8969 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8970 an elcpp::Ehdr as parameter. Adjust call to set_target.
8971 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8972 an elfcpp::Ehdr as parameter.
8973 * object.cc (Object::set_target): Remove the version that looks up
8974 a target and sets it.
8975 (Sized_relobj::setup): Take a Target object instead of
8976 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8977 (make_elf_sized_object): Find target and ask target to
8978 make an ELF object.
8979 * object.h: (Object::set_target): Remove the version that looks up
8980 a target and sets it.
8981 (Sized_relobj::setup): Take a Target object instead of
8982 an elfcpp:Ehdr as parameter.
8983 * target.cc: Include dynobj.h.
8984 (Target::do_make_elf_object_implementation): New.
8985 (Target::do_make_elf_object): New.
8986 * target.h (Target::make_elf_object): New template declaration.
8987 (Target::do_make_elf_object): New method declarations.
8988 (Target::do_make_elf_object_implementation): New template declaration.
8989
8990 2009-08-14 Ian Lance Taylor <iant@google.com>
8991
8992 * gold.h (FUNCTION_NAME): Define.
8993 (gold_unreachable): Use FUNCTION_NAME.
8994
8995 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8996
8997 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8998 symbol in the --keep-unique list is not found.
8999
9000 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9001
9002 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9003 been maked as --keep-unique.
9004 (Icf::unfold_section): New function.
9005 * icf.h (Icf::unfold_section): New function.
9006 * options.h (General_options::keep_unique): New option.
9007 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9008 * testsuite/Makefile.in: Regenerate.
9009 * testsuite/icf_keep_unique_test.sh: New file.
9010 * testsuite/icf_keep_unique_test.cc: New file.
9011
9012 2009-08-12 Cary Coutant <ccoutant@google.com>
9013
9014 PR 10471
9015 * resolve.cc (Symbol_table::resolve): Check for references from
9016 dynamic objects to hidden and internal symbols.
9017 * testsuite/Makefile.am (hidden_test.sh): New test.
9018 * testsuite/Makefile.in: Regenerate.
9019 * testsuite/hidden_test.sh: New script.
9020 * testsuite/hidden_test_1.c: New test source.
9021 * testsuite/hidden_test_main.c: New test source.
9022
9023 2009-08-11 Doug Kwan <dougkwan@google.com>
9024
9025 * arm.cc: Update comments.
9026 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9027 segment to locate the .ARM.exidx section if present.
9028
9029 2009-08-09 Doug Kwan <dougkwan@google.com>
9030
9031 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9032 patch.
9033
9034 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9035 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9036 compiler warnings.
9037
9038 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9039
9040 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9041 valid tls_segment only for non-debug-section relocations.
9042 * testsuite/Makefile.am: Add gc_tls_test.
9043 * testsuite/Makefile.in: Regenerate.
9044 * testsuite/gc_tls_test.cc: New file.
9045 * testsuite/gc_tls_test.sh: New file.
9046
9047 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9048
9049 * icf.cc: New file.
9050 * icf.h: New file.
9051 * Makefile.am (CCFILES): Add icf.cc.
9052 (HFILES): Add icf.h
9053 * Makefile.in: Regenerate.
9054 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9055 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9056 section, symbol and addend information for the relocs.
9057 * gold.cc (queue_middle_tasks): Call identical code folding.
9058 * gold.h: Add defines for multimap.
9059 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9060 to the call of finalize_local_symbols.
9061 * main.cc (main): Create object of class Icf.
9062 * object.cc (Sized_relobj::do_layout): Allow this function to be
9063 called twice during icf.
9064 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9065 to sections marked as identical by icf.
9066 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9067 when available.
9068 (Sized_relobj::do_section_entsize): New function.
9069 * object.h (Object::section_entsize): New function.
9070 (Object::do_section_entsize): New pure virtual function.
9071 (Relobj::finalize_local_symbols): Add new parameter.
9072 (Relobj::do_section_entsize): New function.
9073 * options.h (General_options::icf): New option.
9074 (General_options::icf_iterations): New option.
9075 (General_options::print_icf_sections): New option.
9076 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9077 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9078 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9079 icf.
9080 * symtab.cc (Symbol_table::is_section_folded): New function.
9081 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9082 to sections marked as identical by icf.
9083 * symtab.h (Symbol_table::set_icf): New function.
9084 (Symbol_table::icf): New function.
9085 (Symbol_table::is_section_folded): New function.
9086 (Symbol_table::icf_): New data member.
9087 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9088 * testsuite/Makefile.am: Add commands to build icf_test.
9089 * testsuite/Makefile.in: Regenerate.
9090 * testsuite/icf_test.sh: New file.
9091 * testsuite/icf_test.cc: New file.
9092
9093 2009-07-24 Chris Demetriou <cgd@google.com>
9094
9095 * layout.cc (is_compressible_debug_section): Fix incorrect
9096 comment about compressed section names.
9097
9098 2009-07-20 Ian Lance Taylor <ian@airs.com>
9099
9100 PR 10419
9101 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9102
9103 2009-07-16 Ian Lance Taylor <iant@google.com>
9104
9105 PR 10400
9106 * layout.h: #include <map>.
9107 (class Kept_section): Change from struct to class. Add accessors
9108 and setters. Add section size to Comdat_group mapping. Change
9109 Comdat_group to std::map. Add is_comdat_ field. Add
9110 linkonce_size field in union.
9111 (class Layout): Update declaration of find_or_add_kept_section.
9112 Don't declare find_kept_object.
9113 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9114 parameter. Add object, shndx, is_comdat, and is_group_name
9115 parameters. Change all callers. Adjust for new Kept_section.
9116 (Layout::find_kept_object): Remove.
9117 * object.cc (Sized_relobj::include_section_group): Update use of
9118 Kept_section. Rename secnum to shndx. Only record
9119 Kept_comdat_section if sections are the same size.
9120 (Sized_relobj::include_linkonce_section): Update use of
9121 Kept_section. Only record Kept_comdat_section if sections are the
9122 same size. Set size of linkonce section.
9123 (Sized_relobj::map_to_kept_section): Update call to
9124 get_kept_comdat_section.
9125 * object.h (class Sized_relobj): Rename fields in
9126 Kept_comdat_section to drop trailing underscores; change object
9127 field to Relobj*. Change Kept_comdat_section_table to store
9128 struct rather than pointer.
9129 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9130 Add kept_object and kept_shndx parameters. Change all callers.
9131 (Sized_relobj::get_kept_comdat_section): Change return type to
9132 bool. Add kept_object and kept_shndx parameters. Change all
9133 callers.
9134 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9135 Layout::find_or_add_kept_section.
9136
9137 2009-07-09 Ian Lance Taylor <iant@google.com>
9138
9139 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9140 Reserve space in the hash table.
9141
9142 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9143
9144 * fileread.cc (File_read::get_mtime): New method.
9145 * fileread.h (Timespec): New structure.
9146 (File_read::get_mtime): New method.
9147 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9148 Renamed from timestamp_nsec.
9149 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9150 Elf_Xword.
9151 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9152 timestamp_nsec.
9153 (Incremental_inputs::report_archive): Save mtime; style fix.
9154 (Incremental_inputs::report_obejct): Save mtime; style fix.
9155 (Incremental_inputs::report_script): Save mtime; style fix.
9156 (Incremental_inputs::finalize_inputs): Style fix.
9157 (Incremental_inputs::finalize): Style fix.
9158 (Incremental_inputs::create_input_section_data): Store inputs
9159 mtime.
9160 * incremental.h (Incremental_inputs::report_script): Add mtime
9161 argument.
9162 (Incremental_inputs::Input_info::Input_info): Intialize only one
9163 union member.
9164 (Incremental_inputs::Input_info::archive): Move to nameless
9165 union.
9166 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9167 (Incremental_inputs::Input_info::script): Move to nameless union.
9168 (Incremental_inputs::mtime): New field.
9169 * script.cc (read_input_script): Pass file mtime to
9170 Incremental_input.
9171 * script.h (Script_info::inputs): Style fix.
9172
9173 2009-07-01 Ian Lance Taylor <ian@airs.com>
9174
9175 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9176 instead of 32.
9177
9178 2009-06-24 Ian Lance Taylor <iant@google.com>
9179
9180 PR 10156
9181 * layout.cc (Layout::choose_output_section): If we find an
9182 existing section, update the flags.
9183 (Layout::create_notes): New function, broken out of
9184 Layout::finalize.
9185 (Layout::finalize): Don't create note sections.
9186 (Layout::create_note): Don't crash if linker script discards
9187 section.
9188 (Layout::create_gold_note): Likewise.
9189 (Layout::create_build_id): Likewise. Don't set
9190 after_input_sections on the section.
9191 (Layout::create_executable_stack_info): Remove target parameter.
9192 Change caller.
9193 * layout.h (class Layout): Declare create_notes. Update
9194 declaration of create_executable_stack_info.
9195 * gold.cc (queue_middle_tasks): Call create_notes.
9196 * output.cc (Output_section::update_flags_for_input_section): Move
9197 here from output.h. If SHF_ALLOC flag is newly set, mark address
9198 invalid.
9199 * output.h (Output_data::mark_address_invalid): New function.
9200 (class Output_section): Only declare, not define,
9201 update_flags_for_input_section. Remove set_flags.
9202
9203 2009-06-24 Ian Lance Taylor <iant@google.com>
9204
9205 * script-sections.cc (Output_section_definition::
9206 set_section_addresses): Rename shadowing local load_address to
9207 laddr.
9208
9209 2009-06-24 Ian Lance Taylor <iant@google.com>
9210
9211 PR 10244
9212 * reloc.cc (relocate_sections): Skip empty relocation sections.
9213
9214 2009-06-23 Ian Lance Taylor <iant@google.com>
9215
9216 PR 10156
9217 * layout.cc (Layout::create_note): Use choose_output_section
9218 rather than make_output_section.
9219
9220 2009-06-23 Ian Lance Taylor <iant@google.com>
9221
9222 PR 10237
9223 * options.cc (General_options::parse_V): Set printed_version_.
9224 (General_options::General_options): Initialize printed_version_.
9225 * options.h (class General_options): Add printed_version_ field.
9226 * gold.cc (queue_initial_tasks): If there are no input files,
9227 don't give a fatal error if we printed the version information.
9228 (queue_middle_tasks): If using -r with a shared object, give a
9229 fatal error rather than an ordinary error.
9230
9231 2009-06-23 Ian Lance Taylor <iant@google.com>
9232
9233 PR 10219
9234 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9235 (Layout::make_output_section): Set have_stabstr_section_ if we see
9236 a .stab*str section.
9237 (Layout::finalize): Call link_stabs_sections.
9238 (Layout::link_stabs_sections): New file.
9239 * layout.h (class Layout): Add have_stabstr_section_ field.
9240 Declare link_stabs_sections.
9241
9242 2009-06-23 Doug Kwan <dougkwan@google.com>
9243
9244 * Makefile.am (libgold_a_LIBADD): New.
9245 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9246 * Makefile.in: Regenerate.
9247 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9248 * configure: Regenerate.
9249 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9250 * fileread.cc: Include sys/state.h
9251 * gold.h: Declare memmem and strndup if found missing.
9252 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9253
9254 2009-06-23 Ian Lance Taylor <iant@google.com>
9255
9256 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9257 * configure: Rebuild.
9258
9259 2009-06-23 Ian Lance Taylor <iant@google.com>
9260
9261 PR 10147
9262 * object.cc (Object::section_contents): Don't try to get a view if
9263 the section has length zero.
9264 (Object::handle_gnu_warning_section): If the section is empty, use
9265 the name of the section as the warning.
9266
9267 2009-06-23 Ian Lance Taylor <iant@google.com>
9268
9269 PR 10133
9270 * stringpool.h (class Stringpool_template): Add optimize_ field.
9271 (Stringpool_template::set_optimize): New function.
9272 * stringpool.cc (Stringpool_template::Stringpool_template):
9273 Initialize optimize_ field.
9274 (Stringpool_template::set_string_offsets): Test local optimize
9275 fild rather than parameter.
9276 * layout.cc (Layout::Layout): Call set_optimize on the section
9277 name stringpool.
9278
9279 2009-06-22 Ian Lance Taylor <iant@google.com>
9280
9281 PR 10030
9282 * yyscript.y: Parse TARGET.
9283 * script.cc (script_set_target): New function.
9284 * script-c.h (script_set_target): Declare.
9285 * options.cc (General_options::string_to_object_format): Rename
9286 from string_to_object_format in anonymous namespace. Change
9287 callers.
9288 * options.h (class General_options): Declare
9289 string_to_object_format.
9290
9291 2009-06-22 Ian Lance Taylor <iant@google.com>
9292
9293 * script-sections.cc (Script_sections::create_segments): Don't put
9294 program headers in a PT_LOAD segment if -n or -N.
9295
9296 2009-06-22 Ian Lance Taylor <iant@google.com>
9297
9298 PR 10141
9299 * options.h (class General_options): Add -z lazy and -z now. Sort
9300 -z options into alphabetical order.
9301 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9302
9303 2009-06-21 Ian Lance Taylor <iant@google.com>
9304
9305 * layout.cc (Layout::make_output_section): Call
9306 Target::new_output_section.
9307 (Layout::attach_allocated_section_to_segment): Put large section
9308 sections in a separate load segment with the large segment flag
9309 set.
9310 (Layout::segment_precedes): Sort large data segments after other
9311 load segments.
9312 (align_file_offset): New static function.
9313 (Layout::set_segment_offsets): Use align_file_offset.
9314 * output.h (class Output_section): Add is_small_section_ and
9315 is_large_section_ fields.
9316 (Output_section::is_small_section): New function.
9317 (Output_section::set_is_small_section): New function.
9318 (Output_section::is_large_section): New function.
9319 (Output_section::set_is_large_section): New function.
9320 (Output_section::is_large_data_section): New function.
9321 (class Output_segment): Add is_large_data_segment_ field.
9322 (Output_segment::is_large_data_segment): New function.
9323 (Output_segment::set_is_large_data_segment): New function.
9324 * output.cc (Output_section::Output_section): Initialize new
9325 fields.
9326 (Output_segment::Output_segment): Likewise.
9327 (Output_segment::add_output_section): Add assertion that large
9328 data sections always go in large data segments. Force small data
9329 sections to the end of the list of data sections. Force small BSS
9330 sections to the start of the list of BSS sections. For large BSS
9331 sections to the end of the list of BSS sections.
9332 * symtab.h (class Symbol): Declare is_common_shndx.
9333 (Symbol::is_defined): Check Symbol::is_common_shndx.
9334 (Symbol::is_common): Likewise.
9335 (class Symbol_table): Define enum Commons_section_type. Update
9336 declarations. Add small_commons_ and large_commons_ fields.
9337 * symtab.cc (Symbol::is_common_shndx): New function.
9338 (Symbol_table::Symbol_table): Initialize new fields.
9339 (Symbol_table::add_from_object): Put small and large common
9340 symbols in the right list.
9341 (Symbol_table::sized_finalized_symbol): Check
9342 Symbol::is_common_shndx.
9343 (Symbol_table::sized_write_globals): Likewise.
9344 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9345 common symbol lists. Don't call do_allocate_commons_list if the
9346 list is empty.
9347 (Symbol_table::do_allocate_commons_list): Remove is_tls
9348 parameter. Add comons_section_type parameter. Change all
9349 callers. Handle small and large common symbols.
9350 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9351 Symbol::is_common_shndx.
9352 * resolve.cc (symbol_to_bits): Likewise.
9353 * target.h (Target::small_common_shndx): New function.
9354 (Target::small_common_section_flags): New function.
9355 (Target::large_common_shndx): New function.
9356 (Target::large_common_section_flags): New function.
9357 (Target::new_output_section): New function.
9358 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9359 small_common_section_flags, and large_common_section_flags
9360 fields.
9361 (Target::do_new_output_section): New virtual function.
9362 * arm.cc (Target_arm::arm_info): Initialize new fields.
9363 * i386.cc (Target_i386::i386_info): Likewise.
9364 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9365 Likewise.
9366 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9367 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9368 (Target_x86_64::do_new_output_section): New function.
9369 * configure.ac: Define conditional MCMODEL_MEDIUM.
9370 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9371 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9372 (large_LDFLAGS): Define.
9373 * testsuite/large.c: New file.
9374 * testsuite/testfile.cc (Target_test::test_target_info):
9375 Initialize new fields.
9376 * configure, testsuite/Makefile.in: Rebuild.
9377
9378 2009-06-05 Doug Kwan <dougkwan@google.com>
9379
9380 * Makefile.am (CCFILES): Add target.cc.
9381 * Makefile.in: Regenerate.
9382 * i386.cc (class Target_i386): Define new virtual method to
9383 override do_is_local_label_name in parent.
9384 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9385 local symbols if --discard-locals or -X is given.
9386 * options.h (class General_options): Declare new options
9387 '--discard-locals' and '-X' for discarding locals.
9388 * target.h (class Target): Define new methods is_local_label_name.
9389 Declare new virtual method do_is_local_label_name.
9390 * target.cc: New file.
9391 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9392 (check_SCRIPTS): Add discard_locals_test.sh.
9393 (check_DATA): Add discard_local_tests.syms.
9394 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9395 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9396 * testsuite/Makefile.in: Regenerate.
9397 * testsuite/discard_locals_test.c: New file.
9398 * testsuite/discard_locals_test.sh: Same.
9399
9400 2009-06-05 Doug Kwan <dougkwan@google.com>
9401
9402 * object.cc (Sized_relobj::Sized_relobj): Initialize
9403 discarded_eh_frame_shndx_ to -1U.
9404 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9405 section.
9406 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9407 a discarded .eh_frame section.
9408 (Sized_relobj::do_finalize_local_symbols): Ditto.
9409 * object.h (class Sized_relobj): Declare new member
9410 discarded_eh_frame_shndx_.
9411 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9412 (local_labels_test.o, local_labels_test): New rules.
9413 * testsuite/Makefile.in: Regenerate.
9414
9415 2009-06-04 Doug Kwan <dougkwan@google.com>
9416
9417 * layout.cc (Layout::section_name_mapping): Add mapping for
9418 special ARM sections.
9419
9420 2009-06-03 Doug Kwan <dougkwan@google.com>
9421
9422 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9423 (utils::has_overflow): Same.
9424
9425 2009-06-03 Ian Lance Taylor <iant@google.com>
9426
9427 * layout.cc (Layout::section_name_mapping): New array, replacing
9428 Layout::linkonce_mapping.
9429 (Layout::section_name_mapping_count): New variable, replacing
9430 Layout::linkonce_mapping_count.
9431 (Layout::linkonce_output_name): Remove.
9432 (Layout::output_section_name): Rewrite.
9433 * layout.h (class Layout): Rename Linkonce_mapping to
9434 Section_name_mapping, linkonce_mapping to section_name_mapping,
9435 linkonce_mapping_count to section_name_mapping_count. Don't
9436 declare linkonce_output_name.
9437
9438 2009-06-03 Doug Kwan <dougkwan@google.com>
9439
9440 * gold/arm.cc (namespace utils): New.
9441 (Target_arm::reloc_is_non_pic): Define new method.
9442 (class Arm_relocate_functions): New.
9443 (Target_arm::Relocate::relocate): Handle relocation types used by
9444 Android.
9445
9446 2009-06-03 Ian Lance Taylor <iant@google.com>
9447
9448 * arm.cc (Target_arm::scan::global): Use || instead of |.
9449
9450 2009-06-02 Doug Kwan <dougkwan@google.com>
9451
9452 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9453 issued_non_pic_error_.
9454 (class Target_arm::Scan): Declare new method check_non_pic.
9455 Define new method symbol_needs_plt_entry.
9456 Declare new data member issued_non_pic_error_.
9457 (class Target_arm::Relocate): Declare new method
9458 should_apply_static_reloc.
9459 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9460 (Target_arm::Scan::check_non_pic): Define new method.
9461 (Target_arm::Scan::local): Handle a small subset of reloc types used
9462 by Android.
9463 (Target_arm::Scan::local): Same.
9464 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9465
9466 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9467
9468 * incremental.cc (Incremental_inputs::report_command_line): Filter
9469 out --incremental-* options.
9470
9471 2009-05-29 Doug Kwan <dougkwan@google.com>
9472
9473 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9474 template class.
9475 (class Target_arm): Update comment.
9476 (Target_arm::Target_arm): Initialize new data members GOT_,
9477 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9478 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9479 and Target_arm::rel_dyn_section.
9480 Declare new_enum Target_arm::Got_type.
9481 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9482 and DYNBSS_.
9483 Update commments for member do_dynsym_value.
9484 (Target_arm::got_size, Target_arm::plt_section,
9485 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9486 new methods inside class defintion.
9487 (Target_arm::got_section): Define new method.
9488 (Target_arm::rel_dyn_section): Same.
9489 (Output_data_plt_arm): New template class.
9490 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9491 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9492 (Output_data_plt_arm::add_entry): Same.
9493 (Output_data_plt_arm::first_plt_entry): Define new
9494 static data member for PLT instruction template.
9495 (Output_data_plt_arm::plt_entry): Same.
9496 (Output_data_plt_arm::do_write): Define new method.
9497 (Target_arm::make_plt_entry): Same.
9498 (Target_arm::do_finalize_sections): Same.
9499 (Target_arm::do_dynsym_value): Same.
9500
9501 2009-05-28 Doug Kwan <dougkwan@google.com>
9502
9503 * Makefile.am (TARGETSOURCES): Add arm.cc.
9504 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9505 * Makefile.in: Regenerate.
9506 * arm.cc: New file.
9507 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9508
9509 2009-05-26 Doug Kwan <dougkwan@google.com>
9510
9511 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9512 (General_options::check_excluded_libs): Strip off directories in
9513 archive name before matching like GNU ld does.
9514 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9515 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9516 (exclude_libs_test_LDFLAGS): Add linker option
9517 -Wl,--exclude-libs,libexclude_libs_test_3
9518 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9519 an explicit archive without using -l.
9520 (alt/libexclude_libs_test_3.a): New make rule.
9521 * testsuite/Makefile.in: Regenerate.
9522 * testsuite/exclude_libs_test.c : Declare lib3_default().
9523 (main): Call it.
9524 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9525 * exclude_libs_test_3.c: New file.
9526
9527 2009-05-26 Nick Clifton <nickc@redhat.com>
9528
9529 * po/id.po: New Indonesian translation.
9530 * po/gold.pot: Updated template file.
9531
9532 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9533
9534 * testsuite/Makefile.am: Add -ffunction-sections to compile
9535 gc_comdat_test files. Add -Wl,--gc-sections to build
9536 gc_comdat_test.
9537 * testsuite/Makefile.in: Regenerate.
9538 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9539
9540 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9541
9542 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9543 kept comdat section was garbage collected.
9544 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9545 * testsuite/Makefile.in: Regenerate.
9546 * testsuite/gc_comdat_test.sh: New file.
9547 * testsuite/gc_comdat_test_1.cc: New file.
9548 * testsuite/gc_comdat_test_2.cc: New file.
9549
9550 2009-05-19 Doug Kwan <dougkwan@google.com>
9551
9552 * archive.cc (Archive::Archive): Move constructor from archive.h
9553 to here. Initialize no_export_.
9554 (Archive::get_elf_object_for_member): Set no_export flag of object.
9555 * archive.h (Archive::Archive): Move constructor body to
9556 archive.cc.
9557 (Archive::no_export): New method.
9558 (Archive::no_export_): New field.
9559 * object.h (Object::Object): Initialize no_export_ to false.
9560 (Object::no_export, Object::set_no_export): New methods.
9561 (Object::no_export_): New field.
9562 * options.cc (General_options::parse_exclude_libs): New method.
9563 (General_options::check_excluded_libs) Same.
9564 * options.h (exclude_libs): New option.
9565 (General_options::check_excluded_libs): New method declaration.
9566 (General_options::excluded_libs_): New field.
9567 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9568 default or protected visibility if an object has no-export flag set.
9569 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9570 (check_SCRIPTS): Add exclude_libs_test.sh.
9571 (check_DATA): Add exclude_libs_test.syms.
9572 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9573 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9574 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9575 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9576 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9577 libexclude_libs_test_2.a): New rules.
9578 * testsuite/Makefile.in: Regenerate.
9579 * testsuite/exclude_libs_test.c: New file.
9580 * testsuite/exclude_libs_test.sh: Ditto.
9581 * testsuite/exclude_libs_test_1.c: Ditto.
9582 * testsuite/exclude_libs_test_2.c: Ditto.
9583
9584 2009-05-15 Ian Lance Taylor <iant@google.com>
9585
9586 * configure.ac: Check for declarations for cases where libiberty.h
9587 checks HAVE_DECL_xxx.
9588 * configure, config.in: Rebuild.
9589
9590 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9591
9592 * gold.h (Incremental_argument_list): Remove (invalid) forward
9593 declaration.
9594 * incremental.cc (Incremental_inputs::report_achive): New method.
9595 (Incremental_inputs::report_object): New method.
9596 (Incremental_inputs::report_script): New method.
9597 (Incremental_inputs::finalize_inputs): New method.
9598 (Incremental_inputs::finalize): Call finalize_inputs().
9599 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9600 Create inputs entries.
9601 * incremental.h (Incremental_input_type): New enum.
9602 (Incremental_inputs::Incremental_input): Initialize new fields.
9603 (Incremental_inputs::report_inputs): New method.
9604 (Incremental_inputs::report_achive): New method.
9605 (Incremental_inputs::report_object): New method.
9606 (Incremental_inputs::report_script): New method.
9607 (Incremental_inputs::finalize_inputs): New method.
9608 (Incremental_inputs::Input_info): New struct.
9609 (Incremental_inputs::Input_info_map): New typedef.
9610 (Incremental_inputs::lock_): New field.
9611 (Incremental_inputs::Inputs_): New field.
9612 (Incremental_inputs::Inputs_map): New field.
9613 * main.cc (main): Call Incremental_input::report_inputs.
9614 * options.h (Input_argument_list): Typedef moved from
9615 Input_arguments.
9616 (Input_file_group::Files): Remove, use ::Input_argument_list.
9617 (Input_file_group::Input_argument_list): Remove, use
9618 ::Input_argument_list.
9619 * plugin.cc (Plugin_manager::add_input_file): Add error in
9620 incremental build.
9621 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9622 functions.
9623 * script.cc (read_input_script): Call
9624 Incremental_input::report_script.
9625 * script.h (Script_info): New class.
9626
9627 2009-04-27 Ian Lance Taylor <iant@google.com>
9628
9629 * x86_64.cc (do_adjust_output_section): Set entsize to
9630 plt_entry_size.
9631
9632 2009-04-23 Elliott Hughes <enh@google.com>
9633
9634 * output.cc (Output_file::close): After short writes, continue
9635 writing from the correct offset in the buffer being written.
9636
9637 2009-04-23 Chris Demetriou <cgd@google.com>
9638
9639 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9640 * configure: Regenerate.
9641 * config.in: Regenerate.
9642 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9643 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9644
9645 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9646
9647 * incremental.cc (Incremental_inputs_header_data): Renamed from
9648 Incremental_input_header_data.
9649 (Incremental_inputs_header_data::data_size): New field.
9650 (Incremental_inputs_header_data::put_input_file_count): Renamed
9651 from input_file_count.
9652 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9653 from command_line_offset.
9654 (Incremental_inputs_header_data::put_reserved): Renamed from
9655 put_reserved.
9656 (Incremental_inputs_entry_data): Renamed from
9657 Incremental_input_entry_data.
9658 (Incremental_inputs_entry_data::data_size): New field.
9659 (Incremental_inputs::report_command_line): New method.
9660 (Incremental_inputs::finalize): New method.
9661 (Incremental_inputs::create_incremental_inputs_data): New method.
9662 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9663 * incremental.h: New file.
9664 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9665 (Layout::finalize): Create incremental inputs section in
9666 incremental builds.
9667 (Layout::create_incremental_info_sections): New method.
9668 * layout.h (Layout::incremental_inputs): New method.
9669 (Layout::create_incremental_info_sections): New method.
9670 (Layout::incremental_inputs_): New field.
9671 * main.cc (main): Notify Incremental_input of the command line.
9672
9673 2009-04-01 Ian Lance Taylor <iant@google.com>
9674 Mikolaj Zalewski <mikolajz@google.com>
9675
9676 * gold.h (reserve_unordered_map): Define, three versions, one for
9677 each version of Unordered_map.
9678 * layout.cc (Layout::Layout): Remove options parameter. Add
9679 number_of_input_files parameter. Don't initialize options_.
9680 Initialize number_of_input_files_ and resized_signatures_. Move
9681 sections_are_attached_.
9682 (Layout::layout_group): Reserve space for group_signatures_.
9683 (Layout::find_or_add_kept_section): Change name parameter to be a
9684 reference. Resize signatures_ map when it gets large enough.
9685 (Layout::layout_eh_frame): Use parameters->options() instead of
9686 this->options_.
9687 (Layout::make_output_section): Likewise.
9688 (Layout::attach_allocated_section_to_segment): Likewise.
9689 (Layout::finalize, Layout::create_executable_stack): Likewise.
9690 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9691 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9692 * layout.h (class Layout): Update declarations. Remove options_
9693 field. Add number_of_input_files_ and resized_signatures_
9694 fields. Move sections_are_attached_ field.
9695 * main.cc (main): Pass number of input files to Layout
9696 constructor. Don't pass options.
9697
9698 2009-03-30 Ian Lance Taylor <iant@google.com>
9699
9700 * ffsll.c (ffsll): Correct implementation.
9701
9702 2009-03-27 Ian Lance Taylor <iant@google.com>
9703
9704 * ffsll.c: New file.
9705 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9706 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9707 * ftruncate.c (ftruncate): Declare before definition.
9708 * mremap.c (mremap): Likewise.
9709 * pread.c (pread): Likewise.
9710 * configure, Makefile.in, config.in: Rebuild.
9711
9712 * mremap.c: New file.
9713 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9714 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9715 (mremap): Declare if HAVE_MREMAP is not defined.
9716 * configure, Makefile.in, config.in: Rebuild.
9717
9718 2009-03-27 Cary Coutant <ccoutant@google.com>
9719
9720 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9721 position independent.
9722 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9723 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9724
9725 2009-03-24 Cary Coutant <ccoutant@google.com>
9726
9727 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9728 an executable.
9729 (needs_dynamic_reloc): Likewise.
9730
9731 2009-03-24 Ian Lance Taylor <iant@google.com>
9732
9733 * yyscript.y (file_cmd): Recognize EXTERN.
9734 (extern_name_list, extern_name_list_body): New nonterminals.
9735 * script.cc (script_add_extern): Define.
9736 * script-c.h (script_add_extern): Declare.
9737
9738 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9739
9740 * object.cc (is_elf_object): Define.
9741 * object.h (is_elf_object): Declare.
9742 * archive.cc (Archive::get_elf_object_for_member): Call
9743 is_elf_object.
9744 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9745
9746 2009-03-24 Elliott Hughes <enh@google.com>
9747
9748 * output.cc (Output_file::map_anonymous): Define.
9749 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9750 try an anonymous one. Report the size if the mmap fails.
9751 * output.h (class Output_file): Declare map_anonymous.
9752
9753 2009-03-24 Ian Lance Taylor <iant@google.com>
9754
9755 * target-select.cc (instantiate_target): Don't acquire the lock if
9756 the instantiated_target_ field has already been set.
9757
9758 2009-03-23 Ian Lance Taylor <iant@google.com>
9759
9760 * gold-threads.h (class Initialize_lock): Define.
9761 * gold-threads.cc (class Initialize_lock_once): Define.
9762 (initialize_lock_control): New static variable.
9763 (initialize_lock_pointer): New static variable.
9764 (initialize_lock_once): New static function.
9765 (Initialize_lock::Initialize_lock): Define.
9766 (Initialize_lock::initialize): Define.
9767 * target-select.h: Include "gold-threads.h".
9768 (class Target_selector): Add lock_ and initialize_lock_ fields.
9769 Don't define instantiate_target, just declare it.
9770 * target-select.cc (Target_selector::Target_selector): Initialize
9771 new fields.
9772 (Target_selector::instantiate_target): Define.
9773 * descriptors.h: Include "gold-threads.h".
9774 (class Descriptors): Add initialize_lock_ field.
9775 * descriptors.cc (Descriptors::Descriptors): Initialize new
9776 field.
9777 (Descriptors::open): Use initialize_lock_ field
9778 * errors.h (class Errors): Add initialize_lock_ field.
9779 * errors.cc (Errors::Errors): Initialize new field.
9780 (Errors::initialize_lock): Use initialize_lock_ field.
9781 * powerpc.cc (class Target_selector_powerpc): Remove
9782 instantiated_target_ field. In do_recognize call
9783 instantiate_target rather than do_instantiate_target. In
9784 do_instantiate_target just allocate a new target.
9785 * sparc.cc (class Target_selector_sparc): Likewise.
9786
9787 * freebsd.h: New file.
9788 * i386.cc: Include "freebsd.h".
9789 (Target_i386): Derive from Target_freebsd rather than
9790 Sized_target.
9791 (Target_selector_i386): Derive from Target_selector_freebsd rather
9792 than Target_selector.
9793 * x86_64.cc: Include "freebsd.h".
9794 (Target_x86_64): Derive from Target_freebsd rather than
9795 Sized_target.
9796 (Target_selector_x86_64): Derive from Target_selector_freebsd
9797 rather than Target_selector.
9798 * target.h (class Target): Add adjust_elf_header and
9799 do_adjust_elf_header.
9800 * output.cc (Output_file_header:: do_sized_write): Call target
9801 adjust_elf_header routine.
9802 * configure.tgt: Set targ_osabi.
9803 * configure.ac: Define GOLD_DEFAULT_OSABI.
9804 * parameters.cc (Parameters::default_target): Pass
9805 GOLD_DEFAULT_OSABI to select_target.
9806 * target-select.h (class Target_selector): Make instantiate_target
9807 protected rather than private.
9808 * Makefile.am (HFILES): Add freebsd.h.
9809 * configure, Makefile.in, config.in: Rebuild.
9810
9811 * merge.cc (do_add_input_section): Correct pend value. Change
9812 message about last entry not being null terminated from error to
9813 warning.
9814
9815 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9816
9817 * incremental.cc: New file.
9818 * Makefile.am (CCFILES): Add incremental.cc.
9819 * Makefile.in: Rebuild.
9820
9821 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9822
9823 * layout.cc (Layout::output_section_name): Preserve names
9824 of '.note.' sections.
9825
9826 2009-03-19 Ian Lance Taylor <iant@google.com>
9827
9828 * descriptors.cc (Descriptors::open): Check that the options are
9829 valid before using them.
9830
9831 2009-03-18 Ian Lance Taylor <iant@google.com>
9832
9833 * script-sections.h: Include <list>.
9834 (class Script_sections): Change Sections_elements from std::vector
9835 to std::list. Typedef public Elements_iterator. Add
9836 orphan_section_placement_, data_segment_align_start_, and
9837 saw_data_segment_align_ fields. Remove data_segment_align_index_
9838 field.
9839 * script-sections.cc (class Orphan_section_placement): New class.
9840 (class Sections_element): Add virtual functions is_relro and
9841 orphan_section_init. Remove virtual function place_orphan_here.
9842 (class Output_section_definition): Add is_relro and
9843 orphan_section_init. Remove place_orphan_here.
9844 (class Orphan_output_section): Likewise.
9845 (Script_sections::Script_sections): Update for field changes.
9846 (Script_sections::data_segment_align): Set saw_data_segment_align_
9847 and data_segment_align_start_, not data_segment_align_index.
9848 (Script_sections::data_segment_relro_end): Check
9849 saw_data_segment_align_. Use data_segment_align_start_ rather
9850 than data_segment_align_index_.
9851 (Script_sections::place_orphan): Rewrite to use
9852 Orphan_section_placement.
9853
9854 2009-03-17 Ian Lance Taylor <iant@google.com>
9855
9856 * archive.cc (Archive::add_symbols): Check for a version attached
9857 to the symbol name in the archive map.
9858 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9859 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9860 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9861 (ver_test_11.a): New target.
9862 * testsuite/Makefile.in: Rebuild.
9863
9864 * configure.ac: Check for chsize and posix_fallocate. Replace
9865 ftruncate.
9866 * ftruncate.c: New file, from gnulib.
9867 * output.cc (posix_fallocate): Define dummy version if not
9868 HAVE_POSIX_FALLOCATE.
9869 (Output_file::map): Call posix_fallocate rather than lseek and
9870 write.
9871 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9872 * configure, Makefile.in, config.in: Rebuild.
9873
9874 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9875
9876 * layout.h (Layout::create_note): Add section_name parameter.
9877 * layout.cc (Layout::create_note): Likewise.
9878 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9879
9880 2009-03-17 Ian Lance Taylor <iant@google.com>
9881
9882 * descriptors.cc: Include "options.h".
9883 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9884 (Descriptors::open): Always use O_CLOEXEC when opening a new
9885 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9886 then set FD_CLOEXEC.
9887
9888 * sparc.cc (class Target_sparc): Add has_got_section.
9889 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9890 make sure we have a GOT section.
9891
9892 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9893 (Target_sparc::Scan::local): Likewise.
9894 (Target_sparc::Scan::global): Likewise.
9895 (Target_sparc::Relocate::relocate): Likewise.
9896 (Target_sparc::Relocate::relocate_tls): Likewise.
9897
9898 * symtab.cc (Symbol_table::define_default_version): New function,
9899 broken out of add_from_object.
9900 (Symbol_table::add_from_object): Call define_default_version.
9901 (Symbol_table::define_special_symbol): Add resolve_oldsym
9902 parameter. Change all callers. If the version for a symbol comes
9903 from a version script, resolve it with the symbol with the same
9904 name with no version. Also add the symbol without a version if
9905 appropriate.
9906 (do_define_in_output_data): If resolving with oldsym, don't delete
9907 sym.
9908 (do_define_in_output_segment): Likewise.
9909 (do_define_as_constant): Likewise.
9910 * symtab.h (class Symbol_table): Update declarations.
9911
9912 2009-03-13 Ian Lance Taylor <iant@google.com>
9913
9914 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9915 (Read_symbols::requeue): New function.
9916 (Read_symbols::do_read_symbols): If make_elf_object fails because
9917 the target type is not configured, and the file was searched for,
9918 issue a warning and retry with the next directory.
9919 (Add_symbols::run): If the file has an incompatible format, and
9920 it was searched for, requeue the Read_symbols task. On error,
9921 release the object.
9922 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9923 dirindex parameter to constructor. Change all callers. Declare
9924 incompatible_warning and requeue.
9925 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9926 input_argument_ and input_group_ fields. Add them to
9927 constructor. Change all callers.
9928 (class Read_script): Add dirindex_ field. Add it to constructor.
9929 Change all callers.
9930 * archive.cc (Archive::setup): Remove input_objects parameter.
9931 Change all callers.
9932 (Archive::get_file_and_offset): Likewise.
9933 (Archive::read_all_symbols): Likewise.
9934 (Archive::read_symbols): Likewise.
9935 (Archive::get_elf_object_for_member): Remove input_objects
9936 parameter. Add punconfigured parameter. Change all callers.
9937 (Archive::add_symbols): Change return type to bool. Check return
9938 value of include_member.
9939 (Archive::include_all_members): Likewise.
9940 (Archive::include_member): Change return type to bool. Return
9941 false if first included object has incompatible target. Set
9942 included_member_ field.
9943 (Add_archive_symbols::run): If add_symbols returns false, requeue
9944 Read_symbols task.
9945 * archive.h (class Archive): Add included_member_ field.
9946 Initialize it in constructor. Add input_file and searched_for
9947 methods. Update declarations.
9948 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9949 input_argument_ fields. Add them to constructor. Change all
9950 callers.
9951 * script.cc: Include "target-select.h".
9952 (class Parser_closure): Add skip_on_incompatible_target_ and
9953 found_incompatible_target_ fields. Add
9954 skip_on_incompatible_target parameter to constructor. Change all
9955 callers. Add methods skip_on_incompatible_target,
9956 clear_skip_on_incompatible_target, found_incompatible_target, and
9957 set_found_incompatible_target.
9958 (read_input_script): Add dirindex parameter. Change all callers.
9959 If parser finds an incompatible target, requeue Read_symbols
9960 task.
9961 (script_set_symbol): Clear skip_on_incompatible_target in
9962 closure.
9963 (script_add_assertion, script_parse_option): Likewise.
9964 (script_start_sections, script_add_phdr): Likewise.
9965 (script_check_output_format): New function.
9966 * script.h (read_input_script): Update declaration.
9967 * script-c.h (script_check_output_format): Declare.
9968 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9969 (ignore_cmd): Remove OUTPUT_FORMAT.
9970 * fileread.cc (Input_file::Input_file): Add explicit this.
9971 (Input_file::will_search_for): New function.
9972 (Input_file::open): Add pindex parameter. Change all callers.
9973 * fileread.h (class Input_file): Add input_file_argument method.
9974 Declare will_search_for. Update declarations.
9975 * object.cc (make_elf_object): Add punconfigured parameter.
9976 Change all callers.
9977 * object.h (class Object): Make input_file public. Add
9978 searched_for method.
9979 (make_elf_object): Update declaration.
9980 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9981 restart search.
9982 * dirsearch.h (class Dirsearch): Update declaration.
9983 * options.h (class General_options): Add --warn-search-mismatch.
9984 * parameters.cc (Parameters::is_compatible_target): New function.
9985 * parameters.h (class Parameters): Declare is_compatible_target.
9986 * workqueue.cc (Workqueue::add_blocker): New function.
9987 * workqueue.h (class Workqueue): Declare add_blocker.
9988
9989 * fileread.cc (Input_file::open): Remove options parameter.
9990 Change all callers.
9991 (Input_file::open_binary): Likewise.
9992 * script.cc (read_input_script): Likewise.
9993 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9994 options parameter from constructor. Change all callers.
9995 (class Read_script): Likewise.
9996 * fileread.h (class Input_file): Update declarations.
9997 * script.h (read_input_script): Update declaration.
9998
9999 2009-03-10 Nick Clifton <nickc@redhat.com>
10000
10001 * po/es.po: New Spanish translation.
10002
10003 2009-03-06 Cary Coutant <ccoutant@google.com>
10004
10005 * options.cc (parse_short_option): Keep dash_z from registering itself.
10006
10007 2009-03-03 Ian Lance Taylor <iant@google.com>
10008
10009 PR 9918
10010 * target-reloc.h (relocate_section): Pass output_section to
10011 relocate.
10012 * i386.cc (Target_i386::should_apply_static_reloc): Add
10013 output_section parameter. Change all callers.
10014 (Target_i386::Relocate::relocate): Add output_section parameter.
10015 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10016 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10017 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10018 * testsuite/two_file_shared.sh: New script.
10019 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10020 (check_DATA): Add two_file_shared.dbg.
10021 (two_file_shared.dbg): New target.
10022 * testsuite/Makefile.in: Rebuild.
10023
10024 2009-03-01 Ian Lance Taylor <iant@google.com>
10025
10026 * configure.ac: Check for byteswap.h.
10027 * configure: Rebuild.
10028 * config.in: Rebuild.
10029
10030 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10031
10032 * layout.cc (Layout::find_or_add_kept_section): New function.
10033 (Layout::add_comdat): Removed.
10034 * layout.h (struct Kept_section): Move out of class Layout.
10035 Remove trailing underscores from field names. Add group_sections
10036 field. Rename group_ field to is_group. Change all uses.
10037 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10038 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10039 comdat_groups_ field.
10040 (Sized_relobj::include_section_group): Use
10041 find_or_add_kept_section and Kept_section::group_sections.
10042 (Sized_relobj::include_linkonce_section): Likewise.
10043 * object.cc (class Sized_relobj): Don't define Comdat_group or
10044 Comdat_group_table. Remove find_comdat_group and
10045 add_comdat_group. Remove comdat_groups_ field.
10046 * plugin.cc (include_comdat_group): Use
10047 Layout::find_or_add_kept_section.
10048
10049 2009-02-28 Ian Lance Taylor <iant@google.com>
10050
10051 * README: --gc-sections and map files are now supported. Document
10052 some build requirements.
10053
10054 PR 6992
10055 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10056 relocatable link set the value of the section symbol to zero.
10057 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10058 relocatable link don't include the section address in the local
10059 symbol value.
10060
10061 2009-02-27 Ian Lance Taylor <iant@google.com>
10062
10063 PR 6811
10064 * options.h (class Search_directory): Add is_system_directory.
10065 (class General_options): Declare is_in_system_directory.
10066 * options.cc (get_relative_sysroot): Make static.
10067 (get_default_sysroot): Make static.
10068 (General_optoins::is_in_system_directory): New function.
10069 * fileread.cc (Input_file::is_in_system_directory): New function.
10070 * fileread.h (class Input_file): Declare is_in_system_directory.
10071 * object.h (class Object): Add is_in_system_directory.
10072 (class Input_objects): Remove system_library_directory_ field.
10073 * object.cc (Input_objects::add_object): Don't set
10074 system_library_directory_.
10075 (input_objects::found_in_system_library_directory): Remove.
10076 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10077 parameter. Change all callers.
10078 (Symbol_table::sized_write_globals): Likewise.
10079 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10080 Call Object::is_in_system_directory.
10081 * symtab.h (class Symbol_table): Update declarations.
10082
10083 PR 5990
10084 * descriptors.h (Open_descriptor): Add is_on_stack field.
10085 * descriptors.cc (Descriptors::open): If the descriptor is on the
10086 top of the stack, remove it. Initialize is_on_stack field.
10087 (Descriptors::release): Only add pod to stack if it is not on the
10088 stack already.
10089 (Descriptors::close_some_descriptor): Clear stack_next and
10090 is_on_stack fields.
10091
10092 PR 7091
10093 * output.cc (Output_section::find_starting_output_address): Rename
10094 from starting_output_address; add PADDR parameter; change return
10095 type.
10096 * output.h (class Output_section): Declare
10097 find_starting_output_address instead of starting_output_address.
10098 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10099 section symbol for which we can't find a merge section.
10100
10101 PR 9836
10102 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10103 hidden or internal, force the symbol to be local.
10104 * resolve.cc (Symbol::override_visibility): Define.
10105 (Symbol::override_base): Use override_visibility.
10106 (Symbol_table::resolve): Likewise.
10107 (Symbol::override_base_with_special): Likewise.
10108 (Symbol_table::override_with_special): If the visibility is hidden
10109 or internal, force the symbol to be local.
10110 * symtab.h (class Symbol): Add set_visibility and
10111 override_visibility.
10112 * testsuite/ver_test_1.sh: New file.
10113 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10114 (check_DATA): Add ver_test_1.syms.
10115 (ver_test_1.syms): New target.
10116 * testsuite/Makefile.in: Rebuild.
10117
10118 2009-02-25 Cary Coutant <ccoutant@google.com>
10119
10120 * layout.cc (Layout::choose_output_section): Don't rename sections
10121 when using a linker script that has a SECTIONS clause.
10122 * Makefile.in: Regenerate.
10123
10124 * testsuite/Makefile.am (script_test_5.sh): New test case.
10125 * testsuite/Makefile.in: Regenerate.
10126 * testsuite/script_test_5.cc: New file.
10127 * testsuite/script_test_5.sh: New file.
10128 * testsuite/script_test_5.t: New file.
10129
10130 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10131
10132 * archive.cc (Archive::include_member): Update calls to add_symbols.
10133 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10134 the Layout argument.
10135 * dynobj.h (do_add_symbols): Add the Layout argument.
10136 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10137 Layout argument.
10138 * object.h (Object::add_symbols): Add the Layout argument.
10139 (Object::do_add_symbols): Add the Layout argument.
10140 (Sized_relobj::do_add_symbols): Add the Layout argument.
10141 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10142 Unify the two versions.
10143 (Add_plugin_symbols): Remove.
10144 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10145 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10146 (Add_plugin_symbols): Remove.
10147 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10148 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10149 (Add_symbols::run): Make it work with Pulginobj.
10150
10151 2009-02-06 Ian Lance Taylor <iant@google.com>
10152
10153 * object.cc (Sized_relobj::do_layout): Make info message start
10154 with lower case letter.
10155
10156 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10157
10158 * binary.cc: Fix file comment.
10159
10160 * options.h (enum Incremental_disposition): Define.
10161 (class General_options): Add new options: --incremental,
10162 --incremental_changed, --incremental_unchanged,
10163 --incremental_unknown. Add incremental_disposition_ and
10164 implicit_incremental_ fields.
10165 (General_options::incremental_disposition): New function.
10166 (class Position_dependent_options): Add incremental_disposition
10167 option.
10168 (Position_dependent_options::copy_from_options): Set incremental
10169 dispositions.
10170 * options.cc (General_options::parse_incremental_changed): New
10171 function.
10172 (General_options::parse_incremental_unchanged): New function.
10173 (General_options::parse_incremental_unknown): New function.
10174 (General_options::General_options): Initialize new fields
10175 incremental_disposition_ and implicit_incremental_.
10176 (General_options::finalize): Check for uasge of --incremental-*
10177 without --incremental.
10178
10179 2009-02-06 Chris Demetriou <cgd@google.com>
10180
10181 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10182 pointer and to report location as the file name associated with
10183 the symbol.
10184 (gold_undefined_symbol_at_location): New function to replace the
10185 old gold_undefined_symbol functionality.
10186 * target-reloc.h (relocate_section): Update to use
10187 gold_undefined_symbol_at_location.
10188 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10189 Call gold_undefined_symbol function rather than gold_error.
10190 * errors.h (Errors::undefined_symbol): Take location as a
10191 string, rather than calculating it from a relocation.
10192 * errors.cc (Errors::fatal): Print "fatal error:" before the
10193 formatted message.
10194 (Errors::error, Errors::error_at_location): Print "error: "
10195 before the formatted message.
10196 (Errors::undefined_symbol): Take location as a string, rather
10197 than calculating it from a relocation.
10198 (gold_undefined_symbol_at_location): New function akin to
10199 old gold_undefined_symbol, calculates location from relocation.
10200 (gold_undefined_symbol): Change to take only a Symbol pointer
10201 and to report location as the file name associated with the symbol.
10202 * testsuite/debug_msg.sh: Update for changed error messages.
10203 * testsuite/undef_symbol.sh: Likewise.
10204
10205 2009-02-04 Duncan Sands <baldrick@free.fr>
10206
10207 PR 9812
10208 * reduced_debug_output.h
10209 (Output_reduced_debug_abbrev_section::failed): Use format for
10210 gold_warning.
10211 (Output_reduced_debug_info_section::faild): Likewise.
10212
10213 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10214
10215 * script.cc (Lazy_demangler): New class.
10216 (Version_script_info::get_symbol_version_helper): Demangle a
10217 symbol only once.
10218
10219 2009-01-29 Cary Coutant <ccoutant@google.com>
10220
10221 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10222 to __tls_get_addr.
10223 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10224
10225 2009-01-28 Ian Lance Taylor <iant@google.com>
10226
10227 * version.cc (version_string): Bump to 1.9.
10228
10229 * gold.h: Include <cstring> and <stdint.h>.
10230 * version.cc: Include <cstdio>.
10231 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10232 warning.
10233 * reduced_debug_output.cc (insert_into_vector): Rename from
10234 Insert_into_vector; change all callers. Use Swap_unaligned to
10235 avoid aliasing issue; remove union since it is unnecessary.
10236
10237 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10238
10239 * Makefile.am (CCFILES): Add gc.cc.
10240 (HFILES): Add gc.h.
10241 * Makefile.in: Regenerate.
10242 * gold.cc (Gc_runner): New class.
10243 (queue_initial_tasks): Call garbage collection related tasks
10244 when corresponding options are invoked.
10245 (queue_middle_gc_tasks): New function.
10246 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10247 processed early before laying out sections during garbage collection.
10248 * gold.h (queue_middle_gc_tasks): New function.
10249 (is_prefix_of): Move from "layout.cc".
10250 * i386.cc (Target_i386::gc_process_relocs): New function.
10251 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10252 * main.cc (main): Create object of class "Garbage_collection".
10253 * object.cc (Relobj::copy_symbols_data): New function.
10254 (Relobj::is_section_name_included): New function.
10255 (Sized_relobj::do_layout): Allow this function to be called twice
10256 during garbage collection and defer layout of section during the
10257 first call.
10258 * object.h (Relobj::get_symbols_data): New function.
10259 (Relobj::is_section_name_included): New function.
10260 (Relobj::copy_symbols_data): New function.
10261 (Relobj::set_symbols_data): New function.
10262 (Relobj::get_relocs_data): New function.
10263 (Relobj::set_relocs_data): New function.
10264 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10265 (Relobj::gc_process_relocs): New function.
10266 (Relobj::do_gc_process_relocs): New pure virtual function.
10267 (Relobj::sd_): New data member.
10268 (Sized_relobj::is_output_section_offset_invalid): New function.
10269 (Sized_relobj::do_gc_process_relocs): New function.
10270 * options.h (General_options::gc_sections): Modify to not be a no-op.
10271 (General_options::print_gc_sections): New option.
10272 * plugin.cc (Plugin_finish::run): Remove function call to
10273 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10274 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10275 * reloc.cc (Read_relocs::run): Add task to process relocs and
10276 determine unreferenced sections when doing garbage collection.
10277 (Gc_process_relocs): New class.
10278 (Sized_relobj::do_gc_process_relocs): New function.
10279 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10280 sections that are garbage collected.
10281 * reloc.h (Gc_process_relocs): New class.
10282 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10283 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10284 symbols whose corresponding sections are garbage collected.
10285 (Symbol_table::Symbol_table): Add new parameter for the garbage
10286 collection object.
10287 (Symbol_table::gc_mark_undef_symbols): New function.
10288 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10289 (Symbol_table::gc_mark_dyn_syms): New function.
10290 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10291 as garbage.
10292 (Symbol_table::add_from_object): Likewise.
10293 (Symbol_table::add_from_relobj): When building shared objects, do not
10294 treat externally visible symbols as garbage.
10295 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10296 table information for static and relocatable links.
10297 * symtab.h (Symbol_table::set_gc): New function.
10298 (Symbol_table::gc): New function.
10299 (Symbol_table::gc_mark_undef_symbols): New function.
10300 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10301 (Symbol_table::gc_mark_dyn_syms): New function.
10302 (Symbol_table::gc_): New data member.
10303 * target.h (Sized_target::gc_process_relocs): New pure virtual
10304 function.
10305 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10306 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10307
10308 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10309
10310 * options.h (General_options::gc_sections): Define as a no-op for now.
10311 (General_options::no_keep_memory): Ditto.
10312 (General_options::Bshareable): Define.
10313 * options.cc (General_options::finalize): Honor -Bshareable.
10314
10315 2009-01-20 Andreas Schwab <schwab@suse.de>
10316
10317 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10318 read the value in the contents, since we don't use it. Use the
10319 template endianness when writing.
10320 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10321
10322 2009-01-19 Andreas Schwab <schwab@suse.de>
10323
10324 * configure.tgt (powerpc64-*): Fix targ_obj.
10325
10326 2009-01-15 Ian Lance Taylor <iant@google.com>
10327
10328 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10329 local symbols when stripping all symbols.
10330
10331 2009-01-14 Cary Coutant <ccoutant@google.com>
10332
10333 * output.cc (Output_reloc): Add explicit instantiations.
10334
10335 2009-01-14 Cary Coutant <ccoutant@google.com>
10336
10337 * archive.cc (Archive::get_elf_object_for_member): Remove call
10338 to File_read::claim_for_plugin.
10339 * descriptors.cc (Descriptors::open): Remove reference to
10340 is_claimed.
10341 (Descriptors::claim_for_plugin): Remove.
10342 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10343 (Descriptors::is_claimed): Remove.
10344 (claim_descriptor_for_plugin): Remove.
10345 * fileread.cc (File_read::claim_for_plugin): Remove.
10346 * fileread.h (File_read::claim_for_plugin): Remove.
10347 (File_read::descriptor): Reopen descriptor if necessary.
10348 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10349 (Plugin_manager::all_symbols_read): Add task parameter. Change
10350 all callers.
10351 (Plugin_manager::get_input_file): New function.
10352 (Plugin_manager::release_input_file): New function.
10353 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10354 corresponding data member.
10355 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10356 and pass to base constructor. Change all callers.
10357 (get_input_file, release_input_file): New functions.
10358 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10359 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10360 (Plugin_manager::all_symbols_read): Add task parameter.
10361 (Plugin_manager::get_input_file): New function.
10362 (Plugin_manager::release_input_file): New function.
10363 (Plugin_manager::task_): New data member.
10364 (Pluginobj::Pluginobj): Add filesize parameter.
10365 (Pluginobj::filename): New function.
10366 (Pluginobj::descriptor): New function.
10367 (Pluginobj::filesize): New function.
10368 (Pluginobj::filesize_): New data member.
10369 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10370 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10371 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10372
10373 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10374 with archive libraries.
10375 * testsuite/Makefile.in: Regenerate.
10376 * testsuite/plugin_test.c (struct sym_info): New type.
10377 (get_input_file, release_input_file): New static variables.
10378 (onload): Capture new transfer vector entries.
10379 (claim_file_hook): Stop reading at end of file according to filesize.
10380 Factor out parsing of readelf output into separate function.
10381 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10382 APIs and get the source file name from the symbol table. Convert
10383 source file name to corresponding object file name. Print info
10384 message when adding new input files.
10385 (parse_readelf_line): New function.
10386 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10387 * testsuite/plugin_test_2.sh: Likewise.
10388 * testsuite/plugin_test_3.sh: Likewise.
10389 * testsuite/plugin_test_4.sh: New test case.
10390
10391 2009-01-07 Ian Lance Taylor <iant@google.com>
10392
10393 * version.cc (version_string): Bump to 1.8.
10394
10395 2008-12-23 Cary Coutant <ccoutant@google.com>
10396
10397 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10398 * plugin.cc (Plugin_manager::finish): Rename as
10399 layout_deferred_objects. Move cleanup to separate function.
10400 (Plugin_manager::cleanup): New function.
10401 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10402 separately.
10403 * plugin.h (Plugin_manager::finish): Rename as
10404 layout_deferred_objects.
10405 (Plugin_manager::cleanup): New function.
10406 (Plugin_manager::cleanup_done): New field.
10407
10408 2008-12-23 Cary Coutant <ccoutant@google.com>
10409
10410 * plugin.cc (is_visible_from_outside): New function.
10411 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10412 so we don't return "IR only" status for exported symbols or -r links.
10413
10414 * testsuite/Makefile.am (plugin_test_3): New test case.
10415 * testsuite/Makefile.in: Regenerate.
10416 * testsuite/plugin_test_3.sh: New file.
10417
10418 2008-12-22 Cary Coutant <ccoutant@google.com>
10419
10420 * object.cc (Sized_relobj::layout_section): New function.
10421 (Sized_relobj::do_layout): Defer layout of input sections until after
10422 plugin has provided replacement files.
10423 (Sized_relobj::do_layout_deferred_sections): New function.
10424 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10425 (Relobj::layout_deferred_sections): New function.
10426 (Relobj::do_layout_deferred_sections): New function.
10427 (Sized_relobj::do_layout_deferred_sections): New function.
10428 (Sized_relobj::layout_section): New function.
10429 (Sized_relobj::Deferred_layout): New structure.
10430 (Sized_relobj::deferred_layout_): New field.
10431 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10432 Change all callers. Layout deferred sections.
10433 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10434 references.
10435 (Plugin_hook::run): Move code from do_plugin_hook inline.
10436 (Plugin_hook::do_plugin_hook): Remove.
10437 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10438 (Plugin_manager::finish): Renamed, was cleanup.
10439 (Plugin_manager::should_defer_layout): New function.
10440 (Plugin_manager::add_deferred_layout_object): New function.
10441 (Plugin_manager::Deferred_layout_list): New type.
10442 (Plugin_manager::deferred_layout_objects_): New field.
10443 (Plugin_hook::do_plugin_hook): Remove.
10444
10445 2008-12-17 Ian Lance Taylor <iant@google.com>
10446
10447 * options.h (class General_options): Add --no case for
10448 --export-dynamic.
10449
10450 2008-12-16 Cary Coutant <ccoutant@google.com>
10451
10452 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10453 vector.
10454 (Plugin_manager::claim_file): Create plugin object even if
10455 plugin did not call the add_symbols callback.
10456 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10457 asking for more symbols than were added.
10458 * testsuite/Makefile.am (plugin_test_1): Add test case with
10459 no global symbols.
10460 (empty.syms): New target.
10461 * testsuite/Makefile.in: Regenerate.
10462 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10463 message. Don't call add_symbols if no globals.
10464 (all_symbols_read_hook): Don't provide replacement for empty
10465 claimed file.
10466
10467 2008-12-12 Ian Lance Taylor <iant@google.com>
10468
10469 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10470 r_type == 0 for a local symbol with r_sym == 0.
10471 (scan_relocatable_relocs): Pass r_sym to
10472 local_non_section_strategy.
10473 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10474 r_sym parameter.
10475
10476 * configure.ac: Update test for TLS descriptors: they are
10477 supported as of glibc 2.9.
10478 * configure: Rebuild.
10479
10480 2008-12-11 Ian Lance Taylor <iant@google.com>
10481
10482 PR 7091
10483 * target-reloc.h (Default_scan_relocatable_relocs): For each
10484 function, map r_type == 0 to RELOC_DISCARD.
10485
10486 2008-12-10 Cary Coutant <ccoutant@google.com>
10487
10488 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10489 object to override a kept COMDAT group from a plugin object.
10490
10491 2008-12-09 Ian Lance Taylor <iant@google.com>
10492
10493 PR 7088
10494 * yyscript.y (file_cmd): Handle INPUT.
10495
10496 * testsuite/initpri1.c: Change all declarations to be full
10497 prototypes by adding void, to avoid compiler warnings.
10498
10499 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10500
10501 * options.cc (General_options::parse_plugin_opt): New.
10502 (General_options::add_plugin): The argument now is just the filename.
10503 (General_options::add_plugin_option): New.
10504 * options.h (plugin_opt): New.
10505 (add_plugin): Change argument name.
10506 (add_plugin_option): New.
10507 * plugin.cc (Plugin::load): Don't parse the plugin option.
10508 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10509 (Plugin::add_option): New.
10510 (Plugin::args_): Change type.
10511 (Plugin::filename_): New.
10512 (Plugin_manager::add_plugin_option): New.
10513 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10514 * testsuite/Makefile.in: Regenerate.
10515
10516 2008-12-05 Cary Coutant <ccoutant@google.com>
10517
10518 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10519 Handle --strip-lto-sections option.
10520 * options.h (strip_lto_sections): New option.
10521
10522 2008-12-01 Cary Coutant <ccoutant@google.com>
10523
10524 * plugin.cc (ld_plugin_message): Change format parameter to const.
10525 Fix mismatch between new[] and delete.
10526
10527 2008-11-14 Cary Coutant <ccoutant@google.com>
10528
10529 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10530 instead of -1U.
10531
10532 2008-11-05 Craig Silverstein <csilvers@google.com>
10533
10534 * options.cc (General_options::parse_dynamic_list): New function.
10535 * options.h (General_options): New flags dynamic_list,
10536 dynamic_list_data, dynamic_list_cpp_new, and
10537 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10538 (General_options::in_dynamic_list): New function.
10539 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10540 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10541 (Lex::can_continue_name): Likewise.
10542 (yylex): Likewise.
10543 (read_script_file): New parameter script_options.
10544 (read_dynamic_list): New function.
10545 (Script_options::define_dynamic_list): New function.
10546 (dynamic_list_keyword_parsecodes): New variable.
10547 (dynamic_list_keywords): New variable.
10548 * script.h (Script_options::define_dynamic_list): New function
10549 prototype.
10550 (read_dynamic_list): New function prototype.
10551 * symtab.cc (strprefix): New macro.
10552 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10553 dynamic_list_data, dynamic_list_cpp_new, and
10554 dynamic_list_cpp_typeinfo.
10555 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10556 (dynamic_list_expr): New rule.
10557 (dynamic_list_nodes): Likewise.
10558 (dynamic_list_node): Likewise.
10559 * testsuite/Makefile.am (dynamic_list): New test.
10560 * testsuite/Makefile.in: Regenerated.
10561 * testsuite/dynamic_list.t: New file.
10562 * testsuite/dynamic_list.sh: New file.
10563
10564 2008-11-05 Craig Silverstein <csilvers@google.com>
10565
10566 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10567 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10568 (t11_last): Likewise.
10569 * testsuite/ver_test_6.c (main): Likewise.
10570
10571 2008-10-07 Cary Coutant <ccoutant@google.com>
10572
10573 * options.c (General_options::finalize): Add check for -static and
10574 -shared.
10575 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10576 is not empty.
10577
10578 2008-10-02 Cary Coutant <ccoutant@google.com>
10579
10580 * plugin.cc (make_sized_plugin_object): Fix conditional
10581 compilation to work when not all targets are enabled.
10582
10583 2008-09-29 Cary Coutant <ccoutant@google.com>
10584
10585 * archive.cc (Archive::get_file_and_offset): Use filename instead
10586 of name to get library path.
10587 (Archive::include_member): Unlock external member of a thin archive.
10588
10589 * testsuite/Makefile.am (TEST_AR): New variable.
10590 (thin_archive_test_1): New test.
10591 (thin_archive_test_2): New test.
10592 * testsuite/Makefile.in: Regenerate.
10593 * testsuite/thin_archive_main.cc: New file.
10594 * testsuite/thin_archive_test_1.cc: New file.
10595 * testsuite/thin_archive_test_2.cc: New file.
10596 * testsuite/thin_archive_test_3.cc: New file.
10597 * testsuite/thin_archive_test_4.cc: New file.
10598
10599 2008-09-29 Cary Coutant <ccoutant@google.com>
10600
10601 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10602 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10603 instead of -1U.
10604 (Sized_relobj::do_finalize_local_symbols): Likewise.
10605 (Sized_relobj::map_to_kept_section): Likewise.
10606 * object.h (Sized_relobj::invalid_address): New constant.
10607 (Sized_relobj::do_output_section_offset): Check for invalid_address
10608 and return -1ULL.
10609 * output.cc (Output_reloc::local_section_offset): Use constant
10610 invalid_address instead of -1U.
10611 (Output_reloc::get_address): Likewise.
10612 (Output_section::output_address): Change -1U to -1ULL.
10613 * output.h (Output_reloc::invalid_address): New constant.
10614 * reloc.cc (Sized_relobj::write_sections): Use constant
10615 invalid_address instead of -1U.
10616 (Sized_relobj::relocate_sections): Likewise.
10617 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10618 values for merge sections.
10619 * target-reloc.h (relocate_for_relocatable): Use constant
10620 invalid_address instead of -1U.
10621
10622 2008-09-19 Cary Coutant <ccoutant@google.com>
10623
10624 Add plugin functionality for link-time optimization (LTO).
10625 * configure.ac (plugins): Add --enable-plugins option.
10626 * configure: Regenerate.
10627 * config.in: Regenerate.
10628 * Makefile.am (LIBDL): New variable.
10629 (CCFILES): Add plugin.cc.
10630 (HFILES): Add plugin.h.
10631 (ldadd_var): Add LIBDL.
10632 * Makefile.in: Regenerate.
10633
10634 * archive.cc: Include "plugin.h".
10635 (Archive::setup): Don't preread archive symbols when using a plugin.
10636 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10637 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10638 files.
10639 (Archive::include_member): Add symbols from plugin objects.
10640 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10641 * descriptors.cc (Descriptors::open): Check for file descriptors
10642 abandoned by plugins.
10643 (Descriptors::claim_for_plugin): New function.
10644 * descriptors.h (Descriptors::claim_for_plugin): New function.
10645 (Open_descriptor::is_claimed): New field.
10646 (claim_descriptor_for_plugin): New function.
10647 * fileread.cc (File_read::claim_for_plugin): New function.
10648 * fileread.h (File_read::claim_for_plugin): New function.
10649 (File_read::descriptor): New function.
10650 * gold.cc: Include "plugin.h".
10651 (queue_initial_tasks): Add task to call plugin hooks for generating
10652 new object files.
10653 * main.cc: Include "plugin.h".
10654 (main): Load plugin libraries.
10655 * object.h (Pluginobj): Declare.
10656 (Object::pluginobj): New function.
10657 (Object::do_pluginobj): New function.
10658 (Object::set_target): New function.
10659 * options.cc: Include "plugin.h".
10660 (General_options::parse_plugin): New function.
10661 (General_options::General_options): Initialize plugins_ field.
10662 (General_options::add_plugin): New function.
10663 * options.h (Plugin_manager): Declare.
10664 (General_options): Add --plugin option.
10665 (General_options::has_plugins): New function.
10666 (General_options::plugins): New function.
10667 (General_options::add_plugin): New function.
10668 (General_options::plugins_): New field.
10669 * plugin.cc: New file.
10670 * plugin.h: New file.
10671 * readsyms.cc: Include "plugin.h".
10672 (Read_symbols::do_read_symbols): Check for archive before checking
10673 for ELF file. Call plugin hooks to claim files.
10674 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10675 from a real object file; force override when processing replacement
10676 files.
10677 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10678 (Symbol::init_base_object): Likewise.
10679 (Symbol::init_base_output_data): Likewise.
10680 (Symbol::init_base_output_segment): Likewise.
10681 (Symbol::init_base_constant): Likewise.
10682 (Symbol::init_base_undefined): Likewise.
10683 (Symbol::output_section): Assert that object is not a plugin.
10684 (Symbol_table::add_from_pluginobj): New function.
10685 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10686 undefined.
10687 (Symbol_table::sized_write_globals): Likewise.
10688 (Symbol_table::add_from_pluginobj): Instantiate template.
10689 * symtab.h (Sized_pluginobj): Declare.
10690 (Symbol::in_real_elf): New function.
10691 (Symbol::set_in_real_elf): New function.
10692 (Symbol::in_real_elf_): New field.
10693 (Symbol_table::add_from_pluginobj): New function.
10694
10695 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10696 (LIBDL): New variable.
10697 (LDADD): Add LIBDL.
10698 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10699 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10700 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10701 (MOSTLYCLEANFILES): Likewise.
10702 * testsuite/Makefile.in: Regenerate.
10703 * testsuite/plugin_test.c: New file.
10704 * testsuite/plugin_test_1.sh: New file.
10705 * testsuite/plugin_test_2.sh: New file.
10706
10707 2008-09-16 Ian Lance Taylor <iant@google.com>
10708
10709 * target-reloc.h (relocate_section): Check whether a symbol is
10710 defined by the ABI before reporting an undefined symbol error.
10711 * target.h (Target::is_defined_by_abi): Make parameter const.
10712 (Target::do_is_defined_by_abi): Likewise.
10713 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10714 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10715 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10716 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10717 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10718 * testsuite/Makefile.in: Rebuild.
10719
10720 * fileread.cc (make_view): Add casts to avoid warning.
10721
10722 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10723
10724 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10725 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10726
10727 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10728
10729 * options.h (General_options::output_is_executable): New.
10730 (General_options::output_is_pie): New.
10731 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10732 for shared libraries.
10733 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10734
10735 2008-09-11 Chris Demetriou <cgd@google.com>
10736
10737 * options.h (origin): New -z option.
10738 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10739 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10740 in DT_FLAGS_1.
10741
10742 2008-09-05 Cary Coutant <ccoutant@google.com>
10743
10744 * fileread.cc (File_read::make_view): Add check for attempt to map
10745 beyond end of file.
10746
10747 2008-09-05 Cary Coutant <ccoutant@google.com>
10748
10749 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10750 explicit instantiations.
10751
10752 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10753
10754 PR gold/6858
10755 * options.cc (General_options::finalize): Allow undefined symbols
10756 in shlibs if linking -shared.
10757
10758 PR gold/6859
10759 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10760 symbols as not needing a dynsym entry.
10761
10762 2008-08-20 Craig Silverstein <csilvers@google.com>
10763
10764 * fileread.cc (File_read::open): Do not lock the file unless it
10765 was successfully opened.
10766
10767 2008-08-14 Cary Coutant <ccoutant@google.com>
10768
10769 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10770 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10771 * testsuite/tls_test.cc (struct int128): 128-bit struct
10772 for testing TLS relocs with non-zero addend.
10773 (v12): New TLS variable.
10774 (t12): New test.
10775 (t_last): Add check for v12.
10776 * testsuite/tls_test.h (t12): New function.
10777 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10778
10779 2008-08-13 Ian Lance Taylor <iant@google.com>
10780
10781 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10782 set tls_segment_ or relro_segment_.
10783 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10784 when appropriate.
10785 * output.h (Output_section::clear_is_relro): New function.
10786 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10787 sections specially even when output_data_ is empty.
10788 (Output_segment::maximum_alignment): When first section is relro,
10789 only force alignment for PT_LOAD segments.
10790 * script.cc (script_data_segment_align): New function.
10791 (script_data_segment_relro_end): New function.
10792 * script-c.h (script_data_segment_align): Declare.
10793 (script_data_segment_relro_end): Declare.
10794 * script-sections.h (class Script_sections): Declare
10795 data_segment_align and data_segment_relro_end. Add fields
10796 segment_align_index_ and saw_relro_end_.
10797 * script-sections.cc (class Sections_element): Add set_is_relro
10798 virtual function. Add new bool* parameter to place_orphan_here.
10799 Add get_output_section virtual function.
10800 (class Output_section_definition): Add set_is_relro. Add new
10801 bool* parameter to place_orphan_here. Add get_output_section.
10802 Add is_relro_ field.
10803 (Output_section_definition::Output_section_definition): Initialize
10804 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10805 and is_relro_ fields.
10806 (Output_section_definition::place_orphan_here): Add is_relro
10807 parameter.
10808 (Output_section_definition::set_section_addresses): Set relro for
10809 output section.
10810 (Output_section_definition::alternate_constraint): Likewise.
10811 (class Orphan_output_section): Add new bool* parameter to
10812 place_orphan_here. Add get_output_section.
10813 (Orphan_output_section::place_orphan_here): Add is_relro
10814 parameter.
10815 (Script_sections::Script_sections): Initialize
10816 data_segment_align_index_ and saw_relro_end_.
10817 (Script_sections::data_segment_align): New function.
10818 (Script_sections::data_segment_relro_end): New function.
10819 (Script_sections::place_orphan): Set or clear is_relro.
10820 (Script_sections::set_section_addresses): Force alignment of first
10821 TLS section.
10822 * yyscript.y (exp): Call script_data_segment_align and
10823 script_data_segment_relro_end.
10824 * testsuite/relro_script_test.t: New file.
10825 * testsuite/relro_test.cc (using_script): Declare.
10826 (t1, t2): Test using_script.
10827 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10828 (relro_script_test_SOURCES): Define.
10829 (relro_script_test_DEPENDENCIES): Define.
10830 (relro_script_test_LDFLAGS): Define.
10831 (relro_script_test_LDADD): Define.
10832 (relro_script_test.so): New target.
10833 * testsuite/Makefile.in: Rebuild.
10834
10835 2008-08-06 Cary Coutant <ccoutant@google.com>
10836
10837 * archive.cc (Archive::total_archives, Archive::total_members)
10838 (Archive::total_members_loaded): New variables.
10839 (Archive::setup): Add parameter. Add option to preread
10840 archive symbols.
10841 (Archive::read_armap): Add counter.
10842 (Archive::get_file_and_offset): New function.
10843 (Archive::get_elf_object_for_member): New function.
10844 (Archive::read_all_symbols): New function.
10845 (Archive::read_symbols): New function.
10846 (Archive::add_symbols): Add counters.
10847 (Archive::include_all_members): Use armap to find members if it's
10848 already built.
10849 (Archive::include_member): Skip reading symbols if already read.
10850 Factored code into Archive::get_file_and_offset and
10851 Archive::get_elf_object_for_member. Changed call to
10852 Mapfile::report_include_archive_member.
10853 (Archive::print_stats): New function.
10854 * archive.h: Declare Object and Read_symbols_data classes.
10855 (Archive::Archive): Add initializers for new members.
10856 (Archive::setup): Add parameter.
10857 (Archive::print_stats): New function.
10858 (Archive::total_archives, Archive::total_members)
10859 (Archive::total_members_loaded): New variables.
10860 (Archive::get_file_and_offset): New function.
10861 (Archive::get_elf_object_for_member): New function.
10862 (Archive::read_all_symbols): New function.
10863 (Archive::read_symbols): New function.
10864 (Archive::Archive_member): New class.
10865 (Archive::members_): New member.
10866 (Archive::num_members_): New member.
10867 * main.cc: Include archive.h.
10868 (main): Call Archive::print_stats.
10869 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10870 archive parameter; member_name is now the fully-decorated name.
10871 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10872 * options.h: (General_options): Add --preread-archive-symbols option.
10873 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10874 Archive::setup.
10875
10876 2008-08-04 Ian Lance Taylor <iant@google.com>
10877
10878 * symtab.h (Symbol::use_plt_offset): New function.
10879 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10880 * powerpc.cc (Relocate::relocate): Likewise.
10881 * sparc.cc (Relocate::relocate): Likewise.
10882 * x86_64.cc (Relocate::relocate): Likewise.
10883 * testsuite/weak_plt.sh: New test.
10884 * testsuite/weak_plt_main.cc: New test.
10885 * testsuite/weak_plt_shared.cc: New test.
10886 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10887 (check_PROGRAMS): Add weak_plt.
10888 (check_DATA): Add weak_plt_shared.so.
10889 (weak_plt_main_pic.o, weak_plt): New targets.
10890 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10891 * testsuite/Makefile.in: Rebuild.
10892
10893 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10894 gcctestdir/ld.
10895 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10896 * testsuite/Makefile.in: Rebuild.
10897
10898 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10899
10900 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10901 * Makefile.in: Regenerate.
10902 * po/POTFILES.in: Regenerate.
10903
10904 2008-07-29 Ian Lance Taylor <iant@google.com>
10905
10906 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10907 symbols before other symbols.
10908 * testsuite/script_test_2.cc (test_addr): Declare.
10909 (test_addr_alias): Declare.
10910 (main): Check that test_addr and test_addr_alias have the right
10911 values.
10912 * testsuite/script_test_2.t: Define test_addr_alias and
10913 test_addr.
10914
10915 2008-07-24 Ian Lance Taylor <iant@google.com>
10916
10917 PR 5990
10918 * descriptors.cc: New file.
10919 * descriptors.h: New file.
10920 * gold-threads.h (class Hold_optional_lock): New class.
10921 * fileread.cc: Include "descriptors.h".
10922 (File_read::~File_read): Release descriptor rather than closing
10923 it.
10924 (File_read::open) [file]: Call open_descriptor rather than open.
10925 Set is_descriptor_opened_.
10926 (File_read::open) [memory]: Assert that descriptor is not open.
10927 (File_read::reopen_descriptor): New function.
10928 (File_read::release): Release descriptor.
10929 (File_read::do_read): Make non-const. Reopen descriptor.
10930 (File_read::read): Make non-const.
10931 (File_read::make_view): Reopen descriptor.
10932 (File_read::do_readv): Likewise.
10933 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10934 Update declarations.
10935 * layout.cc: Include "descriptors.h".
10936 (Layout::create_build_id): Use open_descriptor rather than open.
10937 * output.cc: Include "descriptors.h".
10938 (Output_file::open): Use open_descriptor rather than open.
10939 * archive.cc (Archive::const_iterator): Change Archive to be
10940 non-const.
10941 (Archive::begin, Archive::end): Make non-const.
10942 (Archive::count_members): Likewise.
10943 * archive.h (class Archive): Update declarations.
10944 * object.h (Object::read): Make non-const.
10945 * Makefile.am (CCFILES): Add descriptors.cc.
10946 (HFILES): Add descriptors.h.
10947 * Makefile.in: Rebuild.
10948
10949 PR 6716
10950 * gold.h: Always include <clocale>. Add Solaris workarounds
10951 following code in binutils/sysdep.h.
10952
10953 PR 6048
10954 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10955 this->eh_frame_hdr_ is NULL before using it.
10956
10957 * dynobj.cc (Versions::Versions): Update comment.
10958
10959 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10960 the base version name.
10961
10962 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10963 array size plus one.
10964 (Stringpool_template::set_string_offsets): Subtract one from key
10965 before using it as an array index.
10966 (Stringpool_template::get_offset_with_length): Likewise.
10967 (Stringpool_template::write_to_buffer): Likewise.
10968 * stringpool.h (Stringpool_template::get_offset_from_key):
10969 Likewise.
10970
10971 2008-07-23 Ian Lance Taylor <iant@google.com>
10972
10973 PR 6658
10974 * object.h (Merged_symbol_value::value): Do our best to handle a
10975 negative addend.
10976
10977 PR 6647
10978 * script.cc (Version_script_info::get_versions): Don't add empty
10979 version tag to return value.
10980 (Version_script_info::get_symbol_version_helper): Change return
10981 type to bool. Add pversion parameter. Change all callers.
10982 (script_register_vers_node): Don't require a non-NULL tag.
10983 * script.h (class Version_script_info): Update declarations.
10984 (Version_script_info::get_symbol_version): Change return type to
10985 bool. Add version parameter. Change all callers.
10986 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10987 handling. Handle an empty version from a version script.
10988 (Symbol_table::define_special_symbol): Likewise.
10989 * testsuite/ver_test_10.script: New file.
10990 * testsuite/ver_test_10.sh: New file.
10991 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10992 (check_DATA): Add ver_test_10.syms.
10993 (ver_test_10.syms, ver_test_10.so): New target.
10994 * testsuite/Makefile.in: Rebuild.
10995
10996 2008-07-23 Simon Baldwin <simonb@google.com>
10997
10998 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10999 to zero for undefined symbols from dynamic libraries.
11000
11001 2008-07-23 Ian Lance Taylor <iant@google.com>
11002
11003 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11004 Change all callers.
11005 * symtab.h (class Symbol_table): Update declaration.
11006 * testsuite/ver_test_9.cc: New file.
11007 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11008 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11009 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11010 (ver_test_9.so, ver_test_9.o): New targets.
11011 * testsuite/Makefile.in: Rebuild.
11012
11013 2008-07-22 Ian Lance Taylor <iant@google.com>
11014
11015 * options.h (class General_options): Define --check-sections.
11016 * layout.cc (Layout::set_segment_offsets): Handle
11017 --check-sections.
11018
11019 * options.h (class General_options): Define -n/--nmagic and
11020 -N/--omagic.
11021 * options.cc (General_options::finalize): For -n/--nmagic or
11022 -N/--omagic, set -static.
11023 * layout.cc (Layout::attach_allocated_section_to_segment): If
11024 -N/--omagic, don't put read-only and read-write sections in
11025 different segments.
11026 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11027 finding a read-only segment.
11028 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11029 don't set the minimum segment alignment to the common page size,
11030 and don't set the file offset to the address modulo the page size.
11031 * script-sections.cc (Script_sections::create_segments): If
11032 -n/--omagic, don't put read-only and read-write sections in
11033 different segments.
11034
11035 * cref.cc: New file.
11036 * cref.h: New file.
11037 * options.h (class General_options): Add --print-symbol-counts.
11038 * main.cc (main): Issue defined symbol report if requested.
11039 * archive.cc (Archive::interpret_header): Make into a const member
11040 function.
11041 (Archive::add_symbols): Call Input_objects::archive_start and
11042 archive_stop.
11043 (Archive::const_iterator): Define new class.
11044 (Archive::begin, Archive::end): New functions.
11045 (Archive::include_all_members): Rewrite to use iterator.
11046 (Archive::count_members): New function.
11047 * archive.h (class Archive): Update declarations.
11048 (Archive::filename): New function.
11049 * object.cc: Include "cref.h".
11050 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11051 (Sized_relobj::do_get_global_symbol_counts): New function.
11052 (Input_objects::add_object): Add object to cross-referencer.
11053 (Input_objects::archive_start): New function.
11054 (Input_objects::archive_stop): New function.
11055 (Input_objects::print_symbol_counts): New function.
11056 * object.h: Declare Cref and Archive.
11057 (Object::get_global_symbol_counts): New function.
11058 (Object::do_get_global_symbol_counts): New pure virtual function.
11059 (class Sized_relobj): Add defined_count_ field. Update
11060 declarations.
11061 (class Input_objects): Add cref_ field. Update constructor.
11062 Update declarations.
11063 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11064 defined_count_.
11065 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11066 symbol counts.
11067 (Sized_dynobj::do_get_global_symbol_counts): New function.
11068 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11069 defined_count_. Update declarations. Define Symbols typedef.
11070 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11071 parameter. Change all callers.
11072 (Symbol_table::add_from_dynobj): Add sympointers and defined
11073 parameters. Change all callers.
11074 * symtab.h (class Symbol_table): Update declarations.
11075 * Makefile.am (CCFILES): Add cref.cc.
11076 (HFILES): Add cref.h.
11077 * Makefile.in: Rebuild.
11078
11079 2008-07-22 Simon Baldwin <simonb@google.com>
11080
11081 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11082 to zero when writing undefined symbols.
11083
11084 2008-07-22 Ian Lance Taylor <iant@google.com>
11085
11086 * output.cc (Output_section::add_input_section): Don't try to
11087 merge empty merge sections.
11088
11089 2008-07-21 Craig Silverstein <csilvers@google.com>
11090
11091 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11092 Include symbol version in error message.
11093
11094 2008-07-20 Chris Demetriou <cgd@google.com>
11095
11096 * configure.ac (gold_cv_c_random_seed): New configured variable.
11097 (RANDOM_SEED_CFLAGS): New substituted variable.
11098 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11099 * configure: Rebuild.
11100 * Makefile.in: Likewise.
11101 * testsuite/Makefile.in: Likewise.
11102
11103 2008-07-18 Ian Lance Taylor <iant@google.com>
11104
11105 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11106 where we see NAME/NULL and NAME/VERSION as separate symbols.
11107 * testsuite/ver_test_main.cc (main): Call t4.
11108 (t4, t4_2a): Define.
11109 * testsuite/ver_test_2.cc (t4_2): Define.
11110 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11111 * testsuite/ver_test_4.cc (t4_2a): Define.
11112 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11113 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11114
11115 2008-07-17 Ian Lance Taylor <iant@google.com>
11116
11117 * dynobj.cc (Versions::add_def): If we give an error about a
11118 missing version, go ahead and create the version anyhow.
11119
11120 2008-07-10 Ian Lance Taylor <iant@google.com>
11121
11122 Handle output sections with more than 0x7fffffff bytes.
11123 * object.h (class Relobj): Change map_to_output_ to
11124 output_sections_, and just keep a section pointer. Change all
11125 uses. Move comdat group support to Sized_relobj.
11126 (Relobj::is_section_specially_mapped): Remove.
11127 (Relobj::output_section): Remove poff parameter. Change all
11128 callers.
11129 (Relobj::output_section_offset): New function.
11130 (Relobj::set_section_offset): Rewrite.
11131 (Relobj::map_to_output): Remove.
11132 (Relobj::output_sections): New function.
11133 (Relobj::do_output_section_offset): New pure virtual function.
11134 (Relobj::do_set_section_offset): Likewise.
11135 (class Sized_relobj): Add section_offsets_ field. Add comdat
11136 group support from Relobj. Update declarations.
11137 (Sized_relobj::get_output_section_offset): New function.
11138 (Sized_relobj::do_output_section_offset): New function.
11139 (Sized_relobj::do_set_section_offset): New function.
11140 * object.cc (Relobj::output_section_address): Remove.
11141 (Sized_relobj::Sized_relobj): Initialize new fields.
11142 (Sized_relobj::include_section_group): Cast find_kept_object to
11143 Sized_relobj.
11144 (Sized_relobj::include_linkonce_section): Likewise.
11145 (Sized_relobj::do_layout): Use separate arrays for output section
11146 and output offset.
11147 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11148 output_sections.
11149 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11150 output_sections and section_offsets.
11151 (Sized_relobj::write_local_symbols): Likewise.
11152 (map_to_kept_section): Compute output address directly.
11153 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11154 output_sections and section_offsets.
11155 (Sized_relobj::write_sections): Likewise.
11156 (Sized_relobj::relocate_sections): Likewise.
11157 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11158 * output.h (class Output_reloc): Update declarations. Change
11159 u2_.relobj to Sized_relobj*.
11160 (class Output_data_reloc): Change add functions to use
11161 Sized_relobj*.
11162 * output.cc (Output_reloc::Output_reloc): Change relobj to
11163 Sized_relobj*.
11164 (Output_reloc::local_section_offset): Change return type to
11165 Elf_Addr. Use get_output_section_offset.
11166 (Output_reloc::get_address): Likewise.
11167 (Output_section::is_input_address_mapped): Don't call
11168 is_section_specially_mapped.
11169 (Output_section::output_offset): Likewise.
11170 (Output_section::output_address): Likewise.
11171 (Output_section::starting_output_address): Likewise.
11172 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11173 parameter to Sized_relobj*.
11174 (Copy_relocs::need_copy_reloc): Likewise.
11175 (Copy_relocs::save): Likewise.
11176 * copy-relocs.h (class Copy_relocs): Update declarations.
11177 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11178 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11179 * target-reloc.h (relocate_for_relocatable): Change
11180 offset_in_output_section type to Elf_Addr. Change code that uses
11181 it as well.
11182 * layout.cc (Layout::layout): Always set *off.
11183 * mapfile.cc (Mapfile::print_input_section): Use
11184 output_section_offset.
11185 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11186 Sized_relobj*.
11187 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11188 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11189 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11190
11191 2008-07-03 Ian Lance Taylor <iant@google.com>
11192
11193 * layout.cc (Layout::include_section): Do not discard unrecognized
11194 SHT_STRTAB sections.
11195
11196 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11197
11198 * script.cc (Lex::can_continue_name): Make '?' allowable in
11199 version-script names.
11200 * testsuite/version_script.map: Change glob pattern to use '?'
11201
11202 2008-06-30 Manish Singh <yosh@gimp.org>
11203
11204 PR 6585
11205 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11206 Correct typo.
11207
11208 2008-06-30 Ian Lance Taylor <iant@google.com>
11209
11210 PR 6660
11211 PR 6682
11212 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11213 versions]: Don't try to read the value in the contents, since we
11214 don't use it. Use the template endianness when writing.
11215
11216 2008-06-25 Cary Coutant <ccoutant@google.com>
11217
11218 * fileread.cc (File_read::make_view): Assert on zero-length view.
11219 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11220 symbol table when there are no symbols to read.
11221
11222 2008-06-23 Craig Silverstein <csilvers@google.com>
11223
11224 * version.cc (version_string): Bump to 1.7
11225
11226 2008-06-18 Craig Silverstein <csilvers@google.com>
11227
11228 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11229 constant 0xFFFF to type Valtype.
11230 (Powerpc_relocate_functions::rel16_ha): Likewise.
11231
11232 2008-06-17 Ian Lance Taylor <iant@google.com>
11233
11234 * output.h (Output_section::Input_section): Initialize p2align_ to
11235 zero for Output_section_data constructors.
11236 (Output_section::Input_section::addralign): If not an input
11237 section, return the alignment of the Output_section_data.
11238 * testsuite/copy_test.cc: New file.
11239 * testsuite/copy_test_1.cc: New file.
11240 * testsuite/copy_test_2.cc: New file.
11241 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11242 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11243 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11244 (copy_test_1_pic.o, copy_test_1.so): New targets.
11245 (copy_test_2_pic.o, copy_test_2.so): New targets.
11246 * testsuite/Makefile.in: Rebuild.
11247
11248 * script-sections.cc (Script_sections::place_orphan): Initialize
11249 local variable exact.
11250
11251 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11252
11253 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11254
11255 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11256 David S. Miller <davem@davemloft.net>
11257
11258 * powerpc.cc: New file.
11259 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11260 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11261 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11262 * Makefile.in: Rebuild.
11263
11264 2008-06-09 Ian Lance Taylor <iant@google.com>
11265
11266 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11267 <exception>.
11268 (throwing, orig_terminate): New static variables.
11269 (terminate_handler): New static function.
11270 (t2): Set terminate handler.
11271
11272 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11273
11274 PR 6584
11275 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11276 alignment.
11277
11278 2008-05-30 Cary Coutant <ccoutant@google.com>
11279
11280 * archive.cc (Archive::include_all_members) Correct to step
11281 over symbol table and extended name table in thin archives.
11282
11283 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11284
11285 PR 6407
11286 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11287 calculation.
11288
11289 2008-05-28 Caleb Howe <cshowe@google.com>
11290
11291 * reduced_debug_output.cc: New file.
11292 * reduced_debug_output.h: New file.
11293 * options.h (class General_options): Add --strip-debug-non-line.
11294 * options.cc (General_options::finalize): Add strip_debug_non_line
11295 to the strip heirarchy.
11296 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11297 fields.
11298 * layout.cc: Include "reduced_debug_output.h".
11299 (Layout::Layout): Initialize new fields.
11300 (line_only_debug_sections): New static array.
11301 (is_lines_only_debug_sections): New static inline function.
11302 (Layout::include_section): Handle --strip-debug-non-line.
11303 (Layout::make_output_section): If --strip-debug-non-line, build
11304 new output sections for .debug_abbrev and .debug_info.
11305 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11306 gold. Warn about possible overflow.
11307 (read_signed_LEB_128): Likewise.
11308 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11309 (read_signed_LEB_128): Declare.
11310 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11311 (HFILES): Add reduced_debug_output.h.
11312 * Makefile.in: Rebuild.
11313
11314 2008-05-21 Ian Lance Taylor <iant@google.com>
11315
11316 * mapfile.cc: New file.
11317 * mapfile.h: New file.
11318 * options.h (class General_options): Add -M/--print-map and -Map.
11319 * options.cc (General_options::finalize): Make -M equivalent to
11320 -Map -.
11321 * main.cc: Include <cstdio> and "mapfile.h".
11322 (main): Open mapfile if requested.
11323 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11324 constructor. Change caller.
11325 (queue_initial_tasks): Add mapfile parameter. Change caller.
11326 (queue_middle_tasks): Likewise.
11327 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11328 declarations.
11329 * archive.cc: Include "mapfile.h".
11330 (Archive::add_symbols): Add mapfile parameter. Change all
11331 callers. Pass mapfile, symbol, and reason to include_member.
11332 (Archive::include_all_members): Add mapfile parameter. Change all
11333 callers.
11334 (Archive::include_member): Add mapfile, sym, and why parameters.
11335 Change all callers. Report inclusion to map file.
11336 * archive.h: Include "fileread.h".
11337 (class Archive): Update declarations.
11338 (Archive::file): New const method.
11339 (class Add_archive_symbols): Add mapfile_ field. Update
11340 constructor. Change all callers.
11341 * readsyms.h (class Read_symbols): Likewise.
11342 (class Finish_group): Likewise.
11343 (class Read_script): Likewise.
11344 * common.cc: Include "mapfile.h".
11345 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11346 all callers.
11347 (Symbol_table::do_allocate_commons): Likewise.
11348 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11349 symbol allocation to mapfile.
11350 * common.h (class Allocate_commons_task): Add mapfile_ field.
11351 Update constructor. Change all callers.
11352 * symtab.h (class Symbol_table): Update declarations.
11353 * layout.cc: Include "mapfile.h".
11354 (Layout_task_runner::run): Print information to mapfile.
11355 (Layout::create_gold_note): Change Output_data_fixed_space to
11356 Output_data_zero_fill.
11357 (Layout::create_build_id): Likewise.
11358 (Layout::print_to_mapfile): New function.
11359 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11360 constructor. Change caller.
11361 (class Layout): Declare print_to_mapfile.
11362 * output.cc (Output_section::Input_section::print_to_mapfile): New
11363 function.
11364 (Output_section::add_input_section): If producing a map, always
11365 add to input_sections_ list.
11366 (Output_section::do_print_to_mapfile): New function.
11367 (Output_segment::print_sections_to_mapfile): New function.
11368 (Output_segment::print_section_list_to_mapfile): New function.
11369 * output.h: Include "mapfile.h".
11370 (Output_data::print_to_mapfile): New function.
11371 (Output_data::do_print_to_mapfile): New virtual function.
11372 (Output_segment_headers::do_print_to_mapfile): New function.
11373 (Output_file_header::do_print_to_mapfile): New function.
11374 (Output_data_const::do_print_to_mapfile): New function.
11375 (class Output_data_const_buffer): Add map_name_ field. Update
11376 constructor. Change all callers. Add do_print_to_mapfile
11377 function.
11378 (class Output_data_fixed_space): Likewise.
11379 (class Output_data_space): Likewise.
11380 (class Output_data_zero_fill): New class.
11381 (Output_data_strtab::do_print_to_mapfile): New function.
11382 (Output_data_reloc_base::do_print_to_mapfile): New function.
11383 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11384 (Output_data_group::do_print_to_mapfile): New function.
11385 (Output_data_got::do_print_to_mapfile): New function.
11386 (Output_data_dynamic::do_print_to_mapfile): New function.
11387 (Output_symtab_xindex::do_print_to_mapfile): New function.
11388 (class Output_section): Declare do_print_to_mapflie. Declare
11389 print_to_mapfile in Input_section.
11390 (class Output_segment): Declare new functions.
11391 * object.h (Sized_relobj::symbol_count): New function.
11392 * script-sections.cc
11393 (Output_section_element_dot_assignment::set_section_addresses):
11394 Change Output_data_fixed_space to Output_data_zero_fill.
11395 (Output_data_expression::do_print_to_mapfile): New function.
11396 * script.cc (read_input_script): Add mapfile parameter. Change
11397 all callers.
11398 * script.h (read_input_script): Update declaration.
11399 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11400 (Eh_frame::do_print_to_mapfile): New function.
11401 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11402 (Output_merge_string::do_print_to_mapfile): New function.
11403 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11404 function.
11405 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11406 function.
11407 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11408 function.
11409 * Makefile.am (CCFILES): Add mapfile.cc.
11410 (HFILES): Add mapfile.h.
11411 * Makefile.in: Rebuild.
11412
11413 2008-05-19 Ian Lance Taylor <iant@google.com>
11414
11415 * options.h (class General_options): Add -z relro.
11416 * layout.cc (Layout::Layout): Initialize relro_segment_.
11417 (Layout::add_output_section_data): Return the output section.
11418 (Layout::make_output_section): Rcognize relro sections and mark
11419 them appropriately.
11420 (Layout::attach_allocated_section_to_segment): Put relro sections
11421 in a PT_GNU_RELRO segment.
11422 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11423 section as relro.
11424 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11425 PT_TLS segments.
11426 (Layout::linkonce_mapping): Map d.rel.ro.local to
11427 .data.rel.ro.local.
11428 (Layout::output_section_name): Us .data.rel.ro.local for any
11429 section which begins with that.
11430 * layout.h (class Layout): Update add_output_section_data
11431 declaration. Add relro_segment_ field.
11432 * output.cc (Output_section::Output_section): Initialize is_relro_
11433 and is_relro_local_ fields.
11434 (Output_segment::add_output_section): Group relro sections.
11435 (Output_segment::is_first_section_relro): New function.
11436 (Output_segment::maximum_alignment): If there is a relro section,
11437 align the segment to the common page size.
11438 (Output_segment::set_section_addresses): Track whether we are
11439 looking at relro sections. If the last section is a relro
11440 section, align to the common page size.
11441 (Output_segment::set_section_list_addresses): Add in_relro
11442 parameter. Change all callers. Align to the page size when
11443 moving from relro to non-relro section.
11444 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11445 segment.
11446 * output.h (class Output_section): Add is_relro_ and
11447 is_relro_local_ fields.
11448 (Output_section::is_relro): New function.
11449 (Output_section::set_is_relro): New function.
11450 (Output_section::is_relro_local): New function.
11451 (Output_section::set_is_relro_local): New function.
11452 (class Output_segment): Update declarations.
11453 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11454 * sparc.cc (Target_sparc::got_section): Likewise.
11455 * x86_64.cc (Target_x86_64::got_section): Likewise.
11456 * testsuite/relro_test_main.cc: New file.
11457 * testsuite/relro_test.cc: New file.
11458 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11459 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11460 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11461 (relro_test.so, relro_test_pic.o): New targets.
11462 * testsuite/Makefile.in: Rebuild.
11463
11464 2008-05-16 Ian Lance Taylor <iant@google.com>
11465
11466 * output.cc (Output_segment::add_output_section): Remove front
11467 parameter.
11468 * output.h (class Output_segment): Remove
11469 add_initial_output_section and overloaded add_output_section.
11470 Update declaration of remaining add_output_section.
11471 * layout.cc (Layout::create_interp): Call add_output_section
11472 rather than add_initial_output_section.
11473 (Layout::finish_dynamic_section): Likewise.
11474
11475 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11476 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11477 know the dynamic type.
11478 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11479 field. Initialize it in constructor.
11480 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11481 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11482 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11483 reloc.
11484
11485 * output.cc (Output_reloc::get_address): Change return type to
11486 Elf_Addr.
11487 * output.h (class Output_reloc): Update get_address declaration.
11488 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11489 for section addresses.
11490
11491 2008-05-09 Ian Lance Taylor <iant@google.com>
11492
11493 PR 6493
11494 * gold.cc (gold_nomem): Use return value of write.
11495
11496 2008-05-08 Ian Lance Taylor <iant@google.com>
11497
11498 * symtab.c (Symbol::init_base_output_data): Add version
11499 parameter. Change all callers.
11500 (Symbol::init_base_output_segment): Likewise.
11501 (Symbol::init_base_constant): Likewise.
11502 (Symbol::init_base_undefined): Likewise.
11503 (Sized_symbol::init_output_data): Likewise.
11504 (Sized_symbol::init_output_segment): Likewise.
11505 (Sized_symbol::init_constant): Likewise.
11506 (Sized_symbol::init_undefined): Likewise.
11507 (Symbol_table::do_define_in_output_data): If the new symbol has a
11508 version, mark it as the default.
11509 (Symbol_table::do_define_in_output_segment): Likewise.
11510 (Symbol_table::do_define_as_constant): Likewise.
11511 * symtab.h (class Symbol): Update declarations.
11512 (class Sized_symbol): Likewise.
11513 * resolve.cc (Symbol::override_version): New function.
11514 (Symbol::override_base): Call override_version.
11515 (Symbol::override_base_with_special): Likewise.
11516 * testsuite/ver_script_8.script: New file.
11517 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11518 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11519 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11520 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11521
11522 2008-05-06 Ian Lance Taylor <iant@google.com>
11523
11524 PR 6049
11525 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11526 functions.
11527 (class General_options): Remove existing --undefined, and add
11528 --no-undefined instead. Add new --undefined as synonym for -u.
11529 * archive.cc (Archive::add_symbols): Check whether symbol was
11530 named with -u.
11531 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11532 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11533 all uses. Add IS_UNDEFINED. Update declarations to split
11534 different versions of init_base. Declare init_base_undefined.
11535 (Symbol::is_defined): Handle IS_UNDEFINED.
11536 (Symbol::is_undefined): Likewise.
11537 (Symbol::is_weak_undefined): Call is_undefined.
11538 (Symbol::is_absolute): Handle IS_CONSTANT.
11539 (class Sized_symbol): Update declarations to split different
11540 versions of init. Declare init_undefined.
11541 (class Symbol_table): Declare new functions.
11542 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11543 Change all callers.
11544 (Symbol::init_base_output_data): Likewise.
11545 (Symbol::init_base_output_segment): Likewise.
11546 (Symbol::init_base_constant): Likewise.
11547 (Symbol::init_base_undefined): New function.
11548 (Sized_symbol::init_object): Rename from init. Change all
11549 callers.
11550 (Sized_symbol::init_output_data): Likewise.
11551 (Sized_symbol::init_output_segment): Likewise.
11552 (Sized_symbol::init_constant): Likewise.
11553 (Sized_symbol::init_undefined): New function.
11554 (Symbol_table::add_undefined_symbols_from_command_line): New
11555 function.
11556 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11557 function.
11558 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11559 (Symbol::output_section): Likewise.
11560 (Symbol::set_output_section): Likewise.
11561 (Symbol_table::sized_finalize_symbol): Likewise.
11562 (Symbol_table::sized_write_globals): Likewise.
11563 * resolve.cc (Symbol_table::should_override): Likewise.
11564 (Symbol::override_base_with_special): Likewise.
11565
11566 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11567 symbol, change it to have default visibility.
11568 * testsuite/protected_1.cc: New file.
11569 * testsuite/protected_2.cc: New file.
11570 * testsuite/protected_3.cc: New file.
11571 * testsuite/protected_main_1.cc: New file.
11572 * testsuite/protected_main_2.cc: New file.
11573 * testsuite/protected_main_3.cc: New file.
11574 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11575 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11576 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11577 (protected_1.so): New target.
11578 (protected_1_pic.o, protected_2_pic.o): New targets.
11579 (protected_3_pic.o): New target.
11580 (check_PROGRAMS): Add protected_2.
11581 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11582 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11583 * testsuite/Makefile.in: Rebuild.
11584
11585 * options.h (DEFINE_var): Add set_user_set_##varname__.
11586 (DEFINE_bool_alias): New macro.
11587 (class General_options): Define -Bstatic using DEFINE_bool_alias
11588 rather than DEFINE_special. Add --undefined as an alias for -z
11589 defs.
11590 * options.cc (General_options::parse_Bstatic): Remove.
11591
11592 * options.h (class General_options): Add --fatal-warnings.
11593 * main.cc (main): Implement --fatal-warnings.
11594 * errors.h (Errors::warning_count): New function.
11595
11596 * options.h (class General_options): Add -Bsymbolic-functions.
11597 * symtab.h (Symbol::is_preemptible): Check for
11598 -Bsymbolic-functions.
11599
11600 2008-05-05 Ian Lance Taylor <iant@google.com>
11601
11602 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11603 as noVARNAME rather than no-VARNAME.
11604 (class General_options): Add option -z combreloc.
11605 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11606 get_address.
11607 (Output_reloc::sort_before) [SHT_REL]: New function.
11608 (Output_reloc::sort_before) [SHT_RELA]: New function.
11609 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11610 Sort_relocs_comparison.
11611 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11612 parameter. Change all callers.
11613 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11614 sort_relocs parameter. Change all callers.
11615 * output.cc (Output_reloc::get_address): New function, broken out
11616 of write_rel.
11617 (Output_reloc::write_rel): Call it.
11618 (Output_reloc::compare): New function.
11619 (Output_data_reloc_base::do_write): Optionally sort relocs.
11620
11621 * configure.ac: If targ_extra_obj is set, link it in.
11622 * configure.tgt: Initialize all variables.
11623 (x86_64*): Set targ_extra_obj and targ_extra_size.
11624 * configure: Rebuild.
11625
11626 * object.cc (Sized_relobj::include_section_group): Adjust section
11627 indexes read from group data. Build vector to pass to
11628 layout_group.
11629 * layout.cc (Layout::layout_group): Add flags and shndxes
11630 parameters. Remove contents parameter. Change caller. Update
11631 explicit instantiations.
11632 * layout.h (class Layout): Update layout_group declaration.
11633 * output.cc (Output_data_group::Output_data_group): Add flags and
11634 input_shndxes parameters. Remove contents parameter. Change
11635 caller.
11636 (Output_data_group::do_write): Change input_sections_ to
11637 input_shndxes_.
11638 * output.h (class Output_data_group): Update constructor
11639 declaration. Rename input_sections_ to input_shndxes_.
11640 * testsuite/many_sections_test.cc: Add template.
11641
11642 2008-04-30 Cary Coutant <ccoutant@google.com>
11643
11644 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11645
11646 * layout.cc (Layout::include_section): Refactored check for debug
11647 info section.
11648 (Layout::add_comdat): Add new parameters. Change type
11649 of signature parameter. Add object and shndx to signatures table.
11650 (Layout::find_kept_object): New function.
11651 * layout.h: Include <cstring>.
11652 (Layout::is_debug_info_section): New function.
11653 (Layout::add_comdat): Add new parameters.
11654 (Layout::find_kept_object): New function.
11655 (Layout::Kept_section): New struct.
11656 (Layout::Signatures): Change type of map range.
11657 * object.cc (Relobj::output_section_address): New function.
11658 (Sized_relobj::include_section_group): Add new parameters. Change
11659 calls to Layout::add_comdat. Change to build table of kept comdat
11660 groups and table mapping discarded sections to kept sections.
11661 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11662 (Sized_relobj::do_layout): Change calls to include_section_group and
11663 include_linkonce_section.
11664 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11665 value to zero when section is discarded.
11666 (Sized_relobj::map_to_kept_section): New function.
11667 * object.h (Relobj::output_section_address): New function.
11668 (Relobj::Comdat_group): New type.
11669 (Relobj::find_comdat_group): New function.
11670 (Relobj::Comdat_group_table): New type.
11671 (Relobj::Kept_comdat_section): New type.
11672 (Relobj::Kept_comdat_section_table): New type.
11673 (Relobj::add_comdat_group): New function.
11674 (Relobj::set_kept_comdat_section): New function.
11675 (Relobj::get_kept_comdat_section): New function.
11676 (Relobj::comdat_groups_): New field.
11677 (Relobj::kept_comdat_sections_): New field.
11678 (Symbol_value::input_value): Update comment.
11679 (Sized_relobj::map_to_kept_section) New function.
11680 (Sized_relobj::include_linkonce_section): Add new parameter.
11681 * target-reloc.h (Comdat_behavior): New type.
11682 (get_comdat_behavior): New function.
11683 (relocate_section): Add code to map a discarded section to the
11684 corresponding kept section when applying a relocation.
11685
11686 2008-04-30 Craig Silverstein <csilvers@google.com>
11687
11688 * dwarf_reader.cc (next_generation_count): New static var.
11689 (Addr2line_cache_entry): New struct.
11690 (addr2line_cache): New static var.
11691 (Dwarf_line_info::one_addr2line): Added caching.
11692 (Dwarf_line_info::clear_addr2line_cache): New function.
11693 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11694 cache-size parameter.
11695 (Dwarf_line_info::one_addr2line_cache): New function.
11696 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11697 new cache-size argument to one_addr2line(), and clear cache.
11698
11699 2008-04-28 Cary Coutant <ccoutant@google.com>
11700
11701 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11702 R_386_PC8 relocations.
11703
11704 2008-04-23 Ian Lance Taylor <iant@google.com>
11705
11706 * object.cc (Sized_relobj::include_section_group): Check for
11707 invalid section group.
11708
11709 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11710 header size.
11711
11712 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11713 than read for file header.
11714 * archive.cc (Archive::include_member): Likewise.
11715
11716 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11717
11718 * aclocal.m4: Regenerate.
11719 * configure: Regenerate.
11720
11721 2008-04-19 Ian Lance Taylor <iant@google.com>
11722
11723 * version.cc (version_string): Bump to 1.6.
11724
11725 * testsuite/Makefile.am (many_sections_r_test): New target.
11726 (many_sections_r_test_SOURCES): Remove.
11727 (many_sections_r_test_DEPENDENCIES): Remove.
11728 (many_sections_r_test_LDFLAGS): Remove.
11729 (many_sections_r_test_LDADD): Remove.
11730
11731 * object.cc (Sized_relobj::do_add_symbols): Always pass
11732 local_symbol_count_ to add_from_relobj.
11733
11734 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11735 every thousand variables.
11736 * testsuite/Makefile.in: Rebuild.
11737
11738 * object.cc (Xindex::initialize_symtab_xindex): New function.
11739 (Xindex::read_symtab_xindex): New function.
11740 (Xindex::sym_xindex_to_shndx): New function.
11741 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11742 available.
11743 (Sized_relobj::do_initialize_xindex): New function.
11744 (Sized_relobj::do_read_symbols): Adjust section links.
11745 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11746 parameter. Change all callers.
11747 (Sized_relobj::include_section_group): Adjust section links and
11748 symbol section indexes.
11749 (Sized_relobj::do_layout): Adjust section links.
11750 (Sized_relobj::do_count_local_symbols): Adjust section links and
11751 symbol section indexes.
11752 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11753 ordinary and special symbols.
11754 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11755 dynsym_xindex parameters. Change all callers. Adjust section
11756 links. Use SHN_XINDEX when needed.
11757 (Sized_relobj::get_symbol_location_info): Adjust section links.
11758 Don't get fooled by special symbols.
11759 * object.h (class Xindex): Define.
11760 (class Object): Add xindex_ parameter. Declare virtual functoin
11761 do_initialize_xindex.
11762 (Object::adjust_sym_shndx): New function.
11763 (Object::set_xindex): New protected function.
11764 (class Symbol_value): Add is_ordinary_shndx_ field.
11765 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11766 (Symbol_value::value): Assert ordinary section.
11767 (Symbol_value::initialize_input_to_output_map): Likewise.
11768 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11769 Change all callers.
11770 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11771 all callers.
11772 (class Sized_relobj): Update declarations.
11773 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11774 parameter. Change all callers.
11775 (Sized_relobj::adjust_shndx): New function.
11776 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11777 field.
11778 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11779 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11780 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11781 (Sized_dynobj::read_dynsym_section): Adjust section links.
11782 (Sized_dynobj::read_dynamic): Likewise.
11783 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11784 section links.
11785 (Sized_dynobj::do_initialize_xindex): New function.
11786 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11787 do_initialize_xindex.
11788 (Sized_dynobj::adjust_shndx): New function.
11789 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11790 dynsym_xindex_ fields.
11791 (Layout::finalize): Add a call to set_section_indexes before
11792 creating the symtab sections.
11793 (Layout::set_section_indexes): Don't do anything if the section
11794 already has a section index.
11795 (Layout::create_symtab_sections): Add shnum parameter. Change
11796 caller. Create .symtab_shndx section if needed.
11797 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11798 caller.
11799 (Layout::allocated_output_section_count): New function.
11800 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11801 needed.
11802 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11803 fields. Update declarations.
11804 (Layout::symtab_xindex): New function.
11805 (Layout::dynsym_xindex): New function.
11806 (class Write_symbols_task): Add layout_ field.
11807 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11808 Change caller.
11809 * output.cc (Output_section_headers::Output_section_headers): Add
11810 shstrtab_section parameter. Change all callers.
11811 (Output_section_headers::do_sized_write): Store overflow values
11812 for section count and section string table section index in
11813 section header zero.
11814 (Output_file_header::do_sized_write): Check for overflow of
11815 section count and section string table section index.
11816 (Output_symtab_xindex::do_write): New function.
11817 (Output_symtab_xindex::endian_do_write): New function.
11818 * output.h (class Output_section_headers): Add shstrtab_section_.
11819 Update declarations.
11820 (class Output_symtab_xindex): Define.
11821 (Output_section::has_out_shndx): New function.
11822 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11823 field.
11824 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11825 Change all callers.
11826 (Sized_symbol::init): Likewise.
11827 (Symbol::output_section): Check for ordinary symbol.
11828 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11829 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11830 callers.
11831 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11832 Change all callers. Simplify handling of symbols from sections
11833 not included in the link.
11834 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11835 distinction.
11836 (Weak_alias_sorter::operator()): Assert that symbols are
11837 ordinary.
11838 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11839 distinction.
11840 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11841 parameters. Change all callers.
11842 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11843 symbol distinction. Use SHN_XINDEX when needed.
11844 (Symbol_table::write_section_symbol): Add symtab_xindex
11845 parameter. Change all callers.
11846 (Symbol_table::sized_write_section_symbol): Likewise. Use
11847 SHN_XINDEX when needed.
11848 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11849 declarations.
11850 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11851 (Symbol::is_defined): Check is_ordinary.
11852 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11853 (Symbol::is_absolute, Symbol::is_common): Likewise.
11854 (class Sized_symbol): Update declarations.
11855 (class Symbol_table): Update declarations.
11856 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11857 parameters. Change all callers.
11858 (Sized_symbol::override): Likewise.
11859 (Symbol_table::override): Likewise.
11860 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11861 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11862 is_ordinary, and orig_st_shndx parameters. Change all callers.
11863 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11864 to be in an ordinary section.
11865 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11866 object and is_ordinary parameters. Change all callers.
11867 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11868 Change all callers. Don't add undefined or non-ordinary symbols
11869 to reloc_map_.
11870 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11871 Change all callers.
11872 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11873 declarations.
11874 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11875 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11876 (Sized_relobj::relocate_sections): Likewise.
11877 * target-reloc.h (scan_relocs): Adjust section symbol index.
11878 (scan_relocatable_relocs): Likewise.
11879 * i386.cc (Scan::local): Check for ordinary symbols.
11880 * sparc.cc (Scan::local): Likewise.
11881 * x86_64.cc (Scan::local): Likewise.
11882 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11883 to symbol_section_and_value.
11884 * testsuite/many_sections_test.cc: New file.
11885 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11886 (check_PROGRAMS): Add many_sections_test.
11887 (many_sections_test_SOURCES): Define.
11888 (many_sections_test_DEPENDENCIES): Define.
11889 (many_sections_test_LDFLAGS): Define.
11890 (BUILT_SOURCES): Add many_sections_define.h.
11891 (many_sections_define.h): New target.
11892 (BUILT_SOURCES): Add many_sections_check.h.
11893 (many_sections_check.h): New target.
11894 (check_PROGRAMS): Add many_sections_r_test.
11895 (many_sections_r_test_SOURCES): Define.
11896 (many_sections_r_test_DEPENDENCIES): Define.
11897 (many_sections_r_test_LDFLAGS): Define.
11898 (many_sections_r_test_LDADD): Define.
11899 (many_sections_r_test.o): New target.
11900 * testsuite/Makefile.in: Rebuild.
11901
11902 2008-04-17 Cary Coutant <ccoutant@google.com>
11903
11904 * errors.cc (Errors::info): New function.
11905 (gold_info): New function.
11906 * errors.h (Errors::info): New function.
11907 * gold.h (gold_info): New function.
11908 * object.cc (Input_objects::add_object): Print trace output.
11909 * options.cc (options::parse_set): New function.
11910 (General_options::parse_wrap): Deleted.
11911 (General_options::General_options): Deleted initializer.
11912 * options.h (options::String_set): New typedef.
11913 (options::parse_set): New function.
11914 (DEFINE_set): New macro.
11915 (General_options::wrap): Changed to use DEFINE_set. Changed
11916 callers of any_wrap_symbols and is_wrap_symbol.
11917 (General_options::trace, General_options::trace_symbol):
11918 New options.
11919 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11920 (General_options::wrap_symbols_): Deleted.
11921 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11922
11923 2008-04-17 David S. Miller <davem@davemloft.net>
11924
11925 * options.cc (General_options::parse_V): New function.
11926 * options.h: Add entries for -V and -Qy.
11927
11928 2008-04-17 Ian Lance Taylor <iant@google.com>
11929
11930 * common.cc (Symbol_table::allocate_commons): Remove options
11931 parameter. Change caller.
11932 (Symbol_table::do_allocate_commons): Remove options parameter.
11933 Change caller. Just call do_allocate_commons_list twice.
11934 (Symbol_table::do_allocate_commons_list): New function, broken out
11935 of do_allocate_commons.
11936 * common.h (class Allocate_commons_task): Remove options_ field.
11937 Update constructor.
11938 * symtab.cc (Symbol_table::Symbol_table): Initialize
11939 tls_commons_.
11940 (Symbol_table::add_from_object): Put TLS common symbols on
11941 tls_commons_ list.
11942 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11943 which are IN_OUTPUT_DATA.
11944 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11945 allocate_commons and do_allocate_commons declarations. Declare
11946 do_allocate_commons_list.
11947 * gold.cc (queue_middle_tasks): Update creation of
11948 Allocate_commons_task to not pass options.
11949 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11950 (TLS_TEST_C_FLAGS): New variable.
11951 (tls_test_c_pic.o): New target.
11952 (tls_test_shared.so): Link in tls_test_c_pic.o.
11953 (tls_test_c_pic_ie.o): New target.
11954 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11955 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11956 (tls_test_c.o): New target.
11957 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11958 (tls_pic_test_LDADD): Likewise.
11959 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11960 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11961 (tls_test_c_gnu2.o): New target.
11962 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11963 tls_test_c_gnu2.o.
11964 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11965 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11966 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11967 * testsuite/tls_test.cc: Include "config.h".
11968 (t_last): Call t11_last.
11969 * testsuite/tls_test.h (t11, t11_last): Declare.
11970 * testsuite/tls_test_c.c: New file.
11971 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11972 * configure.ac: Check for OpenMP support.
11973 * configure, config.in, Makefile.in: Rebuild.
11974 * testsuite/Makefile.in: Rebuild.
11975
11976 2008-04-16 Cary Coutant <ccoutant@google.com>
11977
11978 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11979 (Target_i386::tls_base_symbol_defined_): New field.
11980 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11981 (Target_i386::Scan::global): Likewise.
11982 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11983 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11984 (Target_x86_64::tls_base_symbol_defined_): New field.
11985 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11986 (Target_x86_64::Scan::global): Likewise.
11987
11988 2008-04-16 Cary Coutant <ccoutant@google.com>
11989
11990 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11991 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11992 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11993 building shared libraries.
11994 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11995 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11996 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11997 * testsuite/Makefile.in: Rebuild.
11998 * testsuite/weak_undef.h: New file.
11999 * testsuite/weak_undef_file1.cc: Add extra test cases.
12000 * testsuite/weak_undef_file2.cc: Likewise.
12001 * testsuite/weak_undef_test.cc: Likewise.
12002
12003 2008-04-16 David S. Miller <davem@davemloft.net>
12004
12005 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12006 Add issued_non_pic_error_ field. Declare check_non_pic.
12007 (Target_sparc::Scan::check_non_pic): New function.
12008 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12009 (Target_sparc::Scan::global): Likewise.
12010
12011 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12012 * configure: Rebuild.
12013
12014 * options.h (DEFINE_enable): New macro.
12015 (new_dtags): New enable option.
12016 (initfirst, interpose, loadfltr, nodefaultlib,
12017 nodelete, nodlopen, nodump): New -z options.
12018 * layout.cc (Layout:finish_dynamic_section): If new
12019 dtags enabled, emit DT_RUNPATH. Also, emit a
12020 DT_FLAGS_1 containing any specified -z flags.
12021
12022 2008-04-16 Ian Lance Taylor <iant@google.com>
12023
12024 * copy-relocs.cc: New file.
12025 * copy-relocs.h: New file.
12026 * reloc.cc: Remove Copy_relocs code.
12027 * reloc.h: Likewise.
12028 * reloc-types.h (struct Reloc_types) [both versions]: Add
12029 get_reloc_addend_noerror.
12030 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12031 variants of add_global which take an addend which must be zero.
12032 * i386.cc: Include "copy-relocs.h".
12033 (class Target_i386): Change type of copy_relocs_ to variable,
12034 update initializer.
12035 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12036 Change all callers.
12037 (Target_i386::do_finalize_sections): Change handling of
12038 copy_relocs_.
12039 * sparc.cc: Include "copy-relocs.h".
12040 (class Target_sparc): Change type of copy_relocs_ to variable,
12041 update initializer.
12042 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12043 Change all callers.
12044 (Target_sparc::do_finalize_sections): Change handling of
12045 copy_relocs_.
12046 * x86_64.cc: Include "copy-relocs.h".
12047 (class Target_x86_64): Change type of copy_relocs_ to variable,
12048 update initializer.
12049 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12050 class. Change all callers.
12051 (Target_x86_64::do_finalize_sections): Change handling of
12052 copy_relocs_.
12053 * Makefile.am (CCFILES): Add copy-relocs.cc.
12054 (HFILES): Add copy-relocs.h.
12055
12056 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12057
12058 * testsuite/script_test_4.sh: Permit leading zeroes.
12059
12060 2008-04-15 Ian Lance Taylor <iant@google.com>
12061
12062 * script-sections.cc (Script_sections::create_segments): Use
12063 header_size_adjustment even when there is enough room for the
12064 headers.
12065 * testsuite/script_test_4.sh: New file.
12066 * testsuite/script_test_4.t: New file.
12067 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12068 (check_DATA): Add script_test_4.stdout.
12069 (MOSTLYCLEANFILES): Likewise.
12070 (script_test_4): New target.
12071 (script_test_4.stdout): New target.
12072 * testsuite/Makefile.in: Rebuild.
12073
12074 * sparc.cc: Add definitions for Output_data_plt_sparc class
12075 constants.
12076
12077 2008-04-14 David S. Miller <davem@davemloft.net>
12078
12079 * sparc.cc: New file.
12080 * Makefile.am (TARGETSOURCES): Add sparc.cc
12081 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12082 * configure.tgt: Document targ_extra_size and
12083 targ_extra_big_endian. Add entries for sparc-* and
12084 sparc64-*.
12085 * configure.ac: Handle targ_extra_size and
12086 targ_extra_big_endian.
12087 * Makefile.in: Rebuild.
12088 * configure: Likewise.
12089 * po/POTFILES.in: Likewise.
12090 * po/gold.pot: Likewise.
12091
12092 2008-04-14 Ian Lance Taylor <iant@google.com>
12093
12094 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12095 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12096 in the name/type/flags to section mapping. Don't call
12097 allocate_output_section.
12098 (Layout::choose_output_section): Change parameter from adjust_name
12099 to is_input_section. Don't permit input sections after sections
12100 are attached to segments. Don't call allocate_output_section.
12101 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12102 not write_enable_output_section.
12103 (Layout::make_output_section): Don't push to
12104 unattached_section_list_ nor call attach_to_segment. Call
12105 attach_section_to_segment if sections are attached.
12106 (Layout::attach_sections_to_segments): New function.
12107 (Layout::attach_section_to_segment): New function.
12108 (Layout::attach_allocated_section_to_segment): Rename from
12109 attach_to_segment. Remove flags parameter.
12110 (Layout::allocate_output_section): Remove function.
12111 (Layout::write_enable_output_section): Remove function.
12112 * layout.h (class Layout): Update for above changes. Add new
12113 field sections_are_attached_.
12114 * output.h (Output_section::update_flags_for_input_section): New
12115 function.
12116 * output.cc (Output_section::add_input_section): Call
12117 update_flags_for_input_section.
12118 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12119
12120 2008-04-11 Cary Coutant <ccoutant@google.com>
12121
12122 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12123 thought unnecessary.
12124 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12125
12126 2008-04-11 Ian Lance Taylor <iant@google.com>
12127
12128 * output.h (class Output_section_data): Remove inline definition
12129 of set_addralign.
12130 * output.cc (Output_section_data::set_addralign): New function.
12131
12132 2008-04-11 Cary Coutant <ccoutant@google.com>
12133
12134 Add support for TLS descriptors for i386 and x86_64.
12135 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12136 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12137 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12138 GOT_TYPE_TLS_DESC.
12139 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12140 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12141 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12142 relocations.
12143 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12144 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12145 Fix problem with initial-exec relocations.
12146 (Target_i386::Relocate::relocate_tls): Likewise.
12147 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12148 relaxation.
12149 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12150 support for section-plus-offset dynamic table entries.
12151 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12152 (Output_data_dynamic::Dynamic_entry): Add support for
12153 section-plus-offset dynamic table entries.
12154 (Output_data_dynamic::Classification): Likewise.
12155 (Output_data_dynamic::classification_): Renamed offset_.
12156 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12157 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12158 (Target_x86_64::make_plt_section): New function.
12159 (Target_x86_64::reserve_tlsdesc_entries): New function.
12160 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12161 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12162 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12163 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12164 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12165 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12166 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12167 add extra PLT entry for TLS descriptors.
12168 (Output_data_plt_x86_64::got_): New field.
12169 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12170 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12171 fields.
12172 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12173 descriptors.
12174 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12175 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12176 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12177 R_386_TLS_DESC_CALL relocations.
12178 (Target_x86_64::Scan::global): Likewise.
12179 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12180 for TLS descriptors.
12181 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12182 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12183 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12184 GD-to-IE relaxation.
12185 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12186 and TLS_DESCRIPTORS.
12187 * Makefile.in: Rebuild.
12188 * configure: Rebuild.
12189 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12190 (tls_test_shared2.so): New target.
12191 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12192 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12193 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12194 (tls_shared_gd_to_ie_test_LDADD): New variable.
12195 (tls_shared_gnu2_gd_to_ie_test): New target.
12196 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12197 New targets.
12198 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12199 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12200 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12201 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12202 (tls_shared_gnu2_test): New target.
12203 (tls_test_gnu2_shared.so): New target.
12204 (tls_shared_gnu2_test_SOURCES): New variable.
12205 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12206 (tls_shared_gnu2_test_LDFLAGS): New variable.
12207 (tls_shared_gnu2_test_LDADD): New variable.
12208 * testsuite/Makefile.in: Rebuild.
12209 * testsuite/Makefile.
12210
12211 2008-04-11 Ian Lance Taylor <iant@google.com>
12212
12213 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12214 justsyms.t.
12215 * testsuite/Makefile.in: Rebuild.
12216
12217 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12218 long.
12219 * testsuite/script_test_2.cc (main): Adjust test.
12220
12221 2008-04-11 David S. Miller <davem@davemloft.net>
12222 Ian Lance Taylor <iant@google.com>
12223
12224 * options.h (General_options): Add entries for '-Y' and
12225 '-relax'.
12226 * options.cc (General_options:finalize): If -Y was used, add those
12227 entries to the library path instead of the default "/lib" and
12228 "/usr/lib".
12229
12230 2008-04-11 David S. Miller <davem@davemloft.net>
12231
12232 * testsuite/justsyms.t: Start at 0x100.
12233 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12234 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12235 long.
12236 * testsuite/script_test_2.cc: Adjust string and section length
12237 checks.
12238
12239 2008-04-09 Ian Lance Taylor <iant@google.com>
12240
12241 PR gold/5996
12242 * script-sections.cc (Sections_element::allocate_to_segment): Add
12243 orphan parameter.
12244 (Output_section_definition::allocate_to_segment): Likewise.
12245 (Orphan_output_section::allocate_to_segment): Likewise.
12246 (Script_sections::attach_sections_using_phdrs_clause): Don't
12247 propagate non-PT_LOAD segments to orphan sections.
12248 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12249 readelf rather than objdump.
12250 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12251 .interp section and PT_INTERP segment are the same size.
12252 * testsuite/Makefile.in: Rebuild.
12253
12254 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12255 aliases for symbols defined in the same object.
12256 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12257 (weak_alias_test_SOURCES): New variable.
12258 (weak_alias_test_DEPENDENCIES): New variable.
12259 (weak_alias_test_LDFLAGS): New variable.
12260 (weak_alias_test_LDADD): New variable.
12261 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12262 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12263 (weak_alias_test_3.o): New target.
12264 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12265 * testsuite/weak_alias_test_main.cc: New file.
12266 * testsuite/weak_alias_test_1.cc: New file.
12267 * testsuite/weak_alias_test_2.cc: New file.
12268 * testsuite/weak_alias_test_3.cc: New file.
12269
12270 2008-04-08 Ian Lance Taylor <iant@google.com>
12271
12272 * options.h (class General_options): Add --noinhibit-exec option.
12273 * main.cc (main): Check --noinhibit-exec.
12274
12275 * options.h (class General_options): Define --wrap as a special
12276 option. Add wrap_symbols_ field.
12277 (General_options::any_wrap_symbols): New function.
12278 (General_options::is_wrap_symbol): New function.
12279 * options.cc (General_options::parse_wrap): New function.
12280 (General_options::General_options): Initialize wrap_symbols_.
12281 * symtab.cc (Symbol_table::wrap_symbol): New function.
12282 (Symbol_table::add_from_object): Handle --wrap.
12283 * symtab.h (class Symbol_table): Declare wrap_symbol.
12284 * target.h (Target::wrap_char): New function.
12285 (Target::Target_info): Add wrap_char field.
12286 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12287 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12288 * testsuite/testfile.cc (Target_test::test_target_info):
12289 Likewise.
12290
12291 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12292 there is one.
12293
12294 * layout.h (class Layout): Add added_eh_frame_data_ field.
12295 * layout.cc (Layout::Layout): Initialize new field.
12296 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12297 output section until we find a section we merged successfully.
12298 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12299 that the size be non-zero.
12300
12301 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12302 qualifier.
12303
12304 2008-04-08 Craig Silverstein <csilvers@google.com>
12305
12306 * configure.ac: Export new conditional variable HAVE_ZLIB.
12307 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12308 on HAVE_ZLIB.
12309 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12310 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12311
12312 2008-04-07 Ian Lance Taylor <iant@google.com>
12313
12314 * version.cc (version_string): Set to "1.5".
12315
12316 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12317 Add issued_non_pic_error_ field. Declare check_non_pic.
12318 (Target_x86_64::Scan::check_non_pic): New function.
12319 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12320 (Target_x86_64::Scan::global): Likewise.
12321
12322 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12323 addend parameter. Change caller. Handle merge sections.
12324 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12325 Address to Addend. Don't add in the result of
12326 local_section_offset, pass down the addend and use the returned
12327 value.
12328 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12329 Update declarations of local_section_offset and symbol_value.
12330 * testsuite/two_file_test_1.cc (t18): New function.
12331 * testsuite/two_file_test_2.cc (f18): New function.
12332 * testsuite/two_file_test_main.cc (main): Call t18.
12333 * testsuite/two_file_test.h (t18, f18): Declare.
12334
12335 * configure.ac: Don't test for objdump, c++filt, or readelf.
12336 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12337 conditionals.
12338 (TEST_READELF): New variable.
12339 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12340 (check_PROGRAMS): Add two_file_strip_test.
12341 (two_file_strip_test): New target.
12342 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12343 (two_file_same_shared_strip_test_SOURCES): New variable.
12344 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12345 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12346 (two_file_same_shared_strip_test_LDADD): New variable.
12347 (two_file_shared_strip.so): New target.
12348 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12349 (ver_test_5.syms, ver_test_7.syms): Likewise.
12350 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12351 (strip_test_3.stdout): Use TEST_OBJDUMP.
12352 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12353
12354 2008-04-04 Cary Coutant <ccoutant@google.com>
12355
12356 * symtab.h (Symbol::is_weak_undefined): New function.
12357 (Symbol::is_strong_undefined): New function.
12358 (Symbol::is_absolute): New function.
12359 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12360 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12361 absolute symbols.
12362 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12363 (weak_undef_test): New target.
12364 * testsuite/Makefile.in: Rebuild.
12365 * testsuite/weak_undef_file1.cc: New file.
12366 * testsuite/weak_undef_file2.cc: New file.
12367 * testsuite/weak_undef_test.cc: New file.
12368
12369 2008-04-03 Craig Silverstein <csilvers@google.com>
12370
12371 * compressed_output.h (class Output_compressed_section): Use
12372 unsigned buffer.
12373 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12374 add zlib header.
12375 (zlib_compressed_suffix): Removed.
12376 (Output_compressed_section::set_final_data_size): Use unsigned
12377 buffers.
12378 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12379 Fix linker invocation.
12380 (flagstest_o_specialfile_and_compress_debug_sections):
12381 Likewise.
12382 * testsuite/Makefile.in: Regenerated.
12383
12384 2008-04-02 David S. Miller <davem@davemloft.net>
12385
12386 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12387 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12388
12389 2008-04-02 Craig Silverstein <csilvers@google.com>
12390
12391 * TODO: New file.
12392
12393 2008-04-02 Ian Lance Taylor <iant@google.com>
12394
12395 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12396 parameters. Update for new key type to views_. Change all
12397 callers.
12398 (File_read::read): Adjust for byteshift in returned view.
12399 (File_read::add_view): New function, broken out of
12400 find_and_make_view.
12401 (File_read::make_view): New function, broken out of
12402 find_and_make_view.
12403 (File_read::find_or_make_view): Add offset and aligned
12404 parameters. Rewrite accordingly. Change all callers.
12405 (File_read::get_view): Add offset and aligned parameters. Adjust
12406 for byteshift in return value.
12407 (File_read::get_lasting_view): Likewise.
12408 * fileread.h (class File_read): Update declarations.
12409 (class File_read::View): Add byteshift_ field. Add byteshift to
12410 constructor. Add byteshift method.
12411 * archive.h (Archive::clear_uncached_views): New function.
12412 (Archive::get_view): Add aligned parameter. Change all callers.
12413 * object.h (Object::get_view): Add aligned parameter. Change all
12414 callers.
12415 (Object::get_lasting_view): Likewise.
12416
12417 * fileread.cc (File_read::release): Don't call clear_views if
12418 there are multiple objects.
12419 * fileread.h (File_read::clear_uncached_views): New function.
12420 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12421 on the archive.
12422
12423 2008-03-31 Cary Coutant <ccoutant@google.com>
12424
12425 Add thin archive support.
12426 * archive.cc (Archive::armagt): New const.
12427 (Archive::setup): Remove task parameter and calls to unlock.
12428 (Archive::unlock_nested_archives): New function.
12429 (Archive::read_header): Add nested_off parameter. Change
12430 all callers.
12431 (Archive::interpret_header): Likewise.
12432 (Archive::include_all_members): Change to handle thin
12433 archives.
12434 (Archive::include_member): Likewise.
12435 * archive.h (Archive::Archive): Add new parameters and
12436 initializers.
12437 (Archive::armagt): New const.
12438 (Archive::setup): Remove task parameter.
12439 (Archive::unlock_nested_archives): New function.
12440 (Archive::read_header): Add nested_off parameter.
12441 (Archive::interpret_header): Likewise.
12442 (Archive::Nested_archive_table): New typedef.
12443 (Archive::is_thin_archive_): New field.
12444 (Archive::nested_archives_): New field.
12445 (Archive::options_): New field.
12446 (Archive::dirpath_): New field.
12447 (Archive::task_): New field.
12448 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12449 for thin archives. Pass additional parameters to
12450 Archive::Archive. Unlock the archive file after calling
12451 Archive::setup.
12452
12453 2008-03-29 Ian Lance Taylor <iant@google.com>
12454
12455 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12456 version symbol to be local.
12457 * testsuite/ver_test_4.sh: New file.
12458 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12459 (check_DATA): Add ver_test_4.syms.
12460 (ver_test_4.syms): New target.
12461 * testsuite/Makefile.in: Rebuild.
12462
12463 * output.cc
12464 (Output_section::Input_section_sort_entry::has_priority): New
12465 function.
12466 (Output_section::Input_section_sort_entry::match_file_name): New
12467 function.
12468 (Output_section::Input_section_sort_entry::match_section_name):
12469 Remove.
12470 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12471 Remove.
12472 (Output_section::Input_section_sort_entry::match_section_file):
12473 Remove.
12474 (Output_section::Input_section_sort_compare::operator()): Rewrite
12475 using new Input_section_sort_entry functions. Sort crtbegin and
12476 crtend first. Sort sections with no priority before sections with
12477 a priority.
12478 * testsuite/initpri1.c (d3): Check j != 4.
12479 (cd5): New constructor/destructor function.
12480 (main): Check j != 2.
12481
12482 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12483 new symbol when resolving, don't call set_is_default.
12484 * testsuite/ver_test_7.cc: New file.
12485 * testsuite/ver_test_7.sh: New file.
12486 * testsuite/Makefile.am (ver_test_7.so): New target.
12487 (ver_test_7.o): New target.
12488 (check_SCRIPTS): Add ver_test_7.sh.
12489 (check_DATA): Add ver_test_7.syms.
12490 (ver_test_7.syms): New target.
12491
12492 2008-03-28 Ian Lance Taylor <iant@google.com>
12493
12494 * layout.cc (Layout::layout): If we see an input section with a
12495 name that needs sorting, set the must_sort flag for the output
12496 section.
12497 (Layout::make_output_section): If the name of the output section
12498 indicates that it might require sorting, set the may_sort flag.
12499 * output.h (Output_section::may_sort_attached_input_sections): New
12500 function.
12501 (Output_section::set_may_sort_attached_input_sections): New
12502 function.
12503 (Output_section::must_sort_attached_input_sections): New
12504 function.
12505 (Output_section::set_must_sort_attached_input_sections): New
12506 function.
12507 (class Output_section): Declare Input_section_sort_entry. Define
12508 Input_section_sort_compare. Declare
12509 sort_attached_input_sections. Add new fields:
12510 may_sort_attached_input_sections_,
12511 must_sort_attached_input_sections_,
12512 attached_input_sections_are_sorted_.
12513 * output.cc (Output_section::Output_section): Initialize new
12514 fields.
12515 (Output_section::add_input_section): Add an entry to
12516 input_sections_ if may_sort or must_sort are true.
12517 (Output_section::set_final_data_size): Call
12518 sort_attached_input_sections if necessary.
12519 (Output_section::Input_section_sort_entry): Define new class.
12520 (Output_section::Input_section_sort_compare::operator()): New
12521 function.
12522 (Output_section::sort_attached_input_sections): New function.
12523 * configure.ac: Check whether the compiler supports constructor
12524 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12525 * testsuite/initpri1.c: New file.
12526 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12527 CONSTRUCTOR_PRIORITY.
12528 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12529 (initpri1_LDFLAGS): New variable.
12530 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12531
12532 2008-03-27 Ian Lance Taylor <iant@google.com>
12533
12534 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12535 * testsuite/common_test_1.c: New file.
12536 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12537 (common_test_1_SOURCES): New variable.
12538 (common_test_1_DEPENDENCIES): New variable.
12539 (common_test_1_LDFLAGS): New variable.
12540
12541 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12542 and commons_ correctly when NAME/VERSION does not override
12543 NAME/NULL.
12544 * testsuite/ver_test_6.c: New file.
12545 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12546 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12547 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12548
12549 2008-03-26 Ian Lance Taylor <iant@google.com>
12550
12551 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12552 of an undefined symbol from a version script.
12553 * testsuite/Makefile.am (ver_test_5.so): New target.
12554 (ver_test_5.o): New target.
12555 (check_SCRIPTS): Add ver_test_5.sh.
12556 (check_DATA): Add ver_test_5.syms.
12557 (ver_test_5.syms): New target.
12558 * testsuite/ver_test_5.cc: New file.
12559 * testsuite/ver_test_5.script: New file.
12560 * testsuite/ver_test_5.sh: New file.
12561 * Makefile.in, testsuite/Makefile.in: Rebuild.
12562
12563 PR gold/5986
12564 Fix problems building gold with gcc 4.3.0.
12565 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12566 (gold_error_at_location, gold_warning_at_location): Use it.
12567 * configure.ac: Check whether we can compile and use a template
12568 function with a printf attribute.
12569 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12570 when jumping over bytes.
12571 * object.cc: Instantiate Object::read_section_data.
12572 * debug.h: Include <cstring>
12573 * dwarf_reader.cc: Include <algorithm>
12574 * main.cc: Include <cstring>.
12575 * options.cc: Include <cstring>.
12576 * output.cc: Include <cstring>.
12577 * script.cc: Include <cstring>.
12578 * script.h: Include <string>.
12579 * symtab.cc: Include <cstring> and <algorithm>.
12580 * target-select.cc: Include <cstring>.
12581 * version.cc: Include <string>.
12582 * testsuite/testmain.cc: Include <cstdlib>.
12583 * configure, config.in: Rebuild.
12584
12585 2008-03-25 Ian Lance Taylor <iant@google.com>
12586
12587 * options.cc: Include "../bfd/bfdver.h".
12588 (options::help): Print bug reporting address.
12589
12590 * version.cc (print_version): Adjust output for current value of
12591 BFD_VERSION_STRING.
12592
12593 * NEWS: New file.
12594
12595 * options.cc (options::help): Print list of supported targets.
12596 * target-select.h: Include <vector>.
12597 (class Target_selector): Make machine_, size_, and is_big_endian_
12598 fields const. Add bfd_name_ and instantiated_target_ fields.
12599 (Target_selector::Target_selector): Add bfd_name parameter.
12600 (Target_selector::recognize): Make non-virtual, call
12601 do_recognize.
12602 (Target_selector::recognize_by_name): Make non-virtual, call
12603 do_recognize_by_name.
12604 (Target_selector::supported_names): New function.
12605 (Target_selector::bfd_name): New function.
12606 (Target_selector::do_instantiate_target): New pure virtual
12607 function.
12608 (Target_selector::do_recognize): New virtual function.
12609 (Target_selector::do_recognize_by_name): New virtual function.
12610 (Target_selector::instantiate_target): New private function.
12611 (supported_target_names): Declare.
12612 * target-select.cc (Target_selector::Target_selector): Update for
12613 new parameter and fields.
12614 (select_target_by_name): Check that the name matches before
12615 calling recognize_by_name.
12616 (supported_target_names): New function.
12617 * i386.cc (class Target_selector_i386): Update Target_selector
12618 constructor call. Remove recognize and recognize_by_name. Add
12619 do_instantiate_target.
12620 * x86_64.cc (class Target_selector_x86_64): Likewise.
12621 * testsuite/testfile.cc (class Target_selector_test): Update for
12622 changes to Target_selector.
12623
12624 * README: Rewrite, with some notes on unsupported features.
12625
12626 2008-03-24 Cary Coutant <ccoutant@google.com>
12627
12628 * i386.cc (Target_i386::Got_type): New enum declaration.
12629 (Target_i386::Scan::local): Updated callers of Output_data_got
12630 member functions.
12631 (Target_i386::Scan::global): Likewise.
12632 (Target_i386::Relocate::relocate): Likewise.
12633 (Target_i386::Relocate::relocate_tls): Likewise.
12634 * object.h (Got_offset_list): New class.
12635 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12636 (Sized_relobj::local_got_offset): Likewise.
12637 (Sized_relobj::set_local_got_offset): Likewise.
12638 (Sized_relobj::local_has_tls_got_offset): Removed.
12639 (Sized_relobj::local_tls_got_offset): Removed.
12640 (Sized_relobj::set_local_tls_got_offset): Removed.
12641 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12642 * output.cc (Output_data_got::add_global): Added got_type parameter.
12643 (Output_data_got::add_global_with_rel): Likewise.
12644 (Output_data_got::add_global_with_rela): Likewise.
12645 (Output_data_got::add_global_pair_with_rel): New function.
12646 (Output_data_got::add_global_pair_with_rela): New function.
12647 (Output_data_got::add_local): Added got_type parameter.
12648 (Output_data_got::add_local_with_rel): Likewise.
12649 (Output_data_got::add_local_with_rela): Likewise.
12650 (Output_data_got::add_local_pair_with_rel): New function.
12651 (Output_data_got::add_local_pair_with_rela): New function.
12652 (Output_data_got::add_global_tls): Removed.
12653 (Output_data_got::add_global_tls_with_rel): Removed.
12654 (Output_data_got::add_global_tls_with_rela): Removed.
12655 (Output_data_got::add_local_tls): Removed.
12656 (Output_data_got::add_local_tls_with_rel): Removed.
12657 (Output_data_got::add_local_tls_with_rela): Removed.
12658 * output.h (Output_data_got::add_global): Added got_type parameter.
12659 (Output_data_got::add_global_with_rel): Likewise.
12660 (Output_data_got::add_global_with_rela): Likewise.
12661 (Output_data_got::add_global_pair_with_rel): New function.
12662 (Output_data_got::add_global_pair_with_rela): New function.
12663 (Output_data_got::add_local): Added got_type parameter.
12664 (Output_data_got::add_local_with_rel): Likewise.
12665 (Output_data_got::add_local_with_rela): Likewise.
12666 (Output_data_got::add_local_pair_with_rel): New function.
12667 (Output_data_got::add_local_pair_with_rela): New function.
12668 (Output_data_got::add_global_tls): Removed.
12669 (Output_data_got::add_global_tls_with_rel): Removed.
12670 (Output_data_got::add_global_tls_with_rela): Removed.
12671 (Output_data_got::add_local_tls): Removed.
12672 (Output_data_got::add_local_tls_with_rel): Removed.
12673 (Output_data_got::add_local_tls_with_rela): Removed.
12674 * resolve.cc (Symbol::override_base_with_special): Removed
12675 reference to has_got_offset_ field.
12676 * symtab.cc (Symbol::init_fields): Replaced initialization
12677 of got_offset_ with got_offsets_. Removed initialization
12678 of has_got_offset_
12679 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12680 (Symbol::got_offset): Likewise.
12681 (Symbol::set_got_offset): Likewise.
12682 (Symbol::has_tls_got_offset): Removed.
12683 (Symbol::tls_got_offset): Removed.
12684 (Symbol::set_tls_got_offset): Removed.
12685 (Symbol::got_offset_): Removed.
12686 (Symbol::tls_mod_got_offset_): Removed.
12687 (Symbol::tls_pair_got_offset_): Removed.
12688 (Symbol::got_offsets_): New field.
12689 (Symbol::has_got_offset): Removed.
12690 (Symbol::has_tls_mod_got_offset): Removed.
12691 (Symbol::has_tls_pair_got_offset): Removed.
12692 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12693 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12694 member functions.
12695 (Target_x86_64::Scan::global): Likewise.
12696 (Target_x86_64::Relocate::relocate): Likewise.
12697 (Target_x86_64::Relocate::relocate_tls): Likewise.
12698
12699 2008-03-25 Ben Elliston <bje@au.ibm.com>
12700
12701 * yyscript.y: Fix spelling error in comment.
12702
12703 2008-03-24 Ian Lance Taylor <iant@google.com>
12704
12705 * options.h (class General_options): Define build_id option.
12706 * layout.h (class Layout): Declare write_build_id, create_note,
12707 create_build_id. Add build_id_note_ member.
12708 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12709 "libiberty.h", "md5.h", "sha1.h".
12710 (Layout::Layout): Initialize eh_frame_data_,
12711 eh_frame_hdr_section_, and build_id_note_.
12712 (Layout::finalize): Call create_build_id.
12713 (Layout::create_note): New function, broken out of
12714 Layout::create_gold_note.
12715 (Layout::create_gold_note): Call create_note.
12716 (Layout::create_build_id): New function.
12717 (Layout::write_build_id): New function.
12718 (Close_task_runner::run): Call write_build_id.
12719
12720 * x86_64.cc: Correct license to GPLv3.
12721
12722 2008-03-23 Ian Lance Taylor <iant@google.com>
12723
12724 * options.cc: Include "demangle.h".
12725 (parse_optional_string): New function.
12726 (parse_long_option): Handle takes_optional_argument.
12727 (parse_short_option): Update dash_z initializer. Handle
12728 takes_optional_argument.
12729 (General_options::General_options): Initialize do_demangle_.
12730 (General_options::finalize): Set do_demangle_. Handle demangling
12731 style.
12732 * options.h (parse_optional_string): Declare.
12733 (struct One_option): Add optional_arg field. Update constructor.
12734 Update call constructor calls. Add takes_optional_argument
12735 function.
12736 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12737 (DEFINE_optional_string): Define.
12738 (General_options::demangle): Change from DEFINE_bool to
12739 DEFINE_optional_string.
12740 (General_options::no_demangle): New function.
12741 (General_options::do_demangle): New function.
12742 (General_options::set_do_demangle): New function.
12743 (General_options::execstack_status_): Move definition to end of
12744 class definition.
12745 (General_options::static_): Likewise.
12746 (General_options::do_demangle_): New field.
12747 * object.cc (big_endian>::get_symbol_location_info): Call
12748 Options::do_demangle, not Options::demangle.
12749 * symtab.cc (demangle): Likewise.
12750
12751 2008-03-22 Ian Lance Taylor <iant@google.com>
12752
12753 * gold.h: Include <cstddef> and <sys/types.h>
12754 * options.h: Include <cstring>.
12755
12756 2008-03-21 Ian Lance Taylor <iant@google.com>
12757
12758 * Added source code to GNU binutils.
This page took 0.272595 seconds and 5 git commands to generate.