binutils/
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
58797674
RM
12012-04-06 Roland McGrath <mcgrathr@google.com>
2
3 * configure.in (AC_CHECK_HEADERS): Add locale.h.
4 * config.in: Regenerate.
5 * configure: Regenerate.
6
44350750
NC
72012-04-05 Nick Clifton <nickc@redhat.com>
8
9 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
10 (AM_LC_MESSAGES): Add.
11 * aclocal.m4: Regenerate.
12 * config.in: Regenerate.
13 * configure: Regenerate.
14
c1027032
CC
152012-03-21 Cary Coutant <ccoutant@google.com>
16
17 * Makefile.am: Add gdb-index.cc, gdb-index.h.
18 * Makefile.in: Regenerate.
19 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
20 (Sized_elf_reloc_mapper::symbol_section): New function.
21 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
22 (make_elf_reloc_mapper): New function.
23 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
24 (Dwarf_abbrev_table::do_read_abbrevs): New function.
25 (Dwarf_abbrev_table::do_get_abbrev): New function.
26 (Dwarf_ranges_table::read_ranges_table): New function.
27 (Dwarf_ranges_table::read_range_list): New function.
28 (Dwarf_pubnames_table::read_section): New function.
29 (Dwarf_pubnames_table::read_header): New function.
30 (Dwarf_pubnames_table::next_name): New function.
31 (Dwarf_die::Dwarf_die): New function.
32 (Dwarf_die::read_attributes): New function.
33 (Dwarf_die::skip_attributes): New function.
34 (Dwarf_die::set_name): New function.
35 (Dwarf_die::set_linkage_name): New function.
36 (Dwarf_die::attribute): New function.
37 (Dwarf_die::string_attribute): New function.
38 (Dwarf_die::int_attribute): New function.
39 (Dwarf_die::uint_attribute): New function.
40 (Dwarf_die::ref_attribute): New function.
41 (Dwarf_die::child_offset): New function.
42 (Dwarf_die::sibling_offset): New function.
43 (Dwarf_info_reader::check_buffer): New function.
44 (Dwarf_info_reader::parse): New function.
45 (Dwarf_info_reader::do_parse): New function.
46 (Dwarf_info_reader::do_read_string_table): New function.
47 (Dwarf_info_reader::lookup_reloc): New function.
48 (Dwarf_info_reader::get_string): New function.
49 (Dwarf_info_reader::visit_compilation_unit): New function.
50 (Dwarf_info_reader::visit_type_unit): New function.
51 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
52 Sized_elf_reloc_mapper.
53 (Sized_dwarf_line_info::symbol_section): Remove function.
54 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
55 (Sized_dwarf_line_info::read_line_mappings): Remove object
56 parameter, adjust callers.
57 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
58 * dwarf_reader.h: Include <sys/types.h>.
59 (class Track_relocs): Remove forward declaration.
60 (class Elf_reloc_mapper): New class.
61 (class Sized_elf_reloc_mapper): New class.
62 (class Dwarf_abbrev_table): New class.
63 (class Dwarf_range_list): New class.
64 (class Dwarf_ranges_table): New class.
65 (class Dwarf_pubnames_table): New class.
66 (class Dwarf_die): New class.
67 (class Dwarf_info_reader): New class.
68 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
69 (Sized_dwarf_line_info::symbol_section): Remove member function.
70 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
71 base class.
72 * gdb-index.cc: New source file.
73 * gdb-index.h: New source file.
74 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
75 and .debug_types sections, call Layout::add_to_gdb_index.
76 (Sized_relobj_incr::do_section_name): Implement.
77 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
78 return type; Implement.
79 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
80 return type.
81 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
82 parameter list and return type.
83 (Sized_incr_dynobj::do_section_contents): Likewise.
84 * layout.cc: Include gdb-index.h.
85 (Layout::Layout): Initialize gdb_index_data_.
86 (Layout::init_fixed_output_section): Check for .gdb_index section.
87 (Layout::add_to_gdb_index): New function. Instantiate.
88 * layout.h: Add forward declaration for class Gdb_index.
89 (Layout::add_to_gdb_index): New member function.
90 (Layout::gdb_index_data_): New data member.
91 * main.cc: Include gdb-index.h.
92 (main): Print statistics for gdb index.
93 * object.cc (Object::section_contents): Move code into
94 do_section_contents.
95 (need_decompressed_section): Check for sections needed when building
96 gdb index.
97 (build_compressed_section_map): Likewise.
98 (Sized_relobj_file::do_read_symbols): Need local symbols when building
99 gdb index.
100 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
101 sections; call Layout::add_to_gdb_index.
102 (Sized_relobj_file::do_decompressed_section_contents): Call
103 do_section_contents directly.
104 * object.h (Object::do_section_contents): Adjust parameter list and
105 return type.
106 (Object::do_decompressed_section_contents): Call do_section_contents
107 directly.
108 (Sized_relobj_file::do_section_contents): Adjust parameter list and
109 return type.
110 * options.h (class General_options): Add --gdb-index option.
111 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
112 list and return type.
113 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
114 * reloc.h (Track_relocs::checkpoint): New function.
115 (Track_relocs::reset): New function.
116
117 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
118 New test cases.
119 * testsuite/Makefile.in: Regenerate.
120 * testsuite/gdb_index_test.cc: New test source file.
121 * testsuite/gdb_index_test_1.sh: New test source file.
122 * testsuite/gdb_index_test_2.sh: New test source file.
123
647f1574
DK
1242012-03-19 Doug Kwan <dougkwan@google.com>
125
126 * arm.cc (Target_arm::do_define_standard_symbols): New method.
127 (Target_arm::do_finalize_sections): Remove code which defines
128 __exidx_start and __exidx_end. Make symbol table parameter
129 anonymous as it is not used.
130 * gold.cc (queue_middle_tasks): Call target hook to define any
131 target-specific symbols.
132 * target.h (Target::define_standard_symbols): New method.
133 (Target::do_define_standard_symbols): Same.
134 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
135 * testsuite/Makefile.in: Regenerate.
136 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
137 and __exidx_end.
138 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
139 relocations are generated for __exidx_start and __exidx_end.
140
7c6109da
DK
1412012-03-16 Doug Kwan <dougkwan@google.com>
142
143 * testsuite/Makefile.am: Disable test initpri3b.
144 * testsuite/Makefile.in: Regenerate.
145
7b8957f8
DK
1462012-03-15 Doug Kwan <dougkwan@google.com>
147
148 * arm.cc (Target_arm::got_section): Make .got section read-only
149 if -z now is given.
150
14dc9ef7
ILT
1512012-03-15 Ian Lance Taylor <iant@google.com>
152
153 PR gold/13850
154 * layout.cc (Layout::make_output_section): Correctly mark
155 SHT_INIT_ARRAY, et. al., as relro.
156
fa40b62a
DK
1572012-03-14 Doug Kwan <dougkwan@google.com>
158
159 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
160 dynamic relocations for protected symbols in shared objects.
161
fd325007
ILT
1622012-03-13 Ian Lance Taylor <iant@google.com>
163
164 * resolve.cc (Symbol_table::resolve): When merging common symbols,
165 keep the larger alignment.
166
e8dd54e1
CC
1672012-03-12 Cary Coutant <ccoutant@google.com>
168
169 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
170 handling of DW_LNE_define_file.
171
feb5f3b0
CC
1722012-03-12 Cary Coutant <ccoutant@google.com>
173
174 * reduced_debug_output.cc
175 (Output_reduced_debug_info_section::get_die_end): Add new FORM
176 codes to switch.
177
a1fb4256
CC
1782012-02-29 Cary Coutant <ccoutant@google.com>
179
180 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
181
5dd8762a
CC
1822012-02-29 Cary Coutant <ccoutant@google.com>
183
184 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
185 Call Object::decompressed_section_contents.
186 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
187 New dtor.
188 (Sized_dwarf_line_info::buffer_start_): New data member.
189 * merge.cc (Output_merge_data::do_add_input_section): Call
190 Object::decompressed_section_contents.
191 (Output_merge_string::do_add_input_section): Likewise.
192 * object.cc (need_decompressed_section): New function.
193 (build_compressed_section_map): Decompress sections needed later.
194 (Sized_relobj_file::do_decompressed_section_contents): New function.
195 (Sized_relobj_file::do_discard_decompressed_sections): New function.
196 * object.h (Object::decompressed_section_contents): New function.
197 (Object::discard_decompressed_sections): New function.
198 (Object::do_decompressed_section_contents): New function.
199 (Object::do_discard_decompressed_sections): New function.
200 (Compressed_section_info): New type.
201 (Compressed_section_map): Include decompressed section contents.
202 (Sized_relobj_file::do_decompressed_section_contents): New function.
203 (Sized_relobj_file::do_discard_decompressed_sections): New function.
204
7b5de7ee
CC
2052012-02-16 Cary Coutant <ccoutant@google.com>
206
207 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
208 * testsuite/Makefile.in: Regenerate.
209
f9fa4a63
CC
2102012-02-14 Cary Coutant <ccoutant@google.com>
211
212 * options.cc (General_options::finalize): Disallow -pie and -static.
213
2c175ebc
DK
2142012-02-03 Doug Kwan <dougkwan@google.com>
215
216 * arm.cc (Arm_relocate_functions::abs8,
217 Arm_relocate_functions::abs16): Use
218 Bits::has_signed_unsigned_overflow32.
219 (Arm_relocate_functions::thm_abs8): Correct range of
220 overflow check.
221 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
222 in assertions.
223
90cff06f
DK
2242012-02-02 Doug Kwan <dougkwan@google.com>
225
226 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
227 position independent outputs, not just shared objects.
228
63887f3d
L
2292012-01-30 H.J. Lu <hongjiu.lu@intel.com>
230
231 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
232 * configure: Regenerated.
233
bef2b434
ILT
2342012-01-27 Ian Lance Taylor <iant@google.com>
235
236 * reloc.h (Bits): New class with static functions, copied from
237 namespace utils in arm.cc.
238 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
239 instead.
240
c335b55d
L
2412012-01-27 H.J. Lu <hongjiu.lu@intel.com>
242
243 * incremental.cc (write_info_blocks): Correct relocation offset.
244
41194d9f
L
2452012-01-27 H.J. Lu <hongjiu.lu@intel.com>
246
247 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
248 (Relocate::tls_gd_to_le): Likewise.
249
1bae613c
L
2502012-01-27 H.J. Lu <hongjiu.lu@intel.com>
251
252 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
253
24482ca0
L
2542012-01-27 H.J. Lu <hongjiu.lu@intel.com>
255
256 * configure.ac: Check if -mcmodel=medium works.
257 * configure: Regenerated.
258
c2c7840a
CC
2592012-01-24 Cary Coutant <ccoutant@google.com>
260
261 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
262 definition and ...
263 (read_unsigned_LEB_128_x): ... this new function.
264 (read_signed_LEB_128): Replaced with inline definition and ...
265 (read_signed_LEB_128_x): ... this new function.
266 * int_encoding.h (read_unsigned_LEB_128_x): New function.
267 (read_unsigned_LEB_128): Add inline definition.
268 (read_signed_LEB_128_x): New function.
269 (read_signed_LEB_128): Add inline definition.
270 * testsuite/Makefile.am (leb128_unittest): New unit test.
271 * testsuite/Makefile.in: Regenerate.
272 * testsuite/leb128_unittest.cc: New unit test.
273
833de760 2742012-01-23 Ian Lance Taylor <iant@google.com>
9dee3b3c
ILT
275
276 PR gold/13617
277 * i386.cc (Target_i386::do_code_fill): When using a jmp
278 instruction, pad with nop instructions.
279 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
280
618d6666
L
2812012-01-22 H.J. Lu <hongjiu.lu@intel.com>
282
283 * x86_64.cc (gc_process_relocs): Add typename on types used in
284 template.
285 (scan_relocs): Likewise.
286 (relocate_section): Likewise.
287 (apply_relocation): Likewise.
288
3660ff06
L
2892012-01-10 H.J. Lu <hongjiu.lu@intel.com>
290
291 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
292 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
293 under x32.
294
fc51264f
L
2952012-01-09 H.J. Lu <hongjiu.lu@intel.com>
296
297 * x86_64.cc: Initial support for x32.
298
dd74ae06
CC
2992012-01-03 Cary Coutant <ccoutant@google.com>
300
301 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
302 Use abstract base class for GOT.
303 * gold/output.h (class Output_data_got_base): New abstract base class.
304 (class Output_data_got): Derive from new base class, adjust ctors.
305 (Output_data_got::reserve_slot): Make virtual; rename to
306 do_reserve_slot; Adjust callers.
307 * gold/target.h (Sized_target::init_got_plt_for_update): Return
308 pointer to abstract base class.
309 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
310
83896202
ILT
3112011-12-18 Ian Lance Taylor <iant@google.com>
312
313 * object.h (Relobj::local_symbol_value): New function.
314 (Relobj::local_plt_offset): New function.
315 (Relobj::local_has_got_offset): New function.
316 (Relobj::local_got_offset): New function.
317 (Relobj::set_local_got_offset): New function.
318 (Relobj::do_local_symbol_value): New pure virtual function.
319 (Relobj::do_local_plt_offset): Likewise.
320 (Relobj::do_local_has_got_offset): Likewise.
321 (Relobj::do_local_got_offset): Likewise.
322 (Relobj::do_set_local_got_offset): Likewise.
323 (Sized_relobj::do_local_has_got_offset): Rename from
324 local_has_got_offset.
325 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
326 (Sized_relobj::do_set_local_got_offset): Rename from
327 set_local_got_offset.
328 (Sized_relobj_file::do_local_plt_offset): Rename from
329 local_plt_offset.
330 (Sized_relobj_file::do_local_symbol_value): New function.
331 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
332 local_plt_offset.
333 * output.cc (Output_data_got::Got_entry::write): Change object to
334 Relobj. Use local_symbol_value.
335 (Output_data_got::add_global_with_rel): Change rel_dyn to
336 Output_data_reloc_generic*. Use add_global_generic.
337 (Output_data_got::add_global_with_rela): Remove. Change all
338 callers to use add_global_with_rel.
339 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
340 Output_data_reloc_generic*. Use add_global_generic.
341 (Output_data_got::add_global_pair_with_rela): Remove. Change all
342 callers to use add_global_pair_with_rel.
343 (Output_data_got::add_local): Change object to Relobj*.
344 (Output_data_got::add_local_plt): Likewise.
345 (Output_data_got::add_local_with_rel): Change object to Relobj*,
346 change rel_dyn to Output_data_reloc_generic*. Use
347 add_local_generic.
348 (Output_data_got::add_local_with_rela): Remove. Change all
349 callers to use all_local_with_rel.
350 (Output_data_got::add_local_pair_with_rel): Change object to
351 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
352 add_output_section_generic.
353 (Output_data_got::add_local_pair_with_rela): Remove. Change all
354 callers to use add_local_pair_with_rel.
355 (Output_data_got::reserve_local): Change object to Relobj*.
356 * output.h: (class Output_data_reloc_generic): Add pure virtual
357 declarations for add_global_generic, add_local_generic,
358 add_output_section_generic.
359 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
360 functions for Output_data_reloc_generic. Update declarations for
361 changes listed in output.cc.
362 (class Output_data_got): Change template parameter to got_size.
363 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
364 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
365 function.
366 (Sized_relobj_incr::do_local_plt_offset): New function.
367 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
368 add_global_generic.
369
76677ad0
CC
3702011-12-17 Cary Coutant <ccoutant@google.com>
371
372 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
373 * resolve.cc (Symbol_table::resolve): Likewise.
374 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
375 arrays.
376 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
377
8b8dd8d5
ILT
3782011-12-16 Ian Lance Taylor <iant@google.com>
379
380 * output.h (Output_data_reloc_generic::add): Only call
381 add_dynamic_reloc if this is a dynamic reloc section.
382
d55525b9
L
3832011-12-15 H.J. Lu <hongjiu.lu@intel.com>
384
385 PR gold/13505
386 * target-reloc.h (apply_relocation): Replace <64, false> with
387 <size, big_endian>.
388
ff81c7c1
NC
3892011-11-25 Nick Clifton <nickc@redhat.com>
390
391 * po/it.po: New Italian translation.
392
628f39be
SA
3932011-11-17 Sterling Augustine <saugustine@google.com>
394
395 * script.cc (script_include_directive): Implement.
396 (read_script_file): New local variables name and search_path. Update
397 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
398 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
399 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
400
98ef3ea4
SA
4012011-11-11 Sterling Augustine <saugustine@google.com>
402
403 * yyscript.y (section_cmd): Add support for INCLUDE directive.
404 (file_or_sections_cmd): Likewise.
405
f4a8b6d7
DK
4062011-11-11 Doug Kwan <dougkwan@google.com>
407
408 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
409 if --just-symbols is given.
410
29ab395d
DK
4112011-11-10 Doug Kwan <dougkwan@google.com>
412
413 PR gold/13362
414 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
415 when processing data relocs.
416 * reloc.h (Relocate_functions::rel_unaligned): New method.
417 (Relocate_functions::pcrel_unaligned): Ditto.
418 (Relocate_functions::rel32_unaligned): Ditto.
419 (Relocate_functions::pcrel32_unaligned): Ditto.
420
2c339f71
DK
4212011-11-09 Doug Kwan <dougkwan@google.com>
422
423 PR gold/13362
424 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
425 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
426 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
427 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
428 (Relocate_functions::rel_unaligned): New.
429 (Relocate_functions::rel32_unaligned): New.
430 * target-reloc.h (relocate_for_relocatable): Add code to handle
431 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
432 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
433 arm_unaligned_reloc_r): New targets.
434 * testsuite/Makefile.in: Regenerate.
435 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
436 linking.
437
3f3cddf1
ILT
4382011-11-02 Ian Lance Taylor <iant@google.com>
439
440 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
441 NATIVE_LINKER.
442 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
443 * options.cc (General_options::finalize): Use library search path
444 from configure script if specified. If not native and no sysroot,
445 only search TOOLLIBDIR.
446 * options.h (Search_directory::Search_directory): Change name to
447 const std::string&.
448 (General_options::add_to_library_path_with_sysroot): Change arg to
449 const std::string&.
450 * configure, Makefile.in, config.in: Rebuild.
451
a8e2273b
ILT
4522011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
453
454 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
455 we are working around the ARM1176 Erratum.
456 * options.h (General_options::fix_arm1176): Add option.
457 * testsuite/Makefile.am: Add testcases, and keep current ones
458 working.
459 * testsuite/Makefile.in: Regenerate.
460 * testsuite/arm_fix_1176.s: New file.
461 * testsuite/arm_fix_1176.sh: Likewise.
462
cd6eab1c
ILT
4632011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
464
465 * arm.cc (Target_arm::Target_arm): Remove initialisation of
466 may_use_blx_.
467 (Target_arm::may_use_blx): Remove method.
468 (Target_arm::set_may_use_blx): Likewise.
469 (Target_arm::may_use_v4t_interworking): New method.
470 (Target_arm::may_use_v5t_interworking): Likewise.
471 (Target_arm::may_use_blx_): Remove member variable.
472 (Arm_relocate_functions::arm_branch_common): Check for v5T
473 interworking.
474 (Arm_relocate_functions::thumb_branch_common): Likewise.
475 (Reloc_stub::stub_type_for_reloc): Likewise.
476 (Target_arm::do_finalize_sections): Correct interworking checks.
477 * testsuite/Makefile.am: Add new tests.
478 * testsuite/Makefile.in: Regenerate.
479 * testsuite/arm_farcall_arm_arm.s: New test.
480 * testsuite/arm_farcall_arm_arm.sh: Likewise.
481 * testsuite/arm_farcall_arm_thumb.s: Likewise.
482 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
483 * testsuite/arm_farcall_thumb_arm.s: Likewise.
484 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
485 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
486 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
487
286adcf4
CC
4882011-10-31 Cary Coutant <ccoutant@google.com>
489
490 PR gold/13023
491 * expression.cc (Expression::eval_with_dot): Add
492 is_section_dot_assignment parameter.
493 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
494 absolute and assigning to dot within a section.
495 * script-sections.cc
496 (Output_section_element_assignment::set_section_addresses): Pass
497 dot_section to set_if_absolute.
498 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
499 as is_section_dot_assignment flag to eval_with_dot.
500 (Output_section_element_dot_assignment::set_section_addresses):
501 Likewise.
502 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
503 parameter. Also set value if relative to dot_section; set the
504 symbol's output_section.
505 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
506 parameter. Adjust all callers.
507 (Expression::eval_maybe_dot): Likewise.
508 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
509 Adjust all callers.
510 * testsuite/script_test_2.t: Test assignment of an absolute value
511 to dot within an output section element.
512
9634ed06
CC
5132011-10-31 Cary Coutant <ccoutant@google.com>
514
515 * options.h (class General_options): Add --[no-]gnu-unique options.
516 * symtab.cc (Symbol_table::sized_write_globals): Convert
517 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
518
de4101c7
CC
5192011-10-31 Cary Coutant <ccoutant@google.com>
520
521 PR gold/13359
522 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
523 unnecessary assertion.
524 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
525
7257cc92
ST
5262011-10-31 Sriraman Tallam <tmsriram@google.com>
527
528 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
529 gc_mark_symbol.
530 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
531 gc_mark_symbol.
532 Change to just keep the section associated with symbol.
533 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
534 they are externally visible and --export-dynamic is turned on.
535 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
536
bfc34b3f
ILT
5372011-10-19 Ian Lance Taylor <iant@google.com>
538
539 PR gold/13163
540 * script-sections.cc
541 (Output_section_element_dot_assignment::needs_output_section): New
542 function.
543
ea0d8c47
ILT
5442011-10-19 Ian Lance Taylor <iant@google.com>
545
546 PR gold/13204
547 * layout.cc (Layout::segment_precedes): Don't assert failure if a
548 --section-start option was seen.
549 * options.h (General_options::any_section_start): New function.
550
abd242a9
DM
5512011-10-18 David S. Miller <davem@davemloft.net>
552
553 PR binutils/13301
554 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
555 member to track relocation locations that have moved during TLS
556 reloc optimizations.
557 (Target_sparc::Relocate::Relocate): Initialize to NULL.
558 (Target_sparc::Relocate::relocate): Adjust view down by 4
559 bytes if it matches reloc_adjust_addr_.
560 (Target_sparc::Relocate::relocate_tls): Always move the
561 __tls_get_addr call delay slot instruction forward 4 bytes when
562 performing relaxation.
563
bab9090f
CC
5642011-10-18 Cary Coutant <ccoutant@google.com>
565
566 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
567 (Output_file::map_no_anonymous): Check for non-zero
568 return code from posix_fallocate.
569
f7c5b166
CC
5702011-10-17 Cary Coutant <ccoutant@google.com>
571
572 PR gold/13245
573 * plugin.cc (is_visible_from_outside): Check for symbols
574 referenced from dynamic objects.
575 * resolve.cc (Symbol_table::resolve): Don't count references
576 from dynamic objects as references from real ELF files.
577 * testsuite/plugin_test_2.sh: Adjust expected result.
578
b490c0bb
CC
5792011-10-17 Cary Coutant <ccoutant@google.com>
580
581 * gold.cc: Include timer.h.
582 (queue_middle_tasks): Stamp time.
583 (queue_final_tasks): Likewise.
584 * main.cc (main): Store timer in parameters. Print timers
585 for each pass.
586 * parameters.cc (Parameters::Parameters): Initialize timer_.
587 (Parameters::set_timer): New function.
588 (set_parameters_timer): New function.
589 * parameters.h (Parameters::set_timer): New function.
590 (Parameters::timer): New function.
591 (Parameters::timer_): New data member.
592 (set_parameters_timer): New function.
593 * timer.cc (Timer::stamp): New function.
594 (Timer::get_pass_time): New function.
595 * timer.h (Timer::stamp): New function.
596 (Timer::get_pass_time): New function.
597 (Timer::pass_times_): New data member.
598
f475cf7b
CC
5992011-10-17 Cary Coutant <ccoutant@google.com>
600
601 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
602 task for members of lib groups.
603
cdd7e244
CC
6042011-10-17 Cary Coutant <ccoutant@google.com>
605
606 PR gold/13288
4f95c8b4 607 * fileread.cc (File_read::find_view): Add assert.
cdd7e244
CC
608 (File_read::make_view): Move bounds check (replace with assert)...
609 (File_read::find_or_make_view): ... to here.
610
dfb45471
CC
6112011-10-12 Cary Coutant <ccoutant@google.com>
612
4f95c8b4 613 * output.cc (Output_file::open_base_file): Handle case where
dfb45471
CC
614 ::read returns less than requested size.
615
53bbcc1b
CC
6162011-10-10 Cary Coutant <ccoutant@google.com>
617
4f95c8b4 618 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
53bbcc1b
CC
619 Initialize defined_count_.
620 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
621 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
622 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
623 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
624 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4f95c8b4 625 * incremental.h (Sized_relobj_incr::defined_count_): New data
53bbcc1b
CC
626 member.
627 (Sized_incr_dynobj::defined_count_): New data member.
4f95c8b4 628 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
53bbcc1b
CC
629 Return zeroes instead of internal error.
630
397b129b
CC
6312011-10-10 Cary Coutant <ccoutant@google.com>
632
633 PR gold/13249
4f95c8b4 634 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
397b129b 635 (Output_reloc::symbol_value): Return PLT offset if flag is set.
4f95c8b4 636 * output.h (class Output_reloc): Add use_plt_offset flag.
397b129b
CC
637 (Output_reloc::type_): Adjust size of bit field.
638 (Output_reloc::use_plt_offset_): New bit field.
639 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
640 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
641 flag. Adjust all callers.
4f95c8b4 642 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
397b129b
CC
643 creating RELATIVE relocations.
644
d5698657
NC
6452011-10-10 Nick Clifton <nickc@redhat.com>
646
647 * po/es.po: Updated Spanish translation.
648 * po/fi.po: Updated Finnish translation.
649
6a59a5c2
DN
6502011-10-03 Diego Novillo <dnovillo@google.com>
651
652 * options.cc (parse_uint): Fix dereference of RETVAL.
653
f0558624
ST
6542011-09-29 Sriraman Tallam <tmsriram@google.com>
655
656 * layout.h (section_order_map_): New member.
657 (get_section_order_map): New member function.
658 * output.cc (Output_section::add_input_section): Check for patterns
659 only when --section-ordering-file is specified.
660 * gold.cc (queue_middle_tasks): Delay updating order of sections till
661 output_sections have been formed.
662 * layout.cc (Layout_Layout): Initialize section_order_map_.
663 * plugin.cc (update_section_order): Store order in order_map. Do not
664 update the order.
665 * testsuite/Makefile.am: Add test case for plugin_final_layout.
666 * testsuite/Makefile.in: Regenerate.
667 * testsuite/plugin_section_order.c: New file.
668 * testsuite/plugin_final_layout.cc: New file.
669 * testsuite/plugin_final_layout.sh: New file.
670
a7dac153
CC
6712011-09-29 Cary Coutant <ccoutant@google.com>
672
4f95c8b4 673 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
a7dac153 674 Check for NULL.
4f95c8b4 675 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
a7dac153
CC
676 symbols during incremental update.
677 (Symbol_table::add_from_dynobj): Likewise.
678
eebd87a5
ILT
6792011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
680 Ian Lance Taylor <iant@google.com>
681
682 * symtab.cc (Symbol_table::define_special_symbol): Always
683 canonicalize version string.
684
403a3331
CC
6852011-09-26 Cary Coutant <ccoutant@google.com>
686
4f95c8b4
CC
687 * gold.cc (queue_initial_tasks): Move option checks ...
688 * options.cc (General_options::finalize): ... to here. Disable
403a3331
CC
689 some options; make others fatal.
690
235061c2
CC
6912011-09-26 Cary Coutant <ccoutant@google.com>
692
693 gcc PR lto/47247
694 * plugin.cc (get_symbols_v2): New function.
695 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
696 (is_referenced_from_outside): New function.
697 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
698 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
699 (get_symbols): Pass version parameter.
700 (get_symbols_v2): New function.
701 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
702 parameter.
703 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
704 (onload): Add LDPT_GET_SYMBOLS_V2.
705 (all_symbols_read_hook): Use get_symbols_v2; check for
706 LDPR_PREVAILING_DEF_IRONLY_EXP.
707 * testsuite/plugin_test_3.sh: Update expected results.
708
dc87f620
ILT
7092011-09-23 Simon Baldwin <simonb@google.com>
710
711 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
712 configuration options.
713 * configure: Regenerate.
714 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
715 * Makefile.in: Regenerate.
716 * testsuite/Makefile.in: Regenerate.
717
a8279f82
ST
7182011-09-19 Sriraman Tallam <tmsriram@google.com>
719
720 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
721
0c9350c8
CC
7222011-09-19 Cary Coutant <ccoutant@google.com>
723
724 * incremental.cc (can_incremental_update): Fix typo in comment.
725 * incremental.h (can_incremental_update): Likewise.
726
aa06ae28
CC
7272011-09-18 Cary Coutant <ccoutant@google.com>
728
729 * incremental.cc (can_incremental_update): New function.
730 * incremental.h (can_incremental_update): New function.
731 * layout.cc (Layout::init_fixed_output_section): Call it.
732 (Layout::make_output_section): Don't allow patch space in .eh_frame.
733 * object.cc (Sized_relobj_file::do_layout): Call
734 can_incremental_update.
735
ebb300b2
CC
7362011-09-13 Cary Coutant <ccoutant@google.com>
737
738 * configure.ac: Check for glibc support for gnu_indirect_function
739 support with static linking, setting automake conditional
740 IFUNC_STATIC.
741 * Makefile.in: Regenerate.
742 * configure: Regenerate.
743
744 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
745 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
746 for IFUNC_STATIC.
747 * testsuite/Makefile.in: Regenerate.
748
1206d0d5
CC
7492011-09-13 Cary Coutant <ccoutant@google.com>
750
751 * incremental.cc (Sized_relobj_incr::do_layout): Call
752 report_comdat_group for kept comdat sections.
753 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
754 * testsuite/Makefile.in: Regenerate.
755 * testsuite/incr_comdat_test_1.cc: New source file.
756 * testsuite/incr_comdat_test_2_v1.cc: New source file.
757 * testsuite/incr_comdat_test_2_v2.cc: New source file.
758 * testsuite/incr_comdat_test_2_v3.cc: New source file.
759
40b29874
ILT
7602011-09-13 Ian Lance Taylor <iant@google.com>
761
762 * object.cc (Sized_relobj_file::do_layout): Remove unused local
763 variable external_symbols_offset.
764
1b045aac
ILT
7652011-09-12 Ian Lance Taylor <iant@google.com>
766
767 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
768 triggered if object has no symbols.
769
24c6c55a
DM
7702011-09-09 David S. Miller <davem@davemloft.net>
771
772 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
773 (Output_fill_debug_line::do_write): Likewise.
774
66570254
CC
7752011-08-29 Cary Coutant <ccoutant@google.com>
776
777 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
778 casts to match formatting specs.
779 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
780
8ea8cd50
CC
7812011-08-26 Cary Coutant <ccoutant@google.com>
782
783 * layout.cc (Free_list::allocate): Provide guarantee of minimum
784 remaining hole size when allocating.
785 (Layout::make_output_section): Set fill methods for debug sections.
786 * layout.h (Free_list::Free_list_node): Move from private to
787 public.
788 (Free_list::set_min_hole_size): New function.
789 (Free_list::begin, Free_list::end): New functions.
790 (Free_list::min_hole_): New data member.
791 * output.cc: Include dwarf.h.
792 (Output_fill_debug_info::do_minimum_hole_size): New function.
793 (Output_fill_debug_info::do_write): New function.
794 (Output_fill_debug_line::do_minimum_hole_size): New function.
795 (Output_fill_debug_line::do_write): New function.
796 (Output_section::Output_section): Initialize new data member.
797 (Output_section::set_final_data_size): Ensure patch space is larger
798 than minimum hole size.
799 (Output_section::do_write): Fill holes in debug sections.
800 * output.h (Output_fill): New class.
801 (Output_fill_debug_info): New class.
802 (Output_fill_debug_line): New class.
803 (Output_section::set_free_space_fill): New function.
804 (Output_section::free_space_fill_): New data member.
805 * testsuite/Makefile.am (incremental_test_3): Add
806 --incremental-patch option.
807 (incremental_test_4): Likewise.
808 (incremental_test_5): Likewise.
809 (incremental_test_6): Likewise.
810 (incremental_copy_test): Likewise.
811 (incremental_common_test_1): Likewise.
812 * testsuite/Makefile.in: Regenerate.
813
7cf80422
NC
8142011-08-26 Nick Clifton <nickc@redhat.com>
815
816 * po/es.po: Updated Spanish translation.
817
c3f7b0e5
CC
8182011-08-01 Cary Coutant <ccoutant@google.com>
819
820 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
821 * gold/testsuite/Makefile.in: Regenerate.
822 * gold/testsuite/justsyms_exec.c: New source file.
823 * gold/testsuite/justsyms_lib.c: New source file.
824
9590bf25
CC
8252011-08-01 Cary Coutant <ccoutant@google.com>
826
827 * layout.cc (Layout::set_segment_offsets): Don't realign text
828 segment if -Ttext was specified.
829 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
830 file type.
831 * object.h (Sized_relobj_file::e_type): New function.
832 (Sized_relobj_file::e_type_): New data member.
833 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
834 base address for ET_EXEC files.
835 * target.cc (Target::do_make_elf_object_implementation): Allow
836 ET_EXEC files with --just-symbols option.
837
dcd8d12e
CC
8382011-07-28 Cary Coutant <ccoutant@google.com>
839
840 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
841 Add thread_number parameter.
842 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
843 * workqueue-threads.cc
844 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
845 current thread if its thread number is greater than desired thread
846 count.
847 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
848 Add thread_number parameter.
849 (Workqueue::should_cancel_thread): Likewise.
850 (Workqueue::find_runnable_or_wait): Pass thread_number to
851 should_cancel_thread.
852 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
853 parameter.
854
804eb480
ST
8552011-07-22 Sriraman Tallam <tmsriram@google.com>
856
857 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
858 only after checking if it cannot be forced local.
859 * symtab.h (is_externally_visible): Check if the symbol is not forced
860 local.
861
f1ddb600
ILT
8622011-07-15 Ian Lance Taylor <iant@google.com>
863
864 * options.h (class General_options): Add --print-output-format.
865 Move -EL next to -EB, for better --help output.
866 * target-select.cc: Include <cstdio>, "options.h", and
867 "parameters.h".
868 (Target_selector::do_target_bfd_name): New function.
869 (print_output_format): New function.
870 * target-select.h (class Target_selector): Update declarations.
871 (Target_selector::target_bfd_name): New function.
872 (print_output_format): Declare.
873 * main.cc: Include "target-select.h".
874 (main): Handle --print-output-format.
875 * gold.cc: Include "target-select.h".
876 (queue_initial_tasks): Handle --print-output-format when there are
877 no input files.
878 * parameters.cc (parameters_force_valid_target): Give a better
879 error message if -EB/-EL does not match target.
880 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
881 function.
882
7d172687
ILT
8832011-07-15 Ian Lance Taylor <iant@google.com>
884
885 * i386.cc (class Output_data_plt_i386): Add layout_ field.
886 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
887 (Output_data_plt_i386::do_write): Write address of .dynamic
888 section to first entry in .got.plt section.
889 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
890 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
891 Initialize layout_.
892 (Output_data_plt_x86_64::do_write): Write address of .dynamic
893 section to first entry in .got.plt section.
894 * layout.h (Layout::dynamic_section): New function.
895
e9552f7e
ST
8962011-07-13 Sriraman Tallam <tmsriram@google.com>
897
898 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
899 to claim_file call.
900 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
901 input_section_position_, and input_section_glob_.
902 (read_layout_from_file): Call function section_ordering_specified.
903 * layout.h (is_section_ordering_specified): New function.
904 (section_ordering_specified): New function.
905 (section_ordering_specified_): New boolean member.
906 * main.cc(main): Call load_plugins after layout object is defined.
907 * output.cc (Output_section::add_input_section): Use
908 function section_ordering_specified to check if section ordering is
909 needed.
910 * output.cc (Output_section::add_relaxed_input_section): Use
911 function section_ordering_specified to check if section ordering is
912 needed.
913 (Output_section::update_section_layout): New function.
914 (Output_section::sort_attached_input_sections): Check if input section
915 must be reordered.
916 * output.h (Output_section::update_section_layout): New function.
917 * plugin.cc (get_section_count): New function.
918 (get_section_type): New function.
919 (get_section_name): New function.
920 (get_section_contents): New function.
921 (update_section_order): New function.
58797674 922 (allow_section_ordering): New function.
e9552f7e
ST
923 (Plugin::load): Add the new interfaces to the transfer vector.
924 (Plugin_manager::load_plugins): New parameter.
925 (Plugin_manager::all_symbols_read): New parameter.
926 (Plugin_manager::claim_file): New parameter. Save the elf object for
927 unclaimed objects.
928 (Plugin_manager::get_elf_object): New function.
929 (Plugin_manager::get_view): Change to directly use the bool to check
930 if get_view is called from claim_file_hook.
931 * plugin.h (input_objects): New function
932 (Plugin__manager::load_plugins): New parameter.
933 (Plugin_manager::claim_file): New parameter.
934 (Plugin_manager::get_elf_object): New function.
935 (Plugin_manager::in_claim_file_handler): New function.
936 (Plugin_manager::in_claim_file_handler_): New member.
937 (layout): New function.
938 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
939 handler with an extra parameter. Make the elf object before calling
940 claim_file handler.
941 * testsuite/plugin_test.c (get_section_count): New function pointer.
942 (get_section_type): New function pointer.
943 (get_section_name): New function pointer.
944 (get_section_contents): New function pointer.
945 (update_section_order): New function pointer.
946 (allow_section_ordering): New function pointer.
947 (onload): Check if the new interfaces exist.
948
9446efde
ILT
9492011-07-13 Ian Lance Taylor <iant@google.com>
950
951 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
952 relro section.
953 * x86_64.cc (Target_x86_64::got_section): Likewise.
954 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
955 (relro_now_test_SOURCES): New variable.
956 (relro_now_test_DEPENDENCIES): New variable.
957 (relro_now_test_LDFLAGS): New variable.
958 (relro_now_test_LDADD): New variable.
959 (relro_now_test.so): New target.
960 * testsuite/Makefile.in: Rebuild.
961
07aa62f2
ILT
9622011-07-12 Ian Lance Taylor <iant@google.com>
963
964 PR gold/12980
965 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
966 GLOB_DAT relocation rather than a RELATIVE relocation for a
967 protected symbol when creating a shared library.
968 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
969 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
970 * testsuite/protected_main_1.cc (main): Test that protected
971 function has same address.
972
e2153196
ILT
9732011-07-11 Ian Lance Taylor <iant@google.com>
974
975 PR gold/12979
976 * options.h (class General_options): Add -Bgroup.
977 * options.cc (General_options::finalize): If -Bgroup is set,
978 default to --unresolved-symbols=report-all.
979 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
980 * target-reloc.h (issue_undefined_symbol_error): Handle
981 --unresolved-symbols=report-all.
982
6daf5215
ILT
9832011-07-08 Ian Lance Taylor <iant@google.com>
984
985 PR gold/11985
986 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
987 if linker script discards key sections.
988 (Layout::create_dynamic_symtab): Likewise.
989 (Layout::assign_local_dynsym_offsets): Likewise.
990 (Layout::sized_create_version_sections): Likewise.
991 (Layout::create_interp): Likewise.
992 (Layout::finish_dynamic_section): Likewise.
993 (Layout::set_dynamic_symbol_size): Likewise.
994
beabb2c6
ILT
9952011-07-08 Ian Lance Taylor <iant@google.com>
996
997 PR gold/12386
998 * options.h (class General_options): Add --unresolved-symbols.
999 * target-reloc.h (issue_undefined_symbol_error): Check
1000 --unresolved-symbols. Add comments.
1001
9c16daf1
ILT
10022011-07-08 Ian Lance Taylor <iant@google.com>
1003
1004 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1005 expression more complex.
1006
191f1a2d
ILT
10072011-07-08 Ian Lance Taylor <iant@google.com>
1008
1009 PR gold/11317
1010 * target-reloc.h (issue_undefined_symbol_error): New inline
1011 function, broken out of relocate_section.
1012 (relocate_section): Call issue_undefined_symbol_error.
1013 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1014 there is no TLS segment if we are about to issue an undefined
1015 symbol error.
1016 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1017
62855347
ILT
10182011-07-08 Ian Lance Taylor <iant@google.com>
1019
1020 PR gold/12279
1021 * resolve.cc (Symbol_table::should_override): Add fromtype
1022 parameter. Change all callers. Give error when linking together
1023 TLS and non-TLS symbol.
1024 (Symbol_table::should_override_with_special): Add fromtype
1025 parameter. Change all callers.
1026 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1027 there is no TLS segment if we have reported some errors.
1028 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1029
67181c72
ILT
10302011-07-08 Ian Lance Taylor <iant@google.com>
1031
1032 PR gold/12372
1033 * target.h (Target::plt_address_for_global): New function.
1034 (Target::plt_address_for_local): New function.
1035 (Target::plt_section_for_global): Remove.
1036 (Target::plt_section_for_local): Remove.
1037 (Target::do_plt_address_for_global): New virtual function.
1038 (Target::do_plt_address_for_local): New virtual function.
1039 (Target::do_plt_section_for_global): Remove.
1040 (Target::do_plt_section_for_local): Remove.
1041 (Target::register_global_plt_entry): Add Symbol_table and Layout
1042 parameters.
1043 * output.cc (Output_data_got::Got_entry::write): Use
1044 plt_address_for_global and plt_address_for_local.
1045 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1046 address of output section.
1047 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1048 got_irelative_, and irelative_count_ fields. Update
1049 declarations.
1050 (Output_data_plt_i386::has_irelative_section): New function.
1051 (Output_data_plt_i386::entry_count): Add irelative_count_.
1052 (Output_data_plt_i386::set_final_data_size): Likewise.
1053 (class Target_i386): Add got_irelative_ and rel_irelative_
1054 fields. Update declarations.
1055 (Target_i386::Target_i386): Initialize new fields.
1056 (Target_i386::do_plt_address_for_global): New function replacing
1057 do_plt_section_for_global.
1058 (Target_i386::do_plt_address_for_local): New function replacing
1059 do_plt_section_for_local.
1060 (Target_i386::got_section): Create got_irelative_.
1061 (Target_i386::rel_irelative_section): New function.
1062 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1063 fields. Don't define __rel_iplt_{start,end}.
1064 (Output_data_plt_i386::add_entry): Add symtab and layout
1065 parameters. Change all callers. Use different PLT and GOT for
1066 IFUNC symbols.
1067 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1068 layout parameters. Change all callers. Use different PLT and
1069 GOT.
1070 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1071 (Output_data_plt_i386::rel_irelative): New function.
1072 (Output_data_plt_i386::address_for_global): New function.
1073 (Output_data_plt_i386::address_for_local): New function.
1074 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1075 IRELATIVE GOT when changing IFUNC GOT entries.
1076 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1077 reloc.
1078 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1079 if we didn't create an IRELATIVE GOT.
1080 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1081 plt_address_for_local.
1082 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1083 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1084 got_irelative_, and irelative_count_ fields. Update
1085 declarations.
1086 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1087 Initialize new fields. Remove symtab parameter. Change all
1088 callers.
1089 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1090 irelative_count_.
1091 (Output_data_plt_x86_64::has_irelative_section): New function.
1092 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1093 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1094 fields. Update declarations.
1095 (Target_x86_64::Target_x86_64): Initialize new fields.
1096 (Target_x86_64::do_plt_address_for_global): New function replacing
1097 do_plt_section_for_global.
1098 (Target_x86_64::do_plt_address_for_local): New function replacing
1099 do_plt_section_for_local.
1100 (Target_x86_64::got_section): Create got_irelative_.
1101 (Target_x86_64::rela_irelative_section): New function.
1102 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1103 all callers. Don't create __rel_iplt_{start,end}.
1104 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1105 parameters. Change all callers. Use different PLT and GOT for
1106 IFUNC symbols.
1107 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1108 layout parameters. Change all callers. Use different PLT and
1109 GOT.
1110 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1111 parameters. Change all callers. Use different PLT and GOT for
1112 IFUNC symbols.
1113 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1114 (Output_data_plt_x86_64::rela_irelative): New function.
1115 (Output_data_plt_x86_64::address_for_global): New function.
1116 (Output_data_plt_x86_64::address_for_local): New function.
1117 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1118 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1119 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1120 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1121 parameters.
1122 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1123 reloc.
1124 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1125 symbols if we didn't create an IRELATIVE GOT.
1126 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1127 plt_address_for_local.
1128 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1129 * testsuite/ifuncvar1.c: New test file.
1130 * testsuite/ifuncvar2.c: New test file.
1131 * testsuite/ifuncvar3.c: New test file.
1132 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1133 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1134 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1135 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1136 * testsuite/Makefile.in: Rebuild.
1137
33c15b45
CC
11382011-07-07 Cary Coutant <ccoutant@google.com>
1139
1140 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1141 (two_file_test_1_ndebug.o): Likewise.
1142 (two_file_test_1b_ndebug.o): Likewise.
1143 (two_file_test_2_ndebug.o): Likewise.
1144 (two_file_test_main_ndebug.o): Likewise.
1145 (incremental_test_2): Link with no-debug versions.
1146
f48b5fb7
CC
11472011-07-06 Cary Coutant <ccoutant@google.com>
1148
1149 * gold/incremental.cc
1150 (Output_section_incremental_inputs::write_info_blocks): Check for
1151 hidden and internal symbols.
1152
221597a5
CC
11532011-07-06 Cary Coutant <ccoutant@google.com>
1154
1155 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1156 Check disposition for startup file.
1157 (Incremental_inputs::report_command_line): Ignore
1158 --incremental-startup-unchanged option.
1159 * options.cc (General_options::parse_incremental_startup_unchanged):
1160 New function.
1161 (General_options::General_options): Initialize new data member.
1162 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1163 (General_options): Add --incremental-startup-unchanged option.
1164 (General_options::incremental_startup_disposition): New function.
1165 (General_options::incremental_startup_disposition_): New data member.
1166
e24719f6
CC
11672011-07-06 Cary Coutant <ccoutant@google.com>
1168
1169 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1170 input file index to Script_info ctor.
1171 (Sized_incremental_binary::do_file_has_changed): Find the
1172 command-line argument for files named in scripts.
1173 * incremental.h (Script_info::Script_info): New ctor
1174 with input file index.
1175 (Script_info::input_file_index): New function.
1176 (Script_info::input_file_index_): New data member.
1177 (Incremental_binary::get_library): Add const.
1178 (Incremental_binary::get_script_info): Add const.
1179 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1180 * testsuite/Makefile.am (incremental_test_5): New test case.
1181 (incremental_test_6): New test case.
1182 * testsuite/Makefile.in: Regenerate.
1183
8f7c81e8
CC
11842011-07-06 Cary Coutant <ccoutant@google.com>
1185
1186 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1187 debug output when command lines differ.
1188
9fbd3822
CC
11892011-07-06 Cary Coutant <ccoutant@google.com>
1190
1191 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1192 --incremental-patch option.
1193 * layout.cc (Free_list::allocate): Extend allocation beyond original
1194 end if enabled.
1195 (Layout::make_output_section): Mark sections that should get
1196 patch space.
1197 * options.cc (parse_percent): New function.
1198 * options.h (parse_percent): New function.
1199 (DEFINE_percent): New macro.
1200 (General_options): Add --incremental-patch option.
1201 * output.cc (Output_section::Output_section): Initialize new data
1202 members.
1203 (Output_section::add_input_section): Print section name when out
1204 of patch space.
1205 (Output_section::add_output_section_data): Likewise.
1206 (Output_section::set_final_data_size): Add patch space when
1207 doing --incremental-full.
1208 (Output_section::do_reset_address_and_file_offset): Remove patch
1209 space.
1210 (Output_segment::set_section_list_addresses): Print debug output
1211 only if --incremental-update.
1212 * output.h (Output_section::set_is_patch_space_allowed): New function.
1213 (Output_section::is_patch_space_allowed_): New data member.
1214 (Output_section::patch_space_): New data member.
1215 * parameters.cc (Parameters::incremental_full): New function.
1216 * parameters.h (Parameters::incremental_full): New function
1217 * testsuite/Makefile.am (incremental_test_2): Add test for
1218 --incremental-patch option.
1219 * testsuite/Makefile.in: Regenerate.
1220 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1221 (t18): Remove function body.
1222
f6cccc2c
DK
12232011-07-05 Doug Kwan <dougkwan@google.com>
1224
1225 PR gold/12771
1226 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1227 Arm_Address type for relocation result.
1228 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1229 overflow check.
1230 (Arm_relocate_functions::abs32): Use unaligned access.
1231 (Arm_relocate_functions::rel32): Ditto.
1232 (Arm_relocate_functions::prel31): Ditto.
1233 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1234 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1235 static data relocations.
1236 * testsuite/Makefile.in: Regnerate.
1237 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1238
28a13fec
ILT
12392011-07-05 Ian Lance Taylor <iant@google.com>
1240
1241 PR gold/12392
1242 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1243 symbols if necessary.
1244 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1245
24d47b34
ILT
12462011-07-05 Ian Lance Taylor <iant@google.com>
1247
1248 PR gold/12952
1249 * resolve.cc (Symbol::override_base_with_special): Simply override
1250 version with special symbol version, ignoring previous version.
1251
41f9cbbe
ILT
12522011-07-05 Ian Lance Taylor <iant@google.com>
1253
1254 * object.cc (Sized_relobj_file::include_section_group): Add
1255 information to comment about signature location.
1256
886288f1
ILT
12572011-07-02 Ian Lance Taylor <iant@google.com>
1258
1259 PR gold/12957
1260 * options.h (class General_options): Add -f and -F.
1261 * options.cc (General_options::finalize): Fatal error if -f/-F
1262 are used without -shared.
1263 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1264
ae3a6d4f
ILT
12652011-07-02 Ian Lance Taylor <iant@google.com>
1266
1267 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1268
21131061
ILT
12692011-07-01 Ian Lance Taylor <iant@google.com>
1270
1271 PR gold/12525
1272 PR gold/12952
1273 * resolve.cc (Symbol::override_base_with_special): Don't override
1274 the version if the overriding symbol has a different name.
1275 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1276 all callers. If we give an error about an undefined version,
1277 define the base version if necessary.
1278 * dynobj.h (class Versions): Update declaration.
1279 * testsuite/weak_alias_test_5.cc: New file.
1280 * testsuite/weak_alias_test.script: New file.
1281 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1282 and versioned_alias have the right value, and call t2.
1283 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1284 weak_alias_test_5.so.
1285 (weak_alias_test_LDADD): Likewise.
1286 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1287 * testsuite/Makefile.in: Rebuild.
1288
611062c0
ILT
12892011-07-01 Ian Lance Taylor <iant@google.com>
1290
1291 PR gold/12525
1292 * options.h (class General_options): Support -z notext.
1293 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1294 -Wl,-z,notext.
1295 (two_file_shared_nonpic.so): Likewise.
1296 (two_file_shared_mixed.so): Likewise.
1297 (two_file_shared_mixed_1.so): Likewise.
1298 (weak_undef_lib_nonpic.so): Likewise.
1299 (alt/weak_undef_lib_nonpic.so): Likewise.
1300 (tls_test_shared_nonpic.so): Likewise.
1301 * testsuite/Makefile.in: Rebuild.
1302
328c7c2f
ILT
13032011-07-01 Ian Lance Taylor <iant@google.com>
1304
1305 PR gold/12525
1306 * configure.ac: Test whether static linking works, setting
1307 the automake conditional HAVE_STATIC.
1308 * testsuite/Makefile.am: Disable tests using -static if
1309 HAVE_STATIC is not true.
1310 * configure, testsuite/Makefile.in: Rebuild.
1311
02d7cd44
ILT
13122011-07-01 Ian Lance Taylor <iant@google.com>
1313
1314 PR gold/12525
1315 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1316 Assert if we see DW_EH_PE_indirect.
1317 * target.h (Target::ehframe_datarel_base): New function.
1318 (Target::do_ehframe_datarel_base): New target function.
1319 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1320 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1321 function.
1322
07a60597
ILT
13232011-07-01 Ian Lance Taylor <iant@google.com>
1324
1325 PR gold/12571
1326 * options.h (class General_options): Add
1327 --ld-generated-unwind-info.
1328 * ehframe.cc (Fde::write): Add address parameter. Change all
1329 callers. If associated with PLT, fill in address and size.
1330 (Cie::set_output_offset): Only add merge mapping if there is an
1331 object.
1332 (Cie::write): Add address parameter. Change all callers.
1333 (Eh_frame::add_ehframe_for_plt): New function.
1334 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1335 input_offset_ fields into union u_, with new plt field.
1336 (Fde::Fde): Adjust for new union field.
1337 (Fde::Fde) [Output_data version]: New constructor.
1338 (Fde::add_mapping): Only add merge mapping if there is an object.
1339 (class Cie): Update declarations.
1340 (class Eh_frame): Declare add_ehframe_for_plt.
1341 * layout.cc (Layout::layout_eh_frame): Break out code into
1342 make_eh_frame_section, and call it.
1343 (Layout::make_eh_frame_section): New function.
1344 (Layout::add_eh_frame_for_plt): New function.
1345 * layout.h (class Layout): Update declarations.
1346 * merge.cc (Merge_map::add_mapping): Add assertion.
1347 * i386.cc: Include "dwarf.h".
1348 (class Output_data_plt_i386): Make first_plt_entry,
1349 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1350 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1351 and plt_eh_frame_fde.
1352 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1353 boundary. Call add_eh_frame_for_plt if appropriate.
1354 * x86_64.cc: Include "dwarf.h".
1355 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1356 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1357 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1358 and plt_eh_frame_fde.
1359 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1360 appropriate.
1361
14788a3f
ILT
13622011-06-29 Ian Lance Taylor <iant@google.com>
1363
1364 PR gold/12629
1365 * object.cc (Sized_relobj_file::layout_section): Change shdr
1366 parameter to be const.
1367 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1368 out of do_layout.
1369 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1370 appropriate. Call layout_eh_frame_section.
1371 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1372 sections.
1373 * object.h (class Sized_relobj_file): Update declarations.
1374
6c21fce1
ILT
13752011-06-29 Ian Lance Taylor <iant@google.com>
1376
37e41b03 1377 PR gold/12652
6c21fce1
ILT
1378 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1379 modifier.
1380 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1381
4d5e4e62
ILT
13822011-06-29 Ian Lance Taylor <iant@google.com>
1383
1384 PR gold/12675
1385 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1386 SHT_X86_64_UNWIND.
1387 * layout.cc (Layout::layout_eh_frame): Likewise.
1388
886f533a
ILT
13892011-06-29 Ian Lance Taylor <iant@google.com>
1390
1391 PR gold/12695
1392 * layout.cc (Layout::symtab_section_shndx): New function.
1393 * layout.h (class Layout): Declare symtab_section_shndx.
1394 * output.cc (Output_section::write_header): Call it.
1395
f3ae1b28
ILT
13962011-06-29 Ian Lance Taylor <iant@google.com>
1397
1398 PR gold/12818
1399 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1400 symbols which are not used in a relocation.
1401
aecf301f
ILT
14022011-06-28 Ian Lance Taylor <iant@google.com>
1403
1404 PR gold/12898
1405 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1406 script create indistinguishable segments.
1407 (Layout::set_segment_offsets): Use stable_sort when sorting
1408 segments. Pass this to Compare_segments constructor.
1409 * layout.h (class Layout): Make segment_precedes non-static.
1410 (class Compare_segments): Change from struct to class. Add
1411 layout_ field. Add constructor.
1412 * script-sections.cc
1413 (Script_sections::attach_sections_using_phdrs_clause): Rename
1414 local orphan to is_orphan. Don't report failure to put empty
1415 section in segment. On attachment failure, report name of
1416 section, and attach to first PT_LOAD segment.
1417
03ef7571
ILT
14182011-06-28 Ian Lance Taylor <iant@google.com>
1419
1420 PR gold/12934
1421 * target-select.cc (Target_selector::Target_selector): Add
1422 emulation parameter. Change all callers.
1423 (select_target_by_bfd_name): Rename from select_target_by_name.
1424 Change all callers.
1425 (select_target_by_emulation): New function.
1426 (supported_emulation_names): New function.
1427 * target-select.h (class Target_selector): Add emulation_ field.
1428 Update declarations.
1429 (Target_selector::recognize_by_bfd_name): Rename from
1430 recognize_by_name. Change all callers.
1431 (Target_selector::supported_bfd_names): Rename from
1432 supported_names. Change all callers.
1433 (Target_selector::recognize_by_emulation): New function.
1434 (Target_selector::supported_emulations): New function.
1435 (Target_selector::emulation): New function.
1436 (Target_selector::do_recognize_by_bfd_name): Rename from
1437 do_recognize_by_name. Change all callers.
1438 (Target_selector::do_supported_bfd_names): Rename from
1439 do_supported_names. Change all callers.
1440 (Target_selector::do_recognize_by_emulation): New function.
1441 (Target_selector::do_supported_emulations): New function.
1442 (select_target_by_bfd_name): Change name in declaration.
1443 (select_target_by_emulation): Declare.
1444 (supported_emulation_names): Declare.
1445 * parameters.cc (parameters_force_valid_target): Try to find
1446 target based on emulation from -m option.
1447 * options.h (class General_options): Change doc string for -m.
1448 * options.cc (help): Print emulations.
1449 (General_options::parse_V): Likewise.
1450 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1451 Add emulation parameter. Change all callers.
1452
200b2bb9
ILT
14532011-06-28 Ian Lance Taylor <iant@google.com>
1454
1455 * target.h (class Target): Add osabi_ field.
1456 (Target::osabi): New function.
1457 (Target::set_osabi): New function.
1458 (Target::Target): Initialize osabi_.
1459 (Target::do_adjust_elf_header): Make pure virtual.
1460 (Sized_target::do_adjust_elf_header): Declare.
1461 * target.cc (Sized_target::do_adjust_elf_header): New function.
1462 (class Sized_target): Instantiate all versions.
1463 * freebsd.h (class Target_freebsd): Remove.
1464 (Target_selector_freebsd::do_recognize): Call set_osabi on
1465 Target.
1466 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1467 (Target_selector_freebsd::set_osabi): Remove.
1468 * i386.cc (class Target_i386): Inherit from Sized_target rather
1469 than Target_freebsd.
1470 * x86_64.cc (class Target_x86_64): Likewise.
1471
b3ce541e
ILT
14722011-06-28 Ian Lance Taylor <iant@google.com>
1473
1474 * target.h (Target::can_check_for_function_pointers): Rewrite.
1475 Make non-virtual.
1476 (Target::can_icf_inline_merge_sections): Likewise.
1477 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1478 (Target::Target_info): Add can_icf_inline_merge_sections field.
1479 (Target::do_can_check_for_function_pointers): New virtual
1480 function.
1481 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1482 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1483 from can_check_for_function_pointers, move in file.
1484 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1485 section_may_have_icf_unsafe_poineters, move in file.
1486 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1487 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1488 Rename from can_check_for_function_pointers, move in file.
1489 (Target_i386::can_icf_inline_merge_sections): Remove.
1490 (Target_i386::i386_info): Initialize
1491 can_icf_inline_merge_sections.
1492 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1493 Initialize can_icf_inline_merge_sections.
1494 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1495 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1496 Rename from can_check_for_function_pointers, move in file.
1497 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1498 (Target_x86_64::x86_64_info): Initialize
1499 can_icf_inline_merge_sections.
1500 * testsuite/testfile.cc (Target_test::test_target_info):
1501 Likewise.
1502 * icf.cc (get_section_contents): Correct formatting.
1503
6d1c4efb
ILT
15042011-06-27 Ian Lance Taylor <iant@google.com>
1505
1506 * symtab.cc (Symbol::versioned_name): New function.
1507 (Symbol_table::add_to_final_symtab): Use versioned_name when
1508 appropriate.
1509 (Symbol_table::sized_write_symbol): Likewise.
1510 * symtab.h (class Symbol): Declare versioned_name.
1511 * stringpool.h (class Stringpool_template): Add variant of add
1512 which takes a std::basic_string.
1513 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1514 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1515 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1516 (ver_test_12.o): New target.
1517 * testsuite/Makefile.in: Rebuild.
1518
57eb9b50
DK
15192011-06-27 Doug Kwan <dougkwan@google.com>
1520
1521 * arm.cc (Arm_relocate_functions::thm_jump8,
1522 Arm_relocate_functions::thm_jump11): Use a wider signed
1523 type to compute offset.
1524 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1525 arm_thm_jump8.
1526 * testsuite/Makefile.in: Regenerate.
1527 * testsuite/arm_branch_in_range.sh: Check test results of
1528 arm_thm_jump11 and arm_thm_jump8.
1529 * testsuite/arm_thm_jump11.s: New test source file.
1530 * testsuite/arm_thm_jump11.t: New linker script.
1531 * testsuite/arm_thm_jump8.s: New test source file.
1532 * testsuite/arm_thm_jump8.t: New linker script.
1533
487b39df
ILT
15342011-06-24 Ian Lance Taylor <iant@google.com>
1535
1536 * layout.cc: Include "object.h".
1537 (ctors_sections_in_init_array): New static variable.
1538 (Layout::is_ctors_in_init_array): New function.
1539 (Layout::layout): Add entry to ctors_sections_in_init_array if
1540 appropriate.
1541 * layout.h (class Layout): Declare is_ctors_in_init_array.
1542 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1543 is_ctors_reverse_view is set.
1544 (Sized_relobj_file::write_sections): Add layout parameter. Change
1545 all callers. Set is_ctors_reverse_view field of View_size.
1546 (Sized_relobj_file::reverse_words): New function.
1547 * object.h (Sized_relobj_file::View_size): Add
1548 is_ctors_reverse_view field.
1549 (class Sized_relobj_file): Update declarations.
1550 * testsuite/initpri3.c: New test.
1551 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1552 initpri3b.
1553 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1554 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1555 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1556 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1557 * testsuite/Makefile.in: Rebuild.
1558
472076e4
CC
15592011-06-24 Cary Coutant <ccoutant@google.com>
1560
1561 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1562 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1563 (debug_msg_cdebug.err): New targets.
1564 * testsuite/Makefile.in: Regenerate.
1565 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1566 Fix checks for link with shared library.
1567
a60af0db
DK
15682011-06-24 Doug Kwan <dougkwan@google.com>
1569
1570 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1571 skip empty text sections.
1572 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1573
5393d741
ILT
15742011-06-22 Ian Lance Taylor <iant@google.com>
1575
1576 PR gold/12910
1577 * options.h (class General_options): Add --ctors-in-init-array.
1578 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1579 friends as SHT_PROGBITS for merging sections.
1580 (Layout::layout): Remove special handling of .init_array and
1581 friends. Don't sort if doing relocatable link. Sort for .ctors
1582 and .dtors if ctors_in_init_array.
1583 (Layout::make_output_section): Force correct section types for
1584 .init_array and friends. Don't sort if doing relocatable link,
1585 Don't sort .ctors and .dtors if ctors_in_init_array.
1586 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1587 (Layout::output_section_name): Add relobj parameter. Change all
1588 callers. Handle .ctors. and .dtors. in code rather than table.
1589 Handle .ctors and .dtors if ctors_in_init_array.
1590 (Layout::match_file_name): New function, moved from output.cc.
1591 * layout.h (class Layout): Update declarations.
1592 * output.cc: Include "layout.h".
1593 (Input_section_sort_entry::get_priority): New function.
1594 (Input_section_sort_entry::match_file_name): Just call
1595 Layout::match_file_name.
1596 (Output_section::Input_section_sort_init_fini_compare::operator()):
1597 Handle .ctors and .dtors. Sort by explicit priority rather than
1598 by name.
1599 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1600 * testsuite/initpri2.c: New test.
1601 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1602 (check_PROGRAMS): Add initpri2.
1603 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1604 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1605 * configure, testsuite/Makefile.in: Rebuild.
1606
e1f74f98
ILT
16072011-06-19 Ian Lance Taylor <iant@google.com>
1608
1609 PR gold/12880
1610 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1611 .interp section to a PT_INTERP segment even if we have seen a
1612 --dynamic-linker option. Don't do it if we have seen a PHDRS
1613 clause in a linker script.
1614 (Layout::finalize): Don't create a .interp section if we've
1615 already create a PT_INTERP segment.
1616 (Layout::create_interp): Always call choose_output_section (revert
1617 patch of 2011-06-17). Don't create PT_INTERP segment.
1618 * script-sections.cc
1619 (Script_sections::create_note_and_tls_segments): Add a .interp
1620 section to a PT_INTERP segment even if we have seen a
1621 --dynamic-linker option.
1622
766f91bb
ILT
16232011-06-18 Ian Lance Taylor <iant@google.com>
1624
1625 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1626 merely because a non-PT_LOAD segment has a dynamic reloc.
1627
0d212c3a
ILT
16282011-06-18 Ian Lance Taylor <iant@google.com>
1629
1630 * layout.cc (Layout::finish_dynamic_section): Don't create
1631 DT_FLAGS entry if not needed.
1632
911a5072
ILT
16332011-06-18 Ian Lance Taylor <iant@google.com>
1634
1635 PR gold/12745
1636 * layout.cc (Layout::layout_eh_frame): Correct handling of
1637 writable .eh_frame section.
1638
534b4e5f
ILT
16392011-06-17 Ian Lance Taylor <iant@google.com>
1640
1641 PR gold/12893
1642 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1643 symbol is redefined with the exact same object and value.
1644
10b4f102
ILT
16452011-06-17 Ian Lance Taylor <iant@google.com>
1646
1647 PR gold/12880
1648 * layout.h (class Layout): Add interp_segment_ field.
1649 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1650 (Layout::attach_allocated_section_to_segment): If making shared
1651 library, put .interp section in PT_INTERP segment.
1652 (Layout::finalize): Also call create_interp if -dynamic-linker
1653 option was used.
1654 (Layout::create_interp): Assert that there is no PT_INTERP
1655 segment. If not using a SECTIONS clause, use make_output_section.
1656 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1657 * script-sections.cc
1658 (Script_sections::create_note_and_tls_segments): If making shared
1659 library, put .interp section in PT_INTERP segment.
1660
a29b0dad
ILT
16612011-06-17 Ian Lance Taylor <iant@google.com>
1662
e588ea8d
ILT
1663 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1664 when making a shared library.
1665
16662011-06-17 Ian Lance Taylor <iant@google.com>
1667
1668 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1669 parameter. Change all callers. Don't issue warning about PC32
1670 against locally defined symbol.
a29b0dad 1671
9d3b0698
ILT
16722011-06-16 Ian Lance Taylor <iant@google.com>
1673
1674 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1675 occurs in same object.
1676
85b0f90c
AM
16772011-06-14 Alan Modra <amodra@gmail.com>
1678
1679 * po/POTFILES.in: Regenerate.
1680
a94907d9
ILT
16812011-06-09 Ian Lance Taylor <iant@google.com>
1682
1683 * script-sections.cc
1684 (Orphan_output_section::set_section_addresses): For a relocatable
1685 link set address to 0.
1686
4fb3a1c3
CC
16872011-06-09 Cary Coutant <ccoutant@google.com>
1688
1689 PR gold/12804
1690 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1691 used with --compress-debug-sections.
1692 * gold/object.cc (Sized_relobj_file::do_layout): Report
1693 uncompressed size of compressed input sections.
1694
61220854
CC
16952011-06-08 Cary Coutant <ccoutant@google.com>
1696
1697 PR gold/12804
1698 * testsuite/two_file_test_2_v1.cc: Change initialization of
1699 v2 to keep it in .data.
1700
e6455dfb
CC
17012011-06-07 Cary Coutant <ccoutant@google.com>
1702
1703 * common.cc (Symbol_table::do_allocate_commons_list): Call
1704 gold_fallback.
1705 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1706 (Errors::fallback): New function.
1707 (gold_fallback): New function.
1708 * errors.h (Errors::fallback): New function.
1709 * gold.cc (gold_exit): Change status parameter to enum; adjust
1710 all callers.
1711 (queue_initial_tasks): Call gold_fallback.
1712 * gold.h: Include cstdlib.
1713 (Exit_status): New enum type.
1714 (gold_exit): Change status parameter to enum.
1715 (gold_fallback): New function.
1716 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1717 (Layout::create_symtab_sections): Likewise.
1718 (Layout::create_shdrs): Likewise.
1719 * main.cc (main): Adjust call to gold_exit.
1720 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1721 (Output_data_got::add_got_entry_pair): Likewise.
1722 (Output_section::add_input_section): Likewise.
1723 (Output_section::add_output_section_data): Likewise.
1724 (Output_segment::set_section_list_addresses): Likewise.
1725 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1726
fb0e076f
CC
17272011-06-07 Cary Coutant <ccoutant@google.com>
1728
1729 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1730 for incremental links.
1731 * output.cc (Output_segment::set_section_list_addresses): Remove
1732 FIXME and test for TLS or BSS.
1733
a5ee4d5d
CC
17342011-06-07 Cary Coutant <ccoutant@google.com>
1735
1736 * testsuite/Makefile.am: Add incremental_copy_test,
1737 incremental_common_test_1.
1738 * testsuite/Makefile.in: Regenerate.
1739 * testsuite/common_test_1_v1.c: New source file.
1740 * testsuite/common_test_1_v2.c: New source file.
1741 * testsuite/copy_test_v1.cc: New source file.
1742
5146f448
CC
17432011-06-07 Cary Coutant <ccoutant@google.com>
1744
1745 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1746 update, allocate common from bss section's free list.
1747 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1748 linker-defined symbols.
1749 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1750 Skip GOT and PLT entries that are no longer referenced.
1751 (Output_section_incremental_inputs::write_info_blocks): Mark
1752 linker-defined symbols.
1753 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1754 * output.cc (Output_section::allocate): New function.
1755 * output.h (Output_section::allocate): New function.
1756 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1757 linker-defined symbols.
1758 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1759 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1760 (Symbol::init_base_output_data): Likewise.
1761 (Symbol::init_base_output_segment): Likewise.
1762 (Symbol::init_base_constant): Likewise.
1763 (Sized_symbol::init_output_data): Likewise.
1764 (Sized_symbol::init_output_segment): Likewise.
1765 (Sized_symbol::init_constant): Likewise.
1766 (Symbol_table::do_define_in_output_data): Likewise.
1767 (Symbol_table::do_define_in_output_segment): Likewise.
1768 (Symbol_table::do_define_as_constant): Likewise.
1769 * symtab.h (Symbol::is_predefined): New function.
1770 (Symbol::init_base_output_data): Add is_predefined parameter.
1771 (Symbol::init_base_output_segment): Likewise.
1772 (Symbol::init_base_constant): Likewise.
1773 (Symbol::is_predefined_): New data member.
1774 (Sized_symbol::init_output_data): Add is_predefined parameter.
1775 (Sized_symbol::init_output_segment): Likewise.
1776 (Sized_symbol::init_constant): Likewise.
1777 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1778
26d3c67d
CC
17792011-06-07 Cary Coutant <ccoutant@google.com>
1780
1781 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1782 instead of emit_copy_reloc.
1783 (Copy_relocs::emit_copy_reloc): Refactor.
1784 (Copy_relocs::make_copy_reloc): New function.
1785 (Copy_relocs::add_copy_reloc): Remove.
1786 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1787 section.
1788 (Copy_relocs::make_copy_reloc): New function.
1789 (Copy_relocs::add_copy_reloc): Remove.
1790 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1791 unchanged input files.
1792 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1793 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1794 Reserve BSS space for COPY relocations.
1795 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1796 (Output_section_incremental_inputs::write_info_blocks): Record
1797 whether a symbol is copied from a shared object.
1798 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1799 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1800 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1801 (Incremental_input_entry_reader::get_output_symbol_index): Add
1802 is_copy parameter.
1803 (Incremental_binary::emit_copy_relocs): New function.
1804 (Incremental_binary::do_emit_copy_relocs): New function.
1805 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1806 new data member.
1807 (Sized_incremental_binary::add_copy_reloc): New function.
1808 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1809 (Sized_incremental_binary::Copy_reloc): New struct.
1810 (Sized_incremental_binary::Copy_relocs): New typedef.
1811 (Sized_incremental_binary::copy_relocs_): New data member.
1812 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1813 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1814 * target.h (Sized_target::emit_copy_reloc): New function.
1815 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1816
7cdb37d9
CC
18172011-06-02 Cary Coutant <ccoutant@google.com>
1818
1819 PR gold/12163
1820 * gold/archive.cc (Archive::Archive): Initialize new data member.
1821 (Archive::include_all_members): Return if archive has already been
1822 included.
1823 * gold/archive.h (Archive::include_all_members_): New data member.
1824
cc643b88
NC
18252011-06-02 Nick Clifton <nickc@redhat.com>
1826
1827 * dynobj.h: Fix spelling mistake in comment.
1828 * output.cc: Likewise.
1829
f62a3ca7
DK
18302011-05-31 Doug Kwan <dougkwan@google.com>
1831 Asier Llano
1832
1833 PR gold/12826
cc643b88 1834 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
1835 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1836 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1837 redundant arm_exidx_test.so.
1838 * testsuite/Makefile.in: Regenerate.
1839 (check_SCRIPTS): Add pr12826.sh
1840 (check_DATA): Add pr12826.stdout
1841 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1842 * testsuite/pr12826.sh: New file.
1843 * testsuite/pr12826_1.s: Ditto.
1844 * testsuite/pr12826_1.s: Ditto.
1845
8dbe1edc
ILT
18462011-05-30 Ian Lance Taylor <iant@google.com>
1847
1848 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1849 sections.
1850
c49875be
ILT
18512011-05-29 Ian Lance Taylor <iant@google.com>
1852
1853 PR gold/12804
1854 * testsuite/Makefile.am: Use different file name for two_file_test
1855 temporary file for each incremental test.
1856 * testsuite/Makefile.in: Rebuild.
1857
69d53f7a
ILT
18582011-05-29 Ian Lance Taylor <iant@google.com>
1859
1860 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1861 binary input file is empty.
1862
41d0ab5f
ILT
18632011-05-27 Ian Lance Taylor <iant@google.com>
1864
1865 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1866 (ver_test_9.so): Likewise.
1867 * testsuite/Makefile.in: Rebuild.
1868
89d8a36b
CC
18692011-05-26 Cary Coutant <ccoutant@google.com>
1870
1871 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1872 * incremental.cc (Incremental_inputs::report_input_section): Fix
1873 comment, indentation.
1874 (Incremental_inputs::report_comdat_group): New function.
1875 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1876 of data for incremental input file entry.
1877 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1878 group count, COMDAT group signatures.
1879 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1880 an unchanged input file.
1881 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1882 Initialize new data member.
1883 (Incremental_object_entry::add_comdat_group): New function.
1884 (Incremental_object_entry::get_comdat_group_count): New function.
1885 (Incremental_object_entry::get_comdat_signature_key): New function.
1886 (Incremental_object_entry::groups_): New data member.
1887 (Incremental_inputs::report_comdat_group): New function.
1888 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1889 data for incremental input file entry.
1890 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1891 (Incremental_input_entry_reader::get_input_section): Adjust size of
1892 data for incremental input file entry.
1893 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1894 (Incremental_input_entry_reader::get_comdat_group_signature): New
1895 function.
1896 * object.cc (Sized_relobj::include_section_group): Report kept
1897 COMDAT groups for incremental links.
1898
1706a06f
ILT
18992011-05-24 David Meyer <pdox@google.com>
1900
1901 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1902 with name parameter. Add found_name parameter.
1903 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1904 * dirsearch.h (class Dirsearch): Update declaration.
1905
a10ae760
ILT
19062011-05-24 Ian Lance Taylor <iant@google.com>
1907
1908 * archive.cc (Library_base::should_include_member): Pull in object
1909 from archive if it defines the entry symbol.
1910 * parameters.cc (Parameters::entry): New function.
1911 * parameters.h (class Parameters): Declare entry.
1912 * output.h (class Output_file_header): Remove entry_ field.
1913 * output.cc (Output_file_header::Output_file_header): Remove entry
1914 parameter. Change all callers.
1915 (Output_file_header::entry): Use parameters->entry.
1916 * gold.cc (queue_middle_tasks): Likewise.
1917 * plugin.cc (Plugin_hook::run): Likewise.
1918
aa92d6ed
CC
19192011-05-24 Cary Coutant <ccoutant@google.com>
1920
1921 * gold.cc (queue_initial_tasks): Pass incremental base filename
1922 to Output_file::open_base_file; don't print error message.
1923 * incremental-dump.cc (main): Adjust call to
1924 Output_file::open_for_modification.
1925 * incremental-dump.cc (main): Likewise.
1926 * incremental.cc (Incremental_inputs::report_command_line):
1927 Ignore --incremental-base option when comparing command lines.
1928 Ignore parameter when given as separate argument.
1929 * options.h (class General_options): Add --incremental-base.
1930 * output.cc (Output_file::Output_file):
1931 (Output_file::open_base_file): Add base_name and writable parameters;
1932 read base file into new file; print error message here.
1933 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1934 callers.
1935 * output.h (Output_file::open_for_modification): Rename to...
1936 (Output_file::open_base_file): ...this; add base_name and
1937 writable parameters; adjust all callers.
1938 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1939 callers.
1940 * testsuite/Makefile.am (incremental_test_4): Test
1941 --incremental-base.
1942 * testsuite/Makefile.in: Regenerate.
1943
2eedd706
CC
19442011-05-24 Cary Coutant <ccoutant@google.com>
1945
1946 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1947 incremental_test_4.
1948 * testsuite/Makefile.in: Regenerate.
1949 * testsuite/two_file_test_1_v1.cc: New test source file.
1950 * testsuite/two_file_test_1b_v1.cc: New test source file.
1951 * testsuite/two_file_test_2_v1.cc: New test source file.
1952
0f1c85a6
CC
19532011-05-24 Cary Coutant <ccoutant@google.com>
1954
1955 * dynobj.h (Dynobj::do_dynobj): New function.
1956 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1957 flag and soname for shared objects.
1958 * incremental.cc (Incremental_inputs::report_object): Make
1959 either Incremental_object_entry or Incremental_dynobj_entry; add
1960 soname to string table.
1961 (Incremental_inputs::report_input_section): Add assertion.
1962 (Output_section_incremental_inputs::set_final_data_size): Adjust
1963 type of input file entry for shared libraries; adjust size of
1964 shared library info entry.
1965 (Output_section_incremental_inputs::write_input_files): Write
1966 as_needed flag for shared libraries.
1967 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1968 of input file entry for shared libraries; write soname.
1969 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1970 soname from incremental info.
1971 * incremental.h (enum Incremental_input_flags): Add
1972 INCREMENTAL_INPUT_AS_NEEDED.
1973 (Incremental_input_entry::Incremental_input_entry): Initialize new
1974 data member.
1975 (Incremental_input_entry::set_as_needed): New function.
1976 (Incremental_input_entry::as_needed): New function.
1977 (Incremental_input_entry::do_dynobj_entry): New function.
1978 (Incremental_input_entry::as_needed_): New data member.
1979 (Incremental_object_entry::Incremental_object_entry): Don't check
1980 for shared library.
1981 (Incremental_object_entry::do_type): Likewise.
1982 (class Incremental_dynobj_entry): New class.
1983 (Incremental_input_entry_reader::as_needed): New function.
1984 (Incremental_input_entry_reader::get_soname): New function.
1985 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1986 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1987 size of shared library info entry.
58797674 1988 * layout.cc (Layout::finish_dynamic_section): Don't test for
0f1c85a6
CC
1989 incremental link when adding DT_NEEDED entries.
1990 * object.h (Object::Object): Initialize new data member.
1991 (Object::dynobj): New function.
1992 (Object::set_as_needed): New function.
1993 (Object::as_needed): New function.
1994 (Object::do_dynobj): New function.
1995 (Object::as_needed_): New data member.
1996
6fa2a40b
CC
19972011-05-24 Cary Coutant <ccoutant@google.com>
1998
1999 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2000 info; adjust display of GOT entries.
2001 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2002 vector of input objects; remove file_status_.
2003 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2004 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2005 got_plt reader; call target hooks to reserve GOT entries.
2006 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2007 of input file info header and GOT info entry.
2008 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2009 relocation info.
2010 (Got_plt_view_info::got_descriptor): Remove.
2011 (Got_plt_view_info::sym_index): New data member.
2012 (Got_plt_view_info::input_index): New data member.
2013 (Local_got_offset_visitor::visit): Write input file index.
2014 (Global_got_offset_visitor::visit): Write 0 for input file index.
2015 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2016 with sym_index and input_index.
2017 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2018 incremental info GOT entry; replace got_descriptor with input_index.
2019 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2020 map from input file index to object.
2021 (Sized_relobj_incr::do_layout): Replace direct data member reference
2022 with accessor function.
2023 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2024 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2025 Adjust size of input file info header.
2026 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2027 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2028 (Incremental_input_entry_reader::get_input_section): Adjust size of
2029 input file info header.
2030 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2031 of incremental info GOT entry.
2032 (Incremental_got_plt_reader::get_got_desc): Remove.
2033 (Incremental_got_plt_reader::get_got_symndx): New function.
2034 (Incremental_got_plt_reader::get_got_input_index): New function.
2035 (Sized_incremental_binary::Sized_incremental_binary): Remove
2036 file_status_; add input_objects_.
2037 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2038 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2039 (Sized_incremental_binary::file_is_unchanged): Remove.
2040 (Sized_incremental_binary::set_input_object): New function.
2041 (Sized_incremental_binary::input_object): New function.
2042 (Sized_incremental_binary::file_status_): Remove.
2043 (Sized_incremental_binary::input_objects_): New data member.
2044 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2045 references.
2046 (Sized_relobj_incr::invalid_address): Move to base class.
2047 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2048 class.
2049 (Sized_relobj_incr::do_output_section_offset): Likewise.
2050 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2051 (Sized_relobj_incr::section_offsets_): Likewise.
2052 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2053 function.
2054 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2055 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2056 with accessor function.
2057 (Sized_relobj_file::do_layout): Likewise.
2058 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2059 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2060 (Sized_relobj_file::compute_final_local_value): Replace refs to
2061 section_offsets_ with accessor function.
2062 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2063 * object.h (Relobj::Relobj): Initialize new data members.
2064 (Relobj::add_dyn_reloc): New function.
2065 (Relobj::first_dyn_reloc): New function.
2066 (Relobj::dyn_reloc_count): New function.
2067 (Relobj::first_dyn_reloc_): New data member.
2068 (Relobj::dyn_reloc_count_): New data member.
2069 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2070 references.
2071 (Sized_relobj::Address): New typedef.
2072 (Sized_relobj::invalid_address): Move here from child class.
2073 (Sized_relobj::Sized_relobj): Initialize new data members.
2074 (Sized_relobj::sized_relobj): New function.
2075 (Sized_relobj::is_output_section_offset_invalid): Move here from
2076 child class.
2077 (Sized_relobj::get_output_section_offset): Likewise.
2078 (Sized_relobj::local_has_got_offset): Likewise.
2079 (Sized_relobj::local_got_offset): Likewise.
2080 (Sized_relobj::set_local_got_offset): Likewise.
2081 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2082 (Sized_relobj::clear_got_offsets): New function.
2083 (Sized_relobj::section_offsets): Move here from child class.
2084 (Sized_relobj::do_output_section_offset): Likewise.
2085 (Sized_relobj::do_set_section_offset): Likewise.
2086 (Sized_relobj::Local_got_offsets): Likewise.
2087 (Sized_relobj::local_got_offsets_): Likewise.
2088 (Sized_relobj::section_offsets_): Likewise.
2089 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2090 references.
2091 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2092 class.
2093 (Sized_relobj_file::sized_relobj): New function
2094 (Sized_relobj_file::local_has_got_offset): Move to base class.
2095 (Sized_relobj_file::local_got_offset): Likewise.
2096 (Sized_relobj_file::set_local_got_offset): Likewise.
2097 (Sized_relobj_file::get_output_section_offset): Likewise.
2098 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2099 (Sized_relobj_file::do_output_section_offset): Likewise.
2100 (Sized_relobj_file::do_set_section_offset): Likewise.
2101 (Sized_relobj_file::Local_got_offsets): Likewise.
2102 (Sized_relobj_file::local_got_offsets_): Likewise.
2103 (Sized_relobj_file::section_offsets_): Likewise.
2104 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2105 (all constructors).
2106 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2107 (Output_reloc::get_symbol_index): Likewise.
2108 (Output_reloc::local_section_offset): Likewise.
2109 (Output_reloc::get_address): Likewise.
2110 (Output_reloc::symbol_value): Likewise.
2111 (Output_data_got::reserve_slot): Move to class definition.
2112 (Output_data_got::reserve_local): New function.
2113 (Output_data_got::reserve_slot_for_global): Remove.
2114 (Output_data_got::reserve_global): New function.
2115 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2116 (all constructors, two instantiations).
2117 (Output_reloc::get_relobj): New function (two instantiations).
2118 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2119 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2120 (Output_data_reloc::add_global): Adjust type of relobj.
2121 (Output_data_reloc::add_global_relative): Likewise.
2122 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2123 (Output_data_reloc::add_local): Likewise.
2124 (Output_data_reloc::add_local_relative): Likewise.
2125 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2126 (Output_data_reloc::add_local_section): Likewise.
2127 (Output_data_reloc::add_output_section): Likewise.
2128 (Output_data_reloc::add_absolute): Likewise.
2129 (Output_data_reloc::add_target_specific): Likewise.
2130 (Output_data_got::reserve_slot): Move definition here.
2131 (Output_data_got::reserve_local): New function.
2132 (Output_data_got::reserve_global): New function.
2133 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2134 section_offsets_ with accessor function.
2135 (Sized_relobj_file::write_sections): Likewise.
2136 (Sized_relobj_file::do_relocate_sections): Likewise.
2137 * target.h (Sized_target::reserve_local_got_entry): New function.
2138 (Sized_target::reserve_global_got_entry): New function.
2139 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2140 (Target_x86_64::reserve_global_got_entry): New function.
2141 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2142
4829d394
CC
21432011-05-23 Cary Coutant <ccoutant@google.com>
2144
2145 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2146 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2147 bit when checking got_type.
2148 * incremental.cc (Sized_incremental_binary::setup_readers):
2149 Store symbol table and string table locations; initialize bit vector
2150 of file status flags.
2151 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2152 unchanged files.
2153 (Sized_incremental_binary::do_process_got_plt): New function.
2154 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2155 (Output_section_incremental_inputs::set_final_data_size): Record
2156 file index for each input file.
2157 (Output_section_incremental_inputs::write_got_plt): Store file index
2158 instead of input entry offset for each GOT entry.
2159 * incremental.h
2160 (Incremental_input_entry::Incremental_input_entry): Initialize new
2161 data member.
2162 (Incremental_input_entry::set_offset): Store file index.
2163 (Incremental_input_entry::get_file_index): New function.
2164 (Incremental_input_entry::file_index_): New data member.
2165 (Incremental_binary::process_got_plt): New function.
2166 (Incremental_binary::do_process_got_plt): New function.
2167 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2168 data members.
2169 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2170 (Sized_incremental_binary::set_file_is_unchanged): New function.
2171 (Sized_incremental_binary::file_is_unchanged): New function.
2172 (Sized_incremental_binary::do_process_got_plt): New function.
2173 (Sized_incremental_binary::file_status_): New data member.
2174 (Sized_incremental_binary::main_symtab_loc_): New data member.
2175 (Sized_incremental_binary::main_strtab_loc_): New data member.
2176 * output.cc (Output_data_got::Got_entry::write): Add case
2177 RESERVED_CODE.
2178 (Output_data_got::add_global): Call add_got_entry.
2179 (Output_data_got::add_global_plt): Likewise.
2180 (Output_data_got::add_global_with_rel): Likewise.
2181 (Output_data_got::add_global_with_rela): Likewise.
2182 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2183 (Output_data_got::add_global_pair_with_rela): Likewise.
2184 (Output_data_got::add_local): Call add_got_entry.
2185 (Output_data_got::add_local_plt): Likewise.
2186 (Output_data_got::add_local_with_rel): Likewise.
2187 (Output_data_got::add_local_with_rela): Likewise.
2188 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2189 (Output_data_got::add_local_pair_with_rela): Likewise.
2190 (Output_data_got::reserve_slot): New function.
2191 (Output_data_got::reserve_slot_for_global): New function.
2192 (Output_data_got::add_got_entry): New function.
2193 (Output_data_got::add_got_entry_pair): New function.
2194 (Output_section::add_output_section_data): Edit FIXME.
2195 * output.h
2196 (Output_section_data_build::Output_section_data_build): New
2197 constructor with size parameter.
2198 (Output_data_space::Output_data_space): Likewise.
2199 (Output_data_got::Output_data_got): Initialize new data member; new
2200 constructor with size parameter.
2201 (Output_data_got::add_constant): Call add_got_entry.
2202 (Output_data_got::reserve_slot): New function.
2203 (Output_data_got::reserve_slot_for_global): New function.
2204 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2205 (Output_data_got::add_got_entry): New function.
2206 (Output_data_got::add_got_entry_pair): New function.
2207 (Output_data_got::free_list_): New data member.
2208 * target.h (Sized_target::init_got_plt_for_update): New function.
2209 (Sized_target::register_global_plt_entry): New function.
2210 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2211 Initialize new data member; call init; add constructor with PLT count.
2212 (Output_data_plt_x86_64::init): New function.
2213 (Output_data_plt_x86_64::add_relocation): New function.
2214 (Output_data_plt_x86_64::reserve_slot): New function.
2215 (Output_data_plt_x86_64::free_list_): New data member.
2216 (Target_x86_64::init_got_plt_for_update): New function.
2217 (Target_x86_64::register_global_plt_entry): New function.
2218 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2219 incremental updates.
2220 (Output_data_plt_x86_64::add_relocation): New function.
2221 * testsuite/object_unittest.cc (Object_test): Set default options.
2222
ec69d6da
ILT
22232011-05-16 Ian Lance Taylor <iant@google.com>
2224
2225 * options.h (class General_options): Make -i a synonym for -r.
2226
732e31de
ILT
22272011-05-16 Ian Lance Taylor <iant@google.com>
2228
2229 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2230
403676b5
CC
22312011-05-10 Cary Coutant <ccoutant@google.com>
2232
2233 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2234 strip_all (-s).
2235
5b7b7d6e
ILT
22362011-05-06 Ian Lance Taylor <iant@google.com>
2237
2238 * layout.cc (Layout::layout): If the output section flags change,
2239 update the ordering.
2240
f0f9babf
CC
22412011-04-25 Cary Coutant <ccoutant@google.com>
2242
2243 * incremental-dump.cc (dump_incremental_inputs): Print local
2244 symbol info for each input file.
2245 * incremental.cc
2246 (Output_section_incremental_inputs::set_final_data_size): Add local
2247 symbol info to input file entries in incremental info.
2248 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2249 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2250 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2251 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2252 implementation.
2253 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2254 (Sized_incr_relobj::do_relocate): Write the local symbols.
2255 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2256 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2257 Adjust size of input file header.
2258 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2259 (Incremental_inputs_reader::get_local_symbol_count): New function.
2260 (Incremental_inputs_reader::get_input_section): Adjust size of input
2261 file header.
2262 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2263 (Sized_incr_relobj::This): New typedef.
2264 (Sized_incr_relobj::sym_size): New const data member.
2265 (Sized_incr_relobj::Local_symbol): New struct.
2266 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2267 (Sized_incr_relobj::do_local_symbol_offset): New function.
2268 (Sized_incr_relobj::local_symbol_count_): New data member.
2269 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2270 (Sized_incr_relobj::local_symbol_index_): New data member.
2271 (Sized_incr_relobj::local_symbol_offset_): New data member.
2272 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2273 (Sized_incr_relobj::local_symbols_): New data member.
2274 * object.h (Relobj::output_local_symbol_count): New function.
2275 (Relobj::local_symbol_offset): New function.
2276 (Relobj::do_output_local_symbol_count): New function.
2277 (Relobj::do_local_symbol_offset): New function.
2278 (Sized_relobj::do_output_local_symbol_count): New function.
2279 (Sized_relobj::do_local_symbol_offset): New function.
2280
d0a9ace3
ILT
22812011-04-22 Vladimir Simonov <sv@sw.ru>
2282
2283 * descriptors.cc (set_close_on_exec): New function.
2284 (Descriptors::open): Use set_close_on_exec.
2285 * output.cc (S_ISLNK): Define if not defined.
2286
94a3fc8b
CC
22872011-04-22 Cary Coutant <ccoutant@google.com>
2288
2289 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2290 global symbol map.
2291 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2292 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2293 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2294 relocations.
2295 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2296 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2297 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2298 * incremental.h
2299 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2300 function.
2301 (Incremental_binary::apply_incremental_relocs): New function.
2302 (Incremental_binary::do_apply_incremental_relocs): New function.
2303 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2304 data member.
2305 (Sized_incremental_binary::add_global_symbol): New function.
2306 (Sized_incremental_binary::global_symbol): New function.
2307 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2308 (Sized_incremental_binary::symbol_map_): New data member.
2309 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2310 * target.h (Sized_target::apply_relocation): New function.
2311 * target-reloc.h (apply_relocation): New function.
2312 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2313
c87e4302
DK
23142011-04-22 Doug Kwan <dougkwan@google.com>
2315
2316 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2317 flag of a SHT_ARM_EXIDX section.
2318 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2319 * testsuite/Makefile.in: Regenerate.
2320 * testsuite/arm_exidx_test.s: New file.
2321 * testsuite/arm_exidx_test.sh: Same.
2322
e7782cf6
CC
23232011-04-20 Cary Coutant <ccoutant@google.com>
2324
2325 PR gold/12689
2326 * archive.h (Incremental_archive_entry::Archive_member):
2327 Initialize arg_serial_ (second constructor).
2328
308ecdc7
ILT
23292011-04-17 Ian Lance Taylor <iant@google.com>
2330
2331 * object.cc (Relocate_info::location): Simplify location string.
2332 * errors.cc (Errors::error_at_location): Don't print program
2333 name.
2334 (Errors::warning_at_location): Likewise.
2335 (Errors::undefined_symbol): Likewise.
2336 * testsuite/debug_msg.sh: Update accordingly.
2337
bec5b579
CC
23382011-04-14 Cary Coutant <ccoutant@google.com>
2339
2340 * gold/layout.cc (Layout::symtab_section_offset): New function.
2341 * gold/layout.h (Layout::symtab_section_offset): New function.
2342 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2343
88597d34
ILT
23442011-04-12 Ian Lance Taylor <iant@google.com>
2345
2346 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2347 with MREMAP_MAYMOVE.
2348 * output.h (class Output_file): Add map_is_allocated_ field.
2349 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2350 not available, provide stubs. If mremap is not available, #define
2351 it to gold_mremap.
2352 (MREMAP_MAYMOVE): Define if not defined.
2353 (Output_file::Output_file): Initialize map_is_allocated_.
2354 (Output_file::resize): Check map_is_allocated_.
2355 (Output_file::map_anonymous): If mmap fails, use malloc.
2356 (Output_file::unmap): Don't do anything for an anonymous map.
2357 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2358 is not available, provide stubs.
2359 (File_read::View::~View): Use free rather than delete[].
2360 (File_read::make_view): Use malloc rather than new[]. If mmap
2361 fails, use malloc.
2362 (File_read::find_or_make_view): Use malloc rather than new[].
2363 * gold.h: Remove HAVE_REMAP code.
2364 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2365 exists. Rename mremap to gold_mremap. If mmap is not available
2366 don't do anything.
2367 * configure, config.in: Rebuild.
2368
11e361bc
ILT
23692011-04-11 Ian Lance Taylor <iant@google.com>
2370
2371 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2372 initialize local variable v.
2373
cdc29364
CC
23742011-04-11 Cary Coutant <ccoutant@google.com>
2375
2376 * archive.cc (Archive::include_member): Adjust call to
2377 report_object.
2378 (Add_archive_symbols::run): Track argument serial numbers.
2379 (Lib_group::include_member): Likewise.
2380 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2381 * archive.h (Incremental_archive_entry::Archive_member):
2382 Initialize arg_serial_.
2383 (Archive_member::arg_serial_): New data member.
2384 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2385 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2386 incremental link.
2387 (Sized_dynobj::do_for_all_local_got_entries): New function.
2388 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2389 function.
2390 * fileread.cc (get_mtime): New function.
2391 * fileread.h (get_mtime): New function.
2392 * gold.cc (queue_initial_tasks): Check for incremental update.
2393 (process_incremental_input): New function.
2394 (queue_middle_tasks): Don't force valid target for incremental
2395 update.
2396 * incremental-dump.cc (find_input_containing_global): Adjust
2397 size of symbol info entry.
2398 (dump_incremental_inputs): Dump argument serial number and
2399 in_system_directory flag; bias shndx by 1; print symbol names
2400 when dumping per-file symbol lists; use new symbol info readers.
2401 * incremental.cc
2402 (Output_section_incremental_inputs:update_data_size): New function.
2403 (Sized_incremental_binary::setup_readers): Setup input readers
2404 for each input file; build maps for files added from libraries
2405 and scripts.
2406 (Sized_incremental_binary::check_input_args): New function.
2407 (Sized_incremental_binary::do_check_inputs): Build map of argument
2408 serial numbers to input arguments.
2409 (Sized_incremental_binary::do_file_has_changed): Rename
2410 do_file_is_unchanged to this; compare file modification times.
2411 (Sized_incremental_binary::do_init_layout): New function.
2412 (Sized_incremental_binary::do_reserve_layout): New function.
2413 (Sized_incremental_binary::do_get_input_reader): Remove.
2414 (Sized_incremental_binary::get_symtab_view): New function.
2415 (Incremental_checker::can_incrementally_link_output_file): Remove.
2416 (Incremental_inputs::report_command_line): Exclude --debug options.
2417 (Incremental_inputs::report_archive_begin): Add parameter; track
2418 argument serial numbers; don't put input file entry for archive
2419 before archive members.
2420 (Incremental_inputs::report_archive_end): Put input file entry
2421 for archive after archive members.
2422 (Incremental_inputs::report_object): Add parameter; track argument
2423 serial numbers and in_system_directory flag.
2424 (Incremental_inputs::report_script): Add parameter; track argument
2425 serial numbers.
2426 (Output_section_incremental_inputs::set_final_data_size): Adjust
2427 size of symbol info entry; check for forwarding symbols.
2428 (Output_section_incremental_inputs::write_input_files): Write
2429 in_system_directory flag and argument serial number.
2430 (Output_section_incremental_inputs::write_info_blocks): Map section
2431 indices between incremental info and original input file; store
2432 input section index for each symbol.
2433 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2434 change operator() to visit().
2435 (class Global_got_offset_visitor): Likewise.
2436 (class Global_symbol_visitor_got_plt):
2437 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2438 classes.
2439 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2440 (Sized_incr_relobj::do_read_symbols): New function.
2441 (Sized_incr_relobj::do_layout): New function.
2442 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2443 (Sized_incr_relobj::do_add_symbols): New function.
2444 (Sized_incr_relobj::do_should_include_member): New function.
2445 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2446 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2447 (Sized_incr_relobj::do_section_size): New function.
2448 (Sized_incr_relobj::do_section_name): New function.
2449 (Sized_incr_relobj::do_section_contents): New function.
2450 (Sized_incr_relobj::do_section_flags): New function.
2451 (Sized_incr_relobj::do_section_entsize): New function.
2452 (Sized_incr_relobj::do_section_address): New function.
2453 (Sized_incr_relobj::do_section_type): New function.
2454 (Sized_incr_relobj::do_section_link): New function.
2455 (Sized_incr_relobj::do_section_info): New function.
2456 (Sized_incr_relobj::do_section_addralign): New function.
2457 (Sized_incr_relobj::do_initialize_xindex): New function.
2458 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2459 (Sized_incr_relobj::do_read_relocs): New function.
2460 (Sized_incr_relobj::do_gc_process_relocs): New function.
2461 (Sized_incr_relobj::do_scan_relocs): New function.
2462 (Sized_incr_relobj::do_count_local_symbols): New function.
2463 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2464 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2465 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2466 (Sized_incr_relobj::do_relocate): New function.
2467 (Sized_incr_relobj::do_set_section_offset): New function.
2468 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2469 (Sized_incr_dynobj::do_read_symbols): New function.
2470 (Sized_incr_dynobj::do_layout): New function.
2471 (Sized_incr_dynobj::do_add_symbols): New function.
2472 (Sized_incr_dynobj::do_should_include_member): New function.
2473 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2474 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2475 (Sized_incr_dynobj::do_section_size): New function.
2476 (Sized_incr_dynobj::do_section_name): New function.
2477 (Sized_incr_dynobj::do_section_contents): New function.
2478 (Sized_incr_dynobj::do_section_flags): New function.
2479 (Sized_incr_dynobj::do_section_entsize): New function.
2480 (Sized_incr_dynobj::do_section_address): New function.
2481 (Sized_incr_dynobj::do_section_type): New function.
2482 (Sized_incr_dynobj::do_section_link): New function.
2483 (Sized_incr_dynobj::do_section_info): New function.
2484 (Sized_incr_dynobj::do_section_addralign): New function.
2485 (Sized_incr_dynobj::do_initialize_xindex): New function.
2486 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2487 (make_sized_incremental_object): New function.
2488 (Incremental_library::copy_unused_symbols): New function.
2489 (Incremental_library::do_for_all_unused_symbols): New function.
2490 * incremental.h (enum Incremental_input_flags): New type.
2491 (class Incremental_checker): Remove.
2492 (Incremental_input_entry::Incremental_input_entry): Add argument
2493 serial number.
2494 (Incremental_input_entry::arg_serial): New function.
2495 (Incremental_input_entry::set_is_in_system_directory): New function.
2496 (Incremental_input_entry::is_in_system_directory): New function.
2497 (Incremental_input_entry::arg_serial_): New data member.
2498 (Incremental_input_entry::is_in_system_directory_): New data member.
2499 (class Script_info): Move here from script.h.
2500 (Script_info::Script_info): Add filename parameter.
2501 (Script_info::filename): New function.
2502 (Script_info::filename_): New data member.
2503 (Incremental_script_entry::Incremental_script_entry): Add argument
2504 serial number.
2505 (Incremental_object_entry::Incremental_object_entry): Likewise.
2506 (Incremental_object_entry::add_input_section): Build list of input
2507 sections with map to original shndx.
2508 (Incremental_object_entry::get_input_section_index): New function.
2509 (Incremental_object_entry::shndx_): New data member.
2510 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2511 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2512 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2513 serial number.
2514 (Incremental_inputs::report_archive_begin): Likewise.
2515 (Incremental_inputs::report_object): Likewise.
2516 (Incremental_inputs::report_script): Likewise.
2517 (class Incremental_global_symbol_reader): New class.
2518 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2519 and store flags and input file type.
2520 (Incremental_input_entry_reader::arg_serial): New function.
2521 (Incremental_input_entry_reader::type): Extract type from flags.
2522 (Incremental_input_entry_reader::is_in_system_directory): New function.
2523 (Incremental_input_entry_reader::get_input_section_count): Call
2524 accessor function for type.
2525 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2526 function for type; adjust size of global symbol entry.
2527 (Incremental_input_entry_reader::get_global_symbol_count): Call
2528 accessor function for type.
2529 (Incremental_input_entry_reader::get_object_count): Likewise.
2530 (Incremental_input_entry_reader::get_object_offset): Likewise.
2531 (Incremental_input_entry_reader::get_member_count): Likewise.
2532 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2533 (Incremental_input_entry_reader::get_member_offset): Likewise.
2534 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2535 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2536 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2537 (Incremental_input_entry_reader::get_global_symbol_reader): New
2538 function.
2539 (Incremental_input_entry_reader::get_output_symbol_index): New
2540 function.
2541 (Incremental_input_entry_reader::type_): Remove.
2542 (Incremental_input_entry_reader::flags_): New data member.
2543 (Incremental_inputs_reader::input_file_offset): New function.
2544 (Incremental_inputs_reader::input_file_index): New function.
2545 (Incremental_inputs_reader::input_file): Call input_file_offset.
2546 (Incremental_inputs_reader::input_file_at_offset): New function.
2547 (Incremental_relocs_reader::get_r_type): Reformat.
2548 (Incremental_relocs_reader::get_r_shndx): Reformat.
2549 (Incremental_relocs_reader::get_r_offset): Reformat.
2550 (Incremental_relocs_reader::data): New function.
2551 (Incremental_binary::Incremental_binary): Initialize new data members.
2552 (Incremental_binary::check_inputs): Add cmdline parameter.
2553 (Incremental_binary::file_is_unchanged): Remove.
2554 (Input_reader::arg_serial): New function.
2555 (Input_reader::get_unused_symbol_count): New function.
2556 (Input_reader::get_unused_symbol): New function.
2557 (Input_reader::do_arg_serial): New function.
2558 (Input_reader::do_get_unused_symbol_count): New function.
2559 (Input_reader::do_get_unused_symbol): New function.
2560 (Incremental_binary::input_file_count): New function.
2561 (Incremental_binary::get_input_reader): Change signature to use
2562 index instead of filename.
2563 (Incremental_binary::file_has_changed): New function.
2564 (Incremental_binary::get_input_argument): New function.
2565 (Incremental_binary::get_library): New function.
2566 (Incremental_binary::get_script_info): New function.
2567 (Incremental_binary::init_layout): New function.
2568 (Incremental_binary::reserve_layout): New function.
2569 (Incremental_binary::output_file): New function.
2570 (Incremental_binary::do_check_inputs): New function.
2571 (Incremental_binary::do_file_is_unchanged): Remove.
2572 (Incremental_binary::do_file_has_changed): New function.
2573 (Incremental_binary::do_init_layout): New function.
2574 (Incremental_binary::do_reserve_layout): New function.
2575 (Incremental_binary::do_input_file_count): New function.
2576 (Incremental_binary::do_get_input_reader): Change signature.
2577 (Incremental_binary::input_args_map_): New data member.
2578 (Incremental_binary::library_map_): New data member.
2579 (Incremental_binary::script_map_): New data member.
2580 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2581 new data members.
2582 (Sized_incremental_binary::output_section): New function.
2583 (Sized_incremental_binary::inputs_reader): Add const.
2584 (Sized_incremental_binary::symtab_reader): Add const.
2585 (Sized_incremental_binary::relocs_reader): Add const.
2586 (Sized_incremental_binary::got_plt_reader): Add const.
2587 (Sized_incremental_binary::get_symtab_view): New function.
2588 (Sized_incremental_binary::Inputs_reader): New typedef.
2589 (Sized_incremental_binary::Input_entry_reader): New typedef.
2590 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2591 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2592 (Sized_incremental_binary::do_file_has_changed): New function.
2593 (Sized_incremental_binary::do_init_layout): New function.
2594 (Sized_incremental_binary::do_reserve_layout): New function.
2595 (Sized_input_reader::Inputs_reader): Remove.
2596 (Sized_input_reader::Input_entry_reader): Remove.
2597 (Sized_input_reader::do_arg_serial): New function.
2598 (Sized_input_reader::do_get_unused_symbol_count): New function.
2599 (Sized_input_reader::do_get_unused_symbol): New function.
2600 (Sized_incremental_binary::do_input_file_count): New function.
2601 (Sized_incremental_binary::do_get_input_reader): Change signature;
2602 use index instead of filename.
2603 (Sized_incremental_binary::section_map_): New data member.
2604 (Sized_incremental_binary::input_entry_readers_): New data member.
2605 (class Sized_incr_relobj): New class.
2606 (class Sized_incr_dynobj): New class.
2607 (make_sized_incremental_object): New function.
2608 (class Incremental_library): New class.
2609 * layout.cc (Free_list::num_lists): New static data member.
2610 (Free_list::num_nodes): New static data member.
2611 (Free_list::num_removes): New static data member.
2612 (Free_list::num_remove_visits): New static data member.
2613 (Free_list::num_allocates): New static data member.
2614 (Free_list::num_allocate_visits): New static data member.
2615 (Free_list::init): New function.
2616 (Free_list::remove): New function.
2617 (Free_list::allocate): New function.
2618 (Free_list::dump): New function.
2619 (Free_list::print_stats): New function.
2620 (Layout_task_runner::run): Resize output file for incremental updates.
2621 (Layout::Layout): Initialize new data members.
2622 (Layout::set_incremental_base): New function.
2623 (Layout::init_fixed_output_section): New function.
2624 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2625 incremental updates.
2626 (Layout::create_gold_note): Do not create gold note section for
2627 incremental updates.
2628 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2629 for incremental updates.
2630 (Layout::set_section_offsets): For incremental updates, allocate space
2631 from free list.
2632 (Layout::create_symtab_sections): Layout with offsets relative to
2633 start of section; for incremental updates, allocate space from free
2634 list.
2635 (Layout::create_shdrs): For incremental updates, allocate space from
2636 free list.
2637 (Layout::finish_dynamic_section): For incremental updates, do not
2638 check --as-needed (fixed in subsequent patch).
2639 * layout.h (class Free_list): New class.
2640 (Layout::set_incremental_base): New function.
2641 (Layout::incremental_base): New function.
2642 (Layout::init_fixed_output_section): New function.
2643 (Layout::allocate): New function.
2644 (Layout::incremental_base_): New data member.
2645 (Layout::free_list_): New data member.
2646 * main.cc (main): Print Free_list statistics.
2647 * object.cc (Relobj::finalize_incremental_relocs): Add
2648 clear_counts parameter; clear counts only when clear_counts is set.
2649 (Sized_relobj::Sized_relobj): Initialize new base class.
2650 (Sized_relobj::do_layout): Don't report special sections.
2651 (Sized_relobj::do_for_all_local_got_entries): New function.
2652 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2653 symtab_off to all symbol table offsets.
2654 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2655 * object.h (class Got_offset_list): Move to top of file.
2656 (Object::Object): Allow case where input_file == NULL.
2657 (Object::~Object): Likewise.
2658 (Object::input_file): Assert that input_file != NULL.
2659 (Object::lock): Allow case where input_file == NULL.
2660 (Object::unlock): Likewise.
2661 (Object::is_locked): Likewise.
2662 (Object::token): Likewise.
2663 (Object::release): Likewise.
2664 (Object::is_incremental): New function.
2665 (Object::get_mtime): New function.
2666 (Object::for_all_local_got_entries): New function.
2667 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2668 (Object::set_is_in_system_directory): New function.
2669 (Object::is_in_system_directory): New function.
2670 (Object::do_is_incremental): New function.
2671 (Object::do_get_mtime): New function.
2672 (Object::do_for_all_local_got_entries): New function.
2673 (Object::is_in_system_directory_): New data member.
2674 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2675 (class Sized_relobj_base): New class.
2676 (class Sized_relobj): Derive from Sized_relobj_base.
2677 (class Sized_relobj::Symbols): Redeclare from base class.
2678 (class Sized_relobj::local_got_offset_list): Remove.
2679 (class Sized_relobj::Output_sections): Redeclare from base class.
2680 (class Sized_relobj::do_for_all_local_got_entries): New function.
2681 (class Sized_relobj::write_local_symbols): Add offset parameter.
2682 (class Sized_relobj::local_symbol_offset_): Update comment.
2683 (class Sized_relobj::local_dynsym_offset_): Update comment.
2684 * options.cc (Input_arguments::add_file): Remove const.
2685 * options.h (Input_file_argument::Input_file_argument):
2686 Initialize arg_serial_ (all constructors).
2687 (Input_file_argument::set_arg_serial): New function.
2688 (Input_file_argument::arg_serial): New function.
2689 (Input_file_argument::arg_serial_): New data member.
2690 (Input_arguments::Input_arguments): Initialize file_count_.
2691 (Input_arguments::add_file): Remove const.
2692 (Input_arguments::number_of_input_files): New function.
2693 (Input_arguments::file_count_): New data member.
2694 (Command_line::number_of_input_files): Call
2695 Input_arguments::number_of_input_files.
2696 * output.cc (Output_segment_headers::Output_segment_headers):
2697 Set current size.
2698 (Output_section::Input_section::current_data_size): New function.
2699 (Output_section::Output_section): Initialize new data members.
2700 (Output_section::add_input_section): Don't do merge sections for
2701 an incremental link; allocate space from free list for an
2702 incremental update.
2703 (Output_section::add_output_section_data): Allocate space from
2704 free list for an incremental update.
2705 (Output_section::update_data_size): New function.
2706 (Output_section::set_fixed_layout): New function.
2707 (Output_section::reserve): New function.
2708 (Output_segment::set_section_addresses): Remove const.
2709 (Output_segment::set_section_list_addresses): Remove const; allocate
2710 space from free list for an incremental update.
2711 (Output_segment::set_offset): Adjust size of RELRO segment for an
2712 incremental update.
2713 * output.h (Output_data::current_data_size): Move here from
2714 child classes.
2715 (Output_data::pre_finalize_data_size): New function.
2716 (Output_data::update_data_size): New function.
2717 (Output_section_headers::update_data_size): new function.
2718 (Output_section_data_build::current_data_size): Move to Output_data.
2719 (Output_data_strtab::update_data_size): New function.
2720 (Output_section::current_data_size): Move to Output_data.
2721 (Output_section::set_fixed_layout): New function.
2722 (Output_section::has_fixed_layout): New function.
2723 (Output_section::reserve): New function.
2724 (Output_section::update_data_size): New function.
2725 (Output_section::has_fixed_layout_): New data member.
2726 (Output_section::free_list_): New data member.
2727 (Output_segment::set_section_addresses): Remove const.
2728 (Output_segment::set_section_list_addresses): Remove const.
2729 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2730 New function.
2731 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2732 New function.
2733 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2734 parameter when calling Add_symbols constructor; store argument
2735 serial number for members of a lib group.
2736 (Add_symbols::locks): Allow case where token == NULL.
2737 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2738 (Read_member::~Read_member): New function.
2739 (Read_member::is_runnable): New function.
2740 (Read_member::locks): New function.
2741 (Read_member::run): New function.
2742 (Check_script::~Check_script): New function.
2743 (Check_script::is_runnable): New function.
2744 (Check_script::locks): New function.
2745 (Check_script::run): New function.
2746 (Check_library::~Check_library): New function.
2747 (Check_library::is_runnable): New function.
2748 (Check_library::locks): New function.
2749 (Check_library::run): New function.
2750 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2751 (Add_symbols::library_): New data member.
2752 (class Read_member): New class.
2753 (class Check_script): New class.
2754 (class Check_library): New class.
2755 * reloc.cc (Read_relocs::is_runnable): Allow case where
2756 token == NULL.
2757 (Read_relocs::locks): Likewise.
2758 (Scan_relocs::locks): Likewise.
2759 (Relocate_task::locks): Likewise.
2760 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2761 to clear counters.
2762 (Sized_relobj::incremental_relocs_scan): Fix comment.
2763 (Sized_relobj::do_relocate): Pass output file offset to
2764 write_local_symbols.
2765 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2766 from class declaration.
2767 * script.cc (read_input_script): Allocate Script_info; pass
2768 argument serial number to report_script.
2769 * script.h (class Script_info): Move to incremental.h.
2770 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2771 * symtab.h (Symbol_table::add_from_incrobj): New function.
2772 (Symbol_table::set_file_offset): New function.
2773
b961d0d7
CC
27742011-04-05 Cary Coutant <ccoutant@google.com>
2775
2776 * incremental-dump.cc (dump_incremental_inputs): Change signature
2777 to take a Sized_incremental_binary; change caller. Use readers
2778 in Sized_incremental_binary.
2779 * incremental.cc
2780 (Sized_incremental_binary::find_incremental_inputs_sections):
2781 Rename do_find_incremental_inputs_sections to this.
2782 (Sized_incremental_binary::setup_readers): New function.
2783 (Sized_incremental_binary::do_check_inputs): Check
2784 has_incremental_info_ flag; move setup code to setup_readers;
2785 use input readers.
2786 (Sized_incremental_binary::do_file_is_unchanged): New function.
2787 (Sized_incremental_binary::do_get_input_reader): New function.
2788 * incremental.h (class Incremental_binary): Move to end of file.
2789 (Incremental_binary::file_is_unchanged): New function.
2790 (Incremental_binary::do_file_is_unchanged): New function.
2791 (Incremental_binary::Input_reader): New class.
2792 (Incremental_binary::get_input_reader): New function.
2793 (class Sized_incremental_binary): Move to end of file.
2794 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2795 input section reader classes.
2796 (Sized_incremental_binary::has_incremental_info): New function.
2797 (Sized_incremental_binary::inputs_reader): New function.
2798 (Sized_incremental_binary::symtab_reader): New function.
2799 (Sized_incremental_binary::relocs_reader): New function.
2800 (Sized_incremental_binary::got_plt_reader): New function.
2801 (Sized_incremental_binary::do_file_is_unchanged): New function.
2802 (Sized_incremental_binary::Sized_input_reader): New class.
2803 (Sized_incremental_binary::get_input_reader): New function.
2804 (Sized_incremental_binary::find_incremental_inputs_sections):
2805 Rename do_find_incremental_inputs_sections to this.
2806 (Sized_incremental_binary::setup_readers): New function.
2807 (Sized_incremental_binary::has_incremental_info_): New data member.
2808 (Sized_incremental_binary::inputs_reader_): New data member.
2809 (Sized_incremental_binary::symtab_reader_): New data member.
2810 (Sized_incremental_binary::relocs_reader_): New data member.
2811 (Sized_incremental_binary::got_plt_reader_): New data member.
2812 (Sized_incremental_binary::current_input_file_): New data member.
2813
a869183f
PP
28142011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2815
2816 PR gold/12640
2817 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2818 violation.
2819
28202011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
2821
2822 * archive.cc (Archive::include_member): Adjust call to report_object.
2823 (Add_archive_symbols::run): Add script_info to call to
2824 report_archive_begin.
2825 (Lib_group::include_member): Adjust call to report_object.
2826 (Add_lib_group_symbols::run): Adjust call to report_object.
2827 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2828 blocks. Add object count for script input files.
2829 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2830 script_info parameter; change all callers.
2831 (Incremental_inputs::report_object): Add script_info parameter;
2832 change all callers.
2833 (Incremental_inputs::report_script): Store backpointer to
2834 incremental info entry.
2835 (Output_section_incremental_inputs::set_final_data_size): Record
2836 additional information for scripts.
2837 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2838 * incremental.h (Incremental_script_entry::add_object): New function.
2839 (Incremental_script_entry::get_object_count): New function.
2840 (Incremental_script_entry::get_object): New function.
2841 (Incremental_script_entry::objects_): New data member; adjust
2842 constructor.
2843 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2844 (Incremental_inputs::report_object): Add script_info parameter.
2845 (Incremental_inputs_reader::get_object_count): New function.
2846 (Incremental_inputs_reader::get_object_offset): New function.
2847 * options.cc (Input_arguments::add_file): Return reference to
2848 new input argument.
2849 * options.h (Input_argument::set_script_info): New function.
2850 (Input_argument::script_info): New function.
2851 (Input_argument::script_info_): New data member; adjust all
2852 constructors.
2853 (Input_file_group::add_file): Return reference to new input argument.
2854 (Input_file_lib::add_file): Likewise.
2855 (Input_arguments::add_file): Likewise.
2856 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2857 * script.cc (Parser_closure::Parser_closure): Add script_info
2858 parameter; adjust all callers.
2859 (Parser_closure::script_info): New function.
2860 (Parser_closure::script_info_): New data member.
2861 (read_input_script): Report scripts earlier to incremental info.
2862 (script_add_file): Set script_info in Input_argument.
2863 (script_add_library): Likewise.
2864 * script.h (Script_options::Script_info): Rewrite class.
2865
a869183f 28662011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
2867
2868 * archive.cc (Library_base::should_include_member): Move
2869 method here from class Archive.
2870 (Archive::Archive): Initialize base class.
2871 (Archive::should_include_member): Move to base class.
2872 (Archive::do_for_all_unused_symbols): New function.
2873 (Add_archive_symbols::run): Remove redundant access to
2874 incremental_inputs.
2875 (Lib_group::Lib_group): Initialize base class.
2876 (Lib_group::do_filename): New function.
2877 (Lib_group::include_member): Pass pointer to Lib_group to
2878 report_object.
2879 (Lib_group::do_for_all_unused_symbols): New function.
2880 (Add_lib_group_symbols::run): Report archive information for
2881 incremental links.
2882 * archive.h (class Library_base): New base class.
2883 (class Archive): Derive from Library_base.
2884 (Archive::filename): Move to base class.
2885 (Archive::set_incremental_info): Likewise.
2886 (Archive::incremental_info): Likewise.
2887 (Archive::Should_include): Likewise.
2888 (Archive::should_include_member): Likewise.
2889 (Archive::Armap_entry): Remove.
2890 (Archive::Unused_symbol_iterator): Remove.
2891 (Archive::unused_symbols_begin): Remove.
2892 (Archive::unused_symbols_end): Remove.
2893 (Archive::do_filename): New function.
2894 (Archive::do_get_mtime): New function.
2895 (Archive::do_for_all_unused_symbols): New function.
2896 (Archive::task_): Move to base class.
2897 (Archive::incremental_info_): Likewise.
2898 (class Lib_group): Derive from Library_base.
2899 (Lib_group::do_filename): New function.
2900 (Lib_group::do_get_mtime): New function.
2901 (Lib_group::do_for_all_unused_symbols): New function.
2902 (Lib_group::task_): Move to base class.
2903 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2904 function.
2905 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2906 function.
2907 * incremental.cc (Incremental_inputs::report_archive_begin):
2908 Use Library_base; call library's get_mtime; add incremental inputs
2909 entry before members.
2910 (class Unused_symbol_visitor): New class.
2911 (Incremental_inputs::report_archive_end): Use Library_base; use
2912 visitor class to record unused symbols; don't add incremental inputs
2913 entry after members.
2914 (Incremental_inputs::report_object): Use Library_base.
2915 * incremental.h
2916 (Incremental_archive_entry::Incremental_archive_entry): Remove
2917 unused Archive parameter.
2918 (Incremental_inputs::report_archive_begin): Use Library_base.
2919 (Incremental_inputs::report_archive_end): Likewise.
2920 (Incremental_inputs::report_object): Likewise.
2921 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2922 function.
2923 * object.h (Object::for_all_global_symbols): New function.
2924 (Object::do_for_all_global_symbols): New function.
2925 (Sized_relobj::do_for_all_global_symbols): New function.
2926 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2927 function.
2928 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2929 function.
2930
61ab3e40
ILT
29312011-03-27 Ian Lance Taylor <iant@google.com>
2932
2933 * archive.cc (Archive::interpret_header): Return -1 if something
2934 goes wrong. Change callers accordingly.
2935
30e1f9e6
CC
29362011-03-25 Cary Coutant <ccoutant@google.com>
2937
2938 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2939 * testsuite/Makefile.in: Regenerate.
2940
9370ce59 29412011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
9c793f14
RÁE
2942
2943 * plugin.cc (get_view): New.
2944 (Plugin::load): Pass get_view to the plugin.
2945 (Plugin_manager::get_view): New.
2946
9312bb0a
ILT
29472011-03-21 Ian Lance Taylor <iant@google.com>
2948
2949 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 2950 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 2951
7e12ba9e
ST
29522011-03-21 Sriraman Tallam <tmsriram@google.com>
2953
2954 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2955 Change == to -eq.
2956 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2957 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2958 Change == to -eq.
2959 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2960 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2961
fd7a005d
ILT
29622011-03-14 Ian Lance Taylor <iant@google.com>
2963
2964 * script-sections.cc (Sort_output_sections::script_compare):
2965 Rename from is_before, change return type.
2966 (Sort_output_sections::operator()): Adjust accordingly.
2967
ed16fd1b
ILT
29682011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2969
2970 PR gold/12572
2971 * testsuite/odr_violation2.cc: Add comment to make all error line
2972 numbers double digits.
2973 * testsuite/debug_msg.sh: Adjust expected errors.
2974
71ff8986
ILT
29752011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2976
2977 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2978 but mark earlier ones as non-canonical
2979 (offset_to_iterator): Update search target and example
2980 (do_addr2line): Return extra lines in a vector*
2981 (format_file_lineno): Extract from do_addr2line
2982 (one_addr2line): Add vector* out-param
2983 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2984 when a lineno entry appeared last for its instruction
2985 (Dwarf_line_info): Add vector* out-param
2986 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2987 * symtab.cc (Odr_violation_compare): Include the lineno in the
2988 comparison again.
2989 (linenos_from_loc): New. Combine the canonical line for an
2990 address with its other lines.
2991 (True_if_intersect): New. Helper functor to make
2992 std::set_intersection a query.
2993 (detect_odr_violations): Compare sets of lines instead of just
2994 one line for each function. This became less deterministic, but
2995 has fewer false positives.
2996 * symtab.h: Declarations.
2997 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2998 mix an optimized and non-optimized object in the same binary
2999 (odr_violation2.so): Same.
3000 * testsuite/Makefile.in: Regenerate from Makefile.am.
3001 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3002 * testsuite/debug_msg.sh: Update line numbers and add
3003 assertions.
3004 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3005 non-optimized context.
3006 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3007 isn't inlined, and use OdrDerived in an optimized context.
3008 * testsuite/odr_header1.h: Defines OdrDerived, where
3009 optimization will change the
3010 first-instruction-in-the-destructor's file and line number.
3011 * testsuite/odr_header2.h: Defines OdrBase.
3012
a19fefdc
ILT
30132011-03-09 Ian Lance Taylor <iant@google.com>
3014
3015 * fileread.cc (File_read::clear_views): Don't delete the whole
3016 file view.
3017
ecb351e9
ILT
30182011-03-08 Ian Lance Taylor <iant@google.com>
3019
3020 PR gold/12525
3021 * fileread.cc: #include <climits>.
3022 (GOLD_IOV_MAX): Define.
3023 (File_read::read_multiple): Limit number of entries by iov_max.
3024 * fileread.h (class File_read): Always set max_readv_entries to
3025 128.
3026
b821d13c
ILT
30272011-03-07 Ian Lance Taylor <iant@google.com>
3028
3029 PR gold/12525
3030 * options.h (class General_options): Add -dy and -dn.
3031
89243142
CC
30322011-03-02 Cary Coutant <ccoutant@google.com>
3033
3034 * testsuite/script_test_9.t: Add TLS segment.
3035
d0773f31
ILT
30362011-03-02 Simon Baldwin <simonb@google.com>
3037
3038 * configure.ac: Add check for gnu_indirect_function support in
3039 the toolchain building binutils.
3040 * configure: Rebuild.
3041
9370ce59 30422011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
badc8139
RÁE
3043
3044 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3045 plugin only symbols.
3046 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3047 in plugin files as not needed in the symbol table.
3048
4cf7a849
ST
30492011-02-11 Sriraman Tallam <tmsriram@google.com>
3050
3051 * output.cc (Output_section::add_input_section): Delay fill
3052 generation for section ordering.
3053
b578bd7d
ILT
30542011-02-09 Ian Lance Taylor <iant@google.com>
3055
3056 PR gold/12316
3057 * object.h (class Sized_relobj): Remove clear_local_symbols.
3058 * reloc.cc (Sized_relobj::do_relocate): Don't call
3059 clear_local_symbols.
3060
9370ce59 30612011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
84ced98a
RÁE
3062
3063 * plugin.cc (is_visible_from_outside): Return true for symbols
3064 in the -u option.
3065
55382fb7
ILT
30662011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3067
3068 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3069 filename.
3070
4e271fff
ST
30712011-02-02 Sriraman Tallam <tmsriram@google.com>
3072
3073 * icf.h (is_section_foldable_candidate): Change type of parameter
3074 to std::string.
3075 * icf.cc (Icf::find_identical_sections): Change type of local variable
3076 section_name to be std::string.
3077 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3078
d433c3ac
ILT
30792011-01-25 Ian Lance Taylor <iant@google.com>
3080
3081 * script.cc (script_add_extern): Rewrite to use
3082 add_symbol_reference.
3083
880473a6
DK
30842011-01-25 Doug Kwan <dougkwan@google.com>
3085
d433c3ac 3086 * icf.cc (get_section_contents): Always lock section's object.
880473a6 3087
f30f86fa
ILT
30882011-01-24 Ian Lance Taylor <iant@google.com>
3089
3090 * options.h (class General_options): Accept
3091 --no-detect-odr-violations.
3092
8e51a0b9
ILT
30932011-01-24 Ian Lance Taylor <iant@google.com>
3094
3095 * version.cc (version_string): Bump to 1.11.
3096
0f3b89d8
ILT
30972011-01-24 Ian Lance Taylor <iant@google.com>
3098
3099 * plugin.cc (class Plugin_rescan): Define new class.
3100 (Plugin_manager::claim_file): Set any_claimed_.
3101 (Plugin_manager::save_archive): New function.
3102 (Plugin_manager::save_input_group): New function.
3103 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3104 necessary.
3105 (Plugin_manager::new_undefined_symbol): New function.
3106 (Plugin_manager::rescan): New function.
3107 (Plugin_manager::rescannable_defines): New function.
3108 (Plugin_manager::add_input_file): Set any_added_.
3109 * plugin.h (class Plugin_manager): define new fields rescannable_,
3110 undefined_symbols_, any_claimed_, and any_added_. Declare
3111 Plugin_rescan as friend. Declare new functions.
3112 (Plugin_manager::Rescannable): Define type.
3113 (Plugin_manager::Rescannable_list): Define type.
3114 (Plugin_manager::Undefined_symbol_list): Define type.
3115 (Plugin_manager::Plugin_manager): Initialize new fields.
3116 * archive.cc (Archive::defines_symbol): New function.
3117 (Add_archive_symbols::run): Pass archive to plugins if any.
3118 * archive.h (class Archive): Declare defines_symbol.
3119 * readsyms.cc (Input_group::~Input_group): New function.
3120 (Finish_group::run): Pass input_group to plugins if any.
3121 * readsyms.h (class Input_group): Declare destructor.
3122 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3123 any.
3124
3bb951e5
ILT
31252011-01-10 Ian Lance Taylor <iant@google.com>
3126
3127 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3128 section as relro.
3129 (Layout::set_segment_offsets): Reset increase_relro before calling
3130 set_section_addresses a second time.
3131
0aa45fac
CC
31322011-01-04 Cary Coutant <ccoutant@google.com>
3133
3134 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3135 sections before NOBITS sections.
3136
0db46eb4
L
31372011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3138
3139 * version.cc (print_version): Update copyright to 2011.
3140
829c9745
CC
31412010-12-23 Cary Coutant <ccoutant@google.com>
3142
3143 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3144 of OS to this->add. Add OD parameter to second form of the function.
3145
7500420b
ILT
31462010-12-20 Ian Lance Taylor <iant@google.com>
3147
3148 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3149 second of two consecutive entries with same offset.
3150
f8e9a930
RW
31512010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3152
3153 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3154 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3155 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3156 to avoid unneeded links against $(LDADD).
3157 * testsuite/Makefile.in: Regenerate.
3158
2fbb4320
ILT
31592010-12-15 Ian Lance Taylor <iant@google.com>
3160
3161 PR gold/12324
3162 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3163 for R_X86_64_32 and R_X86_64_PC32.
3164 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3165 ver_matching_def_pic.o.
3166 (ver_matching_def_pic.o): New target.
3167
fedb228d
RW
31682010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3169
3170 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3171 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3172 Move definition before File_read::View member definitions.
3173 (File_read::View::~View): Initialize and hold lock before
3174 updating current_mapped_bytes.
3175
9b547ce6
RW
31762010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3177
3178 * dwarf_reader.cc: Remove outdated comment.
3179 * gold-threads.cc: Fix typo in error message.
3180 * archive.cc: Fix typos in comments.
3181 * archive.h: Likewise.
3182 * arm-reloc-property.cc: Likewise.
3183 * arm-reloc-property.h: Likewise.
3184 * arm-reloc.def: Likewise.
3185 * arm.cc: Likewise.
3186 * attributes.h: Likewise.
3187 * cref.cc: Likewise.
3188 * ehframe.cc: Likewise.
3189 * fileread.h: Likewise.
3190 * gold.h: Likewise.
3191 * i386.cc: Likewise.
3192 * icf.cc: Likewise.
3193 * incremental.h: Likewise.
3194 * int_encoding.cc: Likewise.
3195 * layout.h: Likewise.
3196 * main.cc: Likewise.
3197 * merge.h: Likewise.
3198 * object.cc: Likewise.
3199 * object.h: Likewise.
3200 * options.cc: Likewise.
3201 * readsyms.cc: Likewise.
3202 * reduced_debug_output.cc: Likewise.
3203 * reloc.cc: Likewise.
3204 * script-sections.cc: Likewise.
3205 * sparc.cc: Likewise.
3206 * symtab.h: Likewise.
3207 * target-reloc.h: Likewise.
3208 * target.cc: Likewise.
3209 * target.h: Likewise.
3210 * timer.cc: Likewise.
3211 * timer.h: Likewise.
3212 * x86_64.cc: Likewise.
3213
83e17bd5
CC
32142010-12-09 Cary Coutant <ccoutant@google.com>
3215
3216 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3217 stack.
3218 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3219 parameter; change all callers.
3220 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3221 * options.h (warn_execstack): New option.
3222
017257f8
DK
32232010-12-07 Doug Kwan <dougkwan@google.com>
3224
3225 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3226 like function call relocations.
3227
c20cbc06
ILT
32282010-12-07 Ian Lance Taylor <iant@google.com>
3229
3230 * archive.cc (Archive::get_elf_object_for_member): Permit
3231 punconfigured to be NULL.
3232 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3233 (Archive::include_member): Pass NULL to get_elf_object_for_member
3234 if we searched for the archive and this is the first included
3235 object.
3236
4dbfafcc
ILT
32372010-12-01 Ian Lance Taylor <iant@google.com>
3238
3239 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3240 track_relocs_type_ field.
3241 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3242 Set track_relocs_type_.
3243 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3244 contents when using RELA relocs.
3245 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3246 reloc_map_.
3247 * reloc.cc (Track_relocs::next_addend): New function.
3248 * reloc.h (class Track_relocs): Declare next_addend.
3249
e5e19edd
ILT
32502010-12-01 Ian Lance Taylor <iant@google.com>
3251
3252 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3253 virtual destructor.
3254
9a5ce24c
ILT
32552010-12-01 Ian Lance Taylor <iant@google.com>
3256
3257 * README: Update compilers known to work and fail.
3258
c7791212
NC
32592010-11-23 Matthias Klose <doko@ubuntu.com>
3260
3261 * configure.in: For --enable-gold, handle value `default' instead of
3262 `both*'. Always install ld as ld.bfd, install as ld if gold is
3263 not the default.
3264 * configure: Regenerate.
3265
0ad220c9
DK
32662010-11-18 Doug Kwan <dougkwan@google.com>
3267
3268 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3269 and right_alignment to be zero. Store result alignment only if it is
3270 greater than existing alignment.
3271
ab8056e0
CC
32722010-11-16 Cary Coutant <ccoutant@google.com>
3273
3274 PR gold/12220
3275 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3276 Check for ".zdebug_line".
3277
fd064a5b
CC
32782010-11-16 Doug Kwan <dougkwan@google.com>
3279 Cary Coutant <ccoutant@google.com>
3280
3281 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3282 by reference; adjust all callers.
3283 * output.cc (Output_segment::set_section_addresses): Adjust references
3284 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3285 list is empty.
3286 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3287 end at page boundary.
3288
6fc6ea19
CC
32892010-11-16 Cary Coutant <ccoutant@google.com>
3290
3291 PR gold/12220
3292 * layout.cc (Layout::choose_output_section): Transform names of
3293 compressed sections even when using a script with a SECTIONS clause.
3294 (Layout::output_section_name): Remove code to transform
3295 compressed debug section names.
3296 * output.cc (Output_section::add_input_section): Use uncompressed
3297 section size when tracking input sections.
3298
95a2c8d6
RS
32992010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3300
3301 * symtab.h (Symbol::NON_PIC_REF): Remove.
3302 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3303 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3304 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3305 (Symbol::use_plt_offset): Take a flags argument and pass it
3306 directly to needs_dynamic_reloc. Restrict check for undefined
3307 weak symbols to function calls.
3308 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3309 (Target_arm::Scan::global): Use it.
3310 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3311 (Target_arm::Relocate::relocate): Likewise.
3312 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3313 parameter with an r_type parameter. Use get_reference_flags
3314 to get the flags.
3315 (Target_arm::Relocate::relocate): Update accordingly.
3316 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3317 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3318 (Target_i386::Scan::global): Likewise.
3319 (Target_i386::Relocate::relocate): Likewise.
3320 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3321 parameter with an r_type parameter. Use get_reference_flags
3322 to get the flags.
3323 (Target_i386::Relocate::relocate): Update accordingly.
3324 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3325 (Target_powerpc::Scan::global): Use it.
3326 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3327 (Target_powerpc::Relocate::relocate): Likewise.
3328 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3329 (Target_sparc::Scan::global): Use it.
3330 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3331 (Target_sparc::Relocate::relocate): Likewise.
3332 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3333 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3334 (Target_x86_64::Scan::global): Likewise.
3335 (Target_x86_64::Relocate::relocate): Likewise.
3336
f625ae50
DK
33372010-11-08 Doug Kwan <dougkwan@google.com>
3338 Cary Coutant <ccoutant@google.com>
3339
3340 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3341 (Arm_exidx_merge_section::section_contents_): New data member.
3342 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3343 (Arm_input_section::~Arm_input_section): De-allocate memory.
58797674 3344 (Arm_input_section::original_contents_): New data member.
f625ae50
DK
3345 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3346 in parameters instead of calling Object::section_contents without
3347 locking.
3348 (Arm_output_section::group_section): New parameter TASK. Pass it
3349 to callees that need locking objects.
3350 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3351 to lock EXIDX input sections. Fix a formatting issue. Call
3352 Arm_exidx_merged_section::build_contents to create merged section
3353 contents.
3354 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3355 to lock object of stub table owner.
3356 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3357 TEXT_SIZE to initialize data member TEXT_SIZE_.
3358 (Arm_exidx_input_section::addralign): Fix typo in comment.
3359 (Arm_exidx_input_section::text_size): New method.
3360 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3361 that require locking objects. Lock objects before scanning for stubs
3362 and updating local symbols.
3363 (Arm_input_section<big_endian>::init): Copy contents of original
3364 input section.
3365 (Arm_input_section<big_endian>::do_write): Use saved contents of
3366 original input section instead of calling Object::section_contents
3367 without locking.
3368 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3369 size without calling Object::section_size().
3370 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3371 for size. Allocate a buffer for merged EXIDX entries.
3372 (Arm_exidx_merged_section::build_contents): New method.
3373 (Arm_exidx_merged_section::do_write): Move merge section contents
3374 building code to Arm_exidx_merged_section::build_contetns. Write
3375 out contetns in buffer instead of building it on the fly.
3376 (Arm_relobj::make_exidx_input_section): Also pass text section size
3377 to Arm_exidx_input_section constructor.
3378 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3379 (Arm_dynobj::do_read_symbols): Fix memory leak.
3380 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3381 * target.h: (class Task): Add forward declaration.
3382 (Target::relax): Add new parameter TASK and pass it to
3383 Target::do_relax().
3384 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3385
5f9bcf58
CC
33862010-11-05 Cary Coutant <ccoutant@google.com>
3387
3388 PR gold/10708
3389 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3390 object when reading from the file.
3391 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3392 second layout pass.
3393 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3394 when reading section contents.
3395 (get_section_contents): Likewise.
3396 (icf::find_identical_sections): Likewise.
3397 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3398 object when reading from the file.
3399 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3400 the object when doing deferred section layout.
3401
e597fa08
NC
34022010-11-03 Nick Clifton <nickc@redhat.com>
3403
3404 PR gold/12001
3405 * script.h (class Symbol_assignment: name): New member. Returns
3406 the name of the symbol.
3407 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3408 Returns true if the given symbol name is on the list of
3409 assignments wating to be processed.
3410 * archive.cc (should_incldue_member): If the symbol is undefined,
3411 check to see if it is on the list of symbols pending assignment.
3412
3f9a3278
ILT
34132010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3414
3415 * script-sections.cc (Script_sections::find_memory_region): Check
3416 for a NULL output section pointer.
3417
d06fb4d1
DK
34182010-10-29 Doug Kwan <dougkwan@google.com>
3419
3420 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3421 Output_section::add_relaxed_input_section.
3422 * output.cc (Output_section::add_relaxed_input_section): Add new
3423 arguments LAYOUT and NAME. Set section order index.
3424 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3425 Copy section order index.
3426 * output.h (Output_section::add_relaxed_input_section): Add new
3427 arguments LAYOUT and NAME.
3428
90e24de5
ILT
34292010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3430
3431 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3432 NATIVE_OR_CROSS_LINKER.
3433 * testsuite/Makefile.in: Regenerate.
3434
c9484ea5
DK
34352010-10-20 Doug Kwan <dougkwan@google.com>
3436
3437 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3438 without SHF_LINK_ORDER flags.
3439 * layout.cc (Layout::choose_output_section): Do not filter
3440 SHF_LINK_ORDER flag in a relocatable link.
3441
5bc2f5be
CC
34422010-10-17 Cary Coutant <ccoutant@google.com>
3443
3444 * output.h (Output_segment::set_section_addresses): Change function
3445 signature. Update all callers.
3446 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3447 sections.
3448 (Output_segment::set_section_addresses): Align after last TLS
3449 section. Add padding before last relro section instead of after.
3450
0c91cf04
DK
34512010-10-17 Doug Kwan <dougkwan@google.com>
3452
3453 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3454 GOT output section to be writable.
3455
8c21d9d3
CC
34562010-10-14 Cary Coutant <ccoutant@google.com>
3457
3458 * debug.h (DEBUG_INCREMENTAL): New flag.
3459 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3460 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3461 mode.
3462 * incremental.cc (report_command_line): Ignore all forms of
3463 --incremental.
3464 * layout.cc (Layout::Layout): Check parameters for incremental link
3465 mode.
3466 * options.cc (General_options::parse_incremental): New function.
3467 (General_options::parse_no_incremental): New function.
3468 (General_options::parse_incremental_full): New function.
3469 (General_options::parse_incremental_update): New function.
3470 (General_options::incremental_mode_): New data member.
3471 (General_options::finalize): Check incremental_mode_.
3472 * options.h (General_options): Update help text for --incremental.
3473 Add --no-incremental, --incremental-full, --incremental-update.
3474 (General_options::Incremental_mode): New enum type.
3475 (General_options::incremental_mode): New function.
3476 (General_options::incremental_mode_): New data member.
3477 * parameters.cc (Parameters::incremental_mode_): New data member.
3478 (Parameters::set_options): Set incremental_mode_.
3479 (Parameters::set_incremental_full): New function.
3480 (Parameters::incremental): New function.
3481 (Parameters::incremental_update): New function.
3482 (set_parameters_incremental_full): New function.
3483 * parameters.h (Parameters::set_incremental_full): New function.
3484 (Parameters::incremental): New function.
3485 (Parameters::incremental_update): New function.
3486 (Parameters::incremental_mode_): New data member.
3487 (set_parameters_incremental_full): New function.
3488 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3489 incremental link mode.
3490 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3491 (Sized_relobj::do_relocate_sections): Likewise.
3492 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3493 option.
3494 * testsuite/Makefile.in: Regenerate.
3495 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3496
bb32aa18 34972010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
3498
3499 * script-sections.h (class Script_sections): Make
3500 Sections_elements typedef public.
3501 * script-sections.cc (class Sort_output_sections): Add elements_
3502 field. Add constructor which sets it; change all callers.
3503 (Sort_output_sections::is_before): New function.
3504 (Sort_output_sections::operator()): Call is_before.
3505 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3506 conditional.
3507 * testsuite/script_test_10.sh: New test. Test script section
3508 order.
3509 * testsuite/script_test_10.t: Likewise.
3510 * testsuite/script_test_10.s: Likewise.
3511 * testsuite/Makefile.am: Wrap the cross linker tests and the
3512 common tests into NATIVE_OR_CROSS_LINKER.
3513 (check_SCRIPTS): Add script_test_10.sh.
3514 (check_DATA): Add script_test_10.stdout.
3515 (script_test_10.o, script_test_10): New targets.
3516 (script_test_10.stdout): New target.
3517 * configure, testsuite/Makefile.in: Regenerate.
3518
3cef7179
ILT
35192010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3520
3521 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3522 error for the deprecated relocations.
3523 (Target_arm::Scan::global): Likewise.
3524 (Target_arm::Relocate::relocate): Likewise.
3525
7411e9a8
RS
35262010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3527
3528 * fileread.cc (Input_file::find_file): Initialize *found_name
3529 and *namep when using the fallback search for case 4.
3530
6a9da32a
CC
35312010-10-11 Cary Coutant <ccoutant@google.com>
3532
3533 * options.h (class General_options): Redefine -z lazy as an alias for
3534 the negation of -z now.
3535
ac897c20
ILT
35362010-10-11 Ian Lance Taylor <iant@google.com>
3537
3538 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3539 binding.
3540
ea5cae92
NC
35412010-10-06 Nick Clifton <nickc@redhat.com>
3542
3543 * script-sections.cc(class Memory_region): Remove
3544 current_lma_offset_ field. Rename current_vma_offset_ to
3545 current_offset_. Add last_section_ field.
3546 (Memory_region::get_current_vma_address): Rename to
3547 get_current_address.
3548 (Memory_region::get_current_lma_address): Delete.
3549 (Memory_region::increment_vma_offset): Rename to
3550 increment_offset.
3551 (Memory_region::increment_lma_offset): Delete.
3552 (Memory_region::attributes_compatible): New method. Returns
3553 true if the provided section is compatible with the region.
3554 (Memory_region::get_last_section): New method. Returns the last
3555 section to use the region.
3556 (Memory_region::set_last_section): New method. Stores the last
3557 section to use the region.
3558 (Script_sections::block_in_region): New method. Returns true if
3559 a block of memory is contained within a region.
3560 (Script_sections::find_memory_region): New method. Locates a
3561 memory region to be used to set a VMA or LMA address.
3562 (Output_section_definition::set_section_addresses): Add code to
3563 check for addresses set by memory regions.
3564 (Output_segment::set_section_addresses): Remove memory region
3565 walking code.
3566 (Script_sections::create_segment): Add a warning if a header
3567 segment is created outside of any region.
3568 * script-sections.h (class Script_sections): Add prototypes for
3569 find_memory_region and block_in_region methods.
3570 * testsuite/memory_test.s: Use .long instead of .word.
3571 * testsuite/memory_test.t: Add some more output sections.
3572 * testsuite/memory_test.sh: Update expected output.
3573
a9bfd952
DK
35742010-10-02 Doug Kwan <dougkwan@google.com>
3575
3576 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3577 defintion to symtab.h
3578 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3579 declaration to defintion.
3580
bacff3ab
NC
35812010-10-01 Nick Clifton <nickc@redhat.com>
3582
3583 * expression.cc (eval): Replace dummy argument with NULL.
3584 (eval_maybe_dot): Check for a NULL result section pointer.
3585 (Symbol_expression::value): Likewise.
3586 (Dot_expression::value): Likewise.
3587 (BINARY_EXPRESSION): Likewise.
3588 (Max_expression::value): Likewise.
3589 (Min_expression::value): Likewise.
3590 (Absolute_expression::value): Likewise.
3591 (Addr_expression::value_from_output_section): Likewise.
3592 (Loaddddr_expression::value_from_output_section): Likewise.
3593 (Segment_start_expression::value): Likewise.
3594 * script-sections.cc
3595 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3596 argument with NULL.
3597 (Sections_elememt_dot_assignment::set_section_addresses):
3598 Likewise.
3599 (Output_data_expression::do_write_to_buffer): Likewise.
3600 (Output_section_definition::finalize_symbols): Likewise.
3601 (Output_section_definition::set_section_addresses): Likewise.
3602
f81bc8b5
DK
36032010-09-30 Doug Kwan <dougkwan@google.com>
3604
3605 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3606
c95e9f27
ST
36072010-09-28 Sriraman Tallam <tmsriram@google.com>
3608
3609 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 3610 function.
c95e9f27
ST
3611 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3612 virtual function.
3613 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3614 virtual function.
3615 * icf.cc (get_section_contents): Inline merge sections only when
3616 target allows it.
3617
3cac54d2
RW
36182010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3619
3620 * configure: Regenerate.
3621
2904037a
ILT
36222010-09-17 Ian Lance Taylor <iant@google.com>
3623
3624 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
3625 * testsuite/Makefile.am (memory_test.o): New target.
3626 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3627 memory_test.t.
3628 * testsuite/Makefile.in: Rebuild.
2904037a 3629
bca7fb63
DK
36302010-09-17 Doug Kwan <dougkwan@google.com>
3631
3632 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3633 defintion if relocation uses GOT entries of the symbol.
3634 * testsuite/icf_safe_test.sh: Fix test.
3635 * testsuite/icf_safe_so_test.sh: Fix test.
3636
4ef28648
CC
36372010-09-16 Cary Coutant <ccoutant@google.com>
3638
3639 * script_sections.cc (class Memory_region): Remove "NULL" from
3640 vector initializations.
3641
793990de
CC
36422010-09-15 Cary Coutant <ccoutant@google.com>
3643
3644 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3645 Resolve forwarding symbols.
3646
81e015e2
DK
36472010-09-15 Doug Kwan <dougkwan@google.com>
3648
3649 * gold/testsuite/script_test_3.t: Add ARM special sections.
3650 * gold/testsuite/script_test_4.t: Same.
3651 * gold/testsuite/script_test_5.t: Same.
3652 * gold/testsuite/script_test_6.t: Same.
3653 * gold/testsuite/script_test_7.t: Same.
3654 * gold/testsuite/script_test_7.t: Same.
3655 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3656
36171d64
CC
36572010-09-14 Cary Coutant <ccoutant@google.com>
3658
3659 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3660 (Target_x86_64::Relocate::relocate_tls): Replace check for
3661 saw_tls_block_reloc_ with test for executable section.
3662
d89051bd
CC
36632010-09-12 Cary Coutant <ccoutant@google.com>
3664
3665 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3666 position-independent executables to shared libraries need dynamic
3667 relocations.
3668 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3669 position-independent executables.
3670 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3671 * testsuite/Makefile.in: Regenerate.
3672
fca41f0f
NC
36732010-09-10 Nick Clifton <nickc@redhat.com>
3674
3675 PR gold/11997
3676 * testsuite/memory_test.t: Discard any sections that are not
3677 needed.
3678
6695e4b3
L
36792010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3680
3681 PR gold/11996
3682 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3683 "This::" to work around a bug in gcc 4.2.
3684
3685 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3686
0f72bf6f
RÁE
36872010-09-09 Rafael Espindola <espindola@google.com>
3688
3689 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3690 sections with different PF_X flags in the same segment.
3691 (Layout::find_first_load_seg): Search all segments to find the first
3692 one.
3693 * options.h (rosegment): New.
3694
36952010-09-08 Rafael Espindola <espindola@google.com>
a6577478 3696
05a79166 3697 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 3698
aa98ff75
DK
36992010-09-08 Doug Kwan <dougkwan@google.com>
3700
3701 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3702 (Arm_relobj::do_relocate_sections): Add new parameter for output
3703 file to match the parent.
3704 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3705 of local symbols instead of input values. Update code to track
3706 changes in gold::relocate_section.
3707 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3708 (Sized_relobj::compute_final_local_value_internal): New methods.
3709 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3710 body into private version of Sized_relobj::compute_final_local_value.
3711 Call the inline method.
3712 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3713 merged symbol value if there is one.
3714 (Symbol_value::has_output_value): New method defintiion.
3715 (Sized_relobj::Compute_final_local_value_status): New enum type.
3716 (Sized_relobj::compute_final_local_value): New methods.
3717 (Sized_relobj::compute_final_local_value_internal): New methods.
3718 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3719 and arm_cortex_a8.sh.
3720 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3721 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3722 New tests.
3723 * Makefile.in: Regenerate.
3724 * testsuite/arm_bl_out_of_range.s: Update test.
3725 * testsuite/thumb_bl_out_of_range.s: Ditto.
3726 * testsuite/thumb_blx_out_of_range.s: Ditto.
3727 * testsuite/arm_branch_out_of_range.sh: New file.
3728 * testsuite/arm_cortex_a8.sh: Ditto.
3729 * testsuite/arm_cortex_a8_b.s: Ditto.
3730 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3731 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3732 * testsuite/arm_cortex_a8_bl.s: Ditto.
3733 * testsuite/arm_cortex_a8_blx.s: Ditto.
3734 * testsuite/arm_cortex_a8_local.s: Ditto.
3735 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3736 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3737
05a79166
L
37382010-09-08 Rafael Espindola <espindola@google.com>
3739
3740 * Makefile.am (memory_test.stdout): Run readelf with -W.
3741 * Makefile.in: Regenerate.
3742 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3743 64 bit output.
3744
33dbc701
RÁE
37452010-09-08 Rafael Espindola <espindola@google.com>
3746
3747 * script-sections.cc (Script_sections::add_memory_region): Convert
3748 field precision to int.
3749 * script.cc (script_set_section_region, script_set_section_region):
3750 Convert field precision to int.
3751
731ca54a
RÁE
37522010-09-08 Rafael Espindola <espindola@google.com>
3753
3754 * arm.cc (do_finalize_sections): Create the __exidx_start and
3755 __exdix_end symbols even when the section is missing.
3756
7f8cd844
NC
37572010-09-08 Nick Clifton <nickc@redhat.com>
3758
3759 * README: Remove claim that MEMORY is not supported.
3760 * expression.cc (script_exp_function_origin)
3761 (script_exp_function_length): Move from here to ...
3762 * script.cc: ... here.
3763 (script_set_section_region, script_add_memory)
3764 (script_parse_memory_attr, script_include_directive): New
3765 functions.
3766 * script-sections.cc
3767 (class Memory_region): New class.
3768 (class Output_section_definition): Add set_memory_region,
3769 set_section_vma, set_section_lma and get_section_name methods.
3770 (class Script_Sections): Add add_memory_region,
3771 find_memory_region, find_memory_region_origin,
3772 find_memory_region_length and set_memory_region methods.
3773 Have set_section_addresses method walk the list of set memory
3774 regions.
3775 Extend the print methos to display memory regions.
3776 * script-sections.h: Add prototypes for new methods.
3777 Add enum for MEMORY region attributes.
3778 * yyscript.y: Add support for parsing MEMORY regions.
3779 * script-c.h: Add prototypes for new functions.
3780 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3781 * testsuite/Makefile.in: Regenerate.
3782 * testsuite/memory_test.sh: New script.
3783 * testsuite/memory_test.s: New assembler source file.
3784 * testsuite/memory_test.t: New linker script.
3785
a4649286
DK
37862010-08-27 Doug Kwan <dougkwan@google.com>
3787
3788 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3789 reference override an existing dynamic weak reference.
3790 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3791 * testsuite/Makefile.in: Regenerate.
3792 * testsuite/dyn_weak_ref.sh: New file.
3793 * testsuite/dyn_weak_ref_1.c: Ditto.
3794 * testsuite/dyn_weak_ref_2.c: Ditto.
3795
b56648ad
ILT
37962010-08-27 Ian Lance Taylor <iant@google.com>
3797
3798 * incremental.h (class Incremental_input_entry): Add virtual
3799 destructor.
3800
809313cb
ILT
38012010-08-27 Ian Lance Taylor <iant@google.com>
3802
3803 * testsuite/start_lib_test_3.c: Mark t3 as used.
3804
11e32464
NC
38052010-08-27 Nick Clifton <nickc@redhat.com>
3806
3807 * options.cc (version_script): Fix small typo in previous
3808 whitespace tidyup.
3809
ca09d69a
NC
38102010-08-25 Nick Clifton <nickc@redhat.com>
3811
3812 * archive.cc: Formatting fixes: Remove whitespace between
3813 typename and following asterisk. Remove whitespace between
3814 function name and opening parenthesis.
3815 * archive.h: Likewise.
3816 * arm.cc: Likewise.
3817 * attributes.cc: Likewise.
3818 * attributes.h: Likewise.
3819 * common.cc: Likewise.
3820 * copy-relocs.cc: Likewise.
3821 * dirsearch.h: Likewise.
3822 * dynobj.cc: Likewise.
3823 * ehframe.cc: Likewise.
3824 * ehframe.h: Likewise.
3825 * expression.cc: Likewise.
3826 * fileread.cc: Likewise.
3827 * fileread.h: Likewise.
3828 * gc.h: Likewise.
3829 * gold-threads.cc: Likewise.
3830 * gold.cc: Likewise.
3831 * i386.cc: Likewise.
3832 * icf.h: Likewise.
3833 * incremental-dump.cc: Likewise.
3834 * incremental.cc: Likewise.
3835 * layout.cc: Likewise.
3836 * layout.h: Likewise.
3837 * main.cc: Likewise.
3838 * merge.cc: Likewise.
3839 * merge.h: Likewise.
3840 * object.cc: Likewise.
3841 * object.h: Likewise.
3842 * options.cc: Likewise.
3843 * options.h: Likewise.
3844 * output.cc: Likewise.
3845 * output.h: Likewise.
3846 * plugin.cc: Likewise.
3847 * plugin.h: Likewise.
3848 * powerpc.cc: Likewise.
3849 * reloc.cc: Likewise.
3850 * script-c.h: Likewise.
3851 * script-sections.cc: Likewise.
3852 * script.cc: Likewise.
3853 * stringpool.cc: Likewise.
3854 * symtab.cc: Likewise.
3855 * symtab.h: Likewise.
3856 * target.cc: Likewise.
3857 * timer.cc: Likewise.
3858 * timer.h: Likewise.
3859 * version.cc: Likewise.
3860 * x86_64.cc: Likewise.
3861
b8fa8750
NC
38622010-08-24 Nick Clifton <nickc@redhat.com>
3863
3864 PR 11899
3865 * layout.cc (segment_precedes): Sort segments by their physical
3866 addresses, if they have been set.
3867
9919d93b
CC
38682010-08-23 Cary Coutant <ccoutant@google.com>
3869
3870 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3871 symbols data.
3872 (Lib_group::include_member): Unlock object after deleting its
3873 symbols data.
3874 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3875 the bug fixed here.
3876
97b4be1c
CC
38772010-08-19 Neil Vachharajani <nvachhar@google.com>
3878 Cary Coutant <ccoutant@google.com>
3879
3880 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3881 constructor, and set_blocker.
3882 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3883 readsyms_blocker_.
3884 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3885 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3886 * testsuite/Makefile.am (start_lib_test): New test case.
3887 * testsuite/Makefile.in: Regenerate.
3888 * testsuite/start_lib_test_main.c: New file.
3889 * testsuite/start_lib_test_1.c: New file.
3890 * testsuite/start_lib_test_2.c: New file.
3891 * testsuite/start_lib_test_3.c: New file.
3892
dd0b1884
ILT
38932010-08-19 Ian Lance Taylor <iant@google.com>
3894
3895 * Makefile.in: Rebuild with automake 1.11.1.
3896 * aclocal.m4: Likewise.
3897 * testsuite/Makefile.in: Likewise.
3898
7223e9ca
ILT
38992010-08-19 Ian Lance Taylor <iant@google.com>
3900
3901 PR 10893
3902 * i386.cc (class Output_data_plt_i386): Update declarations.
3903 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3904 local_ifuncs_ fields.
3905 (Target_i386::do_plt_section_for_global): New function.
3906 (Target_i386::do_plt_section_for_local): New function.
3907 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3908 parameter; change all callers. Initialize global_ifuncs_ and
3909 local_ifuncs_. If doing a static link define __rel_iplt_start and
3910 __rel_iplt_end.
3911 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3912 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3913 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3914 symbols.
3915 (Target_i386::make_plt_section): New function, broken out of
3916 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3917 (Target_i386::make_plt_entry): Call make_plt_section.
3918 (Target_i386::make_local_ifunc_plt_entry): New function.
3919 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3920 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3921 R_386_IRELATIVE to switch.
3922 (Target_i386::Scan::global): Likewise.
3923 (Target_i386::Relocate::relocate): Likewise.
3924 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3925 switch.
3926 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3927 (Target_x86_64::do_plt_section_for_global): New function.
3928 (Target_x86_64::do_plt_section_for_local): New function.
3929 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3930 parameter; change all callers. If doing a static link define
3931 __rela_iplt_start and __rela_iplt_end.
3932 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3933 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3934 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3935 to point to .plt.
3936 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3937 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3938 switch.
3939 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3940 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3941 R_X86_64_IRELATIVE to switch.
3942 (Target_x86_64::Scan::global): Likewise.
3943 (Target_x86_64::Relocate::relocate): Likewise.
3944 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3945 switch.
3946 * target.h (class Target): Add plt_section_for_global and
3947 plt_section_for_local functions. Add do_plt_section_for_global
3948 and do_plt_section_for_local virtual functions.
3949 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3950 clarifying comments.
3951 (Symbol::use_plt_offset): Handle IFUNC symbol.
3952 * object.cc (Sized_relobj::Sized_relobj): Initialize
3953 local_plt_offsets_.
3954 (Sized_relobj::local_has_plt_offset): New function.
3955 (Sized_relobj::local_plt_offset): New function.
3956 (Sized_relobj::set_local_plt_offset): New function.
3957 (Sized_relobj::do_count): Handle IFUNC symbol.
3958 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3959 a bit away from input_shndx_ field. Add set_is_func_symbol and
3960 is_ifunc_symbol functions.
3961 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3962 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3963 local_plt_offsets_ field.
3964 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3965 * output.h (class Output_section_data): Add non-const
3966 output_section function.
3967 (class Output_data_got): Update declarations.
3968 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3969 Add use_plt_offset parameter to global and local constructors.
3970 Change all callers. Change local_sym_index_ field to 31 bits.
3971 Change GSYM_CODE and CONSTANT_CODE accordingly.
3972 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3973 doing a static link don't set sh_link field.
3974 (Output_data_got::Got_entry::write): Use PLT offset if
3975 appropriate.
3976 (Output_data_got::add_global_plt): New function.
3977 (Output_data_got::add_local_plt): New function.
3978 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3979 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3980 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3981 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3982 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3983 IFUNC conditional.
3984 * testsuite/ifunc-sel.h: New file.
3985 * testsuite/ifuncmain1.c: New file.
3986 * testsuite/ifuncmain1vis.c: New file.
3987 * testsuite/ifuncmod1.c: New file.
3988 * testsuite/ifuncdep2.c: New file.
3989 * testsuite/ifuncmain2.c: New file.
3990 * testsuite/ifuncmain3.c: New file.
3991 * testsuite/ifuncmod3.c: New file.
3992 * testsuite/ifuncmain4.c: New file.
3993 * testsuite/ifuncmain5.c: New file.
3994 * testsuite/ifuncmod5.c: New file.
3995 * testsuite/ifuncmain6pie.c: New file.
3996 * testsuite/ifuncmod6.c: New file.
3997 * testsuite/ifuncmain7.c: New file.
3998 * configure, testsuite/Makefile.in: Rebuild.
3999
56f75c03
ILT
40002010-08-18 Ian Lance Taylor <iant@google.com>
4001
4002 * incremental.cc
4003 (Output_section_incremental_inputs::write_input_files): Add cast
4004 to avoid signed/unsigned comparison warning.
4005 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4006
55455f89
CC
40072010-08-12 Cary Coutant <ccoutant@google.com>
4008
4009 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4010
e2054bcb
ILT
40112010-08-13 Ian Lance Taylor <iant@google.com>
4012
4013 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4014
74f67560
DK
40152010-08-12 Cary Coutant <ccoutant@google.com>
4016 Doug Kwan <dougkwan@google.com>
4017
4018 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4019 defintion overrides non-weak undef, remember that the original undef
4020 is not weak.
4021 * symtab.cc (Symbol_table::sized_write_global): For undef without
4022 an original weak binding, set binding to global in output.
4023 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4024 * testsuite/Makefile.in: Regenerate.
4025 * testsuite/strong_ref_weak_def.sh: New file.
4026 * testsuite/strong_ref_weak_def_1.c: Ditto.
4027 * testsuite/strong_ref_weak_def_2.c: Ditto.
4028
d1238d12
CC
40292010-08-12 Cary Coutant <ccoutant@google.com>
4030
4031 * testsuite/incremental_test.sh: Rewrite.
4032 * testsuite/incremental_test_1.c: Rewrite.
4033 * testsuite/incremental_test_2.c: Rewrite.
4034
0e70b911
CC
40352010-08-12 Cary Coutant <ccoutant@google.com>
4036
4037 * arm.cc (Target_arm::got_size): Add const.
4038 (Target_arm::got_entry_count): New function.
4039 (Target_arm::plt_entry_count): New function.
4040 (Target_arm::first_plt_entry_offset): New function.
4041 (Target_arm::plt_entry_size): New function.
4042 (Output_data_plt_arm::entry_count): New function.
4043 (Output_data_plt_arm::first_plt_entry_offset): New function.
4044 (Output_data_plt_arm::get_plt_entry_size): New function.
4045 * i386.cc (Target_i386::got_size): Add const.
4046 (Target_i386::got_entry_count): New function.
4047 (Target_i386::plt_entry_count): New function.
4048 (Target_i386::first_plt_entry_offset): New function.
4049 (Target_i386::plt_entry_size): New function.
4050 (Output_data_plt_i386::entry_count): New function.
4051 (Output_data_plt_i386::first_plt_entry_offset): New function.
4052 (Output_data_plt_i386::get_plt_entry_size): New function.
4053 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4054 find_incremental_inputs_sections. Dump incremental_got_plt section.
4055 * incremental.cc: Include target.h.
4056 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4057 parameter. Adjust all callers. Find incremental_got_plt section.
4058 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4059 section.
4060 (Output_section_incremental_inputs::set_final_data_size): Calculate
4061 size of incremental_got_plt section.
4062 (Output_section_incremental_inputs::do_write): Write the
4063 incremental_got_plt section.
4064 (Got_plt_view_info): New struct.
4065 (Local_got_offset_visitor): New class.
4066 (Global_got_offset_visitor): New class.
4067 (Global_symbol_visitor_got_plt): New class.
4068 (Output_section_incremental_inputs::write_got_plt): New function.
4069 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4070 Add parameter. Adjust all callers.
4071 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4072 (Incremental_inputs::got_plt_section): New function.
4073 (Incremental_inputs::got_plt_section_): New data member.
4074 (Incremental_got_plt_reader): New class.
4075 * layout.cc (Layout::create_incremental_info_sections): Add the
4076 incremental_got_plt section.
4077 * object.h (Got_offset_list::get_list): New function.
4078 (Got offset_list::for_all_got_offsets): New function.
4079 (Sized_relobj::local_got_offset_list): New function.
4080 * powerpc.cc (Target_powerpc::got_size): Add const.
4081 (Target_powerpc::got_entry_count): New function.
4082 (Target_powerpc::plt_entry_count): New function.
4083 (Target_powerpc::first_plt_entry_offset): New function.
4084 (Target_powerpc::plt_entry_size): New function.
4085 (Output_data_plt_powerpc::entry_count): New function.
4086 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4087 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4088 * sparc.cc (Target_sparc::got_size): Add const.
4089 (Target_sparc::got_entry_count): New function.
4090 (Target_sparc::plt_entry_count): New function.
4091 (Target_sparc::first_plt_entry_offset): New function.
4092 (Target_sparc::plt_entry_size): New function.
4093 (Output_data_plt_sparc::entry_count): New function.
4094 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4095 (Output_data_plt_sparc::get_plt_entry_size): New function.
4096 * symtab.h (Symbol::got_offset_list): New function.
4097 (Symbol_table::for_all_symbols): New function.
4098 * target.h (Sized_target::got_entry_count): New function.
4099 (Sized_target::plt_entry_count): New function.
4100 (Sized_target::plt_entry_size): New function.
4101 * x86_64.cc (Target_x86_64::got_size): Add const.
4102 (Target_x86_64::got_entry_count): New function.
4103 (Target_x86_64::plt_entry_count): New function.
4104 (Target_x86_64::first_plt_entry_offset): New function.
4105 (Target_x86_64::plt_entry_size): New function.
4106 (Output_data_plt_x86_64::entry_count): New function.
4107 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4108 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4109
09ec0418
CC
41102010-08-12 Cary Coutant <ccoutant@google.com>
4111
4112 * archive.cc: Include incremental.h.
4113 (Archive::Archive): Initialize incremental_info_.
4114 (Archive::include_member): Record archive members in incremental info.
4115 (Add_archive_symbols::run): Record begin and end of an archive in
4116 incremental info.
4117 (Lib_group::include_member): Record objects in incremental info.
4118 * archive.h (Incremental_archive_entry): Forward declaration.
4119 (Archive::set_incremental_info): New member function.
4120 (Archive::incremental_info): New member function.
4121 (Archive::Unused_symbol_iterator): New class.
4122 (Archive::unused_symbols_begin): New member function.
4123 (Archive::unused_symbols_end): New member function.
4124 (Archive::incremental_info_): New data member.
4125 * incremental-dump.cc (find_input_containing_global): New function.
4126 (dump_incremental_inputs): Dump new incremental info sections.
4127 * incremental.cc: Include symtab.h.
4128 (Output_section_incremental_inputs): New class.
4129 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4130 new incremental info sections.
4131 (Sized_incremental_binary::do_check_inputs): Likewise.
4132 (Incremental_inputs::report_archive): Remove.
4133 (Incremental_inputs::report_archive_begin): New function.
4134 (Incremental_inputs::report_archive_end): New function.
4135 (Incremental_inputs::report_object): New function.
4136 (Incremental_inputs::finalize_inputs): Remove.
4137 (Incremental_inputs::report_input_section): New function.
4138 (Incremental_inputs::report_script): Rewrite.
4139 (Incremental_inputs::finalize): Do nothing but finalize string table.
4140 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4141 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4142 (Incremental_inputs::create_data_sections): New function.
4143 (Incremental_inputs::relocs_entsize): New function.
4144 (Output_section_incremental_inputs::set_final_data_size): New function.
4145 (Output_section_incremental_inputs::do_write): New function.
4146 (Output_section_incremental_inputs::write_header): New function.
4147 (Output_section_incremental_inputs::write_input_files): New function.
4148 (Output_section_incremental_inputs::write_info_blocks): New function.
4149 (Output_section_incremental_inputs::write_symtab): New function.
4150 * incremental.h (Incremental_script_entry): Forward declaration.
4151 (Incremental_object_entry): Forward declaration.
4152 (Incremental_archive_entry): Forward declaration.
4153 (Incremental_inputs): Forward declaration.
4154 (Incremental_inputs_header_data): Remove.
4155 (Incremental_inputs_header): Remove.
4156 (Incremental_inputs_header_write): Remove.
4157 (Incremental_inputs_entry_data): Remove.
4158 (Incremental_inputs_entry): Remove.
4159 (Incremental_inputs_entry_write): Remove.
4160 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4161 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4162 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4163 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4164 Likewise.
4165 (Incremental_input_entry): New class.
4166 (Incremental_script_entry): New class.
4167 (Incremental_object_entry): New class.
4168 (Incremental_archive_entry): New class.
4169 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4170 (Incremental_inputs::report_inputs): Remove.
4171 (Incremental_inputs::report_archive): Remove.
4172 (Incremental_inputs::report_archive_begin): New function.
4173 (Incremental_inputs::report_archive_end): New function.
4174 (Incremental_inputs::report_object): Change prototype.
4175 (Incremental_inputs::report_input_section): New function.
4176 (Incremental_inputs::report_script): Change prototype.
4177 (Incremental_inputs::get_reloc_count): New function.
4178 (Incremental_inputs::set_reloc_count): New function.
4179 (Incremental_inputs::create_data_sections): New function.
4180 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4181 (Incremental_inputs::inputs_section): New function.
4182 (Incremental_inputs::symtab_section): New function.
4183 (Incremental_inputs::relocs_section): New function.
4184 (Incremental_inputs::get_stringpool): Add const.
4185 (Incremental_inputs::command_line): Add const.
4186 (Incremental_inputs::inputs): Remove.
4187 (Incremental_inputs::command_line_key): New function.
4188 (Incremental_inputs::input_file_count): New function.
4189 (Incremental_inputs::input_files): New function.
4190 (Incremental_inputs::relocs_entsize): New function.
4191 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4192 (Incremental_inputs::finalize_inputs): Remove.
4193 (Incremental_inputs::Input_info): Remove.
4194 (Incremental_inputs::lock_): Remove.
4195 (Incremental_inputs::inputs_): Change type.
4196 (Incremental_inputs::inputs_map_): Remove.
4197 (Incremental_inputs::current_object_entry_): New data member.
4198 (Incremental_inputs::inputs_section_): New data member.
4199 (Incremental_inputs::symtab_section_): New data member.
4200 (Incremental_inputs::relocs_section_): New data member.
4201 (Incremental_inputs::reloc_count_): New data member.
4202 (Incremental_inputs_reader): New class.
4203 (Incremental_symtab_reader): New class.
4204 (Incremental_relocs_reader): New class.
4205 * layout.cc (Layout::finalize): Move finalization of incremental info
4206 and creation of incremental info sections to follow finalization of
4207 symbol table. Set offsets for postprocessing sections.
4208 (Layout::create_incremental_info_sections): Call
4209 Incremental_inputs::create_data_sections. Add incremental symtab
4210 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4211 sections to layout after input sections.
4212 * layout.h (struct Timespec): Forward declaration.
4213 (Layout::incremental_inputs): Add const.
4214 (Layout::create_incremental_info_sections): Add parameter.
4215 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4216 * object.cc: Include incremental.h.
4217 (Relobj::finalize_incremental_relocs): New function.
4218 (Sized_relobj::do_layout): Record input sections in incremental info.
4219 * object.h (Object::output_section): New function.
4220 (Object::output_section_offset): Moved from Relobj.
4221 (Object::get_incremental_reloc_base): New function.
4222 (Object::get_incremental_reloc_count): New function.
4223 (Object::do_output_section): New function.
4224 (Object::do_output_section_offset): Moved from Relobj.
4225 (Object::do_get_incremental_reloc_base): New function.
4226 (Object::do_get_incremental_reloc_count): New function.
4227 (Object::Object): Initialize new data members.
4228 (Relobj::output_section): Renamed do_output_section and moved to
4229 protected.
4230 (Relobj::output_section_offset): Moved to Object.
4231 (Relobj::do_get_incremental_reloc_base): New function.
4232 (Relobj::do_get_incremental_reloc_count): New function.
4233 (Relobj::allocate_incremental_reloc_counts): New function.
4234 (Relobj::count_incremental_reloc): New function.
4235 (Relobj::finalize_incremental_relocs): New function.
4236 (Relobj::next_incremental_reloc_index): New function.
4237 (Relobj::reloc_counts_): New data member.
4238 (Relobj::reloc_bases_): New data member.
4239 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4240 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4241 (Sized_relobj::incremental_relocs_scan): New function.
4242 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4243 (Sized_relobj::incremental_relocs_write): New function.
4244 (Sized_relobj::incremental_relocs_write_reltype): New function.
4245 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4246 incremental link.
4247 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4248 archives and object files elsewhere.
4249 (Add_symbols::run): Report object files here.
4250 (Finish_group::run): Report end of archive at end of group.
4251 * reloc.cc: Include layout.h, incremental.h.
4252 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4253 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4254 (Sized_relobj::incremental_relocs_scan): New function.
4255 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4256 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4257 (Sized_relobj::incremental_relocs_write): New function.
4258 (Sized_relobj::incremental_relocs_write_reltype): New function.
4259 * script.cc (read_input_script): Rewrite test for incremental link.
4260 Change call to Incremental_inputs::report_script.
4261 * symtab.h (Symbol_table::first_global_index): New function.
4262 (Symbol_table::output_count): New function.
4263
ce0d1972
DK
42642010-08-12 Doug Kwan <dougkwan@google.com>
4265
4266 * arm.cc (Target_arm::merge_object_attributes): Check command line
4267 options --no-wchar-size-warning and --no-enum-size-warning.
4268 * options.h (General_options): Add ld-compatible options
4269 --no-enum-size-warning and --no-wchar-size-warning.
4270
6e5710ce
ILT
42712010-08-04 Ian Lance Taylor <iant@google.com>
4272
4273 * x86_64.cc (Target_x86_64::Scan::local): Use
4274 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4275 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4276 (Target_x86_64::Scan::global): Likewise.
4277 (Target_x86_64::Relocate::relocate): Likewise.
4278 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4279 Likewise.
4280
fef830db
CC
42812010-08-03 Cary Coutant <ccoutant@google.com>
4282
4283 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4284 to reserve space in merged_strings vector. Keep total input size
4285 for stats.
4286 (Output_merge_string::do_print_merge_stats): Print total input size.
4287 * merge.h (Output_merge_string): Add input_size_ field.
4288 * stringpool.cc (Stringpool_template::string_length): Move
4289 implementations out of Stringpool_template class and place in
4290 stringpool.h.
4291 * stringpool.h (string_length): Move out of Stringpool_template.
4292
1e3811b0
ILT
42932010-08-03 Ian Lance Taylor <iant@google.com>
4294
4295 PR 11712
4296 * layout.cc (relaxation_loop_body): If address of load segment is
4297 set, adjust address to include headers if possible.
4298
7af0c620
ILT
42992010-08-03 Ian Lance Taylor <iant@google.com>
4300
4301 * version.cc (version_string): Bump to 1.10.
4302
22f0da72
ILT
43032010-08-03 Ian Lance Taylor <iant@google.com>
4304
4305 PR 11805
4306 * layout.h (enum Output_section_order): Define.
4307 (class Layout): Update declarations.
4308 * layout.cc (Layout::get_output_section): Add order parameter.
4309 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4310 is_first_non_relro parameters. Change all callers.
4311 (Layout::choose_output_section): Likewise.
4312 (Layout::add_output_section_data): Likewise.
4313 (Layout::make_output_section): Likewise. Set order.
4314 (Layout::default_section_order): New function.
4315 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4316 * output.cc (Output_section::Output_section): Initialize order_.
4317 Don't initialize deleted fields.
4318 (Output_segment::Output_segment): Don't initialize deleted
4319 fields.
4320 (Output_segment::add_output_section_to_load): New function
4321 replacing add_output_section. Change all callers to call this or
4322 add_output_section_to_nonload.
4323 (Output_segment::add_output_section_to_nonload): New function.
4324 (Output_segment::remove_output_section): Rewrite.
4325 (Output_segment::add_initial_output_data): Likewise.
4326 (Output_segment::has_any_data_sections): Likewise.
4327 (Output_segment::is_first_section_relro): Likewise.
4328 (Output_segment::maximum_alignment): Likewise.
4329 (Output_segment::has_dynamic_reloc): New function replacing
4330 dynamic_reloc_count. Change all callers.
4331 (Output_segment::has_dynamic_reloc_list): New function replacing
4332 dynamic_reloc_count_list. Change all callers.
4333 (Output_segment::set_section_addresses): Rewrite.
4334 (Output_segment::set_offset): Rewrite.
4335 (Output_segment::find_first_and_last_list): Remove.
4336 (Output_segment::set_tls_offsets): Rewrite.
4337 (Output_segment::first_section_load_address): Likewise.
4338 (Output_segment::output_section_count): Likewise.
4339 (Output_segment::section_with_lowest_load_address): Likewise.
4340 (Output_segment::write_section_headers): Likewise.
4341 (Output_segment::print_sections_to_map): Likewise.
4342 * output.h (class Output_data): Remove dynamic_reloc_count_
4343 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4344 (Output_data::add_dynamic_reloc): Rewrite.
4345 (Output_data::has_dynamic_reloc): New function.
4346 (Output_data::dynamic_reloc_count): Remove.
4347 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4348 is_last_relro_, is_first_non_relro_, is_interp_,
4349 is_dynamic_linker_section_ fields. Add order and set_order
4350 functions. Remove is_relro_local, set_is_relro_local,
4351 is_last_relro, set_is_last_relro, is_first_non_relro,
4352 set_is_first_non_relro functions, is_interp, set_is_interp,
4353 is_dynamic_linker_section, and set_is_dynamic_linker_section
4354 functions.
4355 (class Output_segment): Change Output_data_list from std::list to
4356 std:;vector. Add output_lists_ field. Remove output_data_ and
4357 output_bss_ fields. Update declarations.
4358
3ff2ccb0
ILT
43592010-08-02 Ian Lance Taylor <iant@google.com>
4360
4361 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4362 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4363 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4364
88a4108b
ILT
43652010-08-02 Ian Lance Taylor <iant@google.com>
4366
4367 PR 11855
4368 * script.cc (Script_options::Script_options): Initialize
4369 symbol_definitions_ and symbol_references_.
4370 (Script_options::add_symbol_assignment): Update
4371 symbol_definitions_ and symbol_references_.
4372 (Script_options::add_symbol_reference): New function.
4373 (script_symbol): New function.
4374 * script.h (class Script_options): Add symbol_definitions_ and
4375 symbol_references_ fields.
4376 (Script_options::referenced_const_iterator): New type.
4377 (Script_options::referenced_begin): New function.
4378 (Script_options::referenced_end): New function.
4379 (Script_options::is_referenced): New function.
4380 (Script_options::any_unreferenced): New function.
4381 * script-c.h (script_symbol): Declare.
4382 * yyscript.y (exp): Call script_symbol.
4383 * symtab.cc: Include "script.h".
4384 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4385 Change all callers. Check symbols referenced by scripts.
4386 (Symbol_table::add_undefined_symbols_from_command_line): Add
4387 layout parameter. Change all callers.
4388 (Symbol_table::do_add_undefined_symbols_from_command_line):
4389 Likewise. Break out loop body. Check symbols referenced by
4390 scripts.
4391 (Symbol_table::add_undefined_symbol_from_command_line): New
4392 function broken out of
4393 do_add_undefined_symbols_from_command_line.
4394 * symtab.h (class Symbol_table): Update declarations.
4395 * archive.cc: Include "layout.h".
4396 (Archive::should_include_member): Add layout parameter. Change
4397 all callers. Check for symbol mentioned in expression.
4398 * archive.h (class Archive): Update declaration.
4399 * object.cc (Sized_relobj::do_should_include_member): Add layout
4400 parameter.
4401 * object.h (Object::should_include_member): Add layout parameter.
4402 Change all callers.
4403 (Object::do_should_include_member): Add layout parameter.
4404 (class Sized_relobj): Update declaration.
4405 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4406 parameter.
4407 * dynobj.h (class Sized_dynobj): Update declaration.
4408 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4409 layout parameter.
4410 * plugin.h (class Sized_pluginobj): Update declaration.
4411
5f1ab67a
ILT
44122010-08-02 Ian Lance Taylor <iant@google.com>
4413
4414 PR 11866
4415 * output.cc (Output_segment::set_offset): Search for the first and
4416 last sections rather than assuming that the list is in order.
4417 (Output_segment::find_first_and_last_list): New function.
4418 * output.h (class Output_segment): Update declarations.
4419 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4420 (relro_strip_test_SOURCES): New variable.
4421 (relro_strip_test_DEPENDENCIES): New variable.
4422 (relro_strip_test_LDFLAGS): New variable.
4423 (relro_strip_test_LDADD): New variable.
4424 (relro_strip_test.so): New target.
4425
a8df5856
ILT
44262010-08-02 Ian Lance Taylor <iant@google.com>
4427
4428 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4429 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4430 (Target_i386::got_tlsdesc_section): New function.
4431 (Target_i386::got_section): Create space for GOT entries for
4432 TLSDESC relocations.
4433 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4434 R_386_TLS_GOTDESC.
4435 (Target_i386::Scan::global): Likewise.
4436 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4437 using TLSDESC GOT.
4438 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4439 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4440 (Target_x86_64::got_tlsdesc_section): New function.
4441 (Target_x86_64::got_section): Create space for GOT entries for
4442 TLSDESC relocations.
4443 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4444 R_386_TLS_GOTDESC.
4445 (Target_x86_64::Scan::global): Likewise.
4446 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4447 using TLSDESC GOT.
4448
0c10a0a6
ILT
44492010-08-02 Ian Lance Taylor <iant@google.com>
4450
4451 * testsuite/final_layout.sh: Use dc to convert from hex to
4452 decimal.
4453
41cbeecc
ST
44542010-07-29 Sriraman Tallam <tmsriram@google.com>
4455
4456 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4457 paramter to the call to gold::gc_process_relocs.
4458 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4459 paramter to the call to gold::gc_process_relocs.
4460 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4461 parameter to the call to gold::gc_process_relocs.
4462 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4463 template parameter to the call to gold::gc_process_relocs.
4464 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4465 paramter to the call to gold::gc_process_relocs.
4466 * gc.h (get_embedded_addend_size): New function.
4467 (gc_process_relocs): Save the size of the reloc for use by ICF.
4468 * icf.cc (get_section_contents): Get the addend from the text section
4469 for SHT_REL relocation sections.
4470 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4471 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4472 * int_encoding.h (read_from_pointer): New overloaded function.
4473 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4474 * testsuite/icf_sht_rel_addend_test.sh: New file.
4475 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4476 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4477
6ea55b82
RW
44782010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4479
4480 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4481 * Makefile.in: Regenerate.
4482 * testsuite/Makefile.in: Regenerate.
4483
9691462b
ILT
44842010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4485
4486 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4487 * gold/testsuite/debug_msg.cc: Likewise.
4488 * gold/testsuite/odr_violation1.cc
4489 * gold/testsuite/odr_violation2.cc
4490
76897331
CC
44912010-07-21 Cary Coutant <ccoutant@google.com>
4492
4493 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4494 string, and length fields.
4495 (Output_merge_string::Merged_strings_list): New type.
4496 (Output_merge_string::Merged_strings_lists): New typedef.
4497 (Output_merge_string): Replace merged_strings_ with
4498 merged_strings_lists_.
4499 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4500 Merged_strings_list per input object and section. Don't store pointer
4501 to the string. Don't store length with each merged string entry.
4502 (Output_merge_string::finalize_merged_data): Loop over list of merged
4503 strings lists. Recompute length of each merged string.
4504
78384e8f
CC
45052010-07-15 Cary Coutant <ccoutant@google.com>
4506
4507 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4508 here.
4509
783659f9
ILT
45102010-07-14 Ian Lance Taylor <iant@google.com>
4511
4512 * descriptors.cc (Descriptors::open): Report correct name in error
4513 message.
4514
131687b4
DK
45152010-07-13 Doug Kwan <dougkwan@google.com>
4516
4517 * arm.cc (Arm_input_section::Arm_input_section): For a
4518 SHT_ARM_EXIDX section, always keeps the input sections.
4519 (Arm_input_section::set_exidx_section_link): New method.
4520 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4521 has_errors_ to false.
4522 (Arm_exidx_input_section::has_errors,
4523 Arm_exidx_input_section::set_has_errors): New methods.
4524 (Arm_exidx_input_section::has_errors_): New data member.
4525 (Arm_relobj::get_exidx_shndx_list): New method.
4526 (Arm_output_section::append_text_sections_to_list): Do not skip
4527 section without SHF_EXECINSTR.
4528 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4529 errors.
4530 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4531 section header. Make error messages more verbose. Check for
4532 a non-executable section linked to an EXIDX section.
4533 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4534 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4535 check that there is no deferred EXIDX section if we exit early.
4536 Instead of not making an EXIDX section in case of an error, make one
4537 and set the has_errors flag of it.
4538 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4539 in a relocatable link.
4540 (Target_arm::do_relax): Look for the EXIDX output section instead of
4541 assuming that it is called .ARM.exidx.
4542 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4543 section list. Do not check for SHF_EXECINSTR section flags but
4544 skip any input section with errors.
4545 * output.cc (Output_section::Output_section): Initialize
4546 always_keeps_input_sections_ to false.
4547 (Output_section::add_input_section): Check for
4548 always_keeps_input_sections_.
4549 * output.h (Output_section::always_keeps_input_sections,
4550 Output_section::set_always_keeps_input_sections): New methods.
4551 (Output_section::always_keeps_input_sections): New data member.
4552
69517287
RÁE
45532010-07-13 Rafael Espindola <espindola@google.com>
4554
4555 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4556 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4557
82742395
ILT
45582010-07-13 Philip Herron <herron.philip@googlemail.com>
4559 Ian Lance Taylor <iant@google.com>
4560
4561 * output.h (Output_section_lookup_maps::add_merge_section):
4562 Correct check of whether value was inserted.
4563 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4564 (Output_section_lookup_maps::add_relaxed_input_section):
4565 Likewise.
4566 * arm.cc (Target_arm::got_section): Remove used local os.
4567 * i386.cc (Target_i386::got_section): Likewise.
4568 * x86_64.cc (Target_x86_64::got_section): Likewise.
4569 * sparc.cc (Target_sparc::got_section): Likewise.
4570 (Target_sparc::relocate): Remove unused local have_got_offset.
4571 * powerpc.cc (Target_powerpc::relocate): Likewise.
4572
f2d707b5
ILT
45732010-07-13 Ian Lance Taylor <iant@google.com>
4574
241531d6
ILT
4575 * compressed_output.cc (zlib_decompress): Fix signature in
4576 !HAVE_ZLIB_H case.
4577
f2d707b5
ILT
4578 * archive.cc (Archive::include_member): Unlock an external member
4579 of a thin archive. Don't bother to delete an object we know is
4580 NULL.
4581
a2e47362
CC
45822010-07-12 Cary Coutant <ccoutant@google.com>
4583
4584 * compressed_output.cc (zlib_decompress): New function.
4585 (get_uncompressed_size): New function.
4586 (decompress_input_section): New function.
4587 * compressed_output.h (get_uncompressed_size): New function.
4588 (decompress_input_section): New function.
4589 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4590 Handle compressed debug sections.
4591 * layout.cc (is_compressed_debug_section): New function.
4592 (Layout::output_section_name): Map compressed section names to
4593 canonical names.
4594 * layout.h (is_compressed_debug_section): New function.
4595 (is_debug_info_section): Recognize compressed debug sections.
4596 * merge.cc: Include compressed_output.h.
4597 (Output_merge_data::do_add_input_section): Handle compressed
4598 debug sections.
4599 (Output_merge_string::do_add_input_section): Handle compressed
4600 debug sections.
4601 * object.cc: Include compressed_output.h.
4602 (Sized_relobj::Sized_relobj): Initialize new data members.
4603 (build_compressed_section_map): New function.
4604 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4605 * object.h (Object::section_is_compressed): New method.
4606 (Object::do_section_is_compressed): New method.
4607 (Sized_relobj::Compressed_section_map): New type.
4608 (Sized_relobj::do_section_is_compressed): New method.
4609 (Sized_relobj::compressed_sections_): New data member.
4610 * output.cc (Output_section::add_input_section): Handle compressed
4611 debug sections.
4612 * reloc.cc: Include compressed_output.h.
4613 (Sized_relobj::write_sections): Handle compressed debug sections.
4614
ce279a62
CC
46152010-07-08 Cary Coutant <ccoutant@google.com>
4616
4617 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4618 weak when resolving to a dynamic def.
4619 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4620 for weak undef/dynamic def cases. Adjust callers.
4621 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4622 undef_binding_weak_.
4623 (Symbol_table::sized_write_globals): Adjust symbol binding.
4624 (Symbol_table::sized_write_symbol): Add binding parameter.
4625 * symtab.h (Symbol::set_undef_binding): New method.
4626 (Symbol::is_undef_binding_weak): New method.
4627 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4628 (Symbol_table::should_override): Add new parameter.
4629 (Symbol_table::sized_write_symbol): Add new parameter.
4630
4631 * testsuite/weak_undef_file1.cc: Add new test case.
4632 * testsuite/weak_undef_file2.cc: Fix header comment.
4633 * testsuite/weak_undef_test.cc: Add new test case.
4634
b2286c10
DK
46352010-06-29 Doug Kwan <dougkwan@google.com>
4636
4637 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4638 Initialize USE_SYMBOL_.
4639 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4640 definition.
4641 (Arm_reloc_property::uses_symbol_): New data member declaration.
4642 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4643 uses symbol value and symbol is undefined but not weakly undefined.
4644
4802450a
RÁE
46452010-06-28 Rafael Espindola <espindola@google.com>
4646
4647 * plugin.cc (Plugin::load): Use dlerror.
4648
e5ca47ba
ILT
46492010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4650
4651 * symtab.cc (detect_odr_violations): When reporting an ODR
4652 violation, report an object where the symbol is defined.
4653
8a75a161
DK
46542010-06-25 Doug Kwan <dougkwan@google.com>
4655
4656 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4657 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4658 definition.
4659 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4660 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4661 target hook to detect function points.
4662 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4663 * icf.h (Icf::check_section_for_function_pointers): Change type of
4664 parameter SECTION_NAME to const reference to std::string. Use
4665 target hook to determine if section may have unsafe pointers.
4666 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4667 method definition.
4668
42218b9f
RÁE
46692010-06-21 Rafael Espindola <espindola@google.com>
4670
4671 * fileread.cc (Input_file::find_fie): New
4672 (Input_file::open): Use Input_file::find_fie.
4673 * fileread.h (Input_file::find_fie): New
4674 * plugin.cc (set_extra_library_path): New.
4675 (Plugin::load): Add set_extra_library_path to the transfer vector.
4676 (Plugin_manager::set_extra_library_path): New.
4677 (Plugin_manager::add_input_file): Use the extra search path if set.
4678 (set_extra_library_path(): New.
4679 * plugin.h (Plugin_manager): Add set_extra_library_path and
4680 extra_search_path_.
4681
a0506cca
CC
46822010-06-19 Cary Coutant <ccoutant@google.com>
4683
4684 * layout.cc (gdb_sections): Add .debug_types.
4685 (lines_only_debug_sections): Likewise.
4686
6508b958
RÁE
46872010-06-18 Rafael Espindola <espindola@google.com>
4688
4689 * plugin.cc (add_input_file,add_input_library)
4690 (Plugin_manager::add_input_file): Make filename arguments const.
4691 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4692 const.
4693
3e235302
DK
46942010-06-16 Doug Kwan <dougkwan@google.com>
4695
4696 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4697 .ARM.attributes section if we have not merged any input
4698 attributes sections.
4699
106e8a6c
DK
47002010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4701
4702 * arm.cc: Allow combining objects with no EABI version
4703 information.
4704
91ff43fe
RÁE
47052010-06-15 Rafael Espindola <espindola@google.com>
4706
4707 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4708
68ed838c
ILT
47092010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4710
4711 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4712 (struct iovec): Correct !HAVE_READV definition.
4713
f3a2388f
CC
47142010-06-10 Cary Coutant <ccoutant@google.com>
4715
4716 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4717 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4718 reloc sections.
4719 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4720
4721 PR 11683
4722 * symtab.h (Symbol::is_placeholder): New member function.
4723 * target-reloc.h (relocate_section): Check for placeholder symbols.
4724
4725 * testsuite/Makefile.am (plugin_test_8): New test.
4726 (plugin_test_9): New test.
4727 * testsuite/Makefile.in: Regenerate.
4728
e1df38aa
NC
47292010-06-09 Nick Clifton <nickc@redhat.com>
4730
4731 * yyscript.y (input_list_element): Allow strings prefixed with
4732 the '-' character. Treat these as libraries.
4733 * script.cc (script_add_library): New function. Adds a library
4734 specified by "-l<name>" found in an input script.
4735 * script-c.h: Add prototype for script_add_library.
4736
25bbe950
DK
47372010-06-07 Doug Kwan <dougkwan@google.com>
4738
4739 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4740 Restrict stub-group size to be within long conditional branch
4741 range when working around cortex-A8 erratum.
4742
0f32ea4c
ILT
47432010-06-07 Damien Diederen <dd@crosstwine.com>
4744
4745 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4746 #ifdef typo.
4747
8fe2a369
ST
47482010-06-03 Sriraman Tallam <tmsriram@google.com>
4749
4750 PR gold/11658
4751 * output.cc
4752 (Output_section::Input_section_sort_entry::compare_section_ordering):
4753 Change to return non-zero correctly.
4754 (Output_section::Input_section_sort_section_order_index_compare
4755 ::operator()): Change to fix ambiguity in comparisons.
4756
6e9ba2ca
ST
47572010-06-01 Sriraman Tallam <tmsriram@google.com>
4758
4759 * gold.h (is_wildcard_string): New function.
4760 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4761 (Layout::layout_eh_frame): Ditto.
4762 (Layout::find_section_order_index): New method.
4763 (Layout::read_layout_from_file): New method.
4764 * layout.h (Layout::find_section_order_index): New method.
4765 (Layout::read_layout_from_file): New method.
4766 (Layout::input_section_position_): New private member.
4767 (Layout::input_section_glob_): New private member.
4768 * main.cc (main): Call read_layout_from_file here.
4769 * options.h (--section-ordering-file): New option.
4770 * output.cc (Output_section::input_section_order_specified_): New
4771 member.
4772 (Output_section::Output_section): Initialize new member.
4773 (Output_section::add_input_section): Add new parameter.
4774 Keep input sections when --section-ordering-file is used.
4775 (Output_section::set_final_data_size): Sort input sections when
4776 section ordering file is specified.
4777 (Output_section::Input_section_sort_entry): Add new parameter.
4778 Check sorting type.
4779 (Output_section::Input_section_sort_entry::compare_section_ordering):
4780 New method.
4781 (Output_section::Input_section_sort_compare::operator()): Change to
4782 consider section_order_index.
4783 (Output_section::Input_section_sort_init_fini_compare::operator()):
4784 Change to consider section_order_index.
4785 (Output_section::Input_section_sort_section_order_index_compare
4786 ::operator()): New method.
4787 (Output_section::sort_attached_input_sections): Change to sort
4788 according to section order when specified.
e1df38aa
NC
4789 (Output_section::add_input_section<32, true>): Add new parameter.
4790 (Output_section::add_input_section<64, true>): Add new parameter.
4791 (Output_section::add_input_section<32, false>): Add new parameter.
4792 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
4793 * output.h (Output_section::add_input_section): Add new parameter.
4794 (Output_section::input_section_order_specified): New
4795 method.
4796 (Output_section::set_input_section_order_specified): New method.
4797 (Input_section::Input_section): Initialize section_order_index_.
4798 (Input_section::section_order_index): New method.
4799 (Input_section::set_section_order_index): New method.
4800 (Input_section::section_order_index_): New member.
4801 (Input_section::Input_section_sort_section_order_index_compare): New
4802 struct.
4803 (Output_section::input_section_order_specified_): New member.
4804 * script-sections.cc (is_wildcard_string): Delete and move modified
4805 method to gold.h.
4806 (Output_section_element_input::Output_section_element_input): Modify
4807 call to is_wildcard_string.
4808 (Output_section_element_input::Input_section_pattern
4809 ::Input_section_pattern): Ditto.
4810 (Output_section_element_input::Output_section_element_input): Ditto.
4811 * testsuite/Makefile.am (final_layout): New test case.
4812 * testsuite/Makefile.in: Regenerate.
4813 * testsuite/final_layout.cc: New file.
4814 * testsuite/final_layout.sh: New file.
4815
3537c84b
RÁE
48162010-06-01 Rafael Espindola <espindola@google.com>
4817
4818 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4819
105b6afd
RÁE
48202010-06-01 Rafael Espindola <espindola@google.com>
4821
4822 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4823 visibility of symbols.
4824
29e11421
DK
48252010-05-27 Doug Kwan <dougkwan@google.com>
4826
4827 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4828 from start of output section instead of address for a local symbol
4829 in a merged or relaxed section when doing a relocatable link.
4830
5e0f337e
RÁE
48312010-05-26 Rafael Espindola <espindola@google.com>
4832
4833 PR 11604
4834 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4835 adding sections the garbage collector removed.
4836 * gold/testsuite/Makefile.am: Add test.
4837 * gold/testsuite/Makefile.in: Regenerate.
4838 * gold/testsuite/plugin_test_7.sh: New.
4839 * gold/testsuite/plugin_test_7_1.c: New.
4840 * gold/testsuite/plugin_test_7_2.c: New.
4841
f4187277
RÁE
48422010-05-26 Rafael Espindola <espindola@google.com>
4843
4844 * script-sections.cc (Output_section_definition::set_section_addresses):
4845 Check for --section-start.
4846
5c388529
DK
48472010-05-26 Doug Kwan <dougkwan@google.com>
4848
4849 * arm.cc (Arm_scan_relocatable_relocs): New class.
4850 (Target_arm::relocate_special_relocatable): New method.
4851 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4852 (Arm_relocate_functions::thumb_branch_common): Same.
4853 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4854 instead of Default_scan_relocatable_relocs.
4855 * target-reloc.h (relocate_for_relocatable): Let target handle
4856 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4857 * target.h (Sized_target::relocate_special_relocatable): New method.
4858
bca1c3ae
ILT
48592010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4860
4861 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4862
0439c796
DK
48632010-05-23 Doug Kwan <dougkwan@google.com>
4864
4865 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4866 instead of a cast.
4867 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4868 with a direct branch, not a conditional branch, to a stub.
4869 * merge.cc (Output_merge_base::record_input_section): New method
4870 defintion.
4871 (Output_merge_data::do_add_input_section): Record input section if
4872 keeps-input-sections flag is set.
4873 (Output_merge_string::do_add_input_section): Ditto.
4874 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4875 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4876 INPUT_SECTIONS_.
4877 (Output_merge_base::keeps_input_sections,
4878 Output_merge_base::set_keeps_input_sections,
4879 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4880 method definitions.
4881 (Output_merge_base::Input_sections): New type declaration.
4882 (Output_merge_base::input_sections_begin,
4883 Output_merge_base::input_sections_end,
4884 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4885 (Output_merge_base::bool keeps_input_sections_,
4886 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4887 Output_merge_base::input_sections_): New data members.
4888 (Output_merge_data::do_set_keeps_input_sections): New method
4889 defintion.
4890 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4891 * output.cc (Output_section::Input_section::relobj): Move method
4892 defintion from class declaration to here and handle merge sections.
4893 (Output_section::Input_section::shndx): Ditto.
4894 (Output_section::Output_section): Remove initializations of removed
4895 data members and initialize new data member LOOKUP_MAPS_.
4896 (Output_section::add_input_section): Set keeps-input-sections flag
4897 for a newly created merge output section as appropriate. Adjust code
4898 to use Output_section_lookup_maps class.
4899 (Output_section::add_relaxed_input_section): Adjst code for lookup
4900 maps code refactoring.
4901 (Output_section::add_merge_input_section): Add a new parameter
4902 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4903 class. If adding input section to a newly created merge output
4904 section fails, remove the new merge section.
4905 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 4906 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
4907 (Output_section::find_merge_section): Ditto.
4908 (Output_section::build_lookup_maps): New method defintion.
4909 (Output_section::find_relaxed_input_section): Adjust code to use
4910 Output_section_lookup_maps class.
4911 (Output_section::get_input_sections): Export merge sections. Adjust
4912 code to use Output_section_lookup_maps class.
4913 (Output_section:::add_script_input_section): Adjust code to use
4914 Output_section_lookup_maps class. Update lookup maps for merge
4915 sections also.
4916 (Output_section::discard_states): Use Output_section_lookup_maps.
4917 (Output_section::restore_states): Same.
4918 * output.h (Merge_section_properties): Move class defintion out of
4919 Output_section.
4920 (Output_section_lookup_maps): New class.
4921 (Output_section::Input_section::is_merge_section): New method
4922 defintion.
4923 (Output_section::Input_section::relobj): Move defintion out of class
4924 defintion. Declare method only.
4925 (Output_section::Input_section::shndx): Ditto.
4926 (Output_section::Input_section::output_merge_base): New method defintion.
4927 (Output_section::Input_section::u2_.pomb): New union field.
4928 (Output_section::Merge_section_by_properties_map,
4929 Output_section::Output_section_data_by_input_section_map,
4930 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4931 Remove types.
4932 (Output_section::add_merge_input_section): Add new parameter
4933 KEEPS_INPUT_SECTIONS.
4934 (Output_section::build_lookup_maps): New method declaration.
4935 (Output_section::merge_section_map_,
4936 Output_section::merge_section_by_properties_map_,
4937 Output_section::relaxed_input_section_map_,
4938 Output_section::is_relaxed_input_section_map_valid_): Remove data
4939 members.
4940 (Output_section::lookup_maps_): New data member.
4941
76295588
L
49422010-05-21 Doug Kwan <dougkwan@google.com>
4943
4944 PR gold/11619
4945 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4946 avoid a compilation error.
4947
d103a984
RÁE
49482010-05-19 Rafael Espindola <espindola@google.com>
4949
4950 * script-sections.cc (Output_section_definition::allocate_to_segment):
4951 Update the phdrs_list even when the output section is NULL.
4952 * testsuite/Makefile.am: Add test.
4953 * testsuite/Makefile.in: Regenerate.
4954 * testsuite/script_test_9.cc: New.
4955 * testsuite/script_test_9.sh: New.
4956 * testsuite/script_test_9.t: New.
4957
6625d24e
DK
49582010-05-19 Doug Kwan <dougkwan@google.com>
4959
4960 * arm.cc (Arm_input_section::original_size): New method.
4961 (Arm_input_section::do_addralign): Add a cast.
4962 (Arm_input_section::do_output_offset): Remove static cast.
4963 (Arm_input_section::original_addralign,
4964 Arm_input_section::original_size_): Change type to uint32_t.
4965 (Arm_input_section::init): Add safe casts for section alignment
4966 and size.
4967 (Arm_input_section::set_final_data_size): Do not set address and
4968 offset of stub table.
4969 (Arm_output_section::fix_exidx_coverage): Change use of of
4970 Output_section::Simple_input_section to that of
4971 Output_section::Input_section.
4972 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4973 except for the first pass.
4974 * output.cc (Output_section::get_input_sections): Change type of
4975 input_sections to std::list<Input_section>.
4976 (Output_section::add_script_input_section): Rename from
4977 Output_section::add_simple_input_section. Change type of SIS
4978 parameter from Simple_input_section to Input_section.
4979 * output.h (Output_section::Simple_input_section): Remove class.
4980 (Output_section::Input_section): Change class visibility to public.
4981 (Output_section::Input_section::addralign): Use stored alignments
4982 for special input sections if set.
4983 (Output_section::Input_section::set_addralign): New method.
4984 (Output_section::get_input_sections): Change parameter type from
4985 list of Simple_input_section to list of Input_section.
4986 (Output_section::add_script_input_section): Rename from
4987 Output_section::add_simple_input_section. Change first parameter's
4988 type from Simple_input_section to Input_section and remove the
4989 second and third parameters.
4990 * script-sections.cc (Input_section::Input_section_list): Change
4991 type to list of Output_section::Input_section/
4992 (Input_section_info::Input_section_info): Change parameter type of
4993 INPUT_SECTION to Output_section::Input_section.
4994 (Input_section_info::input_section): Change return type.
4995 (Input_section_info::input_section_): Change type to
4996 Output_section::Input_section.
4997 (Output_section_element_input::set_section_addresses): Adjust code
4998 to use Output_section::Input_section instead of
4999 Output_section::Simple_input_section. Adjust code for renaming
5000 of Output_section::add_simple_input_section.
5001 (Orphan_output_section::set_section_addresses): Ditto.
5002
e1e82ea4
RW
50032010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5004
5005 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5006 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5007
91e75c8a
RÁE
50082010-05-18 Rafael Espindola <espindola@google.com>
5009
5010 * options.cc (General_options::finalize): Handle -nostdlib.
5011 * options.h (nostdlib): New option.
5012 * script.cc (script_add_search_dir): Handle -nostdlib.
5013
da59ad79
DK
50142010-05-12 Doug Kwan <dougkwan@google.com>
5015
5016 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5017 attributes section only if there no attributes section after merging.
5018 (Target_arm::merge_object_attributes): Move value of
e1df38aa 5019 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
5020 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5021 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5022 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5023 and arm_attr_merge_7.stdout.
5024 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5025 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5026 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5027 arm_attr_merge_7b.o): New rules.
5028 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5029 arm_attr_merge_7
5030 * testsuite/Makefile.in: Regenerate.
5031 * testsuite/arm_attr_merge.sh: New file.
5032 * testsuite/arm_attr_merge_[67][ab].s: Same.
5033
3e01a7fd
NC
50342010-05-05 Nick Clifton <nickc@redhat.com>
5035
5036 * po/es.po: Updated Spanish translation.
5037
7ad2014a
L
50382010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5039
5040 * Makefile.am (install-exec-local): Properly install gold as
5041 default cross linker.
5042 * Makefile.in: Regenerated.
5043
4fda8867
NC
50442010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5045 Nick Clifton <nickc@redhat.com>
5046
5047 * configure.ac (install_as_default): Define and set to false
5048 unless --enable-gold or --enable-gold=both/gold has been
5049 specified.
5050 * configure: Regenerate.
5051
5052 * Makefile.am (install-exec-local): Install the executable as
5053 'ld.gold'. If install_as_default is true then also install it as
5054 'ld'.
5055 * Makefile.in: Regenerated.
5056
bd288ea2
ILT
50572010-04-24 Ian Lance Taylor <iant@google.com>
5058
5059 * layout.cc (Layout::layout_reloc): In relocatable link don't
5060 combine reloc sections for grouped sections.
5061
ef38fd8a
ST
50622010-04-23 Sriraman Tallam <tmsriram@google.com>
5063
5064 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5065 sections that are not ordinary to icf.
5066 * icf.cc (get_section_contents): Handle relocation pointing to section
5067 with no object or shndx information.
5068 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5069 * testsuite/Makefile.in: Regenerate.
5070 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5071 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5072
f6973bdc
ILT
50732010-04-22 Ian Lance Taylor <iant@google.com>
5074
5075 * expression.cc (Expression::Expression_eval_info): Add
5076 result_alignment_pointer field.
5077 (Expression::eval_with_dot): Add result_alignment_pointer
5078 parameter. Change all callers.
5079 (Expression::eval_maybe_dot): Likewise.
5080 (class Binary_expression): Add alignment_pointer parameter to
5081 left_value and right_value. Change all callers.
5082 (BINARY_EXPRESSION): Set result alignment.
5083 (class Trinary_expression): Add alignment_pointer parameter to
5084 arg2_value and arg3_value. Change all callers.
5085 (Trinary_cond::value): Set result alignment.
5086 (Max_expression::value, Min_expression::value): Likewise.
5087 (Align_expression::value): Likewise.
5088 * script-sections.cc (class Sections_element): Add dot_alignment
5089 parameter to set_section_addresses virtual function. Update
5090 instantiations.
5091 (class Output_section_element): Likewise.
5092 (Script_sections::create_segments): Add dot_alignment parameter.
5093 Change all callers.
5094 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5095 (Script_sections::set_phdrs_clause_addresses): Likewise.
5096 * script-sections.h: Update declarations.
5097 * script.h: Update declarations.
5098 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5099 min_p_align.
5100 * testsuite/script_test_3.t: Set large alignment.
5101 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5102 segment has expected alignment.
5103
9c9c98a5
NC
51042010-04-22 Nick Clifton <nickc@redhat.com>
5105
5106 * po/gold.pot: Updated by the Translation project.
5107 * po/vi.po: Updated Vietnamese translation.
5108
2253bfba
L
51092010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5110
5111 * testsuite/Makefile.am (check_PROGRAMS): Add
5112 icf_virtual_function_folding_test.
5113 * testsuite/Makefile.in: Regenerated.
5114
85fdf906
AH
51152010-04-15 Andrew Haley <aph@redhat.com>
5116
5117 * options.h (merge_exidx_entries): New option.
5118 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5119 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5120 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5121 (Target_arm::merge_exidx_entries): New function.
5122 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5123 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5124 to Arm_exidx_fixup constructor.
5125 Add new arg, merge_exidx_entries.
5126 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5127 Arm_output_section::fix_exidx_coverage.
5128
ce97fa81
ST
51292010-04-18 Sriraman Tallam <tmsriram@google.com>
5130
5131 * icf.cc (get_section_contents): Check for preemptible functions.
5132 Ignore addend when appropriate.
5133 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5134 section folded.
5135 (add_from_relobj): Check for section folded.
5136 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5137 * symtab.h (should_add_dynsym_entry): Add new parameter.
5138 * target-reloc.h (scan_relocs): Check for section folded.
5139 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5140 Check reloc types for function pointers in shared objects.
5141 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5142 case.
5143 (icf_preemptible_functions_test): New test case.
5144 (icf_string_merge_test): New test case.
5145 * testsuite.Makefile.in: Regenerate.
5146 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5147 bar_glob. Refactor code.
5148 * testsuite/icf_preemptible_functions_test.cc: New file.
5149 * testsuite/icf_preemptible_functions_test.sh: New file.
5150 * testsuite/icf_string_merge_test.cc: New file.
5151 * testsuite/icf_string_merge_test.sh: New file.
5152 * testsuite/icf_virtual_function_folding_test.cc: New file.
5153 * testsuite/icf_virtual_function_folding_test.sh: New file.
5154
04ceb17c
DK
51552010-04-14 Doug Kwan <dougkwan@google.com>
5156
5157 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5158 for local symbol recounting if we remove a section due to ICF.
5159 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5160 there are no regular objects in input.
5161
153e7da4
DK
51622010-04-13 Doug Kwan <dougkwan@google.com>
5163
5164 * arm.cc (Arm_input_section::set_final_data_size): Compute
5165 accurate final data size instead of using current data size.
5166
4dbd9faf
DK
51672010-04-09 Doug Kwan <dougkwan@google.com>
5168
5169 * layout.cc (Layout::choose_output_section): Handle script section
5170 types.
5171 (Layout::make_output_section_for_script): Add section type parameter.
5172 Handle script section types.
5173 * layout.h (Layout::make_output_section_for_script): Add section
5174 type parameter.
5175 * output.cc (Output_section::Output_section): Initialize data member
5176 is_noload_.
5177 (Output_section::do_reset_address_and_file_offset): Do not set address
5178 to 0 if section is a NOLOAD section.
5179 * output.h (Output_section::is_noload): New method.
5180 (Output_section::set_is_noload): Ditto.
5181 (Output_section::is_noload_): New data member.
5182 * script-c.h (Script_section_type): New enum type.
5183 (struct Parser_output_section_header): Add new file section_type.
5184 * script-sections.cc (Sections_element::output_section_name): Add
5185 parameter for returning script section type.
5186 (Output_section_definition::output_section_name): Ditto.
5187 (Output_section_definition::section_type)P; New method.
5188 (Output_section_definiton::script_section_type_name): Ditto.
5189 (Output_section_definition::script_section_type_): New data member.
5190 (Output_section_definition::Output_section_definition): Initialize
5191 data member Output_section_definition::script_section_type_.
5192 (Output_section_definition::create_sections): Pass script section type
5193 to Layout::make_output_section_for_script.
5194 (Output_section_definition::output_section_name): Return script
5195 section type to caller.
5196 (Output_section_definition::set_section_address): Do not advance
5197 dot value and load address if section type is NOLOAD. Set address
5198 of NOLOAD sections regardless of section flags.
5199 (Output_section_definition::print): Print section type if it is
5200 not SCRIPT_SECTION_TYPE_NONE.
5201 (Output_section_definition::section_type): New method.
5202 (Output_section_definition::script_section_type_name): Ditto.
5203 (Script_sections::output_section_name): Add new parameter
5204 PSECTION_TYPE for returning script section type. Pass it to
5205 section elements. Handle discard sections.
5206 (Sort_output_sections::operator()): Handle NOLOAD sections.
5207 * script-sections.h (Script_sections::Section_type): New enum type.
5208 (Script_sections::output_section_name): Add a new parameter for
5209 returning script section type.
5210 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5211 INFO and NOLOAD.
5212 * yyscript.y (union): Add new field SECTION_TYPE.
5213 (COPY, DSECT, INFO, NOLOAD): New tokens.
5214 (opt_address_and_section_type): Change type to output_section_header.
5215 (section_type): New non-terminal
5216 (section_header): Handle section type.
2253bfba 5217 (opt_address_and_section_type): Return section type value.
4dbd9faf 5218
721ea635
L
52192010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5220
5221 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5222 * testsuite/plugin_common_test_2.c (foo): Likewise.
5223
6bf924b0
DK
52242010-04-08 Doug Kwan <dougkwan@google.com>
5225
5226 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5227 Output_merge_data.
5228 * output.cc (Output_section::add_merge_input_section): Simplify
5229 code and return status of Output_merge_base::add_input_section.
e1df38aa 5230 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
5231 returns true.
5232
24af6f92
DK
52332010-04-07 Doug Kwan <dougkwan@google.com>
5234
5235 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5236 if section is marked as containing instructions but has no mapping
5237 symbols.
5238 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5239 correct section index.
5240 (Arm_relobj::find_linked_text_section): Ditto.
5241
00698fc5
CC
52422010-04-07 Cary Coutant <ccoutant@google.com>
5243
5244 * archive.cc (include_member): Destroy Read_symbols_data object before
5245 releasing file.
5246 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5247 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5248 (Read_symbols_data::~Read_symbols_data) New destructor.
5249 (Section_relocs::Section_relocs) New constructor.
5250 (Section_relocs::~Section_relocs) New destructor.
5251 (Read_relocs_data::Read_relocs_data) New constructor.
5252 (Read_relocs_data::~Read_relocs_data) New destructor.
5253 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5254 pointers to NULL after deleting.
5255
7296d933
DK
52562010-04-07 Doug Kwan <dougkwan@google.com>
5257
5258 * arm.cc: Replace "endianity" with "endianness" in comments.
5259 (Arm_exidx_cantunwind): Ditto.
5260 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5261 (Arm_relobj::merge_flags_and_attributes): New method.
5262 (Arm_relobj::merge_flags_and_attributes_): New data member.
5263 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5264 (Arm_relobj::scan_sections_for_stubs): Ditto.
5265 (Arm_relobj::do_read_symbols): Check to see if we really want to
5266 merge processor-specific flags and attributes. Exit early if
5267 an object is empty except for section names and the undefined symbol.
5268 (Target_arm::do_finalize_sections): Move check for ELF format to
5269 Arm_relobj::do_read_symbols. Merge processor specific flags and
5270 attributes from a regular object only when we have determined that
5271 it is aapropriate. Do not create an .ARM.attributes section in
5272 output if there is no regular input object.
5273 (Target_arm::merge_processor_specific_flags): Check
5274 --warn-mismatch before printing any error.
5275 (Target_arm::merge_object_attributes): Ditto.
5276 * gold.cc (queue_middle_tasks): Handle the case in which there is
5277 no regular object in input.
5278 * options.cc (General_options::parse_EB): New method.
5279 (General_options::parse_EL): Same.
5280 (General_options::General_options): Initialize endianness_.
5281 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5282 New options.
5283 (General_options::Endianness): New enum.
5284 (General_options::endianness): New method.
5285 (General_options::endianness_): New data member.
5286 * parameters.cc (Parameters::set_options): Check target endianness.
5287 (Parameters::set_target_once): Ditto.
5288 (Parameters::check_target_endianness): New method.
5289 (parameters_force_valid_target): If either -EL or -EB is specified,
5290 use it to define endianness of default target.
5291 * parameters.h (Parameters::check_target_endianness): New method
5292 declaration.
5293 * target.h (class Target): Change "endianity" to "endianness"
5294 in comments.
5295
efc8d4f2
RW
52962010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5297
5298 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5299 * configure: Regenerate.
5300 * Makefile.in: Regenerate.
5301 * testsuite/Makefile.in: Regenerate.
5302
be234d88
CC
53032010-04-06 Cary Coutant <ccoutant@google.com>
5304
5305 gcc PR lto/42757
5306 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5307 prevailing definitions of common symbols.
5308 * testsuite/plugin_test_6.sh: New test case.
5309 * testsuite/plugin_common_test_1.c: New test case.
5310 * testsuite/plugin_common_test_2.c: New test case.
5311 * testsuite/Makefile.am (plugin_test_6): New test case.
5312 * testsuite/Makefile.in: Regenerate.
5313
bd32c6bd
NC
53142010-04-06 Nick Clifton <nickc@redhat.com>
5315
5316 * po/vi.po: New Vietnamese translation.
5317
323c532f
DK
53182010-03-30 Doug Kwan <dougkwan@google.com>
5319
5320 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5321
4fcd97eb
DK
53222010-03-25 Doug Kwan <dougkwan@google.com>
5323
5324 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5325 to avoid a conversion warning on a 32-bit host.
5326
4ebf39db
ILT
53272010-03-24 Ian Lance Taylor <iant@google.com>
5328
5329 * testsuite/script_test_3.t: Add a TLS segment.
5330 * testsuite/Makefile.am (check_PROGRAMS): Add
5331 tls_phdrs_script_test.
5332 (tls_phdrs_script_test_SOURCES): Define.
5333 (tls_phdrs_script_test_DEPENDENCIES): Define.
5334 (tls_phdrs_script_test_LDFLAGS): Define.
5335 (tls_phdrs_script_test_LDADD): Define.
5336 * testsuite/Makefile.in: Rebuild.
5337
4a599bdd
CC
53382010-03-23 Cary Coutant <ccoutant@google.com>
5339
5340 * fileread.cc (find_or_make_view): Fix comment.
5341
6c93b22c
ILT
53422010-03-23 Ian Lance Taylor <iant@google.com>
5343
5344 * script-sections.cc (class Orphan_section_placement): Define
5345 PLACE_TLS and PLACE_TLS_BSS.
5346 (Orphan_section_placement::Orphan_section_placement): Initialize
5347 new places.
5348 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5349 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5350 (tls_script_test_SOURCES): Define.
5351 (tls_script_test_DEPENDENCIES): Define.
5352 (tls_script_test_LDFLAGS): Define.
5353 (tls_script_test_LDADD): Define.
5354 * testsuite/Makefile.in: Rebuild.
5355
a2c7281b
DK
53562010-03-22 Doug Kwan <dougkwan@google.com>
5357
5358 * arm.cc (Arm_relocate_functions::abs8,
5359 Arm_relocate_functions::abs16): Use correct check for overflow
5360 specified in the ARM ELF specs.
5361 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5362 target of a BLX instruction specially.
5363 (Reloc_stub::stub_type_for_reloc): Ditto.
5364 (Relocate::relocate): Use symbolic names instead of numeric relocation
5365 codes to report error.
5366 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5367 workaround.
5368 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5369 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5370 thumb2_blx_out_of_range.stdout
5371 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5372 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5373 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5374 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5375 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5376 thumb2_blx_in_range, thumb2_blx_in_range.o,
5377 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5378 thumb2_blx_out_of_range.o): New rules.
5379 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5380 thumb2_blx_in_range and thumb2_blx_out_of_range.
5381 * testsuite/Makefile.in: Regenerate.
5382 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5383 * testsuite/thumb_blx_in_range.s: New file.
5384 * testsuite/thumb_blx_out_of_range.s: New file.
5385
b0193076
RÁE
53862010-03-22 Rafael Espindola <espindola@google.com>
5387
5388 * archive.cc (Should_include): Move to archive.h.
5389 (should_include_member): Make it a member of Archive.
5390 (Lib_group): New.
5391 (Add_lib_group_symbols): New.
5392 * archive.h: Include options.h.
5393 (Archive_member): Moved from Archive.
5394 (Should_include): Moved from archive.cc.
5395 (Lib_group): New.
5396 (Add_lib_group_symbols): New.
5397 * dynobj.cc (do_should_include_member): New.
5398 * dynobj.h (do_should_include_member): New.
5399 * gold.cc (queue_initial_tasks): Update call to queue.
5400 * main.cc (main): Print lib group stats.
5401 * object.cc (do_should_include_member): New.
5402 * object.h: Include archive.h.
5403 (Object::should_include_member): New.
5404 (Object::do_should_include_member): New.
5405 (Sized_relobj::do_should_include_member): New.
5406 * options.cc (General_options::parse_start_lib): New.
5407 (General_options::parse_end_lib): New.
5408 (Input_arguments::add_file): Handle lib groups.
5409 (Input_arguments::start_group): Check we are not in a lib.
5410 (Input_arguments::start_lib): New.
5411 (Input_arguments::end_lib): New.
5412 * options.h (General_options): Add start_lib and end_lib.
5413 (Input_argument::lib_): New.
5414 (Input_argument::lib): New.
5415 (Input_argument::is_lib): New.
5416 (Input_file_lib): New.
5417 (Input_arguments::in_lib_): New.
5418 (Input_arguments::in_lib): New.
5419 (Input_arguments::start_lib): New.
5420 (Input_arguments::end_lib_): New.
5421 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5422 in unused members as preempted.
5423 (Sized_pluginobj::do_should_include_member): New.
5424 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5425 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5426 return the blocker.
5427 (Read_symbols::do_whole_lib_group): New.
5428 (Read_symbols::do_lib_group): New.
5429 (Read_symbols::do_read_symbols): Handle lib groups.
5430 (Read_symbols::get_name): Handle lib groups.
5431 * readsyms.h (Read_symbols): Add an archive member pointer.
5432 (Read_symbols::do_whole_lib_group): New.
5433 (Read_symbols::do_lib_group): New.
5434 (Read_symbols::member_): New.
5435 * script.cc (read_input_script): Update call to queue_soon.
5436
d099120c
DK
54372010-03-19 Doug Kwan <dougkwan@google.com>
5438
5439 * arm.cc (Stub_table::Stub_table): Initialize new data members
5440 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5441 (Stub_table::add_reloc_stub): Assign stub offset and update
5442 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5443 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5444 New data members.
5445 (Stub_table::update_data_size_and_addralign): Use
5446 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5447 instead of going over all reloc stubs.
5448 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5449 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5450 Stringpool_template::offset_ to size of Stringpool_char.
5451 (Stringpool_template::new_key_offset): Remove code to initialize
5452 Stringpool_template::offset_.
5453 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5454 Stringpool_template::offset_ to zero.
5455
1aa37384
DK
54562010-03-15 Doug Kwan <dougkwan@google.com>
5457
5458 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5459 offset_.
5460 (Stringpool_template::new_key_offset): New method.
5461 (Stringpool_template::add_string): Assign offsets when adding new
5462 strings.
5463 (Stringpool_template::set_string_offsets): Do not set string offsets
5464 when not optimizing.
5465 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5466 member size_.
5467 (Chunked_vector::clear): Clear size_.
5468 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5469 (Chunked_vector::size): Return size_.
5470 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 5471 (Chunked_vector::size_): New data member.
1aa37384
DK
5472 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5473 (Stringpool_template::new_key_offset): New method declaration.
5474 (Stringpool_template::offset_): New data member.
5475
b672b057
RÁE
54762010-03-15 Rafael Espindola <espindola@google.com>
5477
5478 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5479 Add_symbols' constructor.
5480 * readsyms.h (Add_symbols): Remove the input_group member.
5481
b6848d3c
ILT
54822010-03-10 Ian Lance Taylor <iant@google.com>
5483
5484 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5485 target to ask whether a reference to a symbol requires a stack
5486 split.
5487 * target.h (Target::is_call_to_non_split): New function.
5488 (Target::do_is_call_to_non_split): Declare virtual function.
5489 * target.cc: Include "symtab.h".
5490 (Target::do_is_call_to_non_split): New function.
5491 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5492
a2a5469e
CC
54932010-03-10 Cary Coutant <ccoutant@google.com>
5494
5495 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5496 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5497 (File_read::open[2]): Add whole_file_view_ to list of views.
5498 (File_read::make_view): Remove test of whole_file_view_.
5499 (File_read::find_or_make_view): Create whole_file_view_ if
5500 necessary.
5501 (File_read::clear_views): Replace bool parameter with enum;
5502 adjust all callers. Don't delete views with permanent data;
5503 do delete cached views and views from archives if
5504 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5505 if clearing the corresponding view.
5506 * fileread.h (File_read::Clear_views_mode): New enum.
5507 (File_read::View::is_permanent_view): New method.
5508 (File_read::clear_views): Replace bool parameter
5509 with enum; adjust all callers.
5510 * options.h (General_options): Change keep_files_mapped option;
5511 add map_whole_files.
5512 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5513 releasing the file.
5514 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5515 the file.
5516
8861f32b
DM
55172010-03-10 David S. Miller <davem@davemloft.net>
5518
5519 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5520
d62d0f5f
ST
55212010-03-09 Sriraman Tallam <tmsriram@google.com>
5522
5523 * icf.cc (get_section_contents): Add '@' marker after processing the
5524 merge reloc.
5525
9177756d
DK
55262010-03-08 Doug Kwan <dougkwan@google.com>
5527
5528 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5529 due to a conversion warning.
5530 (Arm_relobj::update_output_local_symbol_count): Check for local
5531 symbol with unset output index.
5532
9e9e071b
ILT
55332010-03-05 Ian Lance Taylor <iant@google.com>
5534
5535 * options.h (class General_options): Add --spare-dynamic-tags.
5536 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5537 --spare-dynamic-tags.
5538
a81ee015
ILT
55392010-03-05 Ian Lance Taylor <iant@google.com>
5540
5541 * incremental.cc: Include "libiberty.h".
5542
44ec90b9
RO
55432010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5544
5545 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5546 function, is_info_ member.
5547 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5548 (Versions::Versions): Update caller.
5549 (Versions::define_base_version): Likewise.
5550 (Versions::add_def): Likewise.
5551
0897ed3b
ST
55522010-03-03 Sriraman Tallam <tmsriram@google.com>
5553
5554 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5555 (Scan::possible_function_pointer_reloc): New function.
5556 (Scan::local_reloc_may_be_function_pointer): Change to call
5557 possible_function_pointer_reloc.
5558 (Scan::global_reloc_may_be_function_pointer): Ditto.
5559 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5560 relocations in ".data.rel.ro._ZTV" section.
5561 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5562 * testsuite/icf_safe_so_test.cc: Ditto.
5563 * testsuite/icf_safe_test.cc: Ditto.
5564 * testsuite/icf_safe_test.sh: Ditto.
5565
d3bbad62
ILT
55662010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5567 Ian Lance Taylor <iant@google.com>
5568
5569 * target-reloc.h (relocate_section): Check the symbol table index
5570 for -1U before setting the local symbol index.
5571 (scan_relocatable_relocs): If copying the relocation, record that
5572 the local symbol is required.
5573 * object.h (Symbol_value::is_output_symtab_index_set): New
5574 function.
5575 (Symbol_value::may_be_discarded_from_output_symtab): New
5576 function.
5577 (Symbol_value::has_output_symtab_entry): New function.
5578 (Symbol_value::needs_output_symtab_entry): Remove.
5579 (Symbol_value::output_symtab_index): Make sure the symbol index is
5580 set.
5581 (Symbol_value::set_output_symtab_index): Make sure the symbol
5582 index is not set. Make sure the new index is valid.
5583 (Symbol_value::set_must_have_output_symtab_entry): New function.
5584 (Symbol_value::has_output_dynsym_entry): New function.
5585 (Symbol_value::set_output_dynsym_index): Make sure the new index
5586 is valid.
5587 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5588 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5589 local symbol if permitted.
5590 (Sized_relobj::do_finalize_local_symbols): Call
5591 is_output_symtab_index_set rather than needs_output_symtab_entry.
5592 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5593 rather than needs_output_symtab_entry. Call
5594 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5595 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5596 is_output_symtab_index_set rather than needs_output_symtab_entry.
5597 * testsuite/discard_locals_relocatable_test.c: New file.
5598 * testsuite/discard_locals_test.sh: Test -r.
5599 * testsuite/Makefile.am (check_DATA): Add
5600 discard_locals_relocatable_test1.syms,
5601 discard_local_relocatable_test2.syms.
5602 (MOSTLYCLEANFILES): Likewise. Also add
5603 discard_locals_relocatable_test1.lout and
5604 discard_locals_relocatable_test2.out.
5605 (discard_locals_relocatable_test1.syms): New target.
5606 (discard_locals_relocatable_test.o): New target.
5607 (discard_locals_relocatable_test1.out): New target.
5608 (discard_locals_relocatable_test2.syms): New target.
5609 (discard_locals_relocatable_test2.out): New target.
5610 (various): Add missing ../ld-new dependencies.
5611 * testsuite/Makefile.in: Rebuild.
5612
7e8ccf26
NC
56132010-03-03 Nick Clifton <nickc@redhat.com>
5614
5615 * po/fi.po: New Finnish translation.
5616
2a0ff005
DK
56172010-03-01 Doug Kwan <dougkwan@google.com>
5618
5619 * layout.cc (Layout::Layout): Force section types of .init_array*,
5620 .preinit_array* and .fini_array* sections.
5621 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5622 Fix check of return value of std::string::find.().
5623 (Output_section::Input_section_sort_compare::operator()): Remove
5624 comment about .init_array.
5625 (Output_section::Input_section_sort_init_fini_compare::operator()):
5626 New method.
5627 (Output_section::sort_attached_input_sections): Handle .init_array
5628 and .fini_array specially.
5629 * output.h (Output_section::Inut_section_sort_compare): Update
5630 comment.
5631 (Output_section::Input_section_sort_init_fini_compare): New struct.
5632
c3e4ae29
DK
56332010-02-26 Doug Kwan <dougkwan@google.com>
5634
5635 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5636 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5637 * testsuite/debug_msg.sh: Avoid matching source line number for
5638 use of global variable undef_int.
5639
2fd9ae7a
DK
56402010-02-26 Doug Kwan <dougkwan@google.com>
5641
5642 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5643 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5644 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5645 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5646 * options.cc (General_options::General_options): Initialize member
5647 fix_v4bx_.
5648 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5649 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5650 and rm_no_fix_v4bx.stdout
5651 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5652 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5653 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5654 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5655 and arm_no_fix_v4bx.
5656 * Makefile.in: Regenerate.
5657 * testsuite/arm_fix_v4bx.s: New file.
5658 * testsuite/arm_fix_v4bx.sh: Ditto.
5659
67ec7d0b
DK
56602010-02-24 Doug Kwan <dougkwan@google.com>
5661
5662 * arm.cc (Target_arm::got_section): Make the .got section the first
5663 non RELRO section in the data segment.
5664 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5665 suffixes of section names.
5666
10165461
DK
56672010-02-24 Doug Kwan <dougkwan@google.com>
5668
5669 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5670 flags and attributes merging if an input file is a binary file.
5671 * fileread.cc (Input_file::open): Record format of original file.
5672 * fileread.h (Input_file::Format): New enum type.
5673 (Input_file::Input_file): Initialize data member format_.
5674 (Input_file::format): New method definition.
5675 (Input_file::format_):: New data member.
5676
4a54abbb
DK
56772010-02-24 Doug Kwan <dougkwan@google.com>
5678
5679 * arm.cc (Arm_output_data_got): New class.
5680 (ARM_TCB_SIZE): New constant
5681 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5682 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5683 If user uses a script with a SECTIONS clause, issue only a warning
5684 for a misplaced EXIDX input section. Otherwise, issue an error.
5685 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5686 garbage collection.
5687 (Target_arm::got_mode_index_entry): Handle static linking.
5688 (Target_arm::Scan::local): Ditto.
5689 (Target_arm::Scan::global): Ditto.
5690 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5691 all incorrectly implemented relocations.
e1df38aa 5692 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
5693 Arm_output_section::fix_exidx_coverage.
5694 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5695 from ".ARM.exidx." and ".ARM.extab.".
5696
ca419a6f
ILT
56972010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5698
5699 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5700 section if it does not already exist.
5701 * attributes.cc (Attributes_section_data::Attributes_section_data):
5702 Don't crash if size is zero.
5703
135b9c78
ILT
57042010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5705 Ian Lance Taylor <iant@google.com>
5706
5707 * gold.cc (queue_middle_tasks): If no input files were opened,
5708 exit.
5709 * workqueue.h (Task_function::Task_function): Assert that there is
5710 a blocker.
5711
bb0bfe4f
DK
57122010-02-22 Doug Kwan <dougkwan@google.com>
5713
5714 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5715 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5716 types to avoid warnings due to different uint64_t implementations
5717 on different hosts.
5718
2a2b6d42
DK
57192010-02-21 Doug Kwan <dougkwan@google.com>
5720
5721 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5722 handling of the maximum backward branch offset.
5723 (Arm_relocate_functions::thumb_branch_common): Ditto.
5724 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5725 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 5726 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
5727 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5728 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5729 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5730 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5731 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5732 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5733 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5734 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5735 thumb2_bl_out_of_range.o): New rules.
5736 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5737 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5738 thumb2_bl_out_of_range
5739 * testsuite/Makefile.in: Regenerate.
5740 * testsuite/arm_bl_in_range.s: New file.
5741 * testsuite/arm_bl_out_of_range.s: Ditto.
5742 * testsuite/arm_branch_in_range.sh: Ditto.
5743 * testsuite/arm_branch_range.t: Ditto.
5744 * testsuite/thumb2_branch_range.t: Ditto.
5745 * testsuite/thumb_bl_in_range.s: Ditto.
5746 * testsuite/thumb_bl_out_of_range.s: Ditto.
5747 * testsuite/thumb_branch_range.t: Ditto.
5748
b487ad64
ST
57492010-02-20 Sriraman Tallam <tmsriram@google.com>
5750
5751 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5752 Add reloc offset information.
5753 * icf.cc (get_section_contents): Change iterators to point to the new
5754 vectors. Add reloc offset information to the contents.
5755 * icf.h (Icf::Sections_reachable_info): New typedef.
5756 (Icf::Sections_reachable_list): New typedef.
5757 (Icf::Offset_info): New typedef.
5758 (Icf::Reloc_info): New struct typedef.
5759 (Icf::Reloc_info_list): New typedef.
5760 (Icf::symbol_reloc_list): Delete method.
5761 (Icf::addend_reloc_list): Delete method.
5762 (Icf::section_reloc_list): Delete method.
5763 (Icf::reloc_info_list): New method.
5764 (Icf::reloc_info_list_): New member.
5765
f96accdf
DK
57662010-02-19 Doug Kwan <dougkwan@google.com>
5767
5768 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5769 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5770 * arm.cc (Arm_relocation_functions): New forward declaration.
5771 (Target_arm::Target_arm): Initialize new data members
5772 got_mod_index_offset_ and tls_base_symbol_defined_.
5773 (Target_arm::Relocate::relocate_tls): New method.
5774 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5775 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5776 New methods.
5777 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5778 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5779 (Target_arm::got_mod_index_offset_,
5780 Target_arm::tls_base_symbol_defined_): New data members.
5781 (Target_arm::Scan::local, Target::Scan::global,
5782 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5783 relocations.
5784
c8761b9a
DK
57852010-02-18 Doug Kwan <dougkwan@google.com>
5786
5787 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5788 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5789 text section as a parameter becuase some broken tools may not set
5790 the link in section header.
5791 (Target_arm::has_got_section): New method.
5792 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5793 without any mapping symbol as data only. Remove warning.
5794 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5795 link in its section header, try to discover the link by inspecting the
5796 REL31 relocation at the beginning of the section.
5797 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5798 in error message.
5799 (Target_arm::Scan::global): Treat any reference to the symbol
5800 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5801
21bb3914
ST
58022010-02-12 Sriraman Tallam <tmsriram@google.com>
5803
5804 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5805 (Scan::global_reloc_may_be_function_pointer): New function.
5806 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5807 (Scan::global_reloc_may_be_function_pointer): New function.
5808 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5809 (Scan::global_reloc_may_be_function_pointer): New function.
5810 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5811 (Scan::global_reloc_may_be_function_pointer): New function.
5812 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5813 (Scan::global_reloc_may_be_function_pointer): New function.
5814 (Scan::possible_function_pointer_reloc): New function.
5815 (Target_x86_64::can_check_for_function_pointers): New function.
5816 * gc.h (gc_process_relocs): Scan relocation types to determine if
5817 function pointers were taken for targets that support it.
5818 * icf.cc (Icf::find_identical_sections): Include functions for
5819 folding in safe ICF whose pointer is not taken.
5820 * icf.h (Secn_fptr_taken_set): New typedef.
5821 (fptr_section_id_): New member.
5822 (section_has_function_pointers): New function.
5823 (set_section_has_function_pointers): New function.
5824 (check_section_for_function_pointers): New function.
5825 * options.h: Fix comment for safe ICF option.
5826 * target.h (can_check_for_function_pointers): New function.
5827 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5828 Modify icf_safe_test for X86-64.
5829 * testsuite/Makefile.in: Regenerate.
5830 * testsuite/icf_safe_so_test.cc: New file.
5831 * testsuite/icf_safe_so_test.sh: New file.
5832 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5833 (main): Change to take pointer to function kept_func_3.
5834 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5835 folding is done correctly for X86-64.
5836
0da6fa6c
DM
58372010-02-12 David S. Miller <davem@davemloft.net>
5838
5839 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5840 is_symbolless parameter.
5841 (Output_reloc<SHT_REL>::is_symbolless): New.
5842 (Output_reloc<SHT_REL>::is_symbolless_): New.
5843 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5844 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5845 (Output_reloc<SHT_RELA>::is_symbolless): New.
5846 (Output_data_reloc::add_global): Handle is_symbolless.
5847 (Output_data_reloc::add_global_relative): Likewise.
5848 (Output_data_reloc::add_local): Likewise.
5849 (Output_data_reloc::add_local_relative): Likewise.
5850 (Output_data_reloc::add_symbolless_global_addend): New.
5851 (Output_data_reloc::add_symbolless_local_addend): New.
5852 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5853 is_symbolless.
5854 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5855 instead of ->is_relative_
5856 (Output_reloc::write): Likewise.
5857 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5858 (Output_reloc::write_rel): Simplify.
5859
5860 * sparc.cc (Target_sparc::Scan::local): Use
5861 ->add_symbolless_local_addend as needed.
5862 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5863 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5864 based upon relocation offset.
5865
e4782e83
DK
58662010-02-11 Doug Kwan <dougkwan@google.com>
5867
5868 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5869 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5870 beginning of function.
5871 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5872 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5873 parameter is_32bit in calls to should_apply_static_reloc.
5874 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5875 (check_DATA): Add arm_abs_global.stdout.
5876 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5877 arm_abs_global.stdout): New rules.
5878 (MOSTLLYCLEANFILES): Add arm_abs_global
5879 * Makefile.in: Regenerate.
5880 * testsuite/arm_abs_global.s: New file.
5881 * testsuite/arm_abs_global.sh: Ditto.
5882 * testsuite/arm_abs_lib.s: Ditto.
5883
93ceb764
ILT
58842010-02-11 Ian Lance Taylor <iant@google.com>
5885
5886 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5887 Read_relocs task.
5888 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5889 Allocate_commons_task first.
5890 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5891 task, rather than symtab_lock_.
5892 (Gc_process_relocs::~Gc_process_relocs): New function.
5893 (Gc_process_relocs::is_runnable): Check this_blocker_.
5894 (Gc_process_relocs::locks): Use next_blocker_ rather than
5895 blocker_.
5896 (Scan_relocs::~Scan_relocs): New function.
5897 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5898 symtab_lock_.
5899 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5900 next_blocker_.
5901 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5902 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5903 constructor accordingly.
5904 (class Gc_process_relocs): Likewise.
5905 (class Scan_relocs): Likewise.
5906 * common.h (class Allocate_commons_task): Remove symtab_lock_
5907 field, and corresponding constructor parameter.
5908 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5909 symtab_lock_.
5910 (Allocate_commons_task::locks): Likewise.
5911
114dfbe1
ILT
59122010-02-11 Ian Lance Taylor <iant@google.com>
5913
5914 * gold-threads.h (class Once): Define.
5915 (class Initialize_lock): Rewrite as child of Once.
5916 * gold-threads.cc (class Once_initialize): Define.
5917 (once_pointer_control): New static variable.
5918 (once_pointer, once_arg): New static variables.
5919 (c_run_once): New static function.
5920 (Once::Once, Once::run_once, Once::internal_run): New functions.
5921 (class Initialize_lock_once): Remove.
5922 (initialize_lock_control): Remove.
5923 (initialize_lock_pointer): Remove.
5924 (initialize_lock_once): Remove.
5925 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5926 (Initialize_lock::initialize): Rewrite.
5927 (Initialize_lock::do_run_once): New function.
5928 * archive.cc (Archive::interpret_header): Only clear name if it is
5929 not already empty.
5930 * fileread.cc: Include "gold-threads.h"
5931 (file_counts_lock): New static variable.
5932 (file_counts_initialize_lock): Likewise.
5933 (File_read::release): Only increment counts when using --stats.
5934 Use a lock around the increment.
5935 * parameters.cc (class Set_parameters_target_once): Define.
5936 (set_parameters_target_once): New static variable.
5937 (Parameters::Parameters): Move here from parameters.h.
5938 (Parameters::set_target): Rewrite.
5939 (Parameters::set_target_once): New function.
5940 (Parameters::clear_target): Move here and rewrite.
5941 * parameters.h (class Parameters): Update declarations. Add
5942 set_parameters_target_once_ field.
5943 (Parameters::Parameters): Move to parameters.cc.
5944 (Parameters::clear_target): Likewise.
5945 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5946 task.
5947 (Start_group::~Start_group): New function.
5948 (Start_group::is_runnable): New function.
5949 (Start_group::locks, Start_group::run): New functions.
5950 (Finish_group::run): Change saw_undefined to size_t.
5951 * readsyms.h (class Start_group): Define.
5952 (class Finish_group): Change saw_undefined_ field to size_t.
5953 (Finish_group::Finish_group): Remove saw_undefined and
5954 this_blocker parameters. Change all callers.
5955 (Finish_group::set_saw_undefined): New function.
5956 (Finish_group::set_blocker): New function.
5957 * symtab.h (class Symbol_table): Change saw_undefined to return
5958 size_t. Change saw_undefined_ field to size_t.
5959 * target-select.cc (Set_target_once::do_run_once): New function.
5960 (Target_selector::Target_selector): Initialize set_target_once_
5961 field. Don't initialize lock_ and initialize_lock_ fields.
5962 (Target_selector::instantiate_target): Rewrite.
5963 (Target_selector::set_target): New function.
5964 * target-select.h (class Set_target_once): Define.
5965 (class Target_selector): Update declarations. Make
5966 Set_target_once a friend. Remove lock_ and initialize_lock_
5967 fields. Add set_target_once_ field.
5968
fa17a3f4
ILT
59692010-02-10 Ian Lance Taylor <iant@google.com>
5970
5971 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5972 queueing any tasks.
5973 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5974 (queue_middle_tasks): Add all blockers before queueing any tasks.
5975 (queue_final_tasks): Likewise.
5976 * token.h (Task_token::add_blockers): New function.
5977 * object.h (Input_objects::number_of_relobjs): New function.
5978
c7177d31
ILT
59792010-02-10 Ian Lance Taylor <iant@google.com>
5980
5de0e392
ILT
5981 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5982 shared, not if not position independent.
5983 * x86_64.cc (Relocate::relocate_tls): Likewise.
5984 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5985 (tls_pie_pic_test): New target.
5986 * testsuite/Makefile.in: Rebuild.
5987
c7177d31
ILT
5988 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5989 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5990 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5991 * testsuite/Makefile.in: Rebuild.
5992
684b268a
DM
59932010-02-09 David S. Miller <davem@davemloft.net>
5994
5995 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5996 R_SPARC_RELATIVE using ->add_local_relative().
5997 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5998
612a8d3d
DM
5999 * output.h (Output_data_dynamic::add_section_size): New method
6000 that takes two Output_data objects.
6001 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6002 entry param. Handle it in initializers.
6003 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6004 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6005 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6006 arg.
6007 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6008 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6009 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6010 for dynrel_includes_plt.
6011 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6012 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6013 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6014 before .rela.plt
6015 (Target_sparc::do_finalize_sections): Update to pass true for
6016 dynrel_includes_plt.
6017 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6018 output before .rela.plt
6019 (Target_powerpc::do_finalize_sections): Update to pass true for
6020 dynrel_includes_plt when 32-bit.
6021
cb1be87e
DK
60222010-02-08 Doug Kwan <dougkwan@google.com>
6023
6024 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6025 method.
6026 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6027 Arm_relobj::scan_section_for_cortex_a8_stubs,
6028 Arm_relobj::do_relocation_section): Instead of calling
6029 Output_section::output_address, use faster
6030 Arm_relobj::simple_input_section_output_address.
6031
705b5121
DM
60322010-02-08 David S. Miller <davem@davemloft.net>
6033
6034 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6035 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6036 relocation helper function.
6037
024c4466
DM
6038 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6039 just like R_SPARC_GOT{10,13,22}.
6040 (Target_sparc::Scan::local): Likewise.
6041 (Target_sparc::Relocate:relocate): Likewise.
6042
9109c078
ILT
60432010-02-06 Ian Lance Taylor <iant@google.com>
6044
6045 * configure.ac: Rewrite targetobjs duplicate removal code to use
6046 only shell constructs.
6047 * configure: Rebuild.
6048
cf846138
DK
60492010-02-05 Doug Kwan <dougkwan@google.com>
6050
6051 PR 11247
6052 * arm.cc (Arm_relobj::section_is_scannable): New method.
6053 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6054 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6055
6cfaf60b
DK
60562010-02-04 Doug Kwan <dougkwan@google.com>
6057
6058 PR 11247
6059 * arm-reloc-property.cc (cstdio): Include.
6060 * configure.ac (targetobjs): Remove duplicates.
6061 * configure: Regenerate.
6062 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6063 big and little endian version for a given address size.
6064
5c57f1be
DK
60652010-02-03 Doug Kwan <dougkwan@google.com>
6066
6067 * arm-reloc-property.cc
6068 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6069 definition.
6070 * arm-reloc-property.h
6071 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6072 New method definition.
6073 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6074 declaration.
6075 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6076 overflow to N.
6077 (GOT_PREL): Change implemented to Y.
6078 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6079 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6080 (Arm_relocate_functions::movw_abs_nc): Remove method.
6081 (Arm_relocate_functions::movt_abs): Ditto.
6082 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6083 (Arm_relocate_functions::thm_movt_abs): Ditto.
6084 (Arm_relocate_functions::movw_rel_nc): Ditto.
6085 (Arm_relocate_functions::movw_rel): Ditto.
6086 (Arm_relocate_functions::movt_rel): Ditto.
6087 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6088 (Arm_relocate_functions:thm_movw_rel): Ditto.
6089 (Arm_relocate_functions:thm_movt_rel): Ditto.
6090 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6091 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6092 New method definitions.
6093 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6094 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6095 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6096 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6097 (Target_arm::Relocate::relocate): Check for non-static or
6098 unimplemented relocation code and exit early. Change calls to
6099 Target_arm::reloc_uses_thumb_bit and
6100 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6101 instead. Refactor code to handle similar relocations to increase
6102 code sharing. Remove check for unsupported relocation code in switch
6103 statement.
6104 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6105 relocation property table to find out size. Change error message to
6106 print out the name of a relocation code instead of the numeric value.
6107 (Target_arm::scan_reloc_for_stub): Use relocation property table
6108 instead of calling Target_arm::reloc_uses_thumb_bit().
6109
218c5831
DK
61102010-02-02 Doug Kwan <dougkwan@google.com>
6111
6112 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6113 types of relaxed input section.
6114
0d31c79d
DK
61152010-02-02 Doug Kwan <dougkwan@google.com>
6116
6117 * Makefile.am (HFILES): Add arm-reloc-property.h.
6118 (DEFFILES): New.
6119 (TARGETSOURCES): Add arm-reloc-property.cc
6120 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6121 (libgold_a_SOURCES): $(DEFFILES)
6122 * Makefile.in: Regenerate.
6123 * arm-reloc-property.cc: New file.
6124 * arm-reloc-property.h: New file.
6125 * arm-reloc.def: New file.
6126 * arm.cc: Update comments.
6127 (arm-reloc-property.h): New included header.
6128 (arm_reloc_property_table): New global variable.
6129 (Target_arm::do_select_as_default_target): New method definition.
6130 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6131 arm-reloc-property to targ_extra_obj.
6132 * parameters.cc (set_parameters_target): Call
6133 Target::select_as_default_target().
6134 * target.h (Target::select_as_default_target): New method definition.
6135 (Target::do_select_as_default_target): Same.
6136
546c7457
DK
61372010-02-01 Doug Kwan <dougkwan@google.com>
6138
6139 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6140 first_output_text_section_.
6141 (Arm_exidx_fixup::first_output_text_section): New method definition.
6142 (Arm_exidx_fixup::first_output_text_section_): New data member.
6143 (Arm_exidx_fixup::process_exidx_section): Record the first text
6144 output section seen.
6145 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6146 and entsize in output section header.
6147
11b861d5
DK
61482010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6149
6150 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6151 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6152 (Arm_relocate_functions::thm_alu11): New Method.
6153 (Arm_relocate_functions::thm_pc8): New Method.
6154 (Arm_relocate_functions::thm_pc12): New Method.
6155 (Target_arm::Scan::local): Handle the relocations.
6156 (Target_arm::Scan::global): Likewise.
6157 (Target_arm::Relocate::relocate): Likewise.
6158 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6159
c9a2c125
DK
61602010-01-29 Doug Kwan <dougkwan@google.com>
6161
6162 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6163 of relocation types as ld.
6164
1521477a
DK
61652010-01-29 Doug Kwan <dougkwan@google.com>
6166
6167 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6168 to public.
6169 (Arm_relocate_functions::thumb_branch_common): Ditto.
6170 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6171 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6172 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6173 Arm_relocate_functions::jump24): Remove.
6174 (Target_arm::Relocate::relocate): Adjust code to call
6175 Arm_relocation_functions::arm_branch_common and
6176 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 6177 wrappers. Merge switch-cases together to reduce source code size.
1521477a 6178
e7eca48c
DK
61792010-01-29 Doug Kwan <dougkwan@google.com>
6180
6181 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6182 output_local_symbol_count_needs_update_.
6183 (Arm_relobj::output_local_symbol_count_needs_update,
6184 Arm_relobj::set_output_local_symbol_count_needs_update,
6185 Arm_relobj::update_output_local_symbol_count): New methods.
6186 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6187 member.
6188 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6189 of pointed function as in a R_ARM_PREL31 relocation.
6190 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6191 for output local symbol count updating.
6192 (Target_arm::do_relax): Update output local symbol counts in objects
6193 if necessary.
6194 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6195
02961d7e
ILT
61962010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6197
6198 * arm.cc: Added support for the ARM relocations:
6199 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6200 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6201 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6202 movw_prel_nc).
6203 (Arm_relocate_functions::movw_rel): New method.
6204 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6205 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6206 thm_movw_prel_nc).
6207 (Arm_relocate_functions::thm_movw_rel): New method.
6208 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6209 thm_movt_prel).
6210 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6211 relocations.
6212 (Target_arm::Scan::global): Likewise.
6213 (Target_arm::Relocate::relocate): Likewise.
6214 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6215 Likewise.
6216
b10d2873
ILT
62172010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6218
6219 * arm.cc: Added support for ARM group relocations.
6220 (Target_arm::reloc_needs_sym_origin): New method.
6221 (Arm_relocate_functions::calc_grp_kn): New method.
6222 (Arm_relocate_functions::calc_grp_residual): New method.
6223 (Arm_relocate_functions::calc_grp_gn): New method.
6224 (Arm_relocate_functions::arm_grp_alu): New Method.
6225 (Arm_relocate_functions::arm_grp_ldr): New Method.
6226 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6227 (Arm_relocate_functions::arm_grp_ldc): New Method.
6228 (Target_arm::Scan::local): Handle the ARM group relocations.
6229 (Target_arm::Scan::global): Likewise.
6230 (Target_arm::Relocate::relocate): Likewise.
6231 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6232 Likewise.
6233
2b328d4e
DK
62342010-01-26 Doug Kwan <dougkwan@google.com>
6235
6236 * arm.cc (set): Include.
6237 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6238 pointer type.
6239 (Arm_output_section::Text_section_list): New type.
6240 (Arm_output_section::append_text_sections_to_list): New method.
6241 (Arm_output_section::fix_exidx_coverage): Ditto.
6242 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6243 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6244 Relobj::set_section_offset() instead of
6245 Sized_relobj::invalidate_section_offset().
6246 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6247 parameter for section headers. Ignore relocation sections for
6248 unallocated sections and EXIDX sections.
6249 (Target_arm::fix_exidx_coverage): New method.
6250 (Target_arm::output_section_address_less_than): New type.
6251 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6252 linked text section instead of the EXIDX section.
6253 (Arm_output_section::create_stub_group): Add an assertion to check
6254 that this is not an EXIDX output section.
6255 (Arm_output_section::append_text_sections_to_list): New method.
6256 (Arm_output_section::fix_exidx_coverage): Ditto.
6257 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6258 Arm_relobj::section_needs_reloc_stub_scanning.
6259 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6260 first pass.
6261 (Target_arm::fix_exidx_coverage): New method.
6262 * object.h (Relobj::set_output_section): New method.
6263 (Sized_relobj::invalidate_section_offset): Remove method.
6264 (Sized_relobj::do_invalidate_section_offset): Remove method.
6265 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6266
c7f3c371
DK
62672010-01-25 Doug Kwan <dougkwan@google.com>
6268
6269 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6270 Fix warning due to signed and unsigned comparison on a 32-bit host.
6271
8923b24c
DK
62722010-01-22 Doug Kwan <dougkwan@google.com>
6273
6274 * arm.cc (Target_arm::do_relax): Record an output section for section
6275 offset adjustment it contains any stub table that has changed.
6276 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6277 offsets in an output section if necessary.
6278 * output.cc (Output_section::Output_section): Initialize
6279 section_offsets_need_adjustments_.
6280 (Output_section::add_input_section_for_script): Renamed to
6281 Output_section::add_simple_input_section.
6282 (Output_section::save_states): Add a comment.
6283 (Output_section::discard_states): New method defintion.
6284 (Output_section::adjust_section_offsets): Same.
6285 * output.h (Output_section::add_input_section_for_script): Renamed to
6286 Output_section::add_simple_input_section.
6287 (Output_section::discard_states): New method declaration.
6288 (Output_section::adjust_section_offsets): Same.
6289 (Output_section::section_offsets_need_adjustment,
6290 Output_section::set_section_offsets_need_adjustment): New method
6291 definitions.
6292 (Output_section::section_offsets_need_adjustment_): New data member.
6293 * script-sections.cc
6294 (Output_section_element_input::set_section_address): Adjust code for
6295 renaming of Output_section::add_input_section_for_script.
6296 (Orphan_output_section::set_section_address): Same.
6297
9b2fd367
DK
62982010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6299
6300 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6301 Fix_v4bx enum values .
6302 * gold/options.h (General_options): New option definitions.
6303 (General_options::fix_v4bx): New method.
6304 (General_options::Fix_v4bx): New enum.
6305 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6306 (General_options::parse_fix_v4bx_interworking): New method.
6307
80d0d023
DK
63082010-01-22 Doug Kwan <dougkwan@google.com>
6309
6310 * arm.cc (Arm_exidx_fixup): New class.
6311
af2cdeae
DK
63122010-01-21 Doug Kwan <dougkwan@google.com>
6313
6314 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6315 classes.
6316 (Arm_exidx_section_offset_map): New type.
6317
993d07c1
DK
63182010-01-21 Doug Kwan <dougkwan@google.com>
6319
6320 * arm.cc (Arm_exidx_input_section): New class.
6321 (Arm_relobj::exidx_input_section_by_link,
6322 Arm_relobj::exidx_input_section_by_shndx,
6323 Arm_relobj::make_exidx_input_section): New methods.
6324 (read_arm_attributes_section): Remove.
6325 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6326 information about them.
6327 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6328 to here.
6329
5ac169d4
DK
63302010-01-20 Doug Kwan <dougkwan@google.com>
6331
6332 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6333 Input_section_specifier to Section_id.
6334 (Target_arm::new_arm_input_section: Adjust code for change of key
6335 type.
6336 (Target_arm::find_arm_input_section): Ditto.
6337 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6338 (Section_id): Remove.
6339 (Garbage_collection::Section_id_hash): Remove.
6340 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6341 (Section_id): Remove.
6342 (Icf::Section_id_hash): Remove.
6343 * object.h (Section_id, Const_section_id, Section_id_hash,
6344 Const_section_id_hash): New type definitions.
6345 * output.cc (Output_section::add_relaxed_input_section): Change to
6346 use Const_section_id instead of Input_section_specifier as key type.
6347 (Output_section::add_merge_input_section): Ditto.
6348 (Output_section::build_relaxation_map): Change to use Section_id
6349 instead of Input_section_specifier as key type.
6350 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6351 Ditto.
6352 (Output_section::convert_input_sections_to_relaxed_sections): Change
6353 to use Const_section_id instead of Input_section_specifier as key type.
6354 (Output_section::find_merge_section): Ditto.
6355 (Output_section::find_relaxed_input_section): Ditto.
6356 * output.h (Input_section_specifier): Remove class.
6357 (Output_section::Output_section_data_by_input_section_map): Change
6358 key type to Const_section_id.
6359 (Output_section::Output_relaxed_input_section_by_input_section_map):
6360 Ditto.
6361 (Output_section::Relaxation_map): Change key type to Section_id.
6362
a2162063
ILT
63632010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6364
6365 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6366 (class Arm_v4bx_stub): New class.
6367 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6368 (Stub_factory::make_arm_v4bx_stub): New method.
6369 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6370 (Stub_table::empty): Handle v4bx stubs.
6371 (Stub_table::add_arm_v4bx_stub): New method.
6372 (Stub_table::find_arm_v4bx_stub): New method.
6373 (Arm_relocate_functions::v4bx): New method.
6374 (Target_arm::fix_v4bx): New method.
6375 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6376 (Stub_table::relocate_stubs): Likewise.
6377 (Stub_table::do_write): Likewise.
6378 (Stub_table::update_data_size_and_addralign): Likewise.
6379 (Stub_table::finalize_stubs): Likewise.
6380 (Target_arm::Scan::local): Likewise.
6381 (Target_arm::Scan::global): Likewise.
6382 (Target_arm::do_finalize_sections): Likewise.
6383 (Target_arm::Relocate::relocate): Likewise.
6384 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6385 Likewise.
6386 (Target_arm::scan_reloc_for_stub): Likewise.
6387 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6388
5696ab0b
ILT
63892010-01-19 Ian Lance Taylor <iant@google.com>
6390
6391 * output.cc (Output_section_headers::do_sized_write): Write large
6392 segment count to sh_info field.
6393 (Output_file_header::do_sized_write): For large segment count,
6394 write PN_XNUM to e_phnum field.
6395
800d0f56
ILT
63962010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6397
6398 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6399 (Arm_relocate_functions::thm_jump8): New function.
6400 (Arm_relocate_functions::thm_jump11): New function.
6401 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6402 R_ARM_THM_JUMP11.
6403 (Target_arm::Scan::global): Likewise.
6404 (Target_arm::Relocate::relocate): Likewise.
6405 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6406 Likewise.
6407
41263c05
DK
64082010-01-14 Doug Kwan <dougkwan@google.com>
6409
6410 * arm.cc (map, utility): Include headers.
6411 (Target_arm::apply_cortex_a8_workaround): New method.
6412 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6413 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6414 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6415 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6416 the --[no-]fix-cortex-a8 command line options.
6417 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6418 (Target_arm::relocate_stub): Use addend in instruction template.
6419 * options.h (DEFINE_bool): Set the user-set flag.
6420 (General_options): Add --[no-]-fix-cortex options.
6421 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 6422 : Update fast look-up map after conversion.
41263c05 6423
459e9b03
ST
64242010-01-14 Sriraman Tallam <tmsriram@google.com>
6425
6426 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6427 in the first pass of do_layout.
6428
b521dfe4
DK
64292010-01-13 Doug Kwan <dougkwan@google.com>
6430
6431 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6432 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6433 apparent compiler problem of not folding static constant integral
6434 data members of elfcpp::Elf_sizes<32>.
6435
44272192
DK
64362010-01-13 Doug Kwan <dougkwan@google.com>
6437
6438 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6439 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6440 Arm_relobj::scan_section_for_cortex_a8_erratum,
6441 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6442 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6443 sections to scan for relocation stubs into a new method
6444 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6445 relocation and Cortex-A8 stub scanning.
6446 (Target_arm::do_relax): Force stubs to be after stubbed sections
6447 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 6448 the beginning of a new relaxation pass. Update a comment.
44272192
DK
6449 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6450
44b71ece
ILT
64512010-01-12 Ian Lance Taylor <iant@google.com>
6452
6453 * target-reloc.h (visibility_error): New inline function.
6454 (relocate_section): Call visibility_error.
6455 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6456 (MOSTLYCLEANFILES): Likewise.
6457 (protected_4_pic.o, protected_3.err): New targets.
6458 * testsuite/protected_4.cc: New file.
6459
a120bc7f
DK
64602010-01-12 Doug Kwan <dougkwan@google.com>
6461
6462 * arm.cc (Cortex_a8_reloc): New class.
6463 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6464 and cortex_a8_relocs_info_.
6465 (Target_arm::fix_cortex_a8): New method definition.
6466 (Target_arm::Cortex_a8_relocs_info): New type.
6467 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6468 New data member declarations.
6469 (Target_arm::scan_reloc_for_stub): Record information about
6470 relocations for THUMB branches that might be exempted from the
6471 Cortex-A8 workaround.
6472 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6473 at the beginning of a relaxation pass.
6474
20138696
DK
64752010-01-12 Doug Kwan <dougkwan@google.com>
6476
6477 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6478 (Arm_relobj::Mapping_symbol_position,
6479 Arm_reloj::Mapping_symbol_position_less,
6480 Arm_relobj::Mapping_symbols_info): New types.
6481 (Target_arm::is_mapping_symbol_name): New method definition.
6482 (Arm_relobj::do_count_local_symbols): Save information about mapping
6483 symbols.
6484
089d69dc
DK
64852010-01-11 Doug Kwan <dougkwan@google.com>
6486
6487 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6488 Arm_relocate_functions::thumb32_branch_upper,
6489 Arm_relocate_functions::thumb32_branch_lower,
6490 Arm_relocate_functions::thumb32_cond_branch_offset,
6491 Arm_relocate_functions::thumb32_cond_branch_upper,
6492 Arm_relocate_functions::thumb32_cond_branch_lower,
6493 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6494 branch offset encoding.
6495 (Arm_relocate_functions::thumb_branch_common): Use new branch
6496 offset encoding methods to avoid code duplication.
6497 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6498 (Stub_addend_reader::operator()): Use new branch encoding method
6499 to avoid code duplication.
6500
99e5bff2
DK
65012010-01-11 Doug Kwan <dougkwan@google.com>
6502
6503 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6504 (Target_arm::do_finalize_sections): Define special EXIDX section
6505 symbols only if referenced.
6506 * gc.h (Garbage_collection::add_reference): New method.
6507 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6508 code duplication.
6509
98e090bd
ILT
65102010-01-11 Ian Lance Taylor <iant@google.com>
6511
d0a91bd8
ILT
6512 * script.cc (Version_script_info::build_expression_list_lookup):
6513 Change complaing about duplicate wildcard match from error to
6514 warning.
6515
98e090bd
ILT
6516 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6517 of 2009-12-30.
6518 (Version_script_info::Version_script_info): Initialize globs_,
6519 default_version_, default_is_global_, and exact_. Don't
6520 initialize globals_ or locals_.
6521 (Version_script_info::build_lookup_tables): Build local symbols
6522 first.
6523 (Version_script_info::unquote): New function.
6524 (Version_script_info::add_exact_match): New function.
6525 (Version_script_info::build_expression_list_lookup): Remove lookup
6526 parameter. Add is_global parameter. Change all callers. Handle
6527 wildcard pattern specially. Unquote pattern. Call
6528 add_exact_match.
6529 (Version_script_info::get_name_to_match): New function.
6530 (Version_script_info::get_symbol_version): New function.
6531 (Version_script_info::get_symbol_version_helper): Remove.
6532 (Version_script_info::check_unmatched_names): Call unquote.
6533 * script.h (class Version_script_info): Change get_symbol_version
6534 to be non-inline and add is_global parameter; change all callers.
6535 Rewrite symbol_is_local. Update declarations. Define struct
6536 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6537 Remove globals_ and locals_ members. Add exact_, globs_,
6538 default_version_, is_global_.
6539 (Version_script_info::Glob): Remove pattern, add expression and
6540 is_global. Update constructor. Change all callers.
6541 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6542 default version.
6543 (Versions::symbol_section_contents): If a symbol is undefined, or
6544 defined in a dynamic object, set the version index to
6545 VER_NDX_LOCAL.
6546 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6547 symbol_is_local.
6548 (Symbol_table::add_from_pluginobj): Likewise.
6549 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6550
d56962d3
DK
65512010-01-11 Doug Kwan <dougkwan@google.com>
6552
6553 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6554 (incremental_dump_LDADD): Add linking option for libintl.
6555 * Makefile.in: Regenerate.
6556
94e6ee91
L
65572010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6558
6559 PR gold/11144
6560 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6561 instead of -Ds.
6562 * testsuite/Makefile.in: Regenerated.
6563
e96c574b
DK
65642010-01-10 Doug Kwan <dougkwan@google.com>
6565
6566 * options.h (DEFINE_var): Use parentheses around argument varname__
6567 in macro body to avoid any unintended subsequent substitutions.
6568
7198066b
ILT
65692010-01-10 Ian Lance Taylor <iant@google.com>
6570
ba4d53bf
ILT
6571 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6572 candidates before doing symbol resolution.
6573
7198066b
ILT
6574 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6575 ODR candidates if only one is weak.
6576
a2beed37
ILT
65772010-01-08 Ian Lance Taylor <iant@google.com>
6578
6579 * script.cc (Version_script_info::build_expression_list_lookup):
6580 Don't warn about ambiguous version, just record the ambiguity.
6581 (Version_script_info::get_symbol_version_helper): Give error if
6582 version is ambiguous.
6583
2fb7225c
DK
65842010-01-08 Doug Kwan <dougkwan@google.com>
6585
6586 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6587 prev_data_size_ and prev_addralign_. Remove initializer for
6588 deleted data member has_been_changed_.
6589 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6590 to determine if the table is empty.
6591 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6592 Remove.
6593 (Stub_table::add_reloc_stub): Define method in class definition
6594 instead of just declaring it there.
6595 (Stub_table::add_cortex_a8_stub): New method definition.
6596 (Stub_table::update_data_size_and_addralign): Ditto.
6597 (Stub_table::finalize_stubs): Ditto.
6598 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6599 (Stub_table::do_addralign_): Return address alignment in the
6600 (Stub_table::do_reset_address_and_file_offset): Define method in
6601 class definition instead of declaring it there. Set current data
6602 size to be the data size of the previous pass.
6603 (Stub_table::set_final_data_size): Use current data size as the
6604 final data size.
6605 (Stub_table::relocate_stub): Change parameter type of stub from
6606 Reloc_stub pointer to Stub pointer.
6607 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6608 (Stub_table::Cortex_a8_stub_list): New typedef.
6609 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6610 Stub_table::prev_addralign_): New data member.
6611 (Arm_relobj::Arm_relobj): Initialize data member
6612 section_has_cortex_a8_workaround_.
6613 (Arm_relobj::section_has_cortex_a8_workaround,
6614 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6615 definitions.
6616 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6617 declarations.
6618 (Target_arm::relocate_stub): Change parameter type of stub from
6619 Reloc_stub pointer to Stub pointer.
6620 (Insn_template::size, Insn_template::alignment): Handle
6621 THUMB16_SPECIAL_TYPE.
6622 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6623 Stub_table::update_data_size_and_addralign,
6624 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6625 definitions.
6626 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6627 (Stub_table::do_write): Ditto.
6628 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6629
880cd20d
ILT
66302010-01-08 Ian Lance Taylor <iant@google.com>
6631
6632 PR 11108
6633 * symtab.h (class Symbol): Remove fields is_target_special_ and
6634 has_plt_offset_. Add field is_defined_in_discarded_section_.
6635 (Symbol::is_defined_in_discarded_section): New function.
6636 (Symbol::set_is_defined_in_discarded_section): New function.
6637 (Symbol::has_plt_offset): Rewrite.
6638 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6639 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6640 Don't initialize is_target_special_ or has_plt_offset_.
6641 Initialize is_defined_in_discarded_section_.
6642 (Symbol_table::add_from_relobj): If appropriate, set
6643 is_defined_in_discarded_section.
6644 * resolve.cc (Symbol::override_base_with_special): Don't test
6645 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6646 * target-reloc.h (relocate_section): Do special handling for
6647 symbols defined in discarded sections for global symbols as well
6648 as local symbols.
6649
2703e3eb
ILT
66502010-01-08 Ian Lance Taylor <iant@google.com>
6651
6652 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6653 the SHT_SYMTAB case.
6654
339d40a3
ILT
66552010-01-08 Ian Lance Taylor <iant@google.com>
6656
6657 * object.cc (Sized_relobj::do_layout): Don't get confused if
6658 layout_eh_frame returns NULL.
6659
abecea76
ILT
66602010-01-08 Ian Lance Taylor <iant@google.com>
6661
6662 PR 11084
6663 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6664 dynamic symbol table, use the normal symbol table.
6665 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6666 symbol table.
6667
6b7dd3f3
ILT
66682010-01-08 Ian Lance Taylor <iant@google.com>
6669
6670 PR 11072
6671 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6672 sections.
6673
36c50e63
L
66742010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6675
6676 * version.cc (print_version): Change to "Copyright 2010".
6677
e291e7b9
ILT
66782010-01-08 Ian Lance Taylor <iant@google.com>
6679
6680 PR 10287
6681 PR 11063
6682 * i386.cc (class Target_i386): Change return type of plt_section
6683 to be non-const.
6684 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6685 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6686 tls_desc_rel_ field.
6687 (Output_data_plt_i386::rel_tls_desc): New function.
6688 (Target_i386::rel_tls_desc_section): New function.
6689 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6690 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6691 R_386_TLS_DESC reloc in rel_tls_desc_section.
6692 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6693 Define struct Tlsdesc_info.
6694 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6695 (Target_x86_64::do_reloc_symbol_index): New function.
6696 (Target_x86_64::add_tlsdesc_info): New function.
6697 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6698 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6699 tlsdesc_rel_ field.
6700 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6701 all callers.
6702 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6703 (Target_x86_64::rela_tlsdesc_section): New function.
6704 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6705 handling.
6706 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6707 (Target_x86_64::do_reloc_addend): New function.
6708 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6709 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6710 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6711 (Output_reloc::type): New function.
6712 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6713 (Output_reloc::is_target_specific): New function.
6714 (Output_reloc::target_arg): New function.
6715 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6716 absolute relocs and target specific relocs.
6717 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6718 add_target_specific.
6719 (class Output_data_reloc) [SHT_RELA]: Likewise.
6720 * output.cc (Output_reloc::Output_reloc): Add four new versions
6721 for absolute relocs and target specific relocs.
6722 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6723 (Output_reloc::get_symbol_index): Likewise.
6724 (Output_reloc::local_section_offset): Check that local_sym_index_
6725 is not TARGET_CODE or 0.
6726 (Output_reloc::symbol_value): Likewise.
6727 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6728 reloc.
6729 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6730 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6731 functions.
6732 * layout.cc (add_target_dynamic_tags): Use output section for
6733 DT_PLTRELSZ and DT_JMPREL.
6734
3a44184e
ILT
67352010-01-07 Ian Lance Taylor <iant@google.com>
6736
6737 PR 11061
6738 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6739 function.
6740 (class Output_data_reloc_generic): Define.
6741 (class Output_data_reloc_base): Change base class to
6742 Output_data_reloc_generic. Change add() method to call
6743 bump_relative_reloc_count for a relative reloc. Remove
6744 sort_relocs_ field.
6745 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6746 to sort_relocs().
6747 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6748 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6749 appropriate.
6750 * layout.h (class Layout): Update declaration.
6751
ea715a34
ILT
67522010-01-07 Ian Lance Taylor <iant@google.com>
6753
6754 * output.h (class Output_data): Add const version of
6755 output_section and do_output_section.
6756 (class Output_section_data): Add const version of
6757 do_output_section.
6758 (class Output_section): Likewise.
6759 * layout.cc (Layout::add_target_dynamic_tags): New function.
6760 * layout.h (class Layout): Update declarations.
6761 * arm.cc (Target_arm::do_finalize_sections): Use
6762 add_target_dynamic_tags.
6763 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6764 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6765 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6766 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6767
659948a4
ILT
67682010-01-07 Ian Lance Taylor <iant@google.com>
6769
6770 PR 11042
6771 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6772 object as needed.
6773
9d3b86f6
ILT
67742010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6775 Ian Lance Taylor <iant@google.com>
6776
6777 PR 11019
6778 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6779 Xindex::read_symtab_xindex.
6780
bb0d3eb0
DK
67812010-01-07 Doug Kwan <dougkwan@google.com>
6782
6783 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6784 (Insn_template::thumb16_bcond_insn): New method declaration.
6785 (Insn_template): Fix spelling.
6786 (Stub::thumb16_special): New method declaration.
6787 (Stub::do_write): Define virtual method which was previously pure
6788 virtual.
6789 (Stub::do_thumb16_special): New method declaration.
6790 (Stub::do_fixed_endian_write): New template member.
6791 (Reloc_stub::do_write): Remove.
6792 (Reloc_stub::do_fixed_endian_write): Remove.
6793 (Cortex_a8_stub): New class definition.
6794 (Stub_factory::make_cortex_a8_stub): New method definition.
6795 (Stub_factory::Stub_factory): Add missing static storage class
6796 qualifier for elf32_arm_stub_a8_veneer_blx.
6797
ffeef7df
ILT
67982010-01-07 Ian Lance Taylor <iant@google.com>
6799
dc3f80fe
ILT
6800 PR 10980
6801 * options.h (class General_options): Add --warn-unresolved-symbols
6802 and --error-unresolved-symbols.
6803 * errors.cc (Errors::undefined_symbol): Implement
6804 --warn-unresolved-symbols.
6805
ffeef7df
ILT
6806 * options.h (class General_options): Add -z text and -z textoff.
6807 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6808
f1ec9ded
ST
68092010-01-06 Sriraman Tallam <tmsriram@google.com>
6810
6811 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6812 (Garbage_collection::cident_sections): New function.
6813 (Garbage_collection::add_cident_section): New function.
6814 (Garbage_collection::cident_sections_): New member.
6815 (gc_process_relocs): Add references to sections whose names are C
6816 identifiers.
6817 * gold.h (cident_section_start_prefix): New constant.
6818 (cident_section_stop_prefix): New constant.
6819 (is_cident): New function.
6820 * layout.cc (Layout::define_section_symbols): Replace string constants
6821 with the newly defined constants.
6822 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6823 C identifiers.
6824 * testsuite/Makefile.am: Add gc_orphan_section_test.
6825 * testsuite/Makefile.in: Regenerate.
6826 * testsuite/gc_orphan_section_test.cc: New file.
6827 * testsuite/gc_orphan_section_test.sh: New file.
6828
6eda8c29
ILT
68292010-01-06 Ian Lance Taylor <iant@google.com>
6830
b9674e17
ILT
6831 PR 10980
6832 * options.h (class General_options): Add --warn-shared-textrel.
6833 * layout.cc (Layout::finish_dynamic_section): Implement
6834 --warn-shared-textrel.
6835
6eda8c29
ILT
6836 PR 10980
6837 * options.h (class General_options): Add --warn-multiple-gp.
6838
32dcd44e
ILT
68392010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6840
6841 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6842 $(THREADSLIB) and $(LIBDL).
6843 * Makefile.in: Rebuild.
6844
a192ba05
ILT
68452010-01-06 Ian Lance Taylor <iant@google.com>
6846
6847 PR 10980
6848 * options.cc (General_options::parse_section_start): New function.
6849 (General_options::section_start): New function.
6850 (General_options::General_options): Initialize all members.
6851 * options.h: Include <map>
6852 (class General_options): Add --section-start. Add section_starts_
6853 member.
6854 * layout.cc (Layout::attach_allocated_section_to_segment): If
6855 --section-start was used, set the address of the segment. Remove
6856 local sort_sections.
6857 (Layout::relaxation_loop_body): If the address of the load segment
6858 has been set by --section-start, don't use it.
6859 * output.h (Output_segment::update_flags_for_output_section): New
6860 function.
6861 * output.cc (Output_segment::add_output_section): Call
6862 update_flags_for_output_section.
6863
dde3f402
ILT
68642010-01-05 Ian Lance Taylor <iant@google.com>
6865
62dfdd4d
ILT
6866 PR 10980
6867 * options.h (class General_options): Add --undefined-version.
6868 * script.cc (struct Version_expression): Add was_matched_by_symbol
6869 field.
6870 (Version_script_info::matched_symbol): New function.
6871 (Version_script_info::get_symbol_version_helper): Call
6872 matched_symbol.
6873 (Version_script_info::check_unmatched_names): New function.
6874 * script.h (class Version_script_info): Update declarations.
6875 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6876
9c4ae156
ILT
6877 * options.h (class General_options): Use DEFINE_bool_alias for
6878 allow_multiple_definition.
6879 * resolve.cc (Symbol_table::should_override): Don't test
6880 allow_multiple_definition.
6881
dde3f402
ILT
6882 PR 10980
6883 * options.h (class General_options): Add --cref.
6884 * main.cc (main): Print cref table if --cref. Don't close mapfile
6885 until after printing cref table.
6886 * cref.cc: Include "symtab.h".
6887 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6888 (Cref_table_compare::operator()): New function.
6889 (Cref_inputs::gather_cref): New function.
6890 (filecol): New static const.
6891 (Cref_inputs::print_cref): New function.
6892 (Cref::print_cref): New function.
6893 * cref.h: Include <cstdio>.
6894 (class Cref): Update declarations.
6895 * mapfile.h (Mapfile::file): New function.
6896 * object.h (class Object): Define Symbols. Declare virtual
6897 do_get_global_symbols.
6898 (Object::get_global_symbols): New function.
6899 * object.cc (Input_objects::add_object): Pass object to cref_ if
6900 --cref.
6901 (Input_objects::archive_start): Likewise.
6902 (Input_objects::archive_stop): Likewise.
6903 (Input_objects::print_cref): New function.
6904 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6905 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6906 --cref.
6907 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6908 function.
6909 * plugin.h (class Sized_pluginobj): Update declarations.
6910
8781f709
ILT
69112010-01-05 Ian Lance Taylor <iant@google.com>
6912
6913 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6914 to is_default_version. Rename insdef to insdefault.
6915 (Symbol_table::add_from_relobj): Rename def to is_default_version
6916 and local to is_forced_local.
6917 (Symbol_table::add_from_pluginobj): Likewise.
6918 (Symbol_table::add_from_dynobj): Likewise.
6919 (Symbol_table::define_special_symbol): Rename insdef to
6920 insdefault.
6921
fe35d28d
ILT
69222010-01-04 Ian Lance Taylor <iant@google.com>
6923
30bc8c46
ILT
6924 PR 10980
6925 * options.h (class General_options): Add
6926 --allow-multiple-definition and -z muldefs.
6927 * resolve.cc (Symbol_table::should_override): Don't warn about a
6928 multiple symbol definition if --allow-multiple-definition or -z
6929 muldefs.
6930
7eaea549
ILT
6931 PR 10980
6932 * options.h (class General_options): Add --add-needed and
6933 --copy-dt-needed-entries. Tweak --as-needed help entry.
6934 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6935 error if --copy-dt-needed-entries aka --add-needed is used and
6936 would cause a change in behaviour.
6937
fe35d28d
ILT
6938 PR 10980
6939 * options.h (class General_options): Add -G as a short version of
6940 --shared. Add no-op options -assert, -g, and -i.
6941
55a2bb35
ST
69422010-01-04 Sriraman Tallam <tmsriram@google.com>
6943
6944 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6945 check for .text or .gnu.linkonce.t sections.
6946 * icf.cc (Icf::find_identical_sections): Ditto.
6947 Change the detection for mangled function name within the section
6948 name.
6949 * icf.h (is_section_foldable_candidate): New function.
6950
719328e1
ILT
69512009-12-30 Ian Lance Taylor <iant@google.com>
6952
6953 PR 10980
6954 * options.h (class General_options): Permit two dashes with
6955 --retain-symbols-file.
6956
d7bb5745
ILT
69572009-12-30 Ian Lance Taylor <iant@google.com>
6958
403a15dd
ILT
6959 PR 10979
6960 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6961 don't put the file header and segment headers in the text
6962 segment.
6963
eda294df
ILT
6964 PR 10979
6965 * common.cc (Sort_commons::operator()): Stabilize sort when both
6966 entries are NULL.
6967 (Symbol_table::do_allocate_commons_list): When allocating common
6968 symbols, skip a symbol which is no longer common.
6969 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6970 an object before checking its type.
6971 * testsuite/common_test_2.c: New file.
6972 * testsuite/common_test_3.c: New file.
6973 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6974 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6975 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6976 (common_test_2_pic.o, common_test_2.so): New targets.
6977 (common_test_3_pic.o, common_test_3.so): New targets.
6978 * testsuite/Makefile.in: Rebuild.
6979
d7bb5745
ILT
6980 PR 10979
6981 * script.cc (read_input_script): If we see a new SECTIONS clause,
6982 and we have added an input section, give an error.
6983 * layout.h (class Layout): Add have_added_input_section function.
6984 Add have_added_input_section_ field.
6985 * layout.cc (Layout::Layout): Initialize
6986 have_added_input_section_.
6987 (Layout::layout): Set have_added_input_section_.
6988 (Layout::layout_eh_frame): Likewise.
6989
fc59c572
ILT
69902009-12-30 Ian Lance Taylor <iant@google.com>
6991
6992 PR 10931
6993 * options.h (class General_options): Add --sort-common option.
6994 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6995 * common.cc (Sort_common): Add sort_order parameter to
6996 constructor. Add sort_order_ field.
6997 (Sort_commons::operator): Check sort_order_.
6998 (Symbol_table::allocate_commons): Determine the sort order.
6999 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7000 Change all callers.
7001 (Symbol_table::do_allocate_commons_list): Likewise.
7002
1c74fab0
ILT
70032009-12-30 Ian Lance Taylor <iant@google.com>
7004
7005 PR 10916
7006 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7007 symbols from this object, don't change the visibility of an
7008 undefined symbol.
7009 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7010
6affe781
ILT
70112009-12-30 Ian Lance Taylor <iant@google.com>
7012
7013 PR 10861
7014 * script.h (class Version_script_info): Define Language enum.
7015 Update declarations. Define Glob, Exact, and Lookup types. Add
7016 new fields globals_, locals_, and is_finalized_.
7017 * script.cc: Various formatting fixes.
7018 (class Parser_closure): Change language_stack_ from a vector of
7019 std::string to one of Version_script_info::Language. Adjust all
7020 uses accordingly.
7021 (class Lazy_demangler): Remove.
7022 (struct Version_expression): Change language from std::string to
7023 Version_script_info::Language.
7024 (Version_script_info::Version_script_info): New function.
7025 (Version_script_info::~Version_script_info): Don't call clear.
7026 (Version_script_info::finalize): New function.
7027 (Version_script_info::build_lookup_tables): New function.
7028 (Version_script_info::build_expression_list_lookup): New
7029 function.
7030 (Version_script_info::get_symbol_version_helper): Rewrite to use
7031 lookup tables.
7032 (Version_script_info::print_expression_list): Adjust to use
7033 Version_script_info::Language.
7034 (script_push_lex_into_version_mode): Check that the version script
7035 has not been finalized.
7036 (version_script_push_lang): Change language string to
7037 Version_script_info::Language.
7038 * options.cc (Command_line::version_script): New function.
7039 * options.h (class General_options): Add finalize_dynamic_list
7040 function. Change version_script from declaration to definition.
7041 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7042 * testsuite/version_script.map: Remove duplicate def of foo.
7043 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7044 version_script.map.
7045 * testsuite/Makefile.in: Rebuild.
7046
818bf354
ILT
70472009-12-30 Ian Lance Taylor <iant@google.com>
7048
7049 PR 10843
7050 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7051 if the input symbol index is 0, make the output symbol index 0.
7052
ebcc8304
ILT
70532009-12-30 Ian Lance Taylor <iant@google.com>
7054
7055 PR 10670
7056 * options.h (class General_options): Add -x/--discard-all.
7057 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7058 --discard-all. If the local symbol needs a dynamic entry, check
7059 that before handling --discard-locals.
7060
176fe33f
ILT
70612009-12-30 Ian Lance Taylor <iant@google.com>
7062
bb321bb1
ILT
7063 PR 10450
7064 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7065 flags to PF_R.
7066 (Output_segment::add_output_section): Don't change the flags if
7067 the type is PT_TLS.
7068
176fe33f
ILT
7069 PR 10450
7070 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7071 GNU hash table if they need a dynamic value. Otherwise, don't add
7072 them if they are defined in a dynamic object or are forced local.
7073
e8cd95c7
ILT
70742009-12-29 Ian Lance Taylor <iant@google.com>
7075
1b81fb71
ILT
7076 PR 10450
7077 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7078 .gnu.hash table for a 32-bit target.
7079
8d6d383d
ILT
7080 PR 10450
7081 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7082 regular and a dynamic object only needs a dynamic symbol table
7083 entry if it is externally visible.
7084
e785ec03
ILT
7085 PR 10450
7086 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7087 constructor. Add global_offset_table_ field.
7088 (Target_i386::got_section): Set global_offset_table_.
7089 (Target_i386::do_finalize_sections): Set global_offset_table_
7090 size.
7091 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7092 in constructor. Add global_offset_table_ field.
7093 (Target_x86_64::got_section): Set global_offset_table_.
7094 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7095 size.
7096
1a2dff53
ILT
7097 * layout.cc (Layout::Layout): Initialize increase_relro_.
7098 (Layout::get_output_section): Add is_relro, is_last_relro, and
7099 is_first_non_relro parameters. Change all callers.
7100 (Layout::choose_output_section): Likewise.
7101 (Layout::add_output_section_data): Likewise.
7102 (Layout::make_output_section): Likewise.
7103 (Layout::set_segment_offsets): Clear increase_relro when using a
7104 linker script.
7105 * layout.h (class Layout): Add increase_relro method. Add
7106 increase_relro_ field. Update declarations.
7107 * output.cc (Output_section::Output_section): Initialize
7108 is_last_relro_ and is_first_non_relro_.
7109 (Output_segment::add_output_section): Group relro sections is
7110 do_sort is true. Handle is_last_relro and is_first_non_relro.
7111 (Output_segment::maximum_alignment): Remove relro handling.
7112 (Output_segment::set_section_addresses): Add increase_relro
7113 parameter. Change all callers. Add initial alignment to align
7114 relro sections on separate page. Remove old relro handling.
7115 (Output_segment::set_section_list_addresses): Remove in_relro
7116 parameter. Change all callers.
7117 (Output_segment::set_offset): Add increase parameter. Change all
7118 callers. Remove old relro handling.
7119 * output.h (class Output_section): Add new methods: is_last_relro,
7120 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7121 Add is_last_relro_ and is_first_non_relro_ fields.
7122 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7123 Create separate .got.plt section. Call increase_relro.
7124 * x86_64.cc (Target_x86_64::got_section): Likewise.
7125 * testsuite/relro_script_test.t: Add .got.plt.
7126
f0ba79e2
ILT
7127 PR 10450
7128 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7129 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7130 (Layout::finalize): Call set_dynamic_symbol_size.
7131 (Layout::set_dynamic_symbol_size): New function.
7132 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7133 set_dynamic_symbol_size.
7134
e8cd95c7
ILT
7135 PR 10450
7136 * output.h (class Output_section): Add is_entsize_zero_ field.
7137 * output.cc (Output_section::Output_section): Initialize
7138 is_entsize_zero_.
7139 (Output_section::set_entsize): If two different entsizes are
7140 requested, force it to zero.
7141 (Output_section::add_input_section): Set flags for .debug_str
7142 before updating section flags. Set entsize.
7143 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7144 and SHF_STRING if all input sections have those flags.
7145
3e1b9a8a
RÁE
71462009-12-29 Rafael Espindola <espindola@google.com>
7147
7148 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
7149 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7150 reporting.
3e1b9a8a 7151
3dcad376
ST
71522009-12-29 Sriraman Tallam <tmsriram@google.com>
7153
7154 * options.cc (General_options::parse_version): Allow -v to exit
7155 without an error if there is nothing to link.
7156
084e2665
ILT
71572009-12-29 Ian Lance Taylor <iant@google.com>
7158
7159 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7160 using a version of gcc before 4.1.
7161 * configure: Rebuild.
7162
250acde3
CD
71632009-12-28 Chris Demetriou <cgd@google.com>
7164
7165 * attributes.cc (Output_attributes_section_data::do_write): Use
7166 std::vector::front rather than std::vector::data.
7167
99fff23b
ILT
71682009-12-28 Ian Lance Taylor <iant@google.com>
7169
7170 * symtab.h (class Symbol_table): Add enum Defined.
7171 * resolve.cc (Symbol_table::should_override): Add defined
7172 parameter. Change all callers. Test whether object is NULL
7173 before calling a method on it.
7174 (Symbol_table::report_resolve_problem): Add defined parameter.
7175 Change all callers.
7176 (Symbol_table::should_override_with_special): Likewise.
7177 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7178 parameter. Change all callers.
7179 (Symbol_table::do_define_in_output_data): Likewise.
7180 (Symbol_table::define_in_output_segment): Likewise.
7181 (Symbol_table::do_define_in_output_segment): Likewise.
7182 (Symbol_table::define_as_constant): Likewise.
7183 (Symbol_table::do_define_as_constant): Likewise.
7184 * script.h (class Symbol_assignment): Add is_defsym parameter to
7185 constructor; change all callers.
7186 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7187 parameter. Change all callers. Add is_defsym_ field.
7188 (class Parser_closure): Add parsing_defsym parameter to
7189 constructor; change all callers. Add parsing_defsym accessor
7190 function. Add parsing_defsym_ field.
7191
556bd683
ILT
71922009-12-28 Ian Lance Taylor <iant@google.com>
7193
7194 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 7195 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 7196
1782c879
ILT
71972009-12-23 Ian Lance Taylor <iant@google.com>
7198
7199 * i386.cc (Target_i386::do_calls_non_split): Recognize
7200 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
7201 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7202 -fsplit-stack prologue when using %r11.
1782c879 7203
329ca2b1
ST
72042009-12-21 Sriraman Tallam <tmsriram@google.com>
7205
7206 * options.cc (General_options::parse_version): Make -v continue and do
7207 the link like GNU ld does.
7208
d675ff46
RÁE
72092009-12-17 Rafael Avila de Espindola <espindola@google.com>
7210
7211 * Makefile.am (CCFILES): Add timer.cc.
7212 (HFILES): Add timer.h.
7213 * configure.ac: Check for sysconf and times.
7214 * main.cc: include timer.h.
7215 (main): Use Timer instead of get_run_time.
7216 * timer.cc: New.
7217 * timer.h: New.
7218 * workqueue.cc: include timer.h.
7219 (Workqueue::find_and_run_task):
7220 Report user, sys and wall time.
7221 * Makefile.in: Regenerate.
7222 * config.in: Regenerate.
7223 * configure: Regenerate.
7224
d6344fb5
DK
72252009-12-16 Doug Kwan <dougkwan@google.com>
7226
7227 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7228 sections.
7229 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7230 relaxed input sections.
7231 * output.cc (Output_section::find_relaxed_input_section): Change
7232 return type to Output_relaxed_input_section pointer. Adjust code
7233 for new type of relaxed_input_section_map_.
7234 * output.h (Output_section::find_relaxed_input_section): Change
7235 return type to Output_relaxed_input_section pointer.
7236 (Output_section::Output_relaxed_input_section_by_input_section_map):
7237 New type.
7238 (Output_section::relaxed_input_section_map_): Change type to
7239 Output_section::Output_relaxed_input_section_by_input_section_map.
7240 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7241 input section.
7242
0e0d5469
ILT
72432009-12-15 Ian Lance Taylor <iant@google.com>
7244
7245 * layout.cc (Layout::create_shstrtab): Only write out after input
7246 sections if we are compressing debug sections.
7247
0649a889
ILT
72482009-12-15 Ian Lance Taylor <iant@google.com>
7249
7250 * archive.cc (Archive::add_symbols): Only look up a symbol without
7251 a version if there is, in fact, a version.
7252
2ea97941
ILT
72532009-12-14 Ian Lance Taylor <iant@google.com>
7254
7255 Revert -Wshadow changes, all changes from:
7256 2009-12-11 Doug Kwan <dougkwan@google.com>
7257 2009-12-11 Nick Clifton <nickc@redhat.com>
7258 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7259
b0eec2cc
DK
72602009-12-11 Doug Kwan <dougkwan@google.com>
7261
7262 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7263 due to -Wshadow.
7264 * attributes.cc (Object_attribute::size): Ditto.
7265 (Attributes_section_data::size): Ditto.
7266 (Attributes_section_data::Attributes_section_data): Ditto.
7267 (Output_attributes_section_data::do_write): Ditto.
7268 * attributes.h (Object_attribute::set_type): Ditto.
7269 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7270
91d6fa6a
NC
72712009-12-11 Nick Clifton <nickc@redhat.com>
7272
7273 * archive.cc: Fix shadowed variable warnings.
7274 * arm.cc: Likewise.
7275 * compressed_output.cc: Likewise.
7276 * compressed_output.h: Likewise.
7277 * configure: Likewise.
7278 * dwarf_reader.cc: Likewise.
7279 * dynobj.cc: Likewise.
7280 * dynobj.h: Likewise.
7281 * ehframe.cc: Likewise.
7282 * ehframe.h: Likewise.
7283 * errors.cc: Likewise.
7284 * expression.cc: Likewise.
7285 * fileread.cc: Likewise.
7286 * fileread.h: Likewise.
7287 * freebsd.h: Likewise.
7288 * i386.cc: Likewise.
7289 * icf.cc: Likewise.
7290 * incremental.h: Likewise.
7291 * layout.cc: Likewise.
7292 * layout.h: Likewise.
7293 * mapfile.cc: Likewise.
7294 * merge.cc: Likewise.
7295 * merge.h: Likewise.
7296 * object.cc: Likewise.
7297 * object.h: Likewise.
7298 * options.h: Likewise.
7299 * output.cc: Likewise.
7300 * output.h: Likewise.
7301 * parameters.cc: Likewise.
7302 * plugin.cc: Likewise.
7303 * powerpc.cc: Likewise.
7304 * reduced_debug_output.cc: Likewise.
7305 * reduced_debug_output.h: Likewise.
7306 * reloc.cc: Likewise.
7307 * reloc.h: Likewise.
7308 * resolve.cc: Likewise.
7309 * script-sections.cc: Likewise.
7310 * script.cc: Likewise.
7311 * script.h: Likewise.
7312 * sparc.cc: Likewise.
7313 * symtab.cc: Likewise.
7314 * symtab.h: Likewise.
7315 * target-select.cc: Likewise.
7316 * target-select.h: Likewise.
7317 * token.h: Likewise.
7318 * workqueue.cc: Likewise.
7319 * workqueue.h: Likewise.
7320 * x86_64.cc: Likewise.
7321
a0351a69
DK
73222009-12-10 Doug Kwan <dougkwan@google.com>
7323
7324 * arm.cc (attributes.h): New include.
7325 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7326 (Arm_relobj::~Arm_relobj): Delete object pointed by
7327 attributes_section_data_.
7328 (Arm_relobj::attributes_section_data): New method definition.
7329 (Arm_relobj::attributes_section_data_): New data member declaration.
7330 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7331 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7332 attributes_section_data_.
7333 (Arm_dynobj::attributes_section_data): New method definition.
7334 (Arm_dynobj::attributes_section_data_): New data member declaration.
7335 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7336 initialization value of may_use_blx_ to false.
7337 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7338 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7339 object attributes to compute results instead of hard-coding.
7340 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7341 Target_arm::get_secondary_compatible_arch,
7342 Target_arm::set_secondary_compatible_arch
7343 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7344 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7345 New method declarations.
7346 (Target_arm::get_aeabi_object_attribute): New method definition.
7347 (Target_arm::attributes_section_data_): New data member declaration.
7348 (read_arm_attributes_section): New template definition.
7349 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7350 (Arm_dynobj::do_read_symbols): Ditto.
7351 (Target_arm::do_finalize_sections): Merge attributes sections from
7352 input. Check for BLX use after attributes section merging.
7353 Fix __exidx_start and __exidx_end visibility. Create an
7354 .ARM.attributes section if necessary.
7355 (Target_arm::get_secondary_compatible_arch,
7356 Target_arm::set_secondary_compatible_arch,
7357 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7358 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 7359 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
7360 New method definitions.
7361
b59befec
ILT
73622009-12-09 Ian Lance Taylor <iant@google.com>
7363
7364 * plugin.cc (Plugin::load): Don't cast from void* to a function
7365 pointer.
7366
1276bc89
ILT
73672009-12-09 Ian Lance Taylor <iant@google.com>
7368
7369 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7370 information fields.
7371
2f2de248
L
73722009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7373
7374 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7375 Replace two_file_shared_1.so with two_file_shared_2.so.
7376 * testsuite/Makefile.in: Regenerated.
7377
4f787271
DK
73782009-12-08 Doug Kwan <dougkwan@google.com>
7379
7380 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7381 (HFILES): Add attributes.h and int_encoding.h.
7382 * Makefile.in: Regenerate.
7383 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7384 function definitions to int_encoding.cc
7385 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7386 prototypes to int_encoding.h
7387 * reduced_debug_output.cc (int_encoding.h): New include.
7388 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7389 function definitions to int_encoding.cc
7390 (insert_into_vector, read_from_pointer): Move template definitions to
7391 int_encoding.h
7392 * attributes.cc: New file.
7393 * attributes.h: New file.
7394 * int_encoding.cc: New file.
7395 * int_encoding.h: New file.
7396
20b52f1a
RÁE
73972009-12-07 Rafael Avila de Espindola <espindola@google.com>
7398
7399 PR gold/11055
7400 * incremental-dump.cc (dump_incremental_inputs): New.
7401 (main): Use dump_incremental_inputs.
7402
53d7974c
L
74032009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7404
7405 PR gold/10893
7406 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7407 checking elfcpp::STT_FUNC.
7408 (Target_i386::Relocate::relocate): Likewise.
7409 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7410
7411 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7412 symbols from shared libraries into normal FUNC symbols.
7413
7414 * symtab.h (Symbol): Add is_func and use it.
7415
05a352e6
DK
74162009-12-05 Doug Kwan <dougkwan@google.com>
7417
7418 * arm.cc (Target_arm::arm_info): Initialize new fields
7419 attributes_section and attributes_vendor.
7420 * i386.cc (Target_i386::i386_info): Same.
7421 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7422 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7423 fields attributes_section and attributes_vendor.
53d7974c 7424 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
7425 * target.h (Target::attributes_section, Target::attributes_vendor,
7426 Target::is_attributes_section, Target::attribute_arg_type,
7427 Target::attributes_order): New method definitions.
7428 (Target::Target_info::attributes_section,
7429 Target::Target_info::attributes_vendor): New fields.
7430 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7431 virtual method definitions.
7432 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7433 attributes_section and attributes_vendor.
7434 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7435
f4e5969c
DK
74362009-12-05 Doug Kwan <dougkwan@google.com>
7437
7438 * arm.cc: Update comments about interworking and stub generation.
7439 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7440 considered as non-PIC.
7441 (Arm_relocate_functions::base_abs): Fix formatting.
7442 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7443 of function to use GOT entry address instead of offset.
7444 (Target_arm::Scan::global): Issue an error if a symbol would need a
7445 PLT does not get one because it is untyped. Remove code to create
7446 dynamic symbols for relative branches.
7447 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7448 takes unsigned integer instead of boolean.
7449
1abce4a6
L
74502009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7451
7452 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7453 (two_file_test_LDADD): Likewise.
7454 (common_test_1_LDADD): Likewise.
7455 (exception_test_LDADD) Likewise.
7456 (weak_test_LDADD): Likewise.
7457 (many_sections_test_LDADD): Likewise.
7458 (initpri1_LDADD): Likewise.
7459 (script_test_1_LDADD): Likewise.
7460 (script_test_2_LDADD): Likewise.
7461 (justsyms_LDADD): Likewise.
7462 (binary_test_LDADD): Likewise.
7463 (large_LDADD): Likewise.
7464 * testsuite/Makefile.in: Regenerated.
7465
adcf2816 74662009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 7467
adcf2816
L
7468 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7469 (Symbol_table::override_with_special): Likewise.
7470 (Symbol_table::add_from_object): Likewise.
7471
28e67f5d
RÁE
74722009-12-04 Rafael Avila de Espindola <espindola@google.com>
7473
7474 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7475 Don't set the data_offset twice.
7476
ae10a101
RÁE
74772009-12-04 Rafael Avila de Espindola <espindola@google.com>
7478
7479 * testsuite/Makefile.in: Regenerate.
7480
f59f41f3
DK
74812009-12-03 Doug Kwan <dougkwan@google.com>
7482
7483 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7484 (Target_arm::do_finalize_sections): Add parameter for symbol table
7485 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7486 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7487 parameter for symbol table pointer.
7488 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7489 an additional parameter for a pointer to symbol table.
7490 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7491 parameter for a symbol table pointer.
7492 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7493 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7494 Ditto.
7495 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7496 parameter for a symbol table pointer.
7497
ca55d848
RÁE
74982009-12-03 Rafael Avila de Espindola <espindola@google.com>
7499
7500 * incremental.cc (Incremental_inputs_header)
7501 (Incremental_inputs_header_write, Incremental_inputs_entry)
7502 (Incremental_inputs_entry_write): Move ...
7503 * incremental.h (Incremental_inputs_header)
7504 (Incremental_inputs_header_write, Incremental_inputs_entry)
7505 (Incremental_inputs_entry_write): here.
7506
3aec4f9c
RÁE
75072009-12-02 Rafael Avila de Espindola <espindola@google.com>
7508
7509 * incremental.cc (make_sized_incremental_binary): Set the target.
7510 Error if it is incompatible.
7511 * output.h (Output_file): Add filename method.
7512
9c0ae74d
RÁE
75132009-12-02 Rafael Avila de Espindola <espindola@google.com>
7514
7515 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7516 from the get_* methods.
7517
a45500ae
RÁE
75182009-12-02 Rafael Avila de Espindola <espindola@google.com>
7519
7520 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7521 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7522 Write 0 for the data_offset of scripts.
7523
325e6408
RÁE
75242009-12-02 Rafael Avila de Espindola <espindola@google.com>
7525
7526 * testsuite/Makefile.am: Add the incremental_test.sh test.
7527 * testsuite/incremental_test.sh: New.
7528 * testsuite/incremental_test_1.c: New.
7529 * testsuite/incremental_test_2.c: New.
7530
954c3e2e
RÁE
75312009-12-01 Rafael Avila de Espindola <espindola@google.com>
7532
7533 * incremental-dump.cc (main): Fix typos.
7534
f8086623
RÁE
75352009-11-27 Rafael Avila de Espindola <espindola@google.com>
7536
7537 PR gold/11025
7538 * incremental-dump.cc (main): Use llu to print 64 bit values.
7539
3b0dd6ac
L
75402009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7541 H.J. Lu <hongjiu.lu@intel.com>
7542
7543 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7544 $(LIBDL).
7545 (incremental_dump_LDADD): Likewise.
7546 * Makefile.in: Regenerated.
7547
a6d1ef57 75482009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 7549
a6d1ef57
DK
7550 Revert:
7551
7552 2009-11-25 Doug Kwan <dougkwan@google.com>
7553
7554 * arm.cc (Target_arm::Target_arm): Move method definition
7555 outside of class definition. Add code to handle
7556 --target1-rel, --target1-abs and --target2= options.
7557 (Target_arm::get_reloc_reloc_type): Change method to be
7558 non-static and const.
7559 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7560 New data member declaration.
7561 (Target_arm::Scan::local, Target_arm::Scan::global,
7562 Target_arm::Relocate::relocate,
7563 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7564 Adjust call to Target_arm::get_real_reloc_type.
7565 (Target_arm::get_real_reloc_type): Use command line options
7566 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7567 * options.h (--target1-rel, --target1-abs, --target2): New
7568 ARM-only options.
7569
50aeb7d4
DK
75702009-11-25 Doug Kwan <dougkwan@google.com>
7571
7572 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7573 class definition. Add code to handle --target1-rel, --target1-abs
7574 and --target2= options.
7575 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7576 and const.
7577 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7578 member declaration.
7579 (Target_arm::Scan::local, Target_arm::Scan::global,
7580 Target_arm::Relocate::relocate,
7581 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7582 call to Target_arm::get_real_reloc_type.
7583 (Target_arm::get_real_reloc_type): Use command line options to
7584 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7585 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7586 options.
7587
51938283
DK
75882009-11-25 Doug Kwan <dougkwan@google.com>
7589
7590 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7591 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7592 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7593 formatting.
7594 (Arm_relocate_functions::thm_call): Replace body with a call to
7595 Arm_relocate_functions::thumb_branch_common.
7596 (Arm_relocate_functions::thm_jump24,
7597 Arm_relocate_functions::thm_xpc22): New method definitions.
7598 (Arm_relocate_functions::thumb_branch_common): New method definition.
7599 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7600 operator.
7601 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7602 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7603
e2b8f3c4
RÁE
76042009-11-24 Rafael Avila de Espindola <espindola@google.com>
7605
7606 * Makefile.am: Build incremental-dump
7607 * Makefile.in: Regenerate.
7608 * incremental-dump.cc: New.
7609 * incremental.cc (Incremental_inputs_header_data,
7610 Incremental_inputs_entry_data): Move to incremental.h
7611 * incremental.h: (Incremental_inputs_header_data,
7612 Incremental_inputs_entry_data): Move from incremental.cc
7613
bcba9aec
RÁE
76142009-11-24 Rafael Avila de Espindola <espindola@google.com>
7615
7616 * incremental.cc (Incremental_inputs_header,
7617 Incremental_inputs_header_write, Incremental_inputs_entry,
7618 Incremental_inputs_entry_write): Add a typedef with the data type.
7619
7c3afe08
RÁE
76202009-11-24 Rafael Avila de Espindola <espindola@google.com>
7621
7622 * incremental.cc (Incremental_inputs_header,
7623 Incremental_inputs_header_write, Incremental_inputs_entry,
7624 Incremental_inputs_entry_write): Update comment about which
7625 type has the filed descriptions.
7626
d204b6e9
DK
76272009-11-15 Doug Kwan <dougkwan@google.com>
7628
7629 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7630 (Arm_relocate_functions::arm_branch_common): Change method defintion
7631 in class definition to a method declaration and update list of formal
7632 parameters.
7633 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7634 Arm_relocation_functions::jump24): Adjust call to
7635 Arm_relocate_functions::arm_branch_common. Update list of formal
7636 parameters.
7637 (Arm_relocate_functions::xpc25): New method definition.
7638 (Arm_relocate_functions::arm_branch_common): Move method defintion
7639 out from class definition. Use stubs for mode-switching and extending
7640 branch ranges.
7641 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7642 specially. Change code to enable use of stubs in ARM branches.
7643
43d12afe
DK
76442009-11-10 Doug Kwan <dougkwan@google.com>
7645
7646 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7647 in method declaration.
7648 (Target_arm::relocate_stub): New method declaration.
7649 (Target_arm::default_target): Change to return a pointer instead of
7650 a const reference.
7651 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7652 Target_arm::default_target.
7653 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7654 method definition.
7655 (Target_arm::relocate_section): Adjust view.
7656 (Target_arm::relocate_stub): New method definition.
7657
ac33a407
DK
76582009-11-10 Doug Kwan <dougkwan@google.com>
7659
7660 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7661 a format warning.
7662 * incremental.cc (open_incremental_binary): Initialized local
7663 variables to avoid warnings.
7664 * object.cc (make_elf_object): Ditto.
7665 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7666 a format warning.
e1df38aa 7667
88ee28e9
L
7668009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7669
7670 PR gold/10930
7671 * testsuite/plugin_test.c: Include "config.h".
7672
2daedcd6
DK
76732009-11-09 Doug Kwan <dougkwan@google.com>
7674
7675 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7676 (arm_symbol_value): Remove.
7677 (Arm_relocate_functions::arm_branch_common,
7678 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7679 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7680 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7681 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7682 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7683 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7684 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7685 Arm_relocate_functions::thm_mobw_abs_nc,
7686 Arm_relocate_functions::thm_mov_abs,
7687 Arm_relocate_functions::movw_prel_nc,
7688 Arm_relocate_functions::thm_movt_abs,
7689 Arm_relocate_functions::movt_prel,
7690 Arm_relocate_functions::thm_movw_prel_nc,
7691 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7692 (Target_arm::Relocate::relocate): Only decompose address into two
7693 parts if relocation type uses the thumb-bit and pass the actual
7694 bit instead of a flag indicating that the thumb-bit is used. Adjust
7695 calls to methods in Arm_relocate_functions for this change.
7696
1276bc89 76972009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
7698
7699 PR 10925
7700 * reloc.cc: Instantiate
7701 Sized_relobj::initialize_input_to_output_maps and
7702 Sized_relobj:free_input_to_output_maps.
7703
e53ad1b5
ILT
77042009-11-06 Ian Lance Taylor <iant@google.com>
7705
7706 PR 10876
7707 * defstd.cc (in_segment): Set only_if_ref true for "end".
7708
eb44217c
DK
77092009-11-06 Doug Kwan <dougkwan@google.com>
7710
7711 * arm.cc (class Reloc_stub): Correct a comment.
7712 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7713 (Target_arm::scan_section_for_stubs): New method declaration.
7714 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7715 Change methods from private to protected.
7716 (Target_arm::do_may_relax): New method definition.
7717 (Target_arm::do_relax, Target_arm::group_sections,
7718 Target_arm::scan_reloc_for_stub,
7719 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7720 (Target_arm::arm_input_section_map_): New data member declaration.
7721 (Target_arm::scan_reloc_for_stub,
7722 Target_arm::scan_reloc_section_for_stubs,
7723 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7724 Target_arm::do_relax): New method definitions.
7725
5d329b7d
ILT
77262009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7727
7728 * configure.ac: Check for (struct stat)::st_mtim
7729 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7730 * config.in: Regenerate.
7731 * configure: Regenerate.
7732
96a0d71b
ILT
77332009-11-05 Ian Lance Taylor <iant@google.com>
7734
7735 PR 10910
7736 * output.cc (Output_segment::add_output_section): Add missing
7737 return statement.
7738
594c8e5e
ILT
77392009-11-04 Ian Lance Taylor <iant@google.com>
7740
7741 PR 10880
7742 * object.h (class Object): Add is_needed and set_is_needed
7743 methods. Add is_needed_ field. Make bool fields into bitfields.
7744 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7745 defined in a dynamic object and referenced by a regular object,
7746 set is_needed for the dynamic object.
7747 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7748 if the file is marked with as_needed and it is not needed.
7749
22b127cc
ILT
77502009-11-04 Ian Lance Taylor <iant@google.com>
7751
7752 PR 10887
7753 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7754 tags if data is discarded by linker script.
7755 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7756 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7757 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7758 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7759
f5c870d2
ILT
77602009-11-04 Ian Lance Taylor <iant@google.com>
7761
7762 * layout.cc (Layout::get_output_section): Add is_interp and
7763 is_dynamic_linker_section parameters. Change all callers.
7764 (Layout::choose_output_section): Likewise.
7765 (Layout::make_output_section): Likewise.
7766 (Layout::add_output_section_data): Add is_dynamic_linker_section
7767 parameter. Change all callers.
7768 * layout.h (class Layout): Update declarations.
7769 * output.h (class Output_section): Add is_interp, set_is_interp,
7770 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7771 Add is_interp_, is_dynamic_linker_section_ fields. Change
7772 generate_code_fills_at_write_ to a bitfield.
7773 * output.cc (Output_section::Output_sections): Initialize new
7774 fields.
7775 (Output_segment::add_output_section): Add do_sort parameter.
7776 Change all callers.
7777
1ae4d23b
ILT
77782009-11-03 Ian Lance Taylor <iant@google.com>
7779
7780 PR 10860
7781 * options.h (class General_options): Add --warn-common.
7782 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7783 merging two common symbols.
7784 (Symbol_table::should_override): Handle --warn-common when merging
7785 a common symbol with a defined symbol. Use report_resolve_problem
7786 for multiple definitions.
7787 (Symbol_table::report_resolve_problem): New function.
7788 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7789
55da9579
DK
77902009-11-03 Doug Kwan <dougkwan@google.com>
7791
7792 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7793 stub_factory_.
7794 (Target_arm::stub_factory): New method definition.
7795 (Target_arm::new_arm_input_section,
7796 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7797 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 7798 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
7799 New type definitions.
7800 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7801 member declarations.
7802 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7803 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7804 New method definitions.
7805
37a9ac43
ILT
78062009-11-03 Ian Lance Taylor <iant@google.com>
7807
7808 * options.h (class General_options): Add --warn_constructors.
7809
b3d6a3d4
ILT
78102009-11-03 Ian Lance Taylor <iant@google.com>
7811
7812 PR 10893
7813 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7814 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7815
934b01dd
ILT
78162009-11-03 Ian Lance Taylor <iant@google.com>
7817
7818 PR 10895
7819 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7820 --msgid-bugs-address.
7821 (install-pdf): New target.
7822 (install-data_yes): Look up one directory to find mkinstalldirs.
7823
03c1939b
L
78242009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7825
7826 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7827 tree.
7828
ebd95253
DK
78292009-10-30 Doug Kwan <dougkwan@google.com>
7830
7831 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7832
e9bbb538
DK
78332009-10-30 Doug Kwan <dougkwan@google.com>
7834
7835 * arm.cc (Stub_addend_reader): New struct template definition
7836 and partial specializations.
7837 (Stub_addend_reader::operator()): New method definition for a
7838 partially specialized template.
7839
d5b40221
DK
78402009-10-30 Doug Kwan <dougkwan@google.com>
7841
7842 * arm.cc (Arm_relobj::processor_specific_flags): New method
7843 definition.
7844 (Arm_relobj::do_read_symbols): New method declaration.
7845 (Arm_relobj::processor_specific_flags_): New data member declaration.
7846 (Arm_dynobj): New class definition.
7847 (Target_arm::do_finalize_sections): Add input_objects parameter.
7848 (Target_arm::do_adjust_elf_header): New method declaration.
7849 (Target_arm::are_eabi_versions_compatible,
7850 (Target_arm::merge_processor_specific_flags): New method declaration.
7851 (Target_arm::do_make_elf_object): New overloaded method definitions
7852 and declaration.
7853 (Arm_relobj::do_read_symbols): New method definition.
7854 (Arm_dynobj::do_read_symbols): Ditto.
7855 (Target_arm::do_finalize_sections): Add input_objects parameters.
7856 Merge processor-specific flags from all input objects.
7857 (Target_arm::are_eabi_versions_compatible,
7858 Target_arm::merge_processor_specific_flags,
7859 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7860 New method definitions.
7861 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7862 Input_objects pointer type parameter.
7863 * layout.cc (Layout::finalize): Pass input objects to target's.
7864 finalize_sections function.
7865 * output.cc (Output_file_header::do_sized_write): Set ELF file
7866 header's processor-specific flags.
7867 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7868 Input_objects pointer type parameter.
7869 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7870 * target.h (Input_objects): New forward class declaration.
7871 (Target::processor_specific_flags,
7872 Target::are_processor_specific_flags_sect): New method definitions.
7873 (Target::finalize_sections): Add input_objects parameter.
7874 (Target::Target): Initialize processor_specific_flags_ and
7875 are_processor_specific_flags_set_.
7876 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7877 parameter.
7878 (Target::set_processor_specific_flags): New method definition.
7879 (Target::processor_specific_flags_,
7880 Target::are_processor_specific_flags_set_): New data member
7881 declarations.
7882 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7883 Input_objects pointer type parameter.
7884
ebabffbd
DK
78852009-10-30 Doug Kwan <dougkwan@google.com>
7886
7887 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7888
ad0f2072
ILT
78892009-10-28 Ian Lance Taylor <iant@google.com>
7890
7891 * object.h (class Relobj): Drop options parameter from
7892 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7893 do_scan_relocs, do_relocate. Change all callers.
7894 (class Sized_relobj): Drop options parameters from
7895 do_gc_process_relocs, do_scan_relocs, do_relocate,
7896 do_relocate_sections, relocate_sections, emit_relocs_scan,
7897 emit_relocs_scan_reltype. Change all callers.
7898 (struct Relocate_info): Remove options field and all references to
7899 it.
7900 * reloc.h (class Read_relocs): Remove options constructor
7901 parameter and options_ field. Change all callers.
7902 (class Gc_process_relocs, class Scan_relocs): Likewise.
7903 (class Relocate_task): Likewise.
7904 * target-reloc.h (scan_relocs): Remove options parameter. Change
7905 all callers.
7906 (scan_relocatable_relocs): Likewise.
7907 * target.h (class Sized_target): Remove options parameter from
7908 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7909 all callers.
7910 * gc.h (gc_process_relocs): Remove options parameter. Change all
7911 callers.
7912 * arm.cc: Update functions to remove options parameters.
7913 * i386.cc: Likewise.
7914 * powerpc.cc: Likewise.
7915 * sparc.cc: Likewise.
7916 * x86_64.cc: Likewise.
7917 * testsuite/testfile.cc: Likewise.
7918
8ffa3667
DK
79192009-10-28 Doug Kwan <dougkwan@google.com>
7920
7921 * arm.cc (Arm_relobj): New class definition.
e1df38aa 7922 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
7923 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7924 New method definitions.
7925
40f36857
CC
79262009-10-28 Cary Coutant <ccoutant@google.com>
7927
7928 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7929 (Plugin::cleanup_done_): New member.
7930 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7931 (Plugin_manager::cleanup_done_): Remove.
7932 (Plugin_manager::add_input_file): Edit error message.
7933 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7934 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7935
2c849493
ILT
79362009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7937
7938 * fileread.cc: (File_read::View::~View): Use the new
7939 data_ownership_ filed.
7940 (File_read::~File_read): Dispose the new whole_file_view_.
7941 (File_read::open): Mmap the whole file if needed.
7942 (File_read::open): Use whole_file_view_ instead of contents_.
7943 (File_read::find_view): Use whole_file_view_ if applicable.
7944 (File_read::do_read): Use whole_file_view_ instead of contents_.
7945 (File_read::make_view): Use whole_file_view_ instead of contents_,
7946 update File_read::View::View call.
7947 (File_read::find_or_make_view): Update File_read::View::View
7948 call.
7949 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7950 remove contents_
7951 (File_read::View::Data_ownership): New enum.
7952 (File_read::View::View): Replace bool mapped_ with Data_ownership
7953 argument.
7954 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7955 (File_read::View::data_ownership_): New field.
7956 (File_read::contents_): Remove (replaced by whole_file_view_).
7957 (File_read::whole_file_view_): New field.
7958 * options.h (class General_options): Add --keep-files-mapped.
7959
24998053
CC
79602009-10-27 Cary Coutant <ccoutant@google.com>
7961
7962 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7963 * testsuite/Makefile.am (plugin_test_5): New test case.
7964 * testsuite/Makefile.in: Regenerate.
7965
72adc4fa
DK
79662009-10-25 Doug Kwan <dougkwan@google.com>
7967
7968 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7969 from private to protected to allow access by child class.
7970 (Sized_relobj::do_relocate_sections): New method declaration.
7971 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 7972 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
7973 Sized_relobj::relocate_sections. Instantiate template explicitly
7974 for different target sizes and endianity.
7975
07f508a2
DK
79762009-10-24 Doug Kwan <dougkwan@google.com>
7977
7978 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7979 (Arm_input_section::as_arm_input_section): New method.
7980 (Arm_output_section): New class definition.
7981 (Arm_output_section::create_stub_group,
7982 Arm_output_section::group_sections): New method definitions.
7983
10ad9fe5
DK
79842009-10-22 Doug Kwan <dougkwan@google.com>
7985
7986 * arm.cc (Arm_input_section): New class definition.
7987 (Arm_input_section::init, Arm_input_section:do_write,
7988 Arm_input_section::set_final_data_size,
7989 Arm_input_section::do_reset_address_and_file_offset): New method
7990 definitions.
7991
56ee5e00
DK
79922009-10-21 Doug Kwan <dougkwan@google.com>
7993
7994 * arm.cc (Stub_table, Arm_input_section): New forward class
7995 declarations.
7996 (Stub_table): New class defintion.
7997 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7998 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7999 New method definition.
8000
b569affa
DK
80012009-10-21 Doug Kwan <dougkwan@google.com>
8002
8003 * arm.cc: Update copyright comments.
8004 (Target_arm): New forward class template declaration.
8005 (Arm_address): New type.
8006 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8007 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8008 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8009 constants.
8010 (Insn_template): Same.
8011 (DEF_STUBS): New macro.
8012 (Stub_type): New enum type.
8013 (Stub_template): New class definition.
8014 (Stub): Same.
8015 (Reloc_stub): Same.
8016 (Stub_factory): Same.
8017 (Target_arm::Target_arm): Initialize may_use_blx_ and
8018 should_force_pic_veneer_.
8019 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8020 Target_arm::should_force_pic_veneer,
8021 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8022 Target_arm::using_thumb_only, Target_arm:;default_target): New
8023 method defintions.
8024 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8025 New data member declarations.
8026 (Insn_template::size, Insn_template::alignment): New method defintions.
8027 (Stub_template::Stub_template): New method definition.
8028 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8029 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8030 (Stub_factory::Stub_factory): New method definition.
8031 * gold.h (string_hash): New template.
8032 * output.h (Input_section_specifier::hash_value): Use
8033 gold::string_hash.
8034 (Input_section_specifier::string_hash): Remove.
8035 * stringpool.cc (Stringpool_template::string_hash): Use
8036 gold::string_hash.
8037
6c172549
DK
80382009-10-20 Doug Kwan <dougkwan@google.com>
8039
8040 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8041 symbols of relaxed input sections.
8042 * output.h (Output_section::find_relaxed_input_section): Make
8043 method public.
8044
c5617f2f
DK
80452009-10-16 Doug Kwan <dougkwan@google.com>
8046
8047 * dynobj.cc (Versions::Versions): Initialize version_script_.
8048 Only insert base version symbol definition for a shared object
8049 if version script defines any version versions.
8050 (Versions::define_base_version): New method definition.
8051 (Versions::add_def): Check that base version is not needed.
8052 (Versions::add_need): Define base version lazily.
8053 * dynobj.h (Versions::define_base_version): New method declaration.
8054 (Versions::needs_base_version_): New data member declaration.
8055 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8056 (check_DATA): Add no_version_test.stdout.
8057 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8058 New make rules.
8059 * testsuite/Makefile.in: Regenerate.
8060 * testsuite/no_version_test.c: New file.
8061 * testsuite/no_version_test.sh: Ditto.
8062
3c12dcdb
DK
80632009-10-16 Doug Kwan <dougkwan@google.com>
8064
8065 * expression.cc (class Segment_start_expression): New class definition.
8066 (Segment_start_expression::value): New method definition.
8067 (script_exp_function_segment_start): Return a new
8068 Segment_start_expression.
8069 * gold/script-c.h (script_saw_segment_start_expression): New function
8070 prototype.
8071 * script-sections.cc (Script_sections::Script_sections): Initialize
8072 SAW_SEGMENT_START_EXPRESSION_ to false.
8073 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8074 and -Tbbs options to specify section addresses if given in
8075 command line and no SEGMENT_START expression is seen in a script.
8076 * script-sections.h (Script_sections::saw_segment_start_expression,
8077 Script_sections::set_saw_segment_start_expression): New method
8078 definition.
8079 (Script_sections::saw_segment_start_expression_): New data member
8080 declaration.
8081 * script.cc (script_saw_segment_start_expression): New function.
8082 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8083 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8084 script_test_7.sh and script_test_8.sh.
8085 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8086 script_test_8.stdout.
8087 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8088 (script_test_6, script_test_6.stdout, script_test_7,
8089 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8090 * Makefile.in: Regenerate.
8091 * testsuite/script_test_6.sh: New file.
8092 * testsuite/script_test_6.t: Same.
8093 * testsuite/script_test_7.sh: Same.
8094 * testsuite/script_test_7.t: Same.
8095 * testsuite/script_test_8.sh: Same.
8096
64b1ae37
DK
80972009-10-16 Doug Kwan <dougkwan@google.com>
8098
8099 * output.cc (Output_segment::set_section_list_address): Cast
8100 expressions to unsigned long long type to avoid format warnings.
8101
661be1e2
ILT
81022009-10-15 Ian Lance Taylor <iant@google.com>
8103
12edd763 8104 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 8105 dot assignment to script_sections_.
12edd763
ILT
8106 * script-sections.cc (Script_sections::add_dot_assignment):
8107 Initialize if necessary.
8108
68b6574b
ILT
8109 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8110 program headers with no load segment if there is a linker script.
8111
661be1e2
ILT
8112 * layout.cc (Layout::set_segment_offsets): Align the file offset
8113 to the segment aligment for -N or -n with no load segment.
8114 * output.cc (Output_segment::add_output_section): Don't crash if
8115 the first section is a TLS section.
8116 (Output_segment::set_section_list_addresses): Print an error
8117 message if the address moves backward in a linker script.
8118 * script-sections.cc
8119 (Output_section_element_input::set_section_addresses): Don't
8120 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8121 (Orphan_output_section::set_section_addresses): Likewise.
8122
f15f61a7
DK
81232009-10-15 Doug Kwan <dougkwan@google.com>
8124
8125 * layout.cc (Layout::finish_dynamic_section): Generate tags
8126 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8127 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8128 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8129
82bb573a
ILT
81302009-10-14 Ian Lance Taylor <iant@google.com>
8131
8132 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8133 fields.
8134 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8135 data_shdr fields of relinfo.
8136 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8137 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8138 R_386_TLS_LDO_32, adjust based on section flags.
8139 (Target_i386::Relocate::fix_up_ldo): Remove.
8140
374ad285
ILT
81412009-10-13 Ian Lance Taylor <iant@google.com>
8142
8143 Add support for -pie.
8144 * options.h (class General_options): Add -pie and
8145 --pic-executable.
8146 (General_options::output_is_position_independent): Test -pie.
8147 (General_options::output_is_executable): Return true if not shared
8148 and not relocatable.
8149 (General_options::output_is_pie): Remove.
8150 * options.cc (General_options::finalize): Reject incompatible uses
8151 of -pie.
8152 * gold.cc (queue_middle_tasks): A -pie link is not static.
8153 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8154 * symtab.cc (Symbol::final_value_is_known): Return false if
8155 output_is_position_independent.
8156 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8157 output_is_position_independent.
8158 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8159 output_is_position_independent.
8160 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8161 output_is_position_independent.
8162 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8163 two_file_pie_test.
8164 (basic_pie_test.o, basic_pie_test): New targets.
8165 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8166 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8167 (two_file_pie_test): New target.
8168 * testsuite/Makefile.in: Rebuild.
8169 * README: Remove note saying that -pie is not supported.
8170
c6585162
ILT
81712009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8172
8173 * options.h (class General_options): Add -init and -fini.
8174 * layout.cc (Layout::finish_dynamic_section): Emit
8175 given init and fini functions.
8176
032ce4e9
ST
81772009-10-13 Sriraman Tallam <tmsriram@google.com>
8178
8179 * gc.h (gc_process_relocs): Check if icf is enabled using new
8180 function.
8181 * gold.cc (queue_initial_tasks): Likewise.
8182 (queue_middle_tasks): Likewise.
8183 * object.cc (do_layout): Likewise.
8184 * symtab.cc (is_section_folded): Likewise.
8185 * main.cc (main): Likewise.
8186 * reloc.cc (Read_relocs::run): Likewise.
8187 (Sized_relobj::do_scan_relocs): Likewise.
8188 * icf.cc (is_function_ctor_or_dtor): New function.
8189 (Icf::find_identical_sections): Check if function is ctor or dtor when
8190 safe icf is chosen.
8191 * options.h (General_options::icf): Change option to be an enum.
8192 (Icf_status): New enum.
8193 (icf_enabled): New method.
8194 (icf_safe_folding): New method.
8195 (set_icf_status): New method.
8196 (icf_status_): New variable.
8197 * (options.cc) (General_options::finalize): Set icf_status_.
8198 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8199 icf_test and icf_keep_unique_test to use the --icf enum flag.
8200 * testsuite/icf_safe_test.sh: New file.
e1df38aa 8201 * testsuite/icf_safe_test.cc: New file.
032ce4e9 8202
f345227a
ST
82032009-10-12 Sriraman Tallam <tmsriram@google.com>
8204
8205 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8206 includes to gc.h and icf.h.
8207 * arm.cc: Include gc.h.
8208 * gold.cc: Likewise.
8209 * i386.cc: Likewise.
8210 * powerpc.cc: Likewise.
8211 * sparc.cc: Likewise.
8212 * x86_64.cc: Likewise.
8213 * gc.h: Include icf.h.
8214
1c7814ed
ILT
82152009-10-11 Ian Lance Taylor <iant@google.com>
8216
8217 * plugin.cc: Include "gold.h" before other header files.
8218
ae3b5189
CD
82192009-10-10 Chris Demetriou <cgd@google.com>
8220
8221 * options.h (Input_file_argument::Input_file_type): New enum.
8222 (Input_file_argument::is_lib_): Replace with...
8223 (Input_file_argument::type_): New member.
8224 (Input_file_argument::Input_file_argument): Take Input_file_type
8225 'type' rather than boolean 'is_lib' as second argument.
8226 (Input_file_argument::is_lib): Use type_.
8227 (Input_file_argument::is_searched_file): New function.
8228 (Input_file_argument::may_need_search): Handle is_searched_file.
8229 * options.cc (General_options::parse_library): Support -l:filename.
8230 (General_options::parse_just_symbols): Update for Input_file_argument
8231 changes.
8232 (Command_line::process): Likewise.
8233 * archive.cc (Archive::get_file_and_offset): Likewise.
8234 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8235 * script.cc (read_script_file, script_add_file): Likewise.
8236 * fileread.cc (Input_file::Input_file): Likewise.
8237 (Input_file::will_search_for): Handle is_searched_file.
8238 (Input_file::open): Likewise.
8239 * readsyms.cc (Read_symbols::get_name): Likewise.
8240 * testsuite/Makefile.am (searched_file_test): New test.
8241 * testsuite/Makefile.in: Regenerate.
8242 * testsuite/searched_file_test.cc: New file.
8243 * testsuite/searched_file_test_lib.cc: New file.
8244
f3048a1d
ILT
82452009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8246 Ian Lance Taylor <iant@google.com>
8247
8248 * descriptor.cc: Include <cstdio> and "binary-io.h".
8249 (Descriptors::open): Open the files in binary mode always.
8250 * script.cc (Lex::get_token): Treat \r as whitespace.
8251
d4780e57
ILT
82522009-10-09 Ian Lance Taylor <iant@google.com>
8253
8254 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8255
d9a893b8
ILT
82562009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8257 Ian Lance Taylor <iant@google.com>
8258
8259 * configure.ac: Check for readv function also.
8260 * fileread.cc (readv): Define if not HAVE_READV.
8261 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8262 does not exist.
8263 * config.in: Regenerate.
8264 * configure: Regenerate.
8265
c0a62865
DK
82662009-10-09 Doug Kwan <dougkwan@google.com>
8267
8268 * layout.cc (Layout::make_output_section): Call target hook to make
8269 ordinary output section.
8270 (Layout::finalize): Adjust parameter list of call the
8271 Target::may_relax().
8272 * layout.h (class Layout::section_list): New method.
8273 * merge.h (Output_merge_base::entsize): Change visibility to public.
8274 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8275 New methods.
8276 (Output_merge_string::do_is_string): New method.
8277 * object.cc (Sized_relobj::do_setup): renamed from
8278 Sized_relobj::set_up.
8279 * object.h (Sized_relobj::adjust_shndx,
8280 Sized_relobj::initializ_input_to_output_maps,
8281 Sized_relobj::free_input_to_output_maps): Change visibilities to
8282 protected.
8283 (Sized_relobj::setup): Virtualize.
8284 (Sized_relobj::do_setup): New method declaration.
8285 (Sized_relobj::invalidate_section_offset,
8286 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8287 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8288 * options.cc (parse_int): New function.
8289 * options.h (parse_int): New declaration.
8290 (DEFINE_int): New macro.
8291 (stub_group_size): New option.
8292 * output.cc (Output_section::Output_section): Initialize memebers
8293 merge_section_map_, merge_section_by_properties_map_,
8294 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8295 (Output_section::add_input_section): Handled deferred code-fill
8296 generation and remove an old comment.
8297 (Output_section::add_relaxed_input_section): New method definition.
8298 (Output_section::add_merge_input_section): Use merge section by
8299 properties map to speed to search. Update merge section maps
8300 as appropriate.
8301 (Output_section::build_relaxation_map): New method definition.
8302 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8303 Same.
8304 (Output_section::relax_input_section): Renamed to
8305 Output_section::convert_input_sections_to_relaxed_sections and change
8306 interface to take a vector of pointers to relaxed sections.
8307 (Output_section::find_merge_section,
8308 Output_section::find_relaxed_input_section): New method definitions.
8309 (Output_section::is_input_address_mapped,
8310 Output_section::output_offset, Output_section::output_address):
8311 Use output section data maps to speed up searching.
8312 (Output_section::find_starting_output_address): Add comments.
8313 (Output_section::do_write,
8314 Output_section::write_to_postprocessing_buffer): Do code-fill
8315 generation as appropriate.
8316 (Output_section::get_input_sections): Invalidate relaxed input section
8317 map.
8318 (Output_section::restore_states): Adjust type of checkpoint .
8319 Invalidate relaxed input section map.
8320 * output.h (Output_merge_base): New class declaration.
8321 (Input_section_specifier): New class defintion.
8322 (class Output_relaxed_input_section) Change base class to
8323 Output_section_data_build.
8324 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8325 base class initializer.
8326 (Output_section::add_relaxed_input_section): New method declaration.
8327 (Output_section::Input_section): Change visibility to protected.
8328 (Output_section::Input_section::relobj,
8329 Output_section::Input_section::shndx): Handle relaxed input sections.
8330 Output_section::input_sections) Change visibility to protected. Also
8331 define overload to return a non-const pointer.
8332 (Output_section::Merge_section_properties): New class defintion.
8333 (Output_section::Merge_section_by_properties_map,
8334 Output_section::Output_section_data_by_input_section_map,
8335 Output_section::Relaxation_map): New types.
8336 (Output_section::relax_input_section): Rename method to
8337 Output_section::convert_input_sections_to_relaxed_sections and change
8338 interface to take a vector of relaxed section pointers.
8339 (Output_section::find_merge_section,
8340 Output_section::find_relaxed_input_section,
8341 Output_section::build_relaxation_map,
8342 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8343 New method declarations.
8344 (Output_section::merge_section_map_
8345 Output_section::merge_section_by_properties_map_,
8346 Output_section::relaxed_input_section_map_,
8347 Output_section::is_relaxed_input_section_map_valid_,
8348 Output_section::generate_code_fills_at_write_): New data members.
8349 * script-sections.cc
8350 (Output_section_element_input::set_section_addresses): Call
8351 current_data_size and addralign methods of relaxed input sections.
8352 (Orphan_output_section::set_section_addresses): Call current_data_size
8353 and addralign methods of relaxed input sections.
8354 * symtab.cc (Symbol_table::compute_final_value): Extract template
8355 from the body of Symbol_table::sized_finalize_symbol.
8356 (Symbol_table::sized_finalized_symbol): Call
8357 Symbol_table::compute_final_value.
8358 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8359 (Symbol_table::compute_final_value): New templated method declaration.
8360 * target.cc (Target::do_make_output_section): New method defintion.
8361 * target.h (Target::make_output_section): New method declaration.
8362 (Target::relax): Add more parameters for input objects, symbol table
8363 and layout. Adjust call to do_relax.
8364 (Target::do_make_output_section): New method declaration.
8365 (Target::do_relax): Add parameters for input objects, symbol table
8366 and layout.
8367
d446d6c4
ILT
83682009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8369
8370 * pread.c: Include stdio.h.
8371
bc06c745
ILT
83722009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8373
8374 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8375 defined.
8376
75aea3d0
ILT
83772009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8378
8379 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8380 Change read_shndx type to unsigned int.
8381 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8382 int.
8383 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8384 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8385 Change read_shndx type to unsigned int.
8386 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8387 int.
8388 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8389 * layout.cc (Layout::create_symtab_sections): Cast the result of
8390 local_symcount * symsize to off_t in the gold_assert.
8391
be8fcb75
ILT
83922009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8393
8394 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8395 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8396 R_ARM_BASE_ABS.
8397 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8398 (Arm_relocate_functions::thm_abs5): New function.
8399 (Arm_relocate_functions::abs12): New function.
8400 (Arm_relocate_functions::abs16): New function.
8401 (Arm_relocate_functions::base_abs): New function.
8402 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8403 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8404 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8405 R_ARM_BASE_ABS.
8406 (Scan::global): Likewise.
8407 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8408 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8409 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8410 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8411 R_ARM_BASE_ABS.
8412
c2a122b6
ILT
84132009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8414
8415 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8416 (Arm_relocate_functions::movt_prel): New function.
8417 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8418 (Arm_relocate_functions::thm_movt_prel): New function.
8419 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8420 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8421 (Scan::global, Relocate::relocate): Likewise.
8422 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8423
c4aa1e2d
ILT
84242009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8425
8426 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8427 Incremental_checker.
8428 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8429 unsigned int.
8430 (class Incremental_inputs_header): New class.
8431 (Incremental_inputs_header_writer): Edit comment.
8432 (Incremental_inputs_entry): New class.
8433 (Incremental_inputs_entry_writer): Edit comment.
8434 (Sized_incremental_binary::do_find_incremental_inputs_section):
8435 Add *strtab_shndx parameter, fill it.
8436 (Sized_incremental_binary::do_check_inputs): New method.
8437 (Incremental_checker::can_incrementally_link_output_file): Use
8438 Sized_incremental_binary::check_inputs.
8439 (Incremental_inputs::report_command_line): Save command line in
8440 command_line_.
8441 * incremental.h:
8442 (Incremental_binary::find_incremental_inputs_section): New
8443 method.
8444 (Incremental_binary::do_find_incremental_inputs_section): Add
8445 strtab_shndx parameter.
8446 (Incremental_binary::do_check_inputs): New pure virtual method.
8447 (Sized_incremental_binary::do_check_inputs): Declare.
8448 (Incremental_checker::Incremental_checker): Add incremental_inputs
8449 parameter, use it to initialize incremental_inputs_.
8450 (Incremental_checker::incremental_inputs_): New field.
8451 (Incremental_checker::command_line): New method.
8452 (Incremental_checker::inputs): New method.
8453 (Incremental_checker::command_line_): New field.
8454
c549a694
ILT
84552009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8456
8457 * incremental.cc: Include <cstdarg> and "target-select.h".
8458 (vexplain_no_incremental): New function.
8459 (explain_no_incremental): New function.
8460 (Incremental_binary::error): New method.
8461 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8462 method.
8463 (make_sized_incremental_binary): New function.
8464 (open_incremental_binary): New function.
8465 (can_incrementally_link_file): Add checks if output is ELF and has
8466 inputs section.
8467 * incremental.h: Include "elfcpp_file.h" and "output.h".
8468 (Incremental_binary): New class.
8469 (Sized_incremental_binary): New class.
8470 (open_incremental_binary): Declare.
8471 * object.cc (is_elf_object): Use
8472 elfcpp::Elf_recognizer::is_elf_file.
8473 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8474 * output.h (Output_file::filesize): New method.
8475
fd3c5f0b
ILT
84762009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8477
8478 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8479 New function.
8480 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8481 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8482 function.
8483 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8484 function.
8485 (Arm_relocate_functions::movw_abs_nc): New function.
8486 (Arm_relocate_functions::movt_abs): New function.
8487 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8488 (Arm_relocate_functions::thm_movt_abs): New function.
8489 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8490 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8491 (Scan::global): Likewise.
8492 (Relocate::relocate): Likewise.
8493 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8494
7f5309a5
ILT
84952009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8496
8497 * arm.cc (Arm_relocate_functions::got_prel) New function.
8498 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8499 (Relocate::relocate): Likewise.
8500 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8501
364c7fa5
ILT
85022009-10-06 Ian Lance Taylor <iant@google.com>
8503
8504 * options.h (class General_options): Define
8505 split_stack_adjust_size parameter.
8506 * object.h (class Object): Add uses_split_stack_ and
8507 has_no_split_stack_ fields. Add uses_split_stack and
8508 has_no_split_stack accessor functions. Declare
8509 handle_split_stack_section.
8510 (class Reloc_symbol_changes): Define.
8511 (class Sized_relobj): Define Function_offsets. Declare
8512 split_stack_adjust, split_stack_adjust_reltype, and
8513 find_functions.
8514 * object.cc (Object::handle_split_stack_section): New function.
8515 (Sized_relobj::do_layout): Call handle_split_stack_section.
8516 * dynobj.cc (Sized_dynobj::do_layout): Call
8517 handle_split_stack_section.
8518 * reloc.cc (Sized_relobj::relocate_sections): Call
8519 split_stack_adjust for executable sections in split_stack
8520 objects. Pass reloc_map to relocate_section.
8521 (Sized_relobj::split_stack_adjust): New function.
8522 (Sized_relobj::split_stack_adjust_reltype): New function.
8523 (Sized_relobj::find_functions): New function.
8524 * target-reloc.h: Include "object.h".
8525 (relocate_section): Add reloc_symbol_changes parameter. Change
8526 all callers.
8527 * target.h (class Target): Add calls_non_split method. Declare
8528 do_calls_non_split virtual method. Declare match_view and
8529 set_view_to_nop.
8530 * target.cc: Include "elfcpp.h".
8531 (Target::do_calls_non_split): New function.
8532 (Target::match_view): New function.
8533 (Target::set_view_to_nop): New function.
8534 * gold.cc (queue_middle_tasks): Give an error if mixing
8535 split-stack and non-split-stack objects with -r.
8536 * i386.cc (Target_i386::relocate_section): Add
8537 reloc_symbol_changes parameter.
8538 (Target_i386::do_calls_non_split): New function.
8539 * x86_64.cc (Target_x86_64::relocate_section): Add
8540 reloc_symbol_changes parameter.
8541 (Target_x86_64::do_calls_non_split): New function.
8542 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8543 parameter.
8544 * powerpc.cc (Target_powerpc::relocate_section): Add
8545 reloc_symbol_changes parameter.
8546 * sparc.cc (Target_sparc::relocate_section): Add
8547 reloc_symbol_changes parameter.
8548 * configure.ac: Call AM_CONDITIONAL for the default target.
8549 * configure: Rebuild.
8550 * testsuite/Makefile.am (TEST_AS): New variable.
8551 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8552 (check_DATA): Add split_i386 and split_x86_64 files.
8553 (SPLIT_DEFSYMS): Define.
8554 (split_i386_[1234n].o): New targets.
8555 (split_i386_[124]): New targets.
8556 (split_i386_[1234r].stdout): New targets.
8557 (split_x86_64_[1234n].o): New targets.
8558 (split_x86_64_[124]): New targets.
8559 (split_x86_64_[1234r].stdout): New targets.
8560 (MOSTLYCLEANFILES): Add new executables.
8561 * testsuite/split_i386.sh: New file.
8562 * testsuite/split_x86_64.sh: New file.
8563 * testsuite/split_i386_1.s: New file.
8564 * testsuite/split_i386_2.s: New file.
8565 * testsuite/split_i386_3.s: New file.
8566 * testsuite/split_i386_4.s: New file.
8567 * testsuite/split_i386_n.s: New file.
8568 * testsuite/split_x86_64_1.s: New file.
8569 * testsuite/split_x86_64_2.s: New file.
8570 * testsuite/split_x86_64_3.s: New file.
8571 * testsuite/split_x86_64_4.s: New file.
8572 * testsuite/split_x86_64_n.s: New file.
8573 * testsuite/testfile.cc (Target_test): Update relocation_section
8574 function.
8575 * testsuite/Makefile.in: Rebuild.
8576
e8a9fcda
ILT
85772009-10-06 Ian Lance Taylor <iant@google.com>
8578
8579 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8580 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8581 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8582 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8583 the address on ldo_addrs_.
8584 (Target_i386::Relocate::fix_up_ldo): New function.
8585
e99daf92
ILT
85862009-10-06 Rafael Espindola <espindola@google.com>
8587
8588 * plugin.cc (add_input_library): New.
8589 (Plugin::load): Add add_input_library to tv.
8590 (Plugin_manager::add_input_file): Add the is_lib argument.
8591 (add_input_file): Update call to Plugin_manager::add_input_file.
8592 (add_input_library): New.
8593 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8594
966d4097
DK
85952009-09-30 Doug Kwan <dougkwan@google.com>
8596
8597 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8598 symbol and call Symbol::may_need_copy_reloc to determine if
8599 a copy reloc is needed.
8600 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8601 nocopyreloc is given in command line.
8602 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8603 given in command line.
8604 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8605 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8606 of the removed Target_i386::may_need_copy_reloc.
8607 * options.h (copyreloc): New option with default value false.
8608 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8609 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8610 instead of the removed Target_powerpc::may_need_copy_reloc.
8611 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8612 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8613 instead of the removed Target_sparc::may_need_copy_reloc.
8614 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8615 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8616 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8617 instead of the removed Target_x86_64::may_need_copy_reloc.
8618
029ba973
ILT
86192009-09-30 Ian Lance Taylor <iant@google.com>
8620
8621 * object.h (class Object): Remove target_ field, and target,
8622 sized_target, and set_target methods.
8623 (Object::sized_target): Remove.
8624 (class Sized_relobj): Update declarations. Remove sized_target.
8625 * object.cc (Sized_relobj::setup): Remove target parameter.
8626 Change all callers.
8627 (Input_objects::add_object): Don't do anything with the target.
8628 (make_elf_sized_object): Add punconfigured parameter. Change all
8629 callers. Set or test parameter target.
8630 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8631 Change all callers.
8632 * parameters.cc (Parameters::set_target): Change parameter type to
8633 be non-const.
8634 (Parameters::default_target): Remove.
8635 (set_parameters_target): Change parameter type to be non-const.
8636 (parameters_force_valid_target): New function.
8637 (parameters_clear_target): New function.
8638 * parameters.h (class Parameters): Update declarations. Remove
8639 default_target method. Add sized_target and clear_target
8640 methods. Change target_ to be non-const.
8641 (set_parameters_target): Update declaration.
8642 (parameters_force_valid_target): Declare.
8643 (parameters_clear_target): Declare.
8644 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8645 as NULL if we aren't searching.
8646 (Add_symbols::run): Don't check for compatible target.
8647 * fileread.cc (Input_file::open_binary): Call
8648 parameters_force_valid_target.
8649 * gold.cc (queue_middle_tasks): Likewise.
8650 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8651 set_target on object.
8652 * dynobj.h (class Sized_dynobj): Update declarations.
8653 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8654 make_elf_object returns NULL.
8655 (Archive::include_member): Don't check whether object target is
8656 compatible.
8657 * output.cc (Output_section::add_input_section): Get target from
8658 parameters.
8659 (Output_section::relax_input_section): Likewise.
8660 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8661 parameters.
8662 (Sized_relobj::do_scan_relocs): Likewise.
8663 (Sized_relobj::relocate_sections): Likewise.
8664 * resolve.cc (Symbol_table::resolve): Likewise.
8665 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8666 parameter. Change all callers.
8667 (Symbol_table::add_from_object): Get target from parameters.
8668 (Symbol_table::add_from_relobj): Don't check object target.
8669 (Symbol_table::add_from_dynobj): Likewise.
8670 (Symbol_table::define_special_symbol): Get target from
8671 parameters.
8672 * symtab.h (class Symbol_table): Update declaration.
8673 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8674 parameter. Change all callers. Clear parameter target.
8675 (Binary_test): Test target here.
8676 * testsuite/object_unittest.cc (gold_testsuite): Remove
8677 target_test_pointer parameter. Change all callers.
8678 (Object_test): Test target here.
8679
a6a22b83
ILT
86802009-09-26 Ian Lance Taylor <iant@google.com>
8681
8682 * testsuite/initpri1.c: Don't try to use constructor priorities if
8683 compiling with gcc before 4.3.
8684
6a8f49fe
ILT
86852009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8686
8687 * testsuite/retain_symbols_file_test.sh (check_present): Change
8688 output file name to retain_symbols_file_test.stdout.
8689 (check_absent): Likewise.
8690
8c604651
CS
86912009-09-18 Craig Silverstein <csilvers@google.com>
8692
8693 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8694 * options.cc: Include <cerrno> and <fstream>.
8695 (General_options::finalize): Parse -retain-symbols-file tag.
8696 * options.h: New flag.
8697 (General_options): New method should_retain_symbol, new
8698 variable symbols_to_retain.
8699 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8700 should_retain_symbol map.
8701 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8702 * testsuite/Makefile.in: Regenerate.
8703 * testsuite/retain_symbols_file_test.sh: New file.
8704
ca58b19f
NC
87052009-09-18 Nick Clifton <nickc@redhat.com>
8706
8707 * po/es.po: Updated Spanish translation.
8708
20e6d0d6
DK
87092009-09-17 Doug Kwan <dougkwan@google.com>
8710
8711 * debug.h (DEBUG_RELAXATION): New constant.
8712 (DEBUG_ALL): Add DEBUG_RELAXATION.
8713 (debug_string_to_enum): Add relaxation debug option.
8714 * layout.cc
8715 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8716 Layout::Relaxation_debug_check::read_sections,
8717 Layout::Relaxation_debug_check::read_sections): New method definitions.
8718 (Layout::Layout): Initialize data members
8719 record_output_section_data_from_scrips_,
8720 script_output_section_data_list_ and relaxation_debug_check_.
8721 (Layout::save_segments, Layout::restore_segments,
8722 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8723 Layout::relaxation_loop_body): New method definitions.
8724 (Layout::finalize): Support relaxation. Move section layout code to
8725 Layout::relaxation_loop_body.
8726 (Layout::set_asection_address_from_script): Move code for orphan
8727 section placement out.
8728 (Layout::place_orphan_sections_in_script): New method definition.
8729 * layout.h (Output_segment_headers, Output_file_header):
8730 New forward class declarations.
8731 (Layout::~Layout): Define.
8732 (Layout::new_output_section_data_from_script): New method definition.
8733 (Layout::place_orphan_sections_in_script): New method declaration.
8734 (Layout::Segment_states): New type declaration.
8735 (Layout::save_segments, Layout::restore_segments,
8736 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8737 Layout::relaxation_loop_body): New method declarations.
8738 (Layout::Output_section_data_list): New type declaration.
8739 (Layout::Relaxation_debug_check): New class definition.
8740 (Layout::record_output_section_data_from_script_,
8741 Layout::script_output_section_data_list_, Layout::segment_states_,
8742 Layout::relaxation_debug_check_): New data members.
8743 * output.cc: (Output_section_headers::do_size): New method definition.
8744 (Output_section_headers::Output_section_headers): Move size
8745 computation to Output_section_headers::do_size.
8746 (Output_segment_headers::do_size): New method definition.
e1df38aa 8747 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
8748 Output_file_header::do_size and call it.
8749 (Output_file_header::do_size): New method definition.
8750 (Output_data_group::Output_data_group): Adjust call to
8751 Output_section_data.
8752 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8753 (Output_symtab_xindex::do_write): Add array bound check.
8754 (Output_section::Input_section::print_to_mapfile): Handle
8755 RELAXED_INPUT_SECTION_CODE.
8756 (Output_section::Output_section): Initialize data member checkpoint_.
8757 (Output_section::~Output_section): Delete checkpoint object pointed
8758 by checkpoint_.
8759 (Output_section::add_input_section): Always add an Input_section if
8760 relaxing.
8761 (Output_section::add_merge_input_section): Add assert.
8762 (Output_section::relax_input_section): New method definition.
8763 (Output_section::set_final_data_size): Set load address to zero for
8764 an unallocated section.
8765 (Output_section::do_address_and_file_offset_have_reset_values):
8766 New method definition.
8767 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8768 Handle relaxed input section.
8769 (Output_section::sort_attached_input_sections): Checkpoint input
8770 section list lazily.
8771 (Output_section::get_input_sections): Change type of input_sections to
8772 list of Simple_input_section pointers. Checkpoint input section list
8773 lazily. Also handle relaxed input sections.
8774 (Output_section::add_input_section_for_script): Take a reference to
8775 a Simple_input_section object instead of Relobj pointer and section
8776 index as parameter. Handle relaxed input sections.
8777 (Output_section::save_states, Output_section::restore_states): New
8778 method definitions.
8779 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8780 (Output_data::is_data_size_fixed): New method definition.
8781 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8782 if it is fixed.
8783 (Output_data::address_and_file_offset_have_reset_values): New method
8784 definition.
8785 (Output_data::do_address_and_file_offset_have_reset_values): New method
8786 definition.
8787 (Output_data::set_data_size): Check that data size is not fixed.
8788 (Output_data::fix_data_size): New method definition.
8789 (Output_data::is_data_size_fixed_): New data member.
8790 (Output_section_headers::set_final_data_size): New method definition.
8791 (Output_section_headers::do_size): New method declaration.
8792 (Output_segment_headers::set_final_data_size): New method definition.
8793 (Output_segment_headers::do_size): New method declaration.
8794 (Output_file_header::set_final_data_size)::New method definition.
8795 (Output_file_header::do_size)::New method declaration.
8796 (Output_section_data::Output_section_data): Add new parameter
8797 is_data_size_fixed and use it to fix data size.
8798 (Output_data_const::Output_data_const): Adjust call to base class
8799 constructor and fix data size.
8800 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8801 base class constructor and fix data size.
8802 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8803 base class constructor and fix data size.
8804 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8805 class constructor and fix data size.
8806 (Output_data_group::set_final_data_size): New method definition.
8807 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8808 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8809 class constructor and fix data size.
8810 (Output_relaxed_input_section): New class definition.
8811 (Output_section::Simple_input_section): New class definition.
8812 (Output_section::get_input_sections): Adjust parameter list.
8813 (Output_section::add_input_section_for_script): Same.
8814 (Output_section::save_states, Output_section::restore_states,
8815 Output_section::do_address_and_file_offset_have_reset_values,
8816 (Output_section::Input_section::Input_section): Handle
8817 RELAXED_INPUT_SECTION_CODE. Add new overload for
8818 Output_relaxed_input_section.
8819 (Output_section::Input_section::is_input_section,
8820 Output_section::Input_section::set_output_section): Handle relaxed
8821 input section.
8822 (Output_section::Input_section::is_relaxed_input_section,
8823 Output_section::Input_section::output_section_data,
8824 Output_section::Input_section::relaxed_input_section): New method
8825 definitions.
8826 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8827 value.
8828 (Output_section::Input_section::u1_): Update comments.
8829 (Output_section::Input_section::u2_): Add new union member poris.
8830 (Output_section::Checkpoint_output_section): New classs definition.
8831 (Output_section::relax_input_section): New method declaration.
8832 (Output_section::checkpoint_): New data member.
8833 (Output_segment): Update comments.
8834 (Output_segment::Output_segment): Un-privatize copy constructor.
8835 (Output_segment::operator=): Un-privatize.
8836 * script-sections.cc (Output_section_element::Input_section_list):
8837 Change element type to Output_section::Simple_input_section.
8838 (Output_section_element_dot_assignment::set_section_addresses):
8839 Register output section data for relaxation clean up.
8840 (Output_data_exression::Output_data_expression): Adjust call to base
8841 constructor to fix data size.
8842 (Output_section_element_data::set_section_addresses): Register
8843 Output_data_expression object for relaxation clean up.
8844 (struct Input_section_info): Replace Relobj pointer and section index
8845 pair with Output_section::Simple_input_section and Convert struct to a
8846 class.
8847 (Input_section_sorter::operator()): Adjust access to
e1df38aa 8848 Input_section_info data member to use accessors.
20e6d0d6
DK
8849 (Output_section_element_input::set_section_addresses): Use layout
8850 parameter. Adjust code to use Output_section::Simple_input_section
8851 and Input_secction_info classes. Register filler for relaxation
8852 clean up.
8853 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8854 and section index pair with Output_section::Simple_input_section
8855 class. Adjust code accordingly.
8856 (Phdrs_element::release_segment): New method definition.
8857 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8858 segment list.
8859 (Script_sections::release_segments): New method definition.
8860 * gold/script-sections.h (Script_sections::release_segments): New
8861 method declaration.
8862 * gold/target.h (Target::may_relax, Target::relax,
8863 Target::do_may_relax, Target::do_relax): New method definitions.
8864
5e445df6
ILT
88652009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8866
8867 * arm.cc (has_signed_unsigned_overflow): New function.
8868 (Arm_relocate_functions::abs8): New function.
8869 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8870 (Target_arm::Scan::global): Likewise.
8871 (Target_arm::relocate::relocate): Likewise.
8872 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8873 Likewise.
8874
8c604651 88752009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
8876
8877 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8878 * testsuite/Makefile.in: Regenerate.
8879
1e9cc1c2
NC
88802009-09-11 Nick Clifton <nickc@redhat.com>
8881
8882 * po/gold.pot: Updated by the Translation project.
8883
6a89f575
CC
88842009-09-08 Cary Coutant <ccoutant@google.com>
8885
8886 * output.cc (Output_file::open): Add execute permission to empty file.
8887 * testsuite/Makefile.am (permission_test): New test.
8888 * testsuite/Makefile.in: Regenerate.
8889
fdcac5af
ILT
88902009-09-02 Ian Lance Taylor <iant@google.com>
8891
8892 * output.cc (Output_file::resize): Call map_no_anonymous rather
8893 than map.
8894
44453f85
ILT
88952009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8896
8897 * gold.cc: Include "incremental.h".
8898 (queue_initial_tasks): Call Incremental_checker methods.
8899 * incremental.cc: Include "output.h".
8900 (Incremental_checker::can_incrementally_link_output_file): New
8901 method.
8902 * incremental.h (Incremental_checker): New class.
8903
8904 * output.cc (Output_file::open_for_modification): New method.
8905 (Output_file::map_anonymous): Changed return type to bool. Record
8906 map in base_ field.
8907 (Output_file::map_no_anonymous): New method, broken out of map.
8908 (Output_file::map): Use map_no_anonymous and map_anonymous.
8909 * output.h (class Output_file): Update declarations.
8910
293c1386
CC
89112009-08-24 Cary Coutant <ccoutant@google.com>
8912
8913 * options.h (Command_line::Pre_options): New class.
8914 (Command_line::pre_options): New member.
8915 * options.cc (gold::options::ready_to_register): New variable.
8916 (One_option::register_option): Do nothing if not registering options.
8917 Assert if same short option registered twice.
8918 (General_options::General_options): Turn off option registration when
8919 done constructing.
8920 (Command_line::Pre_options::Pre_options): New constructor.
8921
f773f3d2
CC
89222009-08-24 Cary Coutant <ccoutant@google.com>
8923
06a73cfe
CC
8924 * options.h (General_options::no_keep_memory): Remove incorrect
8925 short option.
f773f3d2 8926
a15af8e2
RW
89272009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8928
8929 * Makefile.am (am__skiplex, am__skipyacc): New.
8930 * Makefile.in: Regenerate.
8931
c462b41b
RW
89322009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8933
14ec8efd
RW
8934 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8935 (INCLUDES): ... this.
8936 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8937 (AM_CPPFLAGS): Renamed from ...
8938 (INCLUDE): ... this.
8939 * Makefile.in, testsuite/Makefile.in: Regenerate.
8940
81ecdfbb
RW
8941 * Makefile.in: Regenerate.
8942 * aclocal.m4: Likewise.
8943 * config.in: Likewise.
8944 * configure: Likewise.
8945 * testsuite/Makefile.in: Likewise.
8946
c462b41b
RW
8947 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8948 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8949 * Makefile.in: Regenerate.
8950 * testsuite/Makefile.in: Regenerate.
8951
2da73f13
CC
89522009-08-19 Cary Coutant <ccoutant@google.com>
8953
8954 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8955 symbols in shared libraries overridden by hidden or internal symbols
8956 in the main program.
8957
2db70501
CD
89582009-08-19 Chris Demetriou <cgd@google.com>
8959
8960 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8961 checking source file names in error messages.
8962
f733487b
DK
89632009-08-18 Doug Kwan <dougkwan@google.com>
8964
8965 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8966 an elcpp::Ehdr as parameter. Adjust call to set_target.
8967 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8968 an elfcpp::Ehdr as parameter.
8969 * object.cc (Object::set_target): Remove the version that looks up
8970 a target and sets it.
8971 (Sized_relobj::setup): Take a Target object instead of
8972 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8973 (make_elf_sized_object): Find target and ask target to
8974 make an ELF object.
8975 * object.h: (Object::set_target): Remove the version that looks up
8976 a target and sets it.
8977 (Sized_relobj::setup): Take a Target object instead of
8978 an elfcpp:Ehdr as parameter.
8979 * target.cc: Include dynobj.h.
8980 (Target::do_make_elf_object_implementation): New.
8981 (Target::do_make_elf_object): New.
8982 * target.h (Target::make_elf_object): New template declaration.
8983 (Target::do_make_elf_object): New method declarations.
8984 (Target::do_make_elf_object_implementation): New template declaration.
8985
cc70f101
ILT
89862009-08-14 Ian Lance Taylor <iant@google.com>
8987
8988 * gold.h (FUNCTION_NAME): Define.
8989 (gold_unreachable): Use FUNCTION_NAME.
8990
ef5e0cb1
ST
89912009-08-12 Sriraman Tallam <tmsriram@google.com>
8992
8993 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8994 symbol in the --keep-unique list is not found.
8995
48c187ce
ST
89962009-08-12 Sriraman Tallam <tmsriram@google.com>
8997
8998 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8999 been maked as --keep-unique.
9000 (Icf::unfold_section): New function.
9001 * icf.h (Icf::unfold_section): New function.
9002 * options.h (General_options::keep_unique): New option.
9003 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9004 * testsuite/Makefile.in: Regenerate.
9005 * testsuite/icf_keep_unique_test.sh: New file.
9006 * testsuite/icf_keep_unique_test.cc: New file.
9007
645afe0c
CC
90082009-08-12 Cary Coutant <ccoutant@google.com>
9009
9010 PR 10471
9011 * resolve.cc (Symbol_table::resolve): Check for references from
9012 dynamic objects to hidden and internal symbols.
9013 * testsuite/Makefile.am (hidden_test.sh): New test.
9014 * testsuite/Makefile.in: Regenerate.
9015 * testsuite/hidden_test.sh: New script.
9016 * testsuite/hidden_test_1.c: New test source.
9017 * testsuite/hidden_test_main.c: New test source.
9018
11af873f
DK
90192009-08-11 Doug Kwan <dougkwan@google.com>
9020
9021 * arm.cc: Update comments.
9022 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9023 segment to locate the .ARM.exidx section if present.
9024
b9f7d72d
DK
90252009-08-09 Doug Kwan <dougkwan@google.com>
9026
9027 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9028 patch.
9029
ddd3c53c
ST
90302009-08-07 Sriraman Tallam <tmsriram@google.com>
9031 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9032 compiler warnings.
9033
27721062
ST
90342009-08-06 Sriraman Tallam <tmsriram@google.com>
9035
9036 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9037 valid tls_segment only for non-debug-section relocations.
9038 * testsuite/Makefile.am: Add gc_tls_test.
9039 * testsuite/Makefile.in: Regenerate.
9040 * testsuite/gc_tls_test.cc: New file.
9041 * testsuite/gc_tls_test.sh: New file.
9042
ef15dade 90432009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 9044
ef15dade
ST
9045 * icf.cc: New file.
9046 * icf.h: New file.
9047 * Makefile.am (CCFILES): Add icf.cc.
9048 (HFILES): Add icf.h
9049 * Makefile.in: Regenerate.
9050 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9051 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9052 section, symbol and addend information for the relocs.
9053 * gold.cc (queue_middle_tasks): Call identical code folding.
9054 * gold.h: Add defines for multimap.
9055 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9056 to the call of finalize_local_symbols.
9057 * main.cc (main): Create object of class Icf.
9058 * object.cc (Sized_relobj::do_layout): Allow this function to be
9059 called twice during icf.
9060 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9061 to sections marked as identical by icf.
9062 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9063 when available.
9064 (Sized_relobj::do_section_entsize): New function.
9065 * object.h (Object::section_entsize): New function.
9066 (Object::do_section_entsize): New pure virtual function.
9067 (Relobj::finalize_local_symbols): Add new parameter.
9068 (Relobj::do_section_entsize): New function.
9069 * options.h (General_options::icf): New option.
9070 (General_options::icf_iterations): New option.
9071 (General_options::print_icf_sections): New option.
9072 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9073 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9074 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9075 icf.
9076 * symtab.cc (Symbol_table::is_section_folded): New function.
9077 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9078 to sections marked as identical by icf.
9079 * symtab.h (Symbol_table::set_icf): New function.
9080 (Symbol_table::icf): New function.
9081 (Symbol_table::is_section_folded): New function.
9082 (Symbol_table::icf_): New data member.
9083 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9084 * testsuite/Makefile.am: Add commands to build icf_test.
9085 * testsuite/Makefile.in: Regenerate.
9086 * testsuite/icf_test.sh: New file.
9087 * testsuite/icf_test.cc: New file.
9088
c3b65ac4
CD
90892009-07-24 Chris Demetriou <cgd@google.com>
9090
9091 * layout.cc (is_compressible_debug_section): Fix incorrect
9092 comment about compressed section names.
9093
1caf2c51
ILT
90942009-07-20 Ian Lance Taylor <ian@airs.com>
9095
9096 PR 10419
9097 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9098
1ef4d87f
ILT
90992009-07-16 Ian Lance Taylor <iant@google.com>
9100
9101 PR 10400
9102 * layout.h: #include <map>.
9103 (class Kept_section): Change from struct to class. Add accessors
9104 and setters. Add section size to Comdat_group mapping. Change
9105 Comdat_group to std::map. Add is_comdat_ field. Add
9106 linkonce_size field in union.
9107 (class Layout): Update declaration of find_or_add_kept_section.
9108 Don't declare find_kept_object.
9109 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9110 parameter. Add object, shndx, is_comdat, and is_group_name
9111 parameters. Change all callers. Adjust for new Kept_section.
9112 (Layout::find_kept_object): Remove.
9113 * object.cc (Sized_relobj::include_section_group): Update use of
9114 Kept_section. Rename secnum to shndx. Only record
9115 Kept_comdat_section if sections are the same size.
9116 (Sized_relobj::include_linkonce_section): Update use of
9117 Kept_section. Only record Kept_comdat_section if sections are the
9118 same size. Set size of linkonce section.
9119 (Sized_relobj::map_to_kept_section): Update call to
9120 get_kept_comdat_section.
9121 * object.h (class Sized_relobj): Rename fields in
9122 Kept_comdat_section to drop trailing underscores; change object
9123 field to Relobj*. Change Kept_comdat_section_table to store
9124 struct rather than pointer.
9125 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9126 Add kept_object and kept_shndx parameters. Change all callers.
9127 (Sized_relobj::get_kept_comdat_section): Change return type to
9128 bool. Add kept_object and kept_shndx parameters. Change all
9129 callers.
9130 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9131 Layout::find_or_add_kept_section.
9132
37c3b7b0
ILT
91332009-07-09 Ian Lance Taylor <iant@google.com>
9134
9135 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9136 Reserve space in the hash table.
9137
98fa85cb
ILT
91382009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9139
9140 * fileread.cc (File_read::get_mtime): New method.
9141 * fileread.h (Timespec): New structure.
9142 (File_read::get_mtime): New method.
9143 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9144 Renamed from timestamp_nsec.
9145 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9146 Elf_Xword.
e1df38aa 9147 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 9148 timestamp_nsec.
e1df38aa 9149 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
9150 (Incremental_inputs::report_obejct): Save mtime; style fix.
9151 (Incremental_inputs::report_script): Save mtime; style fix.
9152 (Incremental_inputs::finalize_inputs): Style fix.
9153 (Incremental_inputs::finalize): Style fix.
9154 (Incremental_inputs::create_input_section_data): Store inputs
9155 mtime.
9156 * incremental.h (Incremental_inputs::report_script): Add mtime
9157 argument.
9158 (Incremental_inputs::Input_info::Input_info): Intialize only one
9159 union member.
9160 (Incremental_inputs::Input_info::archive): Move to nameless
9161 union.
9162 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9163 (Incremental_inputs::Input_info::script): Move to nameless union.
9164 (Incremental_inputs::mtime): New field.
9165 * script.cc (read_input_script): Pass file mtime to
9166 Incremental_input.
9167 * script.h (Script_info::inputs): Style fix.
9168
c9d70757
ILT
91692009-07-01 Ian Lance Taylor <ian@airs.com>
9170
9171 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9172 instead of 32.
9173
9c547ec3
ILT
91742009-06-24 Ian Lance Taylor <iant@google.com>
9175
9176 PR 10156
9177 * layout.cc (Layout::choose_output_section): If we find an
9178 existing section, update the flags.
9179 (Layout::create_notes): New function, broken out of
9180 Layout::finalize.
9181 (Layout::finalize): Don't create note sections.
9182 (Layout::create_note): Don't crash if linker script discards
9183 section.
9184 (Layout::create_gold_note): Likewise.
9185 (Layout::create_build_id): Likewise. Don't set
9186 after_input_sections on the section.
9187 (Layout::create_executable_stack_info): Remove target parameter.
9188 Change caller.
9189 * layout.h (class Layout): Declare create_notes. Update
9190 declaration of create_executable_stack_info.
9191 * gold.cc (queue_middle_tasks): Call create_notes.
9192 * output.cc (Output_section::update_flags_for_input_section): Move
9193 here from output.h. If SHF_ALLOC flag is newly set, mark address
9194 invalid.
9195 * output.h (Output_data::mark_address_invalid): New function.
9196 (class Output_section): Only declare, not define,
9197 update_flags_for_input_section. Remove set_flags.
9198
55458500
ILT
91992009-06-24 Ian Lance Taylor <iant@google.com>
9200
9201 * script-sections.cc (Output_section_definition::
9202 set_section_addresses): Rename shadowing local load_address to
9203 laddr.
9204
1307d6cd
ILT
92052009-06-24 Ian Lance Taylor <iant@google.com>
9206
9207 PR 10244
9208 * reloc.cc (relocate_sections): Skip empty relocation sections.
9209
ec3f783e
ILT
92102009-06-23 Ian Lance Taylor <iant@google.com>
9211
9212 PR 10156
9213 * layout.cc (Layout::create_note): Use choose_output_section
9214 rather than make_output_section.
9215
459c9f1c
ILT
92162009-06-23 Ian Lance Taylor <iant@google.com>
9217
9218 PR 10237
9219 * options.cc (General_options::parse_V): Set printed_version_.
9220 (General_options::General_options): Initialize printed_version_.
9221 * options.h (class General_options): Add printed_version_ field.
9222 * gold.cc (queue_initial_tasks): If there are no input files,
9223 don't give a fatal error if we printed the version information.
9224 (queue_middle_tasks): If using -r with a shared object, give a
9225 fatal error rather than an ordinary error.
9226
1518dc8f
ILT
92272009-06-23 Ian Lance Taylor <iant@google.com>
9228
9229 PR 10219
9230 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9231 (Layout::make_output_section): Set have_stabstr_section_ if we see
9232 a .stab*str section.
9233 (Layout::finalize): Call link_stabs_sections.
9234 (Layout::link_stabs_sections): New file.
9235 * layout.h (class Layout): Add have_stabstr_section_ field.
9236 Declare link_stabs_sections.
9237
3d857b98
DK
92382009-06-23 Doug Kwan <dougkwan@google.com>
9239
9240 * Makefile.am (libgold_a_LIBADD): New.
9241 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9242 * Makefile.in: Regenerate.
9243 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9244 * configure: Regenerate.
9245 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9246 * fileread.cc: Include sys/state.h
9247 * gold.h: Declare memmem and strndup if found missing.
9248 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9249
0639a6f6
ILT
92502009-06-23 Ian Lance Taylor <iant@google.com>
9251
9252 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9253 * configure: Rebuild.
9254
8d63875c
ILT
92552009-06-23 Ian Lance Taylor <iant@google.com>
9256
9257 PR 10147
9258 * object.cc (Object::section_contents): Don't try to get a view if
9259 the section has length zero.
9260 (Object::handle_gnu_warning_section): If the section is empty, use
9261 the name of the section as the warning.
9262
f7c8a183
ILT
92632009-06-23 Ian Lance Taylor <iant@google.com>
9264
9265 PR 10133
9266 * stringpool.h (class Stringpool_template): Add optimize_ field.
9267 (Stringpool_template::set_optimize): New function.
9268 * stringpool.cc (Stringpool_template::Stringpool_template):
9269 Initialize optimize_ field.
9270 (Stringpool_template::set_string_offsets): Test local optimize
9271 fild rather than parameter.
9272 * layout.cc (Layout::Layout): Call set_optimize on the section
9273 name stringpool.
9274
e6a307ba
ILT
92752009-06-22 Ian Lance Taylor <iant@google.com>
9276
9277 PR 10030
9278 * yyscript.y: Parse TARGET.
9279 * script.cc (script_set_target): New function.
9280 * script-c.h (script_set_target): Declare.
9281 * options.cc (General_options::string_to_object_format): Rename
9282 from string_to_object_format in anonymous namespace. Change
9283 callers.
9284 * options.h (class General_options): Declare
9285 string_to_object_format.
9286
3ee173de
ILT
92872009-06-22 Ian Lance Taylor <iant@google.com>
9288
9289 * script-sections.cc (Script_sections::create_segments): Don't put
9290 program headers in a PT_LOAD segment if -n or -N.
9291
92922009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
9293
9294 PR 10141
9295 * options.h (class General_options): Add -z lazy and -z now. Sort
9296 -z options into alphabetical order.
9297 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9298
cd6739a1 92992009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
9300
9301 * layout.cc (Layout::make_output_section): Call
9302 Target::new_output_section.
9303 (Layout::attach_allocated_section_to_segment): Put large section
9304 sections in a separate load segment with the large segment flag
9305 set.
9306 (Layout::segment_precedes): Sort large data segments after other
9307 load segments.
9308 (align_file_offset): New static function.
9309 (Layout::set_segment_offsets): Use align_file_offset.
9310 * output.h (class Output_section): Add is_small_section_ and
9311 is_large_section_ fields.
9312 (Output_section::is_small_section): New function.
9313 (Output_section::set_is_small_section): New function.
9314 (Output_section::is_large_section): New function.
9315 (Output_section::set_is_large_section): New function.
9316 (Output_section::is_large_data_section): New function.
9317 (class Output_segment): Add is_large_data_segment_ field.
9318 (Output_segment::is_large_data_segment): New function.
9319 (Output_segment::set_is_large_data_segment): New function.
9320 * output.cc (Output_section::Output_section): Initialize new
9321 fields.
9322 (Output_segment::Output_segment): Likewise.
9323 (Output_segment::add_output_section): Add assertion that large
9324 data sections always go in large data segments. Force small data
9325 sections to the end of the list of data sections. Force small BSS
9326 sections to the start of the list of BSS sections. For large BSS
9327 sections to the end of the list of BSS sections.
9328 * symtab.h (class Symbol): Declare is_common_shndx.
9329 (Symbol::is_defined): Check Symbol::is_common_shndx.
9330 (Symbol::is_common): Likewise.
9331 (class Symbol_table): Define enum Commons_section_type. Update
9332 declarations. Add small_commons_ and large_commons_ fields.
9333 * symtab.cc (Symbol::is_common_shndx): New function.
9334 (Symbol_table::Symbol_table): Initialize new fields.
9335 (Symbol_table::add_from_object): Put small and large common
9336 symbols in the right list.
9337 (Symbol_table::sized_finalized_symbol): Check
9338 Symbol::is_common_shndx.
9339 (Symbol_table::sized_write_globals): Likewise.
9340 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9341 common symbol lists. Don't call do_allocate_commons_list if the
9342 list is empty.
9343 (Symbol_table::do_allocate_commons_list): Remove is_tls
9344 parameter. Add comons_section_type parameter. Change all
9345 callers. Handle small and large common symbols.
9346 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9347 Symbol::is_common_shndx.
9348 * resolve.cc (symbol_to_bits): Likewise.
9349 * target.h (Target::small_common_shndx): New function.
9350 (Target::small_common_section_flags): New function.
9351 (Target::large_common_shndx): New function.
9352 (Target::large_common_section_flags): New function.
9353 (Target::new_output_section): New function.
9354 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9355 small_common_section_flags, and large_common_section_flags
9356 fields.
9357 (Target::do_new_output_section): New virtual function.
9358 * arm.cc (Target_arm::arm_info): Initialize new fields.
9359 * i386.cc (Target_i386::i386_info): Likewise.
9360 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9361 Likewise.
9362 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9363 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9364 (Target_x86_64::do_new_output_section): New function.
9365 * configure.ac: Define conditional MCMODEL_MEDIUM.
9366 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9367 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9368 (large_LDFLAGS): Define.
9369 * testsuite/large.c: New file.
9370 * testsuite/testfile.cc (Target_test::test_target_info):
9371 Initialize new fields.
9372 * configure, testsuite/Makefile.in: Rebuild.
9373
bb04269c
DK
93742009-06-05 Doug Kwan <dougkwan@google.com>
9375
9376 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 9377 * Makefile.in: Regenerate.
bb04269c
DK
9378 * i386.cc (class Target_i386): Define new virtual method to
9379 override do_is_local_label_name in parent.
9380 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9381 local symbols if --discard-locals or -X is given.
9382 * options.h (class General_options): Declare new options
9383 '--discard-locals' and '-X' for discarding locals.
9384 * target.h (class Target): Define new methods is_local_label_name.
9385 Declare new virtual method do_is_local_label_name.
9386 * target.cc: New file.
9387 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9388 (check_SCRIPTS): Add discard_locals_test.sh.
9389 (check_DATA): Add discard_local_tests.syms.
9390 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9391 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9392 * testsuite/Makefile.in: Regenerate.
9393 * testsuite/discard_locals_test.c: New file.
9394 * testsuite/discard_locals_test.sh: Same.
9395
805bb01c
DK
93962009-06-05 Doug Kwan <dougkwan@google.com>
9397
9398 * object.cc (Sized_relobj::Sized_relobj): Initialize
9399 discarded_eh_frame_shndx_ to -1U.
9400 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9401 section.
9402 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9403 a discarded .eh_frame section.
9404 (Sized_relobj::do_finalize_local_symbols): Ditto.
9405 * object.h (class Sized_relobj): Declare new member
9406 discarded_eh_frame_shndx_.
9407 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9408 (local_labels_test.o, local_labels_test): New rules.
9409 * testsuite/Makefile.in: Regenerate.
9410
1dcd334d
DK
94112009-06-04 Doug Kwan <dougkwan@google.com>
9412
9413 * layout.cc (Layout::section_name_mapping): Add mapping for
9414 special ARM sections.
9415
96d49306
DK
94162009-06-03 Doug Kwan <dougkwan@google.com>
9417
9418 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9419 (utils::has_overflow): Same.
9420
dff16297
ILT
94212009-06-03 Ian Lance Taylor <iant@google.com>
9422
9423 * layout.cc (Layout::section_name_mapping): New array, replacing
9424 Layout::linkonce_mapping.
9425 (Layout::section_name_mapping_count): New variable, replacing
9426 Layout::linkonce_mapping_count.
9427 (Layout::linkonce_output_name): Remove.
9428 (Layout::output_section_name): Rewrite.
9429 * layout.h (class Layout): Rename Linkonce_mapping to
9430 Section_name_mapping, linkonce_mapping to section_name_mapping,
9431 linkonce_mapping_count to section_name_mapping_count. Don't
9432 declare linkonce_output_name.
9433
c121c671
DK
94342009-06-03 Doug Kwan <dougkwan@google.com>
9435
9436 * gold/arm.cc (namespace utils): New.
9437 (Target_arm::reloc_is_non_pic): Define new method.
9438 (class Arm_relocate_functions): New.
9439 (Target_arm::Relocate::relocate): Handle relocation types used by
9440 Android.
9441
07800fab
ILT
94422009-06-03 Ian Lance Taylor <iant@google.com>
9443
9444 * arm.cc (Target_arm::scan::global): Use || instead of |.
9445
c121c671
DK
94462009-06-02 Doug Kwan <dougkwan@google.com>
9447
9448 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9449 issued_non_pic_error_.
9450 (class Target_arm::Scan): Declare new method check_non_pic.
9451 Define new method symbol_needs_plt_entry.
9452 Declare new data member issued_non_pic_error_.
9453 (class Target_arm::Relocate): Declare new method
9454 should_apply_static_reloc.
9455 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9456 (Target_arm::Scan::check_non_pic): Define new method.
9457 (Target_arm::Scan::local): Handle a small subset of reloc types used
9458 by Android.
9459 (Target_arm::Scan::local): Same.
9460 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9461
b19b0c6d
ILT
94622009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9463
9464 * incremental.cc (Incremental_inputs::report_command_line): Filter
9465 out --incremental-* options.
9466
94cdfcff
DK
94672009-05-29 Doug Kwan <dougkwan@google.com>
9468
9469 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9470 template class.
9471 (class Target_arm): Update comment.
9472 (Target_arm::Target_arm): Initialize new data members GOT_,
9473 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9474 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9475 and Target_arm::rel_dyn_section.
9476 Declare new_enum Target_arm::Got_type.
9477 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9478 and DYNBSS_.
9479 Update commments for member do_dynsym_value.
9480 (Target_arm::got_size, Target_arm::plt_section,
9481 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9482 new methods inside class defintion.
9483 (Target_arm::got_section): Define new method.
9484 (Target_arm::rel_dyn_section): Same.
9485 (Output_data_plt_arm): New template class.
9486 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9487 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9488 (Output_data_plt_arm::add_entry): Same.
9489 (Output_data_plt_arm::first_plt_entry): Define new
9490 static data member for PLT instruction template.
9491 (Output_data_plt_arm::plt_entry): Same.
9492 (Output_data_plt_arm::do_write): Define new method.
9493 (Target_arm::make_plt_entry): Same.
9494 (Target_arm::do_finalize_sections): Same.
9495 (Target_arm::do_dynsym_value): Same.
9496
4a657b0d
DK
94972009-05-28 Doug Kwan <dougkwan@google.com>
9498
9499 * Makefile.am (TARGETSOURCES): Add arm.cc.
9500 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9501 * Makefile.in: Regenerate.
9502 * arm.cc: New file.
9503 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9504
e7ae8c36
DK
95052009-05-26 Doug Kwan <dougkwan@google.com>
9506
9507 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9508 (General_options::check_excluded_libs): Strip off directories in
9509 archive name before matching like GNU ld does.
9510 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9511 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9512 (exclude_libs_test_LDFLAGS): Add linker option
9513 -Wl,--exclude-libs,libexclude_libs_test_3
9514 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9515 an explicit archive without using -l.
9516 (alt/libexclude_libs_test_3.a): New make rule.
9517 * testsuite/Makefile.in: Regenerate.
9518 * testsuite/exclude_libs_test.c : Declare lib3_default().
9519 (main): Call it.
9520 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9521 * exclude_libs_test_3.c: New file.
9522
f12e7348
NC
95232009-05-26 Nick Clifton <nickc@redhat.com>
9524
9525 * po/id.po: New Indonesian translation.
9526 * po/gold.pot: Updated template file.
9527
4daadc0d
ST
95282009-05-22 Sriraman Tallam <tmsriram@google.com>
9529
e1df38aa 9530 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
9531 gc_comdat_test files. Add -Wl,--gc-sections to build
9532 gc_comdat_test.
9533 * testsuite/Makefile.in: Regenerate.
9534 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9535
531813ad
ST
95362009-05-21 Sriraman Tallam <tmsriram@google.com>
9537
9538 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9539 kept comdat section was garbage collected.
9540 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9541 * testsuite/Makefile.in: Regenerate.
9542 * testsuite/gc_comdat_test.sh: New file.
9543 * testsuite/gc_comdat_test_1.cc: New file.
9544 * testsuite/gc_comdat_test_2.cc: New file.
9545
65514900
CC
95462009-05-19 Doug Kwan <dougkwan@google.com>
9547
9548 * archive.cc (Archive::Archive): Move constructor from archive.h
9549 to here. Initialize no_export_.
9550 (Archive::get_elf_object_for_member): Set no_export flag of object.
9551 * archive.h (Archive::Archive): Move constructor body to
9552 archive.cc.
9553 (Archive::no_export): New method.
9554 (Archive::no_export_): New field.
9555 * object.h (Object::Object): Initialize no_export_ to false.
9556 (Object::no_export, Object::set_no_export): New methods.
9557 (Object::no_export_): New field.
9558 * options.cc (General_options::parse_exclude_libs): New method.
9559 (General_options::check_excluded_libs) Same.
9560 * options.h (exclude_libs): New option.
9561 (General_options::check_excluded_libs): New method declaration.
9562 (General_options::excluded_libs_): New field.
9563 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9564 default or protected visibility if an object has no-export flag set.
9565 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9566 (check_SCRIPTS): Add exclude_libs_test.sh.
9567 (check_DATA): Add exclude_libs_test.syms.
9568 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9569 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9570 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9571 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9572 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9573 libexclude_libs_test_2.a): New rules.
9574 * testsuite/Makefile.in: Regenerate.
9575 * testsuite/exclude_libs_test.c: New file.
9576 * testsuite/exclude_libs_test.sh: Ditto.
9577 * testsuite/exclude_libs_test_1.c: Ditto.
9578 * testsuite/exclude_libs_test_2.c: Ditto.
9579
1b77ea50
ILT
95802009-05-15 Ian Lance Taylor <iant@google.com>
9581
9582 * configure.ac: Check for declarations for cases where libiberty.h
9583 checks HAVE_DECL_xxx.
9584 * configure, config.in: Rebuild.
9585
072fe7ce
ILT
95862009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9587
9588 * gold.h (Incremental_argument_list): Remove (invalid) forward
9589 declaration.
9590 * incremental.cc (Incremental_inputs::report_achive): New method.
9591 (Incremental_inputs::report_object): New method.
9592 (Incremental_inputs::report_script): New method.
9593 (Incremental_inputs::finalize_inputs): New method.
9594 (Incremental_inputs::finalize): Call finalize_inputs().
9595 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9596 Create inputs entries.
9597 * incremental.h (Incremental_input_type): New enum.
9598 (Incremental_inputs::Incremental_input): Initialize new fields.
9599 (Incremental_inputs::report_inputs): New method.
9600 (Incremental_inputs::report_achive): New method.
9601 (Incremental_inputs::report_object): New method.
9602 (Incremental_inputs::report_script): New method.
9603 (Incremental_inputs::finalize_inputs): New method.
9604 (Incremental_inputs::Input_info): New struct.
9605 (Incremental_inputs::Input_info_map): New typedef.
9606 (Incremental_inputs::lock_): New field.
9607 (Incremental_inputs::Inputs_): New field.
9608 (Incremental_inputs::Inputs_map): New field.
9609 * main.cc (main): Call Incremental_input::report_inputs.
9610 * options.h (Input_argument_list): Typedef moved from
9611 Input_arguments.
9612 (Input_file_group::Files): Remove, use ::Input_argument_list.
9613 (Input_file_group::Input_argument_list): Remove, use
9614 ::Input_argument_list.
9615 * plugin.cc (Plugin_manager::add_input_file): Add error in
9616 incremental build.
9617 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9618 functions.
9619 * script.cc (read_input_script): Call
9620 Incremental_input::report_script.
9621 * script.h (Script_info): New class.
9622
b0481b0b
ILT
96232009-04-27 Ian Lance Taylor <iant@google.com>
9624
9625 * x86_64.cc (do_adjust_output_section): Set entsize to
9626 plt_entry_size.
9627
b22a5a41 96282009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
9629
9630 * output.cc (Output_file::close): After short writes, continue
9631 writing from the correct offset in the buffer being written.
9632
40fde488
CD
96332009-04-23 Chris Demetriou <cgd@google.com>
9634
9635 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9636 * configure: Regenerate.
9637 * config.in: Regenerate.
9638 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9639 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9640
3ce2c28e
ILT
96412009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9642
9643 * incremental.cc (Incremental_inputs_header_data): Renamed from
9644 Incremental_input_header_data.
9645 (Incremental_inputs_header_data::data_size): New field.
9646 (Incremental_inputs_header_data::put_input_file_count): Renamed
9647 from input_file_count.
9648 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9649 from command_line_offset.
9650 (Incremental_inputs_header_data::put_reserved): Renamed from
9651 put_reserved.
9652 (Incremental_inputs_entry_data): Renamed from
9653 Incremental_input_entry_data.
9654 (Incremental_inputs_entry_data::data_size): New field.
9655 (Incremental_inputs::report_command_line): New method.
9656 (Incremental_inputs::finalize): New method.
9657 (Incremental_inputs::create_incremental_inputs_data): New method.
9658 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9659 * incremental.h: New file.
9660 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9661 (Layout::finalize): Create incremental inputs section in
9662 incremental builds.
9663 (Layout::create_incremental_info_sections): New method.
9664 * layout.h (Layout::incremental_inputs): New method.
9665 (Layout::create_incremental_info_sections): New method.
9666 (Layout::incremental_inputs_): New field.
9667 * main.cc (main): Notify Incremental_input of the command line.
9668
e55bde5e
ILT
96692009-04-01 Ian Lance Taylor <iant@google.com>
9670 Mikolaj Zalewski <mikolajz@google.com>
9671
9672 * gold.h (reserve_unordered_map): Define, three versions, one for
9673 each version of Unordered_map.
9674 * layout.cc (Layout::Layout): Remove options parameter. Add
9675 number_of_input_files parameter. Don't initialize options_.
9676 Initialize number_of_input_files_ and resized_signatures_. Move
9677 sections_are_attached_.
9678 (Layout::layout_group): Reserve space for group_signatures_.
9679 (Layout::find_or_add_kept_section): Change name parameter to be a
9680 reference. Resize signatures_ map when it gets large enough.
9681 (Layout::layout_eh_frame): Use parameters->options() instead of
9682 this->options_.
9683 (Layout::make_output_section): Likewise.
9684 (Layout::attach_allocated_section_to_segment): Likewise.
9685 (Layout::finalize, Layout::create_executable_stack): Likewise.
9686 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9687 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9688 * layout.h (class Layout): Update declarations. Remove options_
9689 field. Add number_of_input_files_ and resized_signatures_
9690 fields. Move sections_are_attached_ field.
9691 * main.cc (main): Pass number of input files to Layout
9692 constructor. Don't pass options.
9693
154b857c
ILT
96942009-03-30 Ian Lance Taylor <iant@google.com>
9695
9696 * ffsll.c (ffsll): Correct implementation.
9697
2f35ab9b
ILT
96982009-03-27 Ian Lance Taylor <iant@google.com>
9699
fd03461a
ILT
9700 * ffsll.c: New file.
9701 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9702 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9703 * ftruncate.c (ftruncate): Declare before definition.
9704 * mremap.c (mremap): Likewise.
9705 * pread.c (pread): Likewise.
9706 * configure, Makefile.in, config.in: Rebuild.
9707
2f35ab9b
ILT
9708 * mremap.c: New file.
9709 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9710 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9711 (mremap): Declare if HAVE_MREMAP is not defined.
9712 * configure, Makefile.in, config.in: Rebuild.
9713
33aea2fd
CC
97142009-03-27 Cary Coutant <ccoutant@google.com>
9715
9716 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9717 position independent.
9718 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9719 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9720
6d479619
CC
97212009-03-24 Cary Coutant <ccoutant@google.com>
9722
9723 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9724 an executable.
9725 (needs_dynamic_reloc): Likewise.
9726
afc06bb8
ILT
97272009-03-24 Ian Lance Taylor <iant@google.com>
9728
9729 * yyscript.y (file_cmd): Recognize EXTERN.
9730 (extern_name_list, extern_name_list_body): New nonterminals.
9731 * script.cc (script_add_extern): Define.
9732 * script-c.h (script_add_extern): Declare.
9733
f6060a4d
ILT
97342009-03-24 Rafael Avila de Espindola <espindola@google.com>
9735
9736 * object.cc (is_elf_object): Define.
9737 * object.h (is_elf_object): Declare.
9738 * archive.cc (Archive::get_elf_object_for_member): Call
9739 is_elf_object.
33aea2fd 9740 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 9741
26736d8e
ILT
97422009-03-24 Elliott Hughes <enh@google.com>
9743
9744 * output.cc (Output_file::map_anonymous): Define.
9745 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9746 try an anonymous one. Report the size if the mmap fails.
9747 * output.h (class Output_file): Declare map_anonymous.
9748
22fd9730
ILT
97492009-03-24 Ian Lance Taylor <iant@google.com>
9750
9751 * target-select.cc (instantiate_target): Don't acquire the lock if
9752 the instantiated_target_ field has already been set.
9753
cb010894
ILT
97542009-03-23 Ian Lance Taylor <iant@google.com>
9755
7f055c20
ILT
9756 * gold-threads.h (class Initialize_lock): Define.
9757 * gold-threads.cc (class Initialize_lock_once): Define.
9758 (initialize_lock_control): New static variable.
9759 (initialize_lock_pointer): New static variable.
9760 (initialize_lock_once): New static function.
9761 (Initialize_lock::Initialize_lock): Define.
9762 (Initialize_lock::initialize): Define.
9763 * target-select.h: Include "gold-threads.h".
9764 (class Target_selector): Add lock_ and initialize_lock_ fields.
9765 Don't define instantiate_target, just declare it.
9766 * target-select.cc (Target_selector::Target_selector): Initialize
9767 new fields.
9768 (Target_selector::instantiate_target): Define.
9769 * descriptors.h: Include "gold-threads.h".
9770 (class Descriptors): Add initialize_lock_ field.
9771 * descriptors.cc (Descriptors::Descriptors): Initialize new
9772 field.
9773 (Descriptors::open): Use initialize_lock_ field
9774 * errors.h (class Errors): Add initialize_lock_ field.
9775 * errors.cc (Errors::Errors): Initialize new field.
9776 (Errors::initialize_lock): Use initialize_lock_ field.
9777 * powerpc.cc (class Target_selector_powerpc): Remove
9778 instantiated_target_ field. In do_recognize call
9779 instantiate_target rather than do_instantiate_target. In
9780 do_instantiate_target just allocate a new target.
9781 * sparc.cc (class Target_selector_sparc): Likewise.
9782
36959681
ILT
9783 * freebsd.h: New file.
9784 * i386.cc: Include "freebsd.h".
9785 (Target_i386): Derive from Target_freebsd rather than
9786 Sized_target.
9787 (Target_selector_i386): Derive from Target_selector_freebsd rather
9788 than Target_selector.
9789 * x86_64.cc: Include "freebsd.h".
9790 (Target_x86_64): Derive from Target_freebsd rather than
9791 Sized_target.
9792 (Target_selector_x86_64): Derive from Target_selector_freebsd
9793 rather than Target_selector.
9794 * target.h (class Target): Add adjust_elf_header and
9795 do_adjust_elf_header.
9796 * output.cc (Output_file_header:: do_sized_write): Call target
9797 adjust_elf_header routine.
9798 * configure.tgt: Set targ_osabi.
9799 * configure.ac: Define GOLD_DEFAULT_OSABI.
9800 * parameters.cc (Parameters::default_target): Pass
9801 GOLD_DEFAULT_OSABI to select_target.
9802 * target-select.h (class Target_selector): Make instantiate_target
9803 protected rather than private.
9804 * Makefile.am (HFILES): Add freebsd.h.
9805 * configure, Makefile.in, config.in: Rebuild.
9806
cb010894
ILT
9807 * merge.cc (do_add_input_section): Correct pend value. Change
9808 message about last entry not being null terminated from error to
9809 warning.
9810
0e879927
ILT
98112009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9812
9813 * incremental.cc: New file.
9814 * Makefile.am (CCFILES): Add incremental.cc.
9815 * Makefile.in: Rebuild.
9816
41105937
PP
98172009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9818
9819 * layout.cc (Layout::output_section_name): Preserve names
9820 of '.note.' sections.
e1df38aa 9821
60439920
ILT
98222009-03-19 Ian Lance Taylor <iant@google.com>
9823
9824 * descriptors.cc (Descriptors::open): Check that the options are
9825 valid before using them.
9826
0d371ad3
ILT
98272009-03-18 Ian Lance Taylor <iant@google.com>
9828
9829 * script-sections.h: Include <list>.
9830 (class Script_sections): Change Sections_elements from std::vector
9831 to std::list. Typedef public Elements_iterator. Add
9832 orphan_section_placement_, data_segment_align_start_, and
9833 saw_data_segment_align_ fields. Remove data_segment_align_index_
9834 field.
9835 * script-sections.cc (class Orphan_section_placement): New class.
9836 (class Sections_element): Add virtual functions is_relro and
9837 orphan_section_init. Remove virtual function place_orphan_here.
9838 (class Output_section_definition): Add is_relro and
9839 orphan_section_init. Remove place_orphan_here.
9840 (class Orphan_output_section): Likewise.
9841 (Script_sections::Script_sections): Update for field changes.
9842 (Script_sections::data_segment_align): Set saw_data_segment_align_
9843 and data_segment_align_start_, not data_segment_align_index.
9844 (Script_sections::data_segment_relro_end): Check
9845 saw_data_segment_align_. Use data_segment_align_start_ rather
9846 than data_segment_align_index_.
9847 (Script_sections::place_orphan): Rewrite to use
9848 Orphan_section_placement.
9849
9201d894
ILT
98502009-03-17 Ian Lance Taylor <iant@google.com>
9851
9c5b8369
ILT
9852 * archive.cc (Archive::add_symbols): Check for a version attached
9853 to the symbol name in the archive map.
9854 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9855 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9856 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9857 (ver_test_11.a): New target.
9858 * testsuite/Makefile.in: Rebuild.
9859
9201d894
ILT
9860 * configure.ac: Check for chsize and posix_fallocate. Replace
9861 ftruncate.
9862 * ftruncate.c: New file, from gnulib.
9863 * output.cc (posix_fallocate): Define dummy version if not
9864 HAVE_POSIX_FALLOCATE.
9865 (Output_file::map): Call posix_fallocate rather than lseek and
9866 write.
9867 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9868 * configure, Makefile.in, config.in: Rebuild.
9869
ef4ab7a8 98702009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 9871
ef4ab7a8
PP
9872 * layout.h (Layout::create_note): Add section_name parameter.
9873 * layout.cc (Layout::create_note): Likewise.
9874 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 9875
8c500701
ILT
98762009-03-17 Ian Lance Taylor <iant@google.com>
9877
e85b18e1
ILT
9878 * descriptors.cc: Include "options.h".
9879 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9880 (Descriptors::open): Always use O_CLOEXEC when opening a new
9881 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9882 then set FD_CLOEXEC.
9883
9efe6174
ILT
9884 * sparc.cc (class Target_sparc): Add has_got_section.
9885 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9886 make sure we have a GOT section.
9887
9888 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9889 (Target_sparc::Scan::local): Likewise.
9890 (Target_sparc::Scan::global): Likewise.
9891 (Target_sparc::Relocate::relocate): Likewise.
9892 (Target_sparc::Relocate::relocate_tls): Likewise.
9893
8c500701
ILT
9894 * symtab.cc (Symbol_table::define_default_version): New function,
9895 broken out of add_from_object.
9896 (Symbol_table::add_from_object): Call define_default_version.
9897 (Symbol_table::define_special_symbol): Add resolve_oldsym
9898 parameter. Change all callers. If the version for a symbol comes
9899 from a version script, resolve it with the symbol with the same
9900 name with no version. Also add the symbol without a version if
9901 appropriate.
9902 (do_define_in_output_data): If resolving with oldsym, don't delete
9903 sym.
9904 (do_define_in_output_segment): Likewise.
9905 (do_define_as_constant): Likewise.
9906 * symtab.h (class Symbol_table): Update declarations.
9907
f1ed28fb
ILT
99082009-03-13 Ian Lance Taylor <iant@google.com>
9909
15f8229b
ILT
9910 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9911 (Read_symbols::requeue): New function.
9912 (Read_symbols::do_read_symbols): If make_elf_object fails because
9913 the target type is not configured, and the file was searched for,
9914 issue a warning and retry with the next directory.
9915 (Add_symbols::run): If the file has an incompatible format, and
9916 it was searched for, requeue the Read_symbols task. On error,
9917 release the object.
9918 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9919 dirindex parameter to constructor. Change all callers. Declare
9920 incompatible_warning and requeue.
9921 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9922 input_argument_ and input_group_ fields. Add them to
9923 constructor. Change all callers.
9924 (class Read_script): Add dirindex_ field. Add it to constructor.
9925 Change all callers.
9926 * archive.cc (Archive::setup): Remove input_objects parameter.
9927 Change all callers.
9928 (Archive::get_file_and_offset): Likewise.
9929 (Archive::read_all_symbols): Likewise.
9930 (Archive::read_symbols): Likewise.
9931 (Archive::get_elf_object_for_member): Remove input_objects
9932 parameter. Add punconfigured parameter. Change all callers.
9933 (Archive::add_symbols): Change return type to bool. Check return
9934 value of include_member.
9935 (Archive::include_all_members): Likewise.
9936 (Archive::include_member): Change return type to bool. Return
9937 false if first included object has incompatible target. Set
9938 included_member_ field.
9939 (Add_archive_symbols::run): If add_symbols returns false, requeue
9940 Read_symbols task.
9941 * archive.h (class Archive): Add included_member_ field.
9942 Initialize it in constructor. Add input_file and searched_for
9943 methods. Update declarations.
9944 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9945 input_argument_ fields. Add them to constructor. Change all
9946 callers.
9947 * script.cc: Include "target-select.h".
9948 (class Parser_closure): Add skip_on_incompatible_target_ and
9949 found_incompatible_target_ fields. Add
9950 skip_on_incompatible_target parameter to constructor. Change all
9951 callers. Add methods skip_on_incompatible_target,
9952 clear_skip_on_incompatible_target, found_incompatible_target, and
9953 set_found_incompatible_target.
9954 (read_input_script): Add dirindex parameter. Change all callers.
9955 If parser finds an incompatible target, requeue Read_symbols
9956 task.
9957 (script_set_symbol): Clear skip_on_incompatible_target in
9958 closure.
9959 (script_add_assertion, script_parse_option): Likewise.
9960 (script_start_sections, script_add_phdr): Likewise.
9961 (script_check_output_format): New function.
9962 * script.h (read_input_script): Update declaration.
9963 * script-c.h (script_check_output_format): Declare.
9964 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9965 (ignore_cmd): Remove OUTPUT_FORMAT.
9966 * fileread.cc (Input_file::Input_file): Add explicit this.
9967 (Input_file::will_search_for): New function.
9968 (Input_file::open): Add pindex parameter. Change all callers.
9969 * fileread.h (class Input_file): Add input_file_argument method.
9970 Declare will_search_for. Update declarations.
9971 * object.cc (make_elf_object): Add punconfigured parameter.
9972 Change all callers.
9973 * object.h (class Object): Make input_file public. Add
9974 searched_for method.
9975 (make_elf_object): Update declaration.
9976 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9977 restart search.
9978 * dirsearch.h (class Dirsearch): Update declaration.
9979 * options.h (class General_options): Add --warn-search-mismatch.
9980 * parameters.cc (Parameters::is_compatible_target): New function.
9981 * parameters.h (class Parameters): Declare is_compatible_target.
9982 * workqueue.cc (Workqueue::add_blocker): New function.
9983 * workqueue.h (class Workqueue): Declare add_blocker.
9984
f1ed28fb
ILT
9985 * fileread.cc (Input_file::open): Remove options parameter.
9986 Change all callers.
9987 (Input_file::open_binary): Likewise.
9988 * script.cc (read_input_script): Likewise.
9989 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9990 options parameter from constructor. Change all callers.
9991 (class Read_script): Likewise.
9992 * fileread.h (class Input_file): Update declarations.
9993 * script.h (read_input_script): Update declaration.
9994
34dd024a
NC
99952009-03-10 Nick Clifton <nickc@redhat.com>
9996
9997 * po/es.po: New Spanish translation.
9998
6d71b17c
CC
99992009-03-06 Cary Coutant <ccoutant@google.com>
10000
10001 * options.cc (parse_short_option): Keep dash_z from registering itself.
10002
031cdbed
ILT
100032009-03-03 Ian Lance Taylor <iant@google.com>
10004
10005 PR 9918
10006 * target-reloc.h (relocate_section): Pass output_section to
10007 relocate.
10008 * i386.cc (Target_i386::should_apply_static_reloc): Add
10009 output_section parameter. Change all callers.
10010 (Target_i386::Relocate::relocate): Add output_section parameter.
10011 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10012 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10013 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10014 * testsuite/two_file_shared.sh: New script.
10015 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10016 (check_DATA): Add two_file_shared.dbg.
10017 (two_file_shared.dbg): New target.
10018 * testsuite/Makefile.in: Rebuild.
10019
15d5fa16
ILT
100202009-03-01 Ian Lance Taylor <iant@google.com>
10021
10022 * configure.ac: Check for byteswap.h.
10023 * configure: Rebuild.
10024 * config.in: Rebuild.
10025
8a4c0b0d
ILT
100262009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10027
10028 * layout.cc (Layout::find_or_add_kept_section): New function.
10029 (Layout::add_comdat): Removed.
10030 * layout.h (struct Kept_section): Move out of class Layout.
10031 Remove trailing underscores from field names. Add group_sections
10032 field. Rename group_ field to is_group. Change all uses.
10033 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10034 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10035 comdat_groups_ field.
10036 (Sized_relobj::include_section_group): Use
10037 find_or_add_kept_section and Kept_section::group_sections.
10038 (Sized_relobj::include_linkonce_section): Likewise.
10039 * object.cc (class Sized_relobj): Don't define Comdat_group or
10040 Comdat_group_table. Remove find_comdat_group and
10041 add_comdat_group. Remove comdat_groups_ field.
10042 * plugin.cc (include_comdat_group): Use
10043 Layout::find_or_add_kept_section.
10044
b4ecf66b
ILT
100452009-02-28 Ian Lance Taylor <iant@google.com>
10046
14359ca0
ILT
10047 * README: --gc-sections and map files are now supported. Document
10048 some build requirements.
10049
b4ecf66b
ILT
10050 PR 6992
10051 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10052 relocatable link set the value of the section symbol to zero.
10053 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10054 relocatable link don't include the section address in the local
10055 symbol value.
10056
0602e05a
ILT
100572009-02-27 Ian Lance Taylor <iant@google.com>
10058
fd9d194f
ILT
10059 PR 6811
10060 * options.h (class Search_directory): Add is_system_directory.
10061 (class General_options): Declare is_in_system_directory.
10062 * options.cc (get_relative_sysroot): Make static.
10063 (get_default_sysroot): Make static.
10064 (General_optoins::is_in_system_directory): New function.
10065 * fileread.cc (Input_file::is_in_system_directory): New function.
10066 * fileread.h (class Input_file): Declare is_in_system_directory.
10067 * object.h (class Object): Add is_in_system_directory.
10068 (class Input_objects): Remove system_library_directory_ field.
10069 * object.cc (Input_objects::add_object): Don't set
10070 system_library_directory_.
10071 (input_objects::found_in_system_library_directory): Remove.
10072 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10073 parameter. Change all callers.
10074 (Symbol_table::sized_write_globals): Likewise.
10075 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10076 Call Object::is_in_system_directory.
10077 * symtab.h (class Symbol_table): Update declarations.
10078
61edd21f
ILT
10079 PR 5990
10080 * descriptors.h (Open_descriptor): Add is_on_stack field.
10081 * descriptors.cc (Descriptors::open): If the descriptor is on the
10082 top of the stack, remove it. Initialize is_on_stack field.
10083 (Descriptors::release): Only add pod to stack if it is not on the
10084 stack already.
10085 (Descriptors::close_some_descriptor): Clear stack_next and
10086 is_on_stack fields.
10087
e29e076a
ILT
10088 PR 7091
10089 * output.cc (Output_section::find_starting_output_address): Rename
10090 from starting_output_address; add PADDR parameter; change return
10091 type.
10092 * output.h (class Output_section): Declare
10093 find_starting_output_address instead of starting_output_address.
10094 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10095 section symbol for which we can't find a merge section.
10096
0602e05a
ILT
10097 PR 9836
10098 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10099 hidden or internal, force the symbol to be local.
10100 * resolve.cc (Symbol::override_visibility): Define.
10101 (Symbol::override_base): Use override_visibility.
10102 (Symbol_table::resolve): Likewise.
10103 (Symbol::override_base_with_special): Likewise.
10104 (Symbol_table::override_with_special): If the visibility is hidden
10105 or internal, force the symbol to be local.
10106 * symtab.h (class Symbol): Add set_visibility and
10107 override_visibility.
10108 * testsuite/ver_test_1.sh: New file.
10109 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10110 (check_DATA): Add ver_test_1.syms.
10111 (ver_test_1.syms): New target.
10112 * testsuite/Makefile.in: Rebuild.
10113
401a9a73
CC
101142009-02-25 Cary Coutant <ccoutant@google.com>
10115
10116 * layout.cc (Layout::choose_output_section): Don't rename sections
10117 when using a linker script that has a SECTIONS clause.
10118 * Makefile.in: Regenerate.
10119
10120 * testsuite/Makefile.am (script_test_5.sh): New test case.
10121 * testsuite/Makefile.in: Regenerate.
10122 * testsuite/script_test_5.cc: New file.
10123 * testsuite/script_test_5.sh: New file.
10124 * testsuite/script_test_5.t: New file.
10125
f488e4b0
CC
101262009-02-13 Rafael Avila de Espindola <espindola@google.com>
10127
10128 * archive.cc (Archive::include_member): Update calls to add_symbols.
10129 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10130 the Layout argument.
10131 * dynobj.h (do_add_symbols): Add the Layout argument.
10132 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10133 Layout argument.
10134 * object.h (Object::add_symbols): Add the Layout argument.
10135 (Object::do_add_symbols): Add the Layout argument.
10136 (Sized_relobj::do_add_symbols): Add the Layout argument.
10137 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10138 Unify the two versions.
10139 (Add_plugin_symbols): Remove.
10140 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10141 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10142 (Add_plugin_symbols): Remove.
10143 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10144 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10145 (Add_symbols::run): Make it work with Pulginobj.
10146
89dd1680
ILT
101472009-02-06 Ian Lance Taylor <iant@google.com>
10148
10149 * object.cc (Sized_relobj::do_layout): Make info message start
10150 with lower case letter.
10151
266d0a74
ILT
101522009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10153
602b464e
ILT
10154 * binary.cc: Fix file comment.
10155
266d0a74
ILT
10156 * options.h (enum Incremental_disposition): Define.
10157 (class General_options): Add new options: --incremental,
10158 --incremental_changed, --incremental_unchanged,
10159 --incremental_unknown. Add incremental_disposition_ and
10160 implicit_incremental_ fields.
10161 (General_options::incremental_disposition): New function.
10162 (class Position_dependent_options): Add incremental_disposition
10163 option.
10164 (Position_dependent_options::copy_from_options): Set incremental
10165 dispositions.
10166 * options.cc (General_options::parse_incremental_changed): New
10167 function.
10168 (General_options::parse_incremental_unchanged): New function.
10169 (General_options::parse_incremental_unknown): New function.
10170 (General_options::General_options): Initialize new fields
10171 incremental_disposition_ and implicit_incremental_.
10172 (General_options::finalize): Check for uasge of --incremental-*
10173 without --incremental.
10174
f073bbf7
CD
101752009-02-06 Chris Demetriou <cgd@google.com>
10176
10177 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10178 pointer and to report location as the file name associated with
10179 the symbol.
10180 (gold_undefined_symbol_at_location): New function to replace the
10181 old gold_undefined_symbol functionality.
10182 * target-reloc.h (relocate_section): Update to use
10183 gold_undefined_symbol_at_location.
10184 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10185 Call gold_undefined_symbol function rather than gold_error.
10186 * errors.h (Errors::undefined_symbol): Take location as a
10187 string, rather than calculating it from a relocation.
10188 * errors.cc (Errors::fatal): Print "fatal error:" before the
10189 formatted message.
10190 (Errors::error, Errors::error_at_location): Print "error: "
10191 before the formatted message.
10192 (Errors::undefined_symbol): Take location as a string, rather
10193 than calculating it from a relocation.
10194 (gold_undefined_symbol_at_location): New function akin to
10195 old gold_undefined_symbol, calculates location from relocation.
10196 (gold_undefined_symbol): Change to take only a Symbol pointer
10197 and to report location as the file name associated with the symbol.
10198 * testsuite/debug_msg.sh: Update for changed error messages.
10199 * testsuite/undef_symbol.sh: Likewise.
10200
8e94a90c
ILT
102012009-02-04 Duncan Sands <baldrick@free.fr>
10202
10203 PR 9812
10204 * reduced_debug_output.h
10205 (Output_reduced_debug_abbrev_section::failed): Use format for
10206 gold_warning.
10207 (Output_reduced_debug_info_section::faild): Likewise.
10208
88a0e15b
ILT
102092009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10210
10211 * script.cc (Lazy_demangler): New class.
10212 (Version_script_info::get_symbol_version_helper): Demangle a
10213 symbol only once.
10214
5efc7cd2
CC
102152009-01-29 Cary Coutant <ccoutant@google.com>
10216
10217 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10218 to __tls_get_addr.
10219 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10220
e0ebcf42
ILT
102212009-01-28 Ian Lance Taylor <iant@google.com>
10222
5efc7cd2 10223 * version.cc (version_string): Bump to 1.9.
75fe7426 10224
e0ebcf42
ILT
10225 * gold.h: Include <cstring> and <stdint.h>.
10226 * version.cc: Include <cstdio>.
10227 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10228 warning.
10229 * reduced_debug_output.cc (insert_into_vector): Rename from
10230 Insert_into_vector; change all callers. Use Swap_unaligned to
10231 avoid aliasing issue; remove union since it is unnecessary.
10232
8e2813be 102332009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
10234
10235 * Makefile.am (CCFILES): Add gc.cc.
10236 (HFILES): Add gc.h.
10237 * Makefile.in: Regenerate.
10238 * gold.cc (Gc_runner): New class.
10239 (queue_initial_tasks): Call garbage collection related tasks
10240 when corresponding options are invoked.
10241 (queue_middle_gc_tasks): New function.
10242 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10243 processed early before laying out sections during garbage collection.
10244 * gold.h (queue_middle_gc_tasks): New function.
10245 (is_prefix_of): Move from "layout.cc".
10246 * i386.cc (Target_i386::gc_process_relocs): New function.
10247 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10248 * main.cc (main): Create object of class "Garbage_collection".
10249 * object.cc (Relobj::copy_symbols_data): New function.
10250 (Relobj::is_section_name_included): New function.
e1df38aa
NC
10251 (Sized_relobj::do_layout): Allow this function to be called twice
10252 during garbage collection and defer layout of section during the
6d03d481
ST
10253 first call.
10254 * object.h (Relobj::get_symbols_data): New function.
10255 (Relobj::is_section_name_included): New function.
10256 (Relobj::copy_symbols_data): New function.
10257 (Relobj::set_symbols_data): New function.
10258 (Relobj::get_relocs_data): New function.
10259 (Relobj::set_relocs_data): New function.
10260 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10261 (Relobj::gc_process_relocs): New function.
10262 (Relobj::do_gc_process_relocs): New pure virtual function.
10263 (Relobj::sd_): New data member.
10264 (Sized_relobj::is_output_section_offset_invalid): New function.
10265 (Sized_relobj::do_gc_process_relocs): New function.
10266 * options.h (General_options::gc_sections): Modify to not be a no-op.
10267 (General_options::print_gc_sections): New option.
10268 * plugin.cc (Plugin_finish::run): Remove function call to
10269 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10270 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10271 * reloc.cc (Read_relocs::run): Add task to process relocs and
10272 determine unreferenced sections when doing garbage collection.
10273 (Gc_process_relocs): New class.
10274 (Sized_relobj::do_gc_process_relocs): New function.
10275 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10276 sections that are garbage collected.
10277 * reloc.h (Gc_process_relocs): New class.
10278 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10279 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10280 symbols whose corresponding sections are garbage collected.
10281 (Symbol_table::Symbol_table): Add new parameter for the garbage
10282 collection object.
10283 (Symbol_table::gc_mark_undef_symbols): New function.
10284 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10285 (Symbol_table::gc_mark_dyn_syms): New function.
10286 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10287 as garbage.
10288 (Symbol_table::add_from_object): Likewise.
10289 (Symbol_table::add_from_relobj): When building shared objects, do not
10290 treat externally visible symbols as garbage.
10291 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10292 table information for static and relocatable links.
10293 * symtab.h (Symbol_table::set_gc): New function.
10294 (Symbol_table::gc): New function.
10295 (Symbol_table::gc_mark_undef_symbols): New function.
10296 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10297 (Symbol_table::gc_mark_dyn_syms): New function.
10298 (Symbol_table::gc_): New data member.
e1df38aa 10299 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
10300 function.
10301 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10302 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10303
3b293544
CF
103042009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10305
10306 * options.h (General_options::gc_sections): Define as a no-op for now.
10307 (General_options::no_keep_memory): Ditto.
10308 (General_options::Bshareable): Define.
10309 * options.cc (General_options::finalize): Honor -Bshareable.
10310
83d22aa8
AS
103112009-01-20 Andreas Schwab <schwab@suse.de>
10312
10313 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10314 read the value in the contents, since we don't use it. Use the
10315 template endianness when writing.
10316 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10317
cd536b21
AS
103182009-01-19 Andreas Schwab <schwab@suse.de>
10319
10320 * configure.tgt (powerpc64-*): Fix targ_obj.
10321
99e9a495
ILT
103222009-01-15 Ian Lance Taylor <iant@google.com>
10323
10324 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10325 local symbols when stripping all symbols.
10326
bbbfea06
CC
103272009-01-14 Cary Coutant <ccoutant@google.com>
10328
99e9a495 10329 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 10330
0f7c0701
CC
103312009-01-14 Cary Coutant <ccoutant@google.com>
10332
10333 * archive.cc (Archive::get_elf_object_for_member): Remove call
10334 to File_read::claim_for_plugin.
10335 * descriptors.cc (Descriptors::open): Remove reference to
10336 is_claimed.
10337 (Descriptors::claim_for_plugin): Remove.
10338 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10339 (Descriptors::is_claimed): Remove.
10340 (claim_descriptor_for_plugin): Remove.
10341 * fileread.cc (File_read::claim_for_plugin): Remove.
10342 * fileread.h (File_read::claim_for_plugin): Remove.
10343 (File_read::descriptor): Reopen descriptor if necessary.
10344 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10345 (Plugin_manager::all_symbols_read): Add task parameter. Change
10346 all callers.
10347 (Plugin_manager::get_input_file): New function.
10348 (Plugin_manager::release_input_file): New function.
10349 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10350 corresponding data member.
10351 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10352 and pass to base constructor. Change all callers.
10353 (get_input_file, release_input_file): New functions.
10354 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10355 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10356 (Plugin_manager::all_symbols_read): Add task parameter.
10357 (Plugin_manager::get_input_file): New function.
10358 (Plugin_manager::release_input_file): New function.
10359 (Plugin_manager::task_): New data member.
10360 (Pluginobj::Pluginobj): Add filesize parameter.
10361 (Pluginobj::filename): New function.
10362 (Pluginobj::descriptor): New function.
10363 (Pluginobj::filesize): New function.
10364 (Pluginobj::filesize_): New data member.
10365 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10366 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10367 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10368
10369 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10370 with archive libraries.
10371 * testsuite/Makefile.in: Regenerate.
10372 * testsuite/plugin_test.c (struct sym_info): New type.
10373 (get_input_file, release_input_file): New static variables.
10374 (onload): Capture new transfer vector entries.
10375 (claim_file_hook): Stop reading at end of file according to filesize.
10376 Factor out parsing of readelf output into separate function.
10377 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10378 APIs and get the source file name from the symbol table. Convert
10379 source file name to corresponding object file name. Print info
10380 message when adding new input files.
10381 (parse_readelf_line): New function.
10382 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10383 * testsuite/plugin_test_2.sh: Likewise.
10384 * testsuite/plugin_test_3.sh: Likewise.
10385 * testsuite/plugin_test_4.sh: New test case.
10386
62a6d109
ILT
103872009-01-07 Ian Lance Taylor <iant@google.com>
10388
10389 * version.cc (version_string): Bump to 1.8.
10390
483620e8
CC
103912008-12-23 Cary Coutant <ccoutant@google.com>
10392
10393 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10394 * plugin.cc (Plugin_manager::finish): Rename as
10395 layout_deferred_objects. Move cleanup to separate function.
10396 (Plugin_manager::cleanup): New function.
10397 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10398 separately.
10399 * plugin.h (Plugin_manager::finish): Rename as
10400 layout_deferred_objects.
10401 (Plugin_manager::cleanup): New function.
10402 (Plugin_manager::cleanup_done): New field.
10403
d66a9eb3
CC
104042008-12-23 Cary Coutant <ccoutant@google.com>
10405
10406 * plugin.cc (is_visible_from_outside): New function.
10407 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10408 so we don't return "IR only" status for exported symbols or -r links.
10409
10410 * testsuite/Makefile.am (plugin_test_3): New test case.
10411 * testsuite/Makefile.in: Regenerate.
10412 * testsuite/plugin_test_3.sh: New file.
10413
5995b570
CC
104142008-12-22 Cary Coutant <ccoutant@google.com>
10415
10416 * object.cc (Sized_relobj::layout_section): New function.
10417 (Sized_relobj::do_layout): Defer layout of input sections until after
10418 plugin has provided replacement files.
10419 (Sized_relobj::do_layout_deferred_sections): New function.
10420 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10421 (Relobj::layout_deferred_sections): New function.
10422 (Relobj::do_layout_deferred_sections): New function.
10423 (Sized_relobj::do_layout_deferred_sections): New function.
10424 (Sized_relobj::layout_section): New function.
10425 (Sized_relobj::Deferred_layout): New structure.
10426 (Sized_relobj::deferred_layout_): New field.
10427 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10428 Change all callers. Layout deferred sections.
10429 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10430 references.
10431 (Plugin_hook::run): Move code from do_plugin_hook inline.
10432 (Plugin_hook::do_plugin_hook): Remove.
10433 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10434 (Plugin_manager::finish): Renamed, was cleanup.
10435 (Plugin_manager::should_defer_layout): New function.
10436 (Plugin_manager::add_deferred_layout_object): New function.
10437 (Plugin_manager::Deferred_layout_list): New type.
10438 (Plugin_manager::deferred_layout_objects_): New field.
10439 (Plugin_hook::do_plugin_hook): Remove.
10440
ee769c88
ILT
104412008-12-17 Ian Lance Taylor <iant@google.com>
10442
10443 * options.h (class General_options): Add --no case for
10444 --export-dynamic.
10445
abc8dcba
CC
104462008-12-16 Cary Coutant <ccoutant@google.com>
10447
10448 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10449 vector.
10450 (Plugin_manager::claim_file): Create plugin object even if
10451 plugin did not call the add_symbols callback.
10452 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10453 asking for more symbols than were added.
10454 * testsuite/Makefile.am (plugin_test_1): Add test case with
10455 no global symbols.
10456 (empty.syms): New target.
10457 * testsuite/Makefile.in: Regenerate.
10458 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10459 message. Don't call add_symbols if no globals.
10460 (all_symbols_read_hook): Don't provide replacement for empty
10461 claimed file.
10462
b0074644
ILT
104632008-12-12 Ian Lance Taylor <iant@google.com>
10464
68943102
ILT
10465 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10466 r_type == 0 for a local symbol with r_sym == 0.
10467 (scan_relocatable_relocs): Pass r_sym to
10468 local_non_section_strategy.
10469 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10470 r_sym parameter.
10471
b0074644
ILT
10472 * configure.ac: Update test for TLS descriptors: they are
10473 supported as of glibc 2.9.
10474 * configure: Rebuild.
10475
c2508178
ILT
104762008-12-11 Ian Lance Taylor <iant@google.com>
10477
10478 PR 7091
10479 * target-reloc.h (Default_scan_relocatable_relocs): For each
10480 function, map r_type == 0 to RELOC_DISCARD.
10481
2756a258
CC
104822008-12-10 Cary Coutant <ccoutant@google.com>
10483
10484 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10485 object to override a kept COMDAT group from a plugin object.
10486
bb6f53d3
ILT
104872008-12-09 Ian Lance Taylor <iant@google.com>
10488
fbc558e1
ILT
10489 PR 7088
10490 * yyscript.y (file_cmd): Handle INPUT.
10491
bb6f53d3
ILT
10492 * testsuite/initpri1.c: Change all declarations to be full
10493 prototypes by adding void, to avoid compiler warnings.
10494
4674ecfc
CC
104952008-12-05 Rafael Avila de Espindola <espindola@google.com>
10496
10497 * options.cc (General_options::parse_plugin_opt): New.
10498 (General_options::add_plugin): The argument now is just the filename.
10499 (General_options::add_plugin_option): New.
10500 * options.h (plugin_opt): New.
10501 (add_plugin): Change argument name.
10502 (add_plugin_option): New.
10503 * plugin.cc (Plugin::load): Don't parse the plugin option.
10504 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10505 (Plugin::add_option): New.
10506 (Plugin::args_): Change type.
10507 (Plugin::filename_): New.
10508 (Plugin_manager::add_plugin_option): New.
10509 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10510 * testsuite/Makefile.in: Regenerate.
10511
fd06b4aa
CC
105122008-12-05 Cary Coutant <ccoutant@google.com>
10513
10514 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10515 Handle --strip-lto-sections option.
10516 * options.h (strip_lto_sections): New option.
10517
6c52134c
CC
105182008-12-01 Cary Coutant <ccoutant@google.com>
10519
10520 * plugin.cc (ld_plugin_message): Change format parameter to const.
10521 Fix mismatch between new[] and delete.
10522
a45248e0
CC
105232008-11-14 Cary Coutant <ccoutant@google.com>
10524
10525 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10526 instead of -1U.
10527
c82fbeee
CS
105282008-11-05 Craig Silverstein <csilvers@google.com>
10529
10530 * options.cc (General_options::parse_dynamic_list): New function.
10531 * options.h (General_options): New flags dynamic_list,
10532 dynamic_list_data, dynamic_list_cpp_new, and
10533 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10534 (General_options::in_dynamic_list): New function.
10535 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10536 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10537 (Lex::can_continue_name): Likewise.
10538 (yylex): Likewise.
10539 (read_script_file): New parameter script_options.
10540 (read_dynamic_list): New function.
10541 (Script_options::define_dynamic_list): New function.
10542 (dynamic_list_keyword_parsecodes): New variable.
10543 (dynamic_list_keywords): New variable.
10544 * script.h (Script_options::define_dynamic_list): New function
10545 prototype.
10546 (read_dynamic_list): New function prototype.
10547 * symtab.cc (strprefix): New macro.
10548 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10549 dynamic_list_data, dynamic_list_cpp_new, and
10550 dynamic_list_cpp_typeinfo.
10551 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10552 (dynamic_list_expr): New rule.
10553 (dynamic_list_nodes): Likewise.
10554 (dynamic_list_node): Likewise.
10555 * testsuite/Makefile.am (dynamic_list): New test.
10556 * testsuite/Makefile.in: Regenerated.
10557 * testsuite/dynamic_list.t: New file.
10558 * testsuite/dynamic_list.sh: New file.
10559
e0bb29a5
CS
105602008-11-05 Craig Silverstein <csilvers@google.com>
10561
10562 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10563 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10564 (t11_last): Likewise.
10565 * testsuite/ver_test_6.c (main): Likewise.
10566
4e1e25e0
CC
105672008-10-07 Cary Coutant <ccoutant@google.com>
10568
10569 * options.c (General_options::finalize): Add check for -static and
10570 -shared.
10571 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10572 is not empty.
10573
92f03fcb
CC
105742008-10-02 Cary Coutant <ccoutant@google.com>
10575
10576 * plugin.cc (make_sized_plugin_object): Fix conditional
10577 compilation to work when not all targets are enabled.
10578
fbd8a257
CC
105792008-09-29 Cary Coutant <ccoutant@google.com>
10580
10581 * archive.cc (Archive::get_file_and_offset): Use filename instead
10582 of name to get library path.
10583 (Archive::include_member): Unlock external member of a thin archive.
10584
10585 * testsuite/Makefile.am (TEST_AR): New variable.
10586 (thin_archive_test_1): New test.
10587 (thin_archive_test_2): New test.
81636b3f
CC
10588 * testsuite/Makefile.in: Regenerate.
10589 * testsuite/thin_archive_main.cc: New file.
10590 * testsuite/thin_archive_test_1.cc: New file.
10591 * testsuite/thin_archive_test_2.cc: New file.
10592 * testsuite/thin_archive_test_3.cc: New file.
10593 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 10594
eff45813
CC
105952008-09-29 Cary Coutant <ccoutant@google.com>
10596
10597 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10598 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10599 instead of -1U.
10600 (Sized_relobj::do_finalize_local_symbols): Likewise.
10601 (Sized_relobj::map_to_kept_section): Likewise.
10602 * object.h (Sized_relobj::invalid_address): New constant.
10603 (Sized_relobj::do_output_section_offset): Check for invalid_address
10604 and return -1ULL.
10605 * output.cc (Output_reloc::local_section_offset): Use constant
10606 invalid_address instead of -1U.
10607 (Output_reloc::get_address): Likewise.
10608 (Output_section::output_address): Change -1U to -1ULL.
10609 * output.h (Output_reloc::invalid_address): New constant.
10610 * reloc.cc (Sized_relobj::write_sections): Use constant
10611 invalid_address instead of -1U.
10612 (Sized_relobj::relocate_sections): Likewise.
10613 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10614 values for merge sections.
10615 * target-reloc.h (relocate_for_relocatable): Use constant
10616 invalid_address instead of -1U.
10617
89fc3421
CC
106182008-09-19 Cary Coutant <ccoutant@google.com>
10619
10620 Add plugin functionality for link-time optimization (LTO).
10621 * configure.ac (plugins): Add --enable-plugins option.
10622 * configure: Regenerate.
10623 * config.in: Regenerate.
10624 * Makefile.am (LIBDL): New variable.
10625 (CCFILES): Add plugin.cc.
10626 (HFILES): Add plugin.h.
10627 (ldadd_var): Add LIBDL.
10628 * Makefile.in: Regenerate.
10629
10630 * archive.cc: Include "plugin.h".
10631 (Archive::setup): Don't preread archive symbols when using a plugin.
10632 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10633 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10634 files.
10635 (Archive::include_member): Add symbols from plugin objects.
10636 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10637 * descriptors.cc (Descriptors::open): Check for file descriptors
10638 abandoned by plugins.
10639 (Descriptors::claim_for_plugin): New function.
10640 * descriptors.h (Descriptors::claim_for_plugin): New function.
10641 (Open_descriptor::is_claimed): New field.
10642 (claim_descriptor_for_plugin): New function.
10643 * fileread.cc (File_read::claim_for_plugin): New function.
10644 * fileread.h (File_read::claim_for_plugin): New function.
10645 (File_read::descriptor): New function.
10646 * gold.cc: Include "plugin.h".
10647 (queue_initial_tasks): Add task to call plugin hooks for generating
10648 new object files.
10649 * main.cc: Include "plugin.h".
10650 (main): Load plugin libraries.
10651 * object.h (Pluginobj): Declare.
10652 (Object::pluginobj): New function.
10653 (Object::do_pluginobj): New function.
10654 (Object::set_target): New function.
10655 * options.cc: Include "plugin.h".
10656 (General_options::parse_plugin): New function.
10657 (General_options::General_options): Initialize plugins_ field.
10658 (General_options::add_plugin): New function.
10659 * options.h (Plugin_manager): Declare.
10660 (General_options): Add --plugin option.
10661 (General_options::has_plugins): New function.
10662 (General_options::plugins): New function.
10663 (General_options::add_plugin): New function.
10664 (General_options::plugins_): New field.
10665 * plugin.cc: New file.
10666 * plugin.h: New file.
10667 * readsyms.cc: Include "plugin.h".
10668 (Read_symbols::do_read_symbols): Check for archive before checking
10669 for ELF file. Call plugin hooks to claim files.
10670 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10671 from a real object file; force override when processing replacement
10672 files.
10673 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10674 (Symbol::init_base_object): Likewise.
10675 (Symbol::init_base_output_data): Likewise.
10676 (Symbol::init_base_output_segment): Likewise.
10677 (Symbol::init_base_constant): Likewise.
10678 (Symbol::init_base_undefined): Likewise.
10679 (Symbol::output_section): Assert that object is not a plugin.
10680 (Symbol_table::add_from_pluginobj): New function.
10681 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10682 undefined.
10683 (Symbol_table::sized_write_globals): Likewise.
10684 (Symbol_table::add_from_pluginobj): Instantiate template.
10685 * symtab.h (Sized_pluginobj): Declare.
10686 (Symbol::in_real_elf): New function.
10687 (Symbol::set_in_real_elf): New function.
10688 (Symbol::in_real_elf_): New field.
10689 (Symbol_table::add_from_pluginobj): New function.
10690
10691 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10692 (LIBDL): New variable.
10693 (LDADD): Add LIBDL.
10694 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10695 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10696 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10697 (MOSTLYCLEANFILES): Likewise.
10698 * testsuite/Makefile.in: Regenerate.
10699 * testsuite/plugin_test.c: New file.
10700 * testsuite/plugin_test_1.sh: New file.
10701 * testsuite/plugin_test_2.sh: New file.
10702
de31bda5
ILT
107032008-09-16 Ian Lance Taylor <iant@google.com>
10704
9c2d0ef9
ILT
10705 * target-reloc.h (relocate_section): Check whether a symbol is
10706 defined by the ABI before reporting an undefined symbol error.
10707 * target.h (Target::is_defined_by_abi): Make parameter const.
10708 (Target::do_is_defined_by_abi): Likewise.
10709 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10710 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10711 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10712 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10713 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10714 * testsuite/Makefile.in: Rebuild.
10715
de31bda5
ILT
10716 * fileread.cc (make_view): Add casts to avoid warning.
10717
9fa33bee
AO
107182008-09-16 Alexandre Oliva <aoliva@redhat.com>
10719
10720 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10721 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10722
183fd0e3
AO
107232008-09-16 Alexandre Oliva <aoliva@redhat.com>
10724
10725 * options.h (General_options::output_is_executable): New.
10726 (General_options::output_is_pie): New.
10727 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10728 for shared libraries.
10729 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10730
7be8330a
CD
107312008-09-11 Chris Demetriou <cgd@google.com>
10732
10733 * options.h (origin): New -z option.
10734 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10735 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10736 in DT_FLAGS_1.
10737
a9caad02
CC
107382008-09-05 Cary Coutant <ccoutant@google.com>
10739
10740 * fileread.cc (File_read::make_view): Add check for attempt to map
10741 beyond end of file.
10742
ae6dce4d
CC
107432008-09-05 Cary Coutant <ccoutant@google.com>
10744
10745 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10746 explicit instantiations.
10747
d7ab2a47
KVH
107482008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10749
10750 PR gold/6858
10751 * options.cc (General_options::finalize): Allow undefined symbols
10752 in shlibs if linking -shared.
10753
10754 PR gold/6859
10755 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10756 symbols as not needing a dynsym entry.
10757
1e52a9c1
CS
107582008-08-20 Craig Silverstein <csilvers@google.com>
10759
10760 * fileread.cc (File_read::open): Do not lock the file unless it
10761 was successfully opened.
10762
d85c80a3
CC
107632008-08-14 Cary Coutant <ccoutant@google.com>
10764
10765 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10766 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10767 * testsuite/tls_test.cc (struct int128): 128-bit struct
10768 for testing TLS relocs with non-zero addend.
10769 (v12): New TLS variable.
10770 (t12): New test.
10771 (t_last): Add check for v12.
10772 * testsuite/tls_test.h (t12): New function.
10773 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10774
2d924fd9
ILT
107752008-08-13 Ian Lance Taylor <iant@google.com>
10776
10777 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10778 set tls_segment_ or relro_segment_.
10779 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10780 when appropriate.
10781 * output.h (Output_section::clear_is_relro): New function.
10782 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10783 sections specially even when output_data_ is empty.
10784 (Output_segment::maximum_alignment): When first section is relro,
10785 only force alignment for PT_LOAD segments.
10786 * script.cc (script_data_segment_align): New function.
10787 (script_data_segment_relro_end): New function.
10788 * script-c.h (script_data_segment_align): Declare.
10789 (script_data_segment_relro_end): Declare.
10790 * script-sections.h (class Script_sections): Declare
10791 data_segment_align and data_segment_relro_end. Add fields
10792 segment_align_index_ and saw_relro_end_.
10793 * script-sections.cc (class Sections_element): Add set_is_relro
10794 virtual function. Add new bool* parameter to place_orphan_here.
10795 Add get_output_section virtual function.
10796 (class Output_section_definition): Add set_is_relro. Add new
10797 bool* parameter to place_orphan_here. Add get_output_section.
10798 Add is_relro_ field.
10799 (Output_section_definition::Output_section_definition): Initialize
10800 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10801 and is_relro_ fields.
10802 (Output_section_definition::place_orphan_here): Add is_relro
10803 parameter.
10804 (Output_section_definition::set_section_addresses): Set relro for
10805 output section.
10806 (Output_section_definition::alternate_constraint): Likewise.
10807 (class Orphan_output_section): Add new bool* parameter to
10808 place_orphan_here. Add get_output_section.
10809 (Orphan_output_section::place_orphan_here): Add is_relro
10810 parameter.
10811 (Script_sections::Script_sections): Initialize
10812 data_segment_align_index_ and saw_relro_end_.
10813 (Script_sections::data_segment_align): New function.
10814 (Script_sections::data_segment_relro_end): New function.
10815 (Script_sections::place_orphan): Set or clear is_relro.
10816 (Script_sections::set_section_addresses): Force alignment of first
10817 TLS section.
10818 * yyscript.y (exp): Call script_data_segment_align and
10819 script_data_segment_relro_end.
10820 * testsuite/relro_script_test.t: New file.
10821 * testsuite/relro_test.cc (using_script): Declare.
10822 (t1, t2): Test using_script.
10823 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10824 (relro_script_test_SOURCES): Define.
10825 (relro_script_test_DEPENDENCIES): Define.
10826 (relro_script_test_LDFLAGS): Define.
10827 (relro_script_test_LDADD): Define.
10828 (relro_script_test.so): New target.
10829 * testsuite/Makefile.in: Rebuild.
10830
f827c9a9
CC
108312008-08-06 Cary Coutant <ccoutant@google.com>
10832
10833 * archive.cc (Archive::total_archives, Archive::total_members)
10834 (Archive::total_members_loaded): New variables.
10835 (Archive::setup): Add parameter. Add option to preread
10836 archive symbols.
10837 (Archive::read_armap): Add counter.
10838 (Archive::get_file_and_offset): New function.
10839 (Archive::get_elf_object_for_member): New function.
10840 (Archive::read_all_symbols): New function.
10841 (Archive::read_symbols): New function.
10842 (Archive::add_symbols): Add counters.
10843 (Archive::include_all_members): Use armap to find members if it's
10844 already built.
10845 (Archive::include_member): Skip reading symbols if already read.
10846 Factored code into Archive::get_file_and_offset and
10847 Archive::get_elf_object_for_member. Changed call to
10848 Mapfile::report_include_archive_member.
10849 (Archive::print_stats): New function.
10850 * archive.h: Declare Object and Read_symbols_data classes.
10851 (Archive::Archive): Add initializers for new members.
10852 (Archive::setup): Add parameter.
10853 (Archive::print_stats): New function.
10854 (Archive::total_archives, Archive::total_members)
10855 (Archive::total_members_loaded): New variables.
10856 (Archive::get_file_and_offset): New function.
10857 (Archive::get_elf_object_for_member): New function.
10858 (Archive::read_all_symbols): New function.
10859 (Archive::read_symbols): New function.
10860 (Archive::Archive_member): New class.
10861 (Archive::members_): New member.
10862 (Archive::num_members_): New member.
10863 * main.cc: Include archive.h.
10864 (main): Call Archive::print_stats.
10865 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10866 archive parameter; member_name is now the fully-decorated name.
10867 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10868 * options.h: (General_options): Add --preread-archive-symbols option.
10869 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10870 Archive::setup.
10871
de4c45bd
ILT
108722008-08-04 Ian Lance Taylor <iant@google.com>
10873
10874 * symtab.h (Symbol::use_plt_offset): New function.
10875 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10876 * powerpc.cc (Relocate::relocate): Likewise.
10877 * sparc.cc (Relocate::relocate): Likewise.
10878 * x86_64.cc (Relocate::relocate): Likewise.
10879 * testsuite/weak_plt.sh: New test.
10880 * testsuite/weak_plt_main.cc: New test.
10881 * testsuite/weak_plt_shared.cc: New test.
10882 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10883 (check_PROGRAMS): Add weak_plt.
10884 (check_DATA): Add weak_plt_shared.so.
10885 (weak_plt_main_pic.o, weak_plt): New targets.
10886 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10887 * testsuite/Makefile.in: Rebuild.
10888
10889 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10890 gcctestdir/ld.
10891 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10892 * testsuite/Makefile.in: Rebuild.
10893
323ee3f4
AM
108942008-08-04 Alan Modra <amodra@bigpond.net.au>
10895
10896 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10897 * Makefile.in: Regenerate.
10898 * po/POTFILES.in: Regenerate.
10899
7c07ecec
ILT
109002008-07-29 Ian Lance Taylor <iant@google.com>
10901
10902 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10903 symbols before other symbols.
10904 * testsuite/script_test_2.cc (test_addr): Declare.
10905 (test_addr_alias): Declare.
10906 (main): Check that test_addr and test_addr_alias have the right
cd536b21 10907 values.
7c07ecec
ILT
10908 * testsuite/script_test_2.t: Define test_addr_alias and
10909 test_addr.
10910
5778530e
ILT
109112008-07-24 Ian Lance Taylor <iant@google.com>
10912
2a00e4fb
ILT
10913 PR 5990
10914 * descriptors.cc: New file.
10915 * descriptors.h: New file.
10916 * gold-threads.h (class Hold_optional_lock): New class.
10917 * fileread.cc: Include "descriptors.h".
10918 (File_read::~File_read): Release descriptor rather than closing
10919 it.
10920 (File_read::open) [file]: Call open_descriptor rather than open.
10921 Set is_descriptor_opened_.
10922 (File_read::open) [memory]: Assert that descriptor is not open.
10923 (File_read::reopen_descriptor): New function.
10924 (File_read::release): Release descriptor.
10925 (File_read::do_read): Make non-const. Reopen descriptor.
10926 (File_read::read): Make non-const.
10927 (File_read::make_view): Reopen descriptor.
10928 (File_read::do_readv): Likewise.
10929 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10930 Update declarations.
10931 * layout.cc: Include "descriptors.h".
10932 (Layout::create_build_id): Use open_descriptor rather than open.
10933 * output.cc: Include "descriptors.h".
10934 (Output_file::open): Use open_descriptor rather than open.
10935 * archive.cc (Archive::const_iterator): Change Archive to be
10936 non-const.
10937 (Archive::begin, Archive::end): Make non-const.
10938 (Archive::count_members): Likewise.
10939 * archive.h (class Archive): Update declarations.
10940 * object.h (Object::read): Make non-const.
10941 * Makefile.am (CCFILES): Add descriptors.cc.
10942 (HFILES): Add descriptors.h.
10943 * Makefile.in: Rebuild.
10944
801647d1
ILT
10945 PR 6716
10946 * gold.h: Always include <clocale>. Add Solaris workarounds
10947 following code in binutils/sysdep.h.
10948
5edd166e
ILT
10949 PR 6048
10950 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10951 this->eh_frame_hdr_ is NULL before using it.
10952
c89ad728
ILT
10953 * dynobj.cc (Versions::Versions): Update comment.
10954
aa86f06b
ILT
10955 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10956 the base version name.
10957
5778530e
ILT
10958 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10959 array size plus one.
10960 (Stringpool_template::set_string_offsets): Subtract one from key
10961 before using it as an array index.
10962 (Stringpool_template::get_offset_with_length): Likewise.
10963 (Stringpool_template::write_to_buffer): Likewise.
10964 * stringpool.h (Stringpool_template::get_offset_from_key):
10965 Likewise.
10966
057ead22
ILT
109672008-07-23 Ian Lance Taylor <iant@google.com>
10968
7f649c59
ILT
10969 PR 6658
10970 * object.h (Merged_symbol_value::value): Do our best to handle a
10971 negative addend.
10972
057ead22
ILT
10973 PR 6647
10974 * script.cc (Version_script_info::get_versions): Don't add empty
10975 version tag to return value.
10976 (Version_script_info::get_symbol_version_helper): Change return
10977 type to bool. Add pversion parameter. Change all callers.
10978 (script_register_vers_node): Don't require a non-NULL tag.
10979 * script.h (class Version_script_info): Update declarations.
10980 (Version_script_info::get_symbol_version): Change return type to
10981 bool. Add version parameter. Change all callers.
10982 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10983 handling. Handle an empty version from a version script.
10984 (Symbol_table::define_special_symbol): Likewise.
10985 * testsuite/ver_test_10.script: New file.
10986 * testsuite/ver_test_10.sh: New file.
10987 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10988 (check_DATA): Add ver_test_10.syms.
10989 (ver_test_10.syms, ver_test_10.so): New target.
10990 * testsuite/Makefile.in: Rebuild.
10991
58e54ac2
CD
109922008-07-23 Simon Baldwin <simonb@google.com>
10993
10994 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10995 to zero for undefined symbols from dynamic libraries.
10996
95d14cd3
ILT
109972008-07-23 Ian Lance Taylor <iant@google.com>
10998
10999 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11000 Change all callers.
11001 * symtab.h (class Symbol_table): Update declaration.
11002 * testsuite/ver_test_9.cc: New file.
11003 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11004 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11005 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11006 (ver_test_9.so, ver_test_9.o): New targets.
11007 * testsuite/Makefile.in: Rebuild.
11008
92de84a6
ILT
110092008-07-22 Ian Lance Taylor <iant@google.com>
11010
34810851
ILT
11011 * options.h (class General_options): Define --check-sections.
11012 * layout.cc (Layout::set_segment_offsets): Handle
11013 --check-sections.
11014
af6156ef
ILT
11015 * options.h (class General_options): Define -n/--nmagic and
11016 -N/--omagic.
11017 * options.cc (General_options::finalize): For -n/--nmagic or
11018 -N/--omagic, set -static.
11019 * layout.cc (Layout::attach_allocated_section_to_segment): If
11020 -N/--omagic, don't put read-only and read-write sections in
11021 different segments.
11022 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11023 finding a read-only segment.
11024 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11025 don't set the minimum segment alignment to the common page size,
11026 and don't set the file offset to the address modulo the page size.
11027 * script-sections.cc (Script_sections::create_segments): If
11028 -n/--omagic, don't put read-only and read-write sections in
11029 different segments.
11030
92de84a6
ILT
11031 * cref.cc: New file.
11032 * cref.h: New file.
11033 * options.h (class General_options): Add --print-symbol-counts.
11034 * main.cc (main): Issue defined symbol report if requested.
11035 * archive.cc (Archive::interpret_header): Make into a const member
11036 function.
11037 (Archive::add_symbols): Call Input_objects::archive_start and
11038 archive_stop.
11039 (Archive::const_iterator): Define new class.
11040 (Archive::begin, Archive::end): New functions.
11041 (Archive::include_all_members): Rewrite to use iterator.
11042 (Archive::count_members): New function.
11043 * archive.h (class Archive): Update declarations.
11044 (Archive::filename): New function.
11045 * object.cc: Include "cref.h".
11046 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11047 (Sized_relobj::do_get_global_symbol_counts): New function.
11048 (Input_objects::add_object): Add object to cross-referencer.
11049 (Input_objects::archive_start): New function.
11050 (Input_objects::archive_stop): New function.
11051 (Input_objects::print_symbol_counts): New function.
11052 * object.h: Declare Cref and Archive.
11053 (Object::get_global_symbol_counts): New function.
11054 (Object::do_get_global_symbol_counts): New pure virtual function.
11055 (class Sized_relobj): Add defined_count_ field. Update
11056 declarations.
11057 (class Input_objects): Add cref_ field. Update constructor.
11058 Update declarations.
11059 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11060 defined_count_.
11061 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11062 symbol counts.
11063 (Sized_dynobj::do_get_global_symbol_counts): New function.
11064 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11065 defined_count_. Update declarations. Define Symbols typedef.
11066 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11067 parameter. Change all callers.
11068 (Symbol_table::add_from_dynobj): Add sympointers and defined
11069 parameters. Change all callers.
11070 * symtab.h (class Symbol_table): Update declarations.
11071 * Makefile.am (CCFILES): Add cref.cc.
11072 (HFILES): Add cref.h.
11073 * Makefile.in: Rebuild.
11074
3f7c5e1d
CD
110752008-07-22 Simon Baldwin <simonb@google.com>
11076
11077 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11078 to zero when writing undefined symbols.
11079
e0b64032
ILT
110802008-07-22 Ian Lance Taylor <iant@google.com>
11081
11082 * output.cc (Output_section::add_input_section): Don't try to
11083 merge empty merge sections.
11084
096b02cf
CS
110852008-07-21 Craig Silverstein <csilvers@google.com>
11086
11087 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11088 Include symbol version in error message.
cd536b21 11089
1d1f116d
CD
110902008-07-20 Chris Demetriou <cgd@google.com>
11091
cd536b21 11092 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
11093 (RANDOM_SEED_CFLAGS): New substituted variable.
11094 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11095 * configure: Rebuild.
11096 * Makefile.in: Likewise.
11097 * testsuite/Makefile.in: Likewise.
11098
a18f591e
ILT
110992008-07-18 Ian Lance Taylor <iant@google.com>
11100
11101 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11102 where we see NAME/NULL and NAME/VERSION as separate symbols.
11103 * testsuite/ver_test_main.cc (main): Call t4.
11104 (t4, t4_2a): Define.
11105 * testsuite/ver_test_2.cc (t4_2): Define.
11106 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11107 * testsuite/ver_test_4.cc (t4_2a): Define.
11108 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11109 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11110
c6e3f6ed
ILT
111112008-07-17 Ian Lance Taylor <iant@google.com>
11112
11113 * dynobj.cc (Versions::add_def): If we give an error about a
11114 missing version, go ahead and create the version anyhow.
11115
ef9beddf
ILT
111162008-07-10 Ian Lance Taylor <iant@google.com>
11117
11118 Handle output sections with more than 0x7fffffff bytes.
11119 * object.h (class Relobj): Change map_to_output_ to
11120 output_sections_, and just keep a section pointer. Change all
11121 uses. Move comdat group support to Sized_relobj.
11122 (Relobj::is_section_specially_mapped): Remove.
11123 (Relobj::output_section): Remove poff parameter. Change all
11124 callers.
11125 (Relobj::output_section_offset): New function.
11126 (Relobj::set_section_offset): Rewrite.
11127 (Relobj::map_to_output): Remove.
11128 (Relobj::output_sections): New function.
11129 (Relobj::do_output_section_offset): New pure virtual function.
11130 (Relobj::do_set_section_offset): Likewise.
11131 (class Sized_relobj): Add section_offsets_ field. Add comdat
11132 group support from Relobj. Update declarations.
11133 (Sized_relobj::get_output_section_offset): New function.
11134 (Sized_relobj::do_output_section_offset): New function.
11135 (Sized_relobj::do_set_section_offset): New function.
11136 * object.cc (Relobj::output_section_address): Remove.
11137 (Sized_relobj::Sized_relobj): Initialize new fields.
11138 (Sized_relobj::include_section_group): Cast find_kept_object to
11139 Sized_relobj.
11140 (Sized_relobj::include_linkonce_section): Likewise.
11141 (Sized_relobj::do_layout): Use separate arrays for output section
11142 and output offset.
11143 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11144 output_sections.
11145 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11146 output_sections and section_offsets.
11147 (Sized_relobj::write_local_symbols): Likewise.
11148 (map_to_kept_section): Compute output address directly.
11149 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11150 output_sections and section_offsets.
11151 (Sized_relobj::write_sections): Likewise.
11152 (Sized_relobj::relocate_sections): Likewise.
11153 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11154 * output.h (class Output_reloc): Update declarations. Change
11155 u2_.relobj to Sized_relobj*.
11156 (class Output_data_reloc): Change add functions to use
11157 Sized_relobj*.
11158 * output.cc (Output_reloc::Output_reloc): Change relobj to
11159 Sized_relobj*.
11160 (Output_reloc::local_section_offset): Change return type to
11161 Elf_Addr. Use get_output_section_offset.
11162 (Output_reloc::get_address): Likewise.
11163 (Output_section::is_input_address_mapped): Don't call
11164 is_section_specially_mapped.
11165 (Output_section::output_offset): Likewise.
11166 (Output_section::output_address): Likewise.
11167 (Output_section::starting_output_address): Likewise.
11168 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11169 parameter to Sized_relobj*.
11170 (Copy_relocs::need_copy_reloc): Likewise.
11171 (Copy_relocs::save): Likewise.
11172 * copy-relocs.h (class Copy_relocs): Update declarations.
11173 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11174 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11175 * target-reloc.h (relocate_for_relocatable): Change
11176 offset_in_output_section type to Elf_Addr. Change code that uses
11177 it as well.
11178 * layout.cc (Layout::layout): Always set *off.
11179 * mapfile.cc (Mapfile::print_input_section): Use
11180 output_section_offset.
11181 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11182 Sized_relobj*.
11183 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11184 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11185 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11186
5cb66f97
ILT
111872008-07-03 Ian Lance Taylor <iant@google.com>
11188
11189 * layout.cc (Layout::include_section): Do not discard unrecognized
11190 SHT_STRTAB sections.
11191
afe47622
CS
111922008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11193
11194 * script.cc (Lex::can_continue_name): Make '?' allowable in
11195 version-script names.
11196 * testsuite/version_script.map: Change glob pattern to use '?'
11197
5adf9721
ILT
111982008-06-30 Manish Singh <yosh@gimp.org>
11199
11200 PR 6585
11201 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11202 Correct typo.
11203
e6fde208
ILT
112042008-06-30 Ian Lance Taylor <iant@google.com>
11205
11206 PR 6660
11207 PR 6682
11208 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11209 versions]: Don't try to read the value in the contents, since we
11210 don't use it. Use the template endianness when writing.
11211
3f2e6a2d
CC
112122008-06-25 Cary Coutant <ccoutant@google.com>
11213
11214 * fileread.cc (File_read::make_view): Assert on zero-length view.
11215 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11216 symbol table when there are no symbols to read.
11217
c43d3a48
CS
112182008-06-23 Craig Silverstein <csilvers@google.com>
11219
11220 * version.cc (version_string): Bump to 1.7
11221
5f494ea0
CS
112222008-06-18 Craig Silverstein <csilvers@google.com>
11223
11224 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11225 constant 0xFFFF to type Valtype.
11226 (Powerpc_relocate_functions::rel16_ha): Likewise.
11227
c42e122e
ILT
112282008-06-17 Ian Lance Taylor <iant@google.com>
11229
f34787f8
ILT
11230 * output.h (Output_section::Input_section): Initialize p2align_ to
11231 zero for Output_section_data constructors.
11232 (Output_section::Input_section::addralign): If not an input
11233 section, return the alignment of the Output_section_data.
11234 * testsuite/copy_test.cc: New file.
11235 * testsuite/copy_test_1.cc: New file.
11236 * testsuite/copy_test_2.cc: New file.
11237 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11238 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11239 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11240 (copy_test_1_pic.o, copy_test_1.so): New targets.
11241 (copy_test_2_pic.o, copy_test_2.so): New targets.
11242 * testsuite/Makefile.in: Rebuild.
11243
c42e122e
ILT
11244 * script-sections.cc (Script_sections::place_orphan): Initialize
11245 local variable exact.
11246
ce3ac18a
DE
112472008-06-13 David Edelsohn <edelsohn@gnu.org>
11248
11249 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11250
42cacb20
DE
112512008-06-12 David Edelsohn <edelsohn@gnu.org>
11252 David S. Miller <davem@davemloft.net>
11253
11254 * powerpc.cc: New file.
11255 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11256 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11257 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11258 * Makefile.in: Rebuild.
11259
7b308235
ILT
112602008-06-09 Ian Lance Taylor <iant@google.com>
11261
11262 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11263 <exception>.
11264 (throwing, orig_terminate): New static variables.
11265 (terminate_handler): New static function.
11266 (t2): Set terminate handler.
11267
f0b886e3
ILT
112682008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11269
11270 PR 6584
cd536b21 11271 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
11272 alignment.
11273
3e90f135
CC
112742008-05-30 Cary Coutant <ccoutant@google.com>
11275
11276 * archive.cc (Archive::include_all_members) Correct to step
11277 over symbol table and extended name table in thin archives.
11278
e09ad04a
ILT
112792008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11280
11281 PR 6407
11282 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11283 calculation.
11284
62b01cb5
ILT
112852008-05-28 Caleb Howe <cshowe@google.com>
11286
11287 * reduced_debug_output.cc: New file.
11288 * reduced_debug_output.h: New file.
92de84a6 11289 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
11290 * options.cc (General_options::finalize): Add strip_debug_non_line
11291 to the strip heirarchy.
11292 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11293 fields.
11294 * layout.cc: Include "reduced_debug_output.h".
11295 (Layout::Layout): Initialize new fields.
11296 (line_only_debug_sections): New static array.
11297 (is_lines_only_debug_sections): New static inline function.
11298 (Layout::include_section): Handle --strip-debug-non-line.
11299 (Layout::make_output_section): If --strip-debug-non-line, build
11300 new output sections for .debug_abbrev and .debug_info.
11301 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11302 gold. Warn about possible overflow.
11303 (read_signed_LEB_128): Likewise.
11304 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11305 (read_signed_LEB_128): Declare.
11306 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11307 (HFILES): Add reduced_debug_output.h.
11308 * Makefile.in: Rebuild.
11309
7d9e3d98
ILT
113102008-05-21 Ian Lance Taylor <iant@google.com>
11311
11312 * mapfile.cc: New file.
11313 * mapfile.h: New file.
11314 * options.h (class General_options): Add -M/--print-map and -Map.
11315 * options.cc (General_options::finalize): Make -M equivalent to
11316 -Map -.
11317 * main.cc: Include <cstdio> and "mapfile.h".
11318 (main): Open mapfile if requested.
11319 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11320 constructor. Change caller.
11321 (queue_initial_tasks): Add mapfile parameter. Change caller.
11322 (queue_middle_tasks): Likewise.
11323 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11324 declarations.
11325 * archive.cc: Include "mapfile.h".
11326 (Archive::add_symbols): Add mapfile parameter. Change all
11327 callers. Pass mapfile, symbol, and reason to include_member.
11328 (Archive::include_all_members): Add mapfile parameter. Change all
11329 callers.
11330 (Archive::include_member): Add mapfile, sym, and why parameters.
11331 Change all callers. Report inclusion to map file.
11332 * archive.h: Include "fileread.h".
11333 (class Archive): Update declarations.
11334 (Archive::file): New const method.
11335 (class Add_archive_symbols): Add mapfile_ field. Update
11336 constructor. Change all callers.
11337 * readsyms.h (class Read_symbols): Likewise.
11338 (class Finish_group): Likewise.
11339 (class Read_script): Likewise.
11340 * common.cc: Include "mapfile.h".
11341 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11342 all callers.
11343 (Symbol_table::do_allocate_commons): Likewise.
11344 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11345 symbol allocation to mapfile.
11346 * common.h (class Allocate_commons_task): Add mapfile_ field.
11347 Update constructor. Change all callers.
11348 * symtab.h (class Symbol_table): Update declarations.
11349 * layout.cc: Include "mapfile.h".
11350 (Layout_task_runner::run): Print information to mapfile.
11351 (Layout::create_gold_note): Change Output_data_fixed_space to
11352 Output_data_zero_fill.
11353 (Layout::create_build_id): Likewise.
11354 (Layout::print_to_mapfile): New function.
11355 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11356 constructor. Change caller.
11357 (class Layout): Declare print_to_mapfile.
11358 * output.cc (Output_section::Input_section::print_to_mapfile): New
11359 function.
11360 (Output_section::add_input_section): If producing a map, always
11361 add to input_sections_ list.
11362 (Output_section::do_print_to_mapfile): New function.
11363 (Output_segment::print_sections_to_mapfile): New function.
11364 (Output_segment::print_section_list_to_mapfile): New function.
11365 * output.h: Include "mapfile.h".
11366 (Output_data::print_to_mapfile): New function.
11367 (Output_data::do_print_to_mapfile): New virtual function.
11368 (Output_segment_headers::do_print_to_mapfile): New function.
11369 (Output_file_header::do_print_to_mapfile): New function.
11370 (Output_data_const::do_print_to_mapfile): New function.
11371 (class Output_data_const_buffer): Add map_name_ field. Update
11372 constructor. Change all callers. Add do_print_to_mapfile
11373 function.
11374 (class Output_data_fixed_space): Likewise.
11375 (class Output_data_space): Likewise.
11376 (class Output_data_zero_fill): New class.
11377 (Output_data_strtab::do_print_to_mapfile): New function.
11378 (Output_data_reloc_base::do_print_to_mapfile): New function.
11379 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11380 (Output_data_group::do_print_to_mapfile): New function.
11381 (Output_data_got::do_print_to_mapfile): New function.
11382 (Output_data_dynamic::do_print_to_mapfile): New function.
11383 (Output_symtab_xindex::do_print_to_mapfile): New function.
11384 (class Output_section): Declare do_print_to_mapflie. Declare
11385 print_to_mapfile in Input_section.
11386 (class Output_segment): Declare new functions.
11387 * object.h (Sized_relobj::symbol_count): New function.
11388 * script-sections.cc
11389 (Output_section_element_dot_assignment::set_section_addresses):
11390 Change Output_data_fixed_space to Output_data_zero_fill.
11391 (Output_data_expression::do_print_to_mapfile): New function.
11392 * script.cc (read_input_script): Add mapfile parameter. Change
11393 all callers.
11394 * script.h (read_input_script): Update declaration.
11395 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11396 (Eh_frame::do_print_to_mapfile): New function.
11397 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11398 (Output_merge_string::do_print_to_mapfile): New function.
11399 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11400 function.
11401 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11402 function.
11403 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11404 function.
11405 * Makefile.am (CCFILES): Add mapfile.cc.
11406 (HFILES): Add mapfile.h.
11407 * Makefile.in: Rebuild.
11408
9f1d377b
ILT
114092008-05-19 Ian Lance Taylor <iant@google.com>
11410
11411 * options.h (class General_options): Add -z relro.
11412 * layout.cc (Layout::Layout): Initialize relro_segment_.
11413 (Layout::add_output_section_data): Return the output section.
11414 (Layout::make_output_section): Rcognize relro sections and mark
11415 them appropriately.
11416 (Layout::attach_allocated_section_to_segment): Put relro sections
11417 in a PT_GNU_RELRO segment.
11418 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11419 section as relro.
11420 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11421 PT_TLS segments.
11422 (Layout::linkonce_mapping): Map d.rel.ro.local to
11423 .data.rel.ro.local.
11424 (Layout::output_section_name): Us .data.rel.ro.local for any
11425 section which begins with that.
11426 * layout.h (class Layout): Update add_output_section_data
11427 declaration. Add relro_segment_ field.
11428 * output.cc (Output_section::Output_section): Initialize is_relro_
11429 and is_relro_local_ fields.
11430 (Output_segment::add_output_section): Group relro sections.
11431 (Output_segment::is_first_section_relro): New function.
11432 (Output_segment::maximum_alignment): If there is a relro section,
11433 align the segment to the common page size.
11434 (Output_segment::set_section_addresses): Track whether we are
11435 looking at relro sections. If the last section is a relro
11436 section, align to the common page size.
11437 (Output_segment::set_section_list_addresses): Add in_relro
11438 parameter. Change all callers. Align to the page size when
11439 moving from relro to non-relro section.
11440 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11441 segment.
11442 * output.h (class Output_section): Add is_relro_ and
11443 is_relro_local_ fields.
11444 (Output_section::is_relro): New function.
11445 (Output_section::set_is_relro): New function.
11446 (Output_section::is_relro_local): New function.
11447 (Output_section::set_is_relro_local): New function.
11448 (class Output_segment): Update declarations.
11449 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11450 * sparc.cc (Target_sparc::got_section): Likewise.
11451 * x86_64.cc (Target_x86_64::got_section): Likewise.
11452 * testsuite/relro_test_main.cc: New file.
11453 * testsuite/relro_test.cc: New file.
11454 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11455 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11456 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11457 (relro_test.so, relro_test_pic.o): New targets.
11458 * testsuite/Makefile.in: Rebuild.
11459
a984ee1d
ILT
114602008-05-16 Ian Lance Taylor <iant@google.com>
11461
01676dcd
ILT
11462 * output.cc (Output_segment::add_output_section): Remove front
11463 parameter.
11464 * output.h (class Output_segment): Remove
11465 add_initial_output_section and overloaded add_output_section.
11466 Update declaration of remaining add_output_section.
11467 * layout.cc (Layout::create_interp): Call add_output_section
11468 rather than add_initial_output_section.
11469 (Layout::finish_dynamic_section): Likewise.
11470
497897f9
ILT
11471 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11472 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11473 know the dynamic type.
11474 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11475 field. Initialize it in constructor.
11476 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11477 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11478 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11479 reloc.
11480
a984ee1d
ILT
11481 * output.cc (Output_reloc::get_address): Change return type to
11482 Elf_Addr.
11483 * output.h (class Output_reloc): Update get_address declaration.
11484 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11485 for section addresses.
11486
55ba0940
ILT
114872008-05-09 Ian Lance Taylor <iant@google.com>
11488
11489 PR 6493
11490 * gold.cc (gold_nomem): Use return value of write.
11491
75517b77
ILT
114922008-05-08 Ian Lance Taylor <iant@google.com>
11493
11494 * symtab.c (Symbol::init_base_output_data): Add version
11495 parameter. Change all callers.
11496 (Symbol::init_base_output_segment): Likewise.
11497 (Symbol::init_base_constant): Likewise.
11498 (Symbol::init_base_undefined): Likewise.
11499 (Sized_symbol::init_output_data): Likewise.
11500 (Sized_symbol::init_output_segment): Likewise.
11501 (Sized_symbol::init_constant): Likewise.
11502 (Sized_symbol::init_undefined): Likewise.
11503 (Symbol_table::do_define_in_output_data): If the new symbol has a
11504 version, mark it as the default.
11505 (Symbol_table::do_define_in_output_segment): Likewise.
11506 (Symbol_table::do_define_as_constant): Likewise.
11507 * symtab.h (class Symbol): Update declarations.
11508 (class Sized_symbol): Likewise.
11509 * resolve.cc (Symbol::override_version): New function.
c42e122e 11510 (Symbol::override_base): Call override_version.
75517b77
ILT
11511 (Symbol::override_base_with_special): Likewise.
11512 * testsuite/ver_script_8.script: New file.
11513 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11514 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11515 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11516 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11517
f1f70eae
ILT
115182008-05-06 Ian Lance Taylor <iant@google.com>
11519
f3e9c5c5
ILT
11520 PR 6049
11521 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11522 functions.
11523 (class General_options): Remove existing --undefined, and add
11524 --no-undefined instead. Add new --undefined as synonym for -u.
11525 * archive.cc (Archive::add_symbols): Check whether symbol was
11526 named with -u.
11527 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11528 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11529 all uses. Add IS_UNDEFINED. Update declarations to split
11530 different versions of init_base. Declare init_base_undefined.
11531 (Symbol::is_defined): Handle IS_UNDEFINED.
11532 (Symbol::is_undefined): Likewise.
11533 (Symbol::is_weak_undefined): Call is_undefined.
11534 (Symbol::is_absolute): Handle IS_CONSTANT.
11535 (class Sized_symbol): Update declarations to split different
11536 versions of init. Declare init_undefined.
11537 (class Symbol_table): Declare new functions.
11538 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11539 Change all callers.
11540 (Symbol::init_base_output_data): Likewise.
11541 (Symbol::init_base_output_segment): Likewise.
11542 (Symbol::init_base_constant): Likewise.
11543 (Symbol::init_base_undefined): New function.
11544 (Sized_symbol::init_object): Rename from init. Change all
11545 callers.
11546 (Sized_symbol::init_output_data): Likewise.
11547 (Sized_symbol::init_output_segment): Likewise.
11548 (Sized_symbol::init_constant): Likewise.
11549 (Sized_symbol::init_undefined): New function.
11550 (Symbol_table::add_undefined_symbols_from_command_line): New
11551 function.
11552 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11553 function.
11554 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11555 (Symbol::output_section): Likewise.
11556 (Symbol::set_output_section): Likewise.
11557 (Symbol_table::sized_finalize_symbol): Likewise.
11558 (Symbol_table::sized_write_globals): Likewise.
11559 * resolve.cc (Symbol_table::should_override): Likewise.
11560 (Symbol::override_base_with_special): Likewise.
11561
8bdcdf2c
ILT
11562 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11563 symbol, change it to have default visibility.
11564 * testsuite/protected_1.cc: New file.
11565 * testsuite/protected_2.cc: New file.
11566 * testsuite/protected_3.cc: New file.
11567 * testsuite/protected_main_1.cc: New file.
11568 * testsuite/protected_main_2.cc: New file.
11569 * testsuite/protected_main_3.cc: New file.
11570 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11571 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11572 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11573 (protected_1.so): New target.
11574 (protected_1_pic.o, protected_2_pic.o): New targets.
11575 (protected_3_pic.o): New target.
11576 (check_PROGRAMS): Add protected_2.
11577 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11578 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11579 * testsuite/Makefile.in: Rebuild.
11580
2b706932
ILT
11581 * options.h (DEFINE_var): Add set_user_set_##varname__.
11582 (DEFINE_bool_alias): New macro.
11583 (class General_options): Define -Bstatic using DEFINE_bool_alias
11584 rather than DEFINE_special. Add --undefined as an alias for -z
11585 defs.
11586 * options.cc (General_options::parse_Bstatic): Remove.
11587
d82a5bcc
ILT
11588 * options.h (class General_options): Add --fatal-warnings.
11589 * main.cc (main): Implement --fatal-warnings.
11590 * errors.h (Errors::warning_count): New function.
11591
f1f70eae
ILT
11592 * options.h (class General_options): Add -Bsymbolic-functions.
11593 * symtab.h (Symbol::is_preemptible): Check for
11594 -Bsymbolic-functions.
11595
8825ac63
ILT
115962008-05-05 Ian Lance Taylor <iant@google.com>
11597
d98bc257
ILT
11598 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11599 as noVARNAME rather than no-VARNAME.
11600 (class General_options): Add option -z combreloc.
11601 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11602 get_address.
11603 (Output_reloc::sort_before) [SHT_REL]: New function.
11604 (Output_reloc::sort_before) [SHT_RELA]: New function.
11605 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11606 Sort_relocs_comparison.
11607 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11608 parameter. Change all callers.
11609 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11610 sort_relocs parameter. Change all callers.
11611 * output.cc (Output_reloc::get_address): New function, broken out
11612 of write_rel.
11613 (Output_reloc::write_rel): Call it.
11614 (Output_reloc::compare): New function.
11615 (Output_data_reloc_base::do_write): Optionally sort relocs.
11616
60b2b4e7
ILT
11617 * configure.ac: If targ_extra_obj is set, link it in.
11618 * configure.tgt: Initialize all variables.
11619 (x86_64*): Set targ_extra_obj and targ_extra_size.
11620 * configure: Rebuild.
11621
8825ac63
ILT
11622 * object.cc (Sized_relobj::include_section_group): Adjust section
11623 indexes read from group data. Build vector to pass to
11624 layout_group.
11625 * layout.cc (Layout::layout_group): Add flags and shndxes
11626 parameters. Remove contents parameter. Change caller. Update
11627 explicit instantiations.
11628 * layout.h (class Layout): Update layout_group declaration.
11629 * output.cc (Output_data_group::Output_data_group): Add flags and
11630 input_shndxes parameters. Remove contents parameter. Change
11631 caller.
11632 (Output_data_group::do_write): Change input_sections_ to
11633 input_shndxes_.
11634 * output.h (class Output_data_group): Update constructor
11635 declaration. Rename input_sections_ to input_shndxes_.
11636 * testsuite/many_sections_test.cc: Add template.
11637
e94cf127
CC
116382008-04-30 Cary Coutant <ccoutant@google.com>
11639
4418b2d5
CC
11640 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11641
e94cf127
CC
11642 * layout.cc (Layout::include_section): Refactored check for debug
11643 info section.
11644 (Layout::add_comdat): Add new parameters. Change type
11645 of signature parameter. Add object and shndx to signatures table.
11646 (Layout::find_kept_object): New function.
11647 * layout.h: Include <cstring>.
11648 (Layout::is_debug_info_section): New function.
11649 (Layout::add_comdat): Add new parameters.
11650 (Layout::find_kept_object): New function.
11651 (Layout::Kept_section): New struct.
11652 (Layout::Signatures): Change type of map range.
11653 * object.cc (Relobj::output_section_address): New function.
11654 (Sized_relobj::include_section_group): Add new parameters. Change
11655 calls to Layout::add_comdat. Change to build table of kept comdat
11656 groups and table mapping discarded sections to kept sections.
11657 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11658 (Sized_relobj::do_layout): Change calls to include_section_group and
11659 include_linkonce_section.
11660 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11661 value to zero when section is discarded.
11662 (Sized_relobj::map_to_kept_section): New function.
11663 * object.h (Relobj::output_section_address): New function.
11664 (Relobj::Comdat_group): New type.
11665 (Relobj::find_comdat_group): New function.
11666 (Relobj::Comdat_group_table): New type.
11667 (Relobj::Kept_comdat_section): New type.
11668 (Relobj::Kept_comdat_section_table): New type.
11669 (Relobj::add_comdat_group): New function.
11670 (Relobj::set_kept_comdat_section): New function.
11671 (Relobj::get_kept_comdat_section): New function.
11672 (Relobj::comdat_groups_): New field.
11673 (Relobj::kept_comdat_sections_): New field.
11674 (Symbol_value::input_value): Update comment.
11675 (Sized_relobj::map_to_kept_section) New function.
11676 (Sized_relobj::include_linkonce_section): Add new parameter.
11677 * target-reloc.h (Comdat_behavior): New type.
11678 (get_comdat_behavior): New function.
11679 (relocate_section): Add code to map a discarded section to the
11680 corresponding kept section when applying a relocation.
11681
e4e5049b
CS
116822008-04-30 Craig Silverstein <csilvers@google.com>
11683
11684 * dwarf_reader.cc (next_generation_count): New static var.
11685 (Addr2line_cache_entry): New struct.
11686 (addr2line_cache): New static var.
11687 (Dwarf_line_info::one_addr2line): Added caching.
11688 (Dwarf_line_info::clear_addr2line_cache): New function.
11689 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11690 cache-size parameter.
11691 (Dwarf_line_info::one_addr2line_cache): New function.
11692 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11693 new cache-size argument to one_addr2line(), and clear cache.
11694
d09e9154
CC
116952008-04-28 Cary Coutant <ccoutant@google.com>
11696
11697 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11698 R_386_PC8 relocations.
11699
7ef73768
ILT
117002008-04-23 Ian Lance Taylor <iant@google.com>
11701
55438702
ILT
11702 * object.cc (Sized_relobj::include_section_group): Check for
11703 invalid section group.
11704
c165fb93
ILT
11705 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11706 header size.
11707
7ef73768
ILT
11708 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11709 than read for file header.
11710 * archive.cc (Archive::include_member): Likewise.
11711
6194aaab
L
117122008-04-23 Paolo Bonzini <bonzini@gnu.org>
11713
11714 * aclocal.m4: Regenerate.
11715 * configure: Regenerate.
11716
d491d34e
ILT
117172008-04-19 Ian Lance Taylor <iant@google.com>
11718
5ea2bac6
ILT
11719 * version.cc (version_string): Bump to 1.6.
11720
7bc3e21a
ILT
11721 * testsuite/Makefile.am (many_sections_r_test): New target.
11722 (many_sections_r_test_SOURCES): Remove.
11723 (many_sections_r_test_DEPENDENCIES): Remove.
11724 (many_sections_r_test_LDFLAGS): Remove.
11725 (many_sections_r_test_LDADD): Remove.
11726
7fcd3aa9
ILT
11727 * object.cc (Sized_relobj::do_add_symbols): Always pass
11728 local_symbol_count_ to add_from_relobj.
11729
4c94d6ae
ILT
11730 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11731 every thousand variables.
11732 * testsuite/Makefile.in: Rebuild.
11733
d491d34e
ILT
11734 * object.cc (Xindex::initialize_symtab_xindex): New function.
11735 (Xindex::read_symtab_xindex): New function.
11736 (Xindex::sym_xindex_to_shndx): New function.
11737 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11738 available.
11739 (Sized_relobj::do_initialize_xindex): New function.
11740 (Sized_relobj::do_read_symbols): Adjust section links.
11741 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11742 parameter. Change all callers.
11743 (Sized_relobj::include_section_group): Adjust section links and
11744 symbol section indexes.
11745 (Sized_relobj::do_layout): Adjust section links.
11746 (Sized_relobj::do_count_local_symbols): Adjust section links and
11747 symbol section indexes.
11748 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11749 ordinary and special symbols.
11750 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11751 dynsym_xindex parameters. Change all callers. Adjust section
11752 links. Use SHN_XINDEX when needed.
11753 (Sized_relobj::get_symbol_location_info): Adjust section links.
11754 Don't get fooled by special symbols.
11755 * object.h (class Xindex): Define.
11756 (class Object): Add xindex_ parameter. Declare virtual functoin
11757 do_initialize_xindex.
11758 (Object::adjust_sym_shndx): New function.
11759 (Object::set_xindex): New protected function.
11760 (class Symbol_value): Add is_ordinary_shndx_ field.
11761 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11762 (Symbol_value::value): Assert ordinary section.
11763 (Symbol_value::initialize_input_to_output_map): Likewise.
11764 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11765 Change all callers.
11766 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11767 all callers.
11768 (class Sized_relobj): Update declarations.
11769 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11770 parameter. Change all callers.
11771 (Sized_relobj::adjust_shndx): New function.
11772 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11773 field.
11774 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11775 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11776 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11777 (Sized_dynobj::read_dynsym_section): Adjust section links.
11778 (Sized_dynobj::read_dynamic): Likewise.
11779 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11780 section links.
11781 (Sized_dynobj::do_initialize_xindex): New function.
11782 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11783 do_initialize_xindex.
11784 (Sized_dynobj::adjust_shndx): New function.
11785 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11786 dynsym_xindex_ fields.
11787 (Layout::finalize): Add a call to set_section_indexes before
11788 creating the symtab sections.
11789 (Layout::set_section_indexes): Don't do anything if the section
11790 already has a section index.
11791 (Layout::create_symtab_sections): Add shnum parameter. Change
11792 caller. Create .symtab_shndx section if needed.
11793 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11794 caller.
11795 (Layout::allocated_output_section_count): New function.
11796 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11797 needed.
11798 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11799 fields. Update declarations.
11800 (Layout::symtab_xindex): New function.
11801 (Layout::dynsym_xindex): New function.
11802 (class Write_symbols_task): Add layout_ field.
11803 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11804 Change caller.
11805 * output.cc (Output_section_headers::Output_section_headers): Add
11806 shstrtab_section parameter. Change all callers.
11807 (Output_section_headers::do_sized_write): Store overflow values
11808 for section count and section string table section index in
11809 section header zero.
11810 (Output_file_header::do_sized_write): Check for overflow of
11811 section count and section string table section index.
11812 (Output_symtab_xindex::do_write): New function.
11813 (Output_symtab_xindex::endian_do_write): New function.
11814 * output.h (class Output_section_headers): Add shstrtab_section_.
11815 Update declarations.
11816 (class Output_symtab_xindex): Define.
11817 (Output_section::has_out_shndx): New function.
11818 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11819 field.
11820 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11821 Change all callers.
11822 (Sized_symbol::init): Likewise.
11823 (Symbol::output_section): Check for ordinary symbol.
11824 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11825 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11826 callers.
11827 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11828 Change all callers. Simplify handling of symbols from sections
11829 not included in the link.
11830 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11831 distinction.
11832 (Weak_alias_sorter::operator()): Assert that symbols are
11833 ordinary.
11834 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11835 distinction.
11836 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11837 parameters. Change all callers.
11838 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11839 symbol distinction. Use SHN_XINDEX when needed.
11840 (Symbol_table::write_section_symbol): Add symtab_xindex
11841 parameter. Change all callers.
11842 (Symbol_table::sized_write_section_symbol): Likewise. Use
11843 SHN_XINDEX when needed.
11844 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11845 declarations.
11846 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11847 (Symbol::is_defined): Check is_ordinary.
11848 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11849 (Symbol::is_absolute, Symbol::is_common): Likewise.
11850 (class Sized_symbol): Update declarations.
11851 (class Symbol_table): Update declarations.
11852 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11853 parameters. Change all callers.
11854 (Sized_symbol::override): Likewise.
11855 (Symbol_table::override): Likewise.
11856 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11857 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11858 is_ordinary, and orig_st_shndx parameters. Change all callers.
11859 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11860 to be in an ordinary section.
11861 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11862 object and is_ordinary parameters. Change all callers.
11863 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11864 Change all callers. Don't add undefined or non-ordinary symbols
11865 to reloc_map_.
11866 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11867 Change all callers.
11868 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11869 declarations.
11870 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11871 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11872 (Sized_relobj::relocate_sections): Likewise.
11873 * target-reloc.h (scan_relocs): Adjust section symbol index.
11874 (scan_relocatable_relocs): Likewise.
11875 * i386.cc (Scan::local): Check for ordinary symbols.
11876 * sparc.cc (Scan::local): Likewise.
11877 * x86_64.cc (Scan::local): Likewise.
11878 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11879 to symbol_section_and_value.
11880 * testsuite/many_sections_test.cc: New file.
11881 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11882 (check_PROGRAMS): Add many_sections_test.
11883 (many_sections_test_SOURCES): Define.
11884 (many_sections_test_DEPENDENCIES): Define.
11885 (many_sections_test_LDFLAGS): Define.
11886 (BUILT_SOURCES): Add many_sections_define.h.
11887 (many_sections_define.h): New target.
11888 (BUILT_SOURCES): Add many_sections_check.h.
11889 (many_sections_check.h): New target.
11890 (check_PROGRAMS): Add many_sections_r_test.
11891 (many_sections_r_test_SOURCES): Define.
11892 (many_sections_r_test_DEPENDENCIES): Define.
11893 (many_sections_r_test_LDFLAGS): Define.
11894 (many_sections_r_test_LDADD): Define.
11895 (many_sections_r_test.o): New target.
11896 * testsuite/Makefile.in: Rebuild.
11897
c5818ff1
CC
118982008-04-17 Cary Coutant <ccoutant@google.com>
11899
11900 * errors.cc (Errors::info): New function.
11901 (gold_info): New function.
11902 * errors.h (Errors::info): New function.
11903 * gold.h (gold_info): New function.
11904 * object.cc (Input_objects::add_object): Print trace output.
11905 * options.cc (options::parse_set): New function.
11906 (General_options::parse_wrap): Deleted.
11907 (General_options::General_options): Deleted initializer.
11908 * options.h (options::String_set): New typedef.
11909 (options::parse_set): New function.
11910 (DEFINE_set): New macro.
11911 (General_options::wrap): Changed to use DEFINE_set. Changed
11912 callers of any_wrap_symbols and is_wrap_symbol.
11913 (General_options::trace, General_options::trace_symbol):
11914 New options.
11915 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11916 (General_options::wrap_symbols_): Deleted.
11917 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11918
b5be4a7c
DM
119192008-04-17 David S. Miller <davem@davemloft.net>
11920
11921 * options.cc (General_options::parse_V): New function.
11922 * options.h: Add entries for -V and -Qy.
11923
155a0dd7
ILT
119242008-04-17 Ian Lance Taylor <iant@google.com>
11925
11926 * common.cc (Symbol_table::allocate_commons): Remove options
11927 parameter. Change caller.
11928 (Symbol_table::do_allocate_commons): Remove options parameter.
11929 Change caller. Just call do_allocate_commons_list twice.
11930 (Symbol_table::do_allocate_commons_list): New function, broken out
11931 of do_allocate_commons.
11932 * common.h (class Allocate_commons_task): Remove options_ field.
11933 Update constructor.
11934 * symtab.cc (Symbol_table::Symbol_table): Initialize
11935 tls_commons_.
11936 (Symbol_table::add_from_object): Put TLS common symbols on
11937 tls_commons_ list.
11938 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11939 which are IN_OUTPUT_DATA.
11940 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11941 allocate_commons and do_allocate_commons declarations. Declare
11942 do_allocate_commons_list.
11943 * gold.cc (queue_middle_tasks): Update creation of
11944 Allocate_commons_task to not pass options.
11945 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11946 (TLS_TEST_C_FLAGS): New variable.
11947 (tls_test_c_pic.o): New target.
11948 (tls_test_shared.so): Link in tls_test_c_pic.o.
11949 (tls_test_c_pic_ie.o): New target.
11950 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11951 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11952 (tls_test_c.o): New target.
11953 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11954 (tls_pic_test_LDADD): Likewise.
11955 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11956 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11957 (tls_test_c_gnu2.o): New target.
11958 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11959 tls_test_c_gnu2.o.
11960 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11961 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11962 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11963 * testsuite/tls_test.cc: Include "config.h".
11964 (t_last): Call t11_last.
11965 * testsuite/tls_test.h (t11, t11_last): Declare.
11966 * testsuite/tls_test_c.c: New file.
11967 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11968 * configure.ac: Check for OpenMP support.
11969 * configure, config.in, Makefile.in: Rebuild.
11970 * testsuite/Makefile.in: Rebuild.
11971
edfbb029
CC
119722008-04-16 Cary Coutant <ccoutant@google.com>
11973
11974 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11975 (Target_i386::tls_base_symbol_defined_): New field.
11976 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11977 (Target_i386::Scan::global): Likewise.
11978 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11979 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11980 (Target_x86_64::tls_base_symbol_defined_): New field.
11981 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11982 (Target_x86_64::Scan::global): Likewise.
11983
f3c69fca
CC
119842008-04-16 Cary Coutant <ccoutant@google.com>
11985
11986 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11987 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11988 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11989 building shared libraries.
11990 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11991 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11992 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11993 * testsuite/Makefile.in: Rebuild.
11994 * testsuite/weak_undef.h: New file.
11995 * testsuite/weak_undef_file1.cc: Add extra test cases.
11996 * testsuite/weak_undef_file2.cc: Likewise.
11997 * testsuite/weak_undef_test.cc: Likewise.
11998
7c414435
DM
119992008-04-16 David S. Miller <davem@davemloft.net>
12000
32b769e1
DM
12001 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12002 Add issued_non_pic_error_ field. Declare check_non_pic.
12003 (Target_sparc::Scan::check_non_pic): New function.
12004 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12005 (Target_sparc::Scan::global): Likewise.
12006
11936fb1
DM
12007 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12008 * configure: Rebuild.
12009
7c414435
DM
12010 * options.h (DEFINE_enable): New macro.
12011 (new_dtags): New enable option.
12012 (initfirst, interpose, loadfltr, nodefaultlib,
12013 nodelete, nodlopen, nodump): New -z options.
12014 * layout.cc (Layout:finish_dynamic_section): If new
12015 dtags enabled, emit DT_RUNPATH. Also, emit a
12016 DT_FLAGS_1 containing any specified -z flags.
12017
85c7bf8b
ILT
120182008-04-16 Ian Lance Taylor <iant@google.com>
12019
12c0daef
ILT
12020 * copy-relocs.cc: New file.
12021 * copy-relocs.h: New file.
12022 * reloc.cc: Remove Copy_relocs code.
12023 * reloc.h: Likewise.
12024 * reloc-types.h (struct Reloc_types) [both versions]: Add
12025 get_reloc_addend_noerror.
12026 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12027 variants of add_global which take an addend which must be zero.
12028 * i386.cc: Include "copy-relocs.h".
12029 (class Target_i386): Change type of copy_relocs_ to variable,
12030 update initializer.
12031 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12032 Change all callers.
12033 (Target_i386::do_finalize_sections): Change handling of
12034 copy_relocs_.
12035 * sparc.cc: Include "copy-relocs.h".
12036 (class Target_sparc): Change type of copy_relocs_ to variable,
12037 update initializer.
12038 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12039 Change all callers.
12040 (Target_sparc::do_finalize_sections): Change handling of
12041 copy_relocs_.
12042 * x86_64.cc: Include "copy-relocs.h".
12043 (class Target_x86_64): Change type of copy_relocs_ to variable,
12044 update initializer.
12045 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12046 class. Change all callers.
12047 (Target_x86_64::do_finalize_sections): Change handling of
12048 copy_relocs_.
12049 * Makefile.am (CCFILES): Add copy-relocs.cc.
12050 (HFILES): Add copy-relocs.h.
12051
4f4995b6
ILT
12052 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12053
85c7bf8b
ILT
12054 * testsuite/script_test_4.sh: Permit leading zeroes.
12055
4f2a9edd
ILT
120562008-04-15 Ian Lance Taylor <iant@google.com>
12057
e6188289
ILT
12058 * script-sections.cc (Script_sections::create_segments): Use
12059 header_size_adjustment even when there is enough room for the
12060 headers.
12061 * testsuite/script_test_4.sh: New file.
12062 * testsuite/script_test_4.t: New file.
12063 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12064 (check_DATA): Add script_test_4.stdout.
12065 (MOSTLYCLEANFILES): Likewise.
12066 (script_test_4): New target.
12067 (script_test_4.stdout): New target.
12068 * testsuite/Makefile.in: Rebuild.
12069
4f2a9edd
ILT
12070 * sparc.cc: Add definitions for Output_data_plt_sparc class
12071 constants.
12072
f5314dd5
DM
120732008-04-14 David S. Miller <davem@davemloft.net>
12074
12075 * sparc.cc: New file.
12076 * Makefile.am (TARGETSOURCES): Add sparc.cc
12077 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12078 * configure.tgt: Document targ_extra_size and
12079 targ_extra_big_endian. Add entries for sparc-* and
12080 sparc64-*.
12081 * configure.ac: Handle targ_extra_size and
12082 targ_extra_big_endian.
12083 * Makefile.in: Rebuild.
12084 * configure: Likewise.
12085 * po/POTFILES.in: Likewise.
12086 * po/gold.pot: Likewise.
12087
154e0e9a
ILT
120882008-04-14 Ian Lance Taylor <iant@google.com>
12089
12090 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12091 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12092 in the name/type/flags to section mapping. Don't call
12093 allocate_output_section.
12094 (Layout::choose_output_section): Change parameter from adjust_name
12095 to is_input_section. Don't permit input sections after sections
12096 are attached to segments. Don't call allocate_output_section.
12097 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12098 not write_enable_output_section.
12099 (Layout::make_output_section): Don't push to
12100 unattached_section_list_ nor call attach_to_segment. Call
12101 attach_section_to_segment if sections are attached.
12102 (Layout::attach_sections_to_segments): New function.
12103 (Layout::attach_section_to_segment): New function.
12104 (Layout::attach_allocated_section_to_segment): Rename from
12105 attach_to_segment. Remove flags parameter.
12106 (Layout::allocate_output_section): Remove function.
12107 (Layout::write_enable_output_section): Remove function.
12108 * layout.h (class Layout): Update for above changes. Add new
12109 field sections_are_attached_.
12110 * output.h (Output_section::update_flags_for_input_section): New
12111 function.
12112 * output.cc (Output_section::add_input_section): Call
12113 update_flags_for_input_section.
12114 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12115
009a67a2
CC
121162008-04-11 Cary Coutant <ccoutant@google.com>
12117
12118 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12119 thought unnecessary.
12120 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12121
759b1a24
ILT
121222008-04-11 Ian Lance Taylor <iant@google.com>
12123
12124 * output.h (class Output_section_data): Remove inline definition
12125 of set_addralign.
12126 * output.cc (Output_section_data::set_addralign): New function.
12127
c2b45e22
CC
121282008-04-11 Cary Coutant <ccoutant@google.com>
12129
12130 Add support for TLS descriptors for i386 and x86_64.
12131 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12132 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12133 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12134 GOT_TYPE_TLS_DESC.
12135 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12136 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12137 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12138 relocations.
12139 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12140 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12141 Fix problem with initial-exec relocations.
12142 (Target_i386::Relocate::relocate_tls): Likewise.
12143 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12144 relaxation.
12145 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12146 support for section-plus-offset dynamic table entries.
12147 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12148 (Output_data_dynamic::Dynamic_entry): Add support for
12149 section-plus-offset dynamic table entries.
12150 (Output_data_dynamic::Classification): Likewise.
12151 (Output_data_dynamic::classification_): Renamed offset_.
12152 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12153 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12154 (Target_x86_64::make_plt_section): New function.
12155 (Target_x86_64::reserve_tlsdesc_entries): New function.
12156 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12157 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12158 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12159 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12160 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12161 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12162 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12163 add extra PLT entry for TLS descriptors.
12164 (Output_data_plt_x86_64::got_): New field.
12165 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12166 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12167 fields.
12168 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12169 descriptors.
12170 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12171 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12172 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12173 R_386_TLS_DESC_CALL relocations.
12174 (Target_x86_64::Scan::global): Likewise.
12175 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12176 for TLS descriptors.
12177 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12178 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12179 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12180 GD-to-IE relaxation.
12181 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12182 and TLS_DESCRIPTORS.
12183 * Makefile.in: Rebuild.
12184 * configure: Rebuild.
12185 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12186 (tls_test_shared2.so): New target.
12187 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12188 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12189 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12190 (tls_shared_gd_to_ie_test_LDADD): New variable.
12191 (tls_shared_gnu2_gd_to_ie_test): New target.
12192 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12193 New targets.
12194 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12195 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12196 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12197 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12198 (tls_shared_gnu2_test): New target.
12199 (tls_test_gnu2_shared.so): New target.
12200 (tls_shared_gnu2_test_SOURCES): New variable.
12201 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12202 (tls_shared_gnu2_test_LDFLAGS): New variable.
12203 (tls_shared_gnu2_test_LDADD): New variable.
12204 * testsuite/Makefile.in: Rebuild.
12205 * testsuite/Makefile.
12206
83bfb6b7
ILT
122072008-04-11 Ian Lance Taylor <iant@google.com>
12208
12209 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12210 justsyms.t.
12211 * testsuite/Makefile.in: Rebuild.
12212
12213 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12214 long.
12215 * testsuite/script_test_2.cc (main): Adjust test.
12216
706e1f5e
ILT
122172008-04-11 David S. Miller <davem@davemloft.net>
12218 Ian Lance Taylor <iant@google.com>
12219
12220 * options.h (General_options): Add entries for '-Y' and
12221 '-relax'.
12222 * options.cc (General_options:finalize): If -Y was used, add those
12223 entries to the library path instead of the default "/lib" and
12224 "/usr/lib".
12225
7c98e6bb
DM
122262008-04-11 David S. Miller <davem@davemloft.net>
12227
12228 * testsuite/justsyms.t: Start at 0x100.
12229 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
12230 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12231 long.
12232 * testsuite/script_test_2.cc: Adjust string and section length
12233 checks.
7c98e6bb 12234
99a37bfd
ILT
122352008-04-09 Ian Lance Taylor <iant@google.com>
12236
2cefc357
ILT
12237 PR gold/5996
12238 * script-sections.cc (Sections_element::allocate_to_segment): Add
12239 orphan parameter.
12240 (Output_section_definition::allocate_to_segment): Likewise.
12241 (Orphan_output_section::allocate_to_segment): Likewise.
12242 (Script_sections::attach_sections_using_phdrs_clause): Don't
12243 propagate non-PT_LOAD segments to orphan sections.
12244 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12245 readelf rather than objdump.
12246 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12247 .interp section and PT_INTERP segment are the same size.
12248 * testsuite/Makefile.in: Rebuild.
12249
99a37bfd
ILT
12250 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12251 aliases for symbols defined in the same object.
12252 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12253 (weak_alias_test_SOURCES): New variable.
12254 (weak_alias_test_DEPENDENCIES): New variable.
12255 (weak_alias_test_LDFLAGS): New variable.
12256 (weak_alias_test_LDADD): New variable.
12257 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12258 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12259 (weak_alias_test_3.o): New target.
12260 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12261 * testsuite/weak_alias_test_main.cc: New file.
12262 * testsuite/weak_alias_test_1.cc: New file.
12263 * testsuite/weak_alias_test_2.cc: New file.
12264 * testsuite/weak_alias_test_3.cc: New file.
12265
780e49c5
ILT
122662008-04-08 Ian Lance Taylor <iant@google.com>
12267
cdb0b8f5
ILT
12268 * options.h (class General_options): Add --noinhibit-exec option.
12269 * main.cc (main): Check --noinhibit-exec.
12270
0864d551
ILT
12271 * options.h (class General_options): Define --wrap as a special
12272 option. Add wrap_symbols_ field.
12273 (General_options::any_wrap_symbols): New function.
12274 (General_options::is_wrap_symbol): New function.
12275 * options.cc (General_options::parse_wrap): New function.
12276 (General_options::General_options): Initialize wrap_symbols_.
12277 * symtab.cc (Symbol_table::wrap_symbol): New function.
12278 (Symbol_table::add_from_object): Handle --wrap.
12279 * symtab.h (class Symbol_table): Declare wrap_symbol.
12280 * target.h (Target::wrap_char): New function.
12281 (Target::Target_info): Add wrap_char field.
12282 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12283 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12284 * testsuite/testfile.cc (Target_test::test_target_info):
12285 Likewise.
12286
789aa6de
ILT
12287 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12288 there is one.
12289
2c38906f
ILT
12290 * layout.h (class Layout): Add added_eh_frame_data_ field.
12291 * layout.cc (Layout::Layout): Initialize new field.
12292 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12293 output section until we find a section we merged successfully.
12294 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12295 that the size be non-zero.
12296
780e49c5
ILT
12297 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12298 qualifier.
12299
7fcd0256
ILT
123002008-04-08 Craig Silverstein <csilvers@google.com>
12301
12302 * configure.ac: Export new conditional variable HAVE_ZLIB.
12303 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12304 on HAVE_ZLIB.
12305 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12306 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12307
6835af53
ILT
123082008-04-07 Ian Lance Taylor <iant@google.com>
12309
e24f324c
ILT
12310 * version.cc (version_string): Set to "1.5".
12311
a036edd8
ILT
12312 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12313 Add issued_non_pic_error_ field. Declare check_non_pic.
12314 (Target_x86_64::Scan::check_non_pic): New function.
12315 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12316 (Target_x86_64::Scan::global): Likewise.
12317
624f8810
ILT
12318 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12319 addend parameter. Change caller. Handle merge sections.
12320 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12321 Address to Addend. Don't add in the result of
12322 local_section_offset, pass down the addend and use the returned
12323 value.
12324 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12325 Update declarations of local_section_offset and symbol_value.
12326 * testsuite/two_file_test_1.cc (t18): New function.
12327 * testsuite/two_file_test_2.cc (f18): New function.
12328 * testsuite/two_file_test_main.cc (main): Call t18.
12329 * testsuite/two_file_test.h (t18, f18): Declare.
12330
6835af53
ILT
12331 * configure.ac: Don't test for objdump, c++filt, or readelf.
12332 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12333 conditionals.
12334 (TEST_READELF): New variable.
12335 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12336 (check_PROGRAMS): Add two_file_strip_test.
12337 (two_file_strip_test): New target.
12338 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12339 (two_file_same_shared_strip_test_SOURCES): New variable.
12340 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12341 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12342 (two_file_same_shared_strip_test_LDADD): New variable.
12343 (two_file_shared_strip.so): New target.
12344 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12345 (ver_test_5.syms, ver_test_7.syms): Likewise.
12346 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12347 (strip_test_3.stdout): Use TEST_OBJDUMP.
12348 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12349
86925eef
CC
123502008-04-04 Cary Coutant <ccoutant@google.com>
12351
12352 * symtab.h (Symbol::is_weak_undefined): New function.
12353 (Symbol::is_strong_undefined): New function.
12354 (Symbol::is_absolute): New function.
12355 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12356 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12357 absolute symbols.
12358 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12359 (weak_undef_test): New target.
12360 * testsuite/Makefile.in: Rebuild.
12361 * testsuite/weak_undef_file1.cc: New file.
12362 * testsuite/weak_undef_file2.cc: New file.
12363 * testsuite/weak_undef_test.cc: New file.
12364
126f3ece
ILT
123652008-04-03 Craig Silverstein <csilvers@google.com>
12366
12367 * compressed_output.h (class Output_compressed_section): Use
12368 unsigned buffer.
12369 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12370 add zlib header.
12371 (zlib_compressed_suffix): Removed.
12372 (Output_compressed_section::set_final_data_size): Use unsigned
12373 buffers.
12374 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12375 Fix linker invocation.
12376 (flagstest_o_specialfile_and_compress_debug_sections):
12377 Likewise.
12378 * testsuite/Makefile.in: Regenerated.
12379
deae2a14
DM
123802008-04-02 David S. Miller <davem@davemloft.net>
12381
12382 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12383 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12384
70752818
ILT
123852008-04-02 Craig Silverstein <csilvers@google.com>
12386
12387 * TODO: New file.
12388
39d0cb0e
ILT
123892008-04-02 Ian Lance Taylor <iant@google.com>
12390
12391 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12392 parameters. Update for new key type to views_. Change all
12393 callers.
12394 (File_read::read): Adjust for byteshift in returned view.
12395 (File_read::add_view): New function, broken out of
12396 find_and_make_view.
12397 (File_read::make_view): New function, broken out of
12398 find_and_make_view.
12399 (File_read::find_or_make_view): Add offset and aligned
12400 parameters. Rewrite accordingly. Change all callers.
12401 (File_read::get_view): Add offset and aligned parameters. Adjust
12402 for byteshift in return value.
12403 (File_read::get_lasting_view): Likewise.
12404 * fileread.h (class File_read): Update declarations.
12405 (class File_read::View): Add byteshift_ field. Add byteshift to
12406 constructor. Add byteshift method.
12407 * archive.h (Archive::clear_uncached_views): New function.
12408 (Archive::get_view): Add aligned parameter. Change all callers.
12409 * object.h (Object::get_view): Add aligned parameter. Change all
12410 callers.
12411 (Object::get_lasting_view): Likewise.
12412
12413 * fileread.cc (File_read::release): Don't call clear_views if
12414 there are multiple objects.
12415 * fileread.h (File_read::clear_uncached_views): New function.
12416 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12417 on the archive.
12418
a1207466
CC
124192008-03-31 Cary Coutant <ccoutant@google.com>
12420
12421 Add thin archive support.
12422 * archive.cc (Archive::armagt): New const.
12423 (Archive::setup): Remove task parameter and calls to unlock.
12424 (Archive::unlock_nested_archives): New function.
12425 (Archive::read_header): Add nested_off parameter. Change
12426 all callers.
12427 (Archive::interpret_header): Likewise.
12428 (Archive::include_all_members): Change to handle thin
12429 archives.
12430 (Archive::include_member): Likewise.
12431 * archive.h (Archive::Archive): Add new parameters and
12432 initializers.
12433 (Archive::armagt): New const.
12434 (Archive::setup): Remove task parameter.
12435 (Archive::unlock_nested_archives): New function.
12436 (Archive::read_header): Add nested_off parameter.
12437 (Archive::interpret_header): Likewise.
12438 (Archive::Nested_archive_table): New typedef.
12439 (Archive::is_thin_archive_): New field.
12440 (Archive::nested_archives_): New field.
12441 (Archive::options_): New field.
12442 (Archive::dirpath_): New field.
12443 (Archive::task_): New field.
12444 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12445 for thin archives. Pass additional parameters to
12446 Archive::Archive. Unlock the archive file after calling
12447 Archive::setup.
cd536b21 12448
479f6503
ILT
124492008-03-29 Ian Lance Taylor <iant@google.com>
12450
686c8caf
ILT
12451 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12452 version symbol to be local.
12453 * testsuite/ver_test_4.sh: New file.
12454 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12455 (check_DATA): Add ver_test_4.syms.
12456 (ver_test_4.syms): New target.
12457 * testsuite/Makefile.in: Rebuild.
12458
ab794b6b
ILT
12459 * output.cc
12460 (Output_section::Input_section_sort_entry::has_priority): New
12461 function.
12462 (Output_section::Input_section_sort_entry::match_file_name): New
12463 function.
12464 (Output_section::Input_section_sort_entry::match_section_name):
12465 Remove.
12466 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12467 Remove.
12468 (Output_section::Input_section_sort_entry::match_section_file):
12469 Remove.
12470 (Output_section::Input_section_sort_compare::operator()): Rewrite
12471 using new Input_section_sort_entry functions. Sort crtbegin and
12472 crtend first. Sort sections with no priority before sections with
12473 a priority.
12474 * testsuite/initpri1.c (d3): Check j != 4.
12475 (cd5): New constructor/destructor function.
12476 (main): Check j != 2.
12477
479f6503
ILT
12478 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12479 new symbol when resolving, don't call set_is_default.
12480 * testsuite/ver_test_7.cc: New file.
12481 * testsuite/ver_test_7.sh: New file.
12482 * testsuite/Makefile.am (ver_test_7.so): New target.
12483 (ver_test_7.o): New target.
12484 (check_SCRIPTS): Add ver_test_7.sh.
12485 (check_DATA): Add ver_test_7.syms.
12486 (ver_test_7.syms): New target.
12487
2fd32231
ILT
124882008-03-28 Ian Lance Taylor <iant@google.com>
12489
12490 * layout.cc (Layout::layout): If we see an input section with a
12491 name that needs sorting, set the must_sort flag for the output
12492 section.
12493 (Layout::make_output_section): If the name of the output section
12494 indicates that it might require sorting, set the may_sort flag.
12495 * output.h (Output_section::may_sort_attached_input_sections): New
12496 function.
12497 (Output_section::set_may_sort_attached_input_sections): New
12498 function.
12499 (Output_section::must_sort_attached_input_sections): New
12500 function.
12501 (Output_section::set_must_sort_attached_input_sections): New
12502 function.
12503 (class Output_section): Declare Input_section_sort_entry. Define
12504 Input_section_sort_compare. Declare
12505 sort_attached_input_sections. Add new fields:
12506 may_sort_attached_input_sections_,
12507 must_sort_attached_input_sections_,
12508 attached_input_sections_are_sorted_.
12509 * output.cc (Output_section::Output_section): Initialize new
12510 fields.
12511 (Output_section::add_input_section): Add an entry to
12512 input_sections_ if may_sort or must_sort are true.
12513 (Output_section::set_final_data_size): Call
12514 sort_attached_input_sections if necessary.
12515 (Output_section::Input_section_sort_entry): Define new class.
12516 (Output_section::Input_section_sort_compare::operator()): New
12517 function.
12518 (Output_section::sort_attached_input_sections): New function.
12519 * configure.ac: Check whether the compiler supports constructor
12520 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12521 * testsuite/initpri1.c: New file.
12522 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12523 CONSTRUCTOR_PRIORITY.
12524 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12525 (initpri1_LDFLAGS): New variable.
12526 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12527
18e6b24e
ILT
125282008-03-27 Ian Lance Taylor <iant@google.com>
12529
49bdd526
ILT
12530 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12531 * testsuite/common_test_1.c: New file.
12532 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12533 (common_test_1_SOURCES): New variable.
12534 (common_test_1_DEPENDENCIES): New variable.
12535 (common_test_1_LDFLAGS): New variable.
12536
18e6b24e
ILT
12537 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12538 and commons_ correctly when NAME/VERSION does not override
12539 NAME/NULL.
12540 * testsuite/ver_test_6.c: New file.
12541 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12542 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12543 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12544
04bf7072
ILT
125452008-03-26 Ian Lance Taylor <iant@google.com>
12546
5871526f
ILT
12547 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12548 of an undefined symbol from a version script.
12549 * testsuite/Makefile.am (ver_test_5.so): New target.
12550 (ver_test_5.o): New target.
12551 (check_SCRIPTS): Add ver_test_5.sh.
12552 (check_DATA): Add ver_test_5.syms.
12553 (ver_test_5.syms): New target.
12554 * testsuite/ver_test_5.cc: New file.
12555 * testsuite/ver_test_5.script: New file.
12556 * testsuite/ver_test_5.sh: New file.
12557 * Makefile.in, testsuite/Makefile.in: Rebuild.
12558
04bf7072
ILT
12559 PR gold/5986
12560 Fix problems building gold with gcc 4.3.0.
12561 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12562 (gold_error_at_location, gold_warning_at_location): Use it.
12563 * configure.ac: Check whether we can compile and use a template
12564 function with a printf attribute.
12565 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12566 when jumping over bytes.
12567 * object.cc: Instantiate Object::read_section_data.
12568 * debug.h: Include <cstring>
12569 * dwarf_reader.cc: Include <algorithm>
12570 * main.cc: Include <cstring>.
12571 * options.cc: Include <cstring>.
12572 * output.cc: Include <cstring>.
12573 * script.cc: Include <cstring>.
12574 * script.h: Include <string>.
12575 * symtab.cc: Include <cstring> and <algorithm>.
12576 * target-select.cc: Include <cstring>.
12577 * version.cc: Include <string>.
12578 * testsuite/testmain.cc: Include <cstdlib>.
12579 * configure, config.in: Rebuild.
12580
874c5b28
ILT
125812008-03-25 Ian Lance Taylor <iant@google.com>
12582
819d6c3a
ILT
12583 * options.cc: Include "../bfd/bfdver.h".
12584 (options::help): Print bug reporting address.
12585
f4b2c6f5
ILT
12586 * version.cc (print_version): Adjust output for current value of
12587 BFD_VERSION_STRING.
12588
12589 * NEWS: New file.
12590
e96caa79
ILT
12591 * options.cc (options::help): Print list of supported targets.
12592 * target-select.h: Include <vector>.
12593 (class Target_selector): Make machine_, size_, and is_big_endian_
12594 fields const. Add bfd_name_ and instantiated_target_ fields.
12595 (Target_selector::Target_selector): Add bfd_name parameter.
12596 (Target_selector::recognize): Make non-virtual, call
12597 do_recognize.
12598 (Target_selector::recognize_by_name): Make non-virtual, call
12599 do_recognize_by_name.
12600 (Target_selector::supported_names): New function.
12601 (Target_selector::bfd_name): New function.
12602 (Target_selector::do_instantiate_target): New pure virtual
12603 function.
12604 (Target_selector::do_recognize): New virtual function.
12605 (Target_selector::do_recognize_by_name): New virtual function.
12606 (Target_selector::instantiate_target): New private function.
12607 (supported_target_names): Declare.
12608 * target-select.cc (Target_selector::Target_selector): Update for
12609 new parameter and fields.
12610 (select_target_by_name): Check that the name matches before
12611 calling recognize_by_name.
12612 (supported_target_names): New function.
12613 * i386.cc (class Target_selector_i386): Update Target_selector
12614 constructor call. Remove recognize and recognize_by_name. Add
12615 do_instantiate_target.
12616 * x86_64.cc (class Target_selector_x86_64): Likewise.
12617 * testsuite/testfile.cc (class Target_selector_test): Update for
12618 changes to Target_selector.
12619
874c5b28
ILT
12620 * README: Rewrite, with some notes on unsupported features.
12621
0a65a3a7
CC
126222008-03-24 Cary Coutant <ccoutant@google.com>
12623
12624 * i386.cc (Target_i386::Got_type): New enum declaration.
12625 (Target_i386::Scan::local): Updated callers of Output_data_got
12626 member functions.
12627 (Target_i386::Scan::global): Likewise.
12628 (Target_i386::Relocate::relocate): Likewise.
12629 (Target_i386::Relocate::relocate_tls): Likewise.
12630 * object.h (Got_offset_list): New class.
12631 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12632 (Sized_relobj::local_got_offset): Likewise.
12633 (Sized_relobj::set_local_got_offset): Likewise.
12634 (Sized_relobj::local_has_tls_got_offset): Removed.
12635 (Sized_relobj::local_tls_got_offset): Removed.
12636 (Sized_relobj::set_local_tls_got_offset): Removed.
12637 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12638 * output.cc (Output_data_got::add_global): Added got_type parameter.
12639 (Output_data_got::add_global_with_rel): Likewise.
12640 (Output_data_got::add_global_with_rela): Likewise.
12641 (Output_data_got::add_global_pair_with_rel): New function.
12642 (Output_data_got::add_global_pair_with_rela): New function.
12643 (Output_data_got::add_local): Added got_type parameter.
12644 (Output_data_got::add_local_with_rel): Likewise.
12645 (Output_data_got::add_local_with_rela): Likewise.
12646 (Output_data_got::add_local_pair_with_rel): New function.
12647 (Output_data_got::add_local_pair_with_rela): New function.
12648 (Output_data_got::add_global_tls): Removed.
12649 (Output_data_got::add_global_tls_with_rel): Removed.
12650 (Output_data_got::add_global_tls_with_rela): Removed.
12651 (Output_data_got::add_local_tls): Removed.
12652 (Output_data_got::add_local_tls_with_rel): Removed.
12653 (Output_data_got::add_local_tls_with_rela): Removed.
12654 * output.h (Output_data_got::add_global): Added got_type parameter.
12655 (Output_data_got::add_global_with_rel): Likewise.
12656 (Output_data_got::add_global_with_rela): Likewise.
12657 (Output_data_got::add_global_pair_with_rel): New function.
12658 (Output_data_got::add_global_pair_with_rela): New function.
12659 (Output_data_got::add_local): Added got_type parameter.
12660 (Output_data_got::add_local_with_rel): Likewise.
12661 (Output_data_got::add_local_with_rela): Likewise.
12662 (Output_data_got::add_local_pair_with_rel): New function.
12663 (Output_data_got::add_local_pair_with_rela): New function.
12664 (Output_data_got::add_global_tls): Removed.
12665 (Output_data_got::add_global_tls_with_rel): Removed.
12666 (Output_data_got::add_global_tls_with_rela): Removed.
12667 (Output_data_got::add_local_tls): Removed.
12668 (Output_data_got::add_local_tls_with_rel): Removed.
12669 (Output_data_got::add_local_tls_with_rela): Removed.
12670 * resolve.cc (Symbol::override_base_with_special): Removed
12671 reference to has_got_offset_ field.
12672 * symtab.cc (Symbol::init_fields): Replaced initialization
12673 of got_offset_ with got_offsets_. Removed initialization
12674 of has_got_offset_
53fcba31 12675 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
12676 (Symbol::got_offset): Likewise.
12677 (Symbol::set_got_offset): Likewise.
12678 (Symbol::has_tls_got_offset): Removed.
12679 (Symbol::tls_got_offset): Removed.
12680 (Symbol::set_tls_got_offset): Removed.
12681 (Symbol::got_offset_): Removed.
12682 (Symbol::tls_mod_got_offset_): Removed.
12683 (Symbol::tls_pair_got_offset_): Removed.
12684 (Symbol::got_offsets_): New field.
12685 (Symbol::has_got_offset): Removed.
12686 (Symbol::has_tls_mod_got_offset): Removed.
12687 (Symbol::has_tls_pair_got_offset): Removed.
12688 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12689 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12690 member functions.
12691 (Target_x86_64::Scan::global): Likewise.
12692 (Target_x86_64::Relocate::relocate): Likewise.
12693 (Target_x86_64::Relocate::relocate_tls): Likewise.
12694
bd52eafb
BE
126952008-03-25 Ben Elliston <bje@au.ibm.com>
12696
12697 * yyscript.y: Fix spelling error in comment.
12698
8b105e34
ILT
126992008-03-24 Ian Lance Taylor <iant@google.com>
12700
8ed814a9
ILT
12701 * options.h (class General_options): Define build_id option.
12702 * layout.h (class Layout): Declare write_build_id, create_note,
12703 create_build_id. Add build_id_note_ member.
12704 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12705 "libiberty.h", "md5.h", "sha1.h".
12706 (Layout::Layout): Initialize eh_frame_data_,
12707 eh_frame_hdr_section_, and build_id_note_.
12708 (Layout::finalize): Call create_build_id.
12709 (Layout::create_note): New function, broken out of
12710 Layout::create_gold_note.
12711 (Layout::create_gold_note): Call create_note.
12712 (Layout::create_build_id): New function.
12713 (Layout::write_build_id): New function.
12714 (Close_task_runner::run): Call write_build_id.
12715
8b105e34
ILT
12716 * x86_64.cc: Correct license to GPLv3.
12717
086a1841
ILT
127182008-03-23 Ian Lance Taylor <iant@google.com>
12719
12720 * options.cc: Include "demangle.h".
12721 (parse_optional_string): New function.
12722 (parse_long_option): Handle takes_optional_argument.
12723 (parse_short_option): Update dash_z initializer. Handle
12724 takes_optional_argument.
12725 (General_options::General_options): Initialize do_demangle_.
12726 (General_options::finalize): Set do_demangle_. Handle demangling
12727 style.
12728 * options.h (parse_optional_string): Declare.
12729 (struct One_option): Add optional_arg field. Update constructor.
12730 Update call constructor calls. Add takes_optional_argument
12731 function.
12732 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12733 (DEFINE_optional_string): Define.
12734 (General_options::demangle): Change from DEFINE_bool to
12735 DEFINE_optional_string.
12736 (General_options::no_demangle): New function.
12737 (General_options::do_demangle): New function.
12738 (General_options::set_do_demangle): New function.
12739 (General_options::execstack_status_): Move definition to end of
12740 class definition.
12741 (General_options::static_): Likewise.
12742 (General_options::do_demangle_): New field.
12743 * object.cc (big_endian>::get_symbol_location_info): Call
12744 Options::do_demangle, not Options::demangle.
12745 * symtab.cc (demangle): Likewise.
12746
cbb93e63
ILT
127472008-03-22 Ian Lance Taylor <iant@google.com>
12748
12749 * gold.h: Include <cstddef> and <sys/types.h>
12750 * options.h: Include <cstring>.
12751
ec531623
ILT
127522008-03-21 Ian Lance Taylor <iant@google.com>
12753
12754 * Added source code to GNU binutils.
This page took 0.736794 seconds and 4 git commands to generate.