2012-04-20 Pedro Alves <palves@redhat.com>
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
13cf9988
DM
12012-04-16 David S. Miller <davem@davemloft.net>
2
2a1079e8
DM
3 * sparc.cc (Target_sparc::got_address): New function.
4 (Sparc_relocate_functions::gdop_hix22): New function.
5 (Sparc_relocate_functions::gdop_lox10): New function.
6 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
7 relocs.
8 (Target_sparc::Scan::local): Likewise if the global symbol is not
9 preemptible and is not IFUNC.
10 (Target_sparc::Relocate::relocate): Perform GOTDATA code
11 transformations for local and non-preemptible non-IFUNC global
12 symbols.
13
0bc964fc
DM
14 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
15 writing out 64-bit part of ranges.
16
661d7a80
DM
17 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
18 -fpic and -fpie respectively.
19 * Makefile.in: Regenerate.
20
8c2bf391
DM
21 * sparc.cc (class Target_sparc): Add rela_ifunc_.
22 (Target_sparc::Target_sparc): Initialize new field.
23 (Target_sparc::do_plt_section_for_global): New function.
24 (Target_sparc::do_plt_section_for_local): New function.
25 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
26 (Target_sparc::make_plt_section): New function, broken out of
27 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
28 (Target_sparc::make_plt_entry): Call make_plt_section.
29 (Target_sparc::make_local_ifunc_plt_entry): New function.
30 (Target_sparc::rela_ifunc_section): New function.
31 (Target_sparc::plt_section): Remove const.
32 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
33 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
34 and ifunc_count_ fields.
35 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
36 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
37 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
38 (Output_data_plt_sparc::rela_ifunc): New function.
39 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
40 (Output_data_plt_sparc::has_ifunc_section): New function.
41 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
42 (Output_data_plt_sparc::address_for_global): New function.
43 (Output_data_plt_sparc::address_for_local): New function.
44 (Output_data_plt_sparc::plt_index_to_offset): New function.
45 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
46 and entry_count.
47 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
48 entry_count.
49 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
50 R_SPARC_JMP_IREL to switch.
51 (Target_sparc::Scan::check_non_pic): Likewise.
52 (Target_sparc::Scan::local): Handle IFUNC symbols.
53 (Target_sparc::Scan::local): Likewise.
54 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
55 and plt_address_for_local.
56 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
57 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
58
13cf9988
DM
59 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
60 (class Output_data_reloc): Adjust calls to Output_reloc_type.
61 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
62 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
63 global relocs too.
64 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
65 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
66 calls.
67 * sparc.cc (Target_sparc::Scan::global): Likewise.
68 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
69
31821be0
CC
702012-04-16 Cary Coutant <ccoutant@google.com>
71
72 * archive.cc (Library_base::should_include_member): Check for
73 --export-dynamic-symbol.
74 * options.h (class General_options): Add --export-dynamic-symbol.
75 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
76 --export-dynamic-symbol.
77 (Symbol_table::gc_mark_undef_symbols): Likewise.
78 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
79
2615994e
DM
802012-04-12 David S. Miller <davem@davemloft.net>
81
82 * sparc.cc (Reloc::wdisp10): New relocation method.
83 (Reloc::h34): Likewise.
84 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
85 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
86 R_SPARC_WDISP10.
87 (Target_sparc::Scan::local): Likewise.
88 (Target_sparc::Scan::global): Likewise.
89 (Target_sparc::Relocate::relocate): Likewise.
90
6782735d
CC
912012-04-09 Cary Coutant <ccoutant@google.com>
92
93 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
94 low_pc == 0.
95
8c7a0b00
ILT
962012-04-06 Ian Lance Taylor <iant@google.com>
97
98 * timer.cc: #include <unistd.h>.
99
58797674
RM
1002012-04-06 Roland McGrath <mcgrathr@google.com>
101
102 * configure.in (AC_CHECK_HEADERS): Add locale.h.
103 * config.in: Regenerate.
104 * configure: Regenerate.
105
44350750
NC
1062012-04-05 Nick Clifton <nickc@redhat.com>
107
108 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
109 (AM_LC_MESSAGES): Add.
110 * aclocal.m4: Regenerate.
111 * config.in: Regenerate.
112 * configure: Regenerate.
113
c1027032
CC
1142012-03-21 Cary Coutant <ccoutant@google.com>
115
116 * Makefile.am: Add gdb-index.cc, gdb-index.h.
117 * Makefile.in: Regenerate.
118 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
119 (Sized_elf_reloc_mapper::symbol_section): New function.
120 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
121 (make_elf_reloc_mapper): New function.
122 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
123 (Dwarf_abbrev_table::do_read_abbrevs): New function.
124 (Dwarf_abbrev_table::do_get_abbrev): New function.
125 (Dwarf_ranges_table::read_ranges_table): New function.
126 (Dwarf_ranges_table::read_range_list): New function.
127 (Dwarf_pubnames_table::read_section): New function.
128 (Dwarf_pubnames_table::read_header): New function.
129 (Dwarf_pubnames_table::next_name): New function.
130 (Dwarf_die::Dwarf_die): New function.
131 (Dwarf_die::read_attributes): New function.
132 (Dwarf_die::skip_attributes): New function.
133 (Dwarf_die::set_name): New function.
134 (Dwarf_die::set_linkage_name): New function.
135 (Dwarf_die::attribute): New function.
136 (Dwarf_die::string_attribute): New function.
137 (Dwarf_die::int_attribute): New function.
138 (Dwarf_die::uint_attribute): New function.
139 (Dwarf_die::ref_attribute): New function.
140 (Dwarf_die::child_offset): New function.
141 (Dwarf_die::sibling_offset): New function.
142 (Dwarf_info_reader::check_buffer): New function.
143 (Dwarf_info_reader::parse): New function.
144 (Dwarf_info_reader::do_parse): New function.
145 (Dwarf_info_reader::do_read_string_table): New function.
146 (Dwarf_info_reader::lookup_reloc): New function.
147 (Dwarf_info_reader::get_string): New function.
148 (Dwarf_info_reader::visit_compilation_unit): New function.
149 (Dwarf_info_reader::visit_type_unit): New function.
150 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
151 Sized_elf_reloc_mapper.
152 (Sized_dwarf_line_info::symbol_section): Remove function.
153 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
154 (Sized_dwarf_line_info::read_line_mappings): Remove object
155 parameter, adjust callers.
156 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
157 * dwarf_reader.h: Include <sys/types.h>.
158 (class Track_relocs): Remove forward declaration.
159 (class Elf_reloc_mapper): New class.
160 (class Sized_elf_reloc_mapper): New class.
161 (class Dwarf_abbrev_table): New class.
162 (class Dwarf_range_list): New class.
163 (class Dwarf_ranges_table): New class.
164 (class Dwarf_pubnames_table): New class.
165 (class Dwarf_die): New class.
166 (class Dwarf_info_reader): New class.
167 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
168 (Sized_dwarf_line_info::symbol_section): Remove member function.
169 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
170 base class.
171 * gdb-index.cc: New source file.
172 * gdb-index.h: New source file.
173 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
174 and .debug_types sections, call Layout::add_to_gdb_index.
175 (Sized_relobj_incr::do_section_name): Implement.
176 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
177 return type; Implement.
178 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
179 return type.
180 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
181 parameter list and return type.
182 (Sized_incr_dynobj::do_section_contents): Likewise.
183 * layout.cc: Include gdb-index.h.
184 (Layout::Layout): Initialize gdb_index_data_.
185 (Layout::init_fixed_output_section): Check for .gdb_index section.
186 (Layout::add_to_gdb_index): New function. Instantiate.
187 * layout.h: Add forward declaration for class Gdb_index.
188 (Layout::add_to_gdb_index): New member function.
189 (Layout::gdb_index_data_): New data member.
190 * main.cc: Include gdb-index.h.
191 (main): Print statistics for gdb index.
192 * object.cc (Object::section_contents): Move code into
193 do_section_contents.
194 (need_decompressed_section): Check for sections needed when building
195 gdb index.
196 (build_compressed_section_map): Likewise.
197 (Sized_relobj_file::do_read_symbols): Need local symbols when building
198 gdb index.
199 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
200 sections; call Layout::add_to_gdb_index.
201 (Sized_relobj_file::do_decompressed_section_contents): Call
202 do_section_contents directly.
203 * object.h (Object::do_section_contents): Adjust parameter list and
204 return type.
205 (Object::do_decompressed_section_contents): Call do_section_contents
206 directly.
207 (Sized_relobj_file::do_section_contents): Adjust parameter list and
208 return type.
209 * options.h (class General_options): Add --gdb-index option.
210 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
211 list and return type.
212 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
213 * reloc.h (Track_relocs::checkpoint): New function.
214 (Track_relocs::reset): New function.
215
216 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
217 New test cases.
218 * testsuite/Makefile.in: Regenerate.
219 * testsuite/gdb_index_test.cc: New test source file.
220 * testsuite/gdb_index_test_1.sh: New test source file.
221 * testsuite/gdb_index_test_2.sh: New test source file.
222
647f1574
DK
2232012-03-19 Doug Kwan <dougkwan@google.com>
224
225 * arm.cc (Target_arm::do_define_standard_symbols): New method.
226 (Target_arm::do_finalize_sections): Remove code which defines
227 __exidx_start and __exidx_end. Make symbol table parameter
228 anonymous as it is not used.
229 * gold.cc (queue_middle_tasks): Call target hook to define any
230 target-specific symbols.
231 * target.h (Target::define_standard_symbols): New method.
232 (Target::do_define_standard_symbols): Same.
233 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
234 * testsuite/Makefile.in: Regenerate.
235 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
236 and __exidx_end.
237 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
238 relocations are generated for __exidx_start and __exidx_end.
239
7c6109da
DK
2402012-03-16 Doug Kwan <dougkwan@google.com>
241
242 * testsuite/Makefile.am: Disable test initpri3b.
243 * testsuite/Makefile.in: Regenerate.
244
7b8957f8
DK
2452012-03-15 Doug Kwan <dougkwan@google.com>
246
247 * arm.cc (Target_arm::got_section): Make .got section read-only
248 if -z now is given.
249
14dc9ef7
ILT
2502012-03-15 Ian Lance Taylor <iant@google.com>
251
252 PR gold/13850
253 * layout.cc (Layout::make_output_section): Correctly mark
254 SHT_INIT_ARRAY, et. al., as relro.
255
fa40b62a
DK
2562012-03-14 Doug Kwan <dougkwan@google.com>
257
258 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
259 dynamic relocations for protected symbols in shared objects.
260
fd325007
ILT
2612012-03-13 Ian Lance Taylor <iant@google.com>
262
263 * resolve.cc (Symbol_table::resolve): When merging common symbols,
264 keep the larger alignment.
265
e8dd54e1
CC
2662012-03-12 Cary Coutant <ccoutant@google.com>
267
268 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
269 handling of DW_LNE_define_file.
270
feb5f3b0
CC
2712012-03-12 Cary Coutant <ccoutant@google.com>
272
273 * reduced_debug_output.cc
274 (Output_reduced_debug_info_section::get_die_end): Add new FORM
275 codes to switch.
276
a1fb4256
CC
2772012-02-29 Cary Coutant <ccoutant@google.com>
278
279 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
280
5dd8762a
CC
2812012-02-29 Cary Coutant <ccoutant@google.com>
282
283 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
284 Call Object::decompressed_section_contents.
285 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
286 New dtor.
287 (Sized_dwarf_line_info::buffer_start_): New data member.
288 * merge.cc (Output_merge_data::do_add_input_section): Call
289 Object::decompressed_section_contents.
290 (Output_merge_string::do_add_input_section): Likewise.
291 * object.cc (need_decompressed_section): New function.
292 (build_compressed_section_map): Decompress sections needed later.
293 (Sized_relobj_file::do_decompressed_section_contents): New function.
294 (Sized_relobj_file::do_discard_decompressed_sections): New function.
295 * object.h (Object::decompressed_section_contents): New function.
296 (Object::discard_decompressed_sections): New function.
297 (Object::do_decompressed_section_contents): New function.
298 (Object::do_discard_decompressed_sections): New function.
299 (Compressed_section_info): New type.
300 (Compressed_section_map): Include decompressed section contents.
301 (Sized_relobj_file::do_decompressed_section_contents): New function.
302 (Sized_relobj_file::do_discard_decompressed_sections): New function.
303
7b5de7ee
CC
3042012-02-16 Cary Coutant <ccoutant@google.com>
305
306 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
307 * testsuite/Makefile.in: Regenerate.
308
f9fa4a63
CC
3092012-02-14 Cary Coutant <ccoutant@google.com>
310
311 * options.cc (General_options::finalize): Disallow -pie and -static.
312
2c175ebc
DK
3132012-02-03 Doug Kwan <dougkwan@google.com>
314
315 * arm.cc (Arm_relocate_functions::abs8,
316 Arm_relocate_functions::abs16): Use
317 Bits::has_signed_unsigned_overflow32.
318 (Arm_relocate_functions::thm_abs8): Correct range of
319 overflow check.
320 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
321 in assertions.
322
90cff06f
DK
3232012-02-02 Doug Kwan <dougkwan@google.com>
324
325 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
326 position independent outputs, not just shared objects.
327
63887f3d
L
3282012-01-30 H.J. Lu <hongjiu.lu@intel.com>
329
330 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
331 * configure: Regenerated.
332
bef2b434
ILT
3332012-01-27 Ian Lance Taylor <iant@google.com>
334
335 * reloc.h (Bits): New class with static functions, copied from
336 namespace utils in arm.cc.
337 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
338 instead.
339
c335b55d
L
3402012-01-27 H.J. Lu <hongjiu.lu@intel.com>
341
342 * incremental.cc (write_info_blocks): Correct relocation offset.
343
41194d9f
L
3442012-01-27 H.J. Lu <hongjiu.lu@intel.com>
345
346 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
347 (Relocate::tls_gd_to_le): Likewise.
348
1bae613c
L
3492012-01-27 H.J. Lu <hongjiu.lu@intel.com>
350
351 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
352
24482ca0
L
3532012-01-27 H.J. Lu <hongjiu.lu@intel.com>
354
355 * configure.ac: Check if -mcmodel=medium works.
356 * configure: Regenerated.
357
c2c7840a
CC
3582012-01-24 Cary Coutant <ccoutant@google.com>
359
360 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
361 definition and ...
362 (read_unsigned_LEB_128_x): ... this new function.
363 (read_signed_LEB_128): Replaced with inline definition and ...
364 (read_signed_LEB_128_x): ... this new function.
365 * int_encoding.h (read_unsigned_LEB_128_x): New function.
366 (read_unsigned_LEB_128): Add inline definition.
367 (read_signed_LEB_128_x): New function.
368 (read_signed_LEB_128): Add inline definition.
369 * testsuite/Makefile.am (leb128_unittest): New unit test.
370 * testsuite/Makefile.in: Regenerate.
371 * testsuite/leb128_unittest.cc: New unit test.
372
833de760 3732012-01-23 Ian Lance Taylor <iant@google.com>
9dee3b3c
ILT
374
375 PR gold/13617
376 * i386.cc (Target_i386::do_code_fill): When using a jmp
377 instruction, pad with nop instructions.
378 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
379
618d6666
L
3802012-01-22 H.J. Lu <hongjiu.lu@intel.com>
381
382 * x86_64.cc (gc_process_relocs): Add typename on types used in
383 template.
384 (scan_relocs): Likewise.
385 (relocate_section): Likewise.
386 (apply_relocation): Likewise.
387
3660ff06
L
3882012-01-10 H.J. Lu <hongjiu.lu@intel.com>
389
390 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
391 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
392 under x32.
393
fc51264f
L
3942012-01-09 H.J. Lu <hongjiu.lu@intel.com>
395
396 * x86_64.cc: Initial support for x32.
397
dd74ae06
CC
3982012-01-03 Cary Coutant <ccoutant@google.com>
399
400 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
401 Use abstract base class for GOT.
402 * gold/output.h (class Output_data_got_base): New abstract base class.
403 (class Output_data_got): Derive from new base class, adjust ctors.
404 (Output_data_got::reserve_slot): Make virtual; rename to
405 do_reserve_slot; Adjust callers.
406 * gold/target.h (Sized_target::init_got_plt_for_update): Return
407 pointer to abstract base class.
408 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
409
83896202
ILT
4102011-12-18 Ian Lance Taylor <iant@google.com>
411
412 * object.h (Relobj::local_symbol_value): New function.
413 (Relobj::local_plt_offset): New function.
414 (Relobj::local_has_got_offset): New function.
415 (Relobj::local_got_offset): New function.
416 (Relobj::set_local_got_offset): New function.
417 (Relobj::do_local_symbol_value): New pure virtual function.
418 (Relobj::do_local_plt_offset): Likewise.
419 (Relobj::do_local_has_got_offset): Likewise.
420 (Relobj::do_local_got_offset): Likewise.
421 (Relobj::do_set_local_got_offset): Likewise.
422 (Sized_relobj::do_local_has_got_offset): Rename from
423 local_has_got_offset.
424 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
425 (Sized_relobj::do_set_local_got_offset): Rename from
426 set_local_got_offset.
427 (Sized_relobj_file::do_local_plt_offset): Rename from
428 local_plt_offset.
429 (Sized_relobj_file::do_local_symbol_value): New function.
430 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
431 local_plt_offset.
432 * output.cc (Output_data_got::Got_entry::write): Change object to
433 Relobj. Use local_symbol_value.
434 (Output_data_got::add_global_with_rel): Change rel_dyn to
435 Output_data_reloc_generic*. Use add_global_generic.
436 (Output_data_got::add_global_with_rela): Remove. Change all
437 callers to use add_global_with_rel.
438 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
439 Output_data_reloc_generic*. Use add_global_generic.
440 (Output_data_got::add_global_pair_with_rela): Remove. Change all
441 callers to use add_global_pair_with_rel.
442 (Output_data_got::add_local): Change object to Relobj*.
443 (Output_data_got::add_local_plt): Likewise.
444 (Output_data_got::add_local_with_rel): Change object to Relobj*,
445 change rel_dyn to Output_data_reloc_generic*. Use
446 add_local_generic.
447 (Output_data_got::add_local_with_rela): Remove. Change all
448 callers to use all_local_with_rel.
449 (Output_data_got::add_local_pair_with_rel): Change object to
450 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
451 add_output_section_generic.
452 (Output_data_got::add_local_pair_with_rela): Remove. Change all
453 callers to use add_local_pair_with_rel.
454 (Output_data_got::reserve_local): Change object to Relobj*.
455 * output.h: (class Output_data_reloc_generic): Add pure virtual
456 declarations for add_global_generic, add_local_generic,
457 add_output_section_generic.
458 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
459 functions for Output_data_reloc_generic. Update declarations for
460 changes listed in output.cc.
461 (class Output_data_got): Change template parameter to got_size.
462 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
463 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
464 function.
465 (Sized_relobj_incr::do_local_plt_offset): New function.
466 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
467 add_global_generic.
468
76677ad0
CC
4692011-12-17 Cary Coutant <ccoutant@google.com>
470
471 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
472 * resolve.cc (Symbol_table::resolve): Likewise.
473 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
474 arrays.
475 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
476
8b8dd8d5
ILT
4772011-12-16 Ian Lance Taylor <iant@google.com>
478
479 * output.h (Output_data_reloc_generic::add): Only call
480 add_dynamic_reloc if this is a dynamic reloc section.
481
d55525b9
L
4822011-12-15 H.J. Lu <hongjiu.lu@intel.com>
483
484 PR gold/13505
485 * target-reloc.h (apply_relocation): Replace <64, false> with
486 <size, big_endian>.
487
ff81c7c1
NC
4882011-11-25 Nick Clifton <nickc@redhat.com>
489
490 * po/it.po: New Italian translation.
491
628f39be
SA
4922011-11-17 Sterling Augustine <saugustine@google.com>
493
494 * script.cc (script_include_directive): Implement.
495 (read_script_file): New local variables name and search_path. Update
496 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
497 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
498 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
499
98ef3ea4
SA
5002011-11-11 Sterling Augustine <saugustine@google.com>
501
502 * yyscript.y (section_cmd): Add support for INCLUDE directive.
503 (file_or_sections_cmd): Likewise.
504
f4a8b6d7
DK
5052011-11-11 Doug Kwan <dougkwan@google.com>
506
507 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
508 if --just-symbols is given.
509
29ab395d
DK
5102011-11-10 Doug Kwan <dougkwan@google.com>
511
512 PR gold/13362
513 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
514 when processing data relocs.
515 * reloc.h (Relocate_functions::rel_unaligned): New method.
516 (Relocate_functions::pcrel_unaligned): Ditto.
517 (Relocate_functions::rel32_unaligned): Ditto.
518 (Relocate_functions::pcrel32_unaligned): Ditto.
519
2c339f71
DK
5202011-11-09 Doug Kwan <dougkwan@google.com>
521
522 PR gold/13362
523 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
524 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
525 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
526 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
527 (Relocate_functions::rel_unaligned): New.
528 (Relocate_functions::rel32_unaligned): New.
529 * target-reloc.h (relocate_for_relocatable): Add code to handle
530 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
531 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
532 arm_unaligned_reloc_r): New targets.
533 * testsuite/Makefile.in: Regenerate.
534 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
535 linking.
536
3f3cddf1
ILT
5372011-11-02 Ian Lance Taylor <iant@google.com>
538
539 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
540 NATIVE_LINKER.
541 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
542 * options.cc (General_options::finalize): Use library search path
543 from configure script if specified. If not native and no sysroot,
544 only search TOOLLIBDIR.
545 * options.h (Search_directory::Search_directory): Change name to
546 const std::string&.
547 (General_options::add_to_library_path_with_sysroot): Change arg to
548 const std::string&.
549 * configure, Makefile.in, config.in: Rebuild.
550
a8e2273b
ILT
5512011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
552
553 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
554 we are working around the ARM1176 Erratum.
555 * options.h (General_options::fix_arm1176): Add option.
556 * testsuite/Makefile.am: Add testcases, and keep current ones
557 working.
558 * testsuite/Makefile.in: Regenerate.
559 * testsuite/arm_fix_1176.s: New file.
560 * testsuite/arm_fix_1176.sh: Likewise.
561
cd6eab1c
ILT
5622011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
563
564 * arm.cc (Target_arm::Target_arm): Remove initialisation of
565 may_use_blx_.
566 (Target_arm::may_use_blx): Remove method.
567 (Target_arm::set_may_use_blx): Likewise.
568 (Target_arm::may_use_v4t_interworking): New method.
569 (Target_arm::may_use_v5t_interworking): Likewise.
570 (Target_arm::may_use_blx_): Remove member variable.
571 (Arm_relocate_functions::arm_branch_common): Check for v5T
572 interworking.
573 (Arm_relocate_functions::thumb_branch_common): Likewise.
574 (Reloc_stub::stub_type_for_reloc): Likewise.
575 (Target_arm::do_finalize_sections): Correct interworking checks.
576 * testsuite/Makefile.am: Add new tests.
577 * testsuite/Makefile.in: Regenerate.
578 * testsuite/arm_farcall_arm_arm.s: New test.
579 * testsuite/arm_farcall_arm_arm.sh: Likewise.
580 * testsuite/arm_farcall_arm_thumb.s: Likewise.
581 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
582 * testsuite/arm_farcall_thumb_arm.s: Likewise.
583 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
584 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
585 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
586
286adcf4
CC
5872011-10-31 Cary Coutant <ccoutant@google.com>
588
589 PR gold/13023
590 * expression.cc (Expression::eval_with_dot): Add
591 is_section_dot_assignment parameter.
592 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
593 absolute and assigning to dot within a section.
594 * script-sections.cc
595 (Output_section_element_assignment::set_section_addresses): Pass
596 dot_section to set_if_absolute.
597 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
598 as is_section_dot_assignment flag to eval_with_dot.
599 (Output_section_element_dot_assignment::set_section_addresses):
600 Likewise.
601 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
602 parameter. Also set value if relative to dot_section; set the
603 symbol's output_section.
604 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
605 parameter. Adjust all callers.
606 (Expression::eval_maybe_dot): Likewise.
607 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
608 Adjust all callers.
609 * testsuite/script_test_2.t: Test assignment of an absolute value
610 to dot within an output section element.
611
9634ed06
CC
6122011-10-31 Cary Coutant <ccoutant@google.com>
613
614 * options.h (class General_options): Add --[no-]gnu-unique options.
615 * symtab.cc (Symbol_table::sized_write_globals): Convert
616 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
617
de4101c7
CC
6182011-10-31 Cary Coutant <ccoutant@google.com>
619
620 PR gold/13359
621 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
622 unnecessary assertion.
623 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
624
7257cc92
ST
6252011-10-31 Sriraman Tallam <tmsriram@google.com>
626
627 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
628 gc_mark_symbol.
629 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
630 gc_mark_symbol.
631 Change to just keep the section associated with symbol.
632 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
633 they are externally visible and --export-dynamic is turned on.
634 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
635
bfc34b3f
ILT
6362011-10-19 Ian Lance Taylor <iant@google.com>
637
638 PR gold/13163
639 * script-sections.cc
640 (Output_section_element_dot_assignment::needs_output_section): New
641 function.
642
ea0d8c47
ILT
6432011-10-19 Ian Lance Taylor <iant@google.com>
644
645 PR gold/13204
646 * layout.cc (Layout::segment_precedes): Don't assert failure if a
647 --section-start option was seen.
648 * options.h (General_options::any_section_start): New function.
649
abd242a9
DM
6502011-10-18 David S. Miller <davem@davemloft.net>
651
652 PR binutils/13301
653 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
654 member to track relocation locations that have moved during TLS
655 reloc optimizations.
656 (Target_sparc::Relocate::Relocate): Initialize to NULL.
657 (Target_sparc::Relocate::relocate): Adjust view down by 4
658 bytes if it matches reloc_adjust_addr_.
659 (Target_sparc::Relocate::relocate_tls): Always move the
660 __tls_get_addr call delay slot instruction forward 4 bytes when
661 performing relaxation.
662
bab9090f
CC
6632011-10-18 Cary Coutant <ccoutant@google.com>
664
665 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
666 (Output_file::map_no_anonymous): Check for non-zero
667 return code from posix_fallocate.
668
f7c5b166
CC
6692011-10-17 Cary Coutant <ccoutant@google.com>
670
671 PR gold/13245
672 * plugin.cc (is_visible_from_outside): Check for symbols
673 referenced from dynamic objects.
674 * resolve.cc (Symbol_table::resolve): Don't count references
675 from dynamic objects as references from real ELF files.
676 * testsuite/plugin_test_2.sh: Adjust expected result.
677
b490c0bb
CC
6782011-10-17 Cary Coutant <ccoutant@google.com>
679
680 * gold.cc: Include timer.h.
681 (queue_middle_tasks): Stamp time.
682 (queue_final_tasks): Likewise.
683 * main.cc (main): Store timer in parameters. Print timers
684 for each pass.
685 * parameters.cc (Parameters::Parameters): Initialize timer_.
686 (Parameters::set_timer): New function.
687 (set_parameters_timer): New function.
688 * parameters.h (Parameters::set_timer): New function.
689 (Parameters::timer): New function.
690 (Parameters::timer_): New data member.
691 (set_parameters_timer): New function.
692 * timer.cc (Timer::stamp): New function.
693 (Timer::get_pass_time): New function.
694 * timer.h (Timer::stamp): New function.
695 (Timer::get_pass_time): New function.
696 (Timer::pass_times_): New data member.
697
f475cf7b
CC
6982011-10-17 Cary Coutant <ccoutant@google.com>
699
700 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
701 task for members of lib groups.
702
cdd7e244
CC
7032011-10-17 Cary Coutant <ccoutant@google.com>
704
705 PR gold/13288
4f95c8b4 706 * fileread.cc (File_read::find_view): Add assert.
cdd7e244
CC
707 (File_read::make_view): Move bounds check (replace with assert)...
708 (File_read::find_or_make_view): ... to here.
709
dfb45471
CC
7102011-10-12 Cary Coutant <ccoutant@google.com>
711
4f95c8b4 712 * output.cc (Output_file::open_base_file): Handle case where
dfb45471
CC
713 ::read returns less than requested size.
714
53bbcc1b
CC
7152011-10-10 Cary Coutant <ccoutant@google.com>
716
4f95c8b4 717 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
53bbcc1b
CC
718 Initialize defined_count_.
719 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
720 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
721 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
722 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
723 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4f95c8b4 724 * incremental.h (Sized_relobj_incr::defined_count_): New data
53bbcc1b
CC
725 member.
726 (Sized_incr_dynobj::defined_count_): New data member.
4f95c8b4 727 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
53bbcc1b
CC
728 Return zeroes instead of internal error.
729
397b129b
CC
7302011-10-10 Cary Coutant <ccoutant@google.com>
731
732 PR gold/13249
4f95c8b4 733 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
397b129b 734 (Output_reloc::symbol_value): Return PLT offset if flag is set.
4f95c8b4 735 * output.h (class Output_reloc): Add use_plt_offset flag.
397b129b
CC
736 (Output_reloc::type_): Adjust size of bit field.
737 (Output_reloc::use_plt_offset_): New bit field.
738 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
739 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
740 flag. Adjust all callers.
4f95c8b4 741 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
397b129b
CC
742 creating RELATIVE relocations.
743
d5698657
NC
7442011-10-10 Nick Clifton <nickc@redhat.com>
745
746 * po/es.po: Updated Spanish translation.
747 * po/fi.po: Updated Finnish translation.
748
6a59a5c2
DN
7492011-10-03 Diego Novillo <dnovillo@google.com>
750
751 * options.cc (parse_uint): Fix dereference of RETVAL.
752
f0558624
ST
7532011-09-29 Sriraman Tallam <tmsriram@google.com>
754
755 * layout.h (section_order_map_): New member.
756 (get_section_order_map): New member function.
757 * output.cc (Output_section::add_input_section): Check for patterns
758 only when --section-ordering-file is specified.
759 * gold.cc (queue_middle_tasks): Delay updating order of sections till
760 output_sections have been formed.
761 * layout.cc (Layout_Layout): Initialize section_order_map_.
762 * plugin.cc (update_section_order): Store order in order_map. Do not
763 update the order.
764 * testsuite/Makefile.am: Add test case for plugin_final_layout.
765 * testsuite/Makefile.in: Regenerate.
766 * testsuite/plugin_section_order.c: New file.
767 * testsuite/plugin_final_layout.cc: New file.
768 * testsuite/plugin_final_layout.sh: New file.
769
a7dac153
CC
7702011-09-29 Cary Coutant <ccoutant@google.com>
771
4f95c8b4 772 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
a7dac153 773 Check for NULL.
4f95c8b4 774 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
a7dac153
CC
775 symbols during incremental update.
776 (Symbol_table::add_from_dynobj): Likewise.
777
eebd87a5
ILT
7782011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
779 Ian Lance Taylor <iant@google.com>
780
781 * symtab.cc (Symbol_table::define_special_symbol): Always
782 canonicalize version string.
783
403a3331
CC
7842011-09-26 Cary Coutant <ccoutant@google.com>
785
4f95c8b4
CC
786 * gold.cc (queue_initial_tasks): Move option checks ...
787 * options.cc (General_options::finalize): ... to here. Disable
403a3331
CC
788 some options; make others fatal.
789
235061c2
CC
7902011-09-26 Cary Coutant <ccoutant@google.com>
791
792 gcc PR lto/47247
793 * plugin.cc (get_symbols_v2): New function.
794 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
795 (is_referenced_from_outside): New function.
796 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
797 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
798 (get_symbols): Pass version parameter.
799 (get_symbols_v2): New function.
800 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
801 parameter.
802 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
803 (onload): Add LDPT_GET_SYMBOLS_V2.
804 (all_symbols_read_hook): Use get_symbols_v2; check for
805 LDPR_PREVAILING_DEF_IRONLY_EXP.
806 * testsuite/plugin_test_3.sh: Update expected results.
807
dc87f620
ILT
8082011-09-23 Simon Baldwin <simonb@google.com>
809
810 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
811 configuration options.
812 * configure: Regenerate.
813 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
814 * Makefile.in: Regenerate.
815 * testsuite/Makefile.in: Regenerate.
816
a8279f82
ST
8172011-09-19 Sriraman Tallam <tmsriram@google.com>
818
819 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
820
0c9350c8
CC
8212011-09-19 Cary Coutant <ccoutant@google.com>
822
823 * incremental.cc (can_incremental_update): Fix typo in comment.
824 * incremental.h (can_incremental_update): Likewise.
825
aa06ae28
CC
8262011-09-18 Cary Coutant <ccoutant@google.com>
827
828 * incremental.cc (can_incremental_update): New function.
829 * incremental.h (can_incremental_update): New function.
830 * layout.cc (Layout::init_fixed_output_section): Call it.
831 (Layout::make_output_section): Don't allow patch space in .eh_frame.
832 * object.cc (Sized_relobj_file::do_layout): Call
833 can_incremental_update.
834
ebb300b2
CC
8352011-09-13 Cary Coutant <ccoutant@google.com>
836
837 * configure.ac: Check for glibc support for gnu_indirect_function
838 support with static linking, setting automake conditional
839 IFUNC_STATIC.
840 * Makefile.in: Regenerate.
841 * configure: Regenerate.
842
843 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
844 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
845 for IFUNC_STATIC.
846 * testsuite/Makefile.in: Regenerate.
847
1206d0d5
CC
8482011-09-13 Cary Coutant <ccoutant@google.com>
849
850 * incremental.cc (Sized_relobj_incr::do_layout): Call
851 report_comdat_group for kept comdat sections.
852 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
853 * testsuite/Makefile.in: Regenerate.
854 * testsuite/incr_comdat_test_1.cc: New source file.
855 * testsuite/incr_comdat_test_2_v1.cc: New source file.
856 * testsuite/incr_comdat_test_2_v2.cc: New source file.
857 * testsuite/incr_comdat_test_2_v3.cc: New source file.
858
40b29874
ILT
8592011-09-13 Ian Lance Taylor <iant@google.com>
860
861 * object.cc (Sized_relobj_file::do_layout): Remove unused local
862 variable external_symbols_offset.
863
1b045aac
ILT
8642011-09-12 Ian Lance Taylor <iant@google.com>
865
866 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
867 triggered if object has no symbols.
868
24c6c55a
DM
8692011-09-09 David S. Miller <davem@davemloft.net>
870
871 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
872 (Output_fill_debug_line::do_write): Likewise.
873
66570254
CC
8742011-08-29 Cary Coutant <ccoutant@google.com>
875
876 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
877 casts to match formatting specs.
878 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
879
8ea8cd50
CC
8802011-08-26 Cary Coutant <ccoutant@google.com>
881
882 * layout.cc (Free_list::allocate): Provide guarantee of minimum
883 remaining hole size when allocating.
884 (Layout::make_output_section): Set fill methods for debug sections.
885 * layout.h (Free_list::Free_list_node): Move from private to
886 public.
887 (Free_list::set_min_hole_size): New function.
888 (Free_list::begin, Free_list::end): New functions.
889 (Free_list::min_hole_): New data member.
890 * output.cc: Include dwarf.h.
891 (Output_fill_debug_info::do_minimum_hole_size): New function.
892 (Output_fill_debug_info::do_write): New function.
893 (Output_fill_debug_line::do_minimum_hole_size): New function.
894 (Output_fill_debug_line::do_write): New function.
895 (Output_section::Output_section): Initialize new data member.
896 (Output_section::set_final_data_size): Ensure patch space is larger
897 than minimum hole size.
898 (Output_section::do_write): Fill holes in debug sections.
899 * output.h (Output_fill): New class.
900 (Output_fill_debug_info): New class.
901 (Output_fill_debug_line): New class.
902 (Output_section::set_free_space_fill): New function.
903 (Output_section::free_space_fill_): New data member.
904 * testsuite/Makefile.am (incremental_test_3): Add
905 --incremental-patch option.
906 (incremental_test_4): Likewise.
907 (incremental_test_5): Likewise.
908 (incremental_test_6): Likewise.
909 (incremental_copy_test): Likewise.
910 (incremental_common_test_1): Likewise.
911 * testsuite/Makefile.in: Regenerate.
912
7cf80422
NC
9132011-08-26 Nick Clifton <nickc@redhat.com>
914
915 * po/es.po: Updated Spanish translation.
916
c3f7b0e5
CC
9172011-08-01 Cary Coutant <ccoutant@google.com>
918
919 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
920 * gold/testsuite/Makefile.in: Regenerate.
921 * gold/testsuite/justsyms_exec.c: New source file.
922 * gold/testsuite/justsyms_lib.c: New source file.
923
9590bf25
CC
9242011-08-01 Cary Coutant <ccoutant@google.com>
925
926 * layout.cc (Layout::set_segment_offsets): Don't realign text
927 segment if -Ttext was specified.
928 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
929 file type.
930 * object.h (Sized_relobj_file::e_type): New function.
931 (Sized_relobj_file::e_type_): New data member.
932 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
933 base address for ET_EXEC files.
934 * target.cc (Target::do_make_elf_object_implementation): Allow
935 ET_EXEC files with --just-symbols option.
936
dcd8d12e
CC
9372011-07-28 Cary Coutant <ccoutant@google.com>
938
939 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
940 Add thread_number parameter.
941 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
942 * workqueue-threads.cc
943 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
944 current thread if its thread number is greater than desired thread
945 count.
946 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
947 Add thread_number parameter.
948 (Workqueue::should_cancel_thread): Likewise.
949 (Workqueue::find_runnable_or_wait): Pass thread_number to
950 should_cancel_thread.
951 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
952 parameter.
953
804eb480
ST
9542011-07-22 Sriraman Tallam <tmsriram@google.com>
955
956 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
957 only after checking if it cannot be forced local.
958 * symtab.h (is_externally_visible): Check if the symbol is not forced
959 local.
960
f1ddb600
ILT
9612011-07-15 Ian Lance Taylor <iant@google.com>
962
963 * options.h (class General_options): Add --print-output-format.
964 Move -EL next to -EB, for better --help output.
965 * target-select.cc: Include <cstdio>, "options.h", and
966 "parameters.h".
967 (Target_selector::do_target_bfd_name): New function.
968 (print_output_format): New function.
969 * target-select.h (class Target_selector): Update declarations.
970 (Target_selector::target_bfd_name): New function.
971 (print_output_format): Declare.
972 * main.cc: Include "target-select.h".
973 (main): Handle --print-output-format.
974 * gold.cc: Include "target-select.h".
975 (queue_initial_tasks): Handle --print-output-format when there are
976 no input files.
977 * parameters.cc (parameters_force_valid_target): Give a better
978 error message if -EB/-EL does not match target.
979 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
980 function.
981
7d172687
ILT
9822011-07-15 Ian Lance Taylor <iant@google.com>
983
984 * i386.cc (class Output_data_plt_i386): Add layout_ field.
985 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
986 (Output_data_plt_i386::do_write): Write address of .dynamic
987 section to first entry in .got.plt section.
988 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
989 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
990 Initialize layout_.
991 (Output_data_plt_x86_64::do_write): Write address of .dynamic
992 section to first entry in .got.plt section.
993 * layout.h (Layout::dynamic_section): New function.
994
e9552f7e
ST
9952011-07-13 Sriraman Tallam <tmsriram@google.com>
996
997 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
998 to claim_file call.
999 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1000 input_section_position_, and input_section_glob_.
1001 (read_layout_from_file): Call function section_ordering_specified.
1002 * layout.h (is_section_ordering_specified): New function.
1003 (section_ordering_specified): New function.
1004 (section_ordering_specified_): New boolean member.
1005 * main.cc(main): Call load_plugins after layout object is defined.
1006 * output.cc (Output_section::add_input_section): Use
1007 function section_ordering_specified to check if section ordering is
1008 needed.
1009 * output.cc (Output_section::add_relaxed_input_section): Use
1010 function section_ordering_specified to check if section ordering is
1011 needed.
1012 (Output_section::update_section_layout): New function.
1013 (Output_section::sort_attached_input_sections): Check if input section
1014 must be reordered.
1015 * output.h (Output_section::update_section_layout): New function.
1016 * plugin.cc (get_section_count): New function.
1017 (get_section_type): New function.
1018 (get_section_name): New function.
1019 (get_section_contents): New function.
1020 (update_section_order): New function.
58797674 1021 (allow_section_ordering): New function.
e9552f7e
ST
1022 (Plugin::load): Add the new interfaces to the transfer vector.
1023 (Plugin_manager::load_plugins): New parameter.
1024 (Plugin_manager::all_symbols_read): New parameter.
1025 (Plugin_manager::claim_file): New parameter. Save the elf object for
1026 unclaimed objects.
1027 (Plugin_manager::get_elf_object): New function.
1028 (Plugin_manager::get_view): Change to directly use the bool to check
1029 if get_view is called from claim_file_hook.
1030 * plugin.h (input_objects): New function
1031 (Plugin__manager::load_plugins): New parameter.
1032 (Plugin_manager::claim_file): New parameter.
1033 (Plugin_manager::get_elf_object): New function.
1034 (Plugin_manager::in_claim_file_handler): New function.
1035 (Plugin_manager::in_claim_file_handler_): New member.
1036 (layout): New function.
1037 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1038 handler with an extra parameter. Make the elf object before calling
1039 claim_file handler.
1040 * testsuite/plugin_test.c (get_section_count): New function pointer.
1041 (get_section_type): New function pointer.
1042 (get_section_name): New function pointer.
1043 (get_section_contents): New function pointer.
1044 (update_section_order): New function pointer.
1045 (allow_section_ordering): New function pointer.
1046 (onload): Check if the new interfaces exist.
1047
9446efde
ILT
10482011-07-13 Ian Lance Taylor <iant@google.com>
1049
1050 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1051 relro section.
1052 * x86_64.cc (Target_x86_64::got_section): Likewise.
1053 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1054 (relro_now_test_SOURCES): New variable.
1055 (relro_now_test_DEPENDENCIES): New variable.
1056 (relro_now_test_LDFLAGS): New variable.
1057 (relro_now_test_LDADD): New variable.
1058 (relro_now_test.so): New target.
1059 * testsuite/Makefile.in: Rebuild.
1060
07aa62f2
ILT
10612011-07-12 Ian Lance Taylor <iant@google.com>
1062
1063 PR gold/12980
1064 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1065 GLOB_DAT relocation rather than a RELATIVE relocation for a
1066 protected symbol when creating a shared library.
1067 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1068 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1069 * testsuite/protected_main_1.cc (main): Test that protected
1070 function has same address.
1071
e2153196
ILT
10722011-07-11 Ian Lance Taylor <iant@google.com>
1073
1074 PR gold/12979
1075 * options.h (class General_options): Add -Bgroup.
1076 * options.cc (General_options::finalize): If -Bgroup is set,
1077 default to --unresolved-symbols=report-all.
1078 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1079 * target-reloc.h (issue_undefined_symbol_error): Handle
1080 --unresolved-symbols=report-all.
1081
6daf5215
ILT
10822011-07-08 Ian Lance Taylor <iant@google.com>
1083
1084 PR gold/11985
1085 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1086 if linker script discards key sections.
1087 (Layout::create_dynamic_symtab): Likewise.
1088 (Layout::assign_local_dynsym_offsets): Likewise.
1089 (Layout::sized_create_version_sections): Likewise.
1090 (Layout::create_interp): Likewise.
1091 (Layout::finish_dynamic_section): Likewise.
1092 (Layout::set_dynamic_symbol_size): Likewise.
1093
beabb2c6
ILT
10942011-07-08 Ian Lance Taylor <iant@google.com>
1095
1096 PR gold/12386
1097 * options.h (class General_options): Add --unresolved-symbols.
1098 * target-reloc.h (issue_undefined_symbol_error): Check
1099 --unresolved-symbols. Add comments.
1100
9c16daf1
ILT
11012011-07-08 Ian Lance Taylor <iant@google.com>
1102
1103 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1104 expression more complex.
1105
191f1a2d
ILT
11062011-07-08 Ian Lance Taylor <iant@google.com>
1107
1108 PR gold/11317
1109 * target-reloc.h (issue_undefined_symbol_error): New inline
1110 function, broken out of relocate_section.
1111 (relocate_section): Call issue_undefined_symbol_error.
1112 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1113 there is no TLS segment if we are about to issue an undefined
1114 symbol error.
1115 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1116
62855347
ILT
11172011-07-08 Ian Lance Taylor <iant@google.com>
1118
1119 PR gold/12279
1120 * resolve.cc (Symbol_table::should_override): Add fromtype
1121 parameter. Change all callers. Give error when linking together
1122 TLS and non-TLS symbol.
1123 (Symbol_table::should_override_with_special): Add fromtype
1124 parameter. Change all callers.
1125 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1126 there is no TLS segment if we have reported some errors.
1127 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1128
67181c72
ILT
11292011-07-08 Ian Lance Taylor <iant@google.com>
1130
1131 PR gold/12372
1132 * target.h (Target::plt_address_for_global): New function.
1133 (Target::plt_address_for_local): New function.
1134 (Target::plt_section_for_global): Remove.
1135 (Target::plt_section_for_local): Remove.
1136 (Target::do_plt_address_for_global): New virtual function.
1137 (Target::do_plt_address_for_local): New virtual function.
1138 (Target::do_plt_section_for_global): Remove.
1139 (Target::do_plt_section_for_local): Remove.
1140 (Target::register_global_plt_entry): Add Symbol_table and Layout
1141 parameters.
1142 * output.cc (Output_data_got::Got_entry::write): Use
1143 plt_address_for_global and plt_address_for_local.
1144 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1145 address of output section.
1146 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1147 got_irelative_, and irelative_count_ fields. Update
1148 declarations.
1149 (Output_data_plt_i386::has_irelative_section): New function.
1150 (Output_data_plt_i386::entry_count): Add irelative_count_.
1151 (Output_data_plt_i386::set_final_data_size): Likewise.
1152 (class Target_i386): Add got_irelative_ and rel_irelative_
1153 fields. Update declarations.
1154 (Target_i386::Target_i386): Initialize new fields.
1155 (Target_i386::do_plt_address_for_global): New function replacing
1156 do_plt_section_for_global.
1157 (Target_i386::do_plt_address_for_local): New function replacing
1158 do_plt_section_for_local.
1159 (Target_i386::got_section): Create got_irelative_.
1160 (Target_i386::rel_irelative_section): New function.
1161 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1162 fields. Don't define __rel_iplt_{start,end}.
1163 (Output_data_plt_i386::add_entry): Add symtab and layout
1164 parameters. Change all callers. Use different PLT and GOT for
1165 IFUNC symbols.
1166 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1167 layout parameters. Change all callers. Use different PLT and
1168 GOT.
1169 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1170 (Output_data_plt_i386::rel_irelative): New function.
1171 (Output_data_plt_i386::address_for_global): New function.
1172 (Output_data_plt_i386::address_for_local): New function.
1173 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1174 IRELATIVE GOT when changing IFUNC GOT entries.
1175 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1176 reloc.
1177 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1178 if we didn't create an IRELATIVE GOT.
1179 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1180 plt_address_for_local.
1181 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1182 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1183 got_irelative_, and irelative_count_ fields. Update
1184 declarations.
1185 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1186 Initialize new fields. Remove symtab parameter. Change all
1187 callers.
1188 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1189 irelative_count_.
1190 (Output_data_plt_x86_64::has_irelative_section): New function.
1191 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1192 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1193 fields. Update declarations.
1194 (Target_x86_64::Target_x86_64): Initialize new fields.
1195 (Target_x86_64::do_plt_address_for_global): New function replacing
1196 do_plt_section_for_global.
1197 (Target_x86_64::do_plt_address_for_local): New function replacing
1198 do_plt_section_for_local.
1199 (Target_x86_64::got_section): Create got_irelative_.
1200 (Target_x86_64::rela_irelative_section): New function.
1201 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1202 all callers. Don't create __rel_iplt_{start,end}.
1203 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1204 parameters. Change all callers. Use different PLT and GOT for
1205 IFUNC symbols.
1206 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1207 layout parameters. Change all callers. Use different PLT and
1208 GOT.
1209 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1210 parameters. Change all callers. Use different PLT and GOT for
1211 IFUNC symbols.
1212 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1213 (Output_data_plt_x86_64::rela_irelative): New function.
1214 (Output_data_plt_x86_64::address_for_global): New function.
1215 (Output_data_plt_x86_64::address_for_local): New function.
1216 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1217 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1218 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1219 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1220 parameters.
1221 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1222 reloc.
1223 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1224 symbols if we didn't create an IRELATIVE GOT.
1225 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1226 plt_address_for_local.
1227 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1228 * testsuite/ifuncvar1.c: New test file.
1229 * testsuite/ifuncvar2.c: New test file.
1230 * testsuite/ifuncvar3.c: New test file.
1231 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1232 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1233 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1234 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1235 * testsuite/Makefile.in: Rebuild.
1236
33c15b45
CC
12372011-07-07 Cary Coutant <ccoutant@google.com>
1238
1239 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1240 (two_file_test_1_ndebug.o): Likewise.
1241 (two_file_test_1b_ndebug.o): Likewise.
1242 (two_file_test_2_ndebug.o): Likewise.
1243 (two_file_test_main_ndebug.o): Likewise.
1244 (incremental_test_2): Link with no-debug versions.
1245
f48b5fb7
CC
12462011-07-06 Cary Coutant <ccoutant@google.com>
1247
1248 * gold/incremental.cc
1249 (Output_section_incremental_inputs::write_info_blocks): Check for
1250 hidden and internal symbols.
1251
221597a5
CC
12522011-07-06 Cary Coutant <ccoutant@google.com>
1253
1254 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1255 Check disposition for startup file.
1256 (Incremental_inputs::report_command_line): Ignore
1257 --incremental-startup-unchanged option.
1258 * options.cc (General_options::parse_incremental_startup_unchanged):
1259 New function.
1260 (General_options::General_options): Initialize new data member.
1261 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1262 (General_options): Add --incremental-startup-unchanged option.
1263 (General_options::incremental_startup_disposition): New function.
1264 (General_options::incremental_startup_disposition_): New data member.
1265
e24719f6
CC
12662011-07-06 Cary Coutant <ccoutant@google.com>
1267
1268 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1269 input file index to Script_info ctor.
1270 (Sized_incremental_binary::do_file_has_changed): Find the
1271 command-line argument for files named in scripts.
1272 * incremental.h (Script_info::Script_info): New ctor
1273 with input file index.
1274 (Script_info::input_file_index): New function.
1275 (Script_info::input_file_index_): New data member.
1276 (Incremental_binary::get_library): Add const.
1277 (Incremental_binary::get_script_info): Add const.
1278 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1279 * testsuite/Makefile.am (incremental_test_5): New test case.
1280 (incremental_test_6): New test case.
1281 * testsuite/Makefile.in: Regenerate.
1282
8f7c81e8
CC
12832011-07-06 Cary Coutant <ccoutant@google.com>
1284
1285 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1286 debug output when command lines differ.
1287
9fbd3822
CC
12882011-07-06 Cary Coutant <ccoutant@google.com>
1289
1290 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1291 --incremental-patch option.
1292 * layout.cc (Free_list::allocate): Extend allocation beyond original
1293 end if enabled.
1294 (Layout::make_output_section): Mark sections that should get
1295 patch space.
1296 * options.cc (parse_percent): New function.
1297 * options.h (parse_percent): New function.
1298 (DEFINE_percent): New macro.
1299 (General_options): Add --incremental-patch option.
1300 * output.cc (Output_section::Output_section): Initialize new data
1301 members.
1302 (Output_section::add_input_section): Print section name when out
1303 of patch space.
1304 (Output_section::add_output_section_data): Likewise.
1305 (Output_section::set_final_data_size): Add patch space when
1306 doing --incremental-full.
1307 (Output_section::do_reset_address_and_file_offset): Remove patch
1308 space.
1309 (Output_segment::set_section_list_addresses): Print debug output
1310 only if --incremental-update.
1311 * output.h (Output_section::set_is_patch_space_allowed): New function.
1312 (Output_section::is_patch_space_allowed_): New data member.
1313 (Output_section::patch_space_): New data member.
1314 * parameters.cc (Parameters::incremental_full): New function.
1315 * parameters.h (Parameters::incremental_full): New function
1316 * testsuite/Makefile.am (incremental_test_2): Add test for
1317 --incremental-patch option.
1318 * testsuite/Makefile.in: Regenerate.
1319 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1320 (t18): Remove function body.
1321
f6cccc2c
DK
13222011-07-05 Doug Kwan <dougkwan@google.com>
1323
1324 PR gold/12771
1325 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1326 Arm_Address type for relocation result.
1327 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1328 overflow check.
1329 (Arm_relocate_functions::abs32): Use unaligned access.
1330 (Arm_relocate_functions::rel32): Ditto.
1331 (Arm_relocate_functions::prel31): Ditto.
1332 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1333 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1334 static data relocations.
1335 * testsuite/Makefile.in: Regnerate.
1336 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1337
28a13fec
ILT
13382011-07-05 Ian Lance Taylor <iant@google.com>
1339
1340 PR gold/12392
1341 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1342 symbols if necessary.
1343 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1344
24d47b34
ILT
13452011-07-05 Ian Lance Taylor <iant@google.com>
1346
1347 PR gold/12952
1348 * resolve.cc (Symbol::override_base_with_special): Simply override
1349 version with special symbol version, ignoring previous version.
1350
41f9cbbe
ILT
13512011-07-05 Ian Lance Taylor <iant@google.com>
1352
1353 * object.cc (Sized_relobj_file::include_section_group): Add
1354 information to comment about signature location.
1355
886288f1
ILT
13562011-07-02 Ian Lance Taylor <iant@google.com>
1357
1358 PR gold/12957
1359 * options.h (class General_options): Add -f and -F.
1360 * options.cc (General_options::finalize): Fatal error if -f/-F
1361 are used without -shared.
1362 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1363
ae3a6d4f
ILT
13642011-07-02 Ian Lance Taylor <iant@google.com>
1365
1366 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1367
21131061
ILT
13682011-07-01 Ian Lance Taylor <iant@google.com>
1369
1370 PR gold/12525
1371 PR gold/12952
1372 * resolve.cc (Symbol::override_base_with_special): Don't override
1373 the version if the overriding symbol has a different name.
1374 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1375 all callers. If we give an error about an undefined version,
1376 define the base version if necessary.
1377 * dynobj.h (class Versions): Update declaration.
1378 * testsuite/weak_alias_test_5.cc: New file.
1379 * testsuite/weak_alias_test.script: New file.
1380 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1381 and versioned_alias have the right value, and call t2.
1382 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1383 weak_alias_test_5.so.
1384 (weak_alias_test_LDADD): Likewise.
1385 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1386 * testsuite/Makefile.in: Rebuild.
1387
611062c0
ILT
13882011-07-01 Ian Lance Taylor <iant@google.com>
1389
1390 PR gold/12525
1391 * options.h (class General_options): Support -z notext.
1392 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1393 -Wl,-z,notext.
1394 (two_file_shared_nonpic.so): Likewise.
1395 (two_file_shared_mixed.so): Likewise.
1396 (two_file_shared_mixed_1.so): Likewise.
1397 (weak_undef_lib_nonpic.so): Likewise.
1398 (alt/weak_undef_lib_nonpic.so): Likewise.
1399 (tls_test_shared_nonpic.so): Likewise.
1400 * testsuite/Makefile.in: Rebuild.
1401
328c7c2f
ILT
14022011-07-01 Ian Lance Taylor <iant@google.com>
1403
1404 PR gold/12525
1405 * configure.ac: Test whether static linking works, setting
1406 the automake conditional HAVE_STATIC.
1407 * testsuite/Makefile.am: Disable tests using -static if
1408 HAVE_STATIC is not true.
1409 * configure, testsuite/Makefile.in: Rebuild.
1410
02d7cd44
ILT
14112011-07-01 Ian Lance Taylor <iant@google.com>
1412
1413 PR gold/12525
1414 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1415 Assert if we see DW_EH_PE_indirect.
1416 * target.h (Target::ehframe_datarel_base): New function.
1417 (Target::do_ehframe_datarel_base): New target function.
1418 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1419 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1420 function.
1421
07a60597
ILT
14222011-07-01 Ian Lance Taylor <iant@google.com>
1423
1424 PR gold/12571
1425 * options.h (class General_options): Add
1426 --ld-generated-unwind-info.
1427 * ehframe.cc (Fde::write): Add address parameter. Change all
1428 callers. If associated with PLT, fill in address and size.
1429 (Cie::set_output_offset): Only add merge mapping if there is an
1430 object.
1431 (Cie::write): Add address parameter. Change all callers.
1432 (Eh_frame::add_ehframe_for_plt): New function.
1433 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1434 input_offset_ fields into union u_, with new plt field.
1435 (Fde::Fde): Adjust for new union field.
1436 (Fde::Fde) [Output_data version]: New constructor.
1437 (Fde::add_mapping): Only add merge mapping if there is an object.
1438 (class Cie): Update declarations.
1439 (class Eh_frame): Declare add_ehframe_for_plt.
1440 * layout.cc (Layout::layout_eh_frame): Break out code into
1441 make_eh_frame_section, and call it.
1442 (Layout::make_eh_frame_section): New function.
1443 (Layout::add_eh_frame_for_plt): New function.
1444 * layout.h (class Layout): Update declarations.
1445 * merge.cc (Merge_map::add_mapping): Add assertion.
1446 * i386.cc: Include "dwarf.h".
1447 (class Output_data_plt_i386): Make first_plt_entry,
1448 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1449 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1450 and plt_eh_frame_fde.
1451 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1452 boundary. Call add_eh_frame_for_plt if appropriate.
1453 * x86_64.cc: Include "dwarf.h".
1454 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1455 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1456 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1457 and plt_eh_frame_fde.
1458 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1459 appropriate.
1460
14788a3f
ILT
14612011-06-29 Ian Lance Taylor <iant@google.com>
1462
1463 PR gold/12629
1464 * object.cc (Sized_relobj_file::layout_section): Change shdr
1465 parameter to be const.
1466 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1467 out of do_layout.
1468 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1469 appropriate. Call layout_eh_frame_section.
1470 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1471 sections.
1472 * object.h (class Sized_relobj_file): Update declarations.
1473
6c21fce1
ILT
14742011-06-29 Ian Lance Taylor <iant@google.com>
1475
37e41b03 1476 PR gold/12652
6c21fce1
ILT
1477 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1478 modifier.
1479 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1480
4d5e4e62
ILT
14812011-06-29 Ian Lance Taylor <iant@google.com>
1482
1483 PR gold/12675
1484 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1485 SHT_X86_64_UNWIND.
1486 * layout.cc (Layout::layout_eh_frame): Likewise.
1487
886f533a
ILT
14882011-06-29 Ian Lance Taylor <iant@google.com>
1489
1490 PR gold/12695
1491 * layout.cc (Layout::symtab_section_shndx): New function.
1492 * layout.h (class Layout): Declare symtab_section_shndx.
1493 * output.cc (Output_section::write_header): Call it.
1494
f3ae1b28
ILT
14952011-06-29 Ian Lance Taylor <iant@google.com>
1496
1497 PR gold/12818
1498 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1499 symbols which are not used in a relocation.
1500
aecf301f
ILT
15012011-06-28 Ian Lance Taylor <iant@google.com>
1502
1503 PR gold/12898
1504 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1505 script create indistinguishable segments.
1506 (Layout::set_segment_offsets): Use stable_sort when sorting
1507 segments. Pass this to Compare_segments constructor.
1508 * layout.h (class Layout): Make segment_precedes non-static.
1509 (class Compare_segments): Change from struct to class. Add
1510 layout_ field. Add constructor.
1511 * script-sections.cc
1512 (Script_sections::attach_sections_using_phdrs_clause): Rename
1513 local orphan to is_orphan. Don't report failure to put empty
1514 section in segment. On attachment failure, report name of
1515 section, and attach to first PT_LOAD segment.
1516
03ef7571
ILT
15172011-06-28 Ian Lance Taylor <iant@google.com>
1518
1519 PR gold/12934
1520 * target-select.cc (Target_selector::Target_selector): Add
1521 emulation parameter. Change all callers.
1522 (select_target_by_bfd_name): Rename from select_target_by_name.
1523 Change all callers.
1524 (select_target_by_emulation): New function.
1525 (supported_emulation_names): New function.
1526 * target-select.h (class Target_selector): Add emulation_ field.
1527 Update declarations.
1528 (Target_selector::recognize_by_bfd_name): Rename from
1529 recognize_by_name. Change all callers.
1530 (Target_selector::supported_bfd_names): Rename from
1531 supported_names. Change all callers.
1532 (Target_selector::recognize_by_emulation): New function.
1533 (Target_selector::supported_emulations): New function.
1534 (Target_selector::emulation): New function.
1535 (Target_selector::do_recognize_by_bfd_name): Rename from
1536 do_recognize_by_name. Change all callers.
1537 (Target_selector::do_supported_bfd_names): Rename from
1538 do_supported_names. Change all callers.
1539 (Target_selector::do_recognize_by_emulation): New function.
1540 (Target_selector::do_supported_emulations): New function.
1541 (select_target_by_bfd_name): Change name in declaration.
1542 (select_target_by_emulation): Declare.
1543 (supported_emulation_names): Declare.
1544 * parameters.cc (parameters_force_valid_target): Try to find
1545 target based on emulation from -m option.
1546 * options.h (class General_options): Change doc string for -m.
1547 * options.cc (help): Print emulations.
1548 (General_options::parse_V): Likewise.
1549 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1550 Add emulation parameter. Change all callers.
1551
200b2bb9
ILT
15522011-06-28 Ian Lance Taylor <iant@google.com>
1553
1554 * target.h (class Target): Add osabi_ field.
1555 (Target::osabi): New function.
1556 (Target::set_osabi): New function.
1557 (Target::Target): Initialize osabi_.
1558 (Target::do_adjust_elf_header): Make pure virtual.
1559 (Sized_target::do_adjust_elf_header): Declare.
1560 * target.cc (Sized_target::do_adjust_elf_header): New function.
1561 (class Sized_target): Instantiate all versions.
1562 * freebsd.h (class Target_freebsd): Remove.
1563 (Target_selector_freebsd::do_recognize): Call set_osabi on
1564 Target.
1565 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1566 (Target_selector_freebsd::set_osabi): Remove.
1567 * i386.cc (class Target_i386): Inherit from Sized_target rather
1568 than Target_freebsd.
1569 * x86_64.cc (class Target_x86_64): Likewise.
1570
b3ce541e
ILT
15712011-06-28 Ian Lance Taylor <iant@google.com>
1572
1573 * target.h (Target::can_check_for_function_pointers): Rewrite.
1574 Make non-virtual.
1575 (Target::can_icf_inline_merge_sections): Likewise.
1576 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1577 (Target::Target_info): Add can_icf_inline_merge_sections field.
1578 (Target::do_can_check_for_function_pointers): New virtual
1579 function.
1580 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1581 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1582 from can_check_for_function_pointers, move in file.
1583 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1584 section_may_have_icf_unsafe_poineters, move in file.
1585 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1586 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1587 Rename from can_check_for_function_pointers, move in file.
1588 (Target_i386::can_icf_inline_merge_sections): Remove.
1589 (Target_i386::i386_info): Initialize
1590 can_icf_inline_merge_sections.
1591 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1592 Initialize can_icf_inline_merge_sections.
1593 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1594 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1595 Rename from can_check_for_function_pointers, move in file.
1596 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1597 (Target_x86_64::x86_64_info): Initialize
1598 can_icf_inline_merge_sections.
1599 * testsuite/testfile.cc (Target_test::test_target_info):
1600 Likewise.
1601 * icf.cc (get_section_contents): Correct formatting.
1602
6d1c4efb
ILT
16032011-06-27 Ian Lance Taylor <iant@google.com>
1604
1605 * symtab.cc (Symbol::versioned_name): New function.
1606 (Symbol_table::add_to_final_symtab): Use versioned_name when
1607 appropriate.
1608 (Symbol_table::sized_write_symbol): Likewise.
1609 * symtab.h (class Symbol): Declare versioned_name.
1610 * stringpool.h (class Stringpool_template): Add variant of add
1611 which takes a std::basic_string.
1612 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1613 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1614 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1615 (ver_test_12.o): New target.
1616 * testsuite/Makefile.in: Rebuild.
1617
57eb9b50
DK
16182011-06-27 Doug Kwan <dougkwan@google.com>
1619
1620 * arm.cc (Arm_relocate_functions::thm_jump8,
1621 Arm_relocate_functions::thm_jump11): Use a wider signed
1622 type to compute offset.
1623 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1624 arm_thm_jump8.
1625 * testsuite/Makefile.in: Regenerate.
1626 * testsuite/arm_branch_in_range.sh: Check test results of
1627 arm_thm_jump11 and arm_thm_jump8.
1628 * testsuite/arm_thm_jump11.s: New test source file.
1629 * testsuite/arm_thm_jump11.t: New linker script.
1630 * testsuite/arm_thm_jump8.s: New test source file.
1631 * testsuite/arm_thm_jump8.t: New linker script.
1632
487b39df
ILT
16332011-06-24 Ian Lance Taylor <iant@google.com>
1634
1635 * layout.cc: Include "object.h".
1636 (ctors_sections_in_init_array): New static variable.
1637 (Layout::is_ctors_in_init_array): New function.
1638 (Layout::layout): Add entry to ctors_sections_in_init_array if
1639 appropriate.
1640 * layout.h (class Layout): Declare is_ctors_in_init_array.
1641 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1642 is_ctors_reverse_view is set.
1643 (Sized_relobj_file::write_sections): Add layout parameter. Change
1644 all callers. Set is_ctors_reverse_view field of View_size.
1645 (Sized_relobj_file::reverse_words): New function.
1646 * object.h (Sized_relobj_file::View_size): Add
1647 is_ctors_reverse_view field.
1648 (class Sized_relobj_file): Update declarations.
1649 * testsuite/initpri3.c: New test.
1650 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1651 initpri3b.
1652 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1653 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1654 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1655 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1656 * testsuite/Makefile.in: Rebuild.
1657
472076e4
CC
16582011-06-24 Cary Coutant <ccoutant@google.com>
1659
1660 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1661 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1662 (debug_msg_cdebug.err): New targets.
1663 * testsuite/Makefile.in: Regenerate.
1664 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1665 Fix checks for link with shared library.
1666
a60af0db
DK
16672011-06-24 Doug Kwan <dougkwan@google.com>
1668
1669 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1670 skip empty text sections.
1671 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1672
5393d741
ILT
16732011-06-22 Ian Lance Taylor <iant@google.com>
1674
1675 PR gold/12910
1676 * options.h (class General_options): Add --ctors-in-init-array.
1677 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1678 friends as SHT_PROGBITS for merging sections.
1679 (Layout::layout): Remove special handling of .init_array and
1680 friends. Don't sort if doing relocatable link. Sort for .ctors
1681 and .dtors if ctors_in_init_array.
1682 (Layout::make_output_section): Force correct section types for
1683 .init_array and friends. Don't sort if doing relocatable link,
1684 Don't sort .ctors and .dtors if ctors_in_init_array.
1685 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1686 (Layout::output_section_name): Add relobj parameter. Change all
1687 callers. Handle .ctors. and .dtors. in code rather than table.
1688 Handle .ctors and .dtors if ctors_in_init_array.
1689 (Layout::match_file_name): New function, moved from output.cc.
1690 * layout.h (class Layout): Update declarations.
1691 * output.cc: Include "layout.h".
1692 (Input_section_sort_entry::get_priority): New function.
1693 (Input_section_sort_entry::match_file_name): Just call
1694 Layout::match_file_name.
1695 (Output_section::Input_section_sort_init_fini_compare::operator()):
1696 Handle .ctors and .dtors. Sort by explicit priority rather than
1697 by name.
1698 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1699 * testsuite/initpri2.c: New test.
1700 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1701 (check_PROGRAMS): Add initpri2.
1702 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1703 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1704 * configure, testsuite/Makefile.in: Rebuild.
1705
e1f74f98
ILT
17062011-06-19 Ian Lance Taylor <iant@google.com>
1707
1708 PR gold/12880
1709 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1710 .interp section to a PT_INTERP segment even if we have seen a
1711 --dynamic-linker option. Don't do it if we have seen a PHDRS
1712 clause in a linker script.
1713 (Layout::finalize): Don't create a .interp section if we've
1714 already create a PT_INTERP segment.
1715 (Layout::create_interp): Always call choose_output_section (revert
1716 patch of 2011-06-17). Don't create PT_INTERP segment.
1717 * script-sections.cc
1718 (Script_sections::create_note_and_tls_segments): Add a .interp
1719 section to a PT_INTERP segment even if we have seen a
1720 --dynamic-linker option.
1721
766f91bb
ILT
17222011-06-18 Ian Lance Taylor <iant@google.com>
1723
1724 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1725 merely because a non-PT_LOAD segment has a dynamic reloc.
1726
0d212c3a
ILT
17272011-06-18 Ian Lance Taylor <iant@google.com>
1728
1729 * layout.cc (Layout::finish_dynamic_section): Don't create
1730 DT_FLAGS entry if not needed.
1731
911a5072
ILT
17322011-06-18 Ian Lance Taylor <iant@google.com>
1733
1734 PR gold/12745
1735 * layout.cc (Layout::layout_eh_frame): Correct handling of
1736 writable .eh_frame section.
1737
534b4e5f
ILT
17382011-06-17 Ian Lance Taylor <iant@google.com>
1739
1740 PR gold/12893
1741 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1742 symbol is redefined with the exact same object and value.
1743
10b4f102
ILT
17442011-06-17 Ian Lance Taylor <iant@google.com>
1745
1746 PR gold/12880
1747 * layout.h (class Layout): Add interp_segment_ field.
1748 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1749 (Layout::attach_allocated_section_to_segment): If making shared
1750 library, put .interp section in PT_INTERP segment.
1751 (Layout::finalize): Also call create_interp if -dynamic-linker
1752 option was used.
1753 (Layout::create_interp): Assert that there is no PT_INTERP
1754 segment. If not using a SECTIONS clause, use make_output_section.
1755 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1756 * script-sections.cc
1757 (Script_sections::create_note_and_tls_segments): If making shared
1758 library, put .interp section in PT_INTERP segment.
1759
a29b0dad
ILT
17602011-06-17 Ian Lance Taylor <iant@google.com>
1761
e588ea8d
ILT
1762 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1763 when making a shared library.
1764
17652011-06-17 Ian Lance Taylor <iant@google.com>
1766
1767 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1768 parameter. Change all callers. Don't issue warning about PC32
1769 against locally defined symbol.
a29b0dad 1770
9d3b0698
ILT
17712011-06-16 Ian Lance Taylor <iant@google.com>
1772
1773 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1774 occurs in same object.
1775
85b0f90c
AM
17762011-06-14 Alan Modra <amodra@gmail.com>
1777
1778 * po/POTFILES.in: Regenerate.
1779
a94907d9
ILT
17802011-06-09 Ian Lance Taylor <iant@google.com>
1781
1782 * script-sections.cc
1783 (Orphan_output_section::set_section_addresses): For a relocatable
1784 link set address to 0.
1785
4fb3a1c3
CC
17862011-06-09 Cary Coutant <ccoutant@google.com>
1787
1788 PR gold/12804
1789 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1790 used with --compress-debug-sections.
1791 * gold/object.cc (Sized_relobj_file::do_layout): Report
1792 uncompressed size of compressed input sections.
1793
61220854
CC
17942011-06-08 Cary Coutant <ccoutant@google.com>
1795
1796 PR gold/12804
1797 * testsuite/two_file_test_2_v1.cc: Change initialization of
1798 v2 to keep it in .data.
1799
e6455dfb
CC
18002011-06-07 Cary Coutant <ccoutant@google.com>
1801
1802 * common.cc (Symbol_table::do_allocate_commons_list): Call
1803 gold_fallback.
1804 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1805 (Errors::fallback): New function.
1806 (gold_fallback): New function.
1807 * errors.h (Errors::fallback): New function.
1808 * gold.cc (gold_exit): Change status parameter to enum; adjust
1809 all callers.
1810 (queue_initial_tasks): Call gold_fallback.
1811 * gold.h: Include cstdlib.
1812 (Exit_status): New enum type.
1813 (gold_exit): Change status parameter to enum.
1814 (gold_fallback): New function.
1815 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1816 (Layout::create_symtab_sections): Likewise.
1817 (Layout::create_shdrs): Likewise.
1818 * main.cc (main): Adjust call to gold_exit.
1819 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1820 (Output_data_got::add_got_entry_pair): Likewise.
1821 (Output_section::add_input_section): Likewise.
1822 (Output_section::add_output_section_data): Likewise.
1823 (Output_segment::set_section_list_addresses): Likewise.
1824 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1825
fb0e076f
CC
18262011-06-07 Cary Coutant <ccoutant@google.com>
1827
1828 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1829 for incremental links.
1830 * output.cc (Output_segment::set_section_list_addresses): Remove
1831 FIXME and test for TLS or BSS.
1832
a5ee4d5d
CC
18332011-06-07 Cary Coutant <ccoutant@google.com>
1834
1835 * testsuite/Makefile.am: Add incremental_copy_test,
1836 incremental_common_test_1.
1837 * testsuite/Makefile.in: Regenerate.
1838 * testsuite/common_test_1_v1.c: New source file.
1839 * testsuite/common_test_1_v2.c: New source file.
1840 * testsuite/copy_test_v1.cc: New source file.
1841
5146f448
CC
18422011-06-07 Cary Coutant <ccoutant@google.com>
1843
1844 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1845 update, allocate common from bss section's free list.
1846 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1847 linker-defined symbols.
1848 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1849 Skip GOT and PLT entries that are no longer referenced.
1850 (Output_section_incremental_inputs::write_info_blocks): Mark
1851 linker-defined symbols.
1852 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1853 * output.cc (Output_section::allocate): New function.
1854 * output.h (Output_section::allocate): New function.
1855 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1856 linker-defined symbols.
1857 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1858 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1859 (Symbol::init_base_output_data): Likewise.
1860 (Symbol::init_base_output_segment): Likewise.
1861 (Symbol::init_base_constant): Likewise.
1862 (Sized_symbol::init_output_data): Likewise.
1863 (Sized_symbol::init_output_segment): Likewise.
1864 (Sized_symbol::init_constant): Likewise.
1865 (Symbol_table::do_define_in_output_data): Likewise.
1866 (Symbol_table::do_define_in_output_segment): Likewise.
1867 (Symbol_table::do_define_as_constant): Likewise.
1868 * symtab.h (Symbol::is_predefined): New function.
1869 (Symbol::init_base_output_data): Add is_predefined parameter.
1870 (Symbol::init_base_output_segment): Likewise.
1871 (Symbol::init_base_constant): Likewise.
1872 (Symbol::is_predefined_): New data member.
1873 (Sized_symbol::init_output_data): Add is_predefined parameter.
1874 (Sized_symbol::init_output_segment): Likewise.
1875 (Sized_symbol::init_constant): Likewise.
1876 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1877
26d3c67d
CC
18782011-06-07 Cary Coutant <ccoutant@google.com>
1879
1880 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1881 instead of emit_copy_reloc.
1882 (Copy_relocs::emit_copy_reloc): Refactor.
1883 (Copy_relocs::make_copy_reloc): New function.
1884 (Copy_relocs::add_copy_reloc): Remove.
1885 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1886 section.
1887 (Copy_relocs::make_copy_reloc): New function.
1888 (Copy_relocs::add_copy_reloc): Remove.
1889 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1890 unchanged input files.
1891 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1892 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1893 Reserve BSS space for COPY relocations.
1894 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1895 (Output_section_incremental_inputs::write_info_blocks): Record
1896 whether a symbol is copied from a shared object.
1897 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1898 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1899 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1900 (Incremental_input_entry_reader::get_output_symbol_index): Add
1901 is_copy parameter.
1902 (Incremental_binary::emit_copy_relocs): New function.
1903 (Incremental_binary::do_emit_copy_relocs): New function.
1904 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1905 new data member.
1906 (Sized_incremental_binary::add_copy_reloc): New function.
1907 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1908 (Sized_incremental_binary::Copy_reloc): New struct.
1909 (Sized_incremental_binary::Copy_relocs): New typedef.
1910 (Sized_incremental_binary::copy_relocs_): New data member.
1911 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1912 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1913 * target.h (Sized_target::emit_copy_reloc): New function.
1914 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1915
7cdb37d9
CC
19162011-06-02 Cary Coutant <ccoutant@google.com>
1917
1918 PR gold/12163
1919 * gold/archive.cc (Archive::Archive): Initialize new data member.
1920 (Archive::include_all_members): Return if archive has already been
1921 included.
1922 * gold/archive.h (Archive::include_all_members_): New data member.
1923
cc643b88
NC
19242011-06-02 Nick Clifton <nickc@redhat.com>
1925
1926 * dynobj.h: Fix spelling mistake in comment.
1927 * output.cc: Likewise.
1928
f62a3ca7
DK
19292011-05-31 Doug Kwan <dougkwan@google.com>
1930 Asier Llano
1931
1932 PR gold/12826
cc643b88 1933 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
1934 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1935 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1936 redundant arm_exidx_test.so.
1937 * testsuite/Makefile.in: Regenerate.
1938 (check_SCRIPTS): Add pr12826.sh
1939 (check_DATA): Add pr12826.stdout
1940 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1941 * testsuite/pr12826.sh: New file.
1942 * testsuite/pr12826_1.s: Ditto.
1943 * testsuite/pr12826_1.s: Ditto.
1944
8dbe1edc
ILT
19452011-05-30 Ian Lance Taylor <iant@google.com>
1946
1947 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1948 sections.
1949
c49875be
ILT
19502011-05-29 Ian Lance Taylor <iant@google.com>
1951
1952 PR gold/12804
1953 * testsuite/Makefile.am: Use different file name for two_file_test
1954 temporary file for each incremental test.
1955 * testsuite/Makefile.in: Rebuild.
1956
69d53f7a
ILT
19572011-05-29 Ian Lance Taylor <iant@google.com>
1958
1959 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1960 binary input file is empty.
1961
41d0ab5f
ILT
19622011-05-27 Ian Lance Taylor <iant@google.com>
1963
1964 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1965 (ver_test_9.so): Likewise.
1966 * testsuite/Makefile.in: Rebuild.
1967
89d8a36b
CC
19682011-05-26 Cary Coutant <ccoutant@google.com>
1969
1970 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1971 * incremental.cc (Incremental_inputs::report_input_section): Fix
1972 comment, indentation.
1973 (Incremental_inputs::report_comdat_group): New function.
1974 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1975 of data for incremental input file entry.
1976 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1977 group count, COMDAT group signatures.
1978 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1979 an unchanged input file.
1980 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1981 Initialize new data member.
1982 (Incremental_object_entry::add_comdat_group): New function.
1983 (Incremental_object_entry::get_comdat_group_count): New function.
1984 (Incremental_object_entry::get_comdat_signature_key): New function.
1985 (Incremental_object_entry::groups_): New data member.
1986 (Incremental_inputs::report_comdat_group): New function.
1987 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1988 data for incremental input file entry.
1989 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1990 (Incremental_input_entry_reader::get_input_section): Adjust size of
1991 data for incremental input file entry.
1992 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1993 (Incremental_input_entry_reader::get_comdat_group_signature): New
1994 function.
1995 * object.cc (Sized_relobj::include_section_group): Report kept
1996 COMDAT groups for incremental links.
1997
1706a06f
ILT
19982011-05-24 David Meyer <pdox@google.com>
1999
2000 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2001 with name parameter. Add found_name parameter.
2002 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2003 * dirsearch.h (class Dirsearch): Update declaration.
2004
a10ae760
ILT
20052011-05-24 Ian Lance Taylor <iant@google.com>
2006
2007 * archive.cc (Library_base::should_include_member): Pull in object
2008 from archive if it defines the entry symbol.
2009 * parameters.cc (Parameters::entry): New function.
2010 * parameters.h (class Parameters): Declare entry.
2011 * output.h (class Output_file_header): Remove entry_ field.
2012 * output.cc (Output_file_header::Output_file_header): Remove entry
2013 parameter. Change all callers.
2014 (Output_file_header::entry): Use parameters->entry.
2015 * gold.cc (queue_middle_tasks): Likewise.
2016 * plugin.cc (Plugin_hook::run): Likewise.
2017
aa92d6ed
CC
20182011-05-24 Cary Coutant <ccoutant@google.com>
2019
2020 * gold.cc (queue_initial_tasks): Pass incremental base filename
2021 to Output_file::open_base_file; don't print error message.
2022 * incremental-dump.cc (main): Adjust call to
2023 Output_file::open_for_modification.
2024 * incremental-dump.cc (main): Likewise.
2025 * incremental.cc (Incremental_inputs::report_command_line):
2026 Ignore --incremental-base option when comparing command lines.
2027 Ignore parameter when given as separate argument.
2028 * options.h (class General_options): Add --incremental-base.
2029 * output.cc (Output_file::Output_file):
2030 (Output_file::open_base_file): Add base_name and writable parameters;
2031 read base file into new file; print error message here.
2032 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2033 callers.
2034 * output.h (Output_file::open_for_modification): Rename to...
2035 (Output_file::open_base_file): ...this; add base_name and
2036 writable parameters; adjust all callers.
2037 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2038 callers.
2039 * testsuite/Makefile.am (incremental_test_4): Test
2040 --incremental-base.
2041 * testsuite/Makefile.in: Regenerate.
2042
2eedd706
CC
20432011-05-24 Cary Coutant <ccoutant@google.com>
2044
2045 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2046 incremental_test_4.
2047 * testsuite/Makefile.in: Regenerate.
2048 * testsuite/two_file_test_1_v1.cc: New test source file.
2049 * testsuite/two_file_test_1b_v1.cc: New test source file.
2050 * testsuite/two_file_test_2_v1.cc: New test source file.
2051
0f1c85a6
CC
20522011-05-24 Cary Coutant <ccoutant@google.com>
2053
2054 * dynobj.h (Dynobj::do_dynobj): New function.
2055 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2056 flag and soname for shared objects.
2057 * incremental.cc (Incremental_inputs::report_object): Make
2058 either Incremental_object_entry or Incremental_dynobj_entry; add
2059 soname to string table.
2060 (Incremental_inputs::report_input_section): Add assertion.
2061 (Output_section_incremental_inputs::set_final_data_size): Adjust
2062 type of input file entry for shared libraries; adjust size of
2063 shared library info entry.
2064 (Output_section_incremental_inputs::write_input_files): Write
2065 as_needed flag for shared libraries.
2066 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2067 of input file entry for shared libraries; write soname.
2068 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2069 soname from incremental info.
2070 * incremental.h (enum Incremental_input_flags): Add
2071 INCREMENTAL_INPUT_AS_NEEDED.
2072 (Incremental_input_entry::Incremental_input_entry): Initialize new
2073 data member.
2074 (Incremental_input_entry::set_as_needed): New function.
2075 (Incremental_input_entry::as_needed): New function.
2076 (Incremental_input_entry::do_dynobj_entry): New function.
2077 (Incremental_input_entry::as_needed_): New data member.
2078 (Incremental_object_entry::Incremental_object_entry): Don't check
2079 for shared library.
2080 (Incremental_object_entry::do_type): Likewise.
2081 (class Incremental_dynobj_entry): New class.
2082 (Incremental_input_entry_reader::as_needed): New function.
2083 (Incremental_input_entry_reader::get_soname): New function.
2084 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2085 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2086 size of shared library info entry.
58797674 2087 * layout.cc (Layout::finish_dynamic_section): Don't test for
0f1c85a6
CC
2088 incremental link when adding DT_NEEDED entries.
2089 * object.h (Object::Object): Initialize new data member.
2090 (Object::dynobj): New function.
2091 (Object::set_as_needed): New function.
2092 (Object::as_needed): New function.
2093 (Object::do_dynobj): New function.
2094 (Object::as_needed_): New data member.
2095
6fa2a40b
CC
20962011-05-24 Cary Coutant <ccoutant@google.com>
2097
2098 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2099 info; adjust display of GOT entries.
2100 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2101 vector of input objects; remove file_status_.
2102 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2103 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2104 got_plt reader; call target hooks to reserve GOT entries.
2105 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2106 of input file info header and GOT info entry.
2107 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2108 relocation info.
2109 (Got_plt_view_info::got_descriptor): Remove.
2110 (Got_plt_view_info::sym_index): New data member.
2111 (Got_plt_view_info::input_index): New data member.
2112 (Local_got_offset_visitor::visit): Write input file index.
2113 (Global_got_offset_visitor::visit): Write 0 for input file index.
2114 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2115 with sym_index and input_index.
2116 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2117 incremental info GOT entry; replace got_descriptor with input_index.
2118 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2119 map from input file index to object.
2120 (Sized_relobj_incr::do_layout): Replace direct data member reference
2121 with accessor function.
2122 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2123 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2124 Adjust size of input file info header.
2125 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2126 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2127 (Incremental_input_entry_reader::get_input_section): Adjust size of
2128 input file info header.
2129 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2130 of incremental info GOT entry.
2131 (Incremental_got_plt_reader::get_got_desc): Remove.
2132 (Incremental_got_plt_reader::get_got_symndx): New function.
2133 (Incremental_got_plt_reader::get_got_input_index): New function.
2134 (Sized_incremental_binary::Sized_incremental_binary): Remove
2135 file_status_; add input_objects_.
2136 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2137 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2138 (Sized_incremental_binary::file_is_unchanged): Remove.
2139 (Sized_incremental_binary::set_input_object): New function.
2140 (Sized_incremental_binary::input_object): New function.
2141 (Sized_incremental_binary::file_status_): Remove.
2142 (Sized_incremental_binary::input_objects_): New data member.
2143 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2144 references.
2145 (Sized_relobj_incr::invalid_address): Move to base class.
2146 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2147 class.
2148 (Sized_relobj_incr::do_output_section_offset): Likewise.
2149 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2150 (Sized_relobj_incr::section_offsets_): Likewise.
2151 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2152 function.
2153 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2154 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2155 with accessor function.
2156 (Sized_relobj_file::do_layout): Likewise.
2157 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2158 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2159 (Sized_relobj_file::compute_final_local_value): Replace refs to
2160 section_offsets_ with accessor function.
2161 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2162 * object.h (Relobj::Relobj): Initialize new data members.
2163 (Relobj::add_dyn_reloc): New function.
2164 (Relobj::first_dyn_reloc): New function.
2165 (Relobj::dyn_reloc_count): New function.
2166 (Relobj::first_dyn_reloc_): New data member.
2167 (Relobj::dyn_reloc_count_): New data member.
2168 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2169 references.
2170 (Sized_relobj::Address): New typedef.
2171 (Sized_relobj::invalid_address): Move here from child class.
2172 (Sized_relobj::Sized_relobj): Initialize new data members.
2173 (Sized_relobj::sized_relobj): New function.
2174 (Sized_relobj::is_output_section_offset_invalid): Move here from
2175 child class.
2176 (Sized_relobj::get_output_section_offset): Likewise.
2177 (Sized_relobj::local_has_got_offset): Likewise.
2178 (Sized_relobj::local_got_offset): Likewise.
2179 (Sized_relobj::set_local_got_offset): Likewise.
2180 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2181 (Sized_relobj::clear_got_offsets): New function.
2182 (Sized_relobj::section_offsets): Move here from child class.
2183 (Sized_relobj::do_output_section_offset): Likewise.
2184 (Sized_relobj::do_set_section_offset): Likewise.
2185 (Sized_relobj::Local_got_offsets): Likewise.
2186 (Sized_relobj::local_got_offsets_): Likewise.
2187 (Sized_relobj::section_offsets_): Likewise.
2188 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2189 references.
2190 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2191 class.
2192 (Sized_relobj_file::sized_relobj): New function
2193 (Sized_relobj_file::local_has_got_offset): Move to base class.
2194 (Sized_relobj_file::local_got_offset): Likewise.
2195 (Sized_relobj_file::set_local_got_offset): Likewise.
2196 (Sized_relobj_file::get_output_section_offset): Likewise.
2197 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2198 (Sized_relobj_file::do_output_section_offset): Likewise.
2199 (Sized_relobj_file::do_set_section_offset): Likewise.
2200 (Sized_relobj_file::Local_got_offsets): Likewise.
2201 (Sized_relobj_file::local_got_offsets_): Likewise.
2202 (Sized_relobj_file::section_offsets_): Likewise.
2203 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2204 (all constructors).
2205 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2206 (Output_reloc::get_symbol_index): Likewise.
2207 (Output_reloc::local_section_offset): Likewise.
2208 (Output_reloc::get_address): Likewise.
2209 (Output_reloc::symbol_value): Likewise.
2210 (Output_data_got::reserve_slot): Move to class definition.
2211 (Output_data_got::reserve_local): New function.
2212 (Output_data_got::reserve_slot_for_global): Remove.
2213 (Output_data_got::reserve_global): New function.
2214 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2215 (all constructors, two instantiations).
2216 (Output_reloc::get_relobj): New function (two instantiations).
2217 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2218 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2219 (Output_data_reloc::add_global): Adjust type of relobj.
2220 (Output_data_reloc::add_global_relative): Likewise.
2221 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2222 (Output_data_reloc::add_local): Likewise.
2223 (Output_data_reloc::add_local_relative): Likewise.
2224 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2225 (Output_data_reloc::add_local_section): Likewise.
2226 (Output_data_reloc::add_output_section): Likewise.
2227 (Output_data_reloc::add_absolute): Likewise.
2228 (Output_data_reloc::add_target_specific): Likewise.
2229 (Output_data_got::reserve_slot): Move definition here.
2230 (Output_data_got::reserve_local): New function.
2231 (Output_data_got::reserve_global): New function.
2232 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2233 section_offsets_ with accessor function.
2234 (Sized_relobj_file::write_sections): Likewise.
2235 (Sized_relobj_file::do_relocate_sections): Likewise.
2236 * target.h (Sized_target::reserve_local_got_entry): New function.
2237 (Sized_target::reserve_global_got_entry): New function.
2238 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2239 (Target_x86_64::reserve_global_got_entry): New function.
2240 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2241
4829d394
CC
22422011-05-23 Cary Coutant <ccoutant@google.com>
2243
2244 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2245 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2246 bit when checking got_type.
2247 * incremental.cc (Sized_incremental_binary::setup_readers):
2248 Store symbol table and string table locations; initialize bit vector
2249 of file status flags.
2250 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2251 unchanged files.
2252 (Sized_incremental_binary::do_process_got_plt): New function.
2253 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2254 (Output_section_incremental_inputs::set_final_data_size): Record
2255 file index for each input file.
2256 (Output_section_incremental_inputs::write_got_plt): Store file index
2257 instead of input entry offset for each GOT entry.
2258 * incremental.h
2259 (Incremental_input_entry::Incremental_input_entry): Initialize new
2260 data member.
2261 (Incremental_input_entry::set_offset): Store file index.
2262 (Incremental_input_entry::get_file_index): New function.
2263 (Incremental_input_entry::file_index_): New data member.
2264 (Incremental_binary::process_got_plt): New function.
2265 (Incremental_binary::do_process_got_plt): New function.
2266 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2267 data members.
2268 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2269 (Sized_incremental_binary::set_file_is_unchanged): New function.
2270 (Sized_incremental_binary::file_is_unchanged): New function.
2271 (Sized_incremental_binary::do_process_got_plt): New function.
2272 (Sized_incremental_binary::file_status_): New data member.
2273 (Sized_incremental_binary::main_symtab_loc_): New data member.
2274 (Sized_incremental_binary::main_strtab_loc_): New data member.
2275 * output.cc (Output_data_got::Got_entry::write): Add case
2276 RESERVED_CODE.
2277 (Output_data_got::add_global): Call add_got_entry.
2278 (Output_data_got::add_global_plt): Likewise.
2279 (Output_data_got::add_global_with_rel): Likewise.
2280 (Output_data_got::add_global_with_rela): Likewise.
2281 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2282 (Output_data_got::add_global_pair_with_rela): Likewise.
2283 (Output_data_got::add_local): Call add_got_entry.
2284 (Output_data_got::add_local_plt): Likewise.
2285 (Output_data_got::add_local_with_rel): Likewise.
2286 (Output_data_got::add_local_with_rela): Likewise.
2287 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2288 (Output_data_got::add_local_pair_with_rela): Likewise.
2289 (Output_data_got::reserve_slot): New function.
2290 (Output_data_got::reserve_slot_for_global): New function.
2291 (Output_data_got::add_got_entry): New function.
2292 (Output_data_got::add_got_entry_pair): New function.
2293 (Output_section::add_output_section_data): Edit FIXME.
2294 * output.h
2295 (Output_section_data_build::Output_section_data_build): New
2296 constructor with size parameter.
2297 (Output_data_space::Output_data_space): Likewise.
2298 (Output_data_got::Output_data_got): Initialize new data member; new
2299 constructor with size parameter.
2300 (Output_data_got::add_constant): Call add_got_entry.
2301 (Output_data_got::reserve_slot): New function.
2302 (Output_data_got::reserve_slot_for_global): New function.
2303 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2304 (Output_data_got::add_got_entry): New function.
2305 (Output_data_got::add_got_entry_pair): New function.
2306 (Output_data_got::free_list_): New data member.
2307 * target.h (Sized_target::init_got_plt_for_update): New function.
2308 (Sized_target::register_global_plt_entry): New function.
2309 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2310 Initialize new data member; call init; add constructor with PLT count.
2311 (Output_data_plt_x86_64::init): New function.
2312 (Output_data_plt_x86_64::add_relocation): New function.
2313 (Output_data_plt_x86_64::reserve_slot): New function.
2314 (Output_data_plt_x86_64::free_list_): New data member.
2315 (Target_x86_64::init_got_plt_for_update): New function.
2316 (Target_x86_64::register_global_plt_entry): New function.
2317 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2318 incremental updates.
2319 (Output_data_plt_x86_64::add_relocation): New function.
2320 * testsuite/object_unittest.cc (Object_test): Set default options.
2321
ec69d6da
ILT
23222011-05-16 Ian Lance Taylor <iant@google.com>
2323
2324 * options.h (class General_options): Make -i a synonym for -r.
2325
732e31de
ILT
23262011-05-16 Ian Lance Taylor <iant@google.com>
2327
2328 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2329
403676b5
CC
23302011-05-10 Cary Coutant <ccoutant@google.com>
2331
2332 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2333 strip_all (-s).
2334
5b7b7d6e
ILT
23352011-05-06 Ian Lance Taylor <iant@google.com>
2336
2337 * layout.cc (Layout::layout): If the output section flags change,
2338 update the ordering.
2339
f0f9babf
CC
23402011-04-25 Cary Coutant <ccoutant@google.com>
2341
2342 * incremental-dump.cc (dump_incremental_inputs): Print local
2343 symbol info for each input file.
2344 * incremental.cc
2345 (Output_section_incremental_inputs::set_final_data_size): Add local
2346 symbol info to input file entries in incremental info.
2347 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2348 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2349 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2350 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2351 implementation.
2352 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2353 (Sized_incr_relobj::do_relocate): Write the local symbols.
2354 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2355 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2356 Adjust size of input file header.
2357 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2358 (Incremental_inputs_reader::get_local_symbol_count): New function.
2359 (Incremental_inputs_reader::get_input_section): Adjust size of input
2360 file header.
2361 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2362 (Sized_incr_relobj::This): New typedef.
2363 (Sized_incr_relobj::sym_size): New const data member.
2364 (Sized_incr_relobj::Local_symbol): New struct.
2365 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2366 (Sized_incr_relobj::do_local_symbol_offset): New function.
2367 (Sized_incr_relobj::local_symbol_count_): New data member.
2368 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2369 (Sized_incr_relobj::local_symbol_index_): New data member.
2370 (Sized_incr_relobj::local_symbol_offset_): New data member.
2371 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2372 (Sized_incr_relobj::local_symbols_): New data member.
2373 * object.h (Relobj::output_local_symbol_count): New function.
2374 (Relobj::local_symbol_offset): New function.
2375 (Relobj::do_output_local_symbol_count): New function.
2376 (Relobj::do_local_symbol_offset): New function.
2377 (Sized_relobj::do_output_local_symbol_count): New function.
2378 (Sized_relobj::do_local_symbol_offset): New function.
2379
d0a9ace3
ILT
23802011-04-22 Vladimir Simonov <sv@sw.ru>
2381
2382 * descriptors.cc (set_close_on_exec): New function.
2383 (Descriptors::open): Use set_close_on_exec.
2384 * output.cc (S_ISLNK): Define if not defined.
2385
94a3fc8b
CC
23862011-04-22 Cary Coutant <ccoutant@google.com>
2387
2388 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2389 global symbol map.
2390 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2391 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2392 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2393 relocations.
2394 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2395 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2396 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2397 * incremental.h
2398 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2399 function.
2400 (Incremental_binary::apply_incremental_relocs): New function.
2401 (Incremental_binary::do_apply_incremental_relocs): New function.
2402 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2403 data member.
2404 (Sized_incremental_binary::add_global_symbol): New function.
2405 (Sized_incremental_binary::global_symbol): New function.
2406 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2407 (Sized_incremental_binary::symbol_map_): New data member.
2408 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2409 * target.h (Sized_target::apply_relocation): New function.
2410 * target-reloc.h (apply_relocation): New function.
2411 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2412
c87e4302
DK
24132011-04-22 Doug Kwan <dougkwan@google.com>
2414
2415 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2416 flag of a SHT_ARM_EXIDX section.
2417 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2418 * testsuite/Makefile.in: Regenerate.
2419 * testsuite/arm_exidx_test.s: New file.
2420 * testsuite/arm_exidx_test.sh: Same.
2421
e7782cf6
CC
24222011-04-20 Cary Coutant <ccoutant@google.com>
2423
2424 PR gold/12689
2425 * archive.h (Incremental_archive_entry::Archive_member):
2426 Initialize arg_serial_ (second constructor).
2427
308ecdc7
ILT
24282011-04-17 Ian Lance Taylor <iant@google.com>
2429
2430 * object.cc (Relocate_info::location): Simplify location string.
2431 * errors.cc (Errors::error_at_location): Don't print program
2432 name.
2433 (Errors::warning_at_location): Likewise.
2434 (Errors::undefined_symbol): Likewise.
2435 * testsuite/debug_msg.sh: Update accordingly.
2436
bec5b579
CC
24372011-04-14 Cary Coutant <ccoutant@google.com>
2438
2439 * gold/layout.cc (Layout::symtab_section_offset): New function.
2440 * gold/layout.h (Layout::symtab_section_offset): New function.
2441 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2442
88597d34
ILT
24432011-04-12 Ian Lance Taylor <iant@google.com>
2444
2445 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2446 with MREMAP_MAYMOVE.
2447 * output.h (class Output_file): Add map_is_allocated_ field.
2448 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2449 not available, provide stubs. If mremap is not available, #define
2450 it to gold_mremap.
2451 (MREMAP_MAYMOVE): Define if not defined.
2452 (Output_file::Output_file): Initialize map_is_allocated_.
2453 (Output_file::resize): Check map_is_allocated_.
2454 (Output_file::map_anonymous): If mmap fails, use malloc.
2455 (Output_file::unmap): Don't do anything for an anonymous map.
2456 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2457 is not available, provide stubs.
2458 (File_read::View::~View): Use free rather than delete[].
2459 (File_read::make_view): Use malloc rather than new[]. If mmap
2460 fails, use malloc.
2461 (File_read::find_or_make_view): Use malloc rather than new[].
2462 * gold.h: Remove HAVE_REMAP code.
2463 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2464 exists. Rename mremap to gold_mremap. If mmap is not available
2465 don't do anything.
2466 * configure, config.in: Rebuild.
2467
11e361bc
ILT
24682011-04-11 Ian Lance Taylor <iant@google.com>
2469
2470 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2471 initialize local variable v.
2472
cdc29364
CC
24732011-04-11 Cary Coutant <ccoutant@google.com>
2474
2475 * archive.cc (Archive::include_member): Adjust call to
2476 report_object.
2477 (Add_archive_symbols::run): Track argument serial numbers.
2478 (Lib_group::include_member): Likewise.
2479 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2480 * archive.h (Incremental_archive_entry::Archive_member):
2481 Initialize arg_serial_.
2482 (Archive_member::arg_serial_): New data member.
2483 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2484 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2485 incremental link.
2486 (Sized_dynobj::do_for_all_local_got_entries): New function.
2487 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2488 function.
2489 * fileread.cc (get_mtime): New function.
2490 * fileread.h (get_mtime): New function.
2491 * gold.cc (queue_initial_tasks): Check for incremental update.
2492 (process_incremental_input): New function.
2493 (queue_middle_tasks): Don't force valid target for incremental
2494 update.
2495 * incremental-dump.cc (find_input_containing_global): Adjust
2496 size of symbol info entry.
2497 (dump_incremental_inputs): Dump argument serial number and
2498 in_system_directory flag; bias shndx by 1; print symbol names
2499 when dumping per-file symbol lists; use new symbol info readers.
2500 * incremental.cc
2501 (Output_section_incremental_inputs:update_data_size): New function.
2502 (Sized_incremental_binary::setup_readers): Setup input readers
2503 for each input file; build maps for files added from libraries
2504 and scripts.
2505 (Sized_incremental_binary::check_input_args): New function.
2506 (Sized_incremental_binary::do_check_inputs): Build map of argument
2507 serial numbers to input arguments.
2508 (Sized_incremental_binary::do_file_has_changed): Rename
2509 do_file_is_unchanged to this; compare file modification times.
2510 (Sized_incremental_binary::do_init_layout): New function.
2511 (Sized_incremental_binary::do_reserve_layout): New function.
2512 (Sized_incremental_binary::do_get_input_reader): Remove.
2513 (Sized_incremental_binary::get_symtab_view): New function.
2514 (Incremental_checker::can_incrementally_link_output_file): Remove.
2515 (Incremental_inputs::report_command_line): Exclude --debug options.
2516 (Incremental_inputs::report_archive_begin): Add parameter; track
2517 argument serial numbers; don't put input file entry for archive
2518 before archive members.
2519 (Incremental_inputs::report_archive_end): Put input file entry
2520 for archive after archive members.
2521 (Incremental_inputs::report_object): Add parameter; track argument
2522 serial numbers and in_system_directory flag.
2523 (Incremental_inputs::report_script): Add parameter; track argument
2524 serial numbers.
2525 (Output_section_incremental_inputs::set_final_data_size): Adjust
2526 size of symbol info entry; check for forwarding symbols.
2527 (Output_section_incremental_inputs::write_input_files): Write
2528 in_system_directory flag and argument serial number.
2529 (Output_section_incremental_inputs::write_info_blocks): Map section
2530 indices between incremental info and original input file; store
2531 input section index for each symbol.
2532 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2533 change operator() to visit().
2534 (class Global_got_offset_visitor): Likewise.
2535 (class Global_symbol_visitor_got_plt):
2536 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2537 classes.
2538 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2539 (Sized_incr_relobj::do_read_symbols): New function.
2540 (Sized_incr_relobj::do_layout): New function.
2541 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2542 (Sized_incr_relobj::do_add_symbols): New function.
2543 (Sized_incr_relobj::do_should_include_member): New function.
2544 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2545 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2546 (Sized_incr_relobj::do_section_size): New function.
2547 (Sized_incr_relobj::do_section_name): New function.
2548 (Sized_incr_relobj::do_section_contents): New function.
2549 (Sized_incr_relobj::do_section_flags): New function.
2550 (Sized_incr_relobj::do_section_entsize): New function.
2551 (Sized_incr_relobj::do_section_address): New function.
2552 (Sized_incr_relobj::do_section_type): New function.
2553 (Sized_incr_relobj::do_section_link): New function.
2554 (Sized_incr_relobj::do_section_info): New function.
2555 (Sized_incr_relobj::do_section_addralign): New function.
2556 (Sized_incr_relobj::do_initialize_xindex): New function.
2557 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2558 (Sized_incr_relobj::do_read_relocs): New function.
2559 (Sized_incr_relobj::do_gc_process_relocs): New function.
2560 (Sized_incr_relobj::do_scan_relocs): New function.
2561 (Sized_incr_relobj::do_count_local_symbols): New function.
2562 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2563 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2564 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2565 (Sized_incr_relobj::do_relocate): New function.
2566 (Sized_incr_relobj::do_set_section_offset): New function.
2567 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2568 (Sized_incr_dynobj::do_read_symbols): New function.
2569 (Sized_incr_dynobj::do_layout): New function.
2570 (Sized_incr_dynobj::do_add_symbols): New function.
2571 (Sized_incr_dynobj::do_should_include_member): New function.
2572 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2573 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2574 (Sized_incr_dynobj::do_section_size): New function.
2575 (Sized_incr_dynobj::do_section_name): New function.
2576 (Sized_incr_dynobj::do_section_contents): New function.
2577 (Sized_incr_dynobj::do_section_flags): New function.
2578 (Sized_incr_dynobj::do_section_entsize): New function.
2579 (Sized_incr_dynobj::do_section_address): New function.
2580 (Sized_incr_dynobj::do_section_type): New function.
2581 (Sized_incr_dynobj::do_section_link): New function.
2582 (Sized_incr_dynobj::do_section_info): New function.
2583 (Sized_incr_dynobj::do_section_addralign): New function.
2584 (Sized_incr_dynobj::do_initialize_xindex): New function.
2585 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2586 (make_sized_incremental_object): New function.
2587 (Incremental_library::copy_unused_symbols): New function.
2588 (Incremental_library::do_for_all_unused_symbols): New function.
2589 * incremental.h (enum Incremental_input_flags): New type.
2590 (class Incremental_checker): Remove.
2591 (Incremental_input_entry::Incremental_input_entry): Add argument
2592 serial number.
2593 (Incremental_input_entry::arg_serial): New function.
2594 (Incremental_input_entry::set_is_in_system_directory): New function.
2595 (Incremental_input_entry::is_in_system_directory): New function.
2596 (Incremental_input_entry::arg_serial_): New data member.
2597 (Incremental_input_entry::is_in_system_directory_): New data member.
2598 (class Script_info): Move here from script.h.
2599 (Script_info::Script_info): Add filename parameter.
2600 (Script_info::filename): New function.
2601 (Script_info::filename_): New data member.
2602 (Incremental_script_entry::Incremental_script_entry): Add argument
2603 serial number.
2604 (Incremental_object_entry::Incremental_object_entry): Likewise.
2605 (Incremental_object_entry::add_input_section): Build list of input
2606 sections with map to original shndx.
2607 (Incremental_object_entry::get_input_section_index): New function.
2608 (Incremental_object_entry::shndx_): New data member.
2609 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2610 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2611 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2612 serial number.
2613 (Incremental_inputs::report_archive_begin): Likewise.
2614 (Incremental_inputs::report_object): Likewise.
2615 (Incremental_inputs::report_script): Likewise.
2616 (class Incremental_global_symbol_reader): New class.
2617 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2618 and store flags and input file type.
2619 (Incremental_input_entry_reader::arg_serial): New function.
2620 (Incremental_input_entry_reader::type): Extract type from flags.
2621 (Incremental_input_entry_reader::is_in_system_directory): New function.
2622 (Incremental_input_entry_reader::get_input_section_count): Call
2623 accessor function for type.
2624 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2625 function for type; adjust size of global symbol entry.
2626 (Incremental_input_entry_reader::get_global_symbol_count): Call
2627 accessor function for type.
2628 (Incremental_input_entry_reader::get_object_count): Likewise.
2629 (Incremental_input_entry_reader::get_object_offset): Likewise.
2630 (Incremental_input_entry_reader::get_member_count): Likewise.
2631 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2632 (Incremental_input_entry_reader::get_member_offset): Likewise.
2633 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2634 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2635 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2636 (Incremental_input_entry_reader::get_global_symbol_reader): New
2637 function.
2638 (Incremental_input_entry_reader::get_output_symbol_index): New
2639 function.
2640 (Incremental_input_entry_reader::type_): Remove.
2641 (Incremental_input_entry_reader::flags_): New data member.
2642 (Incremental_inputs_reader::input_file_offset): New function.
2643 (Incremental_inputs_reader::input_file_index): New function.
2644 (Incremental_inputs_reader::input_file): Call input_file_offset.
2645 (Incremental_inputs_reader::input_file_at_offset): New function.
2646 (Incremental_relocs_reader::get_r_type): Reformat.
2647 (Incremental_relocs_reader::get_r_shndx): Reformat.
2648 (Incremental_relocs_reader::get_r_offset): Reformat.
2649 (Incremental_relocs_reader::data): New function.
2650 (Incremental_binary::Incremental_binary): Initialize new data members.
2651 (Incremental_binary::check_inputs): Add cmdline parameter.
2652 (Incremental_binary::file_is_unchanged): Remove.
2653 (Input_reader::arg_serial): New function.
2654 (Input_reader::get_unused_symbol_count): New function.
2655 (Input_reader::get_unused_symbol): New function.
2656 (Input_reader::do_arg_serial): New function.
2657 (Input_reader::do_get_unused_symbol_count): New function.
2658 (Input_reader::do_get_unused_symbol): New function.
2659 (Incremental_binary::input_file_count): New function.
2660 (Incremental_binary::get_input_reader): Change signature to use
2661 index instead of filename.
2662 (Incremental_binary::file_has_changed): New function.
2663 (Incremental_binary::get_input_argument): New function.
2664 (Incremental_binary::get_library): New function.
2665 (Incremental_binary::get_script_info): New function.
2666 (Incremental_binary::init_layout): New function.
2667 (Incremental_binary::reserve_layout): New function.
2668 (Incremental_binary::output_file): New function.
2669 (Incremental_binary::do_check_inputs): New function.
2670 (Incremental_binary::do_file_is_unchanged): Remove.
2671 (Incremental_binary::do_file_has_changed): New function.
2672 (Incremental_binary::do_init_layout): New function.
2673 (Incremental_binary::do_reserve_layout): New function.
2674 (Incremental_binary::do_input_file_count): New function.
2675 (Incremental_binary::do_get_input_reader): Change signature.
2676 (Incremental_binary::input_args_map_): New data member.
2677 (Incremental_binary::library_map_): New data member.
2678 (Incremental_binary::script_map_): New data member.
2679 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2680 new data members.
2681 (Sized_incremental_binary::output_section): New function.
2682 (Sized_incremental_binary::inputs_reader): Add const.
2683 (Sized_incremental_binary::symtab_reader): Add const.
2684 (Sized_incremental_binary::relocs_reader): Add const.
2685 (Sized_incremental_binary::got_plt_reader): Add const.
2686 (Sized_incremental_binary::get_symtab_view): New function.
2687 (Sized_incremental_binary::Inputs_reader): New typedef.
2688 (Sized_incremental_binary::Input_entry_reader): New typedef.
2689 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2690 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2691 (Sized_incremental_binary::do_file_has_changed): New function.
2692 (Sized_incremental_binary::do_init_layout): New function.
2693 (Sized_incremental_binary::do_reserve_layout): New function.
2694 (Sized_input_reader::Inputs_reader): Remove.
2695 (Sized_input_reader::Input_entry_reader): Remove.
2696 (Sized_input_reader::do_arg_serial): New function.
2697 (Sized_input_reader::do_get_unused_symbol_count): New function.
2698 (Sized_input_reader::do_get_unused_symbol): New function.
2699 (Sized_incremental_binary::do_input_file_count): New function.
2700 (Sized_incremental_binary::do_get_input_reader): Change signature;
2701 use index instead of filename.
2702 (Sized_incremental_binary::section_map_): New data member.
2703 (Sized_incremental_binary::input_entry_readers_): New data member.
2704 (class Sized_incr_relobj): New class.
2705 (class Sized_incr_dynobj): New class.
2706 (make_sized_incremental_object): New function.
2707 (class Incremental_library): New class.
2708 * layout.cc (Free_list::num_lists): New static data member.
2709 (Free_list::num_nodes): New static data member.
2710 (Free_list::num_removes): New static data member.
2711 (Free_list::num_remove_visits): New static data member.
2712 (Free_list::num_allocates): New static data member.
2713 (Free_list::num_allocate_visits): New static data member.
2714 (Free_list::init): New function.
2715 (Free_list::remove): New function.
2716 (Free_list::allocate): New function.
2717 (Free_list::dump): New function.
2718 (Free_list::print_stats): New function.
2719 (Layout_task_runner::run): Resize output file for incremental updates.
2720 (Layout::Layout): Initialize new data members.
2721 (Layout::set_incremental_base): New function.
2722 (Layout::init_fixed_output_section): New function.
2723 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2724 incremental updates.
2725 (Layout::create_gold_note): Do not create gold note section for
2726 incremental updates.
2727 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2728 for incremental updates.
2729 (Layout::set_section_offsets): For incremental updates, allocate space
2730 from free list.
2731 (Layout::create_symtab_sections): Layout with offsets relative to
2732 start of section; for incremental updates, allocate space from free
2733 list.
2734 (Layout::create_shdrs): For incremental updates, allocate space from
2735 free list.
2736 (Layout::finish_dynamic_section): For incremental updates, do not
2737 check --as-needed (fixed in subsequent patch).
2738 * layout.h (class Free_list): New class.
2739 (Layout::set_incremental_base): New function.
2740 (Layout::incremental_base): New function.
2741 (Layout::init_fixed_output_section): New function.
2742 (Layout::allocate): New function.
2743 (Layout::incremental_base_): New data member.
2744 (Layout::free_list_): New data member.
2745 * main.cc (main): Print Free_list statistics.
2746 * object.cc (Relobj::finalize_incremental_relocs): Add
2747 clear_counts parameter; clear counts only when clear_counts is set.
2748 (Sized_relobj::Sized_relobj): Initialize new base class.
2749 (Sized_relobj::do_layout): Don't report special sections.
2750 (Sized_relobj::do_for_all_local_got_entries): New function.
2751 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2752 symtab_off to all symbol table offsets.
2753 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2754 * object.h (class Got_offset_list): Move to top of file.
2755 (Object::Object): Allow case where input_file == NULL.
2756 (Object::~Object): Likewise.
2757 (Object::input_file): Assert that input_file != NULL.
2758 (Object::lock): Allow case where input_file == NULL.
2759 (Object::unlock): Likewise.
2760 (Object::is_locked): Likewise.
2761 (Object::token): Likewise.
2762 (Object::release): Likewise.
2763 (Object::is_incremental): New function.
2764 (Object::get_mtime): New function.
2765 (Object::for_all_local_got_entries): New function.
2766 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2767 (Object::set_is_in_system_directory): New function.
2768 (Object::is_in_system_directory): New function.
2769 (Object::do_is_incremental): New function.
2770 (Object::do_get_mtime): New function.
2771 (Object::do_for_all_local_got_entries): New function.
2772 (Object::is_in_system_directory_): New data member.
2773 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2774 (class Sized_relobj_base): New class.
2775 (class Sized_relobj): Derive from Sized_relobj_base.
2776 (class Sized_relobj::Symbols): Redeclare from base class.
2777 (class Sized_relobj::local_got_offset_list): Remove.
2778 (class Sized_relobj::Output_sections): Redeclare from base class.
2779 (class Sized_relobj::do_for_all_local_got_entries): New function.
2780 (class Sized_relobj::write_local_symbols): Add offset parameter.
2781 (class Sized_relobj::local_symbol_offset_): Update comment.
2782 (class Sized_relobj::local_dynsym_offset_): Update comment.
2783 * options.cc (Input_arguments::add_file): Remove const.
2784 * options.h (Input_file_argument::Input_file_argument):
2785 Initialize arg_serial_ (all constructors).
2786 (Input_file_argument::set_arg_serial): New function.
2787 (Input_file_argument::arg_serial): New function.
2788 (Input_file_argument::arg_serial_): New data member.
2789 (Input_arguments::Input_arguments): Initialize file_count_.
2790 (Input_arguments::add_file): Remove const.
2791 (Input_arguments::number_of_input_files): New function.
2792 (Input_arguments::file_count_): New data member.
2793 (Command_line::number_of_input_files): Call
2794 Input_arguments::number_of_input_files.
2795 * output.cc (Output_segment_headers::Output_segment_headers):
2796 Set current size.
2797 (Output_section::Input_section::current_data_size): New function.
2798 (Output_section::Output_section): Initialize new data members.
2799 (Output_section::add_input_section): Don't do merge sections for
2800 an incremental link; allocate space from free list for an
2801 incremental update.
2802 (Output_section::add_output_section_data): Allocate space from
2803 free list for an incremental update.
2804 (Output_section::update_data_size): New function.
2805 (Output_section::set_fixed_layout): New function.
2806 (Output_section::reserve): New function.
2807 (Output_segment::set_section_addresses): Remove const.
2808 (Output_segment::set_section_list_addresses): Remove const; allocate
2809 space from free list for an incremental update.
2810 (Output_segment::set_offset): Adjust size of RELRO segment for an
2811 incremental update.
2812 * output.h (Output_data::current_data_size): Move here from
2813 child classes.
2814 (Output_data::pre_finalize_data_size): New function.
2815 (Output_data::update_data_size): New function.
2816 (Output_section_headers::update_data_size): new function.
2817 (Output_section_data_build::current_data_size): Move to Output_data.
2818 (Output_data_strtab::update_data_size): New function.
2819 (Output_section::current_data_size): Move to Output_data.
2820 (Output_section::set_fixed_layout): New function.
2821 (Output_section::has_fixed_layout): New function.
2822 (Output_section::reserve): New function.
2823 (Output_section::update_data_size): New function.
2824 (Output_section::has_fixed_layout_): New data member.
2825 (Output_section::free_list_): New data member.
2826 (Output_segment::set_section_addresses): Remove const.
2827 (Output_segment::set_section_list_addresses): Remove const.
2828 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2829 New function.
2830 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2831 New function.
2832 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2833 parameter when calling Add_symbols constructor; store argument
2834 serial number for members of a lib group.
2835 (Add_symbols::locks): Allow case where token == NULL.
2836 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2837 (Read_member::~Read_member): New function.
2838 (Read_member::is_runnable): New function.
2839 (Read_member::locks): New function.
2840 (Read_member::run): New function.
2841 (Check_script::~Check_script): New function.
2842 (Check_script::is_runnable): New function.
2843 (Check_script::locks): New function.
2844 (Check_script::run): New function.
2845 (Check_library::~Check_library): New function.
2846 (Check_library::is_runnable): New function.
2847 (Check_library::locks): New function.
2848 (Check_library::run): New function.
2849 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2850 (Add_symbols::library_): New data member.
2851 (class Read_member): New class.
2852 (class Check_script): New class.
2853 (class Check_library): New class.
2854 * reloc.cc (Read_relocs::is_runnable): Allow case where
2855 token == NULL.
2856 (Read_relocs::locks): Likewise.
2857 (Scan_relocs::locks): Likewise.
2858 (Relocate_task::locks): Likewise.
2859 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2860 to clear counters.
2861 (Sized_relobj::incremental_relocs_scan): Fix comment.
2862 (Sized_relobj::do_relocate): Pass output file offset to
2863 write_local_symbols.
2864 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2865 from class declaration.
2866 * script.cc (read_input_script): Allocate Script_info; pass
2867 argument serial number to report_script.
2868 * script.h (class Script_info): Move to incremental.h.
2869 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2870 * symtab.h (Symbol_table::add_from_incrobj): New function.
2871 (Symbol_table::set_file_offset): New function.
2872
b961d0d7
CC
28732011-04-05 Cary Coutant <ccoutant@google.com>
2874
2875 * incremental-dump.cc (dump_incremental_inputs): Change signature
2876 to take a Sized_incremental_binary; change caller. Use readers
2877 in Sized_incremental_binary.
2878 * incremental.cc
2879 (Sized_incremental_binary::find_incremental_inputs_sections):
2880 Rename do_find_incremental_inputs_sections to this.
2881 (Sized_incremental_binary::setup_readers): New function.
2882 (Sized_incremental_binary::do_check_inputs): Check
2883 has_incremental_info_ flag; move setup code to setup_readers;
2884 use input readers.
2885 (Sized_incremental_binary::do_file_is_unchanged): New function.
2886 (Sized_incremental_binary::do_get_input_reader): New function.
2887 * incremental.h (class Incremental_binary): Move to end of file.
2888 (Incremental_binary::file_is_unchanged): New function.
2889 (Incremental_binary::do_file_is_unchanged): New function.
2890 (Incremental_binary::Input_reader): New class.
2891 (Incremental_binary::get_input_reader): New function.
2892 (class Sized_incremental_binary): Move to end of file.
2893 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2894 input section reader classes.
2895 (Sized_incremental_binary::has_incremental_info): New function.
2896 (Sized_incremental_binary::inputs_reader): New function.
2897 (Sized_incremental_binary::symtab_reader): New function.
2898 (Sized_incremental_binary::relocs_reader): New function.
2899 (Sized_incremental_binary::got_plt_reader): New function.
2900 (Sized_incremental_binary::do_file_is_unchanged): New function.
2901 (Sized_incremental_binary::Sized_input_reader): New class.
2902 (Sized_incremental_binary::get_input_reader): New function.
2903 (Sized_incremental_binary::find_incremental_inputs_sections):
2904 Rename do_find_incremental_inputs_sections to this.
2905 (Sized_incremental_binary::setup_readers): New function.
2906 (Sized_incremental_binary::has_incremental_info_): New data member.
2907 (Sized_incremental_binary::inputs_reader_): New data member.
2908 (Sized_incremental_binary::symtab_reader_): New data member.
2909 (Sized_incremental_binary::relocs_reader_): New data member.
2910 (Sized_incremental_binary::got_plt_reader_): New data member.
2911 (Sized_incremental_binary::current_input_file_): New data member.
2912
a869183f
PP
29132011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2914
2915 PR gold/12640
2916 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2917 violation.
2918
29192011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
2920
2921 * archive.cc (Archive::include_member): Adjust call to report_object.
2922 (Add_archive_symbols::run): Add script_info to call to
2923 report_archive_begin.
2924 (Lib_group::include_member): Adjust call to report_object.
2925 (Add_lib_group_symbols::run): Adjust call to report_object.
2926 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2927 blocks. Add object count for script input files.
2928 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2929 script_info parameter; change all callers.
2930 (Incremental_inputs::report_object): Add script_info parameter;
2931 change all callers.
2932 (Incremental_inputs::report_script): Store backpointer to
2933 incremental info entry.
2934 (Output_section_incremental_inputs::set_final_data_size): Record
2935 additional information for scripts.
2936 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2937 * incremental.h (Incremental_script_entry::add_object): New function.
2938 (Incremental_script_entry::get_object_count): New function.
2939 (Incremental_script_entry::get_object): New function.
2940 (Incremental_script_entry::objects_): New data member; adjust
2941 constructor.
2942 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2943 (Incremental_inputs::report_object): Add script_info parameter.
2944 (Incremental_inputs_reader::get_object_count): New function.
2945 (Incremental_inputs_reader::get_object_offset): New function.
2946 * options.cc (Input_arguments::add_file): Return reference to
2947 new input argument.
2948 * options.h (Input_argument::set_script_info): New function.
2949 (Input_argument::script_info): New function.
2950 (Input_argument::script_info_): New data member; adjust all
2951 constructors.
2952 (Input_file_group::add_file): Return reference to new input argument.
2953 (Input_file_lib::add_file): Likewise.
2954 (Input_arguments::add_file): Likewise.
2955 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2956 * script.cc (Parser_closure::Parser_closure): Add script_info
2957 parameter; adjust all callers.
2958 (Parser_closure::script_info): New function.
2959 (Parser_closure::script_info_): New data member.
2960 (read_input_script): Report scripts earlier to incremental info.
2961 (script_add_file): Set script_info in Input_argument.
2962 (script_add_library): Likewise.
2963 * script.h (Script_options::Script_info): Rewrite class.
2964
a869183f 29652011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
2966
2967 * archive.cc (Library_base::should_include_member): Move
2968 method here from class Archive.
2969 (Archive::Archive): Initialize base class.
2970 (Archive::should_include_member): Move to base class.
2971 (Archive::do_for_all_unused_symbols): New function.
2972 (Add_archive_symbols::run): Remove redundant access to
2973 incremental_inputs.
2974 (Lib_group::Lib_group): Initialize base class.
2975 (Lib_group::do_filename): New function.
2976 (Lib_group::include_member): Pass pointer to Lib_group to
2977 report_object.
2978 (Lib_group::do_for_all_unused_symbols): New function.
2979 (Add_lib_group_symbols::run): Report archive information for
2980 incremental links.
2981 * archive.h (class Library_base): New base class.
2982 (class Archive): Derive from Library_base.
2983 (Archive::filename): Move to base class.
2984 (Archive::set_incremental_info): Likewise.
2985 (Archive::incremental_info): Likewise.
2986 (Archive::Should_include): Likewise.
2987 (Archive::should_include_member): Likewise.
2988 (Archive::Armap_entry): Remove.
2989 (Archive::Unused_symbol_iterator): Remove.
2990 (Archive::unused_symbols_begin): Remove.
2991 (Archive::unused_symbols_end): Remove.
2992 (Archive::do_filename): New function.
2993 (Archive::do_get_mtime): New function.
2994 (Archive::do_for_all_unused_symbols): New function.
2995 (Archive::task_): Move to base class.
2996 (Archive::incremental_info_): Likewise.
2997 (class Lib_group): Derive from Library_base.
2998 (Lib_group::do_filename): New function.
2999 (Lib_group::do_get_mtime): New function.
3000 (Lib_group::do_for_all_unused_symbols): New function.
3001 (Lib_group::task_): Move to base class.
3002 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3003 function.
3004 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3005 function.
3006 * incremental.cc (Incremental_inputs::report_archive_begin):
3007 Use Library_base; call library's get_mtime; add incremental inputs
3008 entry before members.
3009 (class Unused_symbol_visitor): New class.
3010 (Incremental_inputs::report_archive_end): Use Library_base; use
3011 visitor class to record unused symbols; don't add incremental inputs
3012 entry after members.
3013 (Incremental_inputs::report_object): Use Library_base.
3014 * incremental.h
3015 (Incremental_archive_entry::Incremental_archive_entry): Remove
3016 unused Archive parameter.
3017 (Incremental_inputs::report_archive_begin): Use Library_base.
3018 (Incremental_inputs::report_archive_end): Likewise.
3019 (Incremental_inputs::report_object): Likewise.
3020 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3021 function.
3022 * object.h (Object::for_all_global_symbols): New function.
3023 (Object::do_for_all_global_symbols): New function.
3024 (Sized_relobj::do_for_all_global_symbols): New function.
3025 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3026 function.
3027 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3028 function.
3029
61ab3e40
ILT
30302011-03-27 Ian Lance Taylor <iant@google.com>
3031
3032 * archive.cc (Archive::interpret_header): Return -1 if something
3033 goes wrong. Change callers accordingly.
3034
30e1f9e6
CC
30352011-03-25 Cary Coutant <ccoutant@google.com>
3036
3037 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3038 * testsuite/Makefile.in: Regenerate.
3039
9370ce59 30402011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
9c793f14
RÁE
3041
3042 * plugin.cc (get_view): New.
3043 (Plugin::load): Pass get_view to the plugin.
3044 (Plugin_manager::get_view): New.
3045
9312bb0a
ILT
30462011-03-21 Ian Lance Taylor <iant@google.com>
3047
3048 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 3049 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 3050
7e12ba9e
ST
30512011-03-21 Sriraman Tallam <tmsriram@google.com>
3052
3053 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3054 Change == to -eq.
3055 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3056 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3057 Change == to -eq.
3058 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3059 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3060
fd7a005d
ILT
30612011-03-14 Ian Lance Taylor <iant@google.com>
3062
3063 * script-sections.cc (Sort_output_sections::script_compare):
3064 Rename from is_before, change return type.
3065 (Sort_output_sections::operator()): Adjust accordingly.
3066
ed16fd1b
ILT
30672011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3068
3069 PR gold/12572
3070 * testsuite/odr_violation2.cc: Add comment to make all error line
3071 numbers double digits.
3072 * testsuite/debug_msg.sh: Adjust expected errors.
3073
71ff8986
ILT
30742011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3075
3076 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3077 but mark earlier ones as non-canonical
3078 (offset_to_iterator): Update search target and example
3079 (do_addr2line): Return extra lines in a vector*
3080 (format_file_lineno): Extract from do_addr2line
3081 (one_addr2line): Add vector* out-param
3082 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3083 when a lineno entry appeared last for its instruction
3084 (Dwarf_line_info): Add vector* out-param
3085 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3086 * symtab.cc (Odr_violation_compare): Include the lineno in the
3087 comparison again.
3088 (linenos_from_loc): New. Combine the canonical line for an
3089 address with its other lines.
3090 (True_if_intersect): New. Helper functor to make
3091 std::set_intersection a query.
3092 (detect_odr_violations): Compare sets of lines instead of just
3093 one line for each function. This became less deterministic, but
3094 has fewer false positives.
3095 * symtab.h: Declarations.
3096 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3097 mix an optimized and non-optimized object in the same binary
3098 (odr_violation2.so): Same.
3099 * testsuite/Makefile.in: Regenerate from Makefile.am.
3100 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3101 * testsuite/debug_msg.sh: Update line numbers and add
3102 assertions.
3103 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3104 non-optimized context.
3105 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3106 isn't inlined, and use OdrDerived in an optimized context.
3107 * testsuite/odr_header1.h: Defines OdrDerived, where
3108 optimization will change the
3109 first-instruction-in-the-destructor's file and line number.
3110 * testsuite/odr_header2.h: Defines OdrBase.
3111
a19fefdc
ILT
31122011-03-09 Ian Lance Taylor <iant@google.com>
3113
3114 * fileread.cc (File_read::clear_views): Don't delete the whole
3115 file view.
3116
ecb351e9
ILT
31172011-03-08 Ian Lance Taylor <iant@google.com>
3118
3119 PR gold/12525
3120 * fileread.cc: #include <climits>.
3121 (GOLD_IOV_MAX): Define.
3122 (File_read::read_multiple): Limit number of entries by iov_max.
3123 * fileread.h (class File_read): Always set max_readv_entries to
3124 128.
3125
b821d13c
ILT
31262011-03-07 Ian Lance Taylor <iant@google.com>
3127
3128 PR gold/12525
3129 * options.h (class General_options): Add -dy and -dn.
3130
89243142
CC
31312011-03-02 Cary Coutant <ccoutant@google.com>
3132
3133 * testsuite/script_test_9.t: Add TLS segment.
3134
d0773f31
ILT
31352011-03-02 Simon Baldwin <simonb@google.com>
3136
3137 * configure.ac: Add check for gnu_indirect_function support in
3138 the toolchain building binutils.
3139 * configure: Rebuild.
3140
9370ce59 31412011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
badc8139
RÁE
3142
3143 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3144 plugin only symbols.
3145 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3146 in plugin files as not needed in the symbol table.
3147
4cf7a849
ST
31482011-02-11 Sriraman Tallam <tmsriram@google.com>
3149
3150 * output.cc (Output_section::add_input_section): Delay fill
3151 generation for section ordering.
3152
b578bd7d
ILT
31532011-02-09 Ian Lance Taylor <iant@google.com>
3154
3155 PR gold/12316
3156 * object.h (class Sized_relobj): Remove clear_local_symbols.
3157 * reloc.cc (Sized_relobj::do_relocate): Don't call
3158 clear_local_symbols.
3159
9370ce59 31602011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
84ced98a
RÁE
3161
3162 * plugin.cc (is_visible_from_outside): Return true for symbols
3163 in the -u option.
3164
55382fb7
ILT
31652011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3166
3167 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3168 filename.
3169
4e271fff
ST
31702011-02-02 Sriraman Tallam <tmsriram@google.com>
3171
3172 * icf.h (is_section_foldable_candidate): Change type of parameter
3173 to std::string.
3174 * icf.cc (Icf::find_identical_sections): Change type of local variable
3175 section_name to be std::string.
3176 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3177
d433c3ac
ILT
31782011-01-25 Ian Lance Taylor <iant@google.com>
3179
3180 * script.cc (script_add_extern): Rewrite to use
3181 add_symbol_reference.
3182
880473a6
DK
31832011-01-25 Doug Kwan <dougkwan@google.com>
3184
d433c3ac 3185 * icf.cc (get_section_contents): Always lock section's object.
880473a6 3186
f30f86fa
ILT
31872011-01-24 Ian Lance Taylor <iant@google.com>
3188
3189 * options.h (class General_options): Accept
3190 --no-detect-odr-violations.
3191
8e51a0b9
ILT
31922011-01-24 Ian Lance Taylor <iant@google.com>
3193
3194 * version.cc (version_string): Bump to 1.11.
3195
0f3b89d8
ILT
31962011-01-24 Ian Lance Taylor <iant@google.com>
3197
3198 * plugin.cc (class Plugin_rescan): Define new class.
3199 (Plugin_manager::claim_file): Set any_claimed_.
3200 (Plugin_manager::save_archive): New function.
3201 (Plugin_manager::save_input_group): New function.
3202 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3203 necessary.
3204 (Plugin_manager::new_undefined_symbol): New function.
3205 (Plugin_manager::rescan): New function.
3206 (Plugin_manager::rescannable_defines): New function.
3207 (Plugin_manager::add_input_file): Set any_added_.
3208 * plugin.h (class Plugin_manager): define new fields rescannable_,
3209 undefined_symbols_, any_claimed_, and any_added_. Declare
3210 Plugin_rescan as friend. Declare new functions.
3211 (Plugin_manager::Rescannable): Define type.
3212 (Plugin_manager::Rescannable_list): Define type.
3213 (Plugin_manager::Undefined_symbol_list): Define type.
3214 (Plugin_manager::Plugin_manager): Initialize new fields.
3215 * archive.cc (Archive::defines_symbol): New function.
3216 (Add_archive_symbols::run): Pass archive to plugins if any.
3217 * archive.h (class Archive): Declare defines_symbol.
3218 * readsyms.cc (Input_group::~Input_group): New function.
3219 (Finish_group::run): Pass input_group to plugins if any.
3220 * readsyms.h (class Input_group): Declare destructor.
3221 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3222 any.
3223
3bb951e5
ILT
32242011-01-10 Ian Lance Taylor <iant@google.com>
3225
3226 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3227 section as relro.
3228 (Layout::set_segment_offsets): Reset increase_relro before calling
3229 set_section_addresses a second time.
3230
0aa45fac
CC
32312011-01-04 Cary Coutant <ccoutant@google.com>
3232
3233 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3234 sections before NOBITS sections.
3235
0db46eb4
L
32362011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3237
3238 * version.cc (print_version): Update copyright to 2011.
3239
829c9745
CC
32402010-12-23 Cary Coutant <ccoutant@google.com>
3241
3242 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3243 of OS to this->add. Add OD parameter to second form of the function.
3244
7500420b
ILT
32452010-12-20 Ian Lance Taylor <iant@google.com>
3246
3247 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3248 second of two consecutive entries with same offset.
3249
f8e9a930
RW
32502010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3251
3252 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3253 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3254 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3255 to avoid unneeded links against $(LDADD).
3256 * testsuite/Makefile.in: Regenerate.
3257
2fbb4320
ILT
32582010-12-15 Ian Lance Taylor <iant@google.com>
3259
3260 PR gold/12324
3261 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3262 for R_X86_64_32 and R_X86_64_PC32.
3263 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3264 ver_matching_def_pic.o.
3265 (ver_matching_def_pic.o): New target.
3266
fedb228d
RW
32672010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3268
3269 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3270 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3271 Move definition before File_read::View member definitions.
3272 (File_read::View::~View): Initialize and hold lock before
3273 updating current_mapped_bytes.
3274
9b547ce6
RW
32752010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3276
3277 * dwarf_reader.cc: Remove outdated comment.
3278 * gold-threads.cc: Fix typo in error message.
3279 * archive.cc: Fix typos in comments.
3280 * archive.h: Likewise.
3281 * arm-reloc-property.cc: Likewise.
3282 * arm-reloc-property.h: Likewise.
3283 * arm-reloc.def: Likewise.
3284 * arm.cc: Likewise.
3285 * attributes.h: Likewise.
3286 * cref.cc: Likewise.
3287 * ehframe.cc: Likewise.
3288 * fileread.h: Likewise.
3289 * gold.h: Likewise.
3290 * i386.cc: Likewise.
3291 * icf.cc: Likewise.
3292 * incremental.h: Likewise.
3293 * int_encoding.cc: Likewise.
3294 * layout.h: Likewise.
3295 * main.cc: Likewise.
3296 * merge.h: Likewise.
3297 * object.cc: Likewise.
3298 * object.h: Likewise.
3299 * options.cc: Likewise.
3300 * readsyms.cc: Likewise.
3301 * reduced_debug_output.cc: Likewise.
3302 * reloc.cc: Likewise.
3303 * script-sections.cc: Likewise.
3304 * sparc.cc: Likewise.
3305 * symtab.h: Likewise.
3306 * target-reloc.h: Likewise.
3307 * target.cc: Likewise.
3308 * target.h: Likewise.
3309 * timer.cc: Likewise.
3310 * timer.h: Likewise.
3311 * x86_64.cc: Likewise.
3312
83e17bd5
CC
33132010-12-09 Cary Coutant <ccoutant@google.com>
3314
3315 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3316 stack.
3317 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3318 parameter; change all callers.
3319 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3320 * options.h (warn_execstack): New option.
3321
017257f8
DK
33222010-12-07 Doug Kwan <dougkwan@google.com>
3323
3324 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3325 like function call relocations.
3326
c20cbc06
ILT
33272010-12-07 Ian Lance Taylor <iant@google.com>
3328
3329 * archive.cc (Archive::get_elf_object_for_member): Permit
3330 punconfigured to be NULL.
3331 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3332 (Archive::include_member): Pass NULL to get_elf_object_for_member
3333 if we searched for the archive and this is the first included
3334 object.
3335
4dbfafcc
ILT
33362010-12-01 Ian Lance Taylor <iant@google.com>
3337
3338 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3339 track_relocs_type_ field.
3340 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3341 Set track_relocs_type_.
3342 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3343 contents when using RELA relocs.
3344 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3345 reloc_map_.
3346 * reloc.cc (Track_relocs::next_addend): New function.
3347 * reloc.h (class Track_relocs): Declare next_addend.
3348
e5e19edd
ILT
33492010-12-01 Ian Lance Taylor <iant@google.com>
3350
3351 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3352 virtual destructor.
3353
9a5ce24c
ILT
33542010-12-01 Ian Lance Taylor <iant@google.com>
3355
3356 * README: Update compilers known to work and fail.
3357
c7791212
NC
33582010-11-23 Matthias Klose <doko@ubuntu.com>
3359
3360 * configure.in: For --enable-gold, handle value `default' instead of
3361 `both*'. Always install ld as ld.bfd, install as ld if gold is
3362 not the default.
3363 * configure: Regenerate.
3364
0ad220c9
DK
33652010-11-18 Doug Kwan <dougkwan@google.com>
3366
3367 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3368 and right_alignment to be zero. Store result alignment only if it is
3369 greater than existing alignment.
3370
ab8056e0
CC
33712010-11-16 Cary Coutant <ccoutant@google.com>
3372
3373 PR gold/12220
3374 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3375 Check for ".zdebug_line".
3376
fd064a5b
CC
33772010-11-16 Doug Kwan <dougkwan@google.com>
3378 Cary Coutant <ccoutant@google.com>
3379
3380 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3381 by reference; adjust all callers.
3382 * output.cc (Output_segment::set_section_addresses): Adjust references
3383 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3384 list is empty.
3385 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3386 end at page boundary.
3387
6fc6ea19
CC
33882010-11-16 Cary Coutant <ccoutant@google.com>
3389
3390 PR gold/12220
3391 * layout.cc (Layout::choose_output_section): Transform names of
3392 compressed sections even when using a script with a SECTIONS clause.
3393 (Layout::output_section_name): Remove code to transform
3394 compressed debug section names.
3395 * output.cc (Output_section::add_input_section): Use uncompressed
3396 section size when tracking input sections.
3397
95a2c8d6
RS
33982010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3399
3400 * symtab.h (Symbol::NON_PIC_REF): Remove.
3401 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3402 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3403 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3404 (Symbol::use_plt_offset): Take a flags argument and pass it
3405 directly to needs_dynamic_reloc. Restrict check for undefined
3406 weak symbols to function calls.
3407 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3408 (Target_arm::Scan::global): Use it.
3409 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3410 (Target_arm::Relocate::relocate): Likewise.
3411 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3412 parameter with an r_type parameter. Use get_reference_flags
3413 to get the flags.
3414 (Target_arm::Relocate::relocate): Update accordingly.
3415 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3416 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3417 (Target_i386::Scan::global): Likewise.
3418 (Target_i386::Relocate::relocate): Likewise.
3419 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3420 parameter with an r_type parameter. Use get_reference_flags
3421 to get the flags.
3422 (Target_i386::Relocate::relocate): Update accordingly.
3423 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3424 (Target_powerpc::Scan::global): Use it.
3425 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3426 (Target_powerpc::Relocate::relocate): Likewise.
3427 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3428 (Target_sparc::Scan::global): Use it.
3429 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3430 (Target_sparc::Relocate::relocate): Likewise.
3431 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3432 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3433 (Target_x86_64::Scan::global): Likewise.
3434 (Target_x86_64::Relocate::relocate): Likewise.
3435
f625ae50
DK
34362010-11-08 Doug Kwan <dougkwan@google.com>
3437 Cary Coutant <ccoutant@google.com>
3438
3439 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3440 (Arm_exidx_merge_section::section_contents_): New data member.
3441 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3442 (Arm_input_section::~Arm_input_section): De-allocate memory.
58797674 3443 (Arm_input_section::original_contents_): New data member.
f625ae50
DK
3444 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3445 in parameters instead of calling Object::section_contents without
3446 locking.
3447 (Arm_output_section::group_section): New parameter TASK. Pass it
3448 to callees that need locking objects.
3449 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3450 to lock EXIDX input sections. Fix a formatting issue. Call
3451 Arm_exidx_merged_section::build_contents to create merged section
3452 contents.
3453 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3454 to lock object of stub table owner.
3455 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3456 TEXT_SIZE to initialize data member TEXT_SIZE_.
3457 (Arm_exidx_input_section::addralign): Fix typo in comment.
3458 (Arm_exidx_input_section::text_size): New method.
3459 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3460 that require locking objects. Lock objects before scanning for stubs
3461 and updating local symbols.
3462 (Arm_input_section<big_endian>::init): Copy contents of original
3463 input section.
3464 (Arm_input_section<big_endian>::do_write): Use saved contents of
3465 original input section instead of calling Object::section_contents
3466 without locking.
3467 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3468 size without calling Object::section_size().
3469 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3470 for size. Allocate a buffer for merged EXIDX entries.
3471 (Arm_exidx_merged_section::build_contents): New method.
3472 (Arm_exidx_merged_section::do_write): Move merge section contents
3473 building code to Arm_exidx_merged_section::build_contetns. Write
3474 out contetns in buffer instead of building it on the fly.
3475 (Arm_relobj::make_exidx_input_section): Also pass text section size
3476 to Arm_exidx_input_section constructor.
3477 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3478 (Arm_dynobj::do_read_symbols): Fix memory leak.
3479 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3480 * target.h: (class Task): Add forward declaration.
3481 (Target::relax): Add new parameter TASK and pass it to
3482 Target::do_relax().
3483 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3484
5f9bcf58
CC
34852010-11-05 Cary Coutant <ccoutant@google.com>
3486
3487 PR gold/10708
3488 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3489 object when reading from the file.
3490 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3491 second layout pass.
3492 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3493 when reading section contents.
3494 (get_section_contents): Likewise.
3495 (icf::find_identical_sections): Likewise.
3496 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3497 object when reading from the file.
3498 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3499 the object when doing deferred section layout.
3500
e597fa08
NC
35012010-11-03 Nick Clifton <nickc@redhat.com>
3502
3503 PR gold/12001
3504 * script.h (class Symbol_assignment: name): New member. Returns
3505 the name of the symbol.
3506 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3507 Returns true if the given symbol name is on the list of
3508 assignments wating to be processed.
3509 * archive.cc (should_incldue_member): If the symbol is undefined,
3510 check to see if it is on the list of symbols pending assignment.
3511
3f9a3278
ILT
35122010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3513
3514 * script-sections.cc (Script_sections::find_memory_region): Check
3515 for a NULL output section pointer.
3516
d06fb4d1
DK
35172010-10-29 Doug Kwan <dougkwan@google.com>
3518
3519 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3520 Output_section::add_relaxed_input_section.
3521 * output.cc (Output_section::add_relaxed_input_section): Add new
3522 arguments LAYOUT and NAME. Set section order index.
3523 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3524 Copy section order index.
3525 * output.h (Output_section::add_relaxed_input_section): Add new
3526 arguments LAYOUT and NAME.
3527
90e24de5
ILT
35282010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3529
3530 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3531 NATIVE_OR_CROSS_LINKER.
3532 * testsuite/Makefile.in: Regenerate.
3533
c9484ea5
DK
35342010-10-20 Doug Kwan <dougkwan@google.com>
3535
3536 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3537 without SHF_LINK_ORDER flags.
3538 * layout.cc (Layout::choose_output_section): Do not filter
3539 SHF_LINK_ORDER flag in a relocatable link.
3540
5bc2f5be
CC
35412010-10-17 Cary Coutant <ccoutant@google.com>
3542
3543 * output.h (Output_segment::set_section_addresses): Change function
3544 signature. Update all callers.
3545 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3546 sections.
3547 (Output_segment::set_section_addresses): Align after last TLS
3548 section. Add padding before last relro section instead of after.
3549
0c91cf04
DK
35502010-10-17 Doug Kwan <dougkwan@google.com>
3551
3552 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3553 GOT output section to be writable.
3554
8c21d9d3
CC
35552010-10-14 Cary Coutant <ccoutant@google.com>
3556
3557 * debug.h (DEBUG_INCREMENTAL): New flag.
3558 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3559 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3560 mode.
3561 * incremental.cc (report_command_line): Ignore all forms of
3562 --incremental.
3563 * layout.cc (Layout::Layout): Check parameters for incremental link
3564 mode.
3565 * options.cc (General_options::parse_incremental): New function.
3566 (General_options::parse_no_incremental): New function.
3567 (General_options::parse_incremental_full): New function.
3568 (General_options::parse_incremental_update): New function.
3569 (General_options::incremental_mode_): New data member.
3570 (General_options::finalize): Check incremental_mode_.
3571 * options.h (General_options): Update help text for --incremental.
3572 Add --no-incremental, --incremental-full, --incremental-update.
3573 (General_options::Incremental_mode): New enum type.
3574 (General_options::incremental_mode): New function.
3575 (General_options::incremental_mode_): New data member.
3576 * parameters.cc (Parameters::incremental_mode_): New data member.
3577 (Parameters::set_options): Set incremental_mode_.
3578 (Parameters::set_incremental_full): New function.
3579 (Parameters::incremental): New function.
3580 (Parameters::incremental_update): New function.
3581 (set_parameters_incremental_full): New function.
3582 * parameters.h (Parameters::set_incremental_full): New function.
3583 (Parameters::incremental): New function.
3584 (Parameters::incremental_update): New function.
3585 (Parameters::incremental_mode_): New data member.
3586 (set_parameters_incremental_full): New function.
3587 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3588 incremental link mode.
3589 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3590 (Sized_relobj::do_relocate_sections): Likewise.
3591 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3592 option.
3593 * testsuite/Makefile.in: Regenerate.
3594 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3595
bb32aa18 35962010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
3597
3598 * script-sections.h (class Script_sections): Make
3599 Sections_elements typedef public.
3600 * script-sections.cc (class Sort_output_sections): Add elements_
3601 field. Add constructor which sets it; change all callers.
3602 (Sort_output_sections::is_before): New function.
3603 (Sort_output_sections::operator()): Call is_before.
3604 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3605 conditional.
3606 * testsuite/script_test_10.sh: New test. Test script section
3607 order.
3608 * testsuite/script_test_10.t: Likewise.
3609 * testsuite/script_test_10.s: Likewise.
3610 * testsuite/Makefile.am: Wrap the cross linker tests and the
3611 common tests into NATIVE_OR_CROSS_LINKER.
3612 (check_SCRIPTS): Add script_test_10.sh.
3613 (check_DATA): Add script_test_10.stdout.
3614 (script_test_10.o, script_test_10): New targets.
3615 (script_test_10.stdout): New target.
3616 * configure, testsuite/Makefile.in: Regenerate.
3617
3cef7179
ILT
36182010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3619
3620 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3621 error for the deprecated relocations.
3622 (Target_arm::Scan::global): Likewise.
3623 (Target_arm::Relocate::relocate): Likewise.
3624
7411e9a8
RS
36252010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3626
3627 * fileread.cc (Input_file::find_file): Initialize *found_name
3628 and *namep when using the fallback search for case 4.
3629
6a9da32a
CC
36302010-10-11 Cary Coutant <ccoutant@google.com>
3631
3632 * options.h (class General_options): Redefine -z lazy as an alias for
3633 the negation of -z now.
3634
ac897c20
ILT
36352010-10-11 Ian Lance Taylor <iant@google.com>
3636
3637 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3638 binding.
3639
ea5cae92
NC
36402010-10-06 Nick Clifton <nickc@redhat.com>
3641
3642 * script-sections.cc(class Memory_region): Remove
3643 current_lma_offset_ field. Rename current_vma_offset_ to
3644 current_offset_. Add last_section_ field.
3645 (Memory_region::get_current_vma_address): Rename to
3646 get_current_address.
3647 (Memory_region::get_current_lma_address): Delete.
3648 (Memory_region::increment_vma_offset): Rename to
3649 increment_offset.
3650 (Memory_region::increment_lma_offset): Delete.
3651 (Memory_region::attributes_compatible): New method. Returns
3652 true if the provided section is compatible with the region.
3653 (Memory_region::get_last_section): New method. Returns the last
3654 section to use the region.
3655 (Memory_region::set_last_section): New method. Stores the last
3656 section to use the region.
3657 (Script_sections::block_in_region): New method. Returns true if
3658 a block of memory is contained within a region.
3659 (Script_sections::find_memory_region): New method. Locates a
3660 memory region to be used to set a VMA or LMA address.
3661 (Output_section_definition::set_section_addresses): Add code to
3662 check for addresses set by memory regions.
3663 (Output_segment::set_section_addresses): Remove memory region
3664 walking code.
3665 (Script_sections::create_segment): Add a warning if a header
3666 segment is created outside of any region.
3667 * script-sections.h (class Script_sections): Add prototypes for
3668 find_memory_region and block_in_region methods.
3669 * testsuite/memory_test.s: Use .long instead of .word.
3670 * testsuite/memory_test.t: Add some more output sections.
3671 * testsuite/memory_test.sh: Update expected output.
3672
a9bfd952
DK
36732010-10-02 Doug Kwan <dougkwan@google.com>
3674
3675 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3676 defintion to symtab.h
3677 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3678 declaration to defintion.
3679
bacff3ab
NC
36802010-10-01 Nick Clifton <nickc@redhat.com>
3681
3682 * expression.cc (eval): Replace dummy argument with NULL.
3683 (eval_maybe_dot): Check for a NULL result section pointer.
3684 (Symbol_expression::value): Likewise.
3685 (Dot_expression::value): Likewise.
3686 (BINARY_EXPRESSION): Likewise.
3687 (Max_expression::value): Likewise.
3688 (Min_expression::value): Likewise.
3689 (Absolute_expression::value): Likewise.
3690 (Addr_expression::value_from_output_section): Likewise.
3691 (Loaddddr_expression::value_from_output_section): Likewise.
3692 (Segment_start_expression::value): Likewise.
3693 * script-sections.cc
3694 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3695 argument with NULL.
3696 (Sections_elememt_dot_assignment::set_section_addresses):
3697 Likewise.
3698 (Output_data_expression::do_write_to_buffer): Likewise.
3699 (Output_section_definition::finalize_symbols): Likewise.
3700 (Output_section_definition::set_section_addresses): Likewise.
3701
f81bc8b5
DK
37022010-09-30 Doug Kwan <dougkwan@google.com>
3703
3704 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3705
c95e9f27
ST
37062010-09-28 Sriraman Tallam <tmsriram@google.com>
3707
3708 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 3709 function.
c95e9f27
ST
3710 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3711 virtual function.
3712 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3713 virtual function.
3714 * icf.cc (get_section_contents): Inline merge sections only when
3715 target allows it.
3716
3cac54d2
RW
37172010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3718
3719 * configure: Regenerate.
3720
2904037a
ILT
37212010-09-17 Ian Lance Taylor <iant@google.com>
3722
3723 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
3724 * testsuite/Makefile.am (memory_test.o): New target.
3725 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3726 memory_test.t.
3727 * testsuite/Makefile.in: Rebuild.
2904037a 3728
bca7fb63
DK
37292010-09-17 Doug Kwan <dougkwan@google.com>
3730
3731 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3732 defintion if relocation uses GOT entries of the symbol.
3733 * testsuite/icf_safe_test.sh: Fix test.
3734 * testsuite/icf_safe_so_test.sh: Fix test.
3735
4ef28648
CC
37362010-09-16 Cary Coutant <ccoutant@google.com>
3737
3738 * script_sections.cc (class Memory_region): Remove "NULL" from
3739 vector initializations.
3740
793990de
CC
37412010-09-15 Cary Coutant <ccoutant@google.com>
3742
3743 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3744 Resolve forwarding symbols.
3745
81e015e2
DK
37462010-09-15 Doug Kwan <dougkwan@google.com>
3747
3748 * gold/testsuite/script_test_3.t: Add ARM special sections.
3749 * gold/testsuite/script_test_4.t: Same.
3750 * gold/testsuite/script_test_5.t: Same.
3751 * gold/testsuite/script_test_6.t: Same.
3752 * gold/testsuite/script_test_7.t: Same.
3753 * gold/testsuite/script_test_7.t: Same.
3754 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3755
36171d64
CC
37562010-09-14 Cary Coutant <ccoutant@google.com>
3757
3758 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3759 (Target_x86_64::Relocate::relocate_tls): Replace check for
3760 saw_tls_block_reloc_ with test for executable section.
3761
d89051bd
CC
37622010-09-12 Cary Coutant <ccoutant@google.com>
3763
3764 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3765 position-independent executables to shared libraries need dynamic
3766 relocations.
3767 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3768 position-independent executables.
3769 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3770 * testsuite/Makefile.in: Regenerate.
3771
fca41f0f
NC
37722010-09-10 Nick Clifton <nickc@redhat.com>
3773
3774 PR gold/11997
3775 * testsuite/memory_test.t: Discard any sections that are not
3776 needed.
3777
6695e4b3
L
37782010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3779
3780 PR gold/11996
3781 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3782 "This::" to work around a bug in gcc 4.2.
3783
3784 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3785
0f72bf6f
RÁE
37862010-09-09 Rafael Espindola <espindola@google.com>
3787
3788 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3789 sections with different PF_X flags in the same segment.
3790 (Layout::find_first_load_seg): Search all segments to find the first
3791 one.
3792 * options.h (rosegment): New.
3793
37942010-09-08 Rafael Espindola <espindola@google.com>
a6577478 3795
05a79166 3796 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 3797
aa98ff75
DK
37982010-09-08 Doug Kwan <dougkwan@google.com>
3799
3800 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3801 (Arm_relobj::do_relocate_sections): Add new parameter for output
3802 file to match the parent.
3803 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3804 of local symbols instead of input values. Update code to track
3805 changes in gold::relocate_section.
3806 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3807 (Sized_relobj::compute_final_local_value_internal): New methods.
3808 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3809 body into private version of Sized_relobj::compute_final_local_value.
3810 Call the inline method.
3811 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3812 merged symbol value if there is one.
3813 (Symbol_value::has_output_value): New method defintiion.
3814 (Sized_relobj::Compute_final_local_value_status): New enum type.
3815 (Sized_relobj::compute_final_local_value): New methods.
3816 (Sized_relobj::compute_final_local_value_internal): New methods.
3817 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3818 and arm_cortex_a8.sh.
3819 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3820 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3821 New tests.
3822 * Makefile.in: Regenerate.
3823 * testsuite/arm_bl_out_of_range.s: Update test.
3824 * testsuite/thumb_bl_out_of_range.s: Ditto.
3825 * testsuite/thumb_blx_out_of_range.s: Ditto.
3826 * testsuite/arm_branch_out_of_range.sh: New file.
3827 * testsuite/arm_cortex_a8.sh: Ditto.
3828 * testsuite/arm_cortex_a8_b.s: Ditto.
3829 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3830 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3831 * testsuite/arm_cortex_a8_bl.s: Ditto.
3832 * testsuite/arm_cortex_a8_blx.s: Ditto.
3833 * testsuite/arm_cortex_a8_local.s: Ditto.
3834 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3835 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3836
05a79166
L
38372010-09-08 Rafael Espindola <espindola@google.com>
3838
3839 * Makefile.am (memory_test.stdout): Run readelf with -W.
3840 * Makefile.in: Regenerate.
3841 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3842 64 bit output.
3843
33dbc701
RÁE
38442010-09-08 Rafael Espindola <espindola@google.com>
3845
3846 * script-sections.cc (Script_sections::add_memory_region): Convert
3847 field precision to int.
3848 * script.cc (script_set_section_region, script_set_section_region):
3849 Convert field precision to int.
3850
731ca54a
RÁE
38512010-09-08 Rafael Espindola <espindola@google.com>
3852
3853 * arm.cc (do_finalize_sections): Create the __exidx_start and
3854 __exdix_end symbols even when the section is missing.
3855
7f8cd844
NC
38562010-09-08 Nick Clifton <nickc@redhat.com>
3857
3858 * README: Remove claim that MEMORY is not supported.
3859 * expression.cc (script_exp_function_origin)
3860 (script_exp_function_length): Move from here to ...
3861 * script.cc: ... here.
3862 (script_set_section_region, script_add_memory)
3863 (script_parse_memory_attr, script_include_directive): New
3864 functions.
3865 * script-sections.cc
3866 (class Memory_region): New class.
3867 (class Output_section_definition): Add set_memory_region,
3868 set_section_vma, set_section_lma and get_section_name methods.
3869 (class Script_Sections): Add add_memory_region,
3870 find_memory_region, find_memory_region_origin,
3871 find_memory_region_length and set_memory_region methods.
3872 Have set_section_addresses method walk the list of set memory
3873 regions.
3874 Extend the print methos to display memory regions.
3875 * script-sections.h: Add prototypes for new methods.
3876 Add enum for MEMORY region attributes.
3877 * yyscript.y: Add support for parsing MEMORY regions.
3878 * script-c.h: Add prototypes for new functions.
3879 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3880 * testsuite/Makefile.in: Regenerate.
3881 * testsuite/memory_test.sh: New script.
3882 * testsuite/memory_test.s: New assembler source file.
3883 * testsuite/memory_test.t: New linker script.
3884
a4649286
DK
38852010-08-27 Doug Kwan <dougkwan@google.com>
3886
3887 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3888 reference override an existing dynamic weak reference.
3889 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3890 * testsuite/Makefile.in: Regenerate.
3891 * testsuite/dyn_weak_ref.sh: New file.
3892 * testsuite/dyn_weak_ref_1.c: Ditto.
3893 * testsuite/dyn_weak_ref_2.c: Ditto.
3894
b56648ad
ILT
38952010-08-27 Ian Lance Taylor <iant@google.com>
3896
3897 * incremental.h (class Incremental_input_entry): Add virtual
3898 destructor.
3899
809313cb
ILT
39002010-08-27 Ian Lance Taylor <iant@google.com>
3901
3902 * testsuite/start_lib_test_3.c: Mark t3 as used.
3903
11e32464
NC
39042010-08-27 Nick Clifton <nickc@redhat.com>
3905
3906 * options.cc (version_script): Fix small typo in previous
3907 whitespace tidyup.
3908
ca09d69a
NC
39092010-08-25 Nick Clifton <nickc@redhat.com>
3910
3911 * archive.cc: Formatting fixes: Remove whitespace between
3912 typename and following asterisk. Remove whitespace between
3913 function name and opening parenthesis.
3914 * archive.h: Likewise.
3915 * arm.cc: Likewise.
3916 * attributes.cc: Likewise.
3917 * attributes.h: Likewise.
3918 * common.cc: Likewise.
3919 * copy-relocs.cc: Likewise.
3920 * dirsearch.h: Likewise.
3921 * dynobj.cc: Likewise.
3922 * ehframe.cc: Likewise.
3923 * ehframe.h: Likewise.
3924 * expression.cc: Likewise.
3925 * fileread.cc: Likewise.
3926 * fileread.h: Likewise.
3927 * gc.h: Likewise.
3928 * gold-threads.cc: Likewise.
3929 * gold.cc: Likewise.
3930 * i386.cc: Likewise.
3931 * icf.h: Likewise.
3932 * incremental-dump.cc: Likewise.
3933 * incremental.cc: Likewise.
3934 * layout.cc: Likewise.
3935 * layout.h: Likewise.
3936 * main.cc: Likewise.
3937 * merge.cc: Likewise.
3938 * merge.h: Likewise.
3939 * object.cc: Likewise.
3940 * object.h: Likewise.
3941 * options.cc: Likewise.
3942 * options.h: Likewise.
3943 * output.cc: Likewise.
3944 * output.h: Likewise.
3945 * plugin.cc: Likewise.
3946 * plugin.h: Likewise.
3947 * powerpc.cc: Likewise.
3948 * reloc.cc: Likewise.
3949 * script-c.h: Likewise.
3950 * script-sections.cc: Likewise.
3951 * script.cc: Likewise.
3952 * stringpool.cc: Likewise.
3953 * symtab.cc: Likewise.
3954 * symtab.h: Likewise.
3955 * target.cc: Likewise.
3956 * timer.cc: Likewise.
3957 * timer.h: Likewise.
3958 * version.cc: Likewise.
3959 * x86_64.cc: Likewise.
3960
b8fa8750
NC
39612010-08-24 Nick Clifton <nickc@redhat.com>
3962
3963 PR 11899
3964 * layout.cc (segment_precedes): Sort segments by their physical
3965 addresses, if they have been set.
3966
9919d93b
CC
39672010-08-23 Cary Coutant <ccoutant@google.com>
3968
3969 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3970 symbols data.
3971 (Lib_group::include_member): Unlock object after deleting its
3972 symbols data.
3973 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3974 the bug fixed here.
3975
97b4be1c
CC
39762010-08-19 Neil Vachharajani <nvachhar@google.com>
3977 Cary Coutant <ccoutant@google.com>
3978
3979 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3980 constructor, and set_blocker.
3981 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3982 readsyms_blocker_.
3983 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3984 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3985 * testsuite/Makefile.am (start_lib_test): New test case.
3986 * testsuite/Makefile.in: Regenerate.
3987 * testsuite/start_lib_test_main.c: New file.
3988 * testsuite/start_lib_test_1.c: New file.
3989 * testsuite/start_lib_test_2.c: New file.
3990 * testsuite/start_lib_test_3.c: New file.
3991
dd0b1884
ILT
39922010-08-19 Ian Lance Taylor <iant@google.com>
3993
3994 * Makefile.in: Rebuild with automake 1.11.1.
3995 * aclocal.m4: Likewise.
3996 * testsuite/Makefile.in: Likewise.
3997
7223e9ca
ILT
39982010-08-19 Ian Lance Taylor <iant@google.com>
3999
4000 PR 10893
4001 * i386.cc (class Output_data_plt_i386): Update declarations.
4002 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4003 local_ifuncs_ fields.
4004 (Target_i386::do_plt_section_for_global): New function.
4005 (Target_i386::do_plt_section_for_local): New function.
4006 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4007 parameter; change all callers. Initialize global_ifuncs_ and
4008 local_ifuncs_. If doing a static link define __rel_iplt_start and
4009 __rel_iplt_end.
4010 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4011 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4012 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4013 symbols.
4014 (Target_i386::make_plt_section): New function, broken out of
4015 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4016 (Target_i386::make_plt_entry): Call make_plt_section.
4017 (Target_i386::make_local_ifunc_plt_entry): New function.
4018 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4019 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4020 R_386_IRELATIVE to switch.
4021 (Target_i386::Scan::global): Likewise.
4022 (Target_i386::Relocate::relocate): Likewise.
4023 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4024 switch.
4025 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4026 (Target_x86_64::do_plt_section_for_global): New function.
4027 (Target_x86_64::do_plt_section_for_local): New function.
4028 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4029 parameter; change all callers. If doing a static link define
4030 __rela_iplt_start and __rela_iplt_end.
4031 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4032 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4033 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4034 to point to .plt.
4035 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4036 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4037 switch.
4038 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4039 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4040 R_X86_64_IRELATIVE to switch.
4041 (Target_x86_64::Scan::global): Likewise.
4042 (Target_x86_64::Relocate::relocate): Likewise.
4043 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4044 switch.
4045 * target.h (class Target): Add plt_section_for_global and
4046 plt_section_for_local functions. Add do_plt_section_for_global
4047 and do_plt_section_for_local virtual functions.
4048 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4049 clarifying comments.
4050 (Symbol::use_plt_offset): Handle IFUNC symbol.
4051 * object.cc (Sized_relobj::Sized_relobj): Initialize
4052 local_plt_offsets_.
4053 (Sized_relobj::local_has_plt_offset): New function.
4054 (Sized_relobj::local_plt_offset): New function.
4055 (Sized_relobj::set_local_plt_offset): New function.
4056 (Sized_relobj::do_count): Handle IFUNC symbol.
4057 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4058 a bit away from input_shndx_ field. Add set_is_func_symbol and
4059 is_ifunc_symbol functions.
4060 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4061 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4062 local_plt_offsets_ field.
4063 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4064 * output.h (class Output_section_data): Add non-const
4065 output_section function.
4066 (class Output_data_got): Update declarations.
4067 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4068 Add use_plt_offset parameter to global and local constructors.
4069 Change all callers. Change local_sym_index_ field to 31 bits.
4070 Change GSYM_CODE and CONSTANT_CODE accordingly.
4071 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4072 doing a static link don't set sh_link field.
4073 (Output_data_got::Got_entry::write): Use PLT offset if
4074 appropriate.
4075 (Output_data_got::add_global_plt): New function.
4076 (Output_data_got::add_local_plt): New function.
4077 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4078 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4079 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4080 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4081 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4082 IFUNC conditional.
4083 * testsuite/ifunc-sel.h: New file.
4084 * testsuite/ifuncmain1.c: New file.
4085 * testsuite/ifuncmain1vis.c: New file.
4086 * testsuite/ifuncmod1.c: New file.
4087 * testsuite/ifuncdep2.c: New file.
4088 * testsuite/ifuncmain2.c: New file.
4089 * testsuite/ifuncmain3.c: New file.
4090 * testsuite/ifuncmod3.c: New file.
4091 * testsuite/ifuncmain4.c: New file.
4092 * testsuite/ifuncmain5.c: New file.
4093 * testsuite/ifuncmod5.c: New file.
4094 * testsuite/ifuncmain6pie.c: New file.
4095 * testsuite/ifuncmod6.c: New file.
4096 * testsuite/ifuncmain7.c: New file.
4097 * configure, testsuite/Makefile.in: Rebuild.
4098
56f75c03
ILT
40992010-08-18 Ian Lance Taylor <iant@google.com>
4100
4101 * incremental.cc
4102 (Output_section_incremental_inputs::write_input_files): Add cast
4103 to avoid signed/unsigned comparison warning.
4104 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4105
55455f89
CC
41062010-08-12 Cary Coutant <ccoutant@google.com>
4107
4108 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4109
e2054bcb
ILT
41102010-08-13 Ian Lance Taylor <iant@google.com>
4111
4112 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4113
74f67560
DK
41142010-08-12 Cary Coutant <ccoutant@google.com>
4115 Doug Kwan <dougkwan@google.com>
4116
4117 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4118 defintion overrides non-weak undef, remember that the original undef
4119 is not weak.
4120 * symtab.cc (Symbol_table::sized_write_global): For undef without
4121 an original weak binding, set binding to global in output.
4122 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4123 * testsuite/Makefile.in: Regenerate.
4124 * testsuite/strong_ref_weak_def.sh: New file.
4125 * testsuite/strong_ref_weak_def_1.c: Ditto.
4126 * testsuite/strong_ref_weak_def_2.c: Ditto.
4127
d1238d12
CC
41282010-08-12 Cary Coutant <ccoutant@google.com>
4129
4130 * testsuite/incremental_test.sh: Rewrite.
4131 * testsuite/incremental_test_1.c: Rewrite.
4132 * testsuite/incremental_test_2.c: Rewrite.
4133
0e70b911
CC
41342010-08-12 Cary Coutant <ccoutant@google.com>
4135
4136 * arm.cc (Target_arm::got_size): Add const.
4137 (Target_arm::got_entry_count): New function.
4138 (Target_arm::plt_entry_count): New function.
4139 (Target_arm::first_plt_entry_offset): New function.
4140 (Target_arm::plt_entry_size): New function.
4141 (Output_data_plt_arm::entry_count): New function.
4142 (Output_data_plt_arm::first_plt_entry_offset): New function.
4143 (Output_data_plt_arm::get_plt_entry_size): New function.
4144 * i386.cc (Target_i386::got_size): Add const.
4145 (Target_i386::got_entry_count): New function.
4146 (Target_i386::plt_entry_count): New function.
4147 (Target_i386::first_plt_entry_offset): New function.
4148 (Target_i386::plt_entry_size): New function.
4149 (Output_data_plt_i386::entry_count): New function.
4150 (Output_data_plt_i386::first_plt_entry_offset): New function.
4151 (Output_data_plt_i386::get_plt_entry_size): New function.
4152 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4153 find_incremental_inputs_sections. Dump incremental_got_plt section.
4154 * incremental.cc: Include target.h.
4155 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4156 parameter. Adjust all callers. Find incremental_got_plt section.
4157 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4158 section.
4159 (Output_section_incremental_inputs::set_final_data_size): Calculate
4160 size of incremental_got_plt section.
4161 (Output_section_incremental_inputs::do_write): Write the
4162 incremental_got_plt section.
4163 (Got_plt_view_info): New struct.
4164 (Local_got_offset_visitor): New class.
4165 (Global_got_offset_visitor): New class.
4166 (Global_symbol_visitor_got_plt): New class.
4167 (Output_section_incremental_inputs::write_got_plt): New function.
4168 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4169 Add parameter. Adjust all callers.
4170 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4171 (Incremental_inputs::got_plt_section): New function.
4172 (Incremental_inputs::got_plt_section_): New data member.
4173 (Incremental_got_plt_reader): New class.
4174 * layout.cc (Layout::create_incremental_info_sections): Add the
4175 incremental_got_plt section.
4176 * object.h (Got_offset_list::get_list): New function.
4177 (Got offset_list::for_all_got_offsets): New function.
4178 (Sized_relobj::local_got_offset_list): New function.
4179 * powerpc.cc (Target_powerpc::got_size): Add const.
4180 (Target_powerpc::got_entry_count): New function.
4181 (Target_powerpc::plt_entry_count): New function.
4182 (Target_powerpc::first_plt_entry_offset): New function.
4183 (Target_powerpc::plt_entry_size): New function.
4184 (Output_data_plt_powerpc::entry_count): New function.
4185 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4186 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4187 * sparc.cc (Target_sparc::got_size): Add const.
4188 (Target_sparc::got_entry_count): New function.
4189 (Target_sparc::plt_entry_count): New function.
4190 (Target_sparc::first_plt_entry_offset): New function.
4191 (Target_sparc::plt_entry_size): New function.
4192 (Output_data_plt_sparc::entry_count): New function.
4193 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4194 (Output_data_plt_sparc::get_plt_entry_size): New function.
4195 * symtab.h (Symbol::got_offset_list): New function.
4196 (Symbol_table::for_all_symbols): New function.
4197 * target.h (Sized_target::got_entry_count): New function.
4198 (Sized_target::plt_entry_count): New function.
4199 (Sized_target::plt_entry_size): New function.
4200 * x86_64.cc (Target_x86_64::got_size): Add const.
4201 (Target_x86_64::got_entry_count): New function.
4202 (Target_x86_64::plt_entry_count): New function.
4203 (Target_x86_64::first_plt_entry_offset): New function.
4204 (Target_x86_64::plt_entry_size): New function.
4205 (Output_data_plt_x86_64::entry_count): New function.
4206 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4207 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4208
09ec0418
CC
42092010-08-12 Cary Coutant <ccoutant@google.com>
4210
4211 * archive.cc: Include incremental.h.
4212 (Archive::Archive): Initialize incremental_info_.
4213 (Archive::include_member): Record archive members in incremental info.
4214 (Add_archive_symbols::run): Record begin and end of an archive in
4215 incremental info.
4216 (Lib_group::include_member): Record objects in incremental info.
4217 * archive.h (Incremental_archive_entry): Forward declaration.
4218 (Archive::set_incremental_info): New member function.
4219 (Archive::incremental_info): New member function.
4220 (Archive::Unused_symbol_iterator): New class.
4221 (Archive::unused_symbols_begin): New member function.
4222 (Archive::unused_symbols_end): New member function.
4223 (Archive::incremental_info_): New data member.
4224 * incremental-dump.cc (find_input_containing_global): New function.
4225 (dump_incremental_inputs): Dump new incremental info sections.
4226 * incremental.cc: Include symtab.h.
4227 (Output_section_incremental_inputs): New class.
4228 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4229 new incremental info sections.
4230 (Sized_incremental_binary::do_check_inputs): Likewise.
4231 (Incremental_inputs::report_archive): Remove.
4232 (Incremental_inputs::report_archive_begin): New function.
4233 (Incremental_inputs::report_archive_end): New function.
4234 (Incremental_inputs::report_object): New function.
4235 (Incremental_inputs::finalize_inputs): Remove.
4236 (Incremental_inputs::report_input_section): New function.
4237 (Incremental_inputs::report_script): Rewrite.
4238 (Incremental_inputs::finalize): Do nothing but finalize string table.
4239 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4240 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4241 (Incremental_inputs::create_data_sections): New function.
4242 (Incremental_inputs::relocs_entsize): New function.
4243 (Output_section_incremental_inputs::set_final_data_size): New function.
4244 (Output_section_incremental_inputs::do_write): New function.
4245 (Output_section_incremental_inputs::write_header): New function.
4246 (Output_section_incremental_inputs::write_input_files): New function.
4247 (Output_section_incremental_inputs::write_info_blocks): New function.
4248 (Output_section_incremental_inputs::write_symtab): New function.
4249 * incremental.h (Incremental_script_entry): Forward declaration.
4250 (Incremental_object_entry): Forward declaration.
4251 (Incremental_archive_entry): Forward declaration.
4252 (Incremental_inputs): Forward declaration.
4253 (Incremental_inputs_header_data): Remove.
4254 (Incremental_inputs_header): Remove.
4255 (Incremental_inputs_header_write): Remove.
4256 (Incremental_inputs_entry_data): Remove.
4257 (Incremental_inputs_entry): Remove.
4258 (Incremental_inputs_entry_write): Remove.
4259 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4260 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4261 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4262 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4263 Likewise.
4264 (Incremental_input_entry): New class.
4265 (Incremental_script_entry): New class.
4266 (Incremental_object_entry): New class.
4267 (Incremental_archive_entry): New class.
4268 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4269 (Incremental_inputs::report_inputs): Remove.
4270 (Incremental_inputs::report_archive): Remove.
4271 (Incremental_inputs::report_archive_begin): New function.
4272 (Incremental_inputs::report_archive_end): New function.
4273 (Incremental_inputs::report_object): Change prototype.
4274 (Incremental_inputs::report_input_section): New function.
4275 (Incremental_inputs::report_script): Change prototype.
4276 (Incremental_inputs::get_reloc_count): New function.
4277 (Incremental_inputs::set_reloc_count): New function.
4278 (Incremental_inputs::create_data_sections): New function.
4279 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4280 (Incremental_inputs::inputs_section): New function.
4281 (Incremental_inputs::symtab_section): New function.
4282 (Incremental_inputs::relocs_section): New function.
4283 (Incremental_inputs::get_stringpool): Add const.
4284 (Incremental_inputs::command_line): Add const.
4285 (Incremental_inputs::inputs): Remove.
4286 (Incremental_inputs::command_line_key): New function.
4287 (Incremental_inputs::input_file_count): New function.
4288 (Incremental_inputs::input_files): New function.
4289 (Incremental_inputs::relocs_entsize): New function.
4290 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4291 (Incremental_inputs::finalize_inputs): Remove.
4292 (Incremental_inputs::Input_info): Remove.
4293 (Incremental_inputs::lock_): Remove.
4294 (Incremental_inputs::inputs_): Change type.
4295 (Incremental_inputs::inputs_map_): Remove.
4296 (Incremental_inputs::current_object_entry_): New data member.
4297 (Incremental_inputs::inputs_section_): New data member.
4298 (Incremental_inputs::symtab_section_): New data member.
4299 (Incremental_inputs::relocs_section_): New data member.
4300 (Incremental_inputs::reloc_count_): New data member.
4301 (Incremental_inputs_reader): New class.
4302 (Incremental_symtab_reader): New class.
4303 (Incremental_relocs_reader): New class.
4304 * layout.cc (Layout::finalize): Move finalization of incremental info
4305 and creation of incremental info sections to follow finalization of
4306 symbol table. Set offsets for postprocessing sections.
4307 (Layout::create_incremental_info_sections): Call
4308 Incremental_inputs::create_data_sections. Add incremental symtab
4309 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4310 sections to layout after input sections.
4311 * layout.h (struct Timespec): Forward declaration.
4312 (Layout::incremental_inputs): Add const.
4313 (Layout::create_incremental_info_sections): Add parameter.
4314 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4315 * object.cc: Include incremental.h.
4316 (Relobj::finalize_incremental_relocs): New function.
4317 (Sized_relobj::do_layout): Record input sections in incremental info.
4318 * object.h (Object::output_section): New function.
4319 (Object::output_section_offset): Moved from Relobj.
4320 (Object::get_incremental_reloc_base): New function.
4321 (Object::get_incremental_reloc_count): New function.
4322 (Object::do_output_section): New function.
4323 (Object::do_output_section_offset): Moved from Relobj.
4324 (Object::do_get_incremental_reloc_base): New function.
4325 (Object::do_get_incremental_reloc_count): New function.
4326 (Object::Object): Initialize new data members.
4327 (Relobj::output_section): Renamed do_output_section and moved to
4328 protected.
4329 (Relobj::output_section_offset): Moved to Object.
4330 (Relobj::do_get_incremental_reloc_base): New function.
4331 (Relobj::do_get_incremental_reloc_count): New function.
4332 (Relobj::allocate_incremental_reloc_counts): New function.
4333 (Relobj::count_incremental_reloc): New function.
4334 (Relobj::finalize_incremental_relocs): New function.
4335 (Relobj::next_incremental_reloc_index): New function.
4336 (Relobj::reloc_counts_): New data member.
4337 (Relobj::reloc_bases_): New data member.
4338 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4339 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4340 (Sized_relobj::incremental_relocs_scan): New function.
4341 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4342 (Sized_relobj::incremental_relocs_write): New function.
4343 (Sized_relobj::incremental_relocs_write_reltype): New function.
4344 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4345 incremental link.
4346 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4347 archives and object files elsewhere.
4348 (Add_symbols::run): Report object files here.
4349 (Finish_group::run): Report end of archive at end of group.
4350 * reloc.cc: Include layout.h, incremental.h.
4351 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4352 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4353 (Sized_relobj::incremental_relocs_scan): New function.
4354 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4355 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4356 (Sized_relobj::incremental_relocs_write): New function.
4357 (Sized_relobj::incremental_relocs_write_reltype): New function.
4358 * script.cc (read_input_script): Rewrite test for incremental link.
4359 Change call to Incremental_inputs::report_script.
4360 * symtab.h (Symbol_table::first_global_index): New function.
4361 (Symbol_table::output_count): New function.
4362
ce0d1972
DK
43632010-08-12 Doug Kwan <dougkwan@google.com>
4364
4365 * arm.cc (Target_arm::merge_object_attributes): Check command line
4366 options --no-wchar-size-warning and --no-enum-size-warning.
4367 * options.h (General_options): Add ld-compatible options
4368 --no-enum-size-warning and --no-wchar-size-warning.
4369
6e5710ce
ILT
43702010-08-04 Ian Lance Taylor <iant@google.com>
4371
4372 * x86_64.cc (Target_x86_64::Scan::local): Use
4373 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4374 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4375 (Target_x86_64::Scan::global): Likewise.
4376 (Target_x86_64::Relocate::relocate): Likewise.
4377 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4378 Likewise.
4379
fef830db
CC
43802010-08-03 Cary Coutant <ccoutant@google.com>
4381
4382 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4383 to reserve space in merged_strings vector. Keep total input size
4384 for stats.
4385 (Output_merge_string::do_print_merge_stats): Print total input size.
4386 * merge.h (Output_merge_string): Add input_size_ field.
4387 * stringpool.cc (Stringpool_template::string_length): Move
4388 implementations out of Stringpool_template class and place in
4389 stringpool.h.
4390 * stringpool.h (string_length): Move out of Stringpool_template.
4391
1e3811b0
ILT
43922010-08-03 Ian Lance Taylor <iant@google.com>
4393
4394 PR 11712
4395 * layout.cc (relaxation_loop_body): If address of load segment is
4396 set, adjust address to include headers if possible.
4397
7af0c620
ILT
43982010-08-03 Ian Lance Taylor <iant@google.com>
4399
4400 * version.cc (version_string): Bump to 1.10.
4401
22f0da72
ILT
44022010-08-03 Ian Lance Taylor <iant@google.com>
4403
4404 PR 11805
4405 * layout.h (enum Output_section_order): Define.
4406 (class Layout): Update declarations.
4407 * layout.cc (Layout::get_output_section): Add order parameter.
4408 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4409 is_first_non_relro parameters. Change all callers.
4410 (Layout::choose_output_section): Likewise.
4411 (Layout::add_output_section_data): Likewise.
4412 (Layout::make_output_section): Likewise. Set order.
4413 (Layout::default_section_order): New function.
4414 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4415 * output.cc (Output_section::Output_section): Initialize order_.
4416 Don't initialize deleted fields.
4417 (Output_segment::Output_segment): Don't initialize deleted
4418 fields.
4419 (Output_segment::add_output_section_to_load): New function
4420 replacing add_output_section. Change all callers to call this or
4421 add_output_section_to_nonload.
4422 (Output_segment::add_output_section_to_nonload): New function.
4423 (Output_segment::remove_output_section): Rewrite.
4424 (Output_segment::add_initial_output_data): Likewise.
4425 (Output_segment::has_any_data_sections): Likewise.
4426 (Output_segment::is_first_section_relro): Likewise.
4427 (Output_segment::maximum_alignment): Likewise.
4428 (Output_segment::has_dynamic_reloc): New function replacing
4429 dynamic_reloc_count. Change all callers.
4430 (Output_segment::has_dynamic_reloc_list): New function replacing
4431 dynamic_reloc_count_list. Change all callers.
4432 (Output_segment::set_section_addresses): Rewrite.
4433 (Output_segment::set_offset): Rewrite.
4434 (Output_segment::find_first_and_last_list): Remove.
4435 (Output_segment::set_tls_offsets): Rewrite.
4436 (Output_segment::first_section_load_address): Likewise.
4437 (Output_segment::output_section_count): Likewise.
4438 (Output_segment::section_with_lowest_load_address): Likewise.
4439 (Output_segment::write_section_headers): Likewise.
4440 (Output_segment::print_sections_to_map): Likewise.
4441 * output.h (class Output_data): Remove dynamic_reloc_count_
4442 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4443 (Output_data::add_dynamic_reloc): Rewrite.
4444 (Output_data::has_dynamic_reloc): New function.
4445 (Output_data::dynamic_reloc_count): Remove.
4446 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4447 is_last_relro_, is_first_non_relro_, is_interp_,
4448 is_dynamic_linker_section_ fields. Add order and set_order
4449 functions. Remove is_relro_local, set_is_relro_local,
4450 is_last_relro, set_is_last_relro, is_first_non_relro,
4451 set_is_first_non_relro functions, is_interp, set_is_interp,
4452 is_dynamic_linker_section, and set_is_dynamic_linker_section
4453 functions.
4454 (class Output_segment): Change Output_data_list from std::list to
4455 std:;vector. Add output_lists_ field. Remove output_data_ and
4456 output_bss_ fields. Update declarations.
4457
3ff2ccb0
ILT
44582010-08-02 Ian Lance Taylor <iant@google.com>
4459
4460 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4461 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4462 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4463
88a4108b
ILT
44642010-08-02 Ian Lance Taylor <iant@google.com>
4465
4466 PR 11855
4467 * script.cc (Script_options::Script_options): Initialize
4468 symbol_definitions_ and symbol_references_.
4469 (Script_options::add_symbol_assignment): Update
4470 symbol_definitions_ and symbol_references_.
4471 (Script_options::add_symbol_reference): New function.
4472 (script_symbol): New function.
4473 * script.h (class Script_options): Add symbol_definitions_ and
4474 symbol_references_ fields.
4475 (Script_options::referenced_const_iterator): New type.
4476 (Script_options::referenced_begin): New function.
4477 (Script_options::referenced_end): New function.
4478 (Script_options::is_referenced): New function.
4479 (Script_options::any_unreferenced): New function.
4480 * script-c.h (script_symbol): Declare.
4481 * yyscript.y (exp): Call script_symbol.
4482 * symtab.cc: Include "script.h".
4483 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4484 Change all callers. Check symbols referenced by scripts.
4485 (Symbol_table::add_undefined_symbols_from_command_line): Add
4486 layout parameter. Change all callers.
4487 (Symbol_table::do_add_undefined_symbols_from_command_line):
4488 Likewise. Break out loop body. Check symbols referenced by
4489 scripts.
4490 (Symbol_table::add_undefined_symbol_from_command_line): New
4491 function broken out of
4492 do_add_undefined_symbols_from_command_line.
4493 * symtab.h (class Symbol_table): Update declarations.
4494 * archive.cc: Include "layout.h".
4495 (Archive::should_include_member): Add layout parameter. Change
4496 all callers. Check for symbol mentioned in expression.
4497 * archive.h (class Archive): Update declaration.
4498 * object.cc (Sized_relobj::do_should_include_member): Add layout
4499 parameter.
4500 * object.h (Object::should_include_member): Add layout parameter.
4501 Change all callers.
4502 (Object::do_should_include_member): Add layout parameter.
4503 (class Sized_relobj): Update declaration.
4504 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4505 parameter.
4506 * dynobj.h (class Sized_dynobj): Update declaration.
4507 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4508 layout parameter.
4509 * plugin.h (class Sized_pluginobj): Update declaration.
4510
5f1ab67a
ILT
45112010-08-02 Ian Lance Taylor <iant@google.com>
4512
4513 PR 11866
4514 * output.cc (Output_segment::set_offset): Search for the first and
4515 last sections rather than assuming that the list is in order.
4516 (Output_segment::find_first_and_last_list): New function.
4517 * output.h (class Output_segment): Update declarations.
4518 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4519 (relro_strip_test_SOURCES): New variable.
4520 (relro_strip_test_DEPENDENCIES): New variable.
4521 (relro_strip_test_LDFLAGS): New variable.
4522 (relro_strip_test_LDADD): New variable.
4523 (relro_strip_test.so): New target.
4524
a8df5856
ILT
45252010-08-02 Ian Lance Taylor <iant@google.com>
4526
4527 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4528 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4529 (Target_i386::got_tlsdesc_section): New function.
4530 (Target_i386::got_section): Create space for GOT entries for
4531 TLSDESC relocations.
4532 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4533 R_386_TLS_GOTDESC.
4534 (Target_i386::Scan::global): Likewise.
4535 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4536 using TLSDESC GOT.
4537 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4538 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4539 (Target_x86_64::got_tlsdesc_section): New function.
4540 (Target_x86_64::got_section): Create space for GOT entries for
4541 TLSDESC relocations.
4542 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4543 R_386_TLS_GOTDESC.
4544 (Target_x86_64::Scan::global): Likewise.
4545 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4546 using TLSDESC GOT.
4547
0c10a0a6
ILT
45482010-08-02 Ian Lance Taylor <iant@google.com>
4549
4550 * testsuite/final_layout.sh: Use dc to convert from hex to
4551 decimal.
4552
41cbeecc
ST
45532010-07-29 Sriraman Tallam <tmsriram@google.com>
4554
4555 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4556 paramter to the call to gold::gc_process_relocs.
4557 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4558 paramter to the call to gold::gc_process_relocs.
4559 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4560 parameter to the call to gold::gc_process_relocs.
4561 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4562 template parameter to the call to gold::gc_process_relocs.
4563 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4564 paramter to the call to gold::gc_process_relocs.
4565 * gc.h (get_embedded_addend_size): New function.
4566 (gc_process_relocs): Save the size of the reloc for use by ICF.
4567 * icf.cc (get_section_contents): Get the addend from the text section
4568 for SHT_REL relocation sections.
4569 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4570 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4571 * int_encoding.h (read_from_pointer): New overloaded function.
4572 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4573 * testsuite/icf_sht_rel_addend_test.sh: New file.
4574 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4575 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4576
6ea55b82
RW
45772010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4578
4579 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4580 * Makefile.in: Regenerate.
4581 * testsuite/Makefile.in: Regenerate.
4582
9691462b
ILT
45832010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4584
4585 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4586 * gold/testsuite/debug_msg.cc: Likewise.
4587 * gold/testsuite/odr_violation1.cc
4588 * gold/testsuite/odr_violation2.cc
4589
76897331
CC
45902010-07-21 Cary Coutant <ccoutant@google.com>
4591
4592 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4593 string, and length fields.
4594 (Output_merge_string::Merged_strings_list): New type.
4595 (Output_merge_string::Merged_strings_lists): New typedef.
4596 (Output_merge_string): Replace merged_strings_ with
4597 merged_strings_lists_.
4598 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4599 Merged_strings_list per input object and section. Don't store pointer
4600 to the string. Don't store length with each merged string entry.
4601 (Output_merge_string::finalize_merged_data): Loop over list of merged
4602 strings lists. Recompute length of each merged string.
4603
78384e8f
CC
46042010-07-15 Cary Coutant <ccoutant@google.com>
4605
4606 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4607 here.
4608
783659f9
ILT
46092010-07-14 Ian Lance Taylor <iant@google.com>
4610
4611 * descriptors.cc (Descriptors::open): Report correct name in error
4612 message.
4613
131687b4
DK
46142010-07-13 Doug Kwan <dougkwan@google.com>
4615
4616 * arm.cc (Arm_input_section::Arm_input_section): For a
4617 SHT_ARM_EXIDX section, always keeps the input sections.
4618 (Arm_input_section::set_exidx_section_link): New method.
4619 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4620 has_errors_ to false.
4621 (Arm_exidx_input_section::has_errors,
4622 Arm_exidx_input_section::set_has_errors): New methods.
4623 (Arm_exidx_input_section::has_errors_): New data member.
4624 (Arm_relobj::get_exidx_shndx_list): New method.
4625 (Arm_output_section::append_text_sections_to_list): Do not skip
4626 section without SHF_EXECINSTR.
4627 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4628 errors.
4629 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4630 section header. Make error messages more verbose. Check for
4631 a non-executable section linked to an EXIDX section.
4632 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4633 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4634 check that there is no deferred EXIDX section if we exit early.
4635 Instead of not making an EXIDX section in case of an error, make one
4636 and set the has_errors flag of it.
4637 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4638 in a relocatable link.
4639 (Target_arm::do_relax): Look for the EXIDX output section instead of
4640 assuming that it is called .ARM.exidx.
4641 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4642 section list. Do not check for SHF_EXECINSTR section flags but
4643 skip any input section with errors.
4644 * output.cc (Output_section::Output_section): Initialize
4645 always_keeps_input_sections_ to false.
4646 (Output_section::add_input_section): Check for
4647 always_keeps_input_sections_.
4648 * output.h (Output_section::always_keeps_input_sections,
4649 Output_section::set_always_keeps_input_sections): New methods.
4650 (Output_section::always_keeps_input_sections): New data member.
4651
69517287
RÁE
46522010-07-13 Rafael Espindola <espindola@google.com>
4653
4654 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4655 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4656
82742395
ILT
46572010-07-13 Philip Herron <herron.philip@googlemail.com>
4658 Ian Lance Taylor <iant@google.com>
4659
4660 * output.h (Output_section_lookup_maps::add_merge_section):
4661 Correct check of whether value was inserted.
4662 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4663 (Output_section_lookup_maps::add_relaxed_input_section):
4664 Likewise.
4665 * arm.cc (Target_arm::got_section): Remove used local os.
4666 * i386.cc (Target_i386::got_section): Likewise.
4667 * x86_64.cc (Target_x86_64::got_section): Likewise.
4668 * sparc.cc (Target_sparc::got_section): Likewise.
4669 (Target_sparc::relocate): Remove unused local have_got_offset.
4670 * powerpc.cc (Target_powerpc::relocate): Likewise.
4671
f2d707b5
ILT
46722010-07-13 Ian Lance Taylor <iant@google.com>
4673
241531d6
ILT
4674 * compressed_output.cc (zlib_decompress): Fix signature in
4675 !HAVE_ZLIB_H case.
4676
f2d707b5
ILT
4677 * archive.cc (Archive::include_member): Unlock an external member
4678 of a thin archive. Don't bother to delete an object we know is
4679 NULL.
4680
a2e47362
CC
46812010-07-12 Cary Coutant <ccoutant@google.com>
4682
4683 * compressed_output.cc (zlib_decompress): New function.
4684 (get_uncompressed_size): New function.
4685 (decompress_input_section): New function.
4686 * compressed_output.h (get_uncompressed_size): New function.
4687 (decompress_input_section): New function.
4688 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4689 Handle compressed debug sections.
4690 * layout.cc (is_compressed_debug_section): New function.
4691 (Layout::output_section_name): Map compressed section names to
4692 canonical names.
4693 * layout.h (is_compressed_debug_section): New function.
4694 (is_debug_info_section): Recognize compressed debug sections.
4695 * merge.cc: Include compressed_output.h.
4696 (Output_merge_data::do_add_input_section): Handle compressed
4697 debug sections.
4698 (Output_merge_string::do_add_input_section): Handle compressed
4699 debug sections.
4700 * object.cc: Include compressed_output.h.
4701 (Sized_relobj::Sized_relobj): Initialize new data members.
4702 (build_compressed_section_map): New function.
4703 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4704 * object.h (Object::section_is_compressed): New method.
4705 (Object::do_section_is_compressed): New method.
4706 (Sized_relobj::Compressed_section_map): New type.
4707 (Sized_relobj::do_section_is_compressed): New method.
4708 (Sized_relobj::compressed_sections_): New data member.
4709 * output.cc (Output_section::add_input_section): Handle compressed
4710 debug sections.
4711 * reloc.cc: Include compressed_output.h.
4712 (Sized_relobj::write_sections): Handle compressed debug sections.
4713
ce279a62
CC
47142010-07-08 Cary Coutant <ccoutant@google.com>
4715
4716 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4717 weak when resolving to a dynamic def.
4718 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4719 for weak undef/dynamic def cases. Adjust callers.
4720 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4721 undef_binding_weak_.
4722 (Symbol_table::sized_write_globals): Adjust symbol binding.
4723 (Symbol_table::sized_write_symbol): Add binding parameter.
4724 * symtab.h (Symbol::set_undef_binding): New method.
4725 (Symbol::is_undef_binding_weak): New method.
4726 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4727 (Symbol_table::should_override): Add new parameter.
4728 (Symbol_table::sized_write_symbol): Add new parameter.
4729
4730 * testsuite/weak_undef_file1.cc: Add new test case.
4731 * testsuite/weak_undef_file2.cc: Fix header comment.
4732 * testsuite/weak_undef_test.cc: Add new test case.
4733
b2286c10
DK
47342010-06-29 Doug Kwan <dougkwan@google.com>
4735
4736 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4737 Initialize USE_SYMBOL_.
4738 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4739 definition.
4740 (Arm_reloc_property::uses_symbol_): New data member declaration.
4741 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4742 uses symbol value and symbol is undefined but not weakly undefined.
4743
4802450a
RÁE
47442010-06-28 Rafael Espindola <espindola@google.com>
4745
4746 * plugin.cc (Plugin::load): Use dlerror.
4747
e5ca47ba
ILT
47482010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4749
4750 * symtab.cc (detect_odr_violations): When reporting an ODR
4751 violation, report an object where the symbol is defined.
4752
8a75a161
DK
47532010-06-25 Doug Kwan <dougkwan@google.com>
4754
4755 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4756 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4757 definition.
4758 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4759 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4760 target hook to detect function points.
4761 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4762 * icf.h (Icf::check_section_for_function_pointers): Change type of
4763 parameter SECTION_NAME to const reference to std::string. Use
4764 target hook to determine if section may have unsafe pointers.
4765 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4766 method definition.
4767
42218b9f
RÁE
47682010-06-21 Rafael Espindola <espindola@google.com>
4769
4770 * fileread.cc (Input_file::find_fie): New
4771 (Input_file::open): Use Input_file::find_fie.
4772 * fileread.h (Input_file::find_fie): New
4773 * plugin.cc (set_extra_library_path): New.
4774 (Plugin::load): Add set_extra_library_path to the transfer vector.
4775 (Plugin_manager::set_extra_library_path): New.
4776 (Plugin_manager::add_input_file): Use the extra search path if set.
4777 (set_extra_library_path(): New.
4778 * plugin.h (Plugin_manager): Add set_extra_library_path and
4779 extra_search_path_.
4780
a0506cca
CC
47812010-06-19 Cary Coutant <ccoutant@google.com>
4782
4783 * layout.cc (gdb_sections): Add .debug_types.
4784 (lines_only_debug_sections): Likewise.
4785
6508b958
RÁE
47862010-06-18 Rafael Espindola <espindola@google.com>
4787
4788 * plugin.cc (add_input_file,add_input_library)
4789 (Plugin_manager::add_input_file): Make filename arguments const.
4790 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4791 const.
4792
3e235302
DK
47932010-06-16 Doug Kwan <dougkwan@google.com>
4794
4795 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4796 .ARM.attributes section if we have not merged any input
4797 attributes sections.
4798
106e8a6c
DK
47992010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4800
4801 * arm.cc: Allow combining objects with no EABI version
4802 information.
4803
91ff43fe
RÁE
48042010-06-15 Rafael Espindola <espindola@google.com>
4805
4806 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4807
68ed838c
ILT
48082010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4809
4810 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4811 (struct iovec): Correct !HAVE_READV definition.
4812
f3a2388f
CC
48132010-06-10 Cary Coutant <ccoutant@google.com>
4814
4815 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4816 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4817 reloc sections.
4818 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4819
4820 PR 11683
4821 * symtab.h (Symbol::is_placeholder): New member function.
4822 * target-reloc.h (relocate_section): Check for placeholder symbols.
4823
4824 * testsuite/Makefile.am (plugin_test_8): New test.
4825 (plugin_test_9): New test.
4826 * testsuite/Makefile.in: Regenerate.
4827
e1df38aa
NC
48282010-06-09 Nick Clifton <nickc@redhat.com>
4829
4830 * yyscript.y (input_list_element): Allow strings prefixed with
4831 the '-' character. Treat these as libraries.
4832 * script.cc (script_add_library): New function. Adds a library
4833 specified by "-l<name>" found in an input script.
4834 * script-c.h: Add prototype for script_add_library.
4835
25bbe950
DK
48362010-06-07 Doug Kwan <dougkwan@google.com>
4837
4838 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4839 Restrict stub-group size to be within long conditional branch
4840 range when working around cortex-A8 erratum.
4841
0f32ea4c
ILT
48422010-06-07 Damien Diederen <dd@crosstwine.com>
4843
4844 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4845 #ifdef typo.
4846
8fe2a369
ST
48472010-06-03 Sriraman Tallam <tmsriram@google.com>
4848
4849 PR gold/11658
4850 * output.cc
4851 (Output_section::Input_section_sort_entry::compare_section_ordering):
4852 Change to return non-zero correctly.
4853 (Output_section::Input_section_sort_section_order_index_compare
4854 ::operator()): Change to fix ambiguity in comparisons.
4855
6e9ba2ca
ST
48562010-06-01 Sriraman Tallam <tmsriram@google.com>
4857
4858 * gold.h (is_wildcard_string): New function.
4859 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4860 (Layout::layout_eh_frame): Ditto.
4861 (Layout::find_section_order_index): New method.
4862 (Layout::read_layout_from_file): New method.
4863 * layout.h (Layout::find_section_order_index): New method.
4864 (Layout::read_layout_from_file): New method.
4865 (Layout::input_section_position_): New private member.
4866 (Layout::input_section_glob_): New private member.
4867 * main.cc (main): Call read_layout_from_file here.
4868 * options.h (--section-ordering-file): New option.
4869 * output.cc (Output_section::input_section_order_specified_): New
4870 member.
4871 (Output_section::Output_section): Initialize new member.
4872 (Output_section::add_input_section): Add new parameter.
4873 Keep input sections when --section-ordering-file is used.
4874 (Output_section::set_final_data_size): Sort input sections when
4875 section ordering file is specified.
4876 (Output_section::Input_section_sort_entry): Add new parameter.
4877 Check sorting type.
4878 (Output_section::Input_section_sort_entry::compare_section_ordering):
4879 New method.
4880 (Output_section::Input_section_sort_compare::operator()): Change to
4881 consider section_order_index.
4882 (Output_section::Input_section_sort_init_fini_compare::operator()):
4883 Change to consider section_order_index.
4884 (Output_section::Input_section_sort_section_order_index_compare
4885 ::operator()): New method.
4886 (Output_section::sort_attached_input_sections): Change to sort
4887 according to section order when specified.
e1df38aa
NC
4888 (Output_section::add_input_section<32, true>): Add new parameter.
4889 (Output_section::add_input_section<64, true>): Add new parameter.
4890 (Output_section::add_input_section<32, false>): Add new parameter.
4891 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
4892 * output.h (Output_section::add_input_section): Add new parameter.
4893 (Output_section::input_section_order_specified): New
4894 method.
4895 (Output_section::set_input_section_order_specified): New method.
4896 (Input_section::Input_section): Initialize section_order_index_.
4897 (Input_section::section_order_index): New method.
4898 (Input_section::set_section_order_index): New method.
4899 (Input_section::section_order_index_): New member.
4900 (Input_section::Input_section_sort_section_order_index_compare): New
4901 struct.
4902 (Output_section::input_section_order_specified_): New member.
4903 * script-sections.cc (is_wildcard_string): Delete and move modified
4904 method to gold.h.
4905 (Output_section_element_input::Output_section_element_input): Modify
4906 call to is_wildcard_string.
4907 (Output_section_element_input::Input_section_pattern
4908 ::Input_section_pattern): Ditto.
4909 (Output_section_element_input::Output_section_element_input): Ditto.
4910 * testsuite/Makefile.am (final_layout): New test case.
4911 * testsuite/Makefile.in: Regenerate.
4912 * testsuite/final_layout.cc: New file.
4913 * testsuite/final_layout.sh: New file.
4914
3537c84b
RÁE
49152010-06-01 Rafael Espindola <espindola@google.com>
4916
4917 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4918
105b6afd
RÁE
49192010-06-01 Rafael Espindola <espindola@google.com>
4920
4921 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4922 visibility of symbols.
4923
29e11421
DK
49242010-05-27 Doug Kwan <dougkwan@google.com>
4925
4926 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4927 from start of output section instead of address for a local symbol
4928 in a merged or relaxed section when doing a relocatable link.
4929
5e0f337e
RÁE
49302010-05-26 Rafael Espindola <espindola@google.com>
4931
4932 PR 11604
4933 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4934 adding sections the garbage collector removed.
4935 * gold/testsuite/Makefile.am: Add test.
4936 * gold/testsuite/Makefile.in: Regenerate.
4937 * gold/testsuite/plugin_test_7.sh: New.
4938 * gold/testsuite/plugin_test_7_1.c: New.
4939 * gold/testsuite/plugin_test_7_2.c: New.
4940
f4187277
RÁE
49412010-05-26 Rafael Espindola <espindola@google.com>
4942
4943 * script-sections.cc (Output_section_definition::set_section_addresses):
4944 Check for --section-start.
4945
5c388529
DK
49462010-05-26 Doug Kwan <dougkwan@google.com>
4947
4948 * arm.cc (Arm_scan_relocatable_relocs): New class.
4949 (Target_arm::relocate_special_relocatable): New method.
4950 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4951 (Arm_relocate_functions::thumb_branch_common): Same.
4952 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4953 instead of Default_scan_relocatable_relocs.
4954 * target-reloc.h (relocate_for_relocatable): Let target handle
4955 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4956 * target.h (Sized_target::relocate_special_relocatable): New method.
4957
bca1c3ae
ILT
49582010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4959
4960 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4961
0439c796
DK
49622010-05-23 Doug Kwan <dougkwan@google.com>
4963
4964 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4965 instead of a cast.
4966 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4967 with a direct branch, not a conditional branch, to a stub.
4968 * merge.cc (Output_merge_base::record_input_section): New method
4969 defintion.
4970 (Output_merge_data::do_add_input_section): Record input section if
4971 keeps-input-sections flag is set.
4972 (Output_merge_string::do_add_input_section): Ditto.
4973 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4974 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4975 INPUT_SECTIONS_.
4976 (Output_merge_base::keeps_input_sections,
4977 Output_merge_base::set_keeps_input_sections,
4978 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4979 method definitions.
4980 (Output_merge_base::Input_sections): New type declaration.
4981 (Output_merge_base::input_sections_begin,
4982 Output_merge_base::input_sections_end,
4983 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4984 (Output_merge_base::bool keeps_input_sections_,
4985 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4986 Output_merge_base::input_sections_): New data members.
4987 (Output_merge_data::do_set_keeps_input_sections): New method
4988 defintion.
4989 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4990 * output.cc (Output_section::Input_section::relobj): Move method
4991 defintion from class declaration to here and handle merge sections.
4992 (Output_section::Input_section::shndx): Ditto.
4993 (Output_section::Output_section): Remove initializations of removed
4994 data members and initialize new data member LOOKUP_MAPS_.
4995 (Output_section::add_input_section): Set keeps-input-sections flag
4996 for a newly created merge output section as appropriate. Adjust code
4997 to use Output_section_lookup_maps class.
4998 (Output_section::add_relaxed_input_section): Adjst code for lookup
4999 maps code refactoring.
5000 (Output_section::add_merge_input_section): Add a new parameter
5001 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5002 class. If adding input section to a newly created merge output
5003 section fails, remove the new merge section.
5004 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 5005 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
5006 (Output_section::find_merge_section): Ditto.
5007 (Output_section::build_lookup_maps): New method defintion.
5008 (Output_section::find_relaxed_input_section): Adjust code to use
5009 Output_section_lookup_maps class.
5010 (Output_section::get_input_sections): Export merge sections. Adjust
5011 code to use Output_section_lookup_maps class.
5012 (Output_section:::add_script_input_section): Adjust code to use
5013 Output_section_lookup_maps class. Update lookup maps for merge
5014 sections also.
5015 (Output_section::discard_states): Use Output_section_lookup_maps.
5016 (Output_section::restore_states): Same.
5017 * output.h (Merge_section_properties): Move class defintion out of
5018 Output_section.
5019 (Output_section_lookup_maps): New class.
5020 (Output_section::Input_section::is_merge_section): New method
5021 defintion.
5022 (Output_section::Input_section::relobj): Move defintion out of class
5023 defintion. Declare method only.
5024 (Output_section::Input_section::shndx): Ditto.
5025 (Output_section::Input_section::output_merge_base): New method defintion.
5026 (Output_section::Input_section::u2_.pomb): New union field.
5027 (Output_section::Merge_section_by_properties_map,
5028 Output_section::Output_section_data_by_input_section_map,
5029 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5030 Remove types.
5031 (Output_section::add_merge_input_section): Add new parameter
5032 KEEPS_INPUT_SECTIONS.
5033 (Output_section::build_lookup_maps): New method declaration.
5034 (Output_section::merge_section_map_,
5035 Output_section::merge_section_by_properties_map_,
5036 Output_section::relaxed_input_section_map_,
5037 Output_section::is_relaxed_input_section_map_valid_): Remove data
5038 members.
5039 (Output_section::lookup_maps_): New data member.
5040
76295588
L
50412010-05-21 Doug Kwan <dougkwan@google.com>
5042
5043 PR gold/11619
5044 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5045 avoid a compilation error.
5046
d103a984
RÁE
50472010-05-19 Rafael Espindola <espindola@google.com>
5048
5049 * script-sections.cc (Output_section_definition::allocate_to_segment):
5050 Update the phdrs_list even when the output section is NULL.
5051 * testsuite/Makefile.am: Add test.
5052 * testsuite/Makefile.in: Regenerate.
5053 * testsuite/script_test_9.cc: New.
5054 * testsuite/script_test_9.sh: New.
5055 * testsuite/script_test_9.t: New.
5056
6625d24e
DK
50572010-05-19 Doug Kwan <dougkwan@google.com>
5058
5059 * arm.cc (Arm_input_section::original_size): New method.
5060 (Arm_input_section::do_addralign): Add a cast.
5061 (Arm_input_section::do_output_offset): Remove static cast.
5062 (Arm_input_section::original_addralign,
5063 Arm_input_section::original_size_): Change type to uint32_t.
5064 (Arm_input_section::init): Add safe casts for section alignment
5065 and size.
5066 (Arm_input_section::set_final_data_size): Do not set address and
5067 offset of stub table.
5068 (Arm_output_section::fix_exidx_coverage): Change use of of
5069 Output_section::Simple_input_section to that of
5070 Output_section::Input_section.
5071 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5072 except for the first pass.
5073 * output.cc (Output_section::get_input_sections): Change type of
5074 input_sections to std::list<Input_section>.
5075 (Output_section::add_script_input_section): Rename from
5076 Output_section::add_simple_input_section. Change type of SIS
5077 parameter from Simple_input_section to Input_section.
5078 * output.h (Output_section::Simple_input_section): Remove class.
5079 (Output_section::Input_section): Change class visibility to public.
5080 (Output_section::Input_section::addralign): Use stored alignments
5081 for special input sections if set.
5082 (Output_section::Input_section::set_addralign): New method.
5083 (Output_section::get_input_sections): Change parameter type from
5084 list of Simple_input_section to list of Input_section.
5085 (Output_section::add_script_input_section): Rename from
5086 Output_section::add_simple_input_section. Change first parameter's
5087 type from Simple_input_section to Input_section and remove the
5088 second and third parameters.
5089 * script-sections.cc (Input_section::Input_section_list): Change
5090 type to list of Output_section::Input_section/
5091 (Input_section_info::Input_section_info): Change parameter type of
5092 INPUT_SECTION to Output_section::Input_section.
5093 (Input_section_info::input_section): Change return type.
5094 (Input_section_info::input_section_): Change type to
5095 Output_section::Input_section.
5096 (Output_section_element_input::set_section_addresses): Adjust code
5097 to use Output_section::Input_section instead of
5098 Output_section::Simple_input_section. Adjust code for renaming
5099 of Output_section::add_simple_input_section.
5100 (Orphan_output_section::set_section_addresses): Ditto.
5101
e1e82ea4
RW
51022010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5103
5104 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5105 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5106
91e75c8a
RÁE
51072010-05-18 Rafael Espindola <espindola@google.com>
5108
5109 * options.cc (General_options::finalize): Handle -nostdlib.
5110 * options.h (nostdlib): New option.
5111 * script.cc (script_add_search_dir): Handle -nostdlib.
5112
da59ad79
DK
51132010-05-12 Doug Kwan <dougkwan@google.com>
5114
5115 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5116 attributes section only if there no attributes section after merging.
5117 (Target_arm::merge_object_attributes): Move value of
e1df38aa 5118 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
5119 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5120 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5121 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5122 and arm_attr_merge_7.stdout.
5123 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5124 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5125 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5126 arm_attr_merge_7b.o): New rules.
5127 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5128 arm_attr_merge_7
5129 * testsuite/Makefile.in: Regenerate.
5130 * testsuite/arm_attr_merge.sh: New file.
5131 * testsuite/arm_attr_merge_[67][ab].s: Same.
5132
3e01a7fd
NC
51332010-05-05 Nick Clifton <nickc@redhat.com>
5134
5135 * po/es.po: Updated Spanish translation.
5136
7ad2014a
L
51372010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5138
5139 * Makefile.am (install-exec-local): Properly install gold as
5140 default cross linker.
5141 * Makefile.in: Regenerated.
5142
4fda8867
NC
51432010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5144 Nick Clifton <nickc@redhat.com>
5145
5146 * configure.ac (install_as_default): Define and set to false
5147 unless --enable-gold or --enable-gold=both/gold has been
5148 specified.
5149 * configure: Regenerate.
5150
5151 * Makefile.am (install-exec-local): Install the executable as
5152 'ld.gold'. If install_as_default is true then also install it as
5153 'ld'.
5154 * Makefile.in: Regenerated.
5155
bd288ea2
ILT
51562010-04-24 Ian Lance Taylor <iant@google.com>
5157
5158 * layout.cc (Layout::layout_reloc): In relocatable link don't
5159 combine reloc sections for grouped sections.
5160
ef38fd8a
ST
51612010-04-23 Sriraman Tallam <tmsriram@google.com>
5162
5163 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5164 sections that are not ordinary to icf.
5165 * icf.cc (get_section_contents): Handle relocation pointing to section
5166 with no object or shndx information.
5167 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5168 * testsuite/Makefile.in: Regenerate.
5169 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5170 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5171
f6973bdc
ILT
51722010-04-22 Ian Lance Taylor <iant@google.com>
5173
5174 * expression.cc (Expression::Expression_eval_info): Add
5175 result_alignment_pointer field.
5176 (Expression::eval_with_dot): Add result_alignment_pointer
5177 parameter. Change all callers.
5178 (Expression::eval_maybe_dot): Likewise.
5179 (class Binary_expression): Add alignment_pointer parameter to
5180 left_value and right_value. Change all callers.
5181 (BINARY_EXPRESSION): Set result alignment.
5182 (class Trinary_expression): Add alignment_pointer parameter to
5183 arg2_value and arg3_value. Change all callers.
5184 (Trinary_cond::value): Set result alignment.
5185 (Max_expression::value, Min_expression::value): Likewise.
5186 (Align_expression::value): Likewise.
5187 * script-sections.cc (class Sections_element): Add dot_alignment
5188 parameter to set_section_addresses virtual function. Update
5189 instantiations.
5190 (class Output_section_element): Likewise.
5191 (Script_sections::create_segments): Add dot_alignment parameter.
5192 Change all callers.
5193 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5194 (Script_sections::set_phdrs_clause_addresses): Likewise.
5195 * script-sections.h: Update declarations.
5196 * script.h: Update declarations.
5197 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5198 min_p_align.
5199 * testsuite/script_test_3.t: Set large alignment.
5200 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5201 segment has expected alignment.
5202
9c9c98a5
NC
52032010-04-22 Nick Clifton <nickc@redhat.com>
5204
5205 * po/gold.pot: Updated by the Translation project.
5206 * po/vi.po: Updated Vietnamese translation.
5207
2253bfba
L
52082010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5209
5210 * testsuite/Makefile.am (check_PROGRAMS): Add
5211 icf_virtual_function_folding_test.
5212 * testsuite/Makefile.in: Regenerated.
5213
85fdf906
AH
52142010-04-15 Andrew Haley <aph@redhat.com>
5215
5216 * options.h (merge_exidx_entries): New option.
5217 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5218 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5219 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5220 (Target_arm::merge_exidx_entries): New function.
5221 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5222 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5223 to Arm_exidx_fixup constructor.
5224 Add new arg, merge_exidx_entries.
5225 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5226 Arm_output_section::fix_exidx_coverage.
5227
ce97fa81
ST
52282010-04-18 Sriraman Tallam <tmsriram@google.com>
5229
5230 * icf.cc (get_section_contents): Check for preemptible functions.
5231 Ignore addend when appropriate.
5232 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5233 section folded.
5234 (add_from_relobj): Check for section folded.
5235 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5236 * symtab.h (should_add_dynsym_entry): Add new parameter.
5237 * target-reloc.h (scan_relocs): Check for section folded.
5238 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5239 Check reloc types for function pointers in shared objects.
5240 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5241 case.
5242 (icf_preemptible_functions_test): New test case.
5243 (icf_string_merge_test): New test case.
5244 * testsuite.Makefile.in: Regenerate.
5245 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5246 bar_glob. Refactor code.
5247 * testsuite/icf_preemptible_functions_test.cc: New file.
5248 * testsuite/icf_preemptible_functions_test.sh: New file.
5249 * testsuite/icf_string_merge_test.cc: New file.
5250 * testsuite/icf_string_merge_test.sh: New file.
5251 * testsuite/icf_virtual_function_folding_test.cc: New file.
5252 * testsuite/icf_virtual_function_folding_test.sh: New file.
5253
04ceb17c
DK
52542010-04-14 Doug Kwan <dougkwan@google.com>
5255
5256 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5257 for local symbol recounting if we remove a section due to ICF.
5258 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5259 there are no regular objects in input.
5260
153e7da4
DK
52612010-04-13 Doug Kwan <dougkwan@google.com>
5262
5263 * arm.cc (Arm_input_section::set_final_data_size): Compute
5264 accurate final data size instead of using current data size.
5265
4dbd9faf
DK
52662010-04-09 Doug Kwan <dougkwan@google.com>
5267
5268 * layout.cc (Layout::choose_output_section): Handle script section
5269 types.
5270 (Layout::make_output_section_for_script): Add section type parameter.
5271 Handle script section types.
5272 * layout.h (Layout::make_output_section_for_script): Add section
5273 type parameter.
5274 * output.cc (Output_section::Output_section): Initialize data member
5275 is_noload_.
5276 (Output_section::do_reset_address_and_file_offset): Do not set address
5277 to 0 if section is a NOLOAD section.
5278 * output.h (Output_section::is_noload): New method.
5279 (Output_section::set_is_noload): Ditto.
5280 (Output_section::is_noload_): New data member.
5281 * script-c.h (Script_section_type): New enum type.
5282 (struct Parser_output_section_header): Add new file section_type.
5283 * script-sections.cc (Sections_element::output_section_name): Add
5284 parameter for returning script section type.
5285 (Output_section_definition::output_section_name): Ditto.
5286 (Output_section_definition::section_type)P; New method.
5287 (Output_section_definiton::script_section_type_name): Ditto.
5288 (Output_section_definition::script_section_type_): New data member.
5289 (Output_section_definition::Output_section_definition): Initialize
5290 data member Output_section_definition::script_section_type_.
5291 (Output_section_definition::create_sections): Pass script section type
5292 to Layout::make_output_section_for_script.
5293 (Output_section_definition::output_section_name): Return script
5294 section type to caller.
5295 (Output_section_definition::set_section_address): Do not advance
5296 dot value and load address if section type is NOLOAD. Set address
5297 of NOLOAD sections regardless of section flags.
5298 (Output_section_definition::print): Print section type if it is
5299 not SCRIPT_SECTION_TYPE_NONE.
5300 (Output_section_definition::section_type): New method.
5301 (Output_section_definition::script_section_type_name): Ditto.
5302 (Script_sections::output_section_name): Add new parameter
5303 PSECTION_TYPE for returning script section type. Pass it to
5304 section elements. Handle discard sections.
5305 (Sort_output_sections::operator()): Handle NOLOAD sections.
5306 * script-sections.h (Script_sections::Section_type): New enum type.
5307 (Script_sections::output_section_name): Add a new parameter for
5308 returning script section type.
5309 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5310 INFO and NOLOAD.
5311 * yyscript.y (union): Add new field SECTION_TYPE.
5312 (COPY, DSECT, INFO, NOLOAD): New tokens.
5313 (opt_address_and_section_type): Change type to output_section_header.
5314 (section_type): New non-terminal
5315 (section_header): Handle section type.
2253bfba 5316 (opt_address_and_section_type): Return section type value.
4dbd9faf 5317
721ea635
L
53182010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5319
5320 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5321 * testsuite/plugin_common_test_2.c (foo): Likewise.
5322
6bf924b0
DK
53232010-04-08 Doug Kwan <dougkwan@google.com>
5324
5325 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5326 Output_merge_data.
5327 * output.cc (Output_section::add_merge_input_section): Simplify
5328 code and return status of Output_merge_base::add_input_section.
e1df38aa 5329 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
5330 returns true.
5331
24af6f92
DK
53322010-04-07 Doug Kwan <dougkwan@google.com>
5333
5334 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5335 if section is marked as containing instructions but has no mapping
5336 symbols.
5337 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5338 correct section index.
5339 (Arm_relobj::find_linked_text_section): Ditto.
5340
00698fc5
CC
53412010-04-07 Cary Coutant <ccoutant@google.com>
5342
5343 * archive.cc (include_member): Destroy Read_symbols_data object before
5344 releasing file.
5345 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5346 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5347 (Read_symbols_data::~Read_symbols_data) New destructor.
5348 (Section_relocs::Section_relocs) New constructor.
5349 (Section_relocs::~Section_relocs) New destructor.
5350 (Read_relocs_data::Read_relocs_data) New constructor.
5351 (Read_relocs_data::~Read_relocs_data) New destructor.
5352 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5353 pointers to NULL after deleting.
5354
7296d933
DK
53552010-04-07 Doug Kwan <dougkwan@google.com>
5356
5357 * arm.cc: Replace "endianity" with "endianness" in comments.
5358 (Arm_exidx_cantunwind): Ditto.
5359 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5360 (Arm_relobj::merge_flags_and_attributes): New method.
5361 (Arm_relobj::merge_flags_and_attributes_): New data member.
5362 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5363 (Arm_relobj::scan_sections_for_stubs): Ditto.
5364 (Arm_relobj::do_read_symbols): Check to see if we really want to
5365 merge processor-specific flags and attributes. Exit early if
5366 an object is empty except for section names and the undefined symbol.
5367 (Target_arm::do_finalize_sections): Move check for ELF format to
5368 Arm_relobj::do_read_symbols. Merge processor specific flags and
5369 attributes from a regular object only when we have determined that
5370 it is aapropriate. Do not create an .ARM.attributes section in
5371 output if there is no regular input object.
5372 (Target_arm::merge_processor_specific_flags): Check
5373 --warn-mismatch before printing any error.
5374 (Target_arm::merge_object_attributes): Ditto.
5375 * gold.cc (queue_middle_tasks): Handle the case in which there is
5376 no regular object in input.
5377 * options.cc (General_options::parse_EB): New method.
5378 (General_options::parse_EL): Same.
5379 (General_options::General_options): Initialize endianness_.
5380 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5381 New options.
5382 (General_options::Endianness): New enum.
5383 (General_options::endianness): New method.
5384 (General_options::endianness_): New data member.
5385 * parameters.cc (Parameters::set_options): Check target endianness.
5386 (Parameters::set_target_once): Ditto.
5387 (Parameters::check_target_endianness): New method.
5388 (parameters_force_valid_target): If either -EL or -EB is specified,
5389 use it to define endianness of default target.
5390 * parameters.h (Parameters::check_target_endianness): New method
5391 declaration.
5392 * target.h (class Target): Change "endianity" to "endianness"
5393 in comments.
5394
efc8d4f2
RW
53952010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5396
5397 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5398 * configure: Regenerate.
5399 * Makefile.in: Regenerate.
5400 * testsuite/Makefile.in: Regenerate.
5401
be234d88
CC
54022010-04-06 Cary Coutant <ccoutant@google.com>
5403
5404 gcc PR lto/42757
5405 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5406 prevailing definitions of common symbols.
5407 * testsuite/plugin_test_6.sh: New test case.
5408 * testsuite/plugin_common_test_1.c: New test case.
5409 * testsuite/plugin_common_test_2.c: New test case.
5410 * testsuite/Makefile.am (plugin_test_6): New test case.
5411 * testsuite/Makefile.in: Regenerate.
5412
bd32c6bd
NC
54132010-04-06 Nick Clifton <nickc@redhat.com>
5414
5415 * po/vi.po: New Vietnamese translation.
5416
323c532f
DK
54172010-03-30 Doug Kwan <dougkwan@google.com>
5418
5419 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5420
4fcd97eb
DK
54212010-03-25 Doug Kwan <dougkwan@google.com>
5422
5423 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5424 to avoid a conversion warning on a 32-bit host.
5425
4ebf39db
ILT
54262010-03-24 Ian Lance Taylor <iant@google.com>
5427
5428 * testsuite/script_test_3.t: Add a TLS segment.
5429 * testsuite/Makefile.am (check_PROGRAMS): Add
5430 tls_phdrs_script_test.
5431 (tls_phdrs_script_test_SOURCES): Define.
5432 (tls_phdrs_script_test_DEPENDENCIES): Define.
5433 (tls_phdrs_script_test_LDFLAGS): Define.
5434 (tls_phdrs_script_test_LDADD): Define.
5435 * testsuite/Makefile.in: Rebuild.
5436
4a599bdd
CC
54372010-03-23 Cary Coutant <ccoutant@google.com>
5438
5439 * fileread.cc (find_or_make_view): Fix comment.
5440
6c93b22c
ILT
54412010-03-23 Ian Lance Taylor <iant@google.com>
5442
5443 * script-sections.cc (class Orphan_section_placement): Define
5444 PLACE_TLS and PLACE_TLS_BSS.
5445 (Orphan_section_placement::Orphan_section_placement): Initialize
5446 new places.
5447 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5448 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5449 (tls_script_test_SOURCES): Define.
5450 (tls_script_test_DEPENDENCIES): Define.
5451 (tls_script_test_LDFLAGS): Define.
5452 (tls_script_test_LDADD): Define.
5453 * testsuite/Makefile.in: Rebuild.
5454
a2c7281b
DK
54552010-03-22 Doug Kwan <dougkwan@google.com>
5456
5457 * arm.cc (Arm_relocate_functions::abs8,
5458 Arm_relocate_functions::abs16): Use correct check for overflow
5459 specified in the ARM ELF specs.
5460 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5461 target of a BLX instruction specially.
5462 (Reloc_stub::stub_type_for_reloc): Ditto.
5463 (Relocate::relocate): Use symbolic names instead of numeric relocation
5464 codes to report error.
5465 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5466 workaround.
5467 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5468 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5469 thumb2_blx_out_of_range.stdout
5470 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5471 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5472 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5473 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5474 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5475 thumb2_blx_in_range, thumb2_blx_in_range.o,
5476 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5477 thumb2_blx_out_of_range.o): New rules.
5478 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5479 thumb2_blx_in_range and thumb2_blx_out_of_range.
5480 * testsuite/Makefile.in: Regenerate.
5481 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5482 * testsuite/thumb_blx_in_range.s: New file.
5483 * testsuite/thumb_blx_out_of_range.s: New file.
5484
b0193076
RÁE
54852010-03-22 Rafael Espindola <espindola@google.com>
5486
5487 * archive.cc (Should_include): Move to archive.h.
5488 (should_include_member): Make it a member of Archive.
5489 (Lib_group): New.
5490 (Add_lib_group_symbols): New.
5491 * archive.h: Include options.h.
5492 (Archive_member): Moved from Archive.
5493 (Should_include): Moved from archive.cc.
5494 (Lib_group): New.
5495 (Add_lib_group_symbols): New.
5496 * dynobj.cc (do_should_include_member): New.
5497 * dynobj.h (do_should_include_member): New.
5498 * gold.cc (queue_initial_tasks): Update call to queue.
5499 * main.cc (main): Print lib group stats.
5500 * object.cc (do_should_include_member): New.
5501 * object.h: Include archive.h.
5502 (Object::should_include_member): New.
5503 (Object::do_should_include_member): New.
5504 (Sized_relobj::do_should_include_member): New.
5505 * options.cc (General_options::parse_start_lib): New.
5506 (General_options::parse_end_lib): New.
5507 (Input_arguments::add_file): Handle lib groups.
5508 (Input_arguments::start_group): Check we are not in a lib.
5509 (Input_arguments::start_lib): New.
5510 (Input_arguments::end_lib): New.
5511 * options.h (General_options): Add start_lib and end_lib.
5512 (Input_argument::lib_): New.
5513 (Input_argument::lib): New.
5514 (Input_argument::is_lib): New.
5515 (Input_file_lib): New.
5516 (Input_arguments::in_lib_): New.
5517 (Input_arguments::in_lib): New.
5518 (Input_arguments::start_lib): New.
5519 (Input_arguments::end_lib_): New.
5520 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5521 in unused members as preempted.
5522 (Sized_pluginobj::do_should_include_member): New.
5523 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5524 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5525 return the blocker.
5526 (Read_symbols::do_whole_lib_group): New.
5527 (Read_symbols::do_lib_group): New.
5528 (Read_symbols::do_read_symbols): Handle lib groups.
5529 (Read_symbols::get_name): Handle lib groups.
5530 * readsyms.h (Read_symbols): Add an archive member pointer.
5531 (Read_symbols::do_whole_lib_group): New.
5532 (Read_symbols::do_lib_group): New.
5533 (Read_symbols::member_): New.
5534 * script.cc (read_input_script): Update call to queue_soon.
5535
d099120c
DK
55362010-03-19 Doug Kwan <dougkwan@google.com>
5537
5538 * arm.cc (Stub_table::Stub_table): Initialize new data members
5539 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5540 (Stub_table::add_reloc_stub): Assign stub offset and update
5541 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5542 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5543 New data members.
5544 (Stub_table::update_data_size_and_addralign): Use
5545 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5546 instead of going over all reloc stubs.
5547 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5548 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5549 Stringpool_template::offset_ to size of Stringpool_char.
5550 (Stringpool_template::new_key_offset): Remove code to initialize
5551 Stringpool_template::offset_.
5552 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5553 Stringpool_template::offset_ to zero.
5554
1aa37384
DK
55552010-03-15 Doug Kwan <dougkwan@google.com>
5556
5557 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5558 offset_.
5559 (Stringpool_template::new_key_offset): New method.
5560 (Stringpool_template::add_string): Assign offsets when adding new
5561 strings.
5562 (Stringpool_template::set_string_offsets): Do not set string offsets
5563 when not optimizing.
5564 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5565 member size_.
5566 (Chunked_vector::clear): Clear size_.
5567 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5568 (Chunked_vector::size): Return size_.
5569 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 5570 (Chunked_vector::size_): New data member.
1aa37384
DK
5571 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5572 (Stringpool_template::new_key_offset): New method declaration.
5573 (Stringpool_template::offset_): New data member.
5574
b672b057
RÁE
55752010-03-15 Rafael Espindola <espindola@google.com>
5576
5577 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5578 Add_symbols' constructor.
5579 * readsyms.h (Add_symbols): Remove the input_group member.
5580
b6848d3c
ILT
55812010-03-10 Ian Lance Taylor <iant@google.com>
5582
5583 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5584 target to ask whether a reference to a symbol requires a stack
5585 split.
5586 * target.h (Target::is_call_to_non_split): New function.
5587 (Target::do_is_call_to_non_split): Declare virtual function.
5588 * target.cc: Include "symtab.h".
5589 (Target::do_is_call_to_non_split): New function.
5590 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5591
a2a5469e
CC
55922010-03-10 Cary Coutant <ccoutant@google.com>
5593
5594 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5595 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5596 (File_read::open[2]): Add whole_file_view_ to list of views.
5597 (File_read::make_view): Remove test of whole_file_view_.
5598 (File_read::find_or_make_view): Create whole_file_view_ if
5599 necessary.
5600 (File_read::clear_views): Replace bool parameter with enum;
5601 adjust all callers. Don't delete views with permanent data;
5602 do delete cached views and views from archives if
5603 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5604 if clearing the corresponding view.
5605 * fileread.h (File_read::Clear_views_mode): New enum.
5606 (File_read::View::is_permanent_view): New method.
5607 (File_read::clear_views): Replace bool parameter
5608 with enum; adjust all callers.
5609 * options.h (General_options): Change keep_files_mapped option;
5610 add map_whole_files.
5611 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5612 releasing the file.
5613 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5614 the file.
5615
8861f32b
DM
56162010-03-10 David S. Miller <davem@davemloft.net>
5617
5618 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5619
d62d0f5f
ST
56202010-03-09 Sriraman Tallam <tmsriram@google.com>
5621
5622 * icf.cc (get_section_contents): Add '@' marker after processing the
5623 merge reloc.
5624
9177756d
DK
56252010-03-08 Doug Kwan <dougkwan@google.com>
5626
5627 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5628 due to a conversion warning.
5629 (Arm_relobj::update_output_local_symbol_count): Check for local
5630 symbol with unset output index.
5631
9e9e071b
ILT
56322010-03-05 Ian Lance Taylor <iant@google.com>
5633
5634 * options.h (class General_options): Add --spare-dynamic-tags.
5635 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5636 --spare-dynamic-tags.
5637
a81ee015
ILT
56382010-03-05 Ian Lance Taylor <iant@google.com>
5639
5640 * incremental.cc: Include "libiberty.h".
5641
44ec90b9
RO
56422010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5643
5644 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5645 function, is_info_ member.
5646 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5647 (Versions::Versions): Update caller.
5648 (Versions::define_base_version): Likewise.
5649 (Versions::add_def): Likewise.
5650
0897ed3b
ST
56512010-03-03 Sriraman Tallam <tmsriram@google.com>
5652
5653 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5654 (Scan::possible_function_pointer_reloc): New function.
5655 (Scan::local_reloc_may_be_function_pointer): Change to call
5656 possible_function_pointer_reloc.
5657 (Scan::global_reloc_may_be_function_pointer): Ditto.
5658 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5659 relocations in ".data.rel.ro._ZTV" section.
5660 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5661 * testsuite/icf_safe_so_test.cc: Ditto.
5662 * testsuite/icf_safe_test.cc: Ditto.
5663 * testsuite/icf_safe_test.sh: Ditto.
5664
d3bbad62
ILT
56652010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5666 Ian Lance Taylor <iant@google.com>
5667
5668 * target-reloc.h (relocate_section): Check the symbol table index
5669 for -1U before setting the local symbol index.
5670 (scan_relocatable_relocs): If copying the relocation, record that
5671 the local symbol is required.
5672 * object.h (Symbol_value::is_output_symtab_index_set): New
5673 function.
5674 (Symbol_value::may_be_discarded_from_output_symtab): New
5675 function.
5676 (Symbol_value::has_output_symtab_entry): New function.
5677 (Symbol_value::needs_output_symtab_entry): Remove.
5678 (Symbol_value::output_symtab_index): Make sure the symbol index is
5679 set.
5680 (Symbol_value::set_output_symtab_index): Make sure the symbol
5681 index is not set. Make sure the new index is valid.
5682 (Symbol_value::set_must_have_output_symtab_entry): New function.
5683 (Symbol_value::has_output_dynsym_entry): New function.
5684 (Symbol_value::set_output_dynsym_index): Make sure the new index
5685 is valid.
5686 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5687 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5688 local symbol if permitted.
5689 (Sized_relobj::do_finalize_local_symbols): Call
5690 is_output_symtab_index_set rather than needs_output_symtab_entry.
5691 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5692 rather than needs_output_symtab_entry. Call
5693 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5694 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5695 is_output_symtab_index_set rather than needs_output_symtab_entry.
5696 * testsuite/discard_locals_relocatable_test.c: New file.
5697 * testsuite/discard_locals_test.sh: Test -r.
5698 * testsuite/Makefile.am (check_DATA): Add
5699 discard_locals_relocatable_test1.syms,
5700 discard_local_relocatable_test2.syms.
5701 (MOSTLYCLEANFILES): Likewise. Also add
5702 discard_locals_relocatable_test1.lout and
5703 discard_locals_relocatable_test2.out.
5704 (discard_locals_relocatable_test1.syms): New target.
5705 (discard_locals_relocatable_test.o): New target.
5706 (discard_locals_relocatable_test1.out): New target.
5707 (discard_locals_relocatable_test2.syms): New target.
5708 (discard_locals_relocatable_test2.out): New target.
5709 (various): Add missing ../ld-new dependencies.
5710 * testsuite/Makefile.in: Rebuild.
5711
7e8ccf26
NC
57122010-03-03 Nick Clifton <nickc@redhat.com>
5713
5714 * po/fi.po: New Finnish translation.
5715
2a0ff005
DK
57162010-03-01 Doug Kwan <dougkwan@google.com>
5717
5718 * layout.cc (Layout::Layout): Force section types of .init_array*,
5719 .preinit_array* and .fini_array* sections.
5720 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5721 Fix check of return value of std::string::find.().
5722 (Output_section::Input_section_sort_compare::operator()): Remove
5723 comment about .init_array.
5724 (Output_section::Input_section_sort_init_fini_compare::operator()):
5725 New method.
5726 (Output_section::sort_attached_input_sections): Handle .init_array
5727 and .fini_array specially.
5728 * output.h (Output_section::Inut_section_sort_compare): Update
5729 comment.
5730 (Output_section::Input_section_sort_init_fini_compare): New struct.
5731
c3e4ae29
DK
57322010-02-26 Doug Kwan <dougkwan@google.com>
5733
5734 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5735 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5736 * testsuite/debug_msg.sh: Avoid matching source line number for
5737 use of global variable undef_int.
5738
2fd9ae7a
DK
57392010-02-26 Doug Kwan <dougkwan@google.com>
5740
5741 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5742 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5743 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5744 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5745 * options.cc (General_options::General_options): Initialize member
5746 fix_v4bx_.
5747 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5748 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5749 and rm_no_fix_v4bx.stdout
5750 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5751 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5752 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5753 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5754 and arm_no_fix_v4bx.
5755 * Makefile.in: Regenerate.
5756 * testsuite/arm_fix_v4bx.s: New file.
5757 * testsuite/arm_fix_v4bx.sh: Ditto.
5758
67ec7d0b
DK
57592010-02-24 Doug Kwan <dougkwan@google.com>
5760
5761 * arm.cc (Target_arm::got_section): Make the .got section the first
5762 non RELRO section in the data segment.
5763 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5764 suffixes of section names.
5765
10165461
DK
57662010-02-24 Doug Kwan <dougkwan@google.com>
5767
5768 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5769 flags and attributes merging if an input file is a binary file.
5770 * fileread.cc (Input_file::open): Record format of original file.
5771 * fileread.h (Input_file::Format): New enum type.
5772 (Input_file::Input_file): Initialize data member format_.
5773 (Input_file::format): New method definition.
5774 (Input_file::format_):: New data member.
5775
4a54abbb
DK
57762010-02-24 Doug Kwan <dougkwan@google.com>
5777
5778 * arm.cc (Arm_output_data_got): New class.
5779 (ARM_TCB_SIZE): New constant
5780 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5781 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5782 If user uses a script with a SECTIONS clause, issue only a warning
5783 for a misplaced EXIDX input section. Otherwise, issue an error.
5784 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5785 garbage collection.
5786 (Target_arm::got_mode_index_entry): Handle static linking.
5787 (Target_arm::Scan::local): Ditto.
5788 (Target_arm::Scan::global): Ditto.
5789 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5790 all incorrectly implemented relocations.
e1df38aa 5791 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
5792 Arm_output_section::fix_exidx_coverage.
5793 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5794 from ".ARM.exidx." and ".ARM.extab.".
5795
ca419a6f
ILT
57962010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5797
5798 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5799 section if it does not already exist.
5800 * attributes.cc (Attributes_section_data::Attributes_section_data):
5801 Don't crash if size is zero.
5802
135b9c78
ILT
58032010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5804 Ian Lance Taylor <iant@google.com>
5805
5806 * gold.cc (queue_middle_tasks): If no input files were opened,
5807 exit.
5808 * workqueue.h (Task_function::Task_function): Assert that there is
5809 a blocker.
5810
bb0bfe4f
DK
58112010-02-22 Doug Kwan <dougkwan@google.com>
5812
5813 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5814 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5815 types to avoid warnings due to different uint64_t implementations
5816 on different hosts.
5817
2a2b6d42
DK
58182010-02-21 Doug Kwan <dougkwan@google.com>
5819
5820 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5821 handling of the maximum backward branch offset.
5822 (Arm_relocate_functions::thumb_branch_common): Ditto.
5823 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5824 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 5825 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
5826 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5827 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5828 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5829 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5830 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5831 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5832 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5833 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5834 thumb2_bl_out_of_range.o): New rules.
5835 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5836 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5837 thumb2_bl_out_of_range
5838 * testsuite/Makefile.in: Regenerate.
5839 * testsuite/arm_bl_in_range.s: New file.
5840 * testsuite/arm_bl_out_of_range.s: Ditto.
5841 * testsuite/arm_branch_in_range.sh: Ditto.
5842 * testsuite/arm_branch_range.t: Ditto.
5843 * testsuite/thumb2_branch_range.t: Ditto.
5844 * testsuite/thumb_bl_in_range.s: Ditto.
5845 * testsuite/thumb_bl_out_of_range.s: Ditto.
5846 * testsuite/thumb_branch_range.t: Ditto.
5847
b487ad64
ST
58482010-02-20 Sriraman Tallam <tmsriram@google.com>
5849
5850 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5851 Add reloc offset information.
5852 * icf.cc (get_section_contents): Change iterators to point to the new
5853 vectors. Add reloc offset information to the contents.
5854 * icf.h (Icf::Sections_reachable_info): New typedef.
5855 (Icf::Sections_reachable_list): New typedef.
5856 (Icf::Offset_info): New typedef.
5857 (Icf::Reloc_info): New struct typedef.
5858 (Icf::Reloc_info_list): New typedef.
5859 (Icf::symbol_reloc_list): Delete method.
5860 (Icf::addend_reloc_list): Delete method.
5861 (Icf::section_reloc_list): Delete method.
5862 (Icf::reloc_info_list): New method.
5863 (Icf::reloc_info_list_): New member.
5864
f96accdf
DK
58652010-02-19 Doug Kwan <dougkwan@google.com>
5866
5867 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5868 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5869 * arm.cc (Arm_relocation_functions): New forward declaration.
5870 (Target_arm::Target_arm): Initialize new data members
5871 got_mod_index_offset_ and tls_base_symbol_defined_.
5872 (Target_arm::Relocate::relocate_tls): New method.
5873 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5874 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5875 New methods.
5876 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5877 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5878 (Target_arm::got_mod_index_offset_,
5879 Target_arm::tls_base_symbol_defined_): New data members.
5880 (Target_arm::Scan::local, Target::Scan::global,
5881 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5882 relocations.
5883
c8761b9a
DK
58842010-02-18 Doug Kwan <dougkwan@google.com>
5885
5886 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5887 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5888 text section as a parameter becuase some broken tools may not set
5889 the link in section header.
5890 (Target_arm::has_got_section): New method.
5891 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5892 without any mapping symbol as data only. Remove warning.
5893 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5894 link in its section header, try to discover the link by inspecting the
5895 REL31 relocation at the beginning of the section.
5896 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5897 in error message.
5898 (Target_arm::Scan::global): Treat any reference to the symbol
5899 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5900
21bb3914
ST
59012010-02-12 Sriraman Tallam <tmsriram@google.com>
5902
5903 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5904 (Scan::global_reloc_may_be_function_pointer): New function.
5905 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5906 (Scan::global_reloc_may_be_function_pointer): New function.
5907 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5908 (Scan::global_reloc_may_be_function_pointer): New function.
5909 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5910 (Scan::global_reloc_may_be_function_pointer): New function.
5911 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5912 (Scan::global_reloc_may_be_function_pointer): New function.
5913 (Scan::possible_function_pointer_reloc): New function.
5914 (Target_x86_64::can_check_for_function_pointers): New function.
5915 * gc.h (gc_process_relocs): Scan relocation types to determine if
5916 function pointers were taken for targets that support it.
5917 * icf.cc (Icf::find_identical_sections): Include functions for
5918 folding in safe ICF whose pointer is not taken.
5919 * icf.h (Secn_fptr_taken_set): New typedef.
5920 (fptr_section_id_): New member.
5921 (section_has_function_pointers): New function.
5922 (set_section_has_function_pointers): New function.
5923 (check_section_for_function_pointers): New function.
5924 * options.h: Fix comment for safe ICF option.
5925 * target.h (can_check_for_function_pointers): New function.
5926 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5927 Modify icf_safe_test for X86-64.
5928 * testsuite/Makefile.in: Regenerate.
5929 * testsuite/icf_safe_so_test.cc: New file.
5930 * testsuite/icf_safe_so_test.sh: New file.
5931 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5932 (main): Change to take pointer to function kept_func_3.
5933 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5934 folding is done correctly for X86-64.
5935
0da6fa6c
DM
59362010-02-12 David S. Miller <davem@davemloft.net>
5937
5938 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5939 is_symbolless parameter.
5940 (Output_reloc<SHT_REL>::is_symbolless): New.
5941 (Output_reloc<SHT_REL>::is_symbolless_): New.
5942 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5943 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5944 (Output_reloc<SHT_RELA>::is_symbolless): New.
5945 (Output_data_reloc::add_global): Handle is_symbolless.
5946 (Output_data_reloc::add_global_relative): Likewise.
5947 (Output_data_reloc::add_local): Likewise.
5948 (Output_data_reloc::add_local_relative): Likewise.
5949 (Output_data_reloc::add_symbolless_global_addend): New.
5950 (Output_data_reloc::add_symbolless_local_addend): New.
5951 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5952 is_symbolless.
5953 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5954 instead of ->is_relative_
5955 (Output_reloc::write): Likewise.
5956 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5957 (Output_reloc::write_rel): Simplify.
5958
5959 * sparc.cc (Target_sparc::Scan::local): Use
5960 ->add_symbolless_local_addend as needed.
5961 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5962 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5963 based upon relocation offset.
5964
e4782e83
DK
59652010-02-11 Doug Kwan <dougkwan@google.com>
5966
5967 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5968 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5969 beginning of function.
5970 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5971 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5972 parameter is_32bit in calls to should_apply_static_reloc.
5973 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5974 (check_DATA): Add arm_abs_global.stdout.
5975 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5976 arm_abs_global.stdout): New rules.
5977 (MOSTLLYCLEANFILES): Add arm_abs_global
5978 * Makefile.in: Regenerate.
5979 * testsuite/arm_abs_global.s: New file.
5980 * testsuite/arm_abs_global.sh: Ditto.
5981 * testsuite/arm_abs_lib.s: Ditto.
5982
93ceb764
ILT
59832010-02-11 Ian Lance Taylor <iant@google.com>
5984
5985 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5986 Read_relocs task.
5987 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5988 Allocate_commons_task first.
5989 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5990 task, rather than symtab_lock_.
5991 (Gc_process_relocs::~Gc_process_relocs): New function.
5992 (Gc_process_relocs::is_runnable): Check this_blocker_.
5993 (Gc_process_relocs::locks): Use next_blocker_ rather than
5994 blocker_.
5995 (Scan_relocs::~Scan_relocs): New function.
5996 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5997 symtab_lock_.
5998 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5999 next_blocker_.
6000 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6001 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6002 constructor accordingly.
6003 (class Gc_process_relocs): Likewise.
6004 (class Scan_relocs): Likewise.
6005 * common.h (class Allocate_commons_task): Remove symtab_lock_
6006 field, and corresponding constructor parameter.
6007 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6008 symtab_lock_.
6009 (Allocate_commons_task::locks): Likewise.
6010
114dfbe1
ILT
60112010-02-11 Ian Lance Taylor <iant@google.com>
6012
6013 * gold-threads.h (class Once): Define.
6014 (class Initialize_lock): Rewrite as child of Once.
6015 * gold-threads.cc (class Once_initialize): Define.
6016 (once_pointer_control): New static variable.
6017 (once_pointer, once_arg): New static variables.
6018 (c_run_once): New static function.
6019 (Once::Once, Once::run_once, Once::internal_run): New functions.
6020 (class Initialize_lock_once): Remove.
6021 (initialize_lock_control): Remove.
6022 (initialize_lock_pointer): Remove.
6023 (initialize_lock_once): Remove.
6024 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6025 (Initialize_lock::initialize): Rewrite.
6026 (Initialize_lock::do_run_once): New function.
6027 * archive.cc (Archive::interpret_header): Only clear name if it is
6028 not already empty.
6029 * fileread.cc: Include "gold-threads.h"
6030 (file_counts_lock): New static variable.
6031 (file_counts_initialize_lock): Likewise.
6032 (File_read::release): Only increment counts when using --stats.
6033 Use a lock around the increment.
6034 * parameters.cc (class Set_parameters_target_once): Define.
6035 (set_parameters_target_once): New static variable.
6036 (Parameters::Parameters): Move here from parameters.h.
6037 (Parameters::set_target): Rewrite.
6038 (Parameters::set_target_once): New function.
6039 (Parameters::clear_target): Move here and rewrite.
6040 * parameters.h (class Parameters): Update declarations. Add
6041 set_parameters_target_once_ field.
6042 (Parameters::Parameters): Move to parameters.cc.
6043 (Parameters::clear_target): Likewise.
6044 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6045 task.
6046 (Start_group::~Start_group): New function.
6047 (Start_group::is_runnable): New function.
6048 (Start_group::locks, Start_group::run): New functions.
6049 (Finish_group::run): Change saw_undefined to size_t.
6050 * readsyms.h (class Start_group): Define.
6051 (class Finish_group): Change saw_undefined_ field to size_t.
6052 (Finish_group::Finish_group): Remove saw_undefined and
6053 this_blocker parameters. Change all callers.
6054 (Finish_group::set_saw_undefined): New function.
6055 (Finish_group::set_blocker): New function.
6056 * symtab.h (class Symbol_table): Change saw_undefined to return
6057 size_t. Change saw_undefined_ field to size_t.
6058 * target-select.cc (Set_target_once::do_run_once): New function.
6059 (Target_selector::Target_selector): Initialize set_target_once_
6060 field. Don't initialize lock_ and initialize_lock_ fields.
6061 (Target_selector::instantiate_target): Rewrite.
6062 (Target_selector::set_target): New function.
6063 * target-select.h (class Set_target_once): Define.
6064 (class Target_selector): Update declarations. Make
6065 Set_target_once a friend. Remove lock_ and initialize_lock_
6066 fields. Add set_target_once_ field.
6067
fa17a3f4
ILT
60682010-02-10 Ian Lance Taylor <iant@google.com>
6069
6070 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6071 queueing any tasks.
6072 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6073 (queue_middle_tasks): Add all blockers before queueing any tasks.
6074 (queue_final_tasks): Likewise.
6075 * token.h (Task_token::add_blockers): New function.
6076 * object.h (Input_objects::number_of_relobjs): New function.
6077
c7177d31
ILT
60782010-02-10 Ian Lance Taylor <iant@google.com>
6079
5de0e392
ILT
6080 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6081 shared, not if not position independent.
6082 * x86_64.cc (Relocate::relocate_tls): Likewise.
6083 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6084 (tls_pie_pic_test): New target.
6085 * testsuite/Makefile.in: Rebuild.
6086
c7177d31
ILT
6087 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6088 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6089 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6090 * testsuite/Makefile.in: Rebuild.
6091
684b268a
DM
60922010-02-09 David S. Miller <davem@davemloft.net>
6093
6094 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6095 R_SPARC_RELATIVE using ->add_local_relative().
6096 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6097
612a8d3d
DM
6098 * output.h (Output_data_dynamic::add_section_size): New method
6099 that takes two Output_data objects.
6100 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6101 entry param. Handle it in initializers.
6102 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6103 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6104 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6105 arg.
6106 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6107 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6108 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6109 for dynrel_includes_plt.
6110 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6111 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6112 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6113 before .rela.plt
6114 (Target_sparc::do_finalize_sections): Update to pass true for
6115 dynrel_includes_plt.
6116 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6117 output before .rela.plt
6118 (Target_powerpc::do_finalize_sections): Update to pass true for
6119 dynrel_includes_plt when 32-bit.
6120
cb1be87e
DK
61212010-02-08 Doug Kwan <dougkwan@google.com>
6122
6123 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6124 method.
6125 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6126 Arm_relobj::scan_section_for_cortex_a8_stubs,
6127 Arm_relobj::do_relocation_section): Instead of calling
6128 Output_section::output_address, use faster
6129 Arm_relobj::simple_input_section_output_address.
6130
705b5121
DM
61312010-02-08 David S. Miller <davem@davemloft.net>
6132
6133 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6134 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6135 relocation helper function.
6136
024c4466
DM
6137 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6138 just like R_SPARC_GOT{10,13,22}.
6139 (Target_sparc::Scan::local): Likewise.
6140 (Target_sparc::Relocate:relocate): Likewise.
6141
9109c078
ILT
61422010-02-06 Ian Lance Taylor <iant@google.com>
6143
6144 * configure.ac: Rewrite targetobjs duplicate removal code to use
6145 only shell constructs.
6146 * configure: Rebuild.
6147
cf846138
DK
61482010-02-05 Doug Kwan <dougkwan@google.com>
6149
6150 PR 11247
6151 * arm.cc (Arm_relobj::section_is_scannable): New method.
6152 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6153 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6154
6cfaf60b
DK
61552010-02-04 Doug Kwan <dougkwan@google.com>
6156
6157 PR 11247
6158 * arm-reloc-property.cc (cstdio): Include.
6159 * configure.ac (targetobjs): Remove duplicates.
6160 * configure: Regenerate.
6161 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6162 big and little endian version for a given address size.
6163
5c57f1be
DK
61642010-02-03 Doug Kwan <dougkwan@google.com>
6165
6166 * arm-reloc-property.cc
6167 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6168 definition.
6169 * arm-reloc-property.h
6170 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6171 New method definition.
6172 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6173 declaration.
6174 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6175 overflow to N.
6176 (GOT_PREL): Change implemented to Y.
6177 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6178 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6179 (Arm_relocate_functions::movw_abs_nc): Remove method.
6180 (Arm_relocate_functions::movt_abs): Ditto.
6181 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6182 (Arm_relocate_functions::thm_movt_abs): Ditto.
6183 (Arm_relocate_functions::movw_rel_nc): Ditto.
6184 (Arm_relocate_functions::movw_rel): Ditto.
6185 (Arm_relocate_functions::movt_rel): Ditto.
6186 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6187 (Arm_relocate_functions:thm_movw_rel): Ditto.
6188 (Arm_relocate_functions:thm_movt_rel): Ditto.
6189 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6190 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6191 New method definitions.
6192 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6193 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6194 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6195 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6196 (Target_arm::Relocate::relocate): Check for non-static or
6197 unimplemented relocation code and exit early. Change calls to
6198 Target_arm::reloc_uses_thumb_bit and
6199 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6200 instead. Refactor code to handle similar relocations to increase
6201 code sharing. Remove check for unsupported relocation code in switch
6202 statement.
6203 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6204 relocation property table to find out size. Change error message to
6205 print out the name of a relocation code instead of the numeric value.
6206 (Target_arm::scan_reloc_for_stub): Use relocation property table
6207 instead of calling Target_arm::reloc_uses_thumb_bit().
6208
218c5831
DK
62092010-02-02 Doug Kwan <dougkwan@google.com>
6210
6211 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6212 types of relaxed input section.
6213
0d31c79d
DK
62142010-02-02 Doug Kwan <dougkwan@google.com>
6215
6216 * Makefile.am (HFILES): Add arm-reloc-property.h.
6217 (DEFFILES): New.
6218 (TARGETSOURCES): Add arm-reloc-property.cc
6219 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6220 (libgold_a_SOURCES): $(DEFFILES)
6221 * Makefile.in: Regenerate.
6222 * arm-reloc-property.cc: New file.
6223 * arm-reloc-property.h: New file.
6224 * arm-reloc.def: New file.
6225 * arm.cc: Update comments.
6226 (arm-reloc-property.h): New included header.
6227 (arm_reloc_property_table): New global variable.
6228 (Target_arm::do_select_as_default_target): New method definition.
6229 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6230 arm-reloc-property to targ_extra_obj.
6231 * parameters.cc (set_parameters_target): Call
6232 Target::select_as_default_target().
6233 * target.h (Target::select_as_default_target): New method definition.
6234 (Target::do_select_as_default_target): Same.
6235
546c7457
DK
62362010-02-01 Doug Kwan <dougkwan@google.com>
6237
6238 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6239 first_output_text_section_.
6240 (Arm_exidx_fixup::first_output_text_section): New method definition.
6241 (Arm_exidx_fixup::first_output_text_section_): New data member.
6242 (Arm_exidx_fixup::process_exidx_section): Record the first text
6243 output section seen.
6244 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6245 and entsize in output section header.
6246
11b861d5
DK
62472010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6248
6249 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6250 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6251 (Arm_relocate_functions::thm_alu11): New Method.
6252 (Arm_relocate_functions::thm_pc8): New Method.
6253 (Arm_relocate_functions::thm_pc12): New Method.
6254 (Target_arm::Scan::local): Handle the relocations.
6255 (Target_arm::Scan::global): Likewise.
6256 (Target_arm::Relocate::relocate): Likewise.
6257 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6258
c9a2c125
DK
62592010-01-29 Doug Kwan <dougkwan@google.com>
6260
6261 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6262 of relocation types as ld.
6263
1521477a
DK
62642010-01-29 Doug Kwan <dougkwan@google.com>
6265
6266 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6267 to public.
6268 (Arm_relocate_functions::thumb_branch_common): Ditto.
6269 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6270 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6271 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6272 Arm_relocate_functions::jump24): Remove.
6273 (Target_arm::Relocate::relocate): Adjust code to call
6274 Arm_relocation_functions::arm_branch_common and
6275 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 6276 wrappers. Merge switch-cases together to reduce source code size.
1521477a 6277
e7eca48c
DK
62782010-01-29 Doug Kwan <dougkwan@google.com>
6279
6280 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6281 output_local_symbol_count_needs_update_.
6282 (Arm_relobj::output_local_symbol_count_needs_update,
6283 Arm_relobj::set_output_local_symbol_count_needs_update,
6284 Arm_relobj::update_output_local_symbol_count): New methods.
6285 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6286 member.
6287 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6288 of pointed function as in a R_ARM_PREL31 relocation.
6289 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6290 for output local symbol count updating.
6291 (Target_arm::do_relax): Update output local symbol counts in objects
6292 if necessary.
6293 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6294
02961d7e
ILT
62952010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6296
6297 * arm.cc: Added support for the ARM relocations:
6298 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6299 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6300 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6301 movw_prel_nc).
6302 (Arm_relocate_functions::movw_rel): New method.
6303 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6304 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6305 thm_movw_prel_nc).
6306 (Arm_relocate_functions::thm_movw_rel): New method.
6307 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6308 thm_movt_prel).
6309 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6310 relocations.
6311 (Target_arm::Scan::global): Likewise.
6312 (Target_arm::Relocate::relocate): Likewise.
6313 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6314 Likewise.
6315
b10d2873
ILT
63162010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6317
6318 * arm.cc: Added support for ARM group relocations.
6319 (Target_arm::reloc_needs_sym_origin): New method.
6320 (Arm_relocate_functions::calc_grp_kn): New method.
6321 (Arm_relocate_functions::calc_grp_residual): New method.
6322 (Arm_relocate_functions::calc_grp_gn): New method.
6323 (Arm_relocate_functions::arm_grp_alu): New Method.
6324 (Arm_relocate_functions::arm_grp_ldr): New Method.
6325 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6326 (Arm_relocate_functions::arm_grp_ldc): New Method.
6327 (Target_arm::Scan::local): Handle the ARM group relocations.
6328 (Target_arm::Scan::global): Likewise.
6329 (Target_arm::Relocate::relocate): Likewise.
6330 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6331 Likewise.
6332
2b328d4e
DK
63332010-01-26 Doug Kwan <dougkwan@google.com>
6334
6335 * arm.cc (set): Include.
6336 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6337 pointer type.
6338 (Arm_output_section::Text_section_list): New type.
6339 (Arm_output_section::append_text_sections_to_list): New method.
6340 (Arm_output_section::fix_exidx_coverage): Ditto.
6341 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6342 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6343 Relobj::set_section_offset() instead of
6344 Sized_relobj::invalidate_section_offset().
6345 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6346 parameter for section headers. Ignore relocation sections for
6347 unallocated sections and EXIDX sections.
6348 (Target_arm::fix_exidx_coverage): New method.
6349 (Target_arm::output_section_address_less_than): New type.
6350 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6351 linked text section instead of the EXIDX section.
6352 (Arm_output_section::create_stub_group): Add an assertion to check
6353 that this is not an EXIDX output section.
6354 (Arm_output_section::append_text_sections_to_list): New method.
6355 (Arm_output_section::fix_exidx_coverage): Ditto.
6356 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6357 Arm_relobj::section_needs_reloc_stub_scanning.
6358 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6359 first pass.
6360 (Target_arm::fix_exidx_coverage): New method.
6361 * object.h (Relobj::set_output_section): New method.
6362 (Sized_relobj::invalidate_section_offset): Remove method.
6363 (Sized_relobj::do_invalidate_section_offset): Remove method.
6364 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6365
c7f3c371
DK
63662010-01-25 Doug Kwan <dougkwan@google.com>
6367
6368 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6369 Fix warning due to signed and unsigned comparison on a 32-bit host.
6370
8923b24c
DK
63712010-01-22 Doug Kwan <dougkwan@google.com>
6372
6373 * arm.cc (Target_arm::do_relax): Record an output section for section
6374 offset adjustment it contains any stub table that has changed.
6375 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6376 offsets in an output section if necessary.
6377 * output.cc (Output_section::Output_section): Initialize
6378 section_offsets_need_adjustments_.
6379 (Output_section::add_input_section_for_script): Renamed to
6380 Output_section::add_simple_input_section.
6381 (Output_section::save_states): Add a comment.
6382 (Output_section::discard_states): New method defintion.
6383 (Output_section::adjust_section_offsets): Same.
6384 * output.h (Output_section::add_input_section_for_script): Renamed to
6385 Output_section::add_simple_input_section.
6386 (Output_section::discard_states): New method declaration.
6387 (Output_section::adjust_section_offsets): Same.
6388 (Output_section::section_offsets_need_adjustment,
6389 Output_section::set_section_offsets_need_adjustment): New method
6390 definitions.
6391 (Output_section::section_offsets_need_adjustment_): New data member.
6392 * script-sections.cc
6393 (Output_section_element_input::set_section_address): Adjust code for
6394 renaming of Output_section::add_input_section_for_script.
6395 (Orphan_output_section::set_section_address): Same.
6396
9b2fd367
DK
63972010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6398
6399 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6400 Fix_v4bx enum values .
6401 * gold/options.h (General_options): New option definitions.
6402 (General_options::fix_v4bx): New method.
6403 (General_options::Fix_v4bx): New enum.
6404 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6405 (General_options::parse_fix_v4bx_interworking): New method.
6406
80d0d023
DK
64072010-01-22 Doug Kwan <dougkwan@google.com>
6408
6409 * arm.cc (Arm_exidx_fixup): New class.
6410
af2cdeae
DK
64112010-01-21 Doug Kwan <dougkwan@google.com>
6412
6413 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6414 classes.
6415 (Arm_exidx_section_offset_map): New type.
6416
993d07c1
DK
64172010-01-21 Doug Kwan <dougkwan@google.com>
6418
6419 * arm.cc (Arm_exidx_input_section): New class.
6420 (Arm_relobj::exidx_input_section_by_link,
6421 Arm_relobj::exidx_input_section_by_shndx,
6422 Arm_relobj::make_exidx_input_section): New methods.
6423 (read_arm_attributes_section): Remove.
6424 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6425 information about them.
6426 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6427 to here.
6428
5ac169d4
DK
64292010-01-20 Doug Kwan <dougkwan@google.com>
6430
6431 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6432 Input_section_specifier to Section_id.
6433 (Target_arm::new_arm_input_section: Adjust code for change of key
6434 type.
6435 (Target_arm::find_arm_input_section): Ditto.
6436 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6437 (Section_id): Remove.
6438 (Garbage_collection::Section_id_hash): Remove.
6439 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6440 (Section_id): Remove.
6441 (Icf::Section_id_hash): Remove.
6442 * object.h (Section_id, Const_section_id, Section_id_hash,
6443 Const_section_id_hash): New type definitions.
6444 * output.cc (Output_section::add_relaxed_input_section): Change to
6445 use Const_section_id instead of Input_section_specifier as key type.
6446 (Output_section::add_merge_input_section): Ditto.
6447 (Output_section::build_relaxation_map): Change to use Section_id
6448 instead of Input_section_specifier as key type.
6449 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6450 Ditto.
6451 (Output_section::convert_input_sections_to_relaxed_sections): Change
6452 to use Const_section_id instead of Input_section_specifier as key type.
6453 (Output_section::find_merge_section): Ditto.
6454 (Output_section::find_relaxed_input_section): Ditto.
6455 * output.h (Input_section_specifier): Remove class.
6456 (Output_section::Output_section_data_by_input_section_map): Change
6457 key type to Const_section_id.
6458 (Output_section::Output_relaxed_input_section_by_input_section_map):
6459 Ditto.
6460 (Output_section::Relaxation_map): Change key type to Section_id.
6461
a2162063
ILT
64622010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6463
6464 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6465 (class Arm_v4bx_stub): New class.
6466 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6467 (Stub_factory::make_arm_v4bx_stub): New method.
6468 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6469 (Stub_table::empty): Handle v4bx stubs.
6470 (Stub_table::add_arm_v4bx_stub): New method.
6471 (Stub_table::find_arm_v4bx_stub): New method.
6472 (Arm_relocate_functions::v4bx): New method.
6473 (Target_arm::fix_v4bx): New method.
6474 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6475 (Stub_table::relocate_stubs): Likewise.
6476 (Stub_table::do_write): Likewise.
6477 (Stub_table::update_data_size_and_addralign): Likewise.
6478 (Stub_table::finalize_stubs): Likewise.
6479 (Target_arm::Scan::local): Likewise.
6480 (Target_arm::Scan::global): Likewise.
6481 (Target_arm::do_finalize_sections): Likewise.
6482 (Target_arm::Relocate::relocate): Likewise.
6483 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6484 Likewise.
6485 (Target_arm::scan_reloc_for_stub): Likewise.
6486 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6487
5696ab0b
ILT
64882010-01-19 Ian Lance Taylor <iant@google.com>
6489
6490 * output.cc (Output_section_headers::do_sized_write): Write large
6491 segment count to sh_info field.
6492 (Output_file_header::do_sized_write): For large segment count,
6493 write PN_XNUM to e_phnum field.
6494
800d0f56
ILT
64952010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6496
6497 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6498 (Arm_relocate_functions::thm_jump8): New function.
6499 (Arm_relocate_functions::thm_jump11): New function.
6500 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6501 R_ARM_THM_JUMP11.
6502 (Target_arm::Scan::global): Likewise.
6503 (Target_arm::Relocate::relocate): Likewise.
6504 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6505 Likewise.
6506
41263c05
DK
65072010-01-14 Doug Kwan <dougkwan@google.com>
6508
6509 * arm.cc (map, utility): Include headers.
6510 (Target_arm::apply_cortex_a8_workaround): New method.
6511 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6512 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6513 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6514 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6515 the --[no-]fix-cortex-a8 command line options.
6516 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6517 (Target_arm::relocate_stub): Use addend in instruction template.
6518 * options.h (DEFINE_bool): Set the user-set flag.
6519 (General_options): Add --[no-]-fix-cortex options.
6520 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 6521 : Update fast look-up map after conversion.
41263c05 6522
459e9b03
ST
65232010-01-14 Sriraman Tallam <tmsriram@google.com>
6524
6525 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6526 in the first pass of do_layout.
6527
b521dfe4
DK
65282010-01-13 Doug Kwan <dougkwan@google.com>
6529
6530 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6531 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6532 apparent compiler problem of not folding static constant integral
6533 data members of elfcpp::Elf_sizes<32>.
6534
44272192
DK
65352010-01-13 Doug Kwan <dougkwan@google.com>
6536
6537 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6538 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6539 Arm_relobj::scan_section_for_cortex_a8_erratum,
6540 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6541 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6542 sections to scan for relocation stubs into a new method
6543 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6544 relocation and Cortex-A8 stub scanning.
6545 (Target_arm::do_relax): Force stubs to be after stubbed sections
6546 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 6547 the beginning of a new relaxation pass. Update a comment.
44272192
DK
6548 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6549
44b71ece
ILT
65502010-01-12 Ian Lance Taylor <iant@google.com>
6551
6552 * target-reloc.h (visibility_error): New inline function.
6553 (relocate_section): Call visibility_error.
6554 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6555 (MOSTLYCLEANFILES): Likewise.
6556 (protected_4_pic.o, protected_3.err): New targets.
6557 * testsuite/protected_4.cc: New file.
6558
a120bc7f
DK
65592010-01-12 Doug Kwan <dougkwan@google.com>
6560
6561 * arm.cc (Cortex_a8_reloc): New class.
6562 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6563 and cortex_a8_relocs_info_.
6564 (Target_arm::fix_cortex_a8): New method definition.
6565 (Target_arm::Cortex_a8_relocs_info): New type.
6566 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6567 New data member declarations.
6568 (Target_arm::scan_reloc_for_stub): Record information about
6569 relocations for THUMB branches that might be exempted from the
6570 Cortex-A8 workaround.
6571 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6572 at the beginning of a relaxation pass.
6573
20138696
DK
65742010-01-12 Doug Kwan <dougkwan@google.com>
6575
6576 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6577 (Arm_relobj::Mapping_symbol_position,
6578 Arm_reloj::Mapping_symbol_position_less,
6579 Arm_relobj::Mapping_symbols_info): New types.
6580 (Target_arm::is_mapping_symbol_name): New method definition.
6581 (Arm_relobj::do_count_local_symbols): Save information about mapping
6582 symbols.
6583
089d69dc
DK
65842010-01-11 Doug Kwan <dougkwan@google.com>
6585
6586 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6587 Arm_relocate_functions::thumb32_branch_upper,
6588 Arm_relocate_functions::thumb32_branch_lower,
6589 Arm_relocate_functions::thumb32_cond_branch_offset,
6590 Arm_relocate_functions::thumb32_cond_branch_upper,
6591 Arm_relocate_functions::thumb32_cond_branch_lower,
6592 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6593 branch offset encoding.
6594 (Arm_relocate_functions::thumb_branch_common): Use new branch
6595 offset encoding methods to avoid code duplication.
6596 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6597 (Stub_addend_reader::operator()): Use new branch encoding method
6598 to avoid code duplication.
6599
99e5bff2
DK
66002010-01-11 Doug Kwan <dougkwan@google.com>
6601
6602 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6603 (Target_arm::do_finalize_sections): Define special EXIDX section
6604 symbols only if referenced.
6605 * gc.h (Garbage_collection::add_reference): New method.
6606 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6607 code duplication.
6608
98e090bd
ILT
66092010-01-11 Ian Lance Taylor <iant@google.com>
6610
d0a91bd8
ILT
6611 * script.cc (Version_script_info::build_expression_list_lookup):
6612 Change complaing about duplicate wildcard match from error to
6613 warning.
6614
98e090bd
ILT
6615 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6616 of 2009-12-30.
6617 (Version_script_info::Version_script_info): Initialize globs_,
6618 default_version_, default_is_global_, and exact_. Don't
6619 initialize globals_ or locals_.
6620 (Version_script_info::build_lookup_tables): Build local symbols
6621 first.
6622 (Version_script_info::unquote): New function.
6623 (Version_script_info::add_exact_match): New function.
6624 (Version_script_info::build_expression_list_lookup): Remove lookup
6625 parameter. Add is_global parameter. Change all callers. Handle
6626 wildcard pattern specially. Unquote pattern. Call
6627 add_exact_match.
6628 (Version_script_info::get_name_to_match): New function.
6629 (Version_script_info::get_symbol_version): New function.
6630 (Version_script_info::get_symbol_version_helper): Remove.
6631 (Version_script_info::check_unmatched_names): Call unquote.
6632 * script.h (class Version_script_info): Change get_symbol_version
6633 to be non-inline and add is_global parameter; change all callers.
6634 Rewrite symbol_is_local. Update declarations. Define struct
6635 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6636 Remove globals_ and locals_ members. Add exact_, globs_,
6637 default_version_, is_global_.
6638 (Version_script_info::Glob): Remove pattern, add expression and
6639 is_global. Update constructor. Change all callers.
6640 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6641 default version.
6642 (Versions::symbol_section_contents): If a symbol is undefined, or
6643 defined in a dynamic object, set the version index to
6644 VER_NDX_LOCAL.
6645 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6646 symbol_is_local.
6647 (Symbol_table::add_from_pluginobj): Likewise.
6648 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6649
d56962d3
DK
66502010-01-11 Doug Kwan <dougkwan@google.com>
6651
6652 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6653 (incremental_dump_LDADD): Add linking option for libintl.
6654 * Makefile.in: Regenerate.
6655
94e6ee91
L
66562010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6657
6658 PR gold/11144
6659 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6660 instead of -Ds.
6661 * testsuite/Makefile.in: Regenerated.
6662
e96c574b
DK
66632010-01-10 Doug Kwan <dougkwan@google.com>
6664
6665 * options.h (DEFINE_var): Use parentheses around argument varname__
6666 in macro body to avoid any unintended subsequent substitutions.
6667
7198066b
ILT
66682010-01-10 Ian Lance Taylor <iant@google.com>
6669
ba4d53bf
ILT
6670 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6671 candidates before doing symbol resolution.
6672
7198066b
ILT
6673 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6674 ODR candidates if only one is weak.
6675
a2beed37
ILT
66762010-01-08 Ian Lance Taylor <iant@google.com>
6677
6678 * script.cc (Version_script_info::build_expression_list_lookup):
6679 Don't warn about ambiguous version, just record the ambiguity.
6680 (Version_script_info::get_symbol_version_helper): Give error if
6681 version is ambiguous.
6682
2fb7225c
DK
66832010-01-08 Doug Kwan <dougkwan@google.com>
6684
6685 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6686 prev_data_size_ and prev_addralign_. Remove initializer for
6687 deleted data member has_been_changed_.
6688 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6689 to determine if the table is empty.
6690 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6691 Remove.
6692 (Stub_table::add_reloc_stub): Define method in class definition
6693 instead of just declaring it there.
6694 (Stub_table::add_cortex_a8_stub): New method definition.
6695 (Stub_table::update_data_size_and_addralign): Ditto.
6696 (Stub_table::finalize_stubs): Ditto.
6697 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6698 (Stub_table::do_addralign_): Return address alignment in the
6699 (Stub_table::do_reset_address_and_file_offset): Define method in
6700 class definition instead of declaring it there. Set current data
6701 size to be the data size of the previous pass.
6702 (Stub_table::set_final_data_size): Use current data size as the
6703 final data size.
6704 (Stub_table::relocate_stub): Change parameter type of stub from
6705 Reloc_stub pointer to Stub pointer.
6706 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6707 (Stub_table::Cortex_a8_stub_list): New typedef.
6708 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6709 Stub_table::prev_addralign_): New data member.
6710 (Arm_relobj::Arm_relobj): Initialize data member
6711 section_has_cortex_a8_workaround_.
6712 (Arm_relobj::section_has_cortex_a8_workaround,
6713 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6714 definitions.
6715 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6716 declarations.
6717 (Target_arm::relocate_stub): Change parameter type of stub from
6718 Reloc_stub pointer to Stub pointer.
6719 (Insn_template::size, Insn_template::alignment): Handle
6720 THUMB16_SPECIAL_TYPE.
6721 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6722 Stub_table::update_data_size_and_addralign,
6723 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6724 definitions.
6725 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6726 (Stub_table::do_write): Ditto.
6727 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6728
880cd20d
ILT
67292010-01-08 Ian Lance Taylor <iant@google.com>
6730
6731 PR 11108
6732 * symtab.h (class Symbol): Remove fields is_target_special_ and
6733 has_plt_offset_. Add field is_defined_in_discarded_section_.
6734 (Symbol::is_defined_in_discarded_section): New function.
6735 (Symbol::set_is_defined_in_discarded_section): New function.
6736 (Symbol::has_plt_offset): Rewrite.
6737 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6738 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6739 Don't initialize is_target_special_ or has_plt_offset_.
6740 Initialize is_defined_in_discarded_section_.
6741 (Symbol_table::add_from_relobj): If appropriate, set
6742 is_defined_in_discarded_section.
6743 * resolve.cc (Symbol::override_base_with_special): Don't test
6744 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6745 * target-reloc.h (relocate_section): Do special handling for
6746 symbols defined in discarded sections for global symbols as well
6747 as local symbols.
6748
2703e3eb
ILT
67492010-01-08 Ian Lance Taylor <iant@google.com>
6750
6751 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6752 the SHT_SYMTAB case.
6753
339d40a3
ILT
67542010-01-08 Ian Lance Taylor <iant@google.com>
6755
6756 * object.cc (Sized_relobj::do_layout): Don't get confused if
6757 layout_eh_frame returns NULL.
6758
abecea76
ILT
67592010-01-08 Ian Lance Taylor <iant@google.com>
6760
6761 PR 11084
6762 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6763 dynamic symbol table, use the normal symbol table.
6764 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6765 symbol table.
6766
6b7dd3f3
ILT
67672010-01-08 Ian Lance Taylor <iant@google.com>
6768
6769 PR 11072
6770 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6771 sections.
6772
36c50e63
L
67732010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6774
6775 * version.cc (print_version): Change to "Copyright 2010".
6776
e291e7b9
ILT
67772010-01-08 Ian Lance Taylor <iant@google.com>
6778
6779 PR 10287
6780 PR 11063
6781 * i386.cc (class Target_i386): Change return type of plt_section
6782 to be non-const.
6783 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6784 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6785 tls_desc_rel_ field.
6786 (Output_data_plt_i386::rel_tls_desc): New function.
6787 (Target_i386::rel_tls_desc_section): New function.
6788 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6789 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6790 R_386_TLS_DESC reloc in rel_tls_desc_section.
6791 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6792 Define struct Tlsdesc_info.
6793 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6794 (Target_x86_64::do_reloc_symbol_index): New function.
6795 (Target_x86_64::add_tlsdesc_info): New function.
6796 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6797 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6798 tlsdesc_rel_ field.
6799 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6800 all callers.
6801 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6802 (Target_x86_64::rela_tlsdesc_section): New function.
6803 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6804 handling.
6805 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6806 (Target_x86_64::do_reloc_addend): New function.
6807 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6808 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6809 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6810 (Output_reloc::type): New function.
6811 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6812 (Output_reloc::is_target_specific): New function.
6813 (Output_reloc::target_arg): New function.
6814 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6815 absolute relocs and target specific relocs.
6816 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6817 add_target_specific.
6818 (class Output_data_reloc) [SHT_RELA]: Likewise.
6819 * output.cc (Output_reloc::Output_reloc): Add four new versions
6820 for absolute relocs and target specific relocs.
6821 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6822 (Output_reloc::get_symbol_index): Likewise.
6823 (Output_reloc::local_section_offset): Check that local_sym_index_
6824 is not TARGET_CODE or 0.
6825 (Output_reloc::symbol_value): Likewise.
6826 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6827 reloc.
6828 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6829 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6830 functions.
6831 * layout.cc (add_target_dynamic_tags): Use output section for
6832 DT_PLTRELSZ and DT_JMPREL.
6833
3a44184e
ILT
68342010-01-07 Ian Lance Taylor <iant@google.com>
6835
6836 PR 11061
6837 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6838 function.
6839 (class Output_data_reloc_generic): Define.
6840 (class Output_data_reloc_base): Change base class to
6841 Output_data_reloc_generic. Change add() method to call
6842 bump_relative_reloc_count for a relative reloc. Remove
6843 sort_relocs_ field.
6844 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6845 to sort_relocs().
6846 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6847 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6848 appropriate.
6849 * layout.h (class Layout): Update declaration.
6850
ea715a34
ILT
68512010-01-07 Ian Lance Taylor <iant@google.com>
6852
6853 * output.h (class Output_data): Add const version of
6854 output_section and do_output_section.
6855 (class Output_section_data): Add const version of
6856 do_output_section.
6857 (class Output_section): Likewise.
6858 * layout.cc (Layout::add_target_dynamic_tags): New function.
6859 * layout.h (class Layout): Update declarations.
6860 * arm.cc (Target_arm::do_finalize_sections): Use
6861 add_target_dynamic_tags.
6862 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6863 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6864 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6865 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6866
659948a4
ILT
68672010-01-07 Ian Lance Taylor <iant@google.com>
6868
6869 PR 11042
6870 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6871 object as needed.
6872
9d3b86f6
ILT
68732010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6874 Ian Lance Taylor <iant@google.com>
6875
6876 PR 11019
6877 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6878 Xindex::read_symtab_xindex.
6879
bb0d3eb0
DK
68802010-01-07 Doug Kwan <dougkwan@google.com>
6881
6882 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6883 (Insn_template::thumb16_bcond_insn): New method declaration.
6884 (Insn_template): Fix spelling.
6885 (Stub::thumb16_special): New method declaration.
6886 (Stub::do_write): Define virtual method which was previously pure
6887 virtual.
6888 (Stub::do_thumb16_special): New method declaration.
6889 (Stub::do_fixed_endian_write): New template member.
6890 (Reloc_stub::do_write): Remove.
6891 (Reloc_stub::do_fixed_endian_write): Remove.
6892 (Cortex_a8_stub): New class definition.
6893 (Stub_factory::make_cortex_a8_stub): New method definition.
6894 (Stub_factory::Stub_factory): Add missing static storage class
6895 qualifier for elf32_arm_stub_a8_veneer_blx.
6896
ffeef7df
ILT
68972010-01-07 Ian Lance Taylor <iant@google.com>
6898
dc3f80fe
ILT
6899 PR 10980
6900 * options.h (class General_options): Add --warn-unresolved-symbols
6901 and --error-unresolved-symbols.
6902 * errors.cc (Errors::undefined_symbol): Implement
6903 --warn-unresolved-symbols.
6904
ffeef7df
ILT
6905 * options.h (class General_options): Add -z text and -z textoff.
6906 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6907
f1ec9ded
ST
69082010-01-06 Sriraman Tallam <tmsriram@google.com>
6909
6910 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6911 (Garbage_collection::cident_sections): New function.
6912 (Garbage_collection::add_cident_section): New function.
6913 (Garbage_collection::cident_sections_): New member.
6914 (gc_process_relocs): Add references to sections whose names are C
6915 identifiers.
6916 * gold.h (cident_section_start_prefix): New constant.
6917 (cident_section_stop_prefix): New constant.
6918 (is_cident): New function.
6919 * layout.cc (Layout::define_section_symbols): Replace string constants
6920 with the newly defined constants.
6921 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6922 C identifiers.
6923 * testsuite/Makefile.am: Add gc_orphan_section_test.
6924 * testsuite/Makefile.in: Regenerate.
6925 * testsuite/gc_orphan_section_test.cc: New file.
6926 * testsuite/gc_orphan_section_test.sh: New file.
6927
6eda8c29
ILT
69282010-01-06 Ian Lance Taylor <iant@google.com>
6929
b9674e17
ILT
6930 PR 10980
6931 * options.h (class General_options): Add --warn-shared-textrel.
6932 * layout.cc (Layout::finish_dynamic_section): Implement
6933 --warn-shared-textrel.
6934
6eda8c29
ILT
6935 PR 10980
6936 * options.h (class General_options): Add --warn-multiple-gp.
6937
32dcd44e
ILT
69382010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6939
6940 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6941 $(THREADSLIB) and $(LIBDL).
6942 * Makefile.in: Rebuild.
6943
a192ba05
ILT
69442010-01-06 Ian Lance Taylor <iant@google.com>
6945
6946 PR 10980
6947 * options.cc (General_options::parse_section_start): New function.
6948 (General_options::section_start): New function.
6949 (General_options::General_options): Initialize all members.
6950 * options.h: Include <map>
6951 (class General_options): Add --section-start. Add section_starts_
6952 member.
6953 * layout.cc (Layout::attach_allocated_section_to_segment): If
6954 --section-start was used, set the address of the segment. Remove
6955 local sort_sections.
6956 (Layout::relaxation_loop_body): If the address of the load segment
6957 has been set by --section-start, don't use it.
6958 * output.h (Output_segment::update_flags_for_output_section): New
6959 function.
6960 * output.cc (Output_segment::add_output_section): Call
6961 update_flags_for_output_section.
6962
dde3f402
ILT
69632010-01-05 Ian Lance Taylor <iant@google.com>
6964
62dfdd4d
ILT
6965 PR 10980
6966 * options.h (class General_options): Add --undefined-version.
6967 * script.cc (struct Version_expression): Add was_matched_by_symbol
6968 field.
6969 (Version_script_info::matched_symbol): New function.
6970 (Version_script_info::get_symbol_version_helper): Call
6971 matched_symbol.
6972 (Version_script_info::check_unmatched_names): New function.
6973 * script.h (class Version_script_info): Update declarations.
6974 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6975
9c4ae156
ILT
6976 * options.h (class General_options): Use DEFINE_bool_alias for
6977 allow_multiple_definition.
6978 * resolve.cc (Symbol_table::should_override): Don't test
6979 allow_multiple_definition.
6980
dde3f402
ILT
6981 PR 10980
6982 * options.h (class General_options): Add --cref.
6983 * main.cc (main): Print cref table if --cref. Don't close mapfile
6984 until after printing cref table.
6985 * cref.cc: Include "symtab.h".
6986 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6987 (Cref_table_compare::operator()): New function.
6988 (Cref_inputs::gather_cref): New function.
6989 (filecol): New static const.
6990 (Cref_inputs::print_cref): New function.
6991 (Cref::print_cref): New function.
6992 * cref.h: Include <cstdio>.
6993 (class Cref): Update declarations.
6994 * mapfile.h (Mapfile::file): New function.
6995 * object.h (class Object): Define Symbols. Declare virtual
6996 do_get_global_symbols.
6997 (Object::get_global_symbols): New function.
6998 * object.cc (Input_objects::add_object): Pass object to cref_ if
6999 --cref.
7000 (Input_objects::archive_start): Likewise.
7001 (Input_objects::archive_stop): Likewise.
7002 (Input_objects::print_cref): New function.
7003 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7004 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7005 --cref.
7006 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7007 function.
7008 * plugin.h (class Sized_pluginobj): Update declarations.
7009
8781f709
ILT
70102010-01-05 Ian Lance Taylor <iant@google.com>
7011
7012 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7013 to is_default_version. Rename insdef to insdefault.
7014 (Symbol_table::add_from_relobj): Rename def to is_default_version
7015 and local to is_forced_local.
7016 (Symbol_table::add_from_pluginobj): Likewise.
7017 (Symbol_table::add_from_dynobj): Likewise.
7018 (Symbol_table::define_special_symbol): Rename insdef to
7019 insdefault.
7020
fe35d28d
ILT
70212010-01-04 Ian Lance Taylor <iant@google.com>
7022
30bc8c46
ILT
7023 PR 10980
7024 * options.h (class General_options): Add
7025 --allow-multiple-definition and -z muldefs.
7026 * resolve.cc (Symbol_table::should_override): Don't warn about a
7027 multiple symbol definition if --allow-multiple-definition or -z
7028 muldefs.
7029
7eaea549
ILT
7030 PR 10980
7031 * options.h (class General_options): Add --add-needed and
7032 --copy-dt-needed-entries. Tweak --as-needed help entry.
7033 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7034 error if --copy-dt-needed-entries aka --add-needed is used and
7035 would cause a change in behaviour.
7036
fe35d28d
ILT
7037 PR 10980
7038 * options.h (class General_options): Add -G as a short version of
7039 --shared. Add no-op options -assert, -g, and -i.
7040
55a2bb35
ST
70412010-01-04 Sriraman Tallam <tmsriram@google.com>
7042
7043 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7044 check for .text or .gnu.linkonce.t sections.
7045 * icf.cc (Icf::find_identical_sections): Ditto.
7046 Change the detection for mangled function name within the section
7047 name.
7048 * icf.h (is_section_foldable_candidate): New function.
7049
719328e1
ILT
70502009-12-30 Ian Lance Taylor <iant@google.com>
7051
7052 PR 10980
7053 * options.h (class General_options): Permit two dashes with
7054 --retain-symbols-file.
7055
d7bb5745
ILT
70562009-12-30 Ian Lance Taylor <iant@google.com>
7057
403a15dd
ILT
7058 PR 10979
7059 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7060 don't put the file header and segment headers in the text
7061 segment.
7062
eda294df
ILT
7063 PR 10979
7064 * common.cc (Sort_commons::operator()): Stabilize sort when both
7065 entries are NULL.
7066 (Symbol_table::do_allocate_commons_list): When allocating common
7067 symbols, skip a symbol which is no longer common.
7068 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7069 an object before checking its type.
7070 * testsuite/common_test_2.c: New file.
7071 * testsuite/common_test_3.c: New file.
7072 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7073 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7074 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7075 (common_test_2_pic.o, common_test_2.so): New targets.
7076 (common_test_3_pic.o, common_test_3.so): New targets.
7077 * testsuite/Makefile.in: Rebuild.
7078
d7bb5745
ILT
7079 PR 10979
7080 * script.cc (read_input_script): If we see a new SECTIONS clause,
7081 and we have added an input section, give an error.
7082 * layout.h (class Layout): Add have_added_input_section function.
7083 Add have_added_input_section_ field.
7084 * layout.cc (Layout::Layout): Initialize
7085 have_added_input_section_.
7086 (Layout::layout): Set have_added_input_section_.
7087 (Layout::layout_eh_frame): Likewise.
7088
fc59c572
ILT
70892009-12-30 Ian Lance Taylor <iant@google.com>
7090
7091 PR 10931
7092 * options.h (class General_options): Add --sort-common option.
7093 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7094 * common.cc (Sort_common): Add sort_order parameter to
7095 constructor. Add sort_order_ field.
7096 (Sort_commons::operator): Check sort_order_.
7097 (Symbol_table::allocate_commons): Determine the sort order.
7098 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7099 Change all callers.
7100 (Symbol_table::do_allocate_commons_list): Likewise.
7101
1c74fab0
ILT
71022009-12-30 Ian Lance Taylor <iant@google.com>
7103
7104 PR 10916
7105 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7106 symbols from this object, don't change the visibility of an
7107 undefined symbol.
7108 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7109
6affe781
ILT
71102009-12-30 Ian Lance Taylor <iant@google.com>
7111
7112 PR 10861
7113 * script.h (class Version_script_info): Define Language enum.
7114 Update declarations. Define Glob, Exact, and Lookup types. Add
7115 new fields globals_, locals_, and is_finalized_.
7116 * script.cc: Various formatting fixes.
7117 (class Parser_closure): Change language_stack_ from a vector of
7118 std::string to one of Version_script_info::Language. Adjust all
7119 uses accordingly.
7120 (class Lazy_demangler): Remove.
7121 (struct Version_expression): Change language from std::string to
7122 Version_script_info::Language.
7123 (Version_script_info::Version_script_info): New function.
7124 (Version_script_info::~Version_script_info): Don't call clear.
7125 (Version_script_info::finalize): New function.
7126 (Version_script_info::build_lookup_tables): New function.
7127 (Version_script_info::build_expression_list_lookup): New
7128 function.
7129 (Version_script_info::get_symbol_version_helper): Rewrite to use
7130 lookup tables.
7131 (Version_script_info::print_expression_list): Adjust to use
7132 Version_script_info::Language.
7133 (script_push_lex_into_version_mode): Check that the version script
7134 has not been finalized.
7135 (version_script_push_lang): Change language string to
7136 Version_script_info::Language.
7137 * options.cc (Command_line::version_script): New function.
7138 * options.h (class General_options): Add finalize_dynamic_list
7139 function. Change version_script from declaration to definition.
7140 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7141 * testsuite/version_script.map: Remove duplicate def of foo.
7142 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7143 version_script.map.
7144 * testsuite/Makefile.in: Rebuild.
7145
818bf354
ILT
71462009-12-30 Ian Lance Taylor <iant@google.com>
7147
7148 PR 10843
7149 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7150 if the input symbol index is 0, make the output symbol index 0.
7151
ebcc8304
ILT
71522009-12-30 Ian Lance Taylor <iant@google.com>
7153
7154 PR 10670
7155 * options.h (class General_options): Add -x/--discard-all.
7156 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7157 --discard-all. If the local symbol needs a dynamic entry, check
7158 that before handling --discard-locals.
7159
176fe33f
ILT
71602009-12-30 Ian Lance Taylor <iant@google.com>
7161
bb321bb1
ILT
7162 PR 10450
7163 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7164 flags to PF_R.
7165 (Output_segment::add_output_section): Don't change the flags if
7166 the type is PT_TLS.
7167
176fe33f
ILT
7168 PR 10450
7169 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7170 GNU hash table if they need a dynamic value. Otherwise, don't add
7171 them if they are defined in a dynamic object or are forced local.
7172
e8cd95c7
ILT
71732009-12-29 Ian Lance Taylor <iant@google.com>
7174
1b81fb71
ILT
7175 PR 10450
7176 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7177 .gnu.hash table for a 32-bit target.
7178
8d6d383d
ILT
7179 PR 10450
7180 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7181 regular and a dynamic object only needs a dynamic symbol table
7182 entry if it is externally visible.
7183
e785ec03
ILT
7184 PR 10450
7185 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7186 constructor. Add global_offset_table_ field.
7187 (Target_i386::got_section): Set global_offset_table_.
7188 (Target_i386::do_finalize_sections): Set global_offset_table_
7189 size.
7190 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7191 in constructor. Add global_offset_table_ field.
7192 (Target_x86_64::got_section): Set global_offset_table_.
7193 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7194 size.
7195
1a2dff53
ILT
7196 * layout.cc (Layout::Layout): Initialize increase_relro_.
7197 (Layout::get_output_section): Add is_relro, is_last_relro, and
7198 is_first_non_relro parameters. Change all callers.
7199 (Layout::choose_output_section): Likewise.
7200 (Layout::add_output_section_data): Likewise.
7201 (Layout::make_output_section): Likewise.
7202 (Layout::set_segment_offsets): Clear increase_relro when using a
7203 linker script.
7204 * layout.h (class Layout): Add increase_relro method. Add
7205 increase_relro_ field. Update declarations.
7206 * output.cc (Output_section::Output_section): Initialize
7207 is_last_relro_ and is_first_non_relro_.
7208 (Output_segment::add_output_section): Group relro sections is
7209 do_sort is true. Handle is_last_relro and is_first_non_relro.
7210 (Output_segment::maximum_alignment): Remove relro handling.
7211 (Output_segment::set_section_addresses): Add increase_relro
7212 parameter. Change all callers. Add initial alignment to align
7213 relro sections on separate page. Remove old relro handling.
7214 (Output_segment::set_section_list_addresses): Remove in_relro
7215 parameter. Change all callers.
7216 (Output_segment::set_offset): Add increase parameter. Change all
7217 callers. Remove old relro handling.
7218 * output.h (class Output_section): Add new methods: is_last_relro,
7219 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7220 Add is_last_relro_ and is_first_non_relro_ fields.
7221 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7222 Create separate .got.plt section. Call increase_relro.
7223 * x86_64.cc (Target_x86_64::got_section): Likewise.
7224 * testsuite/relro_script_test.t: Add .got.plt.
7225
f0ba79e2
ILT
7226 PR 10450
7227 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7228 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7229 (Layout::finalize): Call set_dynamic_symbol_size.
7230 (Layout::set_dynamic_symbol_size): New function.
7231 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7232 set_dynamic_symbol_size.
7233
e8cd95c7
ILT
7234 PR 10450
7235 * output.h (class Output_section): Add is_entsize_zero_ field.
7236 * output.cc (Output_section::Output_section): Initialize
7237 is_entsize_zero_.
7238 (Output_section::set_entsize): If two different entsizes are
7239 requested, force it to zero.
7240 (Output_section::add_input_section): Set flags for .debug_str
7241 before updating section flags. Set entsize.
7242 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7243 and SHF_STRING if all input sections have those flags.
7244
3e1b9a8a
RÁE
72452009-12-29 Rafael Espindola <espindola@google.com>
7246
7247 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
7248 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7249 reporting.
3e1b9a8a 7250
3dcad376
ST
72512009-12-29 Sriraman Tallam <tmsriram@google.com>
7252
7253 * options.cc (General_options::parse_version): Allow -v to exit
7254 without an error if there is nothing to link.
7255
084e2665
ILT
72562009-12-29 Ian Lance Taylor <iant@google.com>
7257
7258 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7259 using a version of gcc before 4.1.
7260 * configure: Rebuild.
7261
250acde3
CD
72622009-12-28 Chris Demetriou <cgd@google.com>
7263
7264 * attributes.cc (Output_attributes_section_data::do_write): Use
7265 std::vector::front rather than std::vector::data.
7266
99fff23b
ILT
72672009-12-28 Ian Lance Taylor <iant@google.com>
7268
7269 * symtab.h (class Symbol_table): Add enum Defined.
7270 * resolve.cc (Symbol_table::should_override): Add defined
7271 parameter. Change all callers. Test whether object is NULL
7272 before calling a method on it.
7273 (Symbol_table::report_resolve_problem): Add defined parameter.
7274 Change all callers.
7275 (Symbol_table::should_override_with_special): Likewise.
7276 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7277 parameter. Change all callers.
7278 (Symbol_table::do_define_in_output_data): Likewise.
7279 (Symbol_table::define_in_output_segment): Likewise.
7280 (Symbol_table::do_define_in_output_segment): Likewise.
7281 (Symbol_table::define_as_constant): Likewise.
7282 (Symbol_table::do_define_as_constant): Likewise.
7283 * script.h (class Symbol_assignment): Add is_defsym parameter to
7284 constructor; change all callers.
7285 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7286 parameter. Change all callers. Add is_defsym_ field.
7287 (class Parser_closure): Add parsing_defsym parameter to
7288 constructor; change all callers. Add parsing_defsym accessor
7289 function. Add parsing_defsym_ field.
7290
556bd683
ILT
72912009-12-28 Ian Lance Taylor <iant@google.com>
7292
7293 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 7294 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 7295
1782c879
ILT
72962009-12-23 Ian Lance Taylor <iant@google.com>
7297
7298 * i386.cc (Target_i386::do_calls_non_split): Recognize
7299 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
7300 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7301 -fsplit-stack prologue when using %r11.
1782c879 7302
329ca2b1
ST
73032009-12-21 Sriraman Tallam <tmsriram@google.com>
7304
7305 * options.cc (General_options::parse_version): Make -v continue and do
7306 the link like GNU ld does.
7307
d675ff46
RÁE
73082009-12-17 Rafael Avila de Espindola <espindola@google.com>
7309
7310 * Makefile.am (CCFILES): Add timer.cc.
7311 (HFILES): Add timer.h.
7312 * configure.ac: Check for sysconf and times.
7313 * main.cc: include timer.h.
7314 (main): Use Timer instead of get_run_time.
7315 * timer.cc: New.
7316 * timer.h: New.
7317 * workqueue.cc: include timer.h.
7318 (Workqueue::find_and_run_task):
7319 Report user, sys and wall time.
7320 * Makefile.in: Regenerate.
7321 * config.in: Regenerate.
7322 * configure: Regenerate.
7323
d6344fb5
DK
73242009-12-16 Doug Kwan <dougkwan@google.com>
7325
7326 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7327 sections.
7328 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7329 relaxed input sections.
7330 * output.cc (Output_section::find_relaxed_input_section): Change
7331 return type to Output_relaxed_input_section pointer. Adjust code
7332 for new type of relaxed_input_section_map_.
7333 * output.h (Output_section::find_relaxed_input_section): Change
7334 return type to Output_relaxed_input_section pointer.
7335 (Output_section::Output_relaxed_input_section_by_input_section_map):
7336 New type.
7337 (Output_section::relaxed_input_section_map_): Change type to
7338 Output_section::Output_relaxed_input_section_by_input_section_map.
7339 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7340 input section.
7341
0e0d5469
ILT
73422009-12-15 Ian Lance Taylor <iant@google.com>
7343
7344 * layout.cc (Layout::create_shstrtab): Only write out after input
7345 sections if we are compressing debug sections.
7346
0649a889
ILT
73472009-12-15 Ian Lance Taylor <iant@google.com>
7348
7349 * archive.cc (Archive::add_symbols): Only look up a symbol without
7350 a version if there is, in fact, a version.
7351
2ea97941
ILT
73522009-12-14 Ian Lance Taylor <iant@google.com>
7353
7354 Revert -Wshadow changes, all changes from:
7355 2009-12-11 Doug Kwan <dougkwan@google.com>
7356 2009-12-11 Nick Clifton <nickc@redhat.com>
7357 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7358
b0eec2cc
DK
73592009-12-11 Doug Kwan <dougkwan@google.com>
7360
7361 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7362 due to -Wshadow.
7363 * attributes.cc (Object_attribute::size): Ditto.
7364 (Attributes_section_data::size): Ditto.
7365 (Attributes_section_data::Attributes_section_data): Ditto.
7366 (Output_attributes_section_data::do_write): Ditto.
7367 * attributes.h (Object_attribute::set_type): Ditto.
7368 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7369
91d6fa6a
NC
73702009-12-11 Nick Clifton <nickc@redhat.com>
7371
7372 * archive.cc: Fix shadowed variable warnings.
7373 * arm.cc: Likewise.
7374 * compressed_output.cc: Likewise.
7375 * compressed_output.h: Likewise.
7376 * configure: Likewise.
7377 * dwarf_reader.cc: Likewise.
7378 * dynobj.cc: Likewise.
7379 * dynobj.h: Likewise.
7380 * ehframe.cc: Likewise.
7381 * ehframe.h: Likewise.
7382 * errors.cc: Likewise.
7383 * expression.cc: Likewise.
7384 * fileread.cc: Likewise.
7385 * fileread.h: Likewise.
7386 * freebsd.h: Likewise.
7387 * i386.cc: Likewise.
7388 * icf.cc: Likewise.
7389 * incremental.h: Likewise.
7390 * layout.cc: Likewise.
7391 * layout.h: Likewise.
7392 * mapfile.cc: Likewise.
7393 * merge.cc: Likewise.
7394 * merge.h: Likewise.
7395 * object.cc: Likewise.
7396 * object.h: Likewise.
7397 * options.h: Likewise.
7398 * output.cc: Likewise.
7399 * output.h: Likewise.
7400 * parameters.cc: Likewise.
7401 * plugin.cc: Likewise.
7402 * powerpc.cc: Likewise.
7403 * reduced_debug_output.cc: Likewise.
7404 * reduced_debug_output.h: Likewise.
7405 * reloc.cc: Likewise.
7406 * reloc.h: Likewise.
7407 * resolve.cc: Likewise.
7408 * script-sections.cc: Likewise.
7409 * script.cc: Likewise.
7410 * script.h: Likewise.
7411 * sparc.cc: Likewise.
7412 * symtab.cc: Likewise.
7413 * symtab.h: Likewise.
7414 * target-select.cc: Likewise.
7415 * target-select.h: Likewise.
7416 * token.h: Likewise.
7417 * workqueue.cc: Likewise.
7418 * workqueue.h: Likewise.
7419 * x86_64.cc: Likewise.
7420
a0351a69
DK
74212009-12-10 Doug Kwan <dougkwan@google.com>
7422
7423 * arm.cc (attributes.h): New include.
7424 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7425 (Arm_relobj::~Arm_relobj): Delete object pointed by
7426 attributes_section_data_.
7427 (Arm_relobj::attributes_section_data): New method definition.
7428 (Arm_relobj::attributes_section_data_): New data member declaration.
7429 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7430 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7431 attributes_section_data_.
7432 (Arm_dynobj::attributes_section_data): New method definition.
7433 (Arm_dynobj::attributes_section_data_): New data member declaration.
7434 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7435 initialization value of may_use_blx_ to false.
7436 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7437 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7438 object attributes to compute results instead of hard-coding.
7439 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7440 Target_arm::get_secondary_compatible_arch,
7441 Target_arm::set_secondary_compatible_arch
7442 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7443 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7444 New method declarations.
7445 (Target_arm::get_aeabi_object_attribute): New method definition.
7446 (Target_arm::attributes_section_data_): New data member declaration.
7447 (read_arm_attributes_section): New template definition.
7448 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7449 (Arm_dynobj::do_read_symbols): Ditto.
7450 (Target_arm::do_finalize_sections): Merge attributes sections from
7451 input. Check for BLX use after attributes section merging.
7452 Fix __exidx_start and __exidx_end visibility. Create an
7453 .ARM.attributes section if necessary.
7454 (Target_arm::get_secondary_compatible_arch,
7455 Target_arm::set_secondary_compatible_arch,
7456 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7457 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 7458 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
7459 New method definitions.
7460
b59befec
ILT
74612009-12-09 Ian Lance Taylor <iant@google.com>
7462
7463 * plugin.cc (Plugin::load): Don't cast from void* to a function
7464 pointer.
7465
1276bc89
ILT
74662009-12-09 Ian Lance Taylor <iant@google.com>
7467
7468 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7469 information fields.
7470
2f2de248
L
74712009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7472
7473 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7474 Replace two_file_shared_1.so with two_file_shared_2.so.
7475 * testsuite/Makefile.in: Regenerated.
7476
4f787271
DK
74772009-12-08 Doug Kwan <dougkwan@google.com>
7478
7479 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7480 (HFILES): Add attributes.h and int_encoding.h.
7481 * Makefile.in: Regenerate.
7482 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7483 function definitions to int_encoding.cc
7484 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7485 prototypes to int_encoding.h
7486 * reduced_debug_output.cc (int_encoding.h): New include.
7487 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7488 function definitions to int_encoding.cc
7489 (insert_into_vector, read_from_pointer): Move template definitions to
7490 int_encoding.h
7491 * attributes.cc: New file.
7492 * attributes.h: New file.
7493 * int_encoding.cc: New file.
7494 * int_encoding.h: New file.
7495
20b52f1a
RÁE
74962009-12-07 Rafael Avila de Espindola <espindola@google.com>
7497
7498 PR gold/11055
7499 * incremental-dump.cc (dump_incremental_inputs): New.
7500 (main): Use dump_incremental_inputs.
7501
53d7974c
L
75022009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7503
7504 PR gold/10893
7505 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7506 checking elfcpp::STT_FUNC.
7507 (Target_i386::Relocate::relocate): Likewise.
7508 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7509
7510 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7511 symbols from shared libraries into normal FUNC symbols.
7512
7513 * symtab.h (Symbol): Add is_func and use it.
7514
05a352e6
DK
75152009-12-05 Doug Kwan <dougkwan@google.com>
7516
7517 * arm.cc (Target_arm::arm_info): Initialize new fields
7518 attributes_section and attributes_vendor.
7519 * i386.cc (Target_i386::i386_info): Same.
7520 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7521 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7522 fields attributes_section and attributes_vendor.
53d7974c 7523 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
7524 * target.h (Target::attributes_section, Target::attributes_vendor,
7525 Target::is_attributes_section, Target::attribute_arg_type,
7526 Target::attributes_order): New method definitions.
7527 (Target::Target_info::attributes_section,
7528 Target::Target_info::attributes_vendor): New fields.
7529 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7530 virtual method definitions.
7531 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7532 attributes_section and attributes_vendor.
7533 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7534
f4e5969c
DK
75352009-12-05 Doug Kwan <dougkwan@google.com>
7536
7537 * arm.cc: Update comments about interworking and stub generation.
7538 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7539 considered as non-PIC.
7540 (Arm_relocate_functions::base_abs): Fix formatting.
7541 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7542 of function to use GOT entry address instead of offset.
7543 (Target_arm::Scan::global): Issue an error if a symbol would need a
7544 PLT does not get one because it is untyped. Remove code to create
7545 dynamic symbols for relative branches.
7546 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7547 takes unsigned integer instead of boolean.
7548
1abce4a6
L
75492009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7550
7551 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7552 (two_file_test_LDADD): Likewise.
7553 (common_test_1_LDADD): Likewise.
7554 (exception_test_LDADD) Likewise.
7555 (weak_test_LDADD): Likewise.
7556 (many_sections_test_LDADD): Likewise.
7557 (initpri1_LDADD): Likewise.
7558 (script_test_1_LDADD): Likewise.
7559 (script_test_2_LDADD): Likewise.
7560 (justsyms_LDADD): Likewise.
7561 (binary_test_LDADD): Likewise.
7562 (large_LDADD): Likewise.
7563 * testsuite/Makefile.in: Regenerated.
7564
adcf2816 75652009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 7566
adcf2816
L
7567 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7568 (Symbol_table::override_with_special): Likewise.
7569 (Symbol_table::add_from_object): Likewise.
7570
28e67f5d
RÁE
75712009-12-04 Rafael Avila de Espindola <espindola@google.com>
7572
7573 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7574 Don't set the data_offset twice.
7575
ae10a101
RÁE
75762009-12-04 Rafael Avila de Espindola <espindola@google.com>
7577
7578 * testsuite/Makefile.in: Regenerate.
7579
f59f41f3
DK
75802009-12-03 Doug Kwan <dougkwan@google.com>
7581
7582 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7583 (Target_arm::do_finalize_sections): Add parameter for symbol table
7584 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7585 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7586 parameter for symbol table pointer.
7587 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7588 an additional parameter for a pointer to symbol table.
7589 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7590 parameter for a symbol table pointer.
7591 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7592 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7593 Ditto.
7594 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7595 parameter for a symbol table pointer.
7596
ca55d848
RÁE
75972009-12-03 Rafael Avila de Espindola <espindola@google.com>
7598
7599 * incremental.cc (Incremental_inputs_header)
7600 (Incremental_inputs_header_write, Incremental_inputs_entry)
7601 (Incremental_inputs_entry_write): Move ...
7602 * incremental.h (Incremental_inputs_header)
7603 (Incremental_inputs_header_write, Incremental_inputs_entry)
7604 (Incremental_inputs_entry_write): here.
7605
3aec4f9c
RÁE
76062009-12-02 Rafael Avila de Espindola <espindola@google.com>
7607
7608 * incremental.cc (make_sized_incremental_binary): Set the target.
7609 Error if it is incompatible.
7610 * output.h (Output_file): Add filename method.
7611
9c0ae74d
RÁE
76122009-12-02 Rafael Avila de Espindola <espindola@google.com>
7613
7614 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7615 from the get_* methods.
7616
a45500ae
RÁE
76172009-12-02 Rafael Avila de Espindola <espindola@google.com>
7618
7619 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7620 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7621 Write 0 for the data_offset of scripts.
7622
325e6408
RÁE
76232009-12-02 Rafael Avila de Espindola <espindola@google.com>
7624
7625 * testsuite/Makefile.am: Add the incremental_test.sh test.
7626 * testsuite/incremental_test.sh: New.
7627 * testsuite/incremental_test_1.c: New.
7628 * testsuite/incremental_test_2.c: New.
7629
954c3e2e
RÁE
76302009-12-01 Rafael Avila de Espindola <espindola@google.com>
7631
7632 * incremental-dump.cc (main): Fix typos.
7633
f8086623
RÁE
76342009-11-27 Rafael Avila de Espindola <espindola@google.com>
7635
7636 PR gold/11025
7637 * incremental-dump.cc (main): Use llu to print 64 bit values.
7638
3b0dd6ac
L
76392009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7640 H.J. Lu <hongjiu.lu@intel.com>
7641
7642 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7643 $(LIBDL).
7644 (incremental_dump_LDADD): Likewise.
7645 * Makefile.in: Regenerated.
7646
a6d1ef57 76472009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 7648
a6d1ef57
DK
7649 Revert:
7650
7651 2009-11-25 Doug Kwan <dougkwan@google.com>
7652
7653 * arm.cc (Target_arm::Target_arm): Move method definition
7654 outside of class definition. Add code to handle
7655 --target1-rel, --target1-abs and --target2= options.
7656 (Target_arm::get_reloc_reloc_type): Change method to be
7657 non-static and const.
7658 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7659 New data member declaration.
7660 (Target_arm::Scan::local, Target_arm::Scan::global,
7661 Target_arm::Relocate::relocate,
7662 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7663 Adjust call to Target_arm::get_real_reloc_type.
7664 (Target_arm::get_real_reloc_type): Use command line options
7665 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7666 * options.h (--target1-rel, --target1-abs, --target2): New
7667 ARM-only options.
7668
50aeb7d4
DK
76692009-11-25 Doug Kwan <dougkwan@google.com>
7670
7671 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7672 class definition. Add code to handle --target1-rel, --target1-abs
7673 and --target2= options.
7674 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7675 and const.
7676 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7677 member declaration.
7678 (Target_arm::Scan::local, Target_arm::Scan::global,
7679 Target_arm::Relocate::relocate,
7680 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7681 call to Target_arm::get_real_reloc_type.
7682 (Target_arm::get_real_reloc_type): Use command line options to
7683 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7684 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7685 options.
7686
51938283
DK
76872009-11-25 Doug Kwan <dougkwan@google.com>
7688
7689 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7690 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7691 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7692 formatting.
7693 (Arm_relocate_functions::thm_call): Replace body with a call to
7694 Arm_relocate_functions::thumb_branch_common.
7695 (Arm_relocate_functions::thm_jump24,
7696 Arm_relocate_functions::thm_xpc22): New method definitions.
7697 (Arm_relocate_functions::thumb_branch_common): New method definition.
7698 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7699 operator.
7700 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7701 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7702
e2b8f3c4
RÁE
77032009-11-24 Rafael Avila de Espindola <espindola@google.com>
7704
7705 * Makefile.am: Build incremental-dump
7706 * Makefile.in: Regenerate.
7707 * incremental-dump.cc: New.
7708 * incremental.cc (Incremental_inputs_header_data,
7709 Incremental_inputs_entry_data): Move to incremental.h
7710 * incremental.h: (Incremental_inputs_header_data,
7711 Incremental_inputs_entry_data): Move from incremental.cc
7712
bcba9aec
RÁE
77132009-11-24 Rafael Avila de Espindola <espindola@google.com>
7714
7715 * incremental.cc (Incremental_inputs_header,
7716 Incremental_inputs_header_write, Incremental_inputs_entry,
7717 Incremental_inputs_entry_write): Add a typedef with the data type.
7718
7c3afe08
RÁE
77192009-11-24 Rafael Avila de Espindola <espindola@google.com>
7720
7721 * incremental.cc (Incremental_inputs_header,
7722 Incremental_inputs_header_write, Incremental_inputs_entry,
7723 Incremental_inputs_entry_write): Update comment about which
7724 type has the filed descriptions.
7725
d204b6e9
DK
77262009-11-15 Doug Kwan <dougkwan@google.com>
7727
7728 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7729 (Arm_relocate_functions::arm_branch_common): Change method defintion
7730 in class definition to a method declaration and update list of formal
7731 parameters.
7732 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7733 Arm_relocation_functions::jump24): Adjust call to
7734 Arm_relocate_functions::arm_branch_common. Update list of formal
7735 parameters.
7736 (Arm_relocate_functions::xpc25): New method definition.
7737 (Arm_relocate_functions::arm_branch_common): Move method defintion
7738 out from class definition. Use stubs for mode-switching and extending
7739 branch ranges.
7740 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7741 specially. Change code to enable use of stubs in ARM branches.
7742
43d12afe
DK
77432009-11-10 Doug Kwan <dougkwan@google.com>
7744
7745 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7746 in method declaration.
7747 (Target_arm::relocate_stub): New method declaration.
7748 (Target_arm::default_target): Change to return a pointer instead of
7749 a const reference.
7750 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7751 Target_arm::default_target.
7752 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7753 method definition.
7754 (Target_arm::relocate_section): Adjust view.
7755 (Target_arm::relocate_stub): New method definition.
7756
ac33a407
DK
77572009-11-10 Doug Kwan <dougkwan@google.com>
7758
7759 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7760 a format warning.
7761 * incremental.cc (open_incremental_binary): Initialized local
7762 variables to avoid warnings.
7763 * object.cc (make_elf_object): Ditto.
7764 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7765 a format warning.
e1df38aa 7766
88ee28e9
L
7767009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7768
7769 PR gold/10930
7770 * testsuite/plugin_test.c: Include "config.h".
7771
2daedcd6
DK
77722009-11-09 Doug Kwan <dougkwan@google.com>
7773
7774 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7775 (arm_symbol_value): Remove.
7776 (Arm_relocate_functions::arm_branch_common,
7777 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7778 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7779 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7780 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7781 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7782 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7783 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7784 Arm_relocate_functions::thm_mobw_abs_nc,
7785 Arm_relocate_functions::thm_mov_abs,
7786 Arm_relocate_functions::movw_prel_nc,
7787 Arm_relocate_functions::thm_movt_abs,
7788 Arm_relocate_functions::movt_prel,
7789 Arm_relocate_functions::thm_movw_prel_nc,
7790 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7791 (Target_arm::Relocate::relocate): Only decompose address into two
7792 parts if relocation type uses the thumb-bit and pass the actual
7793 bit instead of a flag indicating that the thumb-bit is used. Adjust
7794 calls to methods in Arm_relocate_functions for this change.
7795
1276bc89 77962009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
7797
7798 PR 10925
7799 * reloc.cc: Instantiate
7800 Sized_relobj::initialize_input_to_output_maps and
7801 Sized_relobj:free_input_to_output_maps.
7802
e53ad1b5
ILT
78032009-11-06 Ian Lance Taylor <iant@google.com>
7804
7805 PR 10876
7806 * defstd.cc (in_segment): Set only_if_ref true for "end".
7807
eb44217c
DK
78082009-11-06 Doug Kwan <dougkwan@google.com>
7809
7810 * arm.cc (class Reloc_stub): Correct a comment.
7811 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7812 (Target_arm::scan_section_for_stubs): New method declaration.
7813 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7814 Change methods from private to protected.
7815 (Target_arm::do_may_relax): New method definition.
7816 (Target_arm::do_relax, Target_arm::group_sections,
7817 Target_arm::scan_reloc_for_stub,
7818 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7819 (Target_arm::arm_input_section_map_): New data member declaration.
7820 (Target_arm::scan_reloc_for_stub,
7821 Target_arm::scan_reloc_section_for_stubs,
7822 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7823 Target_arm::do_relax): New method definitions.
7824
5d329b7d
ILT
78252009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7826
7827 * configure.ac: Check for (struct stat)::st_mtim
7828 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7829 * config.in: Regenerate.
7830 * configure: Regenerate.
7831
96a0d71b
ILT
78322009-11-05 Ian Lance Taylor <iant@google.com>
7833
7834 PR 10910
7835 * output.cc (Output_segment::add_output_section): Add missing
7836 return statement.
7837
594c8e5e
ILT
78382009-11-04 Ian Lance Taylor <iant@google.com>
7839
7840 PR 10880
7841 * object.h (class Object): Add is_needed and set_is_needed
7842 methods. Add is_needed_ field. Make bool fields into bitfields.
7843 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7844 defined in a dynamic object and referenced by a regular object,
7845 set is_needed for the dynamic object.
7846 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7847 if the file is marked with as_needed and it is not needed.
7848
22b127cc
ILT
78492009-11-04 Ian Lance Taylor <iant@google.com>
7850
7851 PR 10887
7852 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7853 tags if data is discarded by linker script.
7854 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7855 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7856 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7857 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7858
f5c870d2
ILT
78592009-11-04 Ian Lance Taylor <iant@google.com>
7860
7861 * layout.cc (Layout::get_output_section): Add is_interp and
7862 is_dynamic_linker_section parameters. Change all callers.
7863 (Layout::choose_output_section): Likewise.
7864 (Layout::make_output_section): Likewise.
7865 (Layout::add_output_section_data): Add is_dynamic_linker_section
7866 parameter. Change all callers.
7867 * layout.h (class Layout): Update declarations.
7868 * output.h (class Output_section): Add is_interp, set_is_interp,
7869 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7870 Add is_interp_, is_dynamic_linker_section_ fields. Change
7871 generate_code_fills_at_write_ to a bitfield.
7872 * output.cc (Output_section::Output_sections): Initialize new
7873 fields.
7874 (Output_segment::add_output_section): Add do_sort parameter.
7875 Change all callers.
7876
1ae4d23b
ILT
78772009-11-03 Ian Lance Taylor <iant@google.com>
7878
7879 PR 10860
7880 * options.h (class General_options): Add --warn-common.
7881 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7882 merging two common symbols.
7883 (Symbol_table::should_override): Handle --warn-common when merging
7884 a common symbol with a defined symbol. Use report_resolve_problem
7885 for multiple definitions.
7886 (Symbol_table::report_resolve_problem): New function.
7887 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7888
55da9579
DK
78892009-11-03 Doug Kwan <dougkwan@google.com>
7890
7891 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7892 stub_factory_.
7893 (Target_arm::stub_factory): New method definition.
7894 (Target_arm::new_arm_input_section,
7895 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7896 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 7897 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
7898 New type definitions.
7899 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7900 member declarations.
7901 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7902 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7903 New method definitions.
7904
37a9ac43
ILT
79052009-11-03 Ian Lance Taylor <iant@google.com>
7906
7907 * options.h (class General_options): Add --warn_constructors.
7908
b3d6a3d4
ILT
79092009-11-03 Ian Lance Taylor <iant@google.com>
7910
7911 PR 10893
7912 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7913 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7914
934b01dd
ILT
79152009-11-03 Ian Lance Taylor <iant@google.com>
7916
7917 PR 10895
7918 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7919 --msgid-bugs-address.
7920 (install-pdf): New target.
7921 (install-data_yes): Look up one directory to find mkinstalldirs.
7922
03c1939b
L
79232009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7924
7925 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7926 tree.
7927
ebd95253
DK
79282009-10-30 Doug Kwan <dougkwan@google.com>
7929
7930 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7931
e9bbb538
DK
79322009-10-30 Doug Kwan <dougkwan@google.com>
7933
7934 * arm.cc (Stub_addend_reader): New struct template definition
7935 and partial specializations.
7936 (Stub_addend_reader::operator()): New method definition for a
7937 partially specialized template.
7938
d5b40221
DK
79392009-10-30 Doug Kwan <dougkwan@google.com>
7940
7941 * arm.cc (Arm_relobj::processor_specific_flags): New method
7942 definition.
7943 (Arm_relobj::do_read_symbols): New method declaration.
7944 (Arm_relobj::processor_specific_flags_): New data member declaration.
7945 (Arm_dynobj): New class definition.
7946 (Target_arm::do_finalize_sections): Add input_objects parameter.
7947 (Target_arm::do_adjust_elf_header): New method declaration.
7948 (Target_arm::are_eabi_versions_compatible,
7949 (Target_arm::merge_processor_specific_flags): New method declaration.
7950 (Target_arm::do_make_elf_object): New overloaded method definitions
7951 and declaration.
7952 (Arm_relobj::do_read_symbols): New method definition.
7953 (Arm_dynobj::do_read_symbols): Ditto.
7954 (Target_arm::do_finalize_sections): Add input_objects parameters.
7955 Merge processor-specific flags from all input objects.
7956 (Target_arm::are_eabi_versions_compatible,
7957 Target_arm::merge_processor_specific_flags,
7958 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7959 New method definitions.
7960 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7961 Input_objects pointer type parameter.
7962 * layout.cc (Layout::finalize): Pass input objects to target's.
7963 finalize_sections function.
7964 * output.cc (Output_file_header::do_sized_write): Set ELF file
7965 header's processor-specific flags.
7966 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7967 Input_objects pointer type parameter.
7968 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7969 * target.h (Input_objects): New forward class declaration.
7970 (Target::processor_specific_flags,
7971 Target::are_processor_specific_flags_sect): New method definitions.
7972 (Target::finalize_sections): Add input_objects parameter.
7973 (Target::Target): Initialize processor_specific_flags_ and
7974 are_processor_specific_flags_set_.
7975 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7976 parameter.
7977 (Target::set_processor_specific_flags): New method definition.
7978 (Target::processor_specific_flags_,
7979 Target::are_processor_specific_flags_set_): New data member
7980 declarations.
7981 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7982 Input_objects pointer type parameter.
7983
ebabffbd
DK
79842009-10-30 Doug Kwan <dougkwan@google.com>
7985
7986 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7987
ad0f2072
ILT
79882009-10-28 Ian Lance Taylor <iant@google.com>
7989
7990 * object.h (class Relobj): Drop options parameter from
7991 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7992 do_scan_relocs, do_relocate. Change all callers.
7993 (class Sized_relobj): Drop options parameters from
7994 do_gc_process_relocs, do_scan_relocs, do_relocate,
7995 do_relocate_sections, relocate_sections, emit_relocs_scan,
7996 emit_relocs_scan_reltype. Change all callers.
7997 (struct Relocate_info): Remove options field and all references to
7998 it.
7999 * reloc.h (class Read_relocs): Remove options constructor
8000 parameter and options_ field. Change all callers.
8001 (class Gc_process_relocs, class Scan_relocs): Likewise.
8002 (class Relocate_task): Likewise.
8003 * target-reloc.h (scan_relocs): Remove options parameter. Change
8004 all callers.
8005 (scan_relocatable_relocs): Likewise.
8006 * target.h (class Sized_target): Remove options parameter from
8007 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8008 all callers.
8009 * gc.h (gc_process_relocs): Remove options parameter. Change all
8010 callers.
8011 * arm.cc: Update functions to remove options parameters.
8012 * i386.cc: Likewise.
8013 * powerpc.cc: Likewise.
8014 * sparc.cc: Likewise.
8015 * x86_64.cc: Likewise.
8016 * testsuite/testfile.cc: Likewise.
8017
8ffa3667
DK
80182009-10-28 Doug Kwan <dougkwan@google.com>
8019
8020 * arm.cc (Arm_relobj): New class definition.
e1df38aa 8021 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
8022 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8023 New method definitions.
8024
40f36857
CC
80252009-10-28 Cary Coutant <ccoutant@google.com>
8026
8027 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8028 (Plugin::cleanup_done_): New member.
8029 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8030 (Plugin_manager::cleanup_done_): Remove.
8031 (Plugin_manager::add_input_file): Edit error message.
8032 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8033 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8034
2c849493
ILT
80352009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8036
8037 * fileread.cc: (File_read::View::~View): Use the new
8038 data_ownership_ filed.
8039 (File_read::~File_read): Dispose the new whole_file_view_.
8040 (File_read::open): Mmap the whole file if needed.
8041 (File_read::open): Use whole_file_view_ instead of contents_.
8042 (File_read::find_view): Use whole_file_view_ if applicable.
8043 (File_read::do_read): Use whole_file_view_ instead of contents_.
8044 (File_read::make_view): Use whole_file_view_ instead of contents_,
8045 update File_read::View::View call.
8046 (File_read::find_or_make_view): Update File_read::View::View
8047 call.
8048 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8049 remove contents_
8050 (File_read::View::Data_ownership): New enum.
8051 (File_read::View::View): Replace bool mapped_ with Data_ownership
8052 argument.
8053 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8054 (File_read::View::data_ownership_): New field.
8055 (File_read::contents_): Remove (replaced by whole_file_view_).
8056 (File_read::whole_file_view_): New field.
8057 * options.h (class General_options): Add --keep-files-mapped.
8058
24998053
CC
80592009-10-27 Cary Coutant <ccoutant@google.com>
8060
8061 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8062 * testsuite/Makefile.am (plugin_test_5): New test case.
8063 * testsuite/Makefile.in: Regenerate.
8064
72adc4fa
DK
80652009-10-25 Doug Kwan <dougkwan@google.com>
8066
8067 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8068 from private to protected to allow access by child class.
8069 (Sized_relobj::do_relocate_sections): New method declaration.
8070 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 8071 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
8072 Sized_relobj::relocate_sections. Instantiate template explicitly
8073 for different target sizes and endianity.
8074
07f508a2
DK
80752009-10-24 Doug Kwan <dougkwan@google.com>
8076
8077 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8078 (Arm_input_section::as_arm_input_section): New method.
8079 (Arm_output_section): New class definition.
8080 (Arm_output_section::create_stub_group,
8081 Arm_output_section::group_sections): New method definitions.
8082
10ad9fe5
DK
80832009-10-22 Doug Kwan <dougkwan@google.com>
8084
8085 * arm.cc (Arm_input_section): New class definition.
8086 (Arm_input_section::init, Arm_input_section:do_write,
8087 Arm_input_section::set_final_data_size,
8088 Arm_input_section::do_reset_address_and_file_offset): New method
8089 definitions.
8090
56ee5e00
DK
80912009-10-21 Doug Kwan <dougkwan@google.com>
8092
8093 * arm.cc (Stub_table, Arm_input_section): New forward class
8094 declarations.
8095 (Stub_table): New class defintion.
8096 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8097 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8098 New method definition.
8099
b569affa
DK
81002009-10-21 Doug Kwan <dougkwan@google.com>
8101
8102 * arm.cc: Update copyright comments.
8103 (Target_arm): New forward class template declaration.
8104 (Arm_address): New type.
8105 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8106 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8107 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8108 constants.
8109 (Insn_template): Same.
8110 (DEF_STUBS): New macro.
8111 (Stub_type): New enum type.
8112 (Stub_template): New class definition.
8113 (Stub): Same.
8114 (Reloc_stub): Same.
8115 (Stub_factory): Same.
8116 (Target_arm::Target_arm): Initialize may_use_blx_ and
8117 should_force_pic_veneer_.
8118 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8119 Target_arm::should_force_pic_veneer,
8120 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8121 Target_arm::using_thumb_only, Target_arm:;default_target): New
8122 method defintions.
8123 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8124 New data member declarations.
8125 (Insn_template::size, Insn_template::alignment): New method defintions.
8126 (Stub_template::Stub_template): New method definition.
8127 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8128 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8129 (Stub_factory::Stub_factory): New method definition.
8130 * gold.h (string_hash): New template.
8131 * output.h (Input_section_specifier::hash_value): Use
8132 gold::string_hash.
8133 (Input_section_specifier::string_hash): Remove.
8134 * stringpool.cc (Stringpool_template::string_hash): Use
8135 gold::string_hash.
8136
6c172549
DK
81372009-10-20 Doug Kwan <dougkwan@google.com>
8138
8139 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8140 symbols of relaxed input sections.
8141 * output.h (Output_section::find_relaxed_input_section): Make
8142 method public.
8143
c5617f2f
DK
81442009-10-16 Doug Kwan <dougkwan@google.com>
8145
8146 * dynobj.cc (Versions::Versions): Initialize version_script_.
8147 Only insert base version symbol definition for a shared object
8148 if version script defines any version versions.
8149 (Versions::define_base_version): New method definition.
8150 (Versions::add_def): Check that base version is not needed.
8151 (Versions::add_need): Define base version lazily.
8152 * dynobj.h (Versions::define_base_version): New method declaration.
8153 (Versions::needs_base_version_): New data member declaration.
8154 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8155 (check_DATA): Add no_version_test.stdout.
8156 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8157 New make rules.
8158 * testsuite/Makefile.in: Regenerate.
8159 * testsuite/no_version_test.c: New file.
8160 * testsuite/no_version_test.sh: Ditto.
8161
3c12dcdb
DK
81622009-10-16 Doug Kwan <dougkwan@google.com>
8163
8164 * expression.cc (class Segment_start_expression): New class definition.
8165 (Segment_start_expression::value): New method definition.
8166 (script_exp_function_segment_start): Return a new
8167 Segment_start_expression.
8168 * gold/script-c.h (script_saw_segment_start_expression): New function
8169 prototype.
8170 * script-sections.cc (Script_sections::Script_sections): Initialize
8171 SAW_SEGMENT_START_EXPRESSION_ to false.
8172 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8173 and -Tbbs options to specify section addresses if given in
8174 command line and no SEGMENT_START expression is seen in a script.
8175 * script-sections.h (Script_sections::saw_segment_start_expression,
8176 Script_sections::set_saw_segment_start_expression): New method
8177 definition.
8178 (Script_sections::saw_segment_start_expression_): New data member
8179 declaration.
8180 * script.cc (script_saw_segment_start_expression): New function.
8181 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8182 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8183 script_test_7.sh and script_test_8.sh.
8184 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8185 script_test_8.stdout.
8186 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8187 (script_test_6, script_test_6.stdout, script_test_7,
8188 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8189 * Makefile.in: Regenerate.
8190 * testsuite/script_test_6.sh: New file.
8191 * testsuite/script_test_6.t: Same.
8192 * testsuite/script_test_7.sh: Same.
8193 * testsuite/script_test_7.t: Same.
8194 * testsuite/script_test_8.sh: Same.
8195
64b1ae37
DK
81962009-10-16 Doug Kwan <dougkwan@google.com>
8197
8198 * output.cc (Output_segment::set_section_list_address): Cast
8199 expressions to unsigned long long type to avoid format warnings.
8200
661be1e2
ILT
82012009-10-15 Ian Lance Taylor <iant@google.com>
8202
12edd763 8203 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 8204 dot assignment to script_sections_.
12edd763
ILT
8205 * script-sections.cc (Script_sections::add_dot_assignment):
8206 Initialize if necessary.
8207
68b6574b
ILT
8208 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8209 program headers with no load segment if there is a linker script.
8210
661be1e2
ILT
8211 * layout.cc (Layout::set_segment_offsets): Align the file offset
8212 to the segment aligment for -N or -n with no load segment.
8213 * output.cc (Output_segment::add_output_section): Don't crash if
8214 the first section is a TLS section.
8215 (Output_segment::set_section_list_addresses): Print an error
8216 message if the address moves backward in a linker script.
8217 * script-sections.cc
8218 (Output_section_element_input::set_section_addresses): Don't
8219 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8220 (Orphan_output_section::set_section_addresses): Likewise.
8221
f15f61a7
DK
82222009-10-15 Doug Kwan <dougkwan@google.com>
8223
8224 * layout.cc (Layout::finish_dynamic_section): Generate tags
8225 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8226 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8227 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8228
82bb573a
ILT
82292009-10-14 Ian Lance Taylor <iant@google.com>
8230
8231 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8232 fields.
8233 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8234 data_shdr fields of relinfo.
8235 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8236 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8237 R_386_TLS_LDO_32, adjust based on section flags.
8238 (Target_i386::Relocate::fix_up_ldo): Remove.
8239
374ad285
ILT
82402009-10-13 Ian Lance Taylor <iant@google.com>
8241
8242 Add support for -pie.
8243 * options.h (class General_options): Add -pie and
8244 --pic-executable.
8245 (General_options::output_is_position_independent): Test -pie.
8246 (General_options::output_is_executable): Return true if not shared
8247 and not relocatable.
8248 (General_options::output_is_pie): Remove.
8249 * options.cc (General_options::finalize): Reject incompatible uses
8250 of -pie.
8251 * gold.cc (queue_middle_tasks): A -pie link is not static.
8252 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8253 * symtab.cc (Symbol::final_value_is_known): Return false if
8254 output_is_position_independent.
8255 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8256 output_is_position_independent.
8257 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8258 output_is_position_independent.
8259 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8260 output_is_position_independent.
8261 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8262 two_file_pie_test.
8263 (basic_pie_test.o, basic_pie_test): New targets.
8264 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8265 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8266 (two_file_pie_test): New target.
8267 * testsuite/Makefile.in: Rebuild.
8268 * README: Remove note saying that -pie is not supported.
8269
c6585162
ILT
82702009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8271
8272 * options.h (class General_options): Add -init and -fini.
8273 * layout.cc (Layout::finish_dynamic_section): Emit
8274 given init and fini functions.
8275
032ce4e9
ST
82762009-10-13 Sriraman Tallam <tmsriram@google.com>
8277
8278 * gc.h (gc_process_relocs): Check if icf is enabled using new
8279 function.
8280 * gold.cc (queue_initial_tasks): Likewise.
8281 (queue_middle_tasks): Likewise.
8282 * object.cc (do_layout): Likewise.
8283 * symtab.cc (is_section_folded): Likewise.
8284 * main.cc (main): Likewise.
8285 * reloc.cc (Read_relocs::run): Likewise.
8286 (Sized_relobj::do_scan_relocs): Likewise.
8287 * icf.cc (is_function_ctor_or_dtor): New function.
8288 (Icf::find_identical_sections): Check if function is ctor or dtor when
8289 safe icf is chosen.
8290 * options.h (General_options::icf): Change option to be an enum.
8291 (Icf_status): New enum.
8292 (icf_enabled): New method.
8293 (icf_safe_folding): New method.
8294 (set_icf_status): New method.
8295 (icf_status_): New variable.
8296 * (options.cc) (General_options::finalize): Set icf_status_.
8297 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8298 icf_test and icf_keep_unique_test to use the --icf enum flag.
8299 * testsuite/icf_safe_test.sh: New file.
e1df38aa 8300 * testsuite/icf_safe_test.cc: New file.
032ce4e9 8301
f345227a
ST
83022009-10-12 Sriraman Tallam <tmsriram@google.com>
8303
8304 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8305 includes to gc.h and icf.h.
8306 * arm.cc: Include gc.h.
8307 * gold.cc: Likewise.
8308 * i386.cc: Likewise.
8309 * powerpc.cc: Likewise.
8310 * sparc.cc: Likewise.
8311 * x86_64.cc: Likewise.
8312 * gc.h: Include icf.h.
8313
1c7814ed
ILT
83142009-10-11 Ian Lance Taylor <iant@google.com>
8315
8316 * plugin.cc: Include "gold.h" before other header files.
8317
ae3b5189
CD
83182009-10-10 Chris Demetriou <cgd@google.com>
8319
8320 * options.h (Input_file_argument::Input_file_type): New enum.
8321 (Input_file_argument::is_lib_): Replace with...
8322 (Input_file_argument::type_): New member.
8323 (Input_file_argument::Input_file_argument): Take Input_file_type
8324 'type' rather than boolean 'is_lib' as second argument.
8325 (Input_file_argument::is_lib): Use type_.
8326 (Input_file_argument::is_searched_file): New function.
8327 (Input_file_argument::may_need_search): Handle is_searched_file.
8328 * options.cc (General_options::parse_library): Support -l:filename.
8329 (General_options::parse_just_symbols): Update for Input_file_argument
8330 changes.
8331 (Command_line::process): Likewise.
8332 * archive.cc (Archive::get_file_and_offset): Likewise.
8333 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8334 * script.cc (read_script_file, script_add_file): Likewise.
8335 * fileread.cc (Input_file::Input_file): Likewise.
8336 (Input_file::will_search_for): Handle is_searched_file.
8337 (Input_file::open): Likewise.
8338 * readsyms.cc (Read_symbols::get_name): Likewise.
8339 * testsuite/Makefile.am (searched_file_test): New test.
8340 * testsuite/Makefile.in: Regenerate.
8341 * testsuite/searched_file_test.cc: New file.
8342 * testsuite/searched_file_test_lib.cc: New file.
8343
f3048a1d
ILT
83442009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8345 Ian Lance Taylor <iant@google.com>
8346
8347 * descriptor.cc: Include <cstdio> and "binary-io.h".
8348 (Descriptors::open): Open the files in binary mode always.
8349 * script.cc (Lex::get_token): Treat \r as whitespace.
8350
d4780e57
ILT
83512009-10-09 Ian Lance Taylor <iant@google.com>
8352
8353 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8354
d9a893b8
ILT
83552009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8356 Ian Lance Taylor <iant@google.com>
8357
8358 * configure.ac: Check for readv function also.
8359 * fileread.cc (readv): Define if not HAVE_READV.
8360 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8361 does not exist.
8362 * config.in: Regenerate.
8363 * configure: Regenerate.
8364
c0a62865
DK
83652009-10-09 Doug Kwan <dougkwan@google.com>
8366
8367 * layout.cc (Layout::make_output_section): Call target hook to make
8368 ordinary output section.
8369 (Layout::finalize): Adjust parameter list of call the
8370 Target::may_relax().
8371 * layout.h (class Layout::section_list): New method.
8372 * merge.h (Output_merge_base::entsize): Change visibility to public.
8373 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8374 New methods.
8375 (Output_merge_string::do_is_string): New method.
8376 * object.cc (Sized_relobj::do_setup): renamed from
8377 Sized_relobj::set_up.
8378 * object.h (Sized_relobj::adjust_shndx,
8379 Sized_relobj::initializ_input_to_output_maps,
8380 Sized_relobj::free_input_to_output_maps): Change visibilities to
8381 protected.
8382 (Sized_relobj::setup): Virtualize.
8383 (Sized_relobj::do_setup): New method declaration.
8384 (Sized_relobj::invalidate_section_offset,
8385 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8386 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8387 * options.cc (parse_int): New function.
8388 * options.h (parse_int): New declaration.
8389 (DEFINE_int): New macro.
8390 (stub_group_size): New option.
8391 * output.cc (Output_section::Output_section): Initialize memebers
8392 merge_section_map_, merge_section_by_properties_map_,
8393 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8394 (Output_section::add_input_section): Handled deferred code-fill
8395 generation and remove an old comment.
8396 (Output_section::add_relaxed_input_section): New method definition.
8397 (Output_section::add_merge_input_section): Use merge section by
8398 properties map to speed to search. Update merge section maps
8399 as appropriate.
8400 (Output_section::build_relaxation_map): New method definition.
8401 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8402 Same.
8403 (Output_section::relax_input_section): Renamed to
8404 Output_section::convert_input_sections_to_relaxed_sections and change
8405 interface to take a vector of pointers to relaxed sections.
8406 (Output_section::find_merge_section,
8407 Output_section::find_relaxed_input_section): New method definitions.
8408 (Output_section::is_input_address_mapped,
8409 Output_section::output_offset, Output_section::output_address):
8410 Use output section data maps to speed up searching.
8411 (Output_section::find_starting_output_address): Add comments.
8412 (Output_section::do_write,
8413 Output_section::write_to_postprocessing_buffer): Do code-fill
8414 generation as appropriate.
8415 (Output_section::get_input_sections): Invalidate relaxed input section
8416 map.
8417 (Output_section::restore_states): Adjust type of checkpoint .
8418 Invalidate relaxed input section map.
8419 * output.h (Output_merge_base): New class declaration.
8420 (Input_section_specifier): New class defintion.
8421 (class Output_relaxed_input_section) Change base class to
8422 Output_section_data_build.
8423 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8424 base class initializer.
8425 (Output_section::add_relaxed_input_section): New method declaration.
8426 (Output_section::Input_section): Change visibility to protected.
8427 (Output_section::Input_section::relobj,
8428 Output_section::Input_section::shndx): Handle relaxed input sections.
8429 Output_section::input_sections) Change visibility to protected. Also
8430 define overload to return a non-const pointer.
8431 (Output_section::Merge_section_properties): New class defintion.
8432 (Output_section::Merge_section_by_properties_map,
8433 Output_section::Output_section_data_by_input_section_map,
8434 Output_section::Relaxation_map): New types.
8435 (Output_section::relax_input_section): Rename method to
8436 Output_section::convert_input_sections_to_relaxed_sections and change
8437 interface to take a vector of relaxed section pointers.
8438 (Output_section::find_merge_section,
8439 Output_section::find_relaxed_input_section,
8440 Output_section::build_relaxation_map,
8441 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8442 New method declarations.
8443 (Output_section::merge_section_map_
8444 Output_section::merge_section_by_properties_map_,
8445 Output_section::relaxed_input_section_map_,
8446 Output_section::is_relaxed_input_section_map_valid_,
8447 Output_section::generate_code_fills_at_write_): New data members.
8448 * script-sections.cc
8449 (Output_section_element_input::set_section_addresses): Call
8450 current_data_size and addralign methods of relaxed input sections.
8451 (Orphan_output_section::set_section_addresses): Call current_data_size
8452 and addralign methods of relaxed input sections.
8453 * symtab.cc (Symbol_table::compute_final_value): Extract template
8454 from the body of Symbol_table::sized_finalize_symbol.
8455 (Symbol_table::sized_finalized_symbol): Call
8456 Symbol_table::compute_final_value.
8457 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8458 (Symbol_table::compute_final_value): New templated method declaration.
8459 * target.cc (Target::do_make_output_section): New method defintion.
8460 * target.h (Target::make_output_section): New method declaration.
8461 (Target::relax): Add more parameters for input objects, symbol table
8462 and layout. Adjust call to do_relax.
8463 (Target::do_make_output_section): New method declaration.
8464 (Target::do_relax): Add parameters for input objects, symbol table
8465 and layout.
8466
d446d6c4
ILT
84672009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8468
8469 * pread.c: Include stdio.h.
8470
bc06c745
ILT
84712009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8472
8473 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8474 defined.
8475
75aea3d0
ILT
84762009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8477
8478 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8479 Change read_shndx type to unsigned int.
8480 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8481 int.
8482 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8483 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8484 Change read_shndx type to unsigned int.
8485 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8486 int.
8487 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8488 * layout.cc (Layout::create_symtab_sections): Cast the result of
8489 local_symcount * symsize to off_t in the gold_assert.
8490
be8fcb75
ILT
84912009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8492
8493 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8494 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8495 R_ARM_BASE_ABS.
8496 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8497 (Arm_relocate_functions::thm_abs5): New function.
8498 (Arm_relocate_functions::abs12): New function.
8499 (Arm_relocate_functions::abs16): New function.
8500 (Arm_relocate_functions::base_abs): New function.
8501 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8502 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8503 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8504 R_ARM_BASE_ABS.
8505 (Scan::global): Likewise.
8506 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8507 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8508 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8509 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8510 R_ARM_BASE_ABS.
8511
c2a122b6
ILT
85122009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8513
8514 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8515 (Arm_relocate_functions::movt_prel): New function.
8516 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8517 (Arm_relocate_functions::thm_movt_prel): New function.
8518 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8519 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8520 (Scan::global, Relocate::relocate): Likewise.
8521 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8522
c4aa1e2d
ILT
85232009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8524
8525 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8526 Incremental_checker.
8527 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8528 unsigned int.
8529 (class Incremental_inputs_header): New class.
8530 (Incremental_inputs_header_writer): Edit comment.
8531 (Incremental_inputs_entry): New class.
8532 (Incremental_inputs_entry_writer): Edit comment.
8533 (Sized_incremental_binary::do_find_incremental_inputs_section):
8534 Add *strtab_shndx parameter, fill it.
8535 (Sized_incremental_binary::do_check_inputs): New method.
8536 (Incremental_checker::can_incrementally_link_output_file): Use
8537 Sized_incremental_binary::check_inputs.
8538 (Incremental_inputs::report_command_line): Save command line in
8539 command_line_.
8540 * incremental.h:
8541 (Incremental_binary::find_incremental_inputs_section): New
8542 method.
8543 (Incremental_binary::do_find_incremental_inputs_section): Add
8544 strtab_shndx parameter.
8545 (Incremental_binary::do_check_inputs): New pure virtual method.
8546 (Sized_incremental_binary::do_check_inputs): Declare.
8547 (Incremental_checker::Incremental_checker): Add incremental_inputs
8548 parameter, use it to initialize incremental_inputs_.
8549 (Incremental_checker::incremental_inputs_): New field.
8550 (Incremental_checker::command_line): New method.
8551 (Incremental_checker::inputs): New method.
8552 (Incremental_checker::command_line_): New field.
8553
c549a694
ILT
85542009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8555
8556 * incremental.cc: Include <cstdarg> and "target-select.h".
8557 (vexplain_no_incremental): New function.
8558 (explain_no_incremental): New function.
8559 (Incremental_binary::error): New method.
8560 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8561 method.
8562 (make_sized_incremental_binary): New function.
8563 (open_incremental_binary): New function.
8564 (can_incrementally_link_file): Add checks if output is ELF and has
8565 inputs section.
8566 * incremental.h: Include "elfcpp_file.h" and "output.h".
8567 (Incremental_binary): New class.
8568 (Sized_incremental_binary): New class.
8569 (open_incremental_binary): Declare.
8570 * object.cc (is_elf_object): Use
8571 elfcpp::Elf_recognizer::is_elf_file.
8572 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8573 * output.h (Output_file::filesize): New method.
8574
fd3c5f0b
ILT
85752009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8576
8577 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8578 New function.
8579 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8580 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8581 function.
8582 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8583 function.
8584 (Arm_relocate_functions::movw_abs_nc): New function.
8585 (Arm_relocate_functions::movt_abs): New function.
8586 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8587 (Arm_relocate_functions::thm_movt_abs): New function.
8588 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8589 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8590 (Scan::global): Likewise.
8591 (Relocate::relocate): Likewise.
8592 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8593
7f5309a5
ILT
85942009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8595
8596 * arm.cc (Arm_relocate_functions::got_prel) New function.
8597 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8598 (Relocate::relocate): Likewise.
8599 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8600
364c7fa5
ILT
86012009-10-06 Ian Lance Taylor <iant@google.com>
8602
8603 * options.h (class General_options): Define
8604 split_stack_adjust_size parameter.
8605 * object.h (class Object): Add uses_split_stack_ and
8606 has_no_split_stack_ fields. Add uses_split_stack and
8607 has_no_split_stack accessor functions. Declare
8608 handle_split_stack_section.
8609 (class Reloc_symbol_changes): Define.
8610 (class Sized_relobj): Define Function_offsets. Declare
8611 split_stack_adjust, split_stack_adjust_reltype, and
8612 find_functions.
8613 * object.cc (Object::handle_split_stack_section): New function.
8614 (Sized_relobj::do_layout): Call handle_split_stack_section.
8615 * dynobj.cc (Sized_dynobj::do_layout): Call
8616 handle_split_stack_section.
8617 * reloc.cc (Sized_relobj::relocate_sections): Call
8618 split_stack_adjust for executable sections in split_stack
8619 objects. Pass reloc_map to relocate_section.
8620 (Sized_relobj::split_stack_adjust): New function.
8621 (Sized_relobj::split_stack_adjust_reltype): New function.
8622 (Sized_relobj::find_functions): New function.
8623 * target-reloc.h: Include "object.h".
8624 (relocate_section): Add reloc_symbol_changes parameter. Change
8625 all callers.
8626 * target.h (class Target): Add calls_non_split method. Declare
8627 do_calls_non_split virtual method. Declare match_view and
8628 set_view_to_nop.
8629 * target.cc: Include "elfcpp.h".
8630 (Target::do_calls_non_split): New function.
8631 (Target::match_view): New function.
8632 (Target::set_view_to_nop): New function.
8633 * gold.cc (queue_middle_tasks): Give an error if mixing
8634 split-stack and non-split-stack objects with -r.
8635 * i386.cc (Target_i386::relocate_section): Add
8636 reloc_symbol_changes parameter.
8637 (Target_i386::do_calls_non_split): New function.
8638 * x86_64.cc (Target_x86_64::relocate_section): Add
8639 reloc_symbol_changes parameter.
8640 (Target_x86_64::do_calls_non_split): New function.
8641 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8642 parameter.
8643 * powerpc.cc (Target_powerpc::relocate_section): Add
8644 reloc_symbol_changes parameter.
8645 * sparc.cc (Target_sparc::relocate_section): Add
8646 reloc_symbol_changes parameter.
8647 * configure.ac: Call AM_CONDITIONAL for the default target.
8648 * configure: Rebuild.
8649 * testsuite/Makefile.am (TEST_AS): New variable.
8650 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8651 (check_DATA): Add split_i386 and split_x86_64 files.
8652 (SPLIT_DEFSYMS): Define.
8653 (split_i386_[1234n].o): New targets.
8654 (split_i386_[124]): New targets.
8655 (split_i386_[1234r].stdout): New targets.
8656 (split_x86_64_[1234n].o): New targets.
8657 (split_x86_64_[124]): New targets.
8658 (split_x86_64_[1234r].stdout): New targets.
8659 (MOSTLYCLEANFILES): Add new executables.
8660 * testsuite/split_i386.sh: New file.
8661 * testsuite/split_x86_64.sh: New file.
8662 * testsuite/split_i386_1.s: New file.
8663 * testsuite/split_i386_2.s: New file.
8664 * testsuite/split_i386_3.s: New file.
8665 * testsuite/split_i386_4.s: New file.
8666 * testsuite/split_i386_n.s: New file.
8667 * testsuite/split_x86_64_1.s: New file.
8668 * testsuite/split_x86_64_2.s: New file.
8669 * testsuite/split_x86_64_3.s: New file.
8670 * testsuite/split_x86_64_4.s: New file.
8671 * testsuite/split_x86_64_n.s: New file.
8672 * testsuite/testfile.cc (Target_test): Update relocation_section
8673 function.
8674 * testsuite/Makefile.in: Rebuild.
8675
e8a9fcda
ILT
86762009-10-06 Ian Lance Taylor <iant@google.com>
8677
8678 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8679 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8680 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8681 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8682 the address on ldo_addrs_.
8683 (Target_i386::Relocate::fix_up_ldo): New function.
8684
e99daf92
ILT
86852009-10-06 Rafael Espindola <espindola@google.com>
8686
8687 * plugin.cc (add_input_library): New.
8688 (Plugin::load): Add add_input_library to tv.
8689 (Plugin_manager::add_input_file): Add the is_lib argument.
8690 (add_input_file): Update call to Plugin_manager::add_input_file.
8691 (add_input_library): New.
8692 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8693
966d4097
DK
86942009-09-30 Doug Kwan <dougkwan@google.com>
8695
8696 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8697 symbol and call Symbol::may_need_copy_reloc to determine if
8698 a copy reloc is needed.
8699 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8700 nocopyreloc is given in command line.
8701 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8702 given in command line.
8703 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8704 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8705 of the removed Target_i386::may_need_copy_reloc.
8706 * options.h (copyreloc): New option with default value false.
8707 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8708 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8709 instead of the removed Target_powerpc::may_need_copy_reloc.
8710 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8711 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8712 instead of the removed Target_sparc::may_need_copy_reloc.
8713 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8714 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8715 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8716 instead of the removed Target_x86_64::may_need_copy_reloc.
8717
029ba973
ILT
87182009-09-30 Ian Lance Taylor <iant@google.com>
8719
8720 * object.h (class Object): Remove target_ field, and target,
8721 sized_target, and set_target methods.
8722 (Object::sized_target): Remove.
8723 (class Sized_relobj): Update declarations. Remove sized_target.
8724 * object.cc (Sized_relobj::setup): Remove target parameter.
8725 Change all callers.
8726 (Input_objects::add_object): Don't do anything with the target.
8727 (make_elf_sized_object): Add punconfigured parameter. Change all
8728 callers. Set or test parameter target.
8729 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8730 Change all callers.
8731 * parameters.cc (Parameters::set_target): Change parameter type to
8732 be non-const.
8733 (Parameters::default_target): Remove.
8734 (set_parameters_target): Change parameter type to be non-const.
8735 (parameters_force_valid_target): New function.
8736 (parameters_clear_target): New function.
8737 * parameters.h (class Parameters): Update declarations. Remove
8738 default_target method. Add sized_target and clear_target
8739 methods. Change target_ to be non-const.
8740 (set_parameters_target): Update declaration.
8741 (parameters_force_valid_target): Declare.
8742 (parameters_clear_target): Declare.
8743 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8744 as NULL if we aren't searching.
8745 (Add_symbols::run): Don't check for compatible target.
8746 * fileread.cc (Input_file::open_binary): Call
8747 parameters_force_valid_target.
8748 * gold.cc (queue_middle_tasks): Likewise.
8749 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8750 set_target on object.
8751 * dynobj.h (class Sized_dynobj): Update declarations.
8752 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8753 make_elf_object returns NULL.
8754 (Archive::include_member): Don't check whether object target is
8755 compatible.
8756 * output.cc (Output_section::add_input_section): Get target from
8757 parameters.
8758 (Output_section::relax_input_section): Likewise.
8759 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8760 parameters.
8761 (Sized_relobj::do_scan_relocs): Likewise.
8762 (Sized_relobj::relocate_sections): Likewise.
8763 * resolve.cc (Symbol_table::resolve): Likewise.
8764 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8765 parameter. Change all callers.
8766 (Symbol_table::add_from_object): Get target from parameters.
8767 (Symbol_table::add_from_relobj): Don't check object target.
8768 (Symbol_table::add_from_dynobj): Likewise.
8769 (Symbol_table::define_special_symbol): Get target from
8770 parameters.
8771 * symtab.h (class Symbol_table): Update declaration.
8772 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8773 parameter. Change all callers. Clear parameter target.
8774 (Binary_test): Test target here.
8775 * testsuite/object_unittest.cc (gold_testsuite): Remove
8776 target_test_pointer parameter. Change all callers.
8777 (Object_test): Test target here.
8778
a6a22b83
ILT
87792009-09-26 Ian Lance Taylor <iant@google.com>
8780
8781 * testsuite/initpri1.c: Don't try to use constructor priorities if
8782 compiling with gcc before 4.3.
8783
6a8f49fe
ILT
87842009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8785
8786 * testsuite/retain_symbols_file_test.sh (check_present): Change
8787 output file name to retain_symbols_file_test.stdout.
8788 (check_absent): Likewise.
8789
8c604651
CS
87902009-09-18 Craig Silverstein <csilvers@google.com>
8791
8792 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8793 * options.cc: Include <cerrno> and <fstream>.
8794 (General_options::finalize): Parse -retain-symbols-file tag.
8795 * options.h: New flag.
8796 (General_options): New method should_retain_symbol, new
8797 variable symbols_to_retain.
8798 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8799 should_retain_symbol map.
8800 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8801 * testsuite/Makefile.in: Regenerate.
8802 * testsuite/retain_symbols_file_test.sh: New file.
8803
ca58b19f
NC
88042009-09-18 Nick Clifton <nickc@redhat.com>
8805
8806 * po/es.po: Updated Spanish translation.
8807
20e6d0d6
DK
88082009-09-17 Doug Kwan <dougkwan@google.com>
8809
8810 * debug.h (DEBUG_RELAXATION): New constant.
8811 (DEBUG_ALL): Add DEBUG_RELAXATION.
8812 (debug_string_to_enum): Add relaxation debug option.
8813 * layout.cc
8814 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8815 Layout::Relaxation_debug_check::read_sections,
8816 Layout::Relaxation_debug_check::read_sections): New method definitions.
8817 (Layout::Layout): Initialize data members
8818 record_output_section_data_from_scrips_,
8819 script_output_section_data_list_ and relaxation_debug_check_.
8820 (Layout::save_segments, Layout::restore_segments,
8821 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8822 Layout::relaxation_loop_body): New method definitions.
8823 (Layout::finalize): Support relaxation. Move section layout code to
8824 Layout::relaxation_loop_body.
8825 (Layout::set_asection_address_from_script): Move code for orphan
8826 section placement out.
8827 (Layout::place_orphan_sections_in_script): New method definition.
8828 * layout.h (Output_segment_headers, Output_file_header):
8829 New forward class declarations.
8830 (Layout::~Layout): Define.
8831 (Layout::new_output_section_data_from_script): New method definition.
8832 (Layout::place_orphan_sections_in_script): New method declaration.
8833 (Layout::Segment_states): New type declaration.
8834 (Layout::save_segments, Layout::restore_segments,
8835 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8836 Layout::relaxation_loop_body): New method declarations.
8837 (Layout::Output_section_data_list): New type declaration.
8838 (Layout::Relaxation_debug_check): New class definition.
8839 (Layout::record_output_section_data_from_script_,
8840 Layout::script_output_section_data_list_, Layout::segment_states_,
8841 Layout::relaxation_debug_check_): New data members.
8842 * output.cc: (Output_section_headers::do_size): New method definition.
8843 (Output_section_headers::Output_section_headers): Move size
8844 computation to Output_section_headers::do_size.
8845 (Output_segment_headers::do_size): New method definition.
e1df38aa 8846 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
8847 Output_file_header::do_size and call it.
8848 (Output_file_header::do_size): New method definition.
8849 (Output_data_group::Output_data_group): Adjust call to
8850 Output_section_data.
8851 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8852 (Output_symtab_xindex::do_write): Add array bound check.
8853 (Output_section::Input_section::print_to_mapfile): Handle
8854 RELAXED_INPUT_SECTION_CODE.
8855 (Output_section::Output_section): Initialize data member checkpoint_.
8856 (Output_section::~Output_section): Delete checkpoint object pointed
8857 by checkpoint_.
8858 (Output_section::add_input_section): Always add an Input_section if
8859 relaxing.
8860 (Output_section::add_merge_input_section): Add assert.
8861 (Output_section::relax_input_section): New method definition.
8862 (Output_section::set_final_data_size): Set load address to zero for
8863 an unallocated section.
8864 (Output_section::do_address_and_file_offset_have_reset_values):
8865 New method definition.
8866 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8867 Handle relaxed input section.
8868 (Output_section::sort_attached_input_sections): Checkpoint input
8869 section list lazily.
8870 (Output_section::get_input_sections): Change type of input_sections to
8871 list of Simple_input_section pointers. Checkpoint input section list
8872 lazily. Also handle relaxed input sections.
8873 (Output_section::add_input_section_for_script): Take a reference to
8874 a Simple_input_section object instead of Relobj pointer and section
8875 index as parameter. Handle relaxed input sections.
8876 (Output_section::save_states, Output_section::restore_states): New
8877 method definitions.
8878 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8879 (Output_data::is_data_size_fixed): New method definition.
8880 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8881 if it is fixed.
8882 (Output_data::address_and_file_offset_have_reset_values): New method
8883 definition.
8884 (Output_data::do_address_and_file_offset_have_reset_values): New method
8885 definition.
8886 (Output_data::set_data_size): Check that data size is not fixed.
8887 (Output_data::fix_data_size): New method definition.
8888 (Output_data::is_data_size_fixed_): New data member.
8889 (Output_section_headers::set_final_data_size): New method definition.
8890 (Output_section_headers::do_size): New method declaration.
8891 (Output_segment_headers::set_final_data_size): New method definition.
8892 (Output_segment_headers::do_size): New method declaration.
8893 (Output_file_header::set_final_data_size)::New method definition.
8894 (Output_file_header::do_size)::New method declaration.
8895 (Output_section_data::Output_section_data): Add new parameter
8896 is_data_size_fixed and use it to fix data size.
8897 (Output_data_const::Output_data_const): Adjust call to base class
8898 constructor and fix data size.
8899 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8900 base class constructor and fix data size.
8901 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8902 base class constructor and fix data size.
8903 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8904 class constructor and fix data size.
8905 (Output_data_group::set_final_data_size): New method definition.
8906 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8907 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8908 class constructor and fix data size.
8909 (Output_relaxed_input_section): New class definition.
8910 (Output_section::Simple_input_section): New class definition.
8911 (Output_section::get_input_sections): Adjust parameter list.
8912 (Output_section::add_input_section_for_script): Same.
8913 (Output_section::save_states, Output_section::restore_states,
8914 Output_section::do_address_and_file_offset_have_reset_values,
8915 (Output_section::Input_section::Input_section): Handle
8916 RELAXED_INPUT_SECTION_CODE. Add new overload for
8917 Output_relaxed_input_section.
8918 (Output_section::Input_section::is_input_section,
8919 Output_section::Input_section::set_output_section): Handle relaxed
8920 input section.
8921 (Output_section::Input_section::is_relaxed_input_section,
8922 Output_section::Input_section::output_section_data,
8923 Output_section::Input_section::relaxed_input_section): New method
8924 definitions.
8925 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8926 value.
8927 (Output_section::Input_section::u1_): Update comments.
8928 (Output_section::Input_section::u2_): Add new union member poris.
8929 (Output_section::Checkpoint_output_section): New classs definition.
8930 (Output_section::relax_input_section): New method declaration.
8931 (Output_section::checkpoint_): New data member.
8932 (Output_segment): Update comments.
8933 (Output_segment::Output_segment): Un-privatize copy constructor.
8934 (Output_segment::operator=): Un-privatize.
8935 * script-sections.cc (Output_section_element::Input_section_list):
8936 Change element type to Output_section::Simple_input_section.
8937 (Output_section_element_dot_assignment::set_section_addresses):
8938 Register output section data for relaxation clean up.
8939 (Output_data_exression::Output_data_expression): Adjust call to base
8940 constructor to fix data size.
8941 (Output_section_element_data::set_section_addresses): Register
8942 Output_data_expression object for relaxation clean up.
8943 (struct Input_section_info): Replace Relobj pointer and section index
8944 pair with Output_section::Simple_input_section and Convert struct to a
8945 class.
8946 (Input_section_sorter::operator()): Adjust access to
e1df38aa 8947 Input_section_info data member to use accessors.
20e6d0d6
DK
8948 (Output_section_element_input::set_section_addresses): Use layout
8949 parameter. Adjust code to use Output_section::Simple_input_section
8950 and Input_secction_info classes. Register filler for relaxation
8951 clean up.
8952 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8953 and section index pair with Output_section::Simple_input_section
8954 class. Adjust code accordingly.
8955 (Phdrs_element::release_segment): New method definition.
8956 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8957 segment list.
8958 (Script_sections::release_segments): New method definition.
8959 * gold/script-sections.h (Script_sections::release_segments): New
8960 method declaration.
8961 * gold/target.h (Target::may_relax, Target::relax,
8962 Target::do_may_relax, Target::do_relax): New method definitions.
8963
5e445df6
ILT
89642009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8965
8966 * arm.cc (has_signed_unsigned_overflow): New function.
8967 (Arm_relocate_functions::abs8): New function.
8968 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8969 (Target_arm::Scan::global): Likewise.
8970 (Target_arm::relocate::relocate): Likewise.
8971 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8972 Likewise.
8973
8c604651 89742009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
8975
8976 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8977 * testsuite/Makefile.in: Regenerate.
8978
1e9cc1c2
NC
89792009-09-11 Nick Clifton <nickc@redhat.com>
8980
8981 * po/gold.pot: Updated by the Translation project.
8982
6a89f575
CC
89832009-09-08 Cary Coutant <ccoutant@google.com>
8984
8985 * output.cc (Output_file::open): Add execute permission to empty file.
8986 * testsuite/Makefile.am (permission_test): New test.
8987 * testsuite/Makefile.in: Regenerate.
8988
fdcac5af
ILT
89892009-09-02 Ian Lance Taylor <iant@google.com>
8990
8991 * output.cc (Output_file::resize): Call map_no_anonymous rather
8992 than map.
8993
44453f85
ILT
89942009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8995
8996 * gold.cc: Include "incremental.h".
8997 (queue_initial_tasks): Call Incremental_checker methods.
8998 * incremental.cc: Include "output.h".
8999 (Incremental_checker::can_incrementally_link_output_file): New
9000 method.
9001 * incremental.h (Incremental_checker): New class.
9002
9003 * output.cc (Output_file::open_for_modification): New method.
9004 (Output_file::map_anonymous): Changed return type to bool. Record
9005 map in base_ field.
9006 (Output_file::map_no_anonymous): New method, broken out of map.
9007 (Output_file::map): Use map_no_anonymous and map_anonymous.
9008 * output.h (class Output_file): Update declarations.
9009
293c1386
CC
90102009-08-24 Cary Coutant <ccoutant@google.com>
9011
9012 * options.h (Command_line::Pre_options): New class.
9013 (Command_line::pre_options): New member.
9014 * options.cc (gold::options::ready_to_register): New variable.
9015 (One_option::register_option): Do nothing if not registering options.
9016 Assert if same short option registered twice.
9017 (General_options::General_options): Turn off option registration when
9018 done constructing.
9019 (Command_line::Pre_options::Pre_options): New constructor.
9020
f773f3d2
CC
90212009-08-24 Cary Coutant <ccoutant@google.com>
9022
06a73cfe
CC
9023 * options.h (General_options::no_keep_memory): Remove incorrect
9024 short option.
f773f3d2 9025
a15af8e2
RW
90262009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9027
9028 * Makefile.am (am__skiplex, am__skipyacc): New.
9029 * Makefile.in: Regenerate.
9030
c462b41b
RW
90312009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9032
14ec8efd
RW
9033 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9034 (INCLUDES): ... this.
9035 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9036 (AM_CPPFLAGS): Renamed from ...
9037 (INCLUDE): ... this.
9038 * Makefile.in, testsuite/Makefile.in: Regenerate.
9039
81ecdfbb
RW
9040 * Makefile.in: Regenerate.
9041 * aclocal.m4: Likewise.
9042 * config.in: Likewise.
9043 * configure: Likewise.
9044 * testsuite/Makefile.in: Likewise.
9045
c462b41b
RW
9046 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9047 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9048 * Makefile.in: Regenerate.
9049 * testsuite/Makefile.in: Regenerate.
9050
2da73f13
CC
90512009-08-19 Cary Coutant <ccoutant@google.com>
9052
9053 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9054 symbols in shared libraries overridden by hidden or internal symbols
9055 in the main program.
9056
2db70501
CD
90572009-08-19 Chris Demetriou <cgd@google.com>
9058
9059 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9060 checking source file names in error messages.
9061
f733487b
DK
90622009-08-18 Doug Kwan <dougkwan@google.com>
9063
9064 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9065 an elcpp::Ehdr as parameter. Adjust call to set_target.
9066 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9067 an elfcpp::Ehdr as parameter.
9068 * object.cc (Object::set_target): Remove the version that looks up
9069 a target and sets it.
9070 (Sized_relobj::setup): Take a Target object instead of
9071 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9072 (make_elf_sized_object): Find target and ask target to
9073 make an ELF object.
9074 * object.h: (Object::set_target): Remove the version that looks up
9075 a target and sets it.
9076 (Sized_relobj::setup): Take a Target object instead of
9077 an elfcpp:Ehdr as parameter.
9078 * target.cc: Include dynobj.h.
9079 (Target::do_make_elf_object_implementation): New.
9080 (Target::do_make_elf_object): New.
9081 * target.h (Target::make_elf_object): New template declaration.
9082 (Target::do_make_elf_object): New method declarations.
9083 (Target::do_make_elf_object_implementation): New template declaration.
9084
cc70f101
ILT
90852009-08-14 Ian Lance Taylor <iant@google.com>
9086
9087 * gold.h (FUNCTION_NAME): Define.
9088 (gold_unreachable): Use FUNCTION_NAME.
9089
ef5e0cb1
ST
90902009-08-12 Sriraman Tallam <tmsriram@google.com>
9091
9092 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9093 symbol in the --keep-unique list is not found.
9094
48c187ce
ST
90952009-08-12 Sriraman Tallam <tmsriram@google.com>
9096
9097 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9098 been maked as --keep-unique.
9099 (Icf::unfold_section): New function.
9100 * icf.h (Icf::unfold_section): New function.
9101 * options.h (General_options::keep_unique): New option.
9102 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9103 * testsuite/Makefile.in: Regenerate.
9104 * testsuite/icf_keep_unique_test.sh: New file.
9105 * testsuite/icf_keep_unique_test.cc: New file.
9106
645afe0c
CC
91072009-08-12 Cary Coutant <ccoutant@google.com>
9108
9109 PR 10471
9110 * resolve.cc (Symbol_table::resolve): Check for references from
9111 dynamic objects to hidden and internal symbols.
9112 * testsuite/Makefile.am (hidden_test.sh): New test.
9113 * testsuite/Makefile.in: Regenerate.
9114 * testsuite/hidden_test.sh: New script.
9115 * testsuite/hidden_test_1.c: New test source.
9116 * testsuite/hidden_test_main.c: New test source.
9117
11af873f
DK
91182009-08-11 Doug Kwan <dougkwan@google.com>
9119
9120 * arm.cc: Update comments.
9121 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9122 segment to locate the .ARM.exidx section if present.
9123
b9f7d72d
DK
91242009-08-09 Doug Kwan <dougkwan@google.com>
9125
9126 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9127 patch.
9128
ddd3c53c
ST
91292009-08-07 Sriraman Tallam <tmsriram@google.com>
9130 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9131 compiler warnings.
9132
27721062
ST
91332009-08-06 Sriraman Tallam <tmsriram@google.com>
9134
9135 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9136 valid tls_segment only for non-debug-section relocations.
9137 * testsuite/Makefile.am: Add gc_tls_test.
9138 * testsuite/Makefile.in: Regenerate.
9139 * testsuite/gc_tls_test.cc: New file.
9140 * testsuite/gc_tls_test.sh: New file.
9141
ef15dade 91422009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 9143
ef15dade
ST
9144 * icf.cc: New file.
9145 * icf.h: New file.
9146 * Makefile.am (CCFILES): Add icf.cc.
9147 (HFILES): Add icf.h
9148 * Makefile.in: Regenerate.
9149 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9150 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9151 section, symbol and addend information for the relocs.
9152 * gold.cc (queue_middle_tasks): Call identical code folding.
9153 * gold.h: Add defines for multimap.
9154 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9155 to the call of finalize_local_symbols.
9156 * main.cc (main): Create object of class Icf.
9157 * object.cc (Sized_relobj::do_layout): Allow this function to be
9158 called twice during icf.
9159 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9160 to sections marked as identical by icf.
9161 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9162 when available.
9163 (Sized_relobj::do_section_entsize): New function.
9164 * object.h (Object::section_entsize): New function.
9165 (Object::do_section_entsize): New pure virtual function.
9166 (Relobj::finalize_local_symbols): Add new parameter.
9167 (Relobj::do_section_entsize): New function.
9168 * options.h (General_options::icf): New option.
9169 (General_options::icf_iterations): New option.
9170 (General_options::print_icf_sections): New option.
9171 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9172 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9173 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9174 icf.
9175 * symtab.cc (Symbol_table::is_section_folded): New function.
9176 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9177 to sections marked as identical by icf.
9178 * symtab.h (Symbol_table::set_icf): New function.
9179 (Symbol_table::icf): New function.
9180 (Symbol_table::is_section_folded): New function.
9181 (Symbol_table::icf_): New data member.
9182 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9183 * testsuite/Makefile.am: Add commands to build icf_test.
9184 * testsuite/Makefile.in: Regenerate.
9185 * testsuite/icf_test.sh: New file.
9186 * testsuite/icf_test.cc: New file.
9187
c3b65ac4
CD
91882009-07-24 Chris Demetriou <cgd@google.com>
9189
9190 * layout.cc (is_compressible_debug_section): Fix incorrect
9191 comment about compressed section names.
9192
1caf2c51
ILT
91932009-07-20 Ian Lance Taylor <ian@airs.com>
9194
9195 PR 10419
9196 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9197
1ef4d87f
ILT
91982009-07-16 Ian Lance Taylor <iant@google.com>
9199
9200 PR 10400
9201 * layout.h: #include <map>.
9202 (class Kept_section): Change from struct to class. Add accessors
9203 and setters. Add section size to Comdat_group mapping. Change
9204 Comdat_group to std::map. Add is_comdat_ field. Add
9205 linkonce_size field in union.
9206 (class Layout): Update declaration of find_or_add_kept_section.
9207 Don't declare find_kept_object.
9208 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9209 parameter. Add object, shndx, is_comdat, and is_group_name
9210 parameters. Change all callers. Adjust for new Kept_section.
9211 (Layout::find_kept_object): Remove.
9212 * object.cc (Sized_relobj::include_section_group): Update use of
9213 Kept_section. Rename secnum to shndx. Only record
9214 Kept_comdat_section if sections are the same size.
9215 (Sized_relobj::include_linkonce_section): Update use of
9216 Kept_section. Only record Kept_comdat_section if sections are the
9217 same size. Set size of linkonce section.
9218 (Sized_relobj::map_to_kept_section): Update call to
9219 get_kept_comdat_section.
9220 * object.h (class Sized_relobj): Rename fields in
9221 Kept_comdat_section to drop trailing underscores; change object
9222 field to Relobj*. Change Kept_comdat_section_table to store
9223 struct rather than pointer.
9224 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9225 Add kept_object and kept_shndx parameters. Change all callers.
9226 (Sized_relobj::get_kept_comdat_section): Change return type to
9227 bool. Add kept_object and kept_shndx parameters. Change all
9228 callers.
9229 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9230 Layout::find_or_add_kept_section.
9231
37c3b7b0
ILT
92322009-07-09 Ian Lance Taylor <iant@google.com>
9233
9234 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9235 Reserve space in the hash table.
9236
98fa85cb
ILT
92372009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9238
9239 * fileread.cc (File_read::get_mtime): New method.
9240 * fileread.h (Timespec): New structure.
9241 (File_read::get_mtime): New method.
9242 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9243 Renamed from timestamp_nsec.
9244 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9245 Elf_Xword.
e1df38aa 9246 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 9247 timestamp_nsec.
e1df38aa 9248 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
9249 (Incremental_inputs::report_obejct): Save mtime; style fix.
9250 (Incremental_inputs::report_script): Save mtime; style fix.
9251 (Incremental_inputs::finalize_inputs): Style fix.
9252 (Incremental_inputs::finalize): Style fix.
9253 (Incremental_inputs::create_input_section_data): Store inputs
9254 mtime.
9255 * incremental.h (Incremental_inputs::report_script): Add mtime
9256 argument.
9257 (Incremental_inputs::Input_info::Input_info): Intialize only one
9258 union member.
9259 (Incremental_inputs::Input_info::archive): Move to nameless
9260 union.
9261 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9262 (Incremental_inputs::Input_info::script): Move to nameless union.
9263 (Incremental_inputs::mtime): New field.
9264 * script.cc (read_input_script): Pass file mtime to
9265 Incremental_input.
9266 * script.h (Script_info::inputs): Style fix.
9267
c9d70757
ILT
92682009-07-01 Ian Lance Taylor <ian@airs.com>
9269
9270 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9271 instead of 32.
9272
9c547ec3
ILT
92732009-06-24 Ian Lance Taylor <iant@google.com>
9274
9275 PR 10156
9276 * layout.cc (Layout::choose_output_section): If we find an
9277 existing section, update the flags.
9278 (Layout::create_notes): New function, broken out of
9279 Layout::finalize.
9280 (Layout::finalize): Don't create note sections.
9281 (Layout::create_note): Don't crash if linker script discards
9282 section.
9283 (Layout::create_gold_note): Likewise.
9284 (Layout::create_build_id): Likewise. Don't set
9285 after_input_sections on the section.
9286 (Layout::create_executable_stack_info): Remove target parameter.
9287 Change caller.
9288 * layout.h (class Layout): Declare create_notes. Update
9289 declaration of create_executable_stack_info.
9290 * gold.cc (queue_middle_tasks): Call create_notes.
9291 * output.cc (Output_section::update_flags_for_input_section): Move
9292 here from output.h. If SHF_ALLOC flag is newly set, mark address
9293 invalid.
9294 * output.h (Output_data::mark_address_invalid): New function.
9295 (class Output_section): Only declare, not define,
9296 update_flags_for_input_section. Remove set_flags.
9297
55458500
ILT
92982009-06-24 Ian Lance Taylor <iant@google.com>
9299
9300 * script-sections.cc (Output_section_definition::
9301 set_section_addresses): Rename shadowing local load_address to
9302 laddr.
9303
1307d6cd
ILT
93042009-06-24 Ian Lance Taylor <iant@google.com>
9305
9306 PR 10244
9307 * reloc.cc (relocate_sections): Skip empty relocation sections.
9308
ec3f783e
ILT
93092009-06-23 Ian Lance Taylor <iant@google.com>
9310
9311 PR 10156
9312 * layout.cc (Layout::create_note): Use choose_output_section
9313 rather than make_output_section.
9314
459c9f1c
ILT
93152009-06-23 Ian Lance Taylor <iant@google.com>
9316
9317 PR 10237
9318 * options.cc (General_options::parse_V): Set printed_version_.
9319 (General_options::General_options): Initialize printed_version_.
9320 * options.h (class General_options): Add printed_version_ field.
9321 * gold.cc (queue_initial_tasks): If there are no input files,
9322 don't give a fatal error if we printed the version information.
9323 (queue_middle_tasks): If using -r with a shared object, give a
9324 fatal error rather than an ordinary error.
9325
1518dc8f
ILT
93262009-06-23 Ian Lance Taylor <iant@google.com>
9327
9328 PR 10219
9329 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9330 (Layout::make_output_section): Set have_stabstr_section_ if we see
9331 a .stab*str section.
9332 (Layout::finalize): Call link_stabs_sections.
9333 (Layout::link_stabs_sections): New file.
9334 * layout.h (class Layout): Add have_stabstr_section_ field.
9335 Declare link_stabs_sections.
9336
3d857b98
DK
93372009-06-23 Doug Kwan <dougkwan@google.com>
9338
9339 * Makefile.am (libgold_a_LIBADD): New.
9340 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9341 * Makefile.in: Regenerate.
9342 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9343 * configure: Regenerate.
9344 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9345 * fileread.cc: Include sys/state.h
9346 * gold.h: Declare memmem and strndup if found missing.
9347 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9348
0639a6f6
ILT
93492009-06-23 Ian Lance Taylor <iant@google.com>
9350
9351 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9352 * configure: Rebuild.
9353
8d63875c
ILT
93542009-06-23 Ian Lance Taylor <iant@google.com>
9355
9356 PR 10147
9357 * object.cc (Object::section_contents): Don't try to get a view if
9358 the section has length zero.
9359 (Object::handle_gnu_warning_section): If the section is empty, use
9360 the name of the section as the warning.
9361
f7c8a183
ILT
93622009-06-23 Ian Lance Taylor <iant@google.com>
9363
9364 PR 10133
9365 * stringpool.h (class Stringpool_template): Add optimize_ field.
9366 (Stringpool_template::set_optimize): New function.
9367 * stringpool.cc (Stringpool_template::Stringpool_template):
9368 Initialize optimize_ field.
9369 (Stringpool_template::set_string_offsets): Test local optimize
9370 fild rather than parameter.
9371 * layout.cc (Layout::Layout): Call set_optimize on the section
9372 name stringpool.
9373
e6a307ba
ILT
93742009-06-22 Ian Lance Taylor <iant@google.com>
9375
9376 PR 10030
9377 * yyscript.y: Parse TARGET.
9378 * script.cc (script_set_target): New function.
9379 * script-c.h (script_set_target): Declare.
9380 * options.cc (General_options::string_to_object_format): Rename
9381 from string_to_object_format in anonymous namespace. Change
9382 callers.
9383 * options.h (class General_options): Declare
9384 string_to_object_format.
9385
3ee173de
ILT
93862009-06-22 Ian Lance Taylor <iant@google.com>
9387
9388 * script-sections.cc (Script_sections::create_segments): Don't put
9389 program headers in a PT_LOAD segment if -n or -N.
9390
93912009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
9392
9393 PR 10141
9394 * options.h (class General_options): Add -z lazy and -z now. Sort
9395 -z options into alphabetical order.
9396 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9397
cd6739a1 93982009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
9399
9400 * layout.cc (Layout::make_output_section): Call
9401 Target::new_output_section.
9402 (Layout::attach_allocated_section_to_segment): Put large section
9403 sections in a separate load segment with the large segment flag
9404 set.
9405 (Layout::segment_precedes): Sort large data segments after other
9406 load segments.
9407 (align_file_offset): New static function.
9408 (Layout::set_segment_offsets): Use align_file_offset.
9409 * output.h (class Output_section): Add is_small_section_ and
9410 is_large_section_ fields.
9411 (Output_section::is_small_section): New function.
9412 (Output_section::set_is_small_section): New function.
9413 (Output_section::is_large_section): New function.
9414 (Output_section::set_is_large_section): New function.
9415 (Output_section::is_large_data_section): New function.
9416 (class Output_segment): Add is_large_data_segment_ field.
9417 (Output_segment::is_large_data_segment): New function.
9418 (Output_segment::set_is_large_data_segment): New function.
9419 * output.cc (Output_section::Output_section): Initialize new
9420 fields.
9421 (Output_segment::Output_segment): Likewise.
9422 (Output_segment::add_output_section): Add assertion that large
9423 data sections always go in large data segments. Force small data
9424 sections to the end of the list of data sections. Force small BSS
9425 sections to the start of the list of BSS sections. For large BSS
9426 sections to the end of the list of BSS sections.
9427 * symtab.h (class Symbol): Declare is_common_shndx.
9428 (Symbol::is_defined): Check Symbol::is_common_shndx.
9429 (Symbol::is_common): Likewise.
9430 (class Symbol_table): Define enum Commons_section_type. Update
9431 declarations. Add small_commons_ and large_commons_ fields.
9432 * symtab.cc (Symbol::is_common_shndx): New function.
9433 (Symbol_table::Symbol_table): Initialize new fields.
9434 (Symbol_table::add_from_object): Put small and large common
9435 symbols in the right list.
9436 (Symbol_table::sized_finalized_symbol): Check
9437 Symbol::is_common_shndx.
9438 (Symbol_table::sized_write_globals): Likewise.
9439 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9440 common symbol lists. Don't call do_allocate_commons_list if the
9441 list is empty.
9442 (Symbol_table::do_allocate_commons_list): Remove is_tls
9443 parameter. Add comons_section_type parameter. Change all
9444 callers. Handle small and large common symbols.
9445 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9446 Symbol::is_common_shndx.
9447 * resolve.cc (symbol_to_bits): Likewise.
9448 * target.h (Target::small_common_shndx): New function.
9449 (Target::small_common_section_flags): New function.
9450 (Target::large_common_shndx): New function.
9451 (Target::large_common_section_flags): New function.
9452 (Target::new_output_section): New function.
9453 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9454 small_common_section_flags, and large_common_section_flags
9455 fields.
9456 (Target::do_new_output_section): New virtual function.
9457 * arm.cc (Target_arm::arm_info): Initialize new fields.
9458 * i386.cc (Target_i386::i386_info): Likewise.
9459 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9460 Likewise.
9461 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9462 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9463 (Target_x86_64::do_new_output_section): New function.
9464 * configure.ac: Define conditional MCMODEL_MEDIUM.
9465 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9466 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9467 (large_LDFLAGS): Define.
9468 * testsuite/large.c: New file.
9469 * testsuite/testfile.cc (Target_test::test_target_info):
9470 Initialize new fields.
9471 * configure, testsuite/Makefile.in: Rebuild.
9472
bb04269c
DK
94732009-06-05 Doug Kwan <dougkwan@google.com>
9474
9475 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 9476 * Makefile.in: Regenerate.
bb04269c
DK
9477 * i386.cc (class Target_i386): Define new virtual method to
9478 override do_is_local_label_name in parent.
9479 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9480 local symbols if --discard-locals or -X is given.
9481 * options.h (class General_options): Declare new options
9482 '--discard-locals' and '-X' for discarding locals.
9483 * target.h (class Target): Define new methods is_local_label_name.
9484 Declare new virtual method do_is_local_label_name.
9485 * target.cc: New file.
9486 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9487 (check_SCRIPTS): Add discard_locals_test.sh.
9488 (check_DATA): Add discard_local_tests.syms.
9489 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9490 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9491 * testsuite/Makefile.in: Regenerate.
9492 * testsuite/discard_locals_test.c: New file.
9493 * testsuite/discard_locals_test.sh: Same.
9494
805bb01c
DK
94952009-06-05 Doug Kwan <dougkwan@google.com>
9496
9497 * object.cc (Sized_relobj::Sized_relobj): Initialize
9498 discarded_eh_frame_shndx_ to -1U.
9499 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9500 section.
9501 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9502 a discarded .eh_frame section.
9503 (Sized_relobj::do_finalize_local_symbols): Ditto.
9504 * object.h (class Sized_relobj): Declare new member
9505 discarded_eh_frame_shndx_.
9506 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9507 (local_labels_test.o, local_labels_test): New rules.
9508 * testsuite/Makefile.in: Regenerate.
9509
1dcd334d
DK
95102009-06-04 Doug Kwan <dougkwan@google.com>
9511
9512 * layout.cc (Layout::section_name_mapping): Add mapping for
9513 special ARM sections.
9514
96d49306
DK
95152009-06-03 Doug Kwan <dougkwan@google.com>
9516
9517 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9518 (utils::has_overflow): Same.
9519
dff16297
ILT
95202009-06-03 Ian Lance Taylor <iant@google.com>
9521
9522 * layout.cc (Layout::section_name_mapping): New array, replacing
9523 Layout::linkonce_mapping.
9524 (Layout::section_name_mapping_count): New variable, replacing
9525 Layout::linkonce_mapping_count.
9526 (Layout::linkonce_output_name): Remove.
9527 (Layout::output_section_name): Rewrite.
9528 * layout.h (class Layout): Rename Linkonce_mapping to
9529 Section_name_mapping, linkonce_mapping to section_name_mapping,
9530 linkonce_mapping_count to section_name_mapping_count. Don't
9531 declare linkonce_output_name.
9532
c121c671
DK
95332009-06-03 Doug Kwan <dougkwan@google.com>
9534
9535 * gold/arm.cc (namespace utils): New.
9536 (Target_arm::reloc_is_non_pic): Define new method.
9537 (class Arm_relocate_functions): New.
9538 (Target_arm::Relocate::relocate): Handle relocation types used by
9539 Android.
9540
07800fab
ILT
95412009-06-03 Ian Lance Taylor <iant@google.com>
9542
9543 * arm.cc (Target_arm::scan::global): Use || instead of |.
9544
c121c671
DK
95452009-06-02 Doug Kwan <dougkwan@google.com>
9546
9547 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9548 issued_non_pic_error_.
9549 (class Target_arm::Scan): Declare new method check_non_pic.
9550 Define new method symbol_needs_plt_entry.
9551 Declare new data member issued_non_pic_error_.
9552 (class Target_arm::Relocate): Declare new method
9553 should_apply_static_reloc.
9554 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9555 (Target_arm::Scan::check_non_pic): Define new method.
9556 (Target_arm::Scan::local): Handle a small subset of reloc types used
9557 by Android.
9558 (Target_arm::Scan::local): Same.
9559 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9560
b19b0c6d
ILT
95612009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9562
9563 * incremental.cc (Incremental_inputs::report_command_line): Filter
9564 out --incremental-* options.
9565
94cdfcff
DK
95662009-05-29 Doug Kwan <dougkwan@google.com>
9567
9568 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9569 template class.
9570 (class Target_arm): Update comment.
9571 (Target_arm::Target_arm): Initialize new data members GOT_,
9572 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9573 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9574 and Target_arm::rel_dyn_section.
9575 Declare new_enum Target_arm::Got_type.
9576 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9577 and DYNBSS_.
9578 Update commments for member do_dynsym_value.
9579 (Target_arm::got_size, Target_arm::plt_section,
9580 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9581 new methods inside class defintion.
9582 (Target_arm::got_section): Define new method.
9583 (Target_arm::rel_dyn_section): Same.
9584 (Output_data_plt_arm): New template class.
9585 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9586 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9587 (Output_data_plt_arm::add_entry): Same.
9588 (Output_data_plt_arm::first_plt_entry): Define new
9589 static data member for PLT instruction template.
9590 (Output_data_plt_arm::plt_entry): Same.
9591 (Output_data_plt_arm::do_write): Define new method.
9592 (Target_arm::make_plt_entry): Same.
9593 (Target_arm::do_finalize_sections): Same.
9594 (Target_arm::do_dynsym_value): Same.
9595
4a657b0d
DK
95962009-05-28 Doug Kwan <dougkwan@google.com>
9597
9598 * Makefile.am (TARGETSOURCES): Add arm.cc.
9599 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9600 * Makefile.in: Regenerate.
9601 * arm.cc: New file.
9602 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9603
e7ae8c36
DK
96042009-05-26 Doug Kwan <dougkwan@google.com>
9605
9606 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9607 (General_options::check_excluded_libs): Strip off directories in
9608 archive name before matching like GNU ld does.
9609 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9610 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9611 (exclude_libs_test_LDFLAGS): Add linker option
9612 -Wl,--exclude-libs,libexclude_libs_test_3
9613 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9614 an explicit archive without using -l.
9615 (alt/libexclude_libs_test_3.a): New make rule.
9616 * testsuite/Makefile.in: Regenerate.
9617 * testsuite/exclude_libs_test.c : Declare lib3_default().
9618 (main): Call it.
9619 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9620 * exclude_libs_test_3.c: New file.
9621
f12e7348
NC
96222009-05-26 Nick Clifton <nickc@redhat.com>
9623
9624 * po/id.po: New Indonesian translation.
9625 * po/gold.pot: Updated template file.
9626
4daadc0d
ST
96272009-05-22 Sriraman Tallam <tmsriram@google.com>
9628
e1df38aa 9629 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
9630 gc_comdat_test files. Add -Wl,--gc-sections to build
9631 gc_comdat_test.
9632 * testsuite/Makefile.in: Regenerate.
9633 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9634
531813ad
ST
96352009-05-21 Sriraman Tallam <tmsriram@google.com>
9636
9637 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9638 kept comdat section was garbage collected.
9639 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9640 * testsuite/Makefile.in: Regenerate.
9641 * testsuite/gc_comdat_test.sh: New file.
9642 * testsuite/gc_comdat_test_1.cc: New file.
9643 * testsuite/gc_comdat_test_2.cc: New file.
9644
65514900
CC
96452009-05-19 Doug Kwan <dougkwan@google.com>
9646
9647 * archive.cc (Archive::Archive): Move constructor from archive.h
9648 to here. Initialize no_export_.
9649 (Archive::get_elf_object_for_member): Set no_export flag of object.
9650 * archive.h (Archive::Archive): Move constructor body to
9651 archive.cc.
9652 (Archive::no_export): New method.
9653 (Archive::no_export_): New field.
9654 * object.h (Object::Object): Initialize no_export_ to false.
9655 (Object::no_export, Object::set_no_export): New methods.
9656 (Object::no_export_): New field.
9657 * options.cc (General_options::parse_exclude_libs): New method.
9658 (General_options::check_excluded_libs) Same.
9659 * options.h (exclude_libs): New option.
9660 (General_options::check_excluded_libs): New method declaration.
9661 (General_options::excluded_libs_): New field.
9662 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9663 default or protected visibility if an object has no-export flag set.
9664 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9665 (check_SCRIPTS): Add exclude_libs_test.sh.
9666 (check_DATA): Add exclude_libs_test.syms.
9667 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9668 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9669 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9670 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9671 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9672 libexclude_libs_test_2.a): New rules.
9673 * testsuite/Makefile.in: Regenerate.
9674 * testsuite/exclude_libs_test.c: New file.
9675 * testsuite/exclude_libs_test.sh: Ditto.
9676 * testsuite/exclude_libs_test_1.c: Ditto.
9677 * testsuite/exclude_libs_test_2.c: Ditto.
9678
1b77ea50
ILT
96792009-05-15 Ian Lance Taylor <iant@google.com>
9680
9681 * configure.ac: Check for declarations for cases where libiberty.h
9682 checks HAVE_DECL_xxx.
9683 * configure, config.in: Rebuild.
9684
072fe7ce
ILT
96852009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9686
9687 * gold.h (Incremental_argument_list): Remove (invalid) forward
9688 declaration.
9689 * incremental.cc (Incremental_inputs::report_achive): New method.
9690 (Incremental_inputs::report_object): New method.
9691 (Incremental_inputs::report_script): New method.
9692 (Incremental_inputs::finalize_inputs): New method.
9693 (Incremental_inputs::finalize): Call finalize_inputs().
9694 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9695 Create inputs entries.
9696 * incremental.h (Incremental_input_type): New enum.
9697 (Incremental_inputs::Incremental_input): Initialize new fields.
9698 (Incremental_inputs::report_inputs): New method.
9699 (Incremental_inputs::report_achive): New method.
9700 (Incremental_inputs::report_object): New method.
9701 (Incremental_inputs::report_script): New method.
9702 (Incremental_inputs::finalize_inputs): New method.
9703 (Incremental_inputs::Input_info): New struct.
9704 (Incremental_inputs::Input_info_map): New typedef.
9705 (Incremental_inputs::lock_): New field.
9706 (Incremental_inputs::Inputs_): New field.
9707 (Incremental_inputs::Inputs_map): New field.
9708 * main.cc (main): Call Incremental_input::report_inputs.
9709 * options.h (Input_argument_list): Typedef moved from
9710 Input_arguments.
9711 (Input_file_group::Files): Remove, use ::Input_argument_list.
9712 (Input_file_group::Input_argument_list): Remove, use
9713 ::Input_argument_list.
9714 * plugin.cc (Plugin_manager::add_input_file): Add error in
9715 incremental build.
9716 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9717 functions.
9718 * script.cc (read_input_script): Call
9719 Incremental_input::report_script.
9720 * script.h (Script_info): New class.
9721
b0481b0b
ILT
97222009-04-27 Ian Lance Taylor <iant@google.com>
9723
9724 * x86_64.cc (do_adjust_output_section): Set entsize to
9725 plt_entry_size.
9726
b22a5a41 97272009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
9728
9729 * output.cc (Output_file::close): After short writes, continue
9730 writing from the correct offset in the buffer being written.
9731
40fde488
CD
97322009-04-23 Chris Demetriou <cgd@google.com>
9733
9734 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9735 * configure: Regenerate.
9736 * config.in: Regenerate.
9737 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9738 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9739
3ce2c28e
ILT
97402009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9741
9742 * incremental.cc (Incremental_inputs_header_data): Renamed from
9743 Incremental_input_header_data.
9744 (Incremental_inputs_header_data::data_size): New field.
9745 (Incremental_inputs_header_data::put_input_file_count): Renamed
9746 from input_file_count.
9747 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9748 from command_line_offset.
9749 (Incremental_inputs_header_data::put_reserved): Renamed from
9750 put_reserved.
9751 (Incremental_inputs_entry_data): Renamed from
9752 Incremental_input_entry_data.
9753 (Incremental_inputs_entry_data::data_size): New field.
9754 (Incremental_inputs::report_command_line): New method.
9755 (Incremental_inputs::finalize): New method.
9756 (Incremental_inputs::create_incremental_inputs_data): New method.
9757 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9758 * incremental.h: New file.
9759 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9760 (Layout::finalize): Create incremental inputs section in
9761 incremental builds.
9762 (Layout::create_incremental_info_sections): New method.
9763 * layout.h (Layout::incremental_inputs): New method.
9764 (Layout::create_incremental_info_sections): New method.
9765 (Layout::incremental_inputs_): New field.
9766 * main.cc (main): Notify Incremental_input of the command line.
9767
e55bde5e
ILT
97682009-04-01 Ian Lance Taylor <iant@google.com>
9769 Mikolaj Zalewski <mikolajz@google.com>
9770
9771 * gold.h (reserve_unordered_map): Define, three versions, one for
9772 each version of Unordered_map.
9773 * layout.cc (Layout::Layout): Remove options parameter. Add
9774 number_of_input_files parameter. Don't initialize options_.
9775 Initialize number_of_input_files_ and resized_signatures_. Move
9776 sections_are_attached_.
9777 (Layout::layout_group): Reserve space for group_signatures_.
9778 (Layout::find_or_add_kept_section): Change name parameter to be a
9779 reference. Resize signatures_ map when it gets large enough.
9780 (Layout::layout_eh_frame): Use parameters->options() instead of
9781 this->options_.
9782 (Layout::make_output_section): Likewise.
9783 (Layout::attach_allocated_section_to_segment): Likewise.
9784 (Layout::finalize, Layout::create_executable_stack): Likewise.
9785 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9786 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9787 * layout.h (class Layout): Update declarations. Remove options_
9788 field. Add number_of_input_files_ and resized_signatures_
9789 fields. Move sections_are_attached_ field.
9790 * main.cc (main): Pass number of input files to Layout
9791 constructor. Don't pass options.
9792
154b857c
ILT
97932009-03-30 Ian Lance Taylor <iant@google.com>
9794
9795 * ffsll.c (ffsll): Correct implementation.
9796
2f35ab9b
ILT
97972009-03-27 Ian Lance Taylor <iant@google.com>
9798
fd03461a
ILT
9799 * ffsll.c: New file.
9800 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9801 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9802 * ftruncate.c (ftruncate): Declare before definition.
9803 * mremap.c (mremap): Likewise.
9804 * pread.c (pread): Likewise.
9805 * configure, Makefile.in, config.in: Rebuild.
9806
2f35ab9b
ILT
9807 * mremap.c: New file.
9808 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9809 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9810 (mremap): Declare if HAVE_MREMAP is not defined.
9811 * configure, Makefile.in, config.in: Rebuild.
9812
33aea2fd
CC
98132009-03-27 Cary Coutant <ccoutant@google.com>
9814
9815 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9816 position independent.
9817 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9818 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9819
6d479619
CC
98202009-03-24 Cary Coutant <ccoutant@google.com>
9821
9822 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9823 an executable.
9824 (needs_dynamic_reloc): Likewise.
9825
afc06bb8
ILT
98262009-03-24 Ian Lance Taylor <iant@google.com>
9827
9828 * yyscript.y (file_cmd): Recognize EXTERN.
9829 (extern_name_list, extern_name_list_body): New nonterminals.
9830 * script.cc (script_add_extern): Define.
9831 * script-c.h (script_add_extern): Declare.
9832
f6060a4d
ILT
98332009-03-24 Rafael Avila de Espindola <espindola@google.com>
9834
9835 * object.cc (is_elf_object): Define.
9836 * object.h (is_elf_object): Declare.
9837 * archive.cc (Archive::get_elf_object_for_member): Call
9838 is_elf_object.
33aea2fd 9839 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 9840
26736d8e
ILT
98412009-03-24 Elliott Hughes <enh@google.com>
9842
9843 * output.cc (Output_file::map_anonymous): Define.
9844 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9845 try an anonymous one. Report the size if the mmap fails.
9846 * output.h (class Output_file): Declare map_anonymous.
9847
22fd9730
ILT
98482009-03-24 Ian Lance Taylor <iant@google.com>
9849
9850 * target-select.cc (instantiate_target): Don't acquire the lock if
9851 the instantiated_target_ field has already been set.
9852
cb010894
ILT
98532009-03-23 Ian Lance Taylor <iant@google.com>
9854
7f055c20
ILT
9855 * gold-threads.h (class Initialize_lock): Define.
9856 * gold-threads.cc (class Initialize_lock_once): Define.
9857 (initialize_lock_control): New static variable.
9858 (initialize_lock_pointer): New static variable.
9859 (initialize_lock_once): New static function.
9860 (Initialize_lock::Initialize_lock): Define.
9861 (Initialize_lock::initialize): Define.
9862 * target-select.h: Include "gold-threads.h".
9863 (class Target_selector): Add lock_ and initialize_lock_ fields.
9864 Don't define instantiate_target, just declare it.
9865 * target-select.cc (Target_selector::Target_selector): Initialize
9866 new fields.
9867 (Target_selector::instantiate_target): Define.
9868 * descriptors.h: Include "gold-threads.h".
9869 (class Descriptors): Add initialize_lock_ field.
9870 * descriptors.cc (Descriptors::Descriptors): Initialize new
9871 field.
9872 (Descriptors::open): Use initialize_lock_ field
9873 * errors.h (class Errors): Add initialize_lock_ field.
9874 * errors.cc (Errors::Errors): Initialize new field.
9875 (Errors::initialize_lock): Use initialize_lock_ field.
9876 * powerpc.cc (class Target_selector_powerpc): Remove
9877 instantiated_target_ field. In do_recognize call
9878 instantiate_target rather than do_instantiate_target. In
9879 do_instantiate_target just allocate a new target.
9880 * sparc.cc (class Target_selector_sparc): Likewise.
9881
36959681
ILT
9882 * freebsd.h: New file.
9883 * i386.cc: Include "freebsd.h".
9884 (Target_i386): Derive from Target_freebsd rather than
9885 Sized_target.
9886 (Target_selector_i386): Derive from Target_selector_freebsd rather
9887 than Target_selector.
9888 * x86_64.cc: Include "freebsd.h".
9889 (Target_x86_64): Derive from Target_freebsd rather than
9890 Sized_target.
9891 (Target_selector_x86_64): Derive from Target_selector_freebsd
9892 rather than Target_selector.
9893 * target.h (class Target): Add adjust_elf_header and
9894 do_adjust_elf_header.
9895 * output.cc (Output_file_header:: do_sized_write): Call target
9896 adjust_elf_header routine.
9897 * configure.tgt: Set targ_osabi.
9898 * configure.ac: Define GOLD_DEFAULT_OSABI.
9899 * parameters.cc (Parameters::default_target): Pass
9900 GOLD_DEFAULT_OSABI to select_target.
9901 * target-select.h (class Target_selector): Make instantiate_target
9902 protected rather than private.
9903 * Makefile.am (HFILES): Add freebsd.h.
9904 * configure, Makefile.in, config.in: Rebuild.
9905
cb010894
ILT
9906 * merge.cc (do_add_input_section): Correct pend value. Change
9907 message about last entry not being null terminated from error to
9908 warning.
9909
0e879927
ILT
99102009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9911
9912 * incremental.cc: New file.
9913 * Makefile.am (CCFILES): Add incremental.cc.
9914 * Makefile.in: Rebuild.
9915
41105937
PP
99162009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9917
9918 * layout.cc (Layout::output_section_name): Preserve names
9919 of '.note.' sections.
e1df38aa 9920
60439920
ILT
99212009-03-19 Ian Lance Taylor <iant@google.com>
9922
9923 * descriptors.cc (Descriptors::open): Check that the options are
9924 valid before using them.
9925
0d371ad3
ILT
99262009-03-18 Ian Lance Taylor <iant@google.com>
9927
9928 * script-sections.h: Include <list>.
9929 (class Script_sections): Change Sections_elements from std::vector
9930 to std::list. Typedef public Elements_iterator. Add
9931 orphan_section_placement_, data_segment_align_start_, and
9932 saw_data_segment_align_ fields. Remove data_segment_align_index_
9933 field.
9934 * script-sections.cc (class Orphan_section_placement): New class.
9935 (class Sections_element): Add virtual functions is_relro and
9936 orphan_section_init. Remove virtual function place_orphan_here.
9937 (class Output_section_definition): Add is_relro and
9938 orphan_section_init. Remove place_orphan_here.
9939 (class Orphan_output_section): Likewise.
9940 (Script_sections::Script_sections): Update for field changes.
9941 (Script_sections::data_segment_align): Set saw_data_segment_align_
9942 and data_segment_align_start_, not data_segment_align_index.
9943 (Script_sections::data_segment_relro_end): Check
9944 saw_data_segment_align_. Use data_segment_align_start_ rather
9945 than data_segment_align_index_.
9946 (Script_sections::place_orphan): Rewrite to use
9947 Orphan_section_placement.
9948
9201d894
ILT
99492009-03-17 Ian Lance Taylor <iant@google.com>
9950
9c5b8369
ILT
9951 * archive.cc (Archive::add_symbols): Check for a version attached
9952 to the symbol name in the archive map.
9953 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9954 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9955 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9956 (ver_test_11.a): New target.
9957 * testsuite/Makefile.in: Rebuild.
9958
9201d894
ILT
9959 * configure.ac: Check for chsize and posix_fallocate. Replace
9960 ftruncate.
9961 * ftruncate.c: New file, from gnulib.
9962 * output.cc (posix_fallocate): Define dummy version if not
9963 HAVE_POSIX_FALLOCATE.
9964 (Output_file::map): Call posix_fallocate rather than lseek and
9965 write.
9966 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9967 * configure, Makefile.in, config.in: Rebuild.
9968
ef4ab7a8 99692009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 9970
ef4ab7a8
PP
9971 * layout.h (Layout::create_note): Add section_name parameter.
9972 * layout.cc (Layout::create_note): Likewise.
9973 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 9974
8c500701
ILT
99752009-03-17 Ian Lance Taylor <iant@google.com>
9976
e85b18e1
ILT
9977 * descriptors.cc: Include "options.h".
9978 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9979 (Descriptors::open): Always use O_CLOEXEC when opening a new
9980 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9981 then set FD_CLOEXEC.
9982
9efe6174
ILT
9983 * sparc.cc (class Target_sparc): Add has_got_section.
9984 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9985 make sure we have a GOT section.
9986
9987 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9988 (Target_sparc::Scan::local): Likewise.
9989 (Target_sparc::Scan::global): Likewise.
9990 (Target_sparc::Relocate::relocate): Likewise.
9991 (Target_sparc::Relocate::relocate_tls): Likewise.
9992
8c500701
ILT
9993 * symtab.cc (Symbol_table::define_default_version): New function,
9994 broken out of add_from_object.
9995 (Symbol_table::add_from_object): Call define_default_version.
9996 (Symbol_table::define_special_symbol): Add resolve_oldsym
9997 parameter. Change all callers. If the version for a symbol comes
9998 from a version script, resolve it with the symbol with the same
9999 name with no version. Also add the symbol without a version if
10000 appropriate.
10001 (do_define_in_output_data): If resolving with oldsym, don't delete
10002 sym.
10003 (do_define_in_output_segment): Likewise.
10004 (do_define_as_constant): Likewise.
10005 * symtab.h (class Symbol_table): Update declarations.
10006
f1ed28fb
ILT
100072009-03-13 Ian Lance Taylor <iant@google.com>
10008
15f8229b
ILT
10009 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10010 (Read_symbols::requeue): New function.
10011 (Read_symbols::do_read_symbols): If make_elf_object fails because
10012 the target type is not configured, and the file was searched for,
10013 issue a warning and retry with the next directory.
10014 (Add_symbols::run): If the file has an incompatible format, and
10015 it was searched for, requeue the Read_symbols task. On error,
10016 release the object.
10017 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10018 dirindex parameter to constructor. Change all callers. Declare
10019 incompatible_warning and requeue.
10020 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10021 input_argument_ and input_group_ fields. Add them to
10022 constructor. Change all callers.
10023 (class Read_script): Add dirindex_ field. Add it to constructor.
10024 Change all callers.
10025 * archive.cc (Archive::setup): Remove input_objects parameter.
10026 Change all callers.
10027 (Archive::get_file_and_offset): Likewise.
10028 (Archive::read_all_symbols): Likewise.
10029 (Archive::read_symbols): Likewise.
10030 (Archive::get_elf_object_for_member): Remove input_objects
10031 parameter. Add punconfigured parameter. Change all callers.
10032 (Archive::add_symbols): Change return type to bool. Check return
10033 value of include_member.
10034 (Archive::include_all_members): Likewise.
10035 (Archive::include_member): Change return type to bool. Return
10036 false if first included object has incompatible target. Set
10037 included_member_ field.
10038 (Add_archive_symbols::run): If add_symbols returns false, requeue
10039 Read_symbols task.
10040 * archive.h (class Archive): Add included_member_ field.
10041 Initialize it in constructor. Add input_file and searched_for
10042 methods. Update declarations.
10043 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10044 input_argument_ fields. Add them to constructor. Change all
10045 callers.
10046 * script.cc: Include "target-select.h".
10047 (class Parser_closure): Add skip_on_incompatible_target_ and
10048 found_incompatible_target_ fields. Add
10049 skip_on_incompatible_target parameter to constructor. Change all
10050 callers. Add methods skip_on_incompatible_target,
10051 clear_skip_on_incompatible_target, found_incompatible_target, and
10052 set_found_incompatible_target.
10053 (read_input_script): Add dirindex parameter. Change all callers.
10054 If parser finds an incompatible target, requeue Read_symbols
10055 task.
10056 (script_set_symbol): Clear skip_on_incompatible_target in
10057 closure.
10058 (script_add_assertion, script_parse_option): Likewise.
10059 (script_start_sections, script_add_phdr): Likewise.
10060 (script_check_output_format): New function.
10061 * script.h (read_input_script): Update declaration.
10062 * script-c.h (script_check_output_format): Declare.
10063 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10064 (ignore_cmd): Remove OUTPUT_FORMAT.
10065 * fileread.cc (Input_file::Input_file): Add explicit this.
10066 (Input_file::will_search_for): New function.
10067 (Input_file::open): Add pindex parameter. Change all callers.
10068 * fileread.h (class Input_file): Add input_file_argument method.
10069 Declare will_search_for. Update declarations.
10070 * object.cc (make_elf_object): Add punconfigured parameter.
10071 Change all callers.
10072 * object.h (class Object): Make input_file public. Add
10073 searched_for method.
10074 (make_elf_object): Update declaration.
10075 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10076 restart search.
10077 * dirsearch.h (class Dirsearch): Update declaration.
10078 * options.h (class General_options): Add --warn-search-mismatch.
10079 * parameters.cc (Parameters::is_compatible_target): New function.
10080 * parameters.h (class Parameters): Declare is_compatible_target.
10081 * workqueue.cc (Workqueue::add_blocker): New function.
10082 * workqueue.h (class Workqueue): Declare add_blocker.
10083
f1ed28fb
ILT
10084 * fileread.cc (Input_file::open): Remove options parameter.
10085 Change all callers.
10086 (Input_file::open_binary): Likewise.
10087 * script.cc (read_input_script): Likewise.
10088 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10089 options parameter from constructor. Change all callers.
10090 (class Read_script): Likewise.
10091 * fileread.h (class Input_file): Update declarations.
10092 * script.h (read_input_script): Update declaration.
10093
34dd024a
NC
100942009-03-10 Nick Clifton <nickc@redhat.com>
10095
10096 * po/es.po: New Spanish translation.
10097
6d71b17c
CC
100982009-03-06 Cary Coutant <ccoutant@google.com>
10099
10100 * options.cc (parse_short_option): Keep dash_z from registering itself.
10101
031cdbed
ILT
101022009-03-03 Ian Lance Taylor <iant@google.com>
10103
10104 PR 9918
10105 * target-reloc.h (relocate_section): Pass output_section to
10106 relocate.
10107 * i386.cc (Target_i386::should_apply_static_reloc): Add
10108 output_section parameter. Change all callers.
10109 (Target_i386::Relocate::relocate): Add output_section parameter.
10110 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10111 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10112 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10113 * testsuite/two_file_shared.sh: New script.
10114 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10115 (check_DATA): Add two_file_shared.dbg.
10116 (two_file_shared.dbg): New target.
10117 * testsuite/Makefile.in: Rebuild.
10118
15d5fa16
ILT
101192009-03-01 Ian Lance Taylor <iant@google.com>
10120
10121 * configure.ac: Check for byteswap.h.
10122 * configure: Rebuild.
10123 * config.in: Rebuild.
10124
8a4c0b0d
ILT
101252009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10126
10127 * layout.cc (Layout::find_or_add_kept_section): New function.
10128 (Layout::add_comdat): Removed.
10129 * layout.h (struct Kept_section): Move out of class Layout.
10130 Remove trailing underscores from field names. Add group_sections
10131 field. Rename group_ field to is_group. Change all uses.
10132 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10133 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10134 comdat_groups_ field.
10135 (Sized_relobj::include_section_group): Use
10136 find_or_add_kept_section and Kept_section::group_sections.
10137 (Sized_relobj::include_linkonce_section): Likewise.
10138 * object.cc (class Sized_relobj): Don't define Comdat_group or
10139 Comdat_group_table. Remove find_comdat_group and
10140 add_comdat_group. Remove comdat_groups_ field.
10141 * plugin.cc (include_comdat_group): Use
10142 Layout::find_or_add_kept_section.
10143
b4ecf66b
ILT
101442009-02-28 Ian Lance Taylor <iant@google.com>
10145
14359ca0
ILT
10146 * README: --gc-sections and map files are now supported. Document
10147 some build requirements.
10148
b4ecf66b
ILT
10149 PR 6992
10150 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10151 relocatable link set the value of the section symbol to zero.
10152 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10153 relocatable link don't include the section address in the local
10154 symbol value.
10155
0602e05a
ILT
101562009-02-27 Ian Lance Taylor <iant@google.com>
10157
fd9d194f
ILT
10158 PR 6811
10159 * options.h (class Search_directory): Add is_system_directory.
10160 (class General_options): Declare is_in_system_directory.
10161 * options.cc (get_relative_sysroot): Make static.
10162 (get_default_sysroot): Make static.
10163 (General_optoins::is_in_system_directory): New function.
10164 * fileread.cc (Input_file::is_in_system_directory): New function.
10165 * fileread.h (class Input_file): Declare is_in_system_directory.
10166 * object.h (class Object): Add is_in_system_directory.
10167 (class Input_objects): Remove system_library_directory_ field.
10168 * object.cc (Input_objects::add_object): Don't set
10169 system_library_directory_.
10170 (input_objects::found_in_system_library_directory): Remove.
10171 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10172 parameter. Change all callers.
10173 (Symbol_table::sized_write_globals): Likewise.
10174 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10175 Call Object::is_in_system_directory.
10176 * symtab.h (class Symbol_table): Update declarations.
10177
61edd21f
ILT
10178 PR 5990
10179 * descriptors.h (Open_descriptor): Add is_on_stack field.
10180 * descriptors.cc (Descriptors::open): If the descriptor is on the
10181 top of the stack, remove it. Initialize is_on_stack field.
10182 (Descriptors::release): Only add pod to stack if it is not on the
10183 stack already.
10184 (Descriptors::close_some_descriptor): Clear stack_next and
10185 is_on_stack fields.
10186
e29e076a
ILT
10187 PR 7091
10188 * output.cc (Output_section::find_starting_output_address): Rename
10189 from starting_output_address; add PADDR parameter; change return
10190 type.
10191 * output.h (class Output_section): Declare
10192 find_starting_output_address instead of starting_output_address.
10193 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10194 section symbol for which we can't find a merge section.
10195
0602e05a
ILT
10196 PR 9836
10197 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10198 hidden or internal, force the symbol to be local.
10199 * resolve.cc (Symbol::override_visibility): Define.
10200 (Symbol::override_base): Use override_visibility.
10201 (Symbol_table::resolve): Likewise.
10202 (Symbol::override_base_with_special): Likewise.
10203 (Symbol_table::override_with_special): If the visibility is hidden
10204 or internal, force the symbol to be local.
10205 * symtab.h (class Symbol): Add set_visibility and
10206 override_visibility.
10207 * testsuite/ver_test_1.sh: New file.
10208 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10209 (check_DATA): Add ver_test_1.syms.
10210 (ver_test_1.syms): New target.
10211 * testsuite/Makefile.in: Rebuild.
10212
401a9a73
CC
102132009-02-25 Cary Coutant <ccoutant@google.com>
10214
10215 * layout.cc (Layout::choose_output_section): Don't rename sections
10216 when using a linker script that has a SECTIONS clause.
10217 * Makefile.in: Regenerate.
10218
10219 * testsuite/Makefile.am (script_test_5.sh): New test case.
10220 * testsuite/Makefile.in: Regenerate.
10221 * testsuite/script_test_5.cc: New file.
10222 * testsuite/script_test_5.sh: New file.
10223 * testsuite/script_test_5.t: New file.
10224
f488e4b0
CC
102252009-02-13 Rafael Avila de Espindola <espindola@google.com>
10226
10227 * archive.cc (Archive::include_member): Update calls to add_symbols.
10228 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10229 the Layout argument.
10230 * dynobj.h (do_add_symbols): Add the Layout argument.
10231 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10232 Layout argument.
10233 * object.h (Object::add_symbols): Add the Layout argument.
10234 (Object::do_add_symbols): Add the Layout argument.
10235 (Sized_relobj::do_add_symbols): Add the Layout argument.
10236 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10237 Unify the two versions.
10238 (Add_plugin_symbols): Remove.
10239 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10240 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10241 (Add_plugin_symbols): Remove.
10242 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10243 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10244 (Add_symbols::run): Make it work with Pulginobj.
10245
89dd1680
ILT
102462009-02-06 Ian Lance Taylor <iant@google.com>
10247
10248 * object.cc (Sized_relobj::do_layout): Make info message start
10249 with lower case letter.
10250
266d0a74
ILT
102512009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10252
602b464e
ILT
10253 * binary.cc: Fix file comment.
10254
266d0a74
ILT
10255 * options.h (enum Incremental_disposition): Define.
10256 (class General_options): Add new options: --incremental,
10257 --incremental_changed, --incremental_unchanged,
10258 --incremental_unknown. Add incremental_disposition_ and
10259 implicit_incremental_ fields.
10260 (General_options::incremental_disposition): New function.
10261 (class Position_dependent_options): Add incremental_disposition
10262 option.
10263 (Position_dependent_options::copy_from_options): Set incremental
10264 dispositions.
10265 * options.cc (General_options::parse_incremental_changed): New
10266 function.
10267 (General_options::parse_incremental_unchanged): New function.
10268 (General_options::parse_incremental_unknown): New function.
10269 (General_options::General_options): Initialize new fields
10270 incremental_disposition_ and implicit_incremental_.
10271 (General_options::finalize): Check for uasge of --incremental-*
10272 without --incremental.
10273
f073bbf7
CD
102742009-02-06 Chris Demetriou <cgd@google.com>
10275
10276 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10277 pointer and to report location as the file name associated with
10278 the symbol.
10279 (gold_undefined_symbol_at_location): New function to replace the
10280 old gold_undefined_symbol functionality.
10281 * target-reloc.h (relocate_section): Update to use
10282 gold_undefined_symbol_at_location.
10283 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10284 Call gold_undefined_symbol function rather than gold_error.
10285 * errors.h (Errors::undefined_symbol): Take location as a
10286 string, rather than calculating it from a relocation.
10287 * errors.cc (Errors::fatal): Print "fatal error:" before the
10288 formatted message.
10289 (Errors::error, Errors::error_at_location): Print "error: "
10290 before the formatted message.
10291 (Errors::undefined_symbol): Take location as a string, rather
10292 than calculating it from a relocation.
10293 (gold_undefined_symbol_at_location): New function akin to
10294 old gold_undefined_symbol, calculates location from relocation.
10295 (gold_undefined_symbol): Change to take only a Symbol pointer
10296 and to report location as the file name associated with the symbol.
10297 * testsuite/debug_msg.sh: Update for changed error messages.
10298 * testsuite/undef_symbol.sh: Likewise.
10299
8e94a90c
ILT
103002009-02-04 Duncan Sands <baldrick@free.fr>
10301
10302 PR 9812
10303 * reduced_debug_output.h
10304 (Output_reduced_debug_abbrev_section::failed): Use format for
10305 gold_warning.
10306 (Output_reduced_debug_info_section::faild): Likewise.
10307
88a0e15b
ILT
103082009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10309
10310 * script.cc (Lazy_demangler): New class.
10311 (Version_script_info::get_symbol_version_helper): Demangle a
10312 symbol only once.
10313
5efc7cd2
CC
103142009-01-29 Cary Coutant <ccoutant@google.com>
10315
10316 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10317 to __tls_get_addr.
10318 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10319
e0ebcf42
ILT
103202009-01-28 Ian Lance Taylor <iant@google.com>
10321
5efc7cd2 10322 * version.cc (version_string): Bump to 1.9.
75fe7426 10323
e0ebcf42
ILT
10324 * gold.h: Include <cstring> and <stdint.h>.
10325 * version.cc: Include <cstdio>.
10326 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10327 warning.
10328 * reduced_debug_output.cc (insert_into_vector): Rename from
10329 Insert_into_vector; change all callers. Use Swap_unaligned to
10330 avoid aliasing issue; remove union since it is unnecessary.
10331
8e2813be 103322009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
10333
10334 * Makefile.am (CCFILES): Add gc.cc.
10335 (HFILES): Add gc.h.
10336 * Makefile.in: Regenerate.
10337 * gold.cc (Gc_runner): New class.
10338 (queue_initial_tasks): Call garbage collection related tasks
10339 when corresponding options are invoked.
10340 (queue_middle_gc_tasks): New function.
10341 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10342 processed early before laying out sections during garbage collection.
10343 * gold.h (queue_middle_gc_tasks): New function.
10344 (is_prefix_of): Move from "layout.cc".
10345 * i386.cc (Target_i386::gc_process_relocs): New function.
10346 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10347 * main.cc (main): Create object of class "Garbage_collection".
10348 * object.cc (Relobj::copy_symbols_data): New function.
10349 (Relobj::is_section_name_included): New function.
e1df38aa
NC
10350 (Sized_relobj::do_layout): Allow this function to be called twice
10351 during garbage collection and defer layout of section during the
6d03d481
ST
10352 first call.
10353 * object.h (Relobj::get_symbols_data): New function.
10354 (Relobj::is_section_name_included): New function.
10355 (Relobj::copy_symbols_data): New function.
10356 (Relobj::set_symbols_data): New function.
10357 (Relobj::get_relocs_data): New function.
10358 (Relobj::set_relocs_data): New function.
10359 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10360 (Relobj::gc_process_relocs): New function.
10361 (Relobj::do_gc_process_relocs): New pure virtual function.
10362 (Relobj::sd_): New data member.
10363 (Sized_relobj::is_output_section_offset_invalid): New function.
10364 (Sized_relobj::do_gc_process_relocs): New function.
10365 * options.h (General_options::gc_sections): Modify to not be a no-op.
10366 (General_options::print_gc_sections): New option.
10367 * plugin.cc (Plugin_finish::run): Remove function call to
10368 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10369 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10370 * reloc.cc (Read_relocs::run): Add task to process relocs and
10371 determine unreferenced sections when doing garbage collection.
10372 (Gc_process_relocs): New class.
10373 (Sized_relobj::do_gc_process_relocs): New function.
10374 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10375 sections that are garbage collected.
10376 * reloc.h (Gc_process_relocs): New class.
10377 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10378 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10379 symbols whose corresponding sections are garbage collected.
10380 (Symbol_table::Symbol_table): Add new parameter for the garbage
10381 collection object.
10382 (Symbol_table::gc_mark_undef_symbols): New function.
10383 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10384 (Symbol_table::gc_mark_dyn_syms): New function.
10385 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10386 as garbage.
10387 (Symbol_table::add_from_object): Likewise.
10388 (Symbol_table::add_from_relobj): When building shared objects, do not
10389 treat externally visible symbols as garbage.
10390 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10391 table information for static and relocatable links.
10392 * symtab.h (Symbol_table::set_gc): New function.
10393 (Symbol_table::gc): New function.
10394 (Symbol_table::gc_mark_undef_symbols): New function.
10395 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10396 (Symbol_table::gc_mark_dyn_syms): New function.
10397 (Symbol_table::gc_): New data member.
e1df38aa 10398 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
10399 function.
10400 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10401 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10402
3b293544
CF
104032009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10404
10405 * options.h (General_options::gc_sections): Define as a no-op for now.
10406 (General_options::no_keep_memory): Ditto.
10407 (General_options::Bshareable): Define.
10408 * options.cc (General_options::finalize): Honor -Bshareable.
10409
83d22aa8
AS
104102009-01-20 Andreas Schwab <schwab@suse.de>
10411
10412 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10413 read the value in the contents, since we don't use it. Use the
10414 template endianness when writing.
10415 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10416
cd536b21
AS
104172009-01-19 Andreas Schwab <schwab@suse.de>
10418
10419 * configure.tgt (powerpc64-*): Fix targ_obj.
10420
99e9a495
ILT
104212009-01-15 Ian Lance Taylor <iant@google.com>
10422
10423 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10424 local symbols when stripping all symbols.
10425
bbbfea06
CC
104262009-01-14 Cary Coutant <ccoutant@google.com>
10427
99e9a495 10428 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 10429
0f7c0701
CC
104302009-01-14 Cary Coutant <ccoutant@google.com>
10431
10432 * archive.cc (Archive::get_elf_object_for_member): Remove call
10433 to File_read::claim_for_plugin.
10434 * descriptors.cc (Descriptors::open): Remove reference to
10435 is_claimed.
10436 (Descriptors::claim_for_plugin): Remove.
10437 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10438 (Descriptors::is_claimed): Remove.
10439 (claim_descriptor_for_plugin): Remove.
10440 * fileread.cc (File_read::claim_for_plugin): Remove.
10441 * fileread.h (File_read::claim_for_plugin): Remove.
10442 (File_read::descriptor): Reopen descriptor if necessary.
10443 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10444 (Plugin_manager::all_symbols_read): Add task parameter. Change
10445 all callers.
10446 (Plugin_manager::get_input_file): New function.
10447 (Plugin_manager::release_input_file): New function.
10448 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10449 corresponding data member.
10450 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10451 and pass to base constructor. Change all callers.
10452 (get_input_file, release_input_file): New functions.
10453 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10454 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10455 (Plugin_manager::all_symbols_read): Add task parameter.
10456 (Plugin_manager::get_input_file): New function.
10457 (Plugin_manager::release_input_file): New function.
10458 (Plugin_manager::task_): New data member.
10459 (Pluginobj::Pluginobj): Add filesize parameter.
10460 (Pluginobj::filename): New function.
10461 (Pluginobj::descriptor): New function.
10462 (Pluginobj::filesize): New function.
10463 (Pluginobj::filesize_): New data member.
10464 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10465 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10466 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10467
10468 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10469 with archive libraries.
10470 * testsuite/Makefile.in: Regenerate.
10471 * testsuite/plugin_test.c (struct sym_info): New type.
10472 (get_input_file, release_input_file): New static variables.
10473 (onload): Capture new transfer vector entries.
10474 (claim_file_hook): Stop reading at end of file according to filesize.
10475 Factor out parsing of readelf output into separate function.
10476 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10477 APIs and get the source file name from the symbol table. Convert
10478 source file name to corresponding object file name. Print info
10479 message when adding new input files.
10480 (parse_readelf_line): New function.
10481 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10482 * testsuite/plugin_test_2.sh: Likewise.
10483 * testsuite/plugin_test_3.sh: Likewise.
10484 * testsuite/plugin_test_4.sh: New test case.
10485
62a6d109
ILT
104862009-01-07 Ian Lance Taylor <iant@google.com>
10487
10488 * version.cc (version_string): Bump to 1.8.
10489
483620e8
CC
104902008-12-23 Cary Coutant <ccoutant@google.com>
10491
10492 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10493 * plugin.cc (Plugin_manager::finish): Rename as
10494 layout_deferred_objects. Move cleanup to separate function.
10495 (Plugin_manager::cleanup): New function.
10496 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10497 separately.
10498 * plugin.h (Plugin_manager::finish): Rename as
10499 layout_deferred_objects.
10500 (Plugin_manager::cleanup): New function.
10501 (Plugin_manager::cleanup_done): New field.
10502
d66a9eb3
CC
105032008-12-23 Cary Coutant <ccoutant@google.com>
10504
10505 * plugin.cc (is_visible_from_outside): New function.
10506 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10507 so we don't return "IR only" status for exported symbols or -r links.
10508
10509 * testsuite/Makefile.am (plugin_test_3): New test case.
10510 * testsuite/Makefile.in: Regenerate.
10511 * testsuite/plugin_test_3.sh: New file.
10512
5995b570
CC
105132008-12-22 Cary Coutant <ccoutant@google.com>
10514
10515 * object.cc (Sized_relobj::layout_section): New function.
10516 (Sized_relobj::do_layout): Defer layout of input sections until after
10517 plugin has provided replacement files.
10518 (Sized_relobj::do_layout_deferred_sections): New function.
10519 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10520 (Relobj::layout_deferred_sections): New function.
10521 (Relobj::do_layout_deferred_sections): New function.
10522 (Sized_relobj::do_layout_deferred_sections): New function.
10523 (Sized_relobj::layout_section): New function.
10524 (Sized_relobj::Deferred_layout): New structure.
10525 (Sized_relobj::deferred_layout_): New field.
10526 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10527 Change all callers. Layout deferred sections.
10528 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10529 references.
10530 (Plugin_hook::run): Move code from do_plugin_hook inline.
10531 (Plugin_hook::do_plugin_hook): Remove.
10532 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10533 (Plugin_manager::finish): Renamed, was cleanup.
10534 (Plugin_manager::should_defer_layout): New function.
10535 (Plugin_manager::add_deferred_layout_object): New function.
10536 (Plugin_manager::Deferred_layout_list): New type.
10537 (Plugin_manager::deferred_layout_objects_): New field.
10538 (Plugin_hook::do_plugin_hook): Remove.
10539
ee769c88
ILT
105402008-12-17 Ian Lance Taylor <iant@google.com>
10541
10542 * options.h (class General_options): Add --no case for
10543 --export-dynamic.
10544
abc8dcba
CC
105452008-12-16 Cary Coutant <ccoutant@google.com>
10546
10547 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10548 vector.
10549 (Plugin_manager::claim_file): Create plugin object even if
10550 plugin did not call the add_symbols callback.
10551 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10552 asking for more symbols than were added.
10553 * testsuite/Makefile.am (plugin_test_1): Add test case with
10554 no global symbols.
10555 (empty.syms): New target.
10556 * testsuite/Makefile.in: Regenerate.
10557 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10558 message. Don't call add_symbols if no globals.
10559 (all_symbols_read_hook): Don't provide replacement for empty
10560 claimed file.
10561
b0074644
ILT
105622008-12-12 Ian Lance Taylor <iant@google.com>
10563
68943102
ILT
10564 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10565 r_type == 0 for a local symbol with r_sym == 0.
10566 (scan_relocatable_relocs): Pass r_sym to
10567 local_non_section_strategy.
10568 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10569 r_sym parameter.
10570
b0074644
ILT
10571 * configure.ac: Update test for TLS descriptors: they are
10572 supported as of glibc 2.9.
10573 * configure: Rebuild.
10574
c2508178
ILT
105752008-12-11 Ian Lance Taylor <iant@google.com>
10576
10577 PR 7091
10578 * target-reloc.h (Default_scan_relocatable_relocs): For each
10579 function, map r_type == 0 to RELOC_DISCARD.
10580
2756a258
CC
105812008-12-10 Cary Coutant <ccoutant@google.com>
10582
10583 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10584 object to override a kept COMDAT group from a plugin object.
10585
bb6f53d3
ILT
105862008-12-09 Ian Lance Taylor <iant@google.com>
10587
fbc558e1
ILT
10588 PR 7088
10589 * yyscript.y (file_cmd): Handle INPUT.
10590
bb6f53d3
ILT
10591 * testsuite/initpri1.c: Change all declarations to be full
10592 prototypes by adding void, to avoid compiler warnings.
10593
4674ecfc
CC
105942008-12-05 Rafael Avila de Espindola <espindola@google.com>
10595
10596 * options.cc (General_options::parse_plugin_opt): New.
10597 (General_options::add_plugin): The argument now is just the filename.
10598 (General_options::add_plugin_option): New.
10599 * options.h (plugin_opt): New.
10600 (add_plugin): Change argument name.
10601 (add_plugin_option): New.
10602 * plugin.cc (Plugin::load): Don't parse the plugin option.
10603 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10604 (Plugin::add_option): New.
10605 (Plugin::args_): Change type.
10606 (Plugin::filename_): New.
10607 (Plugin_manager::add_plugin_option): New.
10608 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10609 * testsuite/Makefile.in: Regenerate.
10610
fd06b4aa
CC
106112008-12-05 Cary Coutant <ccoutant@google.com>
10612
10613 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10614 Handle --strip-lto-sections option.
10615 * options.h (strip_lto_sections): New option.
10616
6c52134c
CC
106172008-12-01 Cary Coutant <ccoutant@google.com>
10618
10619 * plugin.cc (ld_plugin_message): Change format parameter to const.
10620 Fix mismatch between new[] and delete.
10621
a45248e0
CC
106222008-11-14 Cary Coutant <ccoutant@google.com>
10623
10624 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10625 instead of -1U.
10626
c82fbeee
CS
106272008-11-05 Craig Silverstein <csilvers@google.com>
10628
10629 * options.cc (General_options::parse_dynamic_list): New function.
10630 * options.h (General_options): New flags dynamic_list,
10631 dynamic_list_data, dynamic_list_cpp_new, and
10632 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10633 (General_options::in_dynamic_list): New function.
10634 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10635 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10636 (Lex::can_continue_name): Likewise.
10637 (yylex): Likewise.
10638 (read_script_file): New parameter script_options.
10639 (read_dynamic_list): New function.
10640 (Script_options::define_dynamic_list): New function.
10641 (dynamic_list_keyword_parsecodes): New variable.
10642 (dynamic_list_keywords): New variable.
10643 * script.h (Script_options::define_dynamic_list): New function
10644 prototype.
10645 (read_dynamic_list): New function prototype.
10646 * symtab.cc (strprefix): New macro.
10647 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10648 dynamic_list_data, dynamic_list_cpp_new, and
10649 dynamic_list_cpp_typeinfo.
10650 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10651 (dynamic_list_expr): New rule.
10652 (dynamic_list_nodes): Likewise.
10653 (dynamic_list_node): Likewise.
10654 * testsuite/Makefile.am (dynamic_list): New test.
10655 * testsuite/Makefile.in: Regenerated.
10656 * testsuite/dynamic_list.t: New file.
10657 * testsuite/dynamic_list.sh: New file.
10658
e0bb29a5
CS
106592008-11-05 Craig Silverstein <csilvers@google.com>
10660
10661 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10662 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10663 (t11_last): Likewise.
10664 * testsuite/ver_test_6.c (main): Likewise.
10665
4e1e25e0
CC
106662008-10-07 Cary Coutant <ccoutant@google.com>
10667
10668 * options.c (General_options::finalize): Add check for -static and
10669 -shared.
10670 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10671 is not empty.
10672
92f03fcb
CC
106732008-10-02 Cary Coutant <ccoutant@google.com>
10674
10675 * plugin.cc (make_sized_plugin_object): Fix conditional
10676 compilation to work when not all targets are enabled.
10677
fbd8a257
CC
106782008-09-29 Cary Coutant <ccoutant@google.com>
10679
10680 * archive.cc (Archive::get_file_and_offset): Use filename instead
10681 of name to get library path.
10682 (Archive::include_member): Unlock external member of a thin archive.
10683
10684 * testsuite/Makefile.am (TEST_AR): New variable.
10685 (thin_archive_test_1): New test.
10686 (thin_archive_test_2): New test.
81636b3f
CC
10687 * testsuite/Makefile.in: Regenerate.
10688 * testsuite/thin_archive_main.cc: New file.
10689 * testsuite/thin_archive_test_1.cc: New file.
10690 * testsuite/thin_archive_test_2.cc: New file.
10691 * testsuite/thin_archive_test_3.cc: New file.
10692 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 10693
eff45813
CC
106942008-09-29 Cary Coutant <ccoutant@google.com>
10695
10696 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10697 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10698 instead of -1U.
10699 (Sized_relobj::do_finalize_local_symbols): Likewise.
10700 (Sized_relobj::map_to_kept_section): Likewise.
10701 * object.h (Sized_relobj::invalid_address): New constant.
10702 (Sized_relobj::do_output_section_offset): Check for invalid_address
10703 and return -1ULL.
10704 * output.cc (Output_reloc::local_section_offset): Use constant
10705 invalid_address instead of -1U.
10706 (Output_reloc::get_address): Likewise.
10707 (Output_section::output_address): Change -1U to -1ULL.
10708 * output.h (Output_reloc::invalid_address): New constant.
10709 * reloc.cc (Sized_relobj::write_sections): Use constant
10710 invalid_address instead of -1U.
10711 (Sized_relobj::relocate_sections): Likewise.
10712 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10713 values for merge sections.
10714 * target-reloc.h (relocate_for_relocatable): Use constant
10715 invalid_address instead of -1U.
10716
89fc3421
CC
107172008-09-19 Cary Coutant <ccoutant@google.com>
10718
10719 Add plugin functionality for link-time optimization (LTO).
10720 * configure.ac (plugins): Add --enable-plugins option.
10721 * configure: Regenerate.
10722 * config.in: Regenerate.
10723 * Makefile.am (LIBDL): New variable.
10724 (CCFILES): Add plugin.cc.
10725 (HFILES): Add plugin.h.
10726 (ldadd_var): Add LIBDL.
10727 * Makefile.in: Regenerate.
10728
10729 * archive.cc: Include "plugin.h".
10730 (Archive::setup): Don't preread archive symbols when using a plugin.
10731 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10732 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10733 files.
10734 (Archive::include_member): Add symbols from plugin objects.
10735 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10736 * descriptors.cc (Descriptors::open): Check for file descriptors
10737 abandoned by plugins.
10738 (Descriptors::claim_for_plugin): New function.
10739 * descriptors.h (Descriptors::claim_for_plugin): New function.
10740 (Open_descriptor::is_claimed): New field.
10741 (claim_descriptor_for_plugin): New function.
10742 * fileread.cc (File_read::claim_for_plugin): New function.
10743 * fileread.h (File_read::claim_for_plugin): New function.
10744 (File_read::descriptor): New function.
10745 * gold.cc: Include "plugin.h".
10746 (queue_initial_tasks): Add task to call plugin hooks for generating
10747 new object files.
10748 * main.cc: Include "plugin.h".
10749 (main): Load plugin libraries.
10750 * object.h (Pluginobj): Declare.
10751 (Object::pluginobj): New function.
10752 (Object::do_pluginobj): New function.
10753 (Object::set_target): New function.
10754 * options.cc: Include "plugin.h".
10755 (General_options::parse_plugin): New function.
10756 (General_options::General_options): Initialize plugins_ field.
10757 (General_options::add_plugin): New function.
10758 * options.h (Plugin_manager): Declare.
10759 (General_options): Add --plugin option.
10760 (General_options::has_plugins): New function.
10761 (General_options::plugins): New function.
10762 (General_options::add_plugin): New function.
10763 (General_options::plugins_): New field.
10764 * plugin.cc: New file.
10765 * plugin.h: New file.
10766 * readsyms.cc: Include "plugin.h".
10767 (Read_symbols::do_read_symbols): Check for archive before checking
10768 for ELF file. Call plugin hooks to claim files.
10769 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10770 from a real object file; force override when processing replacement
10771 files.
10772 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10773 (Symbol::init_base_object): Likewise.
10774 (Symbol::init_base_output_data): Likewise.
10775 (Symbol::init_base_output_segment): Likewise.
10776 (Symbol::init_base_constant): Likewise.
10777 (Symbol::init_base_undefined): Likewise.
10778 (Symbol::output_section): Assert that object is not a plugin.
10779 (Symbol_table::add_from_pluginobj): New function.
10780 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10781 undefined.
10782 (Symbol_table::sized_write_globals): Likewise.
10783 (Symbol_table::add_from_pluginobj): Instantiate template.
10784 * symtab.h (Sized_pluginobj): Declare.
10785 (Symbol::in_real_elf): New function.
10786 (Symbol::set_in_real_elf): New function.
10787 (Symbol::in_real_elf_): New field.
10788 (Symbol_table::add_from_pluginobj): New function.
10789
10790 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10791 (LIBDL): New variable.
10792 (LDADD): Add LIBDL.
10793 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10794 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10795 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10796 (MOSTLYCLEANFILES): Likewise.
10797 * testsuite/Makefile.in: Regenerate.
10798 * testsuite/plugin_test.c: New file.
10799 * testsuite/plugin_test_1.sh: New file.
10800 * testsuite/plugin_test_2.sh: New file.
10801
de31bda5
ILT
108022008-09-16 Ian Lance Taylor <iant@google.com>
10803
9c2d0ef9
ILT
10804 * target-reloc.h (relocate_section): Check whether a symbol is
10805 defined by the ABI before reporting an undefined symbol error.
10806 * target.h (Target::is_defined_by_abi): Make parameter const.
10807 (Target::do_is_defined_by_abi): Likewise.
10808 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10809 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10810 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10811 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10812 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10813 * testsuite/Makefile.in: Rebuild.
10814
de31bda5
ILT
10815 * fileread.cc (make_view): Add casts to avoid warning.
10816
9fa33bee
AO
108172008-09-16 Alexandre Oliva <aoliva@redhat.com>
10818
10819 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10820 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10821
183fd0e3
AO
108222008-09-16 Alexandre Oliva <aoliva@redhat.com>
10823
10824 * options.h (General_options::output_is_executable): New.
10825 (General_options::output_is_pie): New.
10826 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10827 for shared libraries.
10828 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10829
7be8330a
CD
108302008-09-11 Chris Demetriou <cgd@google.com>
10831
10832 * options.h (origin): New -z option.
10833 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10834 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10835 in DT_FLAGS_1.
10836
a9caad02
CC
108372008-09-05 Cary Coutant <ccoutant@google.com>
10838
10839 * fileread.cc (File_read::make_view): Add check for attempt to map
10840 beyond end of file.
10841
ae6dce4d
CC
108422008-09-05 Cary Coutant <ccoutant@google.com>
10843
10844 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10845 explicit instantiations.
10846
d7ab2a47
KVH
108472008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10848
10849 PR gold/6858
10850 * options.cc (General_options::finalize): Allow undefined symbols
10851 in shlibs if linking -shared.
10852
10853 PR gold/6859
10854 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10855 symbols as not needing a dynsym entry.
10856
1e52a9c1
CS
108572008-08-20 Craig Silverstein <csilvers@google.com>
10858
10859 * fileread.cc (File_read::open): Do not lock the file unless it
10860 was successfully opened.
10861
d85c80a3
CC
108622008-08-14 Cary Coutant <ccoutant@google.com>
10863
10864 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10865 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10866 * testsuite/tls_test.cc (struct int128): 128-bit struct
10867 for testing TLS relocs with non-zero addend.
10868 (v12): New TLS variable.
10869 (t12): New test.
10870 (t_last): Add check for v12.
10871 * testsuite/tls_test.h (t12): New function.
10872 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10873
2d924fd9
ILT
108742008-08-13 Ian Lance Taylor <iant@google.com>
10875
10876 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10877 set tls_segment_ or relro_segment_.
10878 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10879 when appropriate.
10880 * output.h (Output_section::clear_is_relro): New function.
10881 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10882 sections specially even when output_data_ is empty.
10883 (Output_segment::maximum_alignment): When first section is relro,
10884 only force alignment for PT_LOAD segments.
10885 * script.cc (script_data_segment_align): New function.
10886 (script_data_segment_relro_end): New function.
10887 * script-c.h (script_data_segment_align): Declare.
10888 (script_data_segment_relro_end): Declare.
10889 * script-sections.h (class Script_sections): Declare
10890 data_segment_align and data_segment_relro_end. Add fields
10891 segment_align_index_ and saw_relro_end_.
10892 * script-sections.cc (class Sections_element): Add set_is_relro
10893 virtual function. Add new bool* parameter to place_orphan_here.
10894 Add get_output_section virtual function.
10895 (class Output_section_definition): Add set_is_relro. Add new
10896 bool* parameter to place_orphan_here. Add get_output_section.
10897 Add is_relro_ field.
10898 (Output_section_definition::Output_section_definition): Initialize
10899 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10900 and is_relro_ fields.
10901 (Output_section_definition::place_orphan_here): Add is_relro
10902 parameter.
10903 (Output_section_definition::set_section_addresses): Set relro for
10904 output section.
10905 (Output_section_definition::alternate_constraint): Likewise.
10906 (class Orphan_output_section): Add new bool* parameter to
10907 place_orphan_here. Add get_output_section.
10908 (Orphan_output_section::place_orphan_here): Add is_relro
10909 parameter.
10910 (Script_sections::Script_sections): Initialize
10911 data_segment_align_index_ and saw_relro_end_.
10912 (Script_sections::data_segment_align): New function.
10913 (Script_sections::data_segment_relro_end): New function.
10914 (Script_sections::place_orphan): Set or clear is_relro.
10915 (Script_sections::set_section_addresses): Force alignment of first
10916 TLS section.
10917 * yyscript.y (exp): Call script_data_segment_align and
10918 script_data_segment_relro_end.
10919 * testsuite/relro_script_test.t: New file.
10920 * testsuite/relro_test.cc (using_script): Declare.
10921 (t1, t2): Test using_script.
10922 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10923 (relro_script_test_SOURCES): Define.
10924 (relro_script_test_DEPENDENCIES): Define.
10925 (relro_script_test_LDFLAGS): Define.
10926 (relro_script_test_LDADD): Define.
10927 (relro_script_test.so): New target.
10928 * testsuite/Makefile.in: Rebuild.
10929
f827c9a9
CC
109302008-08-06 Cary Coutant <ccoutant@google.com>
10931
10932 * archive.cc (Archive::total_archives, Archive::total_members)
10933 (Archive::total_members_loaded): New variables.
10934 (Archive::setup): Add parameter. Add option to preread
10935 archive symbols.
10936 (Archive::read_armap): Add counter.
10937 (Archive::get_file_and_offset): New function.
10938 (Archive::get_elf_object_for_member): New function.
10939 (Archive::read_all_symbols): New function.
10940 (Archive::read_symbols): New function.
10941 (Archive::add_symbols): Add counters.
10942 (Archive::include_all_members): Use armap to find members if it's
10943 already built.
10944 (Archive::include_member): Skip reading symbols if already read.
10945 Factored code into Archive::get_file_and_offset and
10946 Archive::get_elf_object_for_member. Changed call to
10947 Mapfile::report_include_archive_member.
10948 (Archive::print_stats): New function.
10949 * archive.h: Declare Object and Read_symbols_data classes.
10950 (Archive::Archive): Add initializers for new members.
10951 (Archive::setup): Add parameter.
10952 (Archive::print_stats): New function.
10953 (Archive::total_archives, Archive::total_members)
10954 (Archive::total_members_loaded): New variables.
10955 (Archive::get_file_and_offset): New function.
10956 (Archive::get_elf_object_for_member): New function.
10957 (Archive::read_all_symbols): New function.
10958 (Archive::read_symbols): New function.
10959 (Archive::Archive_member): New class.
10960 (Archive::members_): New member.
10961 (Archive::num_members_): New member.
10962 * main.cc: Include archive.h.
10963 (main): Call Archive::print_stats.
10964 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10965 archive parameter; member_name is now the fully-decorated name.
10966 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10967 * options.h: (General_options): Add --preread-archive-symbols option.
10968 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10969 Archive::setup.
10970
de4c45bd
ILT
109712008-08-04 Ian Lance Taylor <iant@google.com>
10972
10973 * symtab.h (Symbol::use_plt_offset): New function.
10974 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10975 * powerpc.cc (Relocate::relocate): Likewise.
10976 * sparc.cc (Relocate::relocate): Likewise.
10977 * x86_64.cc (Relocate::relocate): Likewise.
10978 * testsuite/weak_plt.sh: New test.
10979 * testsuite/weak_plt_main.cc: New test.
10980 * testsuite/weak_plt_shared.cc: New test.
10981 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10982 (check_PROGRAMS): Add weak_plt.
10983 (check_DATA): Add weak_plt_shared.so.
10984 (weak_plt_main_pic.o, weak_plt): New targets.
10985 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10986 * testsuite/Makefile.in: Rebuild.
10987
10988 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10989 gcctestdir/ld.
10990 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10991 * testsuite/Makefile.in: Rebuild.
10992
323ee3f4
AM
109932008-08-04 Alan Modra <amodra@bigpond.net.au>
10994
10995 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10996 * Makefile.in: Regenerate.
10997 * po/POTFILES.in: Regenerate.
10998
7c07ecec
ILT
109992008-07-29 Ian Lance Taylor <iant@google.com>
11000
11001 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11002 symbols before other symbols.
11003 * testsuite/script_test_2.cc (test_addr): Declare.
11004 (test_addr_alias): Declare.
11005 (main): Check that test_addr and test_addr_alias have the right
cd536b21 11006 values.
7c07ecec
ILT
11007 * testsuite/script_test_2.t: Define test_addr_alias and
11008 test_addr.
11009
5778530e
ILT
110102008-07-24 Ian Lance Taylor <iant@google.com>
11011
2a00e4fb
ILT
11012 PR 5990
11013 * descriptors.cc: New file.
11014 * descriptors.h: New file.
11015 * gold-threads.h (class Hold_optional_lock): New class.
11016 * fileread.cc: Include "descriptors.h".
11017 (File_read::~File_read): Release descriptor rather than closing
11018 it.
11019 (File_read::open) [file]: Call open_descriptor rather than open.
11020 Set is_descriptor_opened_.
11021 (File_read::open) [memory]: Assert that descriptor is not open.
11022 (File_read::reopen_descriptor): New function.
11023 (File_read::release): Release descriptor.
11024 (File_read::do_read): Make non-const. Reopen descriptor.
11025 (File_read::read): Make non-const.
11026 (File_read::make_view): Reopen descriptor.
11027 (File_read::do_readv): Likewise.
11028 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11029 Update declarations.
11030 * layout.cc: Include "descriptors.h".
11031 (Layout::create_build_id): Use open_descriptor rather than open.
11032 * output.cc: Include "descriptors.h".
11033 (Output_file::open): Use open_descriptor rather than open.
11034 * archive.cc (Archive::const_iterator): Change Archive to be
11035 non-const.
11036 (Archive::begin, Archive::end): Make non-const.
11037 (Archive::count_members): Likewise.
11038 * archive.h (class Archive): Update declarations.
11039 * object.h (Object::read): Make non-const.
11040 * Makefile.am (CCFILES): Add descriptors.cc.
11041 (HFILES): Add descriptors.h.
11042 * Makefile.in: Rebuild.
11043
801647d1
ILT
11044 PR 6716
11045 * gold.h: Always include <clocale>. Add Solaris workarounds
11046 following code in binutils/sysdep.h.
11047
5edd166e
ILT
11048 PR 6048
11049 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11050 this->eh_frame_hdr_ is NULL before using it.
11051
c89ad728
ILT
11052 * dynobj.cc (Versions::Versions): Update comment.
11053
aa86f06b
ILT
11054 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11055 the base version name.
11056
5778530e
ILT
11057 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11058 array size plus one.
11059 (Stringpool_template::set_string_offsets): Subtract one from key
11060 before using it as an array index.
11061 (Stringpool_template::get_offset_with_length): Likewise.
11062 (Stringpool_template::write_to_buffer): Likewise.
11063 * stringpool.h (Stringpool_template::get_offset_from_key):
11064 Likewise.
11065
057ead22
ILT
110662008-07-23 Ian Lance Taylor <iant@google.com>
11067
7f649c59
ILT
11068 PR 6658
11069 * object.h (Merged_symbol_value::value): Do our best to handle a
11070 negative addend.
11071
057ead22
ILT
11072 PR 6647
11073 * script.cc (Version_script_info::get_versions): Don't add empty
11074 version tag to return value.
11075 (Version_script_info::get_symbol_version_helper): Change return
11076 type to bool. Add pversion parameter. Change all callers.
11077 (script_register_vers_node): Don't require a non-NULL tag.
11078 * script.h (class Version_script_info): Update declarations.
11079 (Version_script_info::get_symbol_version): Change return type to
11080 bool. Add version parameter. Change all callers.
11081 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11082 handling. Handle an empty version from a version script.
11083 (Symbol_table::define_special_symbol): Likewise.
11084 * testsuite/ver_test_10.script: New file.
11085 * testsuite/ver_test_10.sh: New file.
11086 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11087 (check_DATA): Add ver_test_10.syms.
11088 (ver_test_10.syms, ver_test_10.so): New target.
11089 * testsuite/Makefile.in: Rebuild.
11090
58e54ac2
CD
110912008-07-23 Simon Baldwin <simonb@google.com>
11092
11093 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11094 to zero for undefined symbols from dynamic libraries.
11095
95d14cd3
ILT
110962008-07-23 Ian Lance Taylor <iant@google.com>
11097
11098 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11099 Change all callers.
11100 * symtab.h (class Symbol_table): Update declaration.
11101 * testsuite/ver_test_9.cc: New file.
11102 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11103 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11104 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11105 (ver_test_9.so, ver_test_9.o): New targets.
11106 * testsuite/Makefile.in: Rebuild.
11107
92de84a6
ILT
111082008-07-22 Ian Lance Taylor <iant@google.com>
11109
34810851
ILT
11110 * options.h (class General_options): Define --check-sections.
11111 * layout.cc (Layout::set_segment_offsets): Handle
11112 --check-sections.
11113
af6156ef
ILT
11114 * options.h (class General_options): Define -n/--nmagic and
11115 -N/--omagic.
11116 * options.cc (General_options::finalize): For -n/--nmagic or
11117 -N/--omagic, set -static.
11118 * layout.cc (Layout::attach_allocated_section_to_segment): If
11119 -N/--omagic, don't put read-only and read-write sections in
11120 different segments.
11121 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11122 finding a read-only segment.
11123 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11124 don't set the minimum segment alignment to the common page size,
11125 and don't set the file offset to the address modulo the page size.
11126 * script-sections.cc (Script_sections::create_segments): If
11127 -n/--omagic, don't put read-only and read-write sections in
11128 different segments.
11129
92de84a6
ILT
11130 * cref.cc: New file.
11131 * cref.h: New file.
11132 * options.h (class General_options): Add --print-symbol-counts.
11133 * main.cc (main): Issue defined symbol report if requested.
11134 * archive.cc (Archive::interpret_header): Make into a const member
11135 function.
11136 (Archive::add_symbols): Call Input_objects::archive_start and
11137 archive_stop.
11138 (Archive::const_iterator): Define new class.
11139 (Archive::begin, Archive::end): New functions.
11140 (Archive::include_all_members): Rewrite to use iterator.
11141 (Archive::count_members): New function.
11142 * archive.h (class Archive): Update declarations.
11143 (Archive::filename): New function.
11144 * object.cc: Include "cref.h".
11145 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11146 (Sized_relobj::do_get_global_symbol_counts): New function.
11147 (Input_objects::add_object): Add object to cross-referencer.
11148 (Input_objects::archive_start): New function.
11149 (Input_objects::archive_stop): New function.
11150 (Input_objects::print_symbol_counts): New function.
11151 * object.h: Declare Cref and Archive.
11152 (Object::get_global_symbol_counts): New function.
11153 (Object::do_get_global_symbol_counts): New pure virtual function.
11154 (class Sized_relobj): Add defined_count_ field. Update
11155 declarations.
11156 (class Input_objects): Add cref_ field. Update constructor.
11157 Update declarations.
11158 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11159 defined_count_.
11160 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11161 symbol counts.
11162 (Sized_dynobj::do_get_global_symbol_counts): New function.
11163 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11164 defined_count_. Update declarations. Define Symbols typedef.
11165 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11166 parameter. Change all callers.
11167 (Symbol_table::add_from_dynobj): Add sympointers and defined
11168 parameters. Change all callers.
11169 * symtab.h (class Symbol_table): Update declarations.
11170 * Makefile.am (CCFILES): Add cref.cc.
11171 (HFILES): Add cref.h.
11172 * Makefile.in: Rebuild.
11173
3f7c5e1d
CD
111742008-07-22 Simon Baldwin <simonb@google.com>
11175
11176 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11177 to zero when writing undefined symbols.
11178
e0b64032
ILT
111792008-07-22 Ian Lance Taylor <iant@google.com>
11180
11181 * output.cc (Output_section::add_input_section): Don't try to
11182 merge empty merge sections.
11183
096b02cf
CS
111842008-07-21 Craig Silverstein <csilvers@google.com>
11185
11186 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11187 Include symbol version in error message.
cd536b21 11188
1d1f116d
CD
111892008-07-20 Chris Demetriou <cgd@google.com>
11190
cd536b21 11191 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
11192 (RANDOM_SEED_CFLAGS): New substituted variable.
11193 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11194 * configure: Rebuild.
11195 * Makefile.in: Likewise.
11196 * testsuite/Makefile.in: Likewise.
11197
a18f591e
ILT
111982008-07-18 Ian Lance Taylor <iant@google.com>
11199
11200 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11201 where we see NAME/NULL and NAME/VERSION as separate symbols.
11202 * testsuite/ver_test_main.cc (main): Call t4.
11203 (t4, t4_2a): Define.
11204 * testsuite/ver_test_2.cc (t4_2): Define.
11205 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11206 * testsuite/ver_test_4.cc (t4_2a): Define.
11207 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11208 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11209
c6e3f6ed
ILT
112102008-07-17 Ian Lance Taylor <iant@google.com>
11211
11212 * dynobj.cc (Versions::add_def): If we give an error about a
11213 missing version, go ahead and create the version anyhow.
11214
ef9beddf
ILT
112152008-07-10 Ian Lance Taylor <iant@google.com>
11216
11217 Handle output sections with more than 0x7fffffff bytes.
11218 * object.h (class Relobj): Change map_to_output_ to
11219 output_sections_, and just keep a section pointer. Change all
11220 uses. Move comdat group support to Sized_relobj.
11221 (Relobj::is_section_specially_mapped): Remove.
11222 (Relobj::output_section): Remove poff parameter. Change all
11223 callers.
11224 (Relobj::output_section_offset): New function.
11225 (Relobj::set_section_offset): Rewrite.
11226 (Relobj::map_to_output): Remove.
11227 (Relobj::output_sections): New function.
11228 (Relobj::do_output_section_offset): New pure virtual function.
11229 (Relobj::do_set_section_offset): Likewise.
11230 (class Sized_relobj): Add section_offsets_ field. Add comdat
11231 group support from Relobj. Update declarations.
11232 (Sized_relobj::get_output_section_offset): New function.
11233 (Sized_relobj::do_output_section_offset): New function.
11234 (Sized_relobj::do_set_section_offset): New function.
11235 * object.cc (Relobj::output_section_address): Remove.
11236 (Sized_relobj::Sized_relobj): Initialize new fields.
11237 (Sized_relobj::include_section_group): Cast find_kept_object to
11238 Sized_relobj.
11239 (Sized_relobj::include_linkonce_section): Likewise.
11240 (Sized_relobj::do_layout): Use separate arrays for output section
11241 and output offset.
11242 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11243 output_sections.
11244 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11245 output_sections and section_offsets.
11246 (Sized_relobj::write_local_symbols): Likewise.
11247 (map_to_kept_section): Compute output address directly.
11248 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11249 output_sections and section_offsets.
11250 (Sized_relobj::write_sections): Likewise.
11251 (Sized_relobj::relocate_sections): Likewise.
11252 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11253 * output.h (class Output_reloc): Update declarations. Change
11254 u2_.relobj to Sized_relobj*.
11255 (class Output_data_reloc): Change add functions to use
11256 Sized_relobj*.
11257 * output.cc (Output_reloc::Output_reloc): Change relobj to
11258 Sized_relobj*.
11259 (Output_reloc::local_section_offset): Change return type to
11260 Elf_Addr. Use get_output_section_offset.
11261 (Output_reloc::get_address): Likewise.
11262 (Output_section::is_input_address_mapped): Don't call
11263 is_section_specially_mapped.
11264 (Output_section::output_offset): Likewise.
11265 (Output_section::output_address): Likewise.
11266 (Output_section::starting_output_address): Likewise.
11267 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11268 parameter to Sized_relobj*.
11269 (Copy_relocs::need_copy_reloc): Likewise.
11270 (Copy_relocs::save): Likewise.
11271 * copy-relocs.h (class Copy_relocs): Update declarations.
11272 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11273 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11274 * target-reloc.h (relocate_for_relocatable): Change
11275 offset_in_output_section type to Elf_Addr. Change code that uses
11276 it as well.
11277 * layout.cc (Layout::layout): Always set *off.
11278 * mapfile.cc (Mapfile::print_input_section): Use
11279 output_section_offset.
11280 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11281 Sized_relobj*.
11282 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11283 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11284 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11285
5cb66f97
ILT
112862008-07-03 Ian Lance Taylor <iant@google.com>
11287
11288 * layout.cc (Layout::include_section): Do not discard unrecognized
11289 SHT_STRTAB sections.
11290
afe47622
CS
112912008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11292
11293 * script.cc (Lex::can_continue_name): Make '?' allowable in
11294 version-script names.
11295 * testsuite/version_script.map: Change glob pattern to use '?'
11296
5adf9721
ILT
112972008-06-30 Manish Singh <yosh@gimp.org>
11298
11299 PR 6585
11300 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11301 Correct typo.
11302
e6fde208
ILT
113032008-06-30 Ian Lance Taylor <iant@google.com>
11304
11305 PR 6660
11306 PR 6682
11307 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11308 versions]: Don't try to read the value in the contents, since we
11309 don't use it. Use the template endianness when writing.
11310
3f2e6a2d
CC
113112008-06-25 Cary Coutant <ccoutant@google.com>
11312
11313 * fileread.cc (File_read::make_view): Assert on zero-length view.
11314 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11315 symbol table when there are no symbols to read.
11316
c43d3a48
CS
113172008-06-23 Craig Silverstein <csilvers@google.com>
11318
11319 * version.cc (version_string): Bump to 1.7
11320
5f494ea0
CS
113212008-06-18 Craig Silverstein <csilvers@google.com>
11322
11323 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11324 constant 0xFFFF to type Valtype.
11325 (Powerpc_relocate_functions::rel16_ha): Likewise.
11326
c42e122e
ILT
113272008-06-17 Ian Lance Taylor <iant@google.com>
11328
f34787f8
ILT
11329 * output.h (Output_section::Input_section): Initialize p2align_ to
11330 zero for Output_section_data constructors.
11331 (Output_section::Input_section::addralign): If not an input
11332 section, return the alignment of the Output_section_data.
11333 * testsuite/copy_test.cc: New file.
11334 * testsuite/copy_test_1.cc: New file.
11335 * testsuite/copy_test_2.cc: New file.
11336 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11337 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11338 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11339 (copy_test_1_pic.o, copy_test_1.so): New targets.
11340 (copy_test_2_pic.o, copy_test_2.so): New targets.
11341 * testsuite/Makefile.in: Rebuild.
11342
c42e122e
ILT
11343 * script-sections.cc (Script_sections::place_orphan): Initialize
11344 local variable exact.
11345
ce3ac18a
DE
113462008-06-13 David Edelsohn <edelsohn@gnu.org>
11347
11348 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11349
42cacb20
DE
113502008-06-12 David Edelsohn <edelsohn@gnu.org>
11351 David S. Miller <davem@davemloft.net>
11352
11353 * powerpc.cc: New file.
11354 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11355 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11356 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11357 * Makefile.in: Rebuild.
11358
7b308235
ILT
113592008-06-09 Ian Lance Taylor <iant@google.com>
11360
11361 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11362 <exception>.
11363 (throwing, orig_terminate): New static variables.
11364 (terminate_handler): New static function.
11365 (t2): Set terminate handler.
11366
f0b886e3
ILT
113672008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11368
11369 PR 6584
cd536b21 11370 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
11371 alignment.
11372
3e90f135
CC
113732008-05-30 Cary Coutant <ccoutant@google.com>
11374
11375 * archive.cc (Archive::include_all_members) Correct to step
11376 over symbol table and extended name table in thin archives.
11377
e09ad04a
ILT
113782008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11379
11380 PR 6407
11381 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11382 calculation.
11383
62b01cb5
ILT
113842008-05-28 Caleb Howe <cshowe@google.com>
11385
11386 * reduced_debug_output.cc: New file.
11387 * reduced_debug_output.h: New file.
92de84a6 11388 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
11389 * options.cc (General_options::finalize): Add strip_debug_non_line
11390 to the strip heirarchy.
11391 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11392 fields.
11393 * layout.cc: Include "reduced_debug_output.h".
11394 (Layout::Layout): Initialize new fields.
11395 (line_only_debug_sections): New static array.
11396 (is_lines_only_debug_sections): New static inline function.
11397 (Layout::include_section): Handle --strip-debug-non-line.
11398 (Layout::make_output_section): If --strip-debug-non-line, build
11399 new output sections for .debug_abbrev and .debug_info.
11400 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11401 gold. Warn about possible overflow.
11402 (read_signed_LEB_128): Likewise.
11403 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11404 (read_signed_LEB_128): Declare.
11405 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11406 (HFILES): Add reduced_debug_output.h.
11407 * Makefile.in: Rebuild.
11408
7d9e3d98
ILT
114092008-05-21 Ian Lance Taylor <iant@google.com>
11410
11411 * mapfile.cc: New file.
11412 * mapfile.h: New file.
11413 * options.h (class General_options): Add -M/--print-map and -Map.
11414 * options.cc (General_options::finalize): Make -M equivalent to
11415 -Map -.
11416 * main.cc: Include <cstdio> and "mapfile.h".
11417 (main): Open mapfile if requested.
11418 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11419 constructor. Change caller.
11420 (queue_initial_tasks): Add mapfile parameter. Change caller.
11421 (queue_middle_tasks): Likewise.
11422 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11423 declarations.
11424 * archive.cc: Include "mapfile.h".
11425 (Archive::add_symbols): Add mapfile parameter. Change all
11426 callers. Pass mapfile, symbol, and reason to include_member.
11427 (Archive::include_all_members): Add mapfile parameter. Change all
11428 callers.
11429 (Archive::include_member): Add mapfile, sym, and why parameters.
11430 Change all callers. Report inclusion to map file.
11431 * archive.h: Include "fileread.h".
11432 (class Archive): Update declarations.
11433 (Archive::file): New const method.
11434 (class Add_archive_symbols): Add mapfile_ field. Update
11435 constructor. Change all callers.
11436 * readsyms.h (class Read_symbols): Likewise.
11437 (class Finish_group): Likewise.
11438 (class Read_script): Likewise.
11439 * common.cc: Include "mapfile.h".
11440 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11441 all callers.
11442 (Symbol_table::do_allocate_commons): Likewise.
11443 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11444 symbol allocation to mapfile.
11445 * common.h (class Allocate_commons_task): Add mapfile_ field.
11446 Update constructor. Change all callers.
11447 * symtab.h (class Symbol_table): Update declarations.
11448 * layout.cc: Include "mapfile.h".
11449 (Layout_task_runner::run): Print information to mapfile.
11450 (Layout::create_gold_note): Change Output_data_fixed_space to
11451 Output_data_zero_fill.
11452 (Layout::create_build_id): Likewise.
11453 (Layout::print_to_mapfile): New function.
11454 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11455 constructor. Change caller.
11456 (class Layout): Declare print_to_mapfile.
11457 * output.cc (Output_section::Input_section::print_to_mapfile): New
11458 function.
11459 (Output_section::add_input_section): If producing a map, always
11460 add to input_sections_ list.
11461 (Output_section::do_print_to_mapfile): New function.
11462 (Output_segment::print_sections_to_mapfile): New function.
11463 (Output_segment::print_section_list_to_mapfile): New function.
11464 * output.h: Include "mapfile.h".
11465 (Output_data::print_to_mapfile): New function.
11466 (Output_data::do_print_to_mapfile): New virtual function.
11467 (Output_segment_headers::do_print_to_mapfile): New function.
11468 (Output_file_header::do_print_to_mapfile): New function.
11469 (Output_data_const::do_print_to_mapfile): New function.
11470 (class Output_data_const_buffer): Add map_name_ field. Update
11471 constructor. Change all callers. Add do_print_to_mapfile
11472 function.
11473 (class Output_data_fixed_space): Likewise.
11474 (class Output_data_space): Likewise.
11475 (class Output_data_zero_fill): New class.
11476 (Output_data_strtab::do_print_to_mapfile): New function.
11477 (Output_data_reloc_base::do_print_to_mapfile): New function.
11478 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11479 (Output_data_group::do_print_to_mapfile): New function.
11480 (Output_data_got::do_print_to_mapfile): New function.
11481 (Output_data_dynamic::do_print_to_mapfile): New function.
11482 (Output_symtab_xindex::do_print_to_mapfile): New function.
11483 (class Output_section): Declare do_print_to_mapflie. Declare
11484 print_to_mapfile in Input_section.
11485 (class Output_segment): Declare new functions.
11486 * object.h (Sized_relobj::symbol_count): New function.
11487 * script-sections.cc
11488 (Output_section_element_dot_assignment::set_section_addresses):
11489 Change Output_data_fixed_space to Output_data_zero_fill.
11490 (Output_data_expression::do_print_to_mapfile): New function.
11491 * script.cc (read_input_script): Add mapfile parameter. Change
11492 all callers.
11493 * script.h (read_input_script): Update declaration.
11494 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11495 (Eh_frame::do_print_to_mapfile): New function.
11496 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11497 (Output_merge_string::do_print_to_mapfile): New function.
11498 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11499 function.
11500 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11501 function.
11502 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11503 function.
11504 * Makefile.am (CCFILES): Add mapfile.cc.
11505 (HFILES): Add mapfile.h.
11506 * Makefile.in: Rebuild.
11507
9f1d377b
ILT
115082008-05-19 Ian Lance Taylor <iant@google.com>
11509
11510 * options.h (class General_options): Add -z relro.
11511 * layout.cc (Layout::Layout): Initialize relro_segment_.
11512 (Layout::add_output_section_data): Return the output section.
11513 (Layout::make_output_section): Rcognize relro sections and mark
11514 them appropriately.
11515 (Layout::attach_allocated_section_to_segment): Put relro sections
11516 in a PT_GNU_RELRO segment.
11517 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11518 section as relro.
11519 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11520 PT_TLS segments.
11521 (Layout::linkonce_mapping): Map d.rel.ro.local to
11522 .data.rel.ro.local.
11523 (Layout::output_section_name): Us .data.rel.ro.local for any
11524 section which begins with that.
11525 * layout.h (class Layout): Update add_output_section_data
11526 declaration. Add relro_segment_ field.
11527 * output.cc (Output_section::Output_section): Initialize is_relro_
11528 and is_relro_local_ fields.
11529 (Output_segment::add_output_section): Group relro sections.
11530 (Output_segment::is_first_section_relro): New function.
11531 (Output_segment::maximum_alignment): If there is a relro section,
11532 align the segment to the common page size.
11533 (Output_segment::set_section_addresses): Track whether we are
11534 looking at relro sections. If the last section is a relro
11535 section, align to the common page size.
11536 (Output_segment::set_section_list_addresses): Add in_relro
11537 parameter. Change all callers. Align to the page size when
11538 moving from relro to non-relro section.
11539 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11540 segment.
11541 * output.h (class Output_section): Add is_relro_ and
11542 is_relro_local_ fields.
11543 (Output_section::is_relro): New function.
11544 (Output_section::set_is_relro): New function.
11545 (Output_section::is_relro_local): New function.
11546 (Output_section::set_is_relro_local): New function.
11547 (class Output_segment): Update declarations.
11548 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11549 * sparc.cc (Target_sparc::got_section): Likewise.
11550 * x86_64.cc (Target_x86_64::got_section): Likewise.
11551 * testsuite/relro_test_main.cc: New file.
11552 * testsuite/relro_test.cc: New file.
11553 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11554 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11555 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11556 (relro_test.so, relro_test_pic.o): New targets.
11557 * testsuite/Makefile.in: Rebuild.
11558
a984ee1d
ILT
115592008-05-16 Ian Lance Taylor <iant@google.com>
11560
01676dcd
ILT
11561 * output.cc (Output_segment::add_output_section): Remove front
11562 parameter.
11563 * output.h (class Output_segment): Remove
11564 add_initial_output_section and overloaded add_output_section.
11565 Update declaration of remaining add_output_section.
11566 * layout.cc (Layout::create_interp): Call add_output_section
11567 rather than add_initial_output_section.
11568 (Layout::finish_dynamic_section): Likewise.
11569
497897f9
ILT
11570 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11571 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11572 know the dynamic type.
11573 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11574 field. Initialize it in constructor.
11575 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11576 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11577 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11578 reloc.
11579
a984ee1d
ILT
11580 * output.cc (Output_reloc::get_address): Change return type to
11581 Elf_Addr.
11582 * output.h (class Output_reloc): Update get_address declaration.
11583 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11584 for section addresses.
11585
55ba0940
ILT
115862008-05-09 Ian Lance Taylor <iant@google.com>
11587
11588 PR 6493
11589 * gold.cc (gold_nomem): Use return value of write.
11590
75517b77
ILT
115912008-05-08 Ian Lance Taylor <iant@google.com>
11592
11593 * symtab.c (Symbol::init_base_output_data): Add version
11594 parameter. Change all callers.
11595 (Symbol::init_base_output_segment): Likewise.
11596 (Symbol::init_base_constant): Likewise.
11597 (Symbol::init_base_undefined): Likewise.
11598 (Sized_symbol::init_output_data): Likewise.
11599 (Sized_symbol::init_output_segment): Likewise.
11600 (Sized_symbol::init_constant): Likewise.
11601 (Sized_symbol::init_undefined): Likewise.
11602 (Symbol_table::do_define_in_output_data): If the new symbol has a
11603 version, mark it as the default.
11604 (Symbol_table::do_define_in_output_segment): Likewise.
11605 (Symbol_table::do_define_as_constant): Likewise.
11606 * symtab.h (class Symbol): Update declarations.
11607 (class Sized_symbol): Likewise.
11608 * resolve.cc (Symbol::override_version): New function.
c42e122e 11609 (Symbol::override_base): Call override_version.
75517b77
ILT
11610 (Symbol::override_base_with_special): Likewise.
11611 * testsuite/ver_script_8.script: New file.
11612 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11613 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11614 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11615 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11616
f1f70eae
ILT
116172008-05-06 Ian Lance Taylor <iant@google.com>
11618
f3e9c5c5
ILT
11619 PR 6049
11620 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11621 functions.
11622 (class General_options): Remove existing --undefined, and add
11623 --no-undefined instead. Add new --undefined as synonym for -u.
11624 * archive.cc (Archive::add_symbols): Check whether symbol was
11625 named with -u.
11626 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11627 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11628 all uses. Add IS_UNDEFINED. Update declarations to split
11629 different versions of init_base. Declare init_base_undefined.
11630 (Symbol::is_defined): Handle IS_UNDEFINED.
11631 (Symbol::is_undefined): Likewise.
11632 (Symbol::is_weak_undefined): Call is_undefined.
11633 (Symbol::is_absolute): Handle IS_CONSTANT.
11634 (class Sized_symbol): Update declarations to split different
11635 versions of init. Declare init_undefined.
11636 (class Symbol_table): Declare new functions.
11637 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11638 Change all callers.
11639 (Symbol::init_base_output_data): Likewise.
11640 (Symbol::init_base_output_segment): Likewise.
11641 (Symbol::init_base_constant): Likewise.
11642 (Symbol::init_base_undefined): New function.
11643 (Sized_symbol::init_object): Rename from init. Change all
11644 callers.
11645 (Sized_symbol::init_output_data): Likewise.
11646 (Sized_symbol::init_output_segment): Likewise.
11647 (Sized_symbol::init_constant): Likewise.
11648 (Sized_symbol::init_undefined): New function.
11649 (Symbol_table::add_undefined_symbols_from_command_line): New
11650 function.
11651 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11652 function.
11653 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11654 (Symbol::output_section): Likewise.
11655 (Symbol::set_output_section): Likewise.
11656 (Symbol_table::sized_finalize_symbol): Likewise.
11657 (Symbol_table::sized_write_globals): Likewise.
11658 * resolve.cc (Symbol_table::should_override): Likewise.
11659 (Symbol::override_base_with_special): Likewise.
11660
8bdcdf2c
ILT
11661 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11662 symbol, change it to have default visibility.
11663 * testsuite/protected_1.cc: New file.
11664 * testsuite/protected_2.cc: New file.
11665 * testsuite/protected_3.cc: New file.
11666 * testsuite/protected_main_1.cc: New file.
11667 * testsuite/protected_main_2.cc: New file.
11668 * testsuite/protected_main_3.cc: New file.
11669 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11670 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11671 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11672 (protected_1.so): New target.
11673 (protected_1_pic.o, protected_2_pic.o): New targets.
11674 (protected_3_pic.o): New target.
11675 (check_PROGRAMS): Add protected_2.
11676 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11677 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11678 * testsuite/Makefile.in: Rebuild.
11679
2b706932
ILT
11680 * options.h (DEFINE_var): Add set_user_set_##varname__.
11681 (DEFINE_bool_alias): New macro.
11682 (class General_options): Define -Bstatic using DEFINE_bool_alias
11683 rather than DEFINE_special. Add --undefined as an alias for -z
11684 defs.
11685 * options.cc (General_options::parse_Bstatic): Remove.
11686
d82a5bcc
ILT
11687 * options.h (class General_options): Add --fatal-warnings.
11688 * main.cc (main): Implement --fatal-warnings.
11689 * errors.h (Errors::warning_count): New function.
11690
f1f70eae
ILT
11691 * options.h (class General_options): Add -Bsymbolic-functions.
11692 * symtab.h (Symbol::is_preemptible): Check for
11693 -Bsymbolic-functions.
11694
8825ac63
ILT
116952008-05-05 Ian Lance Taylor <iant@google.com>
11696
d98bc257
ILT
11697 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11698 as noVARNAME rather than no-VARNAME.
11699 (class General_options): Add option -z combreloc.
11700 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11701 get_address.
11702 (Output_reloc::sort_before) [SHT_REL]: New function.
11703 (Output_reloc::sort_before) [SHT_RELA]: New function.
11704 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11705 Sort_relocs_comparison.
11706 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11707 parameter. Change all callers.
11708 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11709 sort_relocs parameter. Change all callers.
11710 * output.cc (Output_reloc::get_address): New function, broken out
11711 of write_rel.
11712 (Output_reloc::write_rel): Call it.
11713 (Output_reloc::compare): New function.
11714 (Output_data_reloc_base::do_write): Optionally sort relocs.
11715
60b2b4e7
ILT
11716 * configure.ac: If targ_extra_obj is set, link it in.
11717 * configure.tgt: Initialize all variables.
11718 (x86_64*): Set targ_extra_obj and targ_extra_size.
11719 * configure: Rebuild.
11720
8825ac63
ILT
11721 * object.cc (Sized_relobj::include_section_group): Adjust section
11722 indexes read from group data. Build vector to pass to
11723 layout_group.
11724 * layout.cc (Layout::layout_group): Add flags and shndxes
11725 parameters. Remove contents parameter. Change caller. Update
11726 explicit instantiations.
11727 * layout.h (class Layout): Update layout_group declaration.
11728 * output.cc (Output_data_group::Output_data_group): Add flags and
11729 input_shndxes parameters. Remove contents parameter. Change
11730 caller.
11731 (Output_data_group::do_write): Change input_sections_ to
11732 input_shndxes_.
11733 * output.h (class Output_data_group): Update constructor
11734 declaration. Rename input_sections_ to input_shndxes_.
11735 * testsuite/many_sections_test.cc: Add template.
11736
e94cf127
CC
117372008-04-30 Cary Coutant <ccoutant@google.com>
11738
4418b2d5
CC
11739 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11740
e94cf127
CC
11741 * layout.cc (Layout::include_section): Refactored check for debug
11742 info section.
11743 (Layout::add_comdat): Add new parameters. Change type
11744 of signature parameter. Add object and shndx to signatures table.
11745 (Layout::find_kept_object): New function.
11746 * layout.h: Include <cstring>.
11747 (Layout::is_debug_info_section): New function.
11748 (Layout::add_comdat): Add new parameters.
11749 (Layout::find_kept_object): New function.
11750 (Layout::Kept_section): New struct.
11751 (Layout::Signatures): Change type of map range.
11752 * object.cc (Relobj::output_section_address): New function.
11753 (Sized_relobj::include_section_group): Add new parameters. Change
11754 calls to Layout::add_comdat. Change to build table of kept comdat
11755 groups and table mapping discarded sections to kept sections.
11756 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11757 (Sized_relobj::do_layout): Change calls to include_section_group and
11758 include_linkonce_section.
11759 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11760 value to zero when section is discarded.
11761 (Sized_relobj::map_to_kept_section): New function.
11762 * object.h (Relobj::output_section_address): New function.
11763 (Relobj::Comdat_group): New type.
11764 (Relobj::find_comdat_group): New function.
11765 (Relobj::Comdat_group_table): New type.
11766 (Relobj::Kept_comdat_section): New type.
11767 (Relobj::Kept_comdat_section_table): New type.
11768 (Relobj::add_comdat_group): New function.
11769 (Relobj::set_kept_comdat_section): New function.
11770 (Relobj::get_kept_comdat_section): New function.
11771 (Relobj::comdat_groups_): New field.
11772 (Relobj::kept_comdat_sections_): New field.
11773 (Symbol_value::input_value): Update comment.
11774 (Sized_relobj::map_to_kept_section) New function.
11775 (Sized_relobj::include_linkonce_section): Add new parameter.
11776 * target-reloc.h (Comdat_behavior): New type.
11777 (get_comdat_behavior): New function.
11778 (relocate_section): Add code to map a discarded section to the
11779 corresponding kept section when applying a relocation.
11780
e4e5049b
CS
117812008-04-30 Craig Silverstein <csilvers@google.com>
11782
11783 * dwarf_reader.cc (next_generation_count): New static var.
11784 (Addr2line_cache_entry): New struct.
11785 (addr2line_cache): New static var.
11786 (Dwarf_line_info::one_addr2line): Added caching.
11787 (Dwarf_line_info::clear_addr2line_cache): New function.
11788 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11789 cache-size parameter.
11790 (Dwarf_line_info::one_addr2line_cache): New function.
11791 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11792 new cache-size argument to one_addr2line(), and clear cache.
11793
d09e9154
CC
117942008-04-28 Cary Coutant <ccoutant@google.com>
11795
11796 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11797 R_386_PC8 relocations.
11798
7ef73768
ILT
117992008-04-23 Ian Lance Taylor <iant@google.com>
11800
55438702
ILT
11801 * object.cc (Sized_relobj::include_section_group): Check for
11802 invalid section group.
11803
c165fb93
ILT
11804 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11805 header size.
11806
7ef73768
ILT
11807 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11808 than read for file header.
11809 * archive.cc (Archive::include_member): Likewise.
11810
6194aaab
L
118112008-04-23 Paolo Bonzini <bonzini@gnu.org>
11812
11813 * aclocal.m4: Regenerate.
11814 * configure: Regenerate.
11815
d491d34e
ILT
118162008-04-19 Ian Lance Taylor <iant@google.com>
11817
5ea2bac6
ILT
11818 * version.cc (version_string): Bump to 1.6.
11819
7bc3e21a
ILT
11820 * testsuite/Makefile.am (many_sections_r_test): New target.
11821 (many_sections_r_test_SOURCES): Remove.
11822 (many_sections_r_test_DEPENDENCIES): Remove.
11823 (many_sections_r_test_LDFLAGS): Remove.
11824 (many_sections_r_test_LDADD): Remove.
11825
7fcd3aa9
ILT
11826 * object.cc (Sized_relobj::do_add_symbols): Always pass
11827 local_symbol_count_ to add_from_relobj.
11828
4c94d6ae
ILT
11829 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11830 every thousand variables.
11831 * testsuite/Makefile.in: Rebuild.
11832
d491d34e
ILT
11833 * object.cc (Xindex::initialize_symtab_xindex): New function.
11834 (Xindex::read_symtab_xindex): New function.
11835 (Xindex::sym_xindex_to_shndx): New function.
11836 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11837 available.
11838 (Sized_relobj::do_initialize_xindex): New function.
11839 (Sized_relobj::do_read_symbols): Adjust section links.
11840 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11841 parameter. Change all callers.
11842 (Sized_relobj::include_section_group): Adjust section links and
11843 symbol section indexes.
11844 (Sized_relobj::do_layout): Adjust section links.
11845 (Sized_relobj::do_count_local_symbols): Adjust section links and
11846 symbol section indexes.
11847 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11848 ordinary and special symbols.
11849 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11850 dynsym_xindex parameters. Change all callers. Adjust section
11851 links. Use SHN_XINDEX when needed.
11852 (Sized_relobj::get_symbol_location_info): Adjust section links.
11853 Don't get fooled by special symbols.
11854 * object.h (class Xindex): Define.
11855 (class Object): Add xindex_ parameter. Declare virtual functoin
11856 do_initialize_xindex.
11857 (Object::adjust_sym_shndx): New function.
11858 (Object::set_xindex): New protected function.
11859 (class Symbol_value): Add is_ordinary_shndx_ field.
11860 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11861 (Symbol_value::value): Assert ordinary section.
11862 (Symbol_value::initialize_input_to_output_map): Likewise.
11863 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11864 Change all callers.
11865 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11866 all callers.
11867 (class Sized_relobj): Update declarations.
11868 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11869 parameter. Change all callers.
11870 (Sized_relobj::adjust_shndx): New function.
11871 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11872 field.
11873 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11874 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11875 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11876 (Sized_dynobj::read_dynsym_section): Adjust section links.
11877 (Sized_dynobj::read_dynamic): Likewise.
11878 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11879 section links.
11880 (Sized_dynobj::do_initialize_xindex): New function.
11881 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11882 do_initialize_xindex.
11883 (Sized_dynobj::adjust_shndx): New function.
11884 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11885 dynsym_xindex_ fields.
11886 (Layout::finalize): Add a call to set_section_indexes before
11887 creating the symtab sections.
11888 (Layout::set_section_indexes): Don't do anything if the section
11889 already has a section index.
11890 (Layout::create_symtab_sections): Add shnum parameter. Change
11891 caller. Create .symtab_shndx section if needed.
11892 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11893 caller.
11894 (Layout::allocated_output_section_count): New function.
11895 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11896 needed.
11897 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11898 fields. Update declarations.
11899 (Layout::symtab_xindex): New function.
11900 (Layout::dynsym_xindex): New function.
11901 (class Write_symbols_task): Add layout_ field.
11902 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11903 Change caller.
11904 * output.cc (Output_section_headers::Output_section_headers): Add
11905 shstrtab_section parameter. Change all callers.
11906 (Output_section_headers::do_sized_write): Store overflow values
11907 for section count and section string table section index in
11908 section header zero.
11909 (Output_file_header::do_sized_write): Check for overflow of
11910 section count and section string table section index.
11911 (Output_symtab_xindex::do_write): New function.
11912 (Output_symtab_xindex::endian_do_write): New function.
11913 * output.h (class Output_section_headers): Add shstrtab_section_.
11914 Update declarations.
11915 (class Output_symtab_xindex): Define.
11916 (Output_section::has_out_shndx): New function.
11917 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11918 field.
11919 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11920 Change all callers.
11921 (Sized_symbol::init): Likewise.
11922 (Symbol::output_section): Check for ordinary symbol.
11923 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11924 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11925 callers.
11926 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11927 Change all callers. Simplify handling of symbols from sections
11928 not included in the link.
11929 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11930 distinction.
11931 (Weak_alias_sorter::operator()): Assert that symbols are
11932 ordinary.
11933 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11934 distinction.
11935 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11936 parameters. Change all callers.
11937 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11938 symbol distinction. Use SHN_XINDEX when needed.
11939 (Symbol_table::write_section_symbol): Add symtab_xindex
11940 parameter. Change all callers.
11941 (Symbol_table::sized_write_section_symbol): Likewise. Use
11942 SHN_XINDEX when needed.
11943 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11944 declarations.
11945 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11946 (Symbol::is_defined): Check is_ordinary.
11947 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11948 (Symbol::is_absolute, Symbol::is_common): Likewise.
11949 (class Sized_symbol): Update declarations.
11950 (class Symbol_table): Update declarations.
11951 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11952 parameters. Change all callers.
11953 (Sized_symbol::override): Likewise.
11954 (Symbol_table::override): Likewise.
11955 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11956 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11957 is_ordinary, and orig_st_shndx parameters. Change all callers.
11958 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11959 to be in an ordinary section.
11960 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11961 object and is_ordinary parameters. Change all callers.
11962 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11963 Change all callers. Don't add undefined or non-ordinary symbols
11964 to reloc_map_.
11965 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11966 Change all callers.
11967 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11968 declarations.
11969 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11970 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11971 (Sized_relobj::relocate_sections): Likewise.
11972 * target-reloc.h (scan_relocs): Adjust section symbol index.
11973 (scan_relocatable_relocs): Likewise.
11974 * i386.cc (Scan::local): Check for ordinary symbols.
11975 * sparc.cc (Scan::local): Likewise.
11976 * x86_64.cc (Scan::local): Likewise.
11977 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11978 to symbol_section_and_value.
11979 * testsuite/many_sections_test.cc: New file.
11980 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11981 (check_PROGRAMS): Add many_sections_test.
11982 (many_sections_test_SOURCES): Define.
11983 (many_sections_test_DEPENDENCIES): Define.
11984 (many_sections_test_LDFLAGS): Define.
11985 (BUILT_SOURCES): Add many_sections_define.h.
11986 (many_sections_define.h): New target.
11987 (BUILT_SOURCES): Add many_sections_check.h.
11988 (many_sections_check.h): New target.
11989 (check_PROGRAMS): Add many_sections_r_test.
11990 (many_sections_r_test_SOURCES): Define.
11991 (many_sections_r_test_DEPENDENCIES): Define.
11992 (many_sections_r_test_LDFLAGS): Define.
11993 (many_sections_r_test_LDADD): Define.
11994 (many_sections_r_test.o): New target.
11995 * testsuite/Makefile.in: Rebuild.
11996
c5818ff1
CC
119972008-04-17 Cary Coutant <ccoutant@google.com>
11998
11999 * errors.cc (Errors::info): New function.
12000 (gold_info): New function.
12001 * errors.h (Errors::info): New function.
12002 * gold.h (gold_info): New function.
12003 * object.cc (Input_objects::add_object): Print trace output.
12004 * options.cc (options::parse_set): New function.
12005 (General_options::parse_wrap): Deleted.
12006 (General_options::General_options): Deleted initializer.
12007 * options.h (options::String_set): New typedef.
12008 (options::parse_set): New function.
12009 (DEFINE_set): New macro.
12010 (General_options::wrap): Changed to use DEFINE_set. Changed
12011 callers of any_wrap_symbols and is_wrap_symbol.
12012 (General_options::trace, General_options::trace_symbol):
12013 New options.
12014 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12015 (General_options::wrap_symbols_): Deleted.
12016 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12017
b5be4a7c
DM
120182008-04-17 David S. Miller <davem@davemloft.net>
12019
12020 * options.cc (General_options::parse_V): New function.
12021 * options.h: Add entries for -V and -Qy.
12022
155a0dd7
ILT
120232008-04-17 Ian Lance Taylor <iant@google.com>
12024
12025 * common.cc (Symbol_table::allocate_commons): Remove options
12026 parameter. Change caller.
12027 (Symbol_table::do_allocate_commons): Remove options parameter.
12028 Change caller. Just call do_allocate_commons_list twice.
12029 (Symbol_table::do_allocate_commons_list): New function, broken out
12030 of do_allocate_commons.
12031 * common.h (class Allocate_commons_task): Remove options_ field.
12032 Update constructor.
12033 * symtab.cc (Symbol_table::Symbol_table): Initialize
12034 tls_commons_.
12035 (Symbol_table::add_from_object): Put TLS common symbols on
12036 tls_commons_ list.
12037 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12038 which are IN_OUTPUT_DATA.
12039 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12040 allocate_commons and do_allocate_commons declarations. Declare
12041 do_allocate_commons_list.
12042 * gold.cc (queue_middle_tasks): Update creation of
12043 Allocate_commons_task to not pass options.
12044 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12045 (TLS_TEST_C_FLAGS): New variable.
12046 (tls_test_c_pic.o): New target.
12047 (tls_test_shared.so): Link in tls_test_c_pic.o.
12048 (tls_test_c_pic_ie.o): New target.
12049 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12050 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12051 (tls_test_c.o): New target.
12052 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12053 (tls_pic_test_LDADD): Likewise.
12054 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12055 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12056 (tls_test_c_gnu2.o): New target.
12057 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12058 tls_test_c_gnu2.o.
12059 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12060 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12061 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12062 * testsuite/tls_test.cc: Include "config.h".
12063 (t_last): Call t11_last.
12064 * testsuite/tls_test.h (t11, t11_last): Declare.
12065 * testsuite/tls_test_c.c: New file.
12066 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12067 * configure.ac: Check for OpenMP support.
12068 * configure, config.in, Makefile.in: Rebuild.
12069 * testsuite/Makefile.in: Rebuild.
12070
edfbb029
CC
120712008-04-16 Cary Coutant <ccoutant@google.com>
12072
12073 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12074 (Target_i386::tls_base_symbol_defined_): New field.
12075 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12076 (Target_i386::Scan::global): Likewise.
12077 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12078 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12079 (Target_x86_64::tls_base_symbol_defined_): New field.
12080 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12081 (Target_x86_64::Scan::global): Likewise.
12082
f3c69fca
CC
120832008-04-16 Cary Coutant <ccoutant@google.com>
12084
12085 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12086 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12087 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12088 building shared libraries.
12089 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12090 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12091 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12092 * testsuite/Makefile.in: Rebuild.
12093 * testsuite/weak_undef.h: New file.
12094 * testsuite/weak_undef_file1.cc: Add extra test cases.
12095 * testsuite/weak_undef_file2.cc: Likewise.
12096 * testsuite/weak_undef_test.cc: Likewise.
12097
7c414435
DM
120982008-04-16 David S. Miller <davem@davemloft.net>
12099
32b769e1
DM
12100 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12101 Add issued_non_pic_error_ field. Declare check_non_pic.
12102 (Target_sparc::Scan::check_non_pic): New function.
12103 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12104 (Target_sparc::Scan::global): Likewise.
12105
11936fb1
DM
12106 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12107 * configure: Rebuild.
12108
7c414435
DM
12109 * options.h (DEFINE_enable): New macro.
12110 (new_dtags): New enable option.
12111 (initfirst, interpose, loadfltr, nodefaultlib,
12112 nodelete, nodlopen, nodump): New -z options.
12113 * layout.cc (Layout:finish_dynamic_section): If new
12114 dtags enabled, emit DT_RUNPATH. Also, emit a
12115 DT_FLAGS_1 containing any specified -z flags.
12116
85c7bf8b
ILT
121172008-04-16 Ian Lance Taylor <iant@google.com>
12118
12c0daef
ILT
12119 * copy-relocs.cc: New file.
12120 * copy-relocs.h: New file.
12121 * reloc.cc: Remove Copy_relocs code.
12122 * reloc.h: Likewise.
12123 * reloc-types.h (struct Reloc_types) [both versions]: Add
12124 get_reloc_addend_noerror.
12125 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12126 variants of add_global which take an addend which must be zero.
12127 * i386.cc: Include "copy-relocs.h".
12128 (class Target_i386): Change type of copy_relocs_ to variable,
12129 update initializer.
12130 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12131 Change all callers.
12132 (Target_i386::do_finalize_sections): Change handling of
12133 copy_relocs_.
12134 * sparc.cc: Include "copy-relocs.h".
12135 (class Target_sparc): Change type of copy_relocs_ to variable,
12136 update initializer.
12137 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12138 Change all callers.
12139 (Target_sparc::do_finalize_sections): Change handling of
12140 copy_relocs_.
12141 * x86_64.cc: Include "copy-relocs.h".
12142 (class Target_x86_64): Change type of copy_relocs_ to variable,
12143 update initializer.
12144 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12145 class. Change all callers.
12146 (Target_x86_64::do_finalize_sections): Change handling of
12147 copy_relocs_.
12148 * Makefile.am (CCFILES): Add copy-relocs.cc.
12149 (HFILES): Add copy-relocs.h.
12150
4f4995b6
ILT
12151 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12152
85c7bf8b
ILT
12153 * testsuite/script_test_4.sh: Permit leading zeroes.
12154
4f2a9edd
ILT
121552008-04-15 Ian Lance Taylor <iant@google.com>
12156
e6188289
ILT
12157 * script-sections.cc (Script_sections::create_segments): Use
12158 header_size_adjustment even when there is enough room for the
12159 headers.
12160 * testsuite/script_test_4.sh: New file.
12161 * testsuite/script_test_4.t: New file.
12162 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12163 (check_DATA): Add script_test_4.stdout.
12164 (MOSTLYCLEANFILES): Likewise.
12165 (script_test_4): New target.
12166 (script_test_4.stdout): New target.
12167 * testsuite/Makefile.in: Rebuild.
12168
4f2a9edd
ILT
12169 * sparc.cc: Add definitions for Output_data_plt_sparc class
12170 constants.
12171
f5314dd5
DM
121722008-04-14 David S. Miller <davem@davemloft.net>
12173
12174 * sparc.cc: New file.
12175 * Makefile.am (TARGETSOURCES): Add sparc.cc
12176 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12177 * configure.tgt: Document targ_extra_size and
12178 targ_extra_big_endian. Add entries for sparc-* and
12179 sparc64-*.
12180 * configure.ac: Handle targ_extra_size and
12181 targ_extra_big_endian.
12182 * Makefile.in: Rebuild.
12183 * configure: Likewise.
12184 * po/POTFILES.in: Likewise.
12185 * po/gold.pot: Likewise.
12186
154e0e9a
ILT
121872008-04-14 Ian Lance Taylor <iant@google.com>
12188
12189 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12190 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12191 in the name/type/flags to section mapping. Don't call
12192 allocate_output_section.
12193 (Layout::choose_output_section): Change parameter from adjust_name
12194 to is_input_section. Don't permit input sections after sections
12195 are attached to segments. Don't call allocate_output_section.
12196 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12197 not write_enable_output_section.
12198 (Layout::make_output_section): Don't push to
12199 unattached_section_list_ nor call attach_to_segment. Call
12200 attach_section_to_segment if sections are attached.
12201 (Layout::attach_sections_to_segments): New function.
12202 (Layout::attach_section_to_segment): New function.
12203 (Layout::attach_allocated_section_to_segment): Rename from
12204 attach_to_segment. Remove flags parameter.
12205 (Layout::allocate_output_section): Remove function.
12206 (Layout::write_enable_output_section): Remove function.
12207 * layout.h (class Layout): Update for above changes. Add new
12208 field sections_are_attached_.
12209 * output.h (Output_section::update_flags_for_input_section): New
12210 function.
12211 * output.cc (Output_section::add_input_section): Call
12212 update_flags_for_input_section.
12213 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12214
009a67a2
CC
122152008-04-11 Cary Coutant <ccoutant@google.com>
12216
12217 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12218 thought unnecessary.
12219 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12220
759b1a24
ILT
122212008-04-11 Ian Lance Taylor <iant@google.com>
12222
12223 * output.h (class Output_section_data): Remove inline definition
12224 of set_addralign.
12225 * output.cc (Output_section_data::set_addralign): New function.
12226
c2b45e22
CC
122272008-04-11 Cary Coutant <ccoutant@google.com>
12228
12229 Add support for TLS descriptors for i386 and x86_64.
12230 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12231 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12232 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12233 GOT_TYPE_TLS_DESC.
12234 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12235 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12236 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12237 relocations.
12238 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12239 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12240 Fix problem with initial-exec relocations.
12241 (Target_i386::Relocate::relocate_tls): Likewise.
12242 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12243 relaxation.
12244 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12245 support for section-plus-offset dynamic table entries.
12246 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12247 (Output_data_dynamic::Dynamic_entry): Add support for
12248 section-plus-offset dynamic table entries.
12249 (Output_data_dynamic::Classification): Likewise.
12250 (Output_data_dynamic::classification_): Renamed offset_.
12251 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12252 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12253 (Target_x86_64::make_plt_section): New function.
12254 (Target_x86_64::reserve_tlsdesc_entries): New function.
12255 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12256 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12257 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12258 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12259 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12260 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12261 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12262 add extra PLT entry for TLS descriptors.
12263 (Output_data_plt_x86_64::got_): New field.
12264 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12265 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12266 fields.
12267 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12268 descriptors.
12269 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12270 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12271 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12272 R_386_TLS_DESC_CALL relocations.
12273 (Target_x86_64::Scan::global): Likewise.
12274 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12275 for TLS descriptors.
12276 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12277 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12278 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12279 GD-to-IE relaxation.
12280 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12281 and TLS_DESCRIPTORS.
12282 * Makefile.in: Rebuild.
12283 * configure: Rebuild.
12284 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12285 (tls_test_shared2.so): New target.
12286 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12287 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12288 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12289 (tls_shared_gd_to_ie_test_LDADD): New variable.
12290 (tls_shared_gnu2_gd_to_ie_test): New target.
12291 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12292 New targets.
12293 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12294 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12295 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12296 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12297 (tls_shared_gnu2_test): New target.
12298 (tls_test_gnu2_shared.so): New target.
12299 (tls_shared_gnu2_test_SOURCES): New variable.
12300 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12301 (tls_shared_gnu2_test_LDFLAGS): New variable.
12302 (tls_shared_gnu2_test_LDADD): New variable.
12303 * testsuite/Makefile.in: Rebuild.
12304 * testsuite/Makefile.
12305
83bfb6b7
ILT
123062008-04-11 Ian Lance Taylor <iant@google.com>
12307
12308 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12309 justsyms.t.
12310 * testsuite/Makefile.in: Rebuild.
12311
12312 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12313 long.
12314 * testsuite/script_test_2.cc (main): Adjust test.
12315
706e1f5e
ILT
123162008-04-11 David S. Miller <davem@davemloft.net>
12317 Ian Lance Taylor <iant@google.com>
12318
12319 * options.h (General_options): Add entries for '-Y' and
12320 '-relax'.
12321 * options.cc (General_options:finalize): If -Y was used, add those
12322 entries to the library path instead of the default "/lib" and
12323 "/usr/lib".
12324
7c98e6bb
DM
123252008-04-11 David S. Miller <davem@davemloft.net>
12326
12327 * testsuite/justsyms.t: Start at 0x100.
12328 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
12329 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12330 long.
12331 * testsuite/script_test_2.cc: Adjust string and section length
12332 checks.
7c98e6bb 12333
99a37bfd
ILT
123342008-04-09 Ian Lance Taylor <iant@google.com>
12335
2cefc357
ILT
12336 PR gold/5996
12337 * script-sections.cc (Sections_element::allocate_to_segment): Add
12338 orphan parameter.
12339 (Output_section_definition::allocate_to_segment): Likewise.
12340 (Orphan_output_section::allocate_to_segment): Likewise.
12341 (Script_sections::attach_sections_using_phdrs_clause): Don't
12342 propagate non-PT_LOAD segments to orphan sections.
12343 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12344 readelf rather than objdump.
12345 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12346 .interp section and PT_INTERP segment are the same size.
12347 * testsuite/Makefile.in: Rebuild.
12348
99a37bfd
ILT
12349 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12350 aliases for symbols defined in the same object.
12351 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12352 (weak_alias_test_SOURCES): New variable.
12353 (weak_alias_test_DEPENDENCIES): New variable.
12354 (weak_alias_test_LDFLAGS): New variable.
12355 (weak_alias_test_LDADD): New variable.
12356 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12357 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12358 (weak_alias_test_3.o): New target.
12359 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12360 * testsuite/weak_alias_test_main.cc: New file.
12361 * testsuite/weak_alias_test_1.cc: New file.
12362 * testsuite/weak_alias_test_2.cc: New file.
12363 * testsuite/weak_alias_test_3.cc: New file.
12364
780e49c5
ILT
123652008-04-08 Ian Lance Taylor <iant@google.com>
12366
cdb0b8f5
ILT
12367 * options.h (class General_options): Add --noinhibit-exec option.
12368 * main.cc (main): Check --noinhibit-exec.
12369
0864d551
ILT
12370 * options.h (class General_options): Define --wrap as a special
12371 option. Add wrap_symbols_ field.
12372 (General_options::any_wrap_symbols): New function.
12373 (General_options::is_wrap_symbol): New function.
12374 * options.cc (General_options::parse_wrap): New function.
12375 (General_options::General_options): Initialize wrap_symbols_.
12376 * symtab.cc (Symbol_table::wrap_symbol): New function.
12377 (Symbol_table::add_from_object): Handle --wrap.
12378 * symtab.h (class Symbol_table): Declare wrap_symbol.
12379 * target.h (Target::wrap_char): New function.
12380 (Target::Target_info): Add wrap_char field.
12381 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12382 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12383 * testsuite/testfile.cc (Target_test::test_target_info):
12384 Likewise.
12385
789aa6de
ILT
12386 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12387 there is one.
12388
2c38906f
ILT
12389 * layout.h (class Layout): Add added_eh_frame_data_ field.
12390 * layout.cc (Layout::Layout): Initialize new field.
12391 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12392 output section until we find a section we merged successfully.
12393 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12394 that the size be non-zero.
12395
780e49c5
ILT
12396 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12397 qualifier.
12398
7fcd0256
ILT
123992008-04-08 Craig Silverstein <csilvers@google.com>
12400
12401 * configure.ac: Export new conditional variable HAVE_ZLIB.
12402 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12403 on HAVE_ZLIB.
12404 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12405 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12406
6835af53
ILT
124072008-04-07 Ian Lance Taylor <iant@google.com>
12408
e24f324c
ILT
12409 * version.cc (version_string): Set to "1.5".
12410
a036edd8
ILT
12411 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12412 Add issued_non_pic_error_ field. Declare check_non_pic.
12413 (Target_x86_64::Scan::check_non_pic): New function.
12414 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12415 (Target_x86_64::Scan::global): Likewise.
12416
624f8810
ILT
12417 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12418 addend parameter. Change caller. Handle merge sections.
12419 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12420 Address to Addend. Don't add in the result of
12421 local_section_offset, pass down the addend and use the returned
12422 value.
12423 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12424 Update declarations of local_section_offset and symbol_value.
12425 * testsuite/two_file_test_1.cc (t18): New function.
12426 * testsuite/two_file_test_2.cc (f18): New function.
12427 * testsuite/two_file_test_main.cc (main): Call t18.
12428 * testsuite/two_file_test.h (t18, f18): Declare.
12429
6835af53
ILT
12430 * configure.ac: Don't test for objdump, c++filt, or readelf.
12431 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12432 conditionals.
12433 (TEST_READELF): New variable.
12434 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12435 (check_PROGRAMS): Add two_file_strip_test.
12436 (two_file_strip_test): New target.
12437 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12438 (two_file_same_shared_strip_test_SOURCES): New variable.
12439 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12440 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12441 (two_file_same_shared_strip_test_LDADD): New variable.
12442 (two_file_shared_strip.so): New target.
12443 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12444 (ver_test_5.syms, ver_test_7.syms): Likewise.
12445 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12446 (strip_test_3.stdout): Use TEST_OBJDUMP.
12447 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12448
86925eef
CC
124492008-04-04 Cary Coutant <ccoutant@google.com>
12450
12451 * symtab.h (Symbol::is_weak_undefined): New function.
12452 (Symbol::is_strong_undefined): New function.
12453 (Symbol::is_absolute): New function.
12454 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12455 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12456 absolute symbols.
12457 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12458 (weak_undef_test): New target.
12459 * testsuite/Makefile.in: Rebuild.
12460 * testsuite/weak_undef_file1.cc: New file.
12461 * testsuite/weak_undef_file2.cc: New file.
12462 * testsuite/weak_undef_test.cc: New file.
12463
126f3ece
ILT
124642008-04-03 Craig Silverstein <csilvers@google.com>
12465
12466 * compressed_output.h (class Output_compressed_section): Use
12467 unsigned buffer.
12468 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12469 add zlib header.
12470 (zlib_compressed_suffix): Removed.
12471 (Output_compressed_section::set_final_data_size): Use unsigned
12472 buffers.
12473 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12474 Fix linker invocation.
12475 (flagstest_o_specialfile_and_compress_debug_sections):
12476 Likewise.
12477 * testsuite/Makefile.in: Regenerated.
12478
deae2a14
DM
124792008-04-02 David S. Miller <davem@davemloft.net>
12480
12481 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12482 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12483
70752818
ILT
124842008-04-02 Craig Silverstein <csilvers@google.com>
12485
12486 * TODO: New file.
12487
39d0cb0e
ILT
124882008-04-02 Ian Lance Taylor <iant@google.com>
12489
12490 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12491 parameters. Update for new key type to views_. Change all
12492 callers.
12493 (File_read::read): Adjust for byteshift in returned view.
12494 (File_read::add_view): New function, broken out of
12495 find_and_make_view.
12496 (File_read::make_view): New function, broken out of
12497 find_and_make_view.
12498 (File_read::find_or_make_view): Add offset and aligned
12499 parameters. Rewrite accordingly. Change all callers.
12500 (File_read::get_view): Add offset and aligned parameters. Adjust
12501 for byteshift in return value.
12502 (File_read::get_lasting_view): Likewise.
12503 * fileread.h (class File_read): Update declarations.
12504 (class File_read::View): Add byteshift_ field. Add byteshift to
12505 constructor. Add byteshift method.
12506 * archive.h (Archive::clear_uncached_views): New function.
12507 (Archive::get_view): Add aligned parameter. Change all callers.
12508 * object.h (Object::get_view): Add aligned parameter. Change all
12509 callers.
12510 (Object::get_lasting_view): Likewise.
12511
12512 * fileread.cc (File_read::release): Don't call clear_views if
12513 there are multiple objects.
12514 * fileread.h (File_read::clear_uncached_views): New function.
12515 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12516 on the archive.
12517
a1207466
CC
125182008-03-31 Cary Coutant <ccoutant@google.com>
12519
12520 Add thin archive support.
12521 * archive.cc (Archive::armagt): New const.
12522 (Archive::setup): Remove task parameter and calls to unlock.
12523 (Archive::unlock_nested_archives): New function.
12524 (Archive::read_header): Add nested_off parameter. Change
12525 all callers.
12526 (Archive::interpret_header): Likewise.
12527 (Archive::include_all_members): Change to handle thin
12528 archives.
12529 (Archive::include_member): Likewise.
12530 * archive.h (Archive::Archive): Add new parameters and
12531 initializers.
12532 (Archive::armagt): New const.
12533 (Archive::setup): Remove task parameter.
12534 (Archive::unlock_nested_archives): New function.
12535 (Archive::read_header): Add nested_off parameter.
12536 (Archive::interpret_header): Likewise.
12537 (Archive::Nested_archive_table): New typedef.
12538 (Archive::is_thin_archive_): New field.
12539 (Archive::nested_archives_): New field.
12540 (Archive::options_): New field.
12541 (Archive::dirpath_): New field.
12542 (Archive::task_): New field.
12543 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12544 for thin archives. Pass additional parameters to
12545 Archive::Archive. Unlock the archive file after calling
12546 Archive::setup.
cd536b21 12547
479f6503
ILT
125482008-03-29 Ian Lance Taylor <iant@google.com>
12549
686c8caf
ILT
12550 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12551 version symbol to be local.
12552 * testsuite/ver_test_4.sh: New file.
12553 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12554 (check_DATA): Add ver_test_4.syms.
12555 (ver_test_4.syms): New target.
12556 * testsuite/Makefile.in: Rebuild.
12557
ab794b6b
ILT
12558 * output.cc
12559 (Output_section::Input_section_sort_entry::has_priority): New
12560 function.
12561 (Output_section::Input_section_sort_entry::match_file_name): New
12562 function.
12563 (Output_section::Input_section_sort_entry::match_section_name):
12564 Remove.
12565 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12566 Remove.
12567 (Output_section::Input_section_sort_entry::match_section_file):
12568 Remove.
12569 (Output_section::Input_section_sort_compare::operator()): Rewrite
12570 using new Input_section_sort_entry functions. Sort crtbegin and
12571 crtend first. Sort sections with no priority before sections with
12572 a priority.
12573 * testsuite/initpri1.c (d3): Check j != 4.
12574 (cd5): New constructor/destructor function.
12575 (main): Check j != 2.
12576
479f6503
ILT
12577 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12578 new symbol when resolving, don't call set_is_default.
12579 * testsuite/ver_test_7.cc: New file.
12580 * testsuite/ver_test_7.sh: New file.
12581 * testsuite/Makefile.am (ver_test_7.so): New target.
12582 (ver_test_7.o): New target.
12583 (check_SCRIPTS): Add ver_test_7.sh.
12584 (check_DATA): Add ver_test_7.syms.
12585 (ver_test_7.syms): New target.
12586
2fd32231
ILT
125872008-03-28 Ian Lance Taylor <iant@google.com>
12588
12589 * layout.cc (Layout::layout): If we see an input section with a
12590 name that needs sorting, set the must_sort flag for the output
12591 section.
12592 (Layout::make_output_section): If the name of the output section
12593 indicates that it might require sorting, set the may_sort flag.
12594 * output.h (Output_section::may_sort_attached_input_sections): New
12595 function.
12596 (Output_section::set_may_sort_attached_input_sections): New
12597 function.
12598 (Output_section::must_sort_attached_input_sections): New
12599 function.
12600 (Output_section::set_must_sort_attached_input_sections): New
12601 function.
12602 (class Output_section): Declare Input_section_sort_entry. Define
12603 Input_section_sort_compare. Declare
12604 sort_attached_input_sections. Add new fields:
12605 may_sort_attached_input_sections_,
12606 must_sort_attached_input_sections_,
12607 attached_input_sections_are_sorted_.
12608 * output.cc (Output_section::Output_section): Initialize new
12609 fields.
12610 (Output_section::add_input_section): Add an entry to
12611 input_sections_ if may_sort or must_sort are true.
12612 (Output_section::set_final_data_size): Call
12613 sort_attached_input_sections if necessary.
12614 (Output_section::Input_section_sort_entry): Define new class.
12615 (Output_section::Input_section_sort_compare::operator()): New
12616 function.
12617 (Output_section::sort_attached_input_sections): New function.
12618 * configure.ac: Check whether the compiler supports constructor
12619 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12620 * testsuite/initpri1.c: New file.
12621 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12622 CONSTRUCTOR_PRIORITY.
12623 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12624 (initpri1_LDFLAGS): New variable.
12625 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12626
18e6b24e
ILT
126272008-03-27 Ian Lance Taylor <iant@google.com>
12628
49bdd526
ILT
12629 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12630 * testsuite/common_test_1.c: New file.
12631 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12632 (common_test_1_SOURCES): New variable.
12633 (common_test_1_DEPENDENCIES): New variable.
12634 (common_test_1_LDFLAGS): New variable.
12635
18e6b24e
ILT
12636 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12637 and commons_ correctly when NAME/VERSION does not override
12638 NAME/NULL.
12639 * testsuite/ver_test_6.c: New file.
12640 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12641 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12642 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12643
04bf7072
ILT
126442008-03-26 Ian Lance Taylor <iant@google.com>
12645
5871526f
ILT
12646 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12647 of an undefined symbol from a version script.
12648 * testsuite/Makefile.am (ver_test_5.so): New target.
12649 (ver_test_5.o): New target.
12650 (check_SCRIPTS): Add ver_test_5.sh.
12651 (check_DATA): Add ver_test_5.syms.
12652 (ver_test_5.syms): New target.
12653 * testsuite/ver_test_5.cc: New file.
12654 * testsuite/ver_test_5.script: New file.
12655 * testsuite/ver_test_5.sh: New file.
12656 * Makefile.in, testsuite/Makefile.in: Rebuild.
12657
04bf7072
ILT
12658 PR gold/5986
12659 Fix problems building gold with gcc 4.3.0.
12660 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12661 (gold_error_at_location, gold_warning_at_location): Use it.
12662 * configure.ac: Check whether we can compile and use a template
12663 function with a printf attribute.
12664 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12665 when jumping over bytes.
12666 * object.cc: Instantiate Object::read_section_data.
12667 * debug.h: Include <cstring>
12668 * dwarf_reader.cc: Include <algorithm>
12669 * main.cc: Include <cstring>.
12670 * options.cc: Include <cstring>.
12671 * output.cc: Include <cstring>.
12672 * script.cc: Include <cstring>.
12673 * script.h: Include <string>.
12674 * symtab.cc: Include <cstring> and <algorithm>.
12675 * target-select.cc: Include <cstring>.
12676 * version.cc: Include <string>.
12677 * testsuite/testmain.cc: Include <cstdlib>.
12678 * configure, config.in: Rebuild.
12679
874c5b28
ILT
126802008-03-25 Ian Lance Taylor <iant@google.com>
12681
819d6c3a
ILT
12682 * options.cc: Include "../bfd/bfdver.h".
12683 (options::help): Print bug reporting address.
12684
f4b2c6f5
ILT
12685 * version.cc (print_version): Adjust output for current value of
12686 BFD_VERSION_STRING.
12687
12688 * NEWS: New file.
12689
e96caa79
ILT
12690 * options.cc (options::help): Print list of supported targets.
12691 * target-select.h: Include <vector>.
12692 (class Target_selector): Make machine_, size_, and is_big_endian_
12693 fields const. Add bfd_name_ and instantiated_target_ fields.
12694 (Target_selector::Target_selector): Add bfd_name parameter.
12695 (Target_selector::recognize): Make non-virtual, call
12696 do_recognize.
12697 (Target_selector::recognize_by_name): Make non-virtual, call
12698 do_recognize_by_name.
12699 (Target_selector::supported_names): New function.
12700 (Target_selector::bfd_name): New function.
12701 (Target_selector::do_instantiate_target): New pure virtual
12702 function.
12703 (Target_selector::do_recognize): New virtual function.
12704 (Target_selector::do_recognize_by_name): New virtual function.
12705 (Target_selector::instantiate_target): New private function.
12706 (supported_target_names): Declare.
12707 * target-select.cc (Target_selector::Target_selector): Update for
12708 new parameter and fields.
12709 (select_target_by_name): Check that the name matches before
12710 calling recognize_by_name.
12711 (supported_target_names): New function.
12712 * i386.cc (class Target_selector_i386): Update Target_selector
12713 constructor call. Remove recognize and recognize_by_name. Add
12714 do_instantiate_target.
12715 * x86_64.cc (class Target_selector_x86_64): Likewise.
12716 * testsuite/testfile.cc (class Target_selector_test): Update for
12717 changes to Target_selector.
12718
874c5b28
ILT
12719 * README: Rewrite, with some notes on unsupported features.
12720
0a65a3a7
CC
127212008-03-24 Cary Coutant <ccoutant@google.com>
12722
12723 * i386.cc (Target_i386::Got_type): New enum declaration.
12724 (Target_i386::Scan::local): Updated callers of Output_data_got
12725 member functions.
12726 (Target_i386::Scan::global): Likewise.
12727 (Target_i386::Relocate::relocate): Likewise.
12728 (Target_i386::Relocate::relocate_tls): Likewise.
12729 * object.h (Got_offset_list): New class.
12730 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12731 (Sized_relobj::local_got_offset): Likewise.
12732 (Sized_relobj::set_local_got_offset): Likewise.
12733 (Sized_relobj::local_has_tls_got_offset): Removed.
12734 (Sized_relobj::local_tls_got_offset): Removed.
12735 (Sized_relobj::set_local_tls_got_offset): Removed.
12736 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12737 * output.cc (Output_data_got::add_global): Added got_type parameter.
12738 (Output_data_got::add_global_with_rel): Likewise.
12739 (Output_data_got::add_global_with_rela): Likewise.
12740 (Output_data_got::add_global_pair_with_rel): New function.
12741 (Output_data_got::add_global_pair_with_rela): New function.
12742 (Output_data_got::add_local): Added got_type parameter.
12743 (Output_data_got::add_local_with_rel): Likewise.
12744 (Output_data_got::add_local_with_rela): Likewise.
12745 (Output_data_got::add_local_pair_with_rel): New function.
12746 (Output_data_got::add_local_pair_with_rela): New function.
12747 (Output_data_got::add_global_tls): Removed.
12748 (Output_data_got::add_global_tls_with_rel): Removed.
12749 (Output_data_got::add_global_tls_with_rela): Removed.
12750 (Output_data_got::add_local_tls): Removed.
12751 (Output_data_got::add_local_tls_with_rel): Removed.
12752 (Output_data_got::add_local_tls_with_rela): Removed.
12753 * output.h (Output_data_got::add_global): Added got_type parameter.
12754 (Output_data_got::add_global_with_rel): Likewise.
12755 (Output_data_got::add_global_with_rela): Likewise.
12756 (Output_data_got::add_global_pair_with_rel): New function.
12757 (Output_data_got::add_global_pair_with_rela): New function.
12758 (Output_data_got::add_local): Added got_type parameter.
12759 (Output_data_got::add_local_with_rel): Likewise.
12760 (Output_data_got::add_local_with_rela): Likewise.
12761 (Output_data_got::add_local_pair_with_rel): New function.
12762 (Output_data_got::add_local_pair_with_rela): New function.
12763 (Output_data_got::add_global_tls): Removed.
12764 (Output_data_got::add_global_tls_with_rel): Removed.
12765 (Output_data_got::add_global_tls_with_rela): Removed.
12766 (Output_data_got::add_local_tls): Removed.
12767 (Output_data_got::add_local_tls_with_rel): Removed.
12768 (Output_data_got::add_local_tls_with_rela): Removed.
12769 * resolve.cc (Symbol::override_base_with_special): Removed
12770 reference to has_got_offset_ field.
12771 * symtab.cc (Symbol::init_fields): Replaced initialization
12772 of got_offset_ with got_offsets_. Removed initialization
12773 of has_got_offset_
53fcba31 12774 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
12775 (Symbol::got_offset): Likewise.
12776 (Symbol::set_got_offset): Likewise.
12777 (Symbol::has_tls_got_offset): Removed.
12778 (Symbol::tls_got_offset): Removed.
12779 (Symbol::set_tls_got_offset): Removed.
12780 (Symbol::got_offset_): Removed.
12781 (Symbol::tls_mod_got_offset_): Removed.
12782 (Symbol::tls_pair_got_offset_): Removed.
12783 (Symbol::got_offsets_): New field.
12784 (Symbol::has_got_offset): Removed.
12785 (Symbol::has_tls_mod_got_offset): Removed.
12786 (Symbol::has_tls_pair_got_offset): Removed.
12787 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12788 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12789 member functions.
12790 (Target_x86_64::Scan::global): Likewise.
12791 (Target_x86_64::Relocate::relocate): Likewise.
12792 (Target_x86_64::Relocate::relocate_tls): Likewise.
12793
bd52eafb
BE
127942008-03-25 Ben Elliston <bje@au.ibm.com>
12795
12796 * yyscript.y: Fix spelling error in comment.
12797
8b105e34
ILT
127982008-03-24 Ian Lance Taylor <iant@google.com>
12799
8ed814a9
ILT
12800 * options.h (class General_options): Define build_id option.
12801 * layout.h (class Layout): Declare write_build_id, create_note,
12802 create_build_id. Add build_id_note_ member.
12803 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12804 "libiberty.h", "md5.h", "sha1.h".
12805 (Layout::Layout): Initialize eh_frame_data_,
12806 eh_frame_hdr_section_, and build_id_note_.
12807 (Layout::finalize): Call create_build_id.
12808 (Layout::create_note): New function, broken out of
12809 Layout::create_gold_note.
12810 (Layout::create_gold_note): Call create_note.
12811 (Layout::create_build_id): New function.
12812 (Layout::write_build_id): New function.
12813 (Close_task_runner::run): Call write_build_id.
12814
8b105e34
ILT
12815 * x86_64.cc: Correct license to GPLv3.
12816
086a1841
ILT
128172008-03-23 Ian Lance Taylor <iant@google.com>
12818
12819 * options.cc: Include "demangle.h".
12820 (parse_optional_string): New function.
12821 (parse_long_option): Handle takes_optional_argument.
12822 (parse_short_option): Update dash_z initializer. Handle
12823 takes_optional_argument.
12824 (General_options::General_options): Initialize do_demangle_.
12825 (General_options::finalize): Set do_demangle_. Handle demangling
12826 style.
12827 * options.h (parse_optional_string): Declare.
12828 (struct One_option): Add optional_arg field. Update constructor.
12829 Update call constructor calls. Add takes_optional_argument
12830 function.
12831 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12832 (DEFINE_optional_string): Define.
12833 (General_options::demangle): Change from DEFINE_bool to
12834 DEFINE_optional_string.
12835 (General_options::no_demangle): New function.
12836 (General_options::do_demangle): New function.
12837 (General_options::set_do_demangle): New function.
12838 (General_options::execstack_status_): Move definition to end of
12839 class definition.
12840 (General_options::static_): Likewise.
12841 (General_options::do_demangle_): New field.
12842 * object.cc (big_endian>::get_symbol_location_info): Call
12843 Options::do_demangle, not Options::demangle.
12844 * symtab.cc (demangle): Likewise.
12845
cbb93e63
ILT
128462008-03-22 Ian Lance Taylor <iant@google.com>
12847
12848 * gold.h: Include <cstddef> and <sys/types.h>
12849 * options.h: Include <cstring>.
12850
ec531623
ILT
128512008-03-21 Ian Lance Taylor <iant@google.com>
12852
12853 * Added source code to GNU binutils.
This page took 0.74538 seconds and 4 git commands to generate.