[Ada] processId: Do not modify already encoded IDs
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
7b5de7ee
CC
12012-02-16 Cary Coutant <ccoutant@google.com>
2
3 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4 * testsuite/Makefile.in: Regenerate.
5
f9fa4a63
CC
62012-02-14 Cary Coutant <ccoutant@google.com>
7
8 * options.cc (General_options::finalize): Disallow -pie and -static.
9
2c175ebc
DK
102012-02-03 Doug Kwan <dougkwan@google.com>
11
12 * arm.cc (Arm_relocate_functions::abs8,
13 Arm_relocate_functions::abs16): Use
14 Bits::has_signed_unsigned_overflow32.
15 (Arm_relocate_functions::thm_abs8): Correct range of
16 overflow check.
17 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
18 in assertions.
19
90cff06f
DK
202012-02-02 Doug Kwan <dougkwan@google.com>
21
22 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
23 position independent outputs, not just shared objects.
24
63887f3d
L
252012-01-30 H.J. Lu <hongjiu.lu@intel.com>
26
27 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
28 * configure: Regenerated.
29
bef2b434
ILT
302012-01-27 Ian Lance Taylor <iant@google.com>
31
32 * reloc.h (Bits): New class with static functions, copied from
33 namespace utils in arm.cc.
34 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
35 instead.
36
c335b55d
L
372012-01-27 H.J. Lu <hongjiu.lu@intel.com>
38
39 * incremental.cc (write_info_blocks): Correct relocation offset.
40
41194d9f
L
412012-01-27 H.J. Lu <hongjiu.lu@intel.com>
42
43 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
44 (Relocate::tls_gd_to_le): Likewise.
45
1bae613c
L
462012-01-27 H.J. Lu <hongjiu.lu@intel.com>
47
48 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
49
24482ca0
L
502012-01-27 H.J. Lu <hongjiu.lu@intel.com>
51
52 * configure.ac: Check if -mcmodel=medium works.
53 * configure: Regenerated.
54
c2c7840a
CC
552012-01-24 Cary Coutant <ccoutant@google.com>
56
57 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
58 definition and ...
59 (read_unsigned_LEB_128_x): ... this new function.
60 (read_signed_LEB_128): Replaced with inline definition and ...
61 (read_signed_LEB_128_x): ... this new function.
62 * int_encoding.h (read_unsigned_LEB_128_x): New function.
63 (read_unsigned_LEB_128): Add inline definition.
64 (read_signed_LEB_128_x): New function.
65 (read_signed_LEB_128): Add inline definition.
66 * testsuite/Makefile.am (leb128_unittest): New unit test.
67 * testsuite/Makefile.in: Regenerate.
68 * testsuite/leb128_unittest.cc: New unit test.
69
833de760 702012-01-23 Ian Lance Taylor <iant@google.com>
9dee3b3c
ILT
71
72 PR gold/13617
73 * i386.cc (Target_i386::do_code_fill): When using a jmp
74 instruction, pad with nop instructions.
75 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
76
618d6666
L
772012-01-22 H.J. Lu <hongjiu.lu@intel.com>
78
79 * x86_64.cc (gc_process_relocs): Add typename on types used in
80 template.
81 (scan_relocs): Likewise.
82 (relocate_section): Likewise.
83 (apply_relocation): Likewise.
84
3660ff06
L
852012-01-10 H.J. Lu <hongjiu.lu@intel.com>
86
87 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
88 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
89 under x32.
90
fc51264f
L
912012-01-09 H.J. Lu <hongjiu.lu@intel.com>
92
93 * x86_64.cc: Initial support for x32.
94
dd74ae06
CC
952012-01-03 Cary Coutant <ccoutant@google.com>
96
97 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
98 Use abstract base class for GOT.
99 * gold/output.h (class Output_data_got_base): New abstract base class.
100 (class Output_data_got): Derive from new base class, adjust ctors.
101 (Output_data_got::reserve_slot): Make virtual; rename to
102 do_reserve_slot; Adjust callers.
103 * gold/target.h (Sized_target::init_got_plt_for_update): Return
104 pointer to abstract base class.
105 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
106
83896202
ILT
1072011-12-18 Ian Lance Taylor <iant@google.com>
108
109 * object.h (Relobj::local_symbol_value): New function.
110 (Relobj::local_plt_offset): New function.
111 (Relobj::local_has_got_offset): New function.
112 (Relobj::local_got_offset): New function.
113 (Relobj::set_local_got_offset): New function.
114 (Relobj::do_local_symbol_value): New pure virtual function.
115 (Relobj::do_local_plt_offset): Likewise.
116 (Relobj::do_local_has_got_offset): Likewise.
117 (Relobj::do_local_got_offset): Likewise.
118 (Relobj::do_set_local_got_offset): Likewise.
119 (Sized_relobj::do_local_has_got_offset): Rename from
120 local_has_got_offset.
121 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
122 (Sized_relobj::do_set_local_got_offset): Rename from
123 set_local_got_offset.
124 (Sized_relobj_file::do_local_plt_offset): Rename from
125 local_plt_offset.
126 (Sized_relobj_file::do_local_symbol_value): New function.
127 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
128 local_plt_offset.
129 * output.cc (Output_data_got::Got_entry::write): Change object to
130 Relobj. Use local_symbol_value.
131 (Output_data_got::add_global_with_rel): Change rel_dyn to
132 Output_data_reloc_generic*. Use add_global_generic.
133 (Output_data_got::add_global_with_rela): Remove. Change all
134 callers to use add_global_with_rel.
135 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
136 Output_data_reloc_generic*. Use add_global_generic.
137 (Output_data_got::add_global_pair_with_rela): Remove. Change all
138 callers to use add_global_pair_with_rel.
139 (Output_data_got::add_local): Change object to Relobj*.
140 (Output_data_got::add_local_plt): Likewise.
141 (Output_data_got::add_local_with_rel): Change object to Relobj*,
142 change rel_dyn to Output_data_reloc_generic*. Use
143 add_local_generic.
144 (Output_data_got::add_local_with_rela): Remove. Change all
145 callers to use all_local_with_rel.
146 (Output_data_got::add_local_pair_with_rel): Change object to
147 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
148 add_output_section_generic.
149 (Output_data_got::add_local_pair_with_rela): Remove. Change all
150 callers to use add_local_pair_with_rel.
151 (Output_data_got::reserve_local): Change object to Relobj*.
152 * output.h: (class Output_data_reloc_generic): Add pure virtual
153 declarations for add_global_generic, add_local_generic,
154 add_output_section_generic.
155 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
156 functions for Output_data_reloc_generic. Update declarations for
157 changes listed in output.cc.
158 (class Output_data_got): Change template parameter to got_size.
159 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
160 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
161 function.
162 (Sized_relobj_incr::do_local_plt_offset): New function.
163 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
164 add_global_generic.
165
76677ad0
CC
1662011-12-17 Cary Coutant <ccoutant@google.com>
167
168 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
169 * resolve.cc (Symbol_table::resolve): Likewise.
170 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
171 arrays.
172 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
173
8b8dd8d5
ILT
1742011-12-16 Ian Lance Taylor <iant@google.com>
175
176 * output.h (Output_data_reloc_generic::add): Only call
177 add_dynamic_reloc if this is a dynamic reloc section.
178
d55525b9
L
1792011-12-15 H.J. Lu <hongjiu.lu@intel.com>
180
181 PR gold/13505
182 * target-reloc.h (apply_relocation): Replace <64, false> with
183 <size, big_endian>.
184
ff81c7c1
NC
1852011-11-25 Nick Clifton <nickc@redhat.com>
186
187 * po/it.po: New Italian translation.
188
628f39be
SA
1892011-11-17 Sterling Augustine <saugustine@google.com>
190
191 * script.cc (script_include_directive): Implement.
192 (read_script_file): New local variables name and search_path. Update
193 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
194 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
195 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
196
98ef3ea4
SA
1972011-11-11 Sterling Augustine <saugustine@google.com>
198
199 * yyscript.y (section_cmd): Add support for INCLUDE directive.
200 (file_or_sections_cmd): Likewise.
201
f4a8b6d7
DK
2022011-11-11 Doug Kwan <dougkwan@google.com>
203
204 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
205 if --just-symbols is given.
206
29ab395d
DK
2072011-11-10 Doug Kwan <dougkwan@google.com>
208
209 PR gold/13362
210 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
211 when processing data relocs.
212 * reloc.h (Relocate_functions::rel_unaligned): New method.
213 (Relocate_functions::pcrel_unaligned): Ditto.
214 (Relocate_functions::rel32_unaligned): Ditto.
215 (Relocate_functions::pcrel32_unaligned): Ditto.
216
2c339f71
DK
2172011-11-09 Doug Kwan <dougkwan@google.com>
218
219 PR gold/13362
220 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
221 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
222 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
223 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
224 (Relocate_functions::rel_unaligned): New.
225 (Relocate_functions::rel32_unaligned): New.
226 * target-reloc.h (relocate_for_relocatable): Add code to handle
227 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
228 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
229 arm_unaligned_reloc_r): New targets.
230 * testsuite/Makefile.in: Regenerate.
231 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
232 linking.
233
3f3cddf1
ILT
2342011-11-02 Ian Lance Taylor <iant@google.com>
235
236 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
237 NATIVE_LINKER.
238 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
239 * options.cc (General_options::finalize): Use library search path
240 from configure script if specified. If not native and no sysroot,
241 only search TOOLLIBDIR.
242 * options.h (Search_directory::Search_directory): Change name to
243 const std::string&.
244 (General_options::add_to_library_path_with_sysroot): Change arg to
245 const std::string&.
246 * configure, Makefile.in, config.in: Rebuild.
247
a8e2273b
ILT
2482011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
249
250 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
251 we are working around the ARM1176 Erratum.
252 * options.h (General_options::fix_arm1176): Add option.
253 * testsuite/Makefile.am: Add testcases, and keep current ones
254 working.
255 * testsuite/Makefile.in: Regenerate.
256 * testsuite/arm_fix_1176.s: New file.
257 * testsuite/arm_fix_1176.sh: Likewise.
258
cd6eab1c
ILT
2592011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
260
261 * arm.cc (Target_arm::Target_arm): Remove initialisation of
262 may_use_blx_.
263 (Target_arm::may_use_blx): Remove method.
264 (Target_arm::set_may_use_blx): Likewise.
265 (Target_arm::may_use_v4t_interworking): New method.
266 (Target_arm::may_use_v5t_interworking): Likewise.
267 (Target_arm::may_use_blx_): Remove member variable.
268 (Arm_relocate_functions::arm_branch_common): Check for v5T
269 interworking.
270 (Arm_relocate_functions::thumb_branch_common): Likewise.
271 (Reloc_stub::stub_type_for_reloc): Likewise.
272 (Target_arm::do_finalize_sections): Correct interworking checks.
273 * testsuite/Makefile.am: Add new tests.
274 * testsuite/Makefile.in: Regenerate.
275 * testsuite/arm_farcall_arm_arm.s: New test.
276 * testsuite/arm_farcall_arm_arm.sh: Likewise.
277 * testsuite/arm_farcall_arm_thumb.s: Likewise.
278 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
279 * testsuite/arm_farcall_thumb_arm.s: Likewise.
280 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
281 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
282 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
283
286adcf4
CC
2842011-10-31 Cary Coutant <ccoutant@google.com>
285
286 PR gold/13023
287 * expression.cc (Expression::eval_with_dot): Add
288 is_section_dot_assignment parameter.
289 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
290 absolute and assigning to dot within a section.
291 * script-sections.cc
292 (Output_section_element_assignment::set_section_addresses): Pass
293 dot_section to set_if_absolute.
294 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
295 as is_section_dot_assignment flag to eval_with_dot.
296 (Output_section_element_dot_assignment::set_section_addresses):
297 Likewise.
298 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
299 parameter. Also set value if relative to dot_section; set the
300 symbol's output_section.
301 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
302 parameter. Adjust all callers.
303 (Expression::eval_maybe_dot): Likewise.
304 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
305 Adjust all callers.
306 * testsuite/script_test_2.t: Test assignment of an absolute value
307 to dot within an output section element.
308
9634ed06
CC
3092011-10-31 Cary Coutant <ccoutant@google.com>
310
311 * options.h (class General_options): Add --[no-]gnu-unique options.
312 * symtab.cc (Symbol_table::sized_write_globals): Convert
313 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
314
de4101c7
CC
3152011-10-31 Cary Coutant <ccoutant@google.com>
316
317 PR gold/13359
318 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
319 unnecessary assertion.
320 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
321
7257cc92
ST
3222011-10-31 Sriraman Tallam <tmsriram@google.com>
323
324 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
325 gc_mark_symbol.
326 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
327 gc_mark_symbol.
328 Change to just keep the section associated with symbol.
329 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
330 they are externally visible and --export-dynamic is turned on.
331 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
332
bfc34b3f
ILT
3332011-10-19 Ian Lance Taylor <iant@google.com>
334
335 PR gold/13163
336 * script-sections.cc
337 (Output_section_element_dot_assignment::needs_output_section): New
338 function.
339
ea0d8c47
ILT
3402011-10-19 Ian Lance Taylor <iant@google.com>
341
342 PR gold/13204
343 * layout.cc (Layout::segment_precedes): Don't assert failure if a
344 --section-start option was seen.
345 * options.h (General_options::any_section_start): New function.
346
abd242a9
DM
3472011-10-18 David S. Miller <davem@davemloft.net>
348
349 PR binutils/13301
350 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
351 member to track relocation locations that have moved during TLS
352 reloc optimizations.
353 (Target_sparc::Relocate::Relocate): Initialize to NULL.
354 (Target_sparc::Relocate::relocate): Adjust view down by 4
355 bytes if it matches reloc_adjust_addr_.
356 (Target_sparc::Relocate::relocate_tls): Always move the
357 __tls_get_addr call delay slot instruction forward 4 bytes when
358 performing relaxation.
359
bab9090f
CC
3602011-10-18 Cary Coutant <ccoutant@google.com>
361
362 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
363 (Output_file::map_no_anonymous): Check for non-zero
364 return code from posix_fallocate.
365
f7c5b166
CC
3662011-10-17 Cary Coutant <ccoutant@google.com>
367
368 PR gold/13245
369 * plugin.cc (is_visible_from_outside): Check for symbols
370 referenced from dynamic objects.
371 * resolve.cc (Symbol_table::resolve): Don't count references
372 from dynamic objects as references from real ELF files.
373 * testsuite/plugin_test_2.sh: Adjust expected result.
374
b490c0bb
CC
3752011-10-17 Cary Coutant <ccoutant@google.com>
376
377 * gold.cc: Include timer.h.
378 (queue_middle_tasks): Stamp time.
379 (queue_final_tasks): Likewise.
380 * main.cc (main): Store timer in parameters. Print timers
381 for each pass.
382 * parameters.cc (Parameters::Parameters): Initialize timer_.
383 (Parameters::set_timer): New function.
384 (set_parameters_timer): New function.
385 * parameters.h (Parameters::set_timer): New function.
386 (Parameters::timer): New function.
387 (Parameters::timer_): New data member.
388 (set_parameters_timer): New function.
389 * timer.cc (Timer::stamp): New function.
390 (Timer::get_pass_time): New function.
391 * timer.h (Timer::stamp): New function.
392 (Timer::get_pass_time): New function.
393 (Timer::pass_times_): New data member.
394
f475cf7b
CC
3952011-10-17 Cary Coutant <ccoutant@google.com>
396
397 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
398 task for members of lib groups.
399
cdd7e244
CC
4002011-10-17 Cary Coutant <ccoutant@google.com>
401
402 PR gold/13288
4f95c8b4 403 * fileread.cc (File_read::find_view): Add assert.
cdd7e244
CC
404 (File_read::make_view): Move bounds check (replace with assert)...
405 (File_read::find_or_make_view): ... to here.
406
dfb45471
CC
4072011-10-12 Cary Coutant <ccoutant@google.com>
408
4f95c8b4 409 * output.cc (Output_file::open_base_file): Handle case where
dfb45471
CC
410 ::read returns less than requested size.
411
53bbcc1b
CC
4122011-10-10 Cary Coutant <ccoutant@google.com>
413
4f95c8b4 414 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
53bbcc1b
CC
415 Initialize defined_count_.
416 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
417 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
418 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
419 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
420 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4f95c8b4 421 * incremental.h (Sized_relobj_incr::defined_count_): New data
53bbcc1b
CC
422 member.
423 (Sized_incr_dynobj::defined_count_): New data member.
4f95c8b4 424 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
53bbcc1b
CC
425 Return zeroes instead of internal error.
426
397b129b
CC
4272011-10-10 Cary Coutant <ccoutant@google.com>
428
429 PR gold/13249
4f95c8b4 430 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
397b129b 431 (Output_reloc::symbol_value): Return PLT offset if flag is set.
4f95c8b4 432 * output.h (class Output_reloc): Add use_plt_offset flag.
397b129b
CC
433 (Output_reloc::type_): Adjust size of bit field.
434 (Output_reloc::use_plt_offset_): New bit field.
435 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
436 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
437 flag. Adjust all callers.
4f95c8b4 438 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
397b129b
CC
439 creating RELATIVE relocations.
440
d5698657
NC
4412011-10-10 Nick Clifton <nickc@redhat.com>
442
443 * po/es.po: Updated Spanish translation.
444 * po/fi.po: Updated Finnish translation.
445
6a59a5c2
DN
4462011-10-03 Diego Novillo <dnovillo@google.com>
447
448 * options.cc (parse_uint): Fix dereference of RETVAL.
449
f0558624
ST
4502011-09-29 Sriraman Tallam <tmsriram@google.com>
451
452 * layout.h (section_order_map_): New member.
453 (get_section_order_map): New member function.
454 * output.cc (Output_section::add_input_section): Check for patterns
455 only when --section-ordering-file is specified.
456 * gold.cc (queue_middle_tasks): Delay updating order of sections till
457 output_sections have been formed.
458 * layout.cc (Layout_Layout): Initialize section_order_map_.
459 * plugin.cc (update_section_order): Store order in order_map. Do not
460 update the order.
461 * testsuite/Makefile.am: Add test case for plugin_final_layout.
462 * testsuite/Makefile.in: Regenerate.
463 * testsuite/plugin_section_order.c: New file.
464 * testsuite/plugin_final_layout.cc: New file.
465 * testsuite/plugin_final_layout.sh: New file.
466
a7dac153
CC
4672011-09-29 Cary Coutant <ccoutant@google.com>
468
4f95c8b4 469 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
a7dac153 470 Check for NULL.
4f95c8b4 471 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
a7dac153
CC
472 symbols during incremental update.
473 (Symbol_table::add_from_dynobj): Likewise.
474
eebd87a5
ILT
4752011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
476 Ian Lance Taylor <iant@google.com>
477
478 * symtab.cc (Symbol_table::define_special_symbol): Always
479 canonicalize version string.
480
403a3331
CC
4812011-09-26 Cary Coutant <ccoutant@google.com>
482
4f95c8b4
CC
483 * gold.cc (queue_initial_tasks): Move option checks ...
484 * options.cc (General_options::finalize): ... to here. Disable
403a3331
CC
485 some options; make others fatal.
486
235061c2
CC
4872011-09-26 Cary Coutant <ccoutant@google.com>
488
489 gcc PR lto/47247
490 * plugin.cc (get_symbols_v2): New function.
491 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
492 (is_referenced_from_outside): New function.
493 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
494 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
495 (get_symbols): Pass version parameter.
496 (get_symbols_v2): New function.
497 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
498 parameter.
499 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
500 (onload): Add LDPT_GET_SYMBOLS_V2.
501 (all_symbols_read_hook): Use get_symbols_v2; check for
502 LDPR_PREVAILING_DEF_IRONLY_EXP.
503 * testsuite/plugin_test_3.sh: Update expected results.
504
dc87f620
ILT
5052011-09-23 Simon Baldwin <simonb@google.com>
506
507 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
508 configuration options.
509 * configure: Regenerate.
510 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
511 * Makefile.in: Regenerate.
512 * testsuite/Makefile.in: Regenerate.
513
a8279f82
ST
5142011-09-19 Sriraman Tallam <tmsriram@google.com>
515
516 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
517
0c9350c8
CC
5182011-09-19 Cary Coutant <ccoutant@google.com>
519
520 * incremental.cc (can_incremental_update): Fix typo in comment.
521 * incremental.h (can_incremental_update): Likewise.
522
aa06ae28
CC
5232011-09-18 Cary Coutant <ccoutant@google.com>
524
525 * incremental.cc (can_incremental_update): New function.
526 * incremental.h (can_incremental_update): New function.
527 * layout.cc (Layout::init_fixed_output_section): Call it.
528 (Layout::make_output_section): Don't allow patch space in .eh_frame.
529 * object.cc (Sized_relobj_file::do_layout): Call
530 can_incremental_update.
531
ebb300b2
CC
5322011-09-13 Cary Coutant <ccoutant@google.com>
533
534 * configure.ac: Check for glibc support for gnu_indirect_function
535 support with static linking, setting automake conditional
536 IFUNC_STATIC.
537 * Makefile.in: Regenerate.
538 * configure: Regenerate.
539
540 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
541 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
542 for IFUNC_STATIC.
543 * testsuite/Makefile.in: Regenerate.
544
1206d0d5
CC
5452011-09-13 Cary Coutant <ccoutant@google.com>
546
547 * incremental.cc (Sized_relobj_incr::do_layout): Call
548 report_comdat_group for kept comdat sections.
549 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
550 * testsuite/Makefile.in: Regenerate.
551 * testsuite/incr_comdat_test_1.cc: New source file.
552 * testsuite/incr_comdat_test_2_v1.cc: New source file.
553 * testsuite/incr_comdat_test_2_v2.cc: New source file.
554 * testsuite/incr_comdat_test_2_v3.cc: New source file.
555
40b29874
ILT
5562011-09-13 Ian Lance Taylor <iant@google.com>
557
558 * object.cc (Sized_relobj_file::do_layout): Remove unused local
559 variable external_symbols_offset.
560
1b045aac
ILT
5612011-09-12 Ian Lance Taylor <iant@google.com>
562
563 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
564 triggered if object has no symbols.
565
24c6c55a
DM
5662011-09-09 David S. Miller <davem@davemloft.net>
567
568 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
569 (Output_fill_debug_line::do_write): Likewise.
570
66570254
CC
5712011-08-29 Cary Coutant <ccoutant@google.com>
572
573 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
574 casts to match formatting specs.
575 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
576
8ea8cd50
CC
5772011-08-26 Cary Coutant <ccoutant@google.com>
578
579 * layout.cc (Free_list::allocate): Provide guarantee of minimum
580 remaining hole size when allocating.
581 (Layout::make_output_section): Set fill methods for debug sections.
582 * layout.h (Free_list::Free_list_node): Move from private to
583 public.
584 (Free_list::set_min_hole_size): New function.
585 (Free_list::begin, Free_list::end): New functions.
586 (Free_list::min_hole_): New data member.
587 * output.cc: Include dwarf.h.
588 (Output_fill_debug_info::do_minimum_hole_size): New function.
589 (Output_fill_debug_info::do_write): New function.
590 (Output_fill_debug_line::do_minimum_hole_size): New function.
591 (Output_fill_debug_line::do_write): New function.
592 (Output_section::Output_section): Initialize new data member.
593 (Output_section::set_final_data_size): Ensure patch space is larger
594 than minimum hole size.
595 (Output_section::do_write): Fill holes in debug sections.
596 * output.h (Output_fill): New class.
597 (Output_fill_debug_info): New class.
598 (Output_fill_debug_line): New class.
599 (Output_section::set_free_space_fill): New function.
600 (Output_section::free_space_fill_): New data member.
601 * testsuite/Makefile.am (incremental_test_3): Add
602 --incremental-patch option.
603 (incremental_test_4): Likewise.
604 (incremental_test_5): Likewise.
605 (incremental_test_6): Likewise.
606 (incremental_copy_test): Likewise.
607 (incremental_common_test_1): Likewise.
608 * testsuite/Makefile.in: Regenerate.
609
7cf80422
NC
6102011-08-26 Nick Clifton <nickc@redhat.com>
611
612 * po/es.po: Updated Spanish translation.
613
c3f7b0e5
CC
6142011-08-01 Cary Coutant <ccoutant@google.com>
615
616 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
617 * gold/testsuite/Makefile.in: Regenerate.
618 * gold/testsuite/justsyms_exec.c: New source file.
619 * gold/testsuite/justsyms_lib.c: New source file.
620
9590bf25
CC
6212011-08-01 Cary Coutant <ccoutant@google.com>
622
623 * layout.cc (Layout::set_segment_offsets): Don't realign text
624 segment if -Ttext was specified.
625 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
626 file type.
627 * object.h (Sized_relobj_file::e_type): New function.
628 (Sized_relobj_file::e_type_): New data member.
629 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
630 base address for ET_EXEC files.
631 * target.cc (Target::do_make_elf_object_implementation): Allow
632 ET_EXEC files with --just-symbols option.
633
dcd8d12e
CC
6342011-07-28 Cary Coutant <ccoutant@google.com>
635
636 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
637 Add thread_number parameter.
638 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
639 * workqueue-threads.cc
640 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
641 current thread if its thread number is greater than desired thread
642 count.
643 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
644 Add thread_number parameter.
645 (Workqueue::should_cancel_thread): Likewise.
646 (Workqueue::find_runnable_or_wait): Pass thread_number to
647 should_cancel_thread.
648 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
649 parameter.
650
804eb480
ST
6512011-07-22 Sriraman Tallam <tmsriram@google.com>
652
653 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
654 only after checking if it cannot be forced local.
655 * symtab.h (is_externally_visible): Check if the symbol is not forced
656 local.
657
f1ddb600
ILT
6582011-07-15 Ian Lance Taylor <iant@google.com>
659
660 * options.h (class General_options): Add --print-output-format.
661 Move -EL next to -EB, for better --help output.
662 * target-select.cc: Include <cstdio>, "options.h", and
663 "parameters.h".
664 (Target_selector::do_target_bfd_name): New function.
665 (print_output_format): New function.
666 * target-select.h (class Target_selector): Update declarations.
667 (Target_selector::target_bfd_name): New function.
668 (print_output_format): Declare.
669 * main.cc: Include "target-select.h".
670 (main): Handle --print-output-format.
671 * gold.cc: Include "target-select.h".
672 (queue_initial_tasks): Handle --print-output-format when there are
673 no input files.
674 * parameters.cc (parameters_force_valid_target): Give a better
675 error message if -EB/-EL does not match target.
676 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
677 function.
678
7d172687
ILT
6792011-07-15 Ian Lance Taylor <iant@google.com>
680
681 * i386.cc (class Output_data_plt_i386): Add layout_ field.
682 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
683 (Output_data_plt_i386::do_write): Write address of .dynamic
684 section to first entry in .got.plt section.
685 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
686 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
687 Initialize layout_.
688 (Output_data_plt_x86_64::do_write): Write address of .dynamic
689 section to first entry in .got.plt section.
690 * layout.h (Layout::dynamic_section): New function.
691
e9552f7e
ST
6922011-07-13 Sriraman Tallam <tmsriram@google.com>
693
694 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
695 to claim_file call.
696 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
697 input_section_position_, and input_section_glob_.
698 (read_layout_from_file): Call function section_ordering_specified.
699 * layout.h (is_section_ordering_specified): New function.
700 (section_ordering_specified): New function.
701 (section_ordering_specified_): New boolean member.
702 * main.cc(main): Call load_plugins after layout object is defined.
703 * output.cc (Output_section::add_input_section): Use
704 function section_ordering_specified to check if section ordering is
705 needed.
706 * output.cc (Output_section::add_relaxed_input_section): Use
707 function section_ordering_specified to check if section ordering is
708 needed.
709 (Output_section::update_section_layout): New function.
710 (Output_section::sort_attached_input_sections): Check if input section
711 must be reordered.
712 * output.h (Output_section::update_section_layout): New function.
713 * plugin.cc (get_section_count): New function.
714 (get_section_type): New function.
715 (get_section_name): New function.
716 (get_section_contents): New function.
717 (update_section_order): New function.
718 (allow_section_ordering): New function.
719 (Plugin::load): Add the new interfaces to the transfer vector.
720 (Plugin_manager::load_plugins): New parameter.
721 (Plugin_manager::all_symbols_read): New parameter.
722 (Plugin_manager::claim_file): New parameter. Save the elf object for
723 unclaimed objects.
724 (Plugin_manager::get_elf_object): New function.
725 (Plugin_manager::get_view): Change to directly use the bool to check
726 if get_view is called from claim_file_hook.
727 * plugin.h (input_objects): New function
728 (Plugin__manager::load_plugins): New parameter.
729 (Plugin_manager::claim_file): New parameter.
730 (Plugin_manager::get_elf_object): New function.
731 (Plugin_manager::in_claim_file_handler): New function.
732 (Plugin_manager::in_claim_file_handler_): New member.
733 (layout): New function.
734 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
735 handler with an extra parameter. Make the elf object before calling
736 claim_file handler.
737 * testsuite/plugin_test.c (get_section_count): New function pointer.
738 (get_section_type): New function pointer.
739 (get_section_name): New function pointer.
740 (get_section_contents): New function pointer.
741 (update_section_order): New function pointer.
742 (allow_section_ordering): New function pointer.
743 (onload): Check if the new interfaces exist.
744
9446efde
ILT
7452011-07-13 Ian Lance Taylor <iant@google.com>
746
747 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
748 relro section.
749 * x86_64.cc (Target_x86_64::got_section): Likewise.
750 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
751 (relro_now_test_SOURCES): New variable.
752 (relro_now_test_DEPENDENCIES): New variable.
753 (relro_now_test_LDFLAGS): New variable.
754 (relro_now_test_LDADD): New variable.
755 (relro_now_test.so): New target.
756 * testsuite/Makefile.in: Rebuild.
757
07aa62f2
ILT
7582011-07-12 Ian Lance Taylor <iant@google.com>
759
760 PR gold/12980
761 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
762 GLOB_DAT relocation rather than a RELATIVE relocation for a
763 protected symbol when creating a shared library.
764 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
765 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
766 * testsuite/protected_main_1.cc (main): Test that protected
767 function has same address.
768
e2153196
ILT
7692011-07-11 Ian Lance Taylor <iant@google.com>
770
771 PR gold/12979
772 * options.h (class General_options): Add -Bgroup.
773 * options.cc (General_options::finalize): If -Bgroup is set,
774 default to --unresolved-symbols=report-all.
775 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
776 * target-reloc.h (issue_undefined_symbol_error): Handle
777 --unresolved-symbols=report-all.
778
6daf5215
ILT
7792011-07-08 Ian Lance Taylor <iant@google.com>
780
781 PR gold/11985
782 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
783 if linker script discards key sections.
784 (Layout::create_dynamic_symtab): Likewise.
785 (Layout::assign_local_dynsym_offsets): Likewise.
786 (Layout::sized_create_version_sections): Likewise.
787 (Layout::create_interp): Likewise.
788 (Layout::finish_dynamic_section): Likewise.
789 (Layout::set_dynamic_symbol_size): Likewise.
790
beabb2c6
ILT
7912011-07-08 Ian Lance Taylor <iant@google.com>
792
793 PR gold/12386
794 * options.h (class General_options): Add --unresolved-symbols.
795 * target-reloc.h (issue_undefined_symbol_error): Check
796 --unresolved-symbols. Add comments.
797
9c16daf1
ILT
7982011-07-08 Ian Lance Taylor <iant@google.com>
799
800 * testsuite/odr_violation2.cc (Ordering::operator()): Make
801 expression more complex.
802
191f1a2d
ILT
8032011-07-08 Ian Lance Taylor <iant@google.com>
804
805 PR gold/11317
806 * target-reloc.h (issue_undefined_symbol_error): New inline
807 function, broken out of relocate_section.
808 (relocate_section): Call issue_undefined_symbol_error.
809 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
810 there is no TLS segment if we are about to issue an undefined
811 symbol error.
812 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
813
62855347
ILT
8142011-07-08 Ian Lance Taylor <iant@google.com>
815
816 PR gold/12279
817 * resolve.cc (Symbol_table::should_override): Add fromtype
818 parameter. Change all callers. Give error when linking together
819 TLS and non-TLS symbol.
820 (Symbol_table::should_override_with_special): Add fromtype
821 parameter. Change all callers.
822 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
823 there is no TLS segment if we have reported some errors.
824 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
825
67181c72
ILT
8262011-07-08 Ian Lance Taylor <iant@google.com>
827
828 PR gold/12372
829 * target.h (Target::plt_address_for_global): New function.
830 (Target::plt_address_for_local): New function.
831 (Target::plt_section_for_global): Remove.
832 (Target::plt_section_for_local): Remove.
833 (Target::do_plt_address_for_global): New virtual function.
834 (Target::do_plt_address_for_local): New virtual function.
835 (Target::do_plt_section_for_global): Remove.
836 (Target::do_plt_section_for_local): Remove.
837 (Target::register_global_plt_entry): Add Symbol_table and Layout
838 parameters.
839 * output.cc (Output_data_got::Got_entry::write): Use
840 plt_address_for_global and plt_address_for_local.
841 * layout.cc (Layout::add_target_dynamic_tags): Use size and
842 address of output section.
843 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
844 got_irelative_, and irelative_count_ fields. Update
845 declarations.
846 (Output_data_plt_i386::has_irelative_section): New function.
847 (Output_data_plt_i386::entry_count): Add irelative_count_.
848 (Output_data_plt_i386::set_final_data_size): Likewise.
849 (class Target_i386): Add got_irelative_ and rel_irelative_
850 fields. Update declarations.
851 (Target_i386::Target_i386): Initialize new fields.
852 (Target_i386::do_plt_address_for_global): New function replacing
853 do_plt_section_for_global.
854 (Target_i386::do_plt_address_for_local): New function replacing
855 do_plt_section_for_local.
856 (Target_i386::got_section): Create got_irelative_.
857 (Target_i386::rel_irelative_section): New function.
858 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
859 fields. Don't define __rel_iplt_{start,end}.
860 (Output_data_plt_i386::add_entry): Add symtab and layout
861 parameters. Change all callers. Use different PLT and GOT for
862 IFUNC symbols.
863 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
864 layout parameters. Change all callers. Use different PLT and
865 GOT.
866 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
867 (Output_data_plt_i386::rel_irelative): New function.
868 (Output_data_plt_i386::address_for_global): New function.
869 (Output_data_plt_i386::address_for_local): New function.
870 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
871 IRELATIVE GOT when changing IFUNC GOT entries.
872 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
873 reloc.
874 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
875 if we didn't create an IRELATIVE GOT.
876 (Target_i386::Relocate::relocate): Use plt_address_for_global and
877 plt_address_for_local.
878 (Target_i386::do_dynsym_value): Use plt_address_for_global.
879 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
880 got_irelative_, and irelative_count_ fields. Update
881 declarations.
882 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
883 Initialize new fields. Remove symtab parameter. Change all
884 callers.
885 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
886 irelative_count_.
887 (Output_data_plt_x86_64::has_irelative_section): New function.
888 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
889 (class Target_x86_64): Add got_irelative_ and rel_irelative_
890 fields. Update declarations.
891 (Target_x86_64::Target_x86_64): Initialize new fields.
892 (Target_x86_64::do_plt_address_for_global): New function replacing
893 do_plt_section_for_global.
894 (Target_x86_64::do_plt_address_for_local): New function replacing
895 do_plt_section_for_local.
896 (Target_x86_64::got_section): Create got_irelative_.
897 (Target_x86_64::rela_irelative_section): New function.
898 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
899 all callers. Don't create __rel_iplt_{start,end}.
900 (Output_data_plt_x86_64::add_entry): Add symtab and layout
901 parameters. Change all callers. Use different PLT and GOT for
902 IFUNC symbols.
903 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
904 layout parameters. Change all callers. Use different PLT and
905 GOT.
906 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
907 parameters. Change all callers. Use different PLT and GOT for
908 IFUNC symbols.
909 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
910 (Output_data_plt_x86_64::rela_irelative): New function.
911 (Output_data_plt_x86_64::address_for_global): New function.
912 (Output_data_plt_x86_64::address_for_local): New function.
913 (Output_data_plt_x86_64::set_final_data_size): Likewise.
914 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
915 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
916 (Target_x86_64::register_global_plt_entry): Add symtab and layout
917 parameters.
918 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
919 reloc.
920 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
921 symbols if we didn't create an IRELATIVE GOT.
922 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
923 plt_address_for_local.
924 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
925 * testsuite/ifuncvar1.c: New test file.
926 * testsuite/ifuncvar2.c: New test file.
927 * testsuite/ifuncvar3.c: New test file.
928 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
929 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
930 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
931 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
932 * testsuite/Makefile.in: Rebuild.
933
33c15b45
CC
9342011-07-07 Cary Coutant <ccoutant@google.com>
935
936 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
937 (two_file_test_1_ndebug.o): Likewise.
938 (two_file_test_1b_ndebug.o): Likewise.
939 (two_file_test_2_ndebug.o): Likewise.
940 (two_file_test_main_ndebug.o): Likewise.
941 (incremental_test_2): Link with no-debug versions.
942
f48b5fb7
CC
9432011-07-06 Cary Coutant <ccoutant@google.com>
944
945 * gold/incremental.cc
946 (Output_section_incremental_inputs::write_info_blocks): Check for
947 hidden and internal symbols.
948
221597a5
CC
9492011-07-06 Cary Coutant <ccoutant@google.com>
950
951 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
952 Check disposition for startup file.
953 (Incremental_inputs::report_command_line): Ignore
954 --incremental-startup-unchanged option.
955 * options.cc (General_options::parse_incremental_startup_unchanged):
956 New function.
957 (General_options::General_options): Initialize new data member.
958 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
959 (General_options): Add --incremental-startup-unchanged option.
960 (General_options::incremental_startup_disposition): New function.
961 (General_options::incremental_startup_disposition_): New data member.
962
e24719f6
CC
9632011-07-06 Cary Coutant <ccoutant@google.com>
964
965 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
966 input file index to Script_info ctor.
967 (Sized_incremental_binary::do_file_has_changed): Find the
968 command-line argument for files named in scripts.
969 * incremental.h (Script_info::Script_info): New ctor
970 with input file index.
971 (Script_info::input_file_index): New function.
972 (Script_info::input_file_index_): New data member.
973 (Incremental_binary::get_library): Add const.
974 (Incremental_binary::get_script_info): Add const.
975 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
976 * testsuite/Makefile.am (incremental_test_5): New test case.
977 (incremental_test_6): New test case.
978 * testsuite/Makefile.in: Regenerate.
979
8f7c81e8
CC
9802011-07-06 Cary Coutant <ccoutant@google.com>
981
982 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
983 debug output when command lines differ.
984
9fbd3822
CC
9852011-07-06 Cary Coutant <ccoutant@google.com>
986
987 * incremental.cc (Incremental_inputs::report_command_line): Ignore
988 --incremental-patch option.
989 * layout.cc (Free_list::allocate): Extend allocation beyond original
990 end if enabled.
991 (Layout::make_output_section): Mark sections that should get
992 patch space.
993 * options.cc (parse_percent): New function.
994 * options.h (parse_percent): New function.
995 (DEFINE_percent): New macro.
996 (General_options): Add --incremental-patch option.
997 * output.cc (Output_section::Output_section): Initialize new data
998 members.
999 (Output_section::add_input_section): Print section name when out
1000 of patch space.
1001 (Output_section::add_output_section_data): Likewise.
1002 (Output_section::set_final_data_size): Add patch space when
1003 doing --incremental-full.
1004 (Output_section::do_reset_address_and_file_offset): Remove patch
1005 space.
1006 (Output_segment::set_section_list_addresses): Print debug output
1007 only if --incremental-update.
1008 * output.h (Output_section::set_is_patch_space_allowed): New function.
1009 (Output_section::is_patch_space_allowed_): New data member.
1010 (Output_section::patch_space_): New data member.
1011 * parameters.cc (Parameters::incremental_full): New function.
1012 * parameters.h (Parameters::incremental_full): New function
1013 * testsuite/Makefile.am (incremental_test_2): Add test for
1014 --incremental-patch option.
1015 * testsuite/Makefile.in: Regenerate.
1016 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1017 (t18): Remove function body.
1018
f6cccc2c
DK
10192011-07-05 Doug Kwan <dougkwan@google.com>
1020
1021 PR gold/12771
1022 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1023 Arm_Address type for relocation result.
1024 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1025 overflow check.
1026 (Arm_relocate_functions::abs32): Use unaligned access.
1027 (Arm_relocate_functions::rel32): Ditto.
1028 (Arm_relocate_functions::prel31): Ditto.
1029 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1030 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1031 static data relocations.
1032 * testsuite/Makefile.in: Regnerate.
1033 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1034
28a13fec
ILT
10352011-07-05 Ian Lance Taylor <iant@google.com>
1036
1037 PR gold/12392
1038 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1039 symbols if necessary.
1040 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1041
24d47b34
ILT
10422011-07-05 Ian Lance Taylor <iant@google.com>
1043
1044 PR gold/12952
1045 * resolve.cc (Symbol::override_base_with_special): Simply override
1046 version with special symbol version, ignoring previous version.
1047
41f9cbbe
ILT
10482011-07-05 Ian Lance Taylor <iant@google.com>
1049
1050 * object.cc (Sized_relobj_file::include_section_group): Add
1051 information to comment about signature location.
1052
886288f1
ILT
10532011-07-02 Ian Lance Taylor <iant@google.com>
1054
1055 PR gold/12957
1056 * options.h (class General_options): Add -f and -F.
1057 * options.cc (General_options::finalize): Fatal error if -f/-F
1058 are used without -shared.
1059 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1060
ae3a6d4f
ILT
10612011-07-02 Ian Lance Taylor <iant@google.com>
1062
1063 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1064
21131061
ILT
10652011-07-01 Ian Lance Taylor <iant@google.com>
1066
1067 PR gold/12525
1068 PR gold/12952
1069 * resolve.cc (Symbol::override_base_with_special): Don't override
1070 the version if the overriding symbol has a different name.
1071 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1072 all callers. If we give an error about an undefined version,
1073 define the base version if necessary.
1074 * dynobj.h (class Versions): Update declaration.
1075 * testsuite/weak_alias_test_5.cc: New file.
1076 * testsuite/weak_alias_test.script: New file.
1077 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1078 and versioned_alias have the right value, and call t2.
1079 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1080 weak_alias_test_5.so.
1081 (weak_alias_test_LDADD): Likewise.
1082 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1083 * testsuite/Makefile.in: Rebuild.
1084
611062c0
ILT
10852011-07-01 Ian Lance Taylor <iant@google.com>
1086
1087 PR gold/12525
1088 * options.h (class General_options): Support -z notext.
1089 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1090 -Wl,-z,notext.
1091 (two_file_shared_nonpic.so): Likewise.
1092 (two_file_shared_mixed.so): Likewise.
1093 (two_file_shared_mixed_1.so): Likewise.
1094 (weak_undef_lib_nonpic.so): Likewise.
1095 (alt/weak_undef_lib_nonpic.so): Likewise.
1096 (tls_test_shared_nonpic.so): Likewise.
1097 * testsuite/Makefile.in: Rebuild.
1098
328c7c2f
ILT
10992011-07-01 Ian Lance Taylor <iant@google.com>
1100
1101 PR gold/12525
1102 * configure.ac: Test whether static linking works, setting
1103 the automake conditional HAVE_STATIC.
1104 * testsuite/Makefile.am: Disable tests using -static if
1105 HAVE_STATIC is not true.
1106 * configure, testsuite/Makefile.in: Rebuild.
1107
02d7cd44
ILT
11082011-07-01 Ian Lance Taylor <iant@google.com>
1109
1110 PR gold/12525
1111 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1112 Assert if we see DW_EH_PE_indirect.
1113 * target.h (Target::ehframe_datarel_base): New function.
1114 (Target::do_ehframe_datarel_base): New target function.
1115 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1116 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1117 function.
1118
07a60597
ILT
11192011-07-01 Ian Lance Taylor <iant@google.com>
1120
1121 PR gold/12571
1122 * options.h (class General_options): Add
1123 --ld-generated-unwind-info.
1124 * ehframe.cc (Fde::write): Add address parameter. Change all
1125 callers. If associated with PLT, fill in address and size.
1126 (Cie::set_output_offset): Only add merge mapping if there is an
1127 object.
1128 (Cie::write): Add address parameter. Change all callers.
1129 (Eh_frame::add_ehframe_for_plt): New function.
1130 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1131 input_offset_ fields into union u_, with new plt field.
1132 (Fde::Fde): Adjust for new union field.
1133 (Fde::Fde) [Output_data version]: New constructor.
1134 (Fde::add_mapping): Only add merge mapping if there is an object.
1135 (class Cie): Update declarations.
1136 (class Eh_frame): Declare add_ehframe_for_plt.
1137 * layout.cc (Layout::layout_eh_frame): Break out code into
1138 make_eh_frame_section, and call it.
1139 (Layout::make_eh_frame_section): New function.
1140 (Layout::add_eh_frame_for_plt): New function.
1141 * layout.h (class Layout): Update declarations.
1142 * merge.cc (Merge_map::add_mapping): Add assertion.
1143 * i386.cc: Include "dwarf.h".
1144 (class Output_data_plt_i386): Make first_plt_entry,
1145 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1146 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1147 and plt_eh_frame_fde.
1148 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1149 boundary. Call add_eh_frame_for_plt if appropriate.
1150 * x86_64.cc: Include "dwarf.h".
1151 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1152 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1153 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1154 and plt_eh_frame_fde.
1155 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1156 appropriate.
1157
14788a3f
ILT
11582011-06-29 Ian Lance Taylor <iant@google.com>
1159
1160 PR gold/12629
1161 * object.cc (Sized_relobj_file::layout_section): Change shdr
1162 parameter to be const.
1163 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1164 out of do_layout.
1165 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1166 appropriate. Call layout_eh_frame_section.
1167 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1168 sections.
1169 * object.h (class Sized_relobj_file): Update declarations.
1170
6c21fce1
ILT
11712011-06-29 Ian Lance Taylor <iant@google.com>
1172
37e41b03 1173 PR gold/12652
6c21fce1
ILT
1174 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1175 modifier.
1176 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1177
4d5e4e62
ILT
11782011-06-29 Ian Lance Taylor <iant@google.com>
1179
1180 PR gold/12675
1181 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1182 SHT_X86_64_UNWIND.
1183 * layout.cc (Layout::layout_eh_frame): Likewise.
1184
886f533a
ILT
11852011-06-29 Ian Lance Taylor <iant@google.com>
1186
1187 PR gold/12695
1188 * layout.cc (Layout::symtab_section_shndx): New function.
1189 * layout.h (class Layout): Declare symtab_section_shndx.
1190 * output.cc (Output_section::write_header): Call it.
1191
f3ae1b28
ILT
11922011-06-29 Ian Lance Taylor <iant@google.com>
1193
1194 PR gold/12818
1195 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1196 symbols which are not used in a relocation.
1197
aecf301f
ILT
11982011-06-28 Ian Lance Taylor <iant@google.com>
1199
1200 PR gold/12898
1201 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1202 script create indistinguishable segments.
1203 (Layout::set_segment_offsets): Use stable_sort when sorting
1204 segments. Pass this to Compare_segments constructor.
1205 * layout.h (class Layout): Make segment_precedes non-static.
1206 (class Compare_segments): Change from struct to class. Add
1207 layout_ field. Add constructor.
1208 * script-sections.cc
1209 (Script_sections::attach_sections_using_phdrs_clause): Rename
1210 local orphan to is_orphan. Don't report failure to put empty
1211 section in segment. On attachment failure, report name of
1212 section, and attach to first PT_LOAD segment.
1213
03ef7571
ILT
12142011-06-28 Ian Lance Taylor <iant@google.com>
1215
1216 PR gold/12934
1217 * target-select.cc (Target_selector::Target_selector): Add
1218 emulation parameter. Change all callers.
1219 (select_target_by_bfd_name): Rename from select_target_by_name.
1220 Change all callers.
1221 (select_target_by_emulation): New function.
1222 (supported_emulation_names): New function.
1223 * target-select.h (class Target_selector): Add emulation_ field.
1224 Update declarations.
1225 (Target_selector::recognize_by_bfd_name): Rename from
1226 recognize_by_name. Change all callers.
1227 (Target_selector::supported_bfd_names): Rename from
1228 supported_names. Change all callers.
1229 (Target_selector::recognize_by_emulation): New function.
1230 (Target_selector::supported_emulations): New function.
1231 (Target_selector::emulation): New function.
1232 (Target_selector::do_recognize_by_bfd_name): Rename from
1233 do_recognize_by_name. Change all callers.
1234 (Target_selector::do_supported_bfd_names): Rename from
1235 do_supported_names. Change all callers.
1236 (Target_selector::do_recognize_by_emulation): New function.
1237 (Target_selector::do_supported_emulations): New function.
1238 (select_target_by_bfd_name): Change name in declaration.
1239 (select_target_by_emulation): Declare.
1240 (supported_emulation_names): Declare.
1241 * parameters.cc (parameters_force_valid_target): Try to find
1242 target based on emulation from -m option.
1243 * options.h (class General_options): Change doc string for -m.
1244 * options.cc (help): Print emulations.
1245 (General_options::parse_V): Likewise.
1246 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1247 Add emulation parameter. Change all callers.
1248
200b2bb9
ILT
12492011-06-28 Ian Lance Taylor <iant@google.com>
1250
1251 * target.h (class Target): Add osabi_ field.
1252 (Target::osabi): New function.
1253 (Target::set_osabi): New function.
1254 (Target::Target): Initialize osabi_.
1255 (Target::do_adjust_elf_header): Make pure virtual.
1256 (Sized_target::do_adjust_elf_header): Declare.
1257 * target.cc (Sized_target::do_adjust_elf_header): New function.
1258 (class Sized_target): Instantiate all versions.
1259 * freebsd.h (class Target_freebsd): Remove.
1260 (Target_selector_freebsd::do_recognize): Call set_osabi on
1261 Target.
1262 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1263 (Target_selector_freebsd::set_osabi): Remove.
1264 * i386.cc (class Target_i386): Inherit from Sized_target rather
1265 than Target_freebsd.
1266 * x86_64.cc (class Target_x86_64): Likewise.
1267
b3ce541e
ILT
12682011-06-28 Ian Lance Taylor <iant@google.com>
1269
1270 * target.h (Target::can_check_for_function_pointers): Rewrite.
1271 Make non-virtual.
1272 (Target::can_icf_inline_merge_sections): Likewise.
1273 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1274 (Target::Target_info): Add can_icf_inline_merge_sections field.
1275 (Target::do_can_check_for_function_pointers): New virtual
1276 function.
1277 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1278 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1279 from can_check_for_function_pointers, move in file.
1280 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1281 section_may_have_icf_unsafe_poineters, move in file.
1282 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1283 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1284 Rename from can_check_for_function_pointers, move in file.
1285 (Target_i386::can_icf_inline_merge_sections): Remove.
1286 (Target_i386::i386_info): Initialize
1287 can_icf_inline_merge_sections.
1288 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1289 Initialize can_icf_inline_merge_sections.
1290 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1291 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1292 Rename from can_check_for_function_pointers, move in file.
1293 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1294 (Target_x86_64::x86_64_info): Initialize
1295 can_icf_inline_merge_sections.
1296 * testsuite/testfile.cc (Target_test::test_target_info):
1297 Likewise.
1298 * icf.cc (get_section_contents): Correct formatting.
1299
6d1c4efb
ILT
13002011-06-27 Ian Lance Taylor <iant@google.com>
1301
1302 * symtab.cc (Symbol::versioned_name): New function.
1303 (Symbol_table::add_to_final_symtab): Use versioned_name when
1304 appropriate.
1305 (Symbol_table::sized_write_symbol): Likewise.
1306 * symtab.h (class Symbol): Declare versioned_name.
1307 * stringpool.h (class Stringpool_template): Add variant of add
1308 which takes a std::basic_string.
1309 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1310 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1311 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1312 (ver_test_12.o): New target.
1313 * testsuite/Makefile.in: Rebuild.
1314
57eb9b50
DK
13152011-06-27 Doug Kwan <dougkwan@google.com>
1316
1317 * arm.cc (Arm_relocate_functions::thm_jump8,
1318 Arm_relocate_functions::thm_jump11): Use a wider signed
1319 type to compute offset.
1320 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1321 arm_thm_jump8.
1322 * testsuite/Makefile.in: Regenerate.
1323 * testsuite/arm_branch_in_range.sh: Check test results of
1324 arm_thm_jump11 and arm_thm_jump8.
1325 * testsuite/arm_thm_jump11.s: New test source file.
1326 * testsuite/arm_thm_jump11.t: New linker script.
1327 * testsuite/arm_thm_jump8.s: New test source file.
1328 * testsuite/arm_thm_jump8.t: New linker script.
1329
487b39df
ILT
13302011-06-24 Ian Lance Taylor <iant@google.com>
1331
1332 * layout.cc: Include "object.h".
1333 (ctors_sections_in_init_array): New static variable.
1334 (Layout::is_ctors_in_init_array): New function.
1335 (Layout::layout): Add entry to ctors_sections_in_init_array if
1336 appropriate.
1337 * layout.h (class Layout): Declare is_ctors_in_init_array.
1338 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1339 is_ctors_reverse_view is set.
1340 (Sized_relobj_file::write_sections): Add layout parameter. Change
1341 all callers. Set is_ctors_reverse_view field of View_size.
1342 (Sized_relobj_file::reverse_words): New function.
1343 * object.h (Sized_relobj_file::View_size): Add
1344 is_ctors_reverse_view field.
1345 (class Sized_relobj_file): Update declarations.
1346 * testsuite/initpri3.c: New test.
1347 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1348 initpri3b.
1349 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1350 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1351 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1352 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1353 * testsuite/Makefile.in: Rebuild.
1354
472076e4
CC
13552011-06-24 Cary Coutant <ccoutant@google.com>
1356
1357 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1358 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1359 (debug_msg_cdebug.err): New targets.
1360 * testsuite/Makefile.in: Regenerate.
1361 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1362 Fix checks for link with shared library.
1363
a60af0db
DK
13642011-06-24 Doug Kwan <dougkwan@google.com>
1365
1366 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1367 skip empty text sections.
1368 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1369
5393d741
ILT
13702011-06-22 Ian Lance Taylor <iant@google.com>
1371
1372 PR gold/12910
1373 * options.h (class General_options): Add --ctors-in-init-array.
1374 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1375 friends as SHT_PROGBITS for merging sections.
1376 (Layout::layout): Remove special handling of .init_array and
1377 friends. Don't sort if doing relocatable link. Sort for .ctors
1378 and .dtors if ctors_in_init_array.
1379 (Layout::make_output_section): Force correct section types for
1380 .init_array and friends. Don't sort if doing relocatable link,
1381 Don't sort .ctors and .dtors if ctors_in_init_array.
1382 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1383 (Layout::output_section_name): Add relobj parameter. Change all
1384 callers. Handle .ctors. and .dtors. in code rather than table.
1385 Handle .ctors and .dtors if ctors_in_init_array.
1386 (Layout::match_file_name): New function, moved from output.cc.
1387 * layout.h (class Layout): Update declarations.
1388 * output.cc: Include "layout.h".
1389 (Input_section_sort_entry::get_priority): New function.
1390 (Input_section_sort_entry::match_file_name): Just call
1391 Layout::match_file_name.
1392 (Output_section::Input_section_sort_init_fini_compare::operator()):
1393 Handle .ctors and .dtors. Sort by explicit priority rather than
1394 by name.
1395 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1396 * testsuite/initpri2.c: New test.
1397 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1398 (check_PROGRAMS): Add initpri2.
1399 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1400 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1401 * configure, testsuite/Makefile.in: Rebuild.
1402
e1f74f98
ILT
14032011-06-19 Ian Lance Taylor <iant@google.com>
1404
1405 PR gold/12880
1406 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1407 .interp section to a PT_INTERP segment even if we have seen a
1408 --dynamic-linker option. Don't do it if we have seen a PHDRS
1409 clause in a linker script.
1410 (Layout::finalize): Don't create a .interp section if we've
1411 already create a PT_INTERP segment.
1412 (Layout::create_interp): Always call choose_output_section (revert
1413 patch of 2011-06-17). Don't create PT_INTERP segment.
1414 * script-sections.cc
1415 (Script_sections::create_note_and_tls_segments): Add a .interp
1416 section to a PT_INTERP segment even if we have seen a
1417 --dynamic-linker option.
1418
766f91bb
ILT
14192011-06-18 Ian Lance Taylor <iant@google.com>
1420
1421 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1422 merely because a non-PT_LOAD segment has a dynamic reloc.
1423
0d212c3a
ILT
14242011-06-18 Ian Lance Taylor <iant@google.com>
1425
1426 * layout.cc (Layout::finish_dynamic_section): Don't create
1427 DT_FLAGS entry if not needed.
1428
911a5072
ILT
14292011-06-18 Ian Lance Taylor <iant@google.com>
1430
1431 PR gold/12745
1432 * layout.cc (Layout::layout_eh_frame): Correct handling of
1433 writable .eh_frame section.
1434
534b4e5f
ILT
14352011-06-17 Ian Lance Taylor <iant@google.com>
1436
1437 PR gold/12893
1438 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1439 symbol is redefined with the exact same object and value.
1440
10b4f102
ILT
14412011-06-17 Ian Lance Taylor <iant@google.com>
1442
1443 PR gold/12880
1444 * layout.h (class Layout): Add interp_segment_ field.
1445 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1446 (Layout::attach_allocated_section_to_segment): If making shared
1447 library, put .interp section in PT_INTERP segment.
1448 (Layout::finalize): Also call create_interp if -dynamic-linker
1449 option was used.
1450 (Layout::create_interp): Assert that there is no PT_INTERP
1451 segment. If not using a SECTIONS clause, use make_output_section.
1452 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1453 * script-sections.cc
1454 (Script_sections::create_note_and_tls_segments): If making shared
1455 library, put .interp section in PT_INTERP segment.
1456
a29b0dad
ILT
14572011-06-17 Ian Lance Taylor <iant@google.com>
1458
e588ea8d
ILT
1459 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1460 when making a shared library.
1461
14622011-06-17 Ian Lance Taylor <iant@google.com>
1463
1464 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1465 parameter. Change all callers. Don't issue warning about PC32
1466 against locally defined symbol.
a29b0dad 1467
9d3b0698
ILT
14682011-06-16 Ian Lance Taylor <iant@google.com>
1469
1470 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1471 occurs in same object.
1472
85b0f90c
AM
14732011-06-14 Alan Modra <amodra@gmail.com>
1474
1475 * po/POTFILES.in: Regenerate.
1476
a94907d9
ILT
14772011-06-09 Ian Lance Taylor <iant@google.com>
1478
1479 * script-sections.cc
1480 (Orphan_output_section::set_section_addresses): For a relocatable
1481 link set address to 0.
1482
4fb3a1c3
CC
14832011-06-09 Cary Coutant <ccoutant@google.com>
1484
1485 PR gold/12804
1486 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1487 used with --compress-debug-sections.
1488 * gold/object.cc (Sized_relobj_file::do_layout): Report
1489 uncompressed size of compressed input sections.
1490
61220854
CC
14912011-06-08 Cary Coutant <ccoutant@google.com>
1492
1493 PR gold/12804
1494 * testsuite/two_file_test_2_v1.cc: Change initialization of
1495 v2 to keep it in .data.
1496
e6455dfb
CC
14972011-06-07 Cary Coutant <ccoutant@google.com>
1498
1499 * common.cc (Symbol_table::do_allocate_commons_list): Call
1500 gold_fallback.
1501 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1502 (Errors::fallback): New function.
1503 (gold_fallback): New function.
1504 * errors.h (Errors::fallback): New function.
1505 * gold.cc (gold_exit): Change status parameter to enum; adjust
1506 all callers.
1507 (queue_initial_tasks): Call gold_fallback.
1508 * gold.h: Include cstdlib.
1509 (Exit_status): New enum type.
1510 (gold_exit): Change status parameter to enum.
1511 (gold_fallback): New function.
1512 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1513 (Layout::create_symtab_sections): Likewise.
1514 (Layout::create_shdrs): Likewise.
1515 * main.cc (main): Adjust call to gold_exit.
1516 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1517 (Output_data_got::add_got_entry_pair): Likewise.
1518 (Output_section::add_input_section): Likewise.
1519 (Output_section::add_output_section_data): Likewise.
1520 (Output_segment::set_section_list_addresses): Likewise.
1521 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1522
fb0e076f
CC
15232011-06-07 Cary Coutant <ccoutant@google.com>
1524
1525 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1526 for incremental links.
1527 * output.cc (Output_segment::set_section_list_addresses): Remove
1528 FIXME and test for TLS or BSS.
1529
a5ee4d5d
CC
15302011-06-07 Cary Coutant <ccoutant@google.com>
1531
1532 * testsuite/Makefile.am: Add incremental_copy_test,
1533 incremental_common_test_1.
1534 * testsuite/Makefile.in: Regenerate.
1535 * testsuite/common_test_1_v1.c: New source file.
1536 * testsuite/common_test_1_v2.c: New source file.
1537 * testsuite/copy_test_v1.cc: New source file.
1538
5146f448
CC
15392011-06-07 Cary Coutant <ccoutant@google.com>
1540
1541 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1542 update, allocate common from bss section's free list.
1543 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1544 linker-defined symbols.
1545 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1546 Skip GOT and PLT entries that are no longer referenced.
1547 (Output_section_incremental_inputs::write_info_blocks): Mark
1548 linker-defined symbols.
1549 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1550 * output.cc (Output_section::allocate): New function.
1551 * output.h (Output_section::allocate): New function.
1552 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1553 linker-defined symbols.
1554 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1555 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1556 (Symbol::init_base_output_data): Likewise.
1557 (Symbol::init_base_output_segment): Likewise.
1558 (Symbol::init_base_constant): Likewise.
1559 (Sized_symbol::init_output_data): Likewise.
1560 (Sized_symbol::init_output_segment): Likewise.
1561 (Sized_symbol::init_constant): Likewise.
1562 (Symbol_table::do_define_in_output_data): Likewise.
1563 (Symbol_table::do_define_in_output_segment): Likewise.
1564 (Symbol_table::do_define_as_constant): Likewise.
1565 * symtab.h (Symbol::is_predefined): New function.
1566 (Symbol::init_base_output_data): Add is_predefined parameter.
1567 (Symbol::init_base_output_segment): Likewise.
1568 (Symbol::init_base_constant): Likewise.
1569 (Symbol::is_predefined_): New data member.
1570 (Sized_symbol::init_output_data): Add is_predefined parameter.
1571 (Sized_symbol::init_output_segment): Likewise.
1572 (Sized_symbol::init_constant): Likewise.
1573 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1574
26d3c67d
CC
15752011-06-07 Cary Coutant <ccoutant@google.com>
1576
1577 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1578 instead of emit_copy_reloc.
1579 (Copy_relocs::emit_copy_reloc): Refactor.
1580 (Copy_relocs::make_copy_reloc): New function.
1581 (Copy_relocs::add_copy_reloc): Remove.
1582 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1583 section.
1584 (Copy_relocs::make_copy_reloc): New function.
1585 (Copy_relocs::add_copy_reloc): Remove.
1586 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1587 unchanged input files.
1588 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1589 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1590 Reserve BSS space for COPY relocations.
1591 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1592 (Output_section_incremental_inputs::write_info_blocks): Record
1593 whether a symbol is copied from a shared object.
1594 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1595 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1596 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1597 (Incremental_input_entry_reader::get_output_symbol_index): Add
1598 is_copy parameter.
1599 (Incremental_binary::emit_copy_relocs): New function.
1600 (Incremental_binary::do_emit_copy_relocs): New function.
1601 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1602 new data member.
1603 (Sized_incremental_binary::add_copy_reloc): New function.
1604 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1605 (Sized_incremental_binary::Copy_reloc): New struct.
1606 (Sized_incremental_binary::Copy_relocs): New typedef.
1607 (Sized_incremental_binary::copy_relocs_): New data member.
1608 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1609 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1610 * target.h (Sized_target::emit_copy_reloc): New function.
1611 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1612
7cdb37d9
CC
16132011-06-02 Cary Coutant <ccoutant@google.com>
1614
1615 PR gold/12163
1616 * gold/archive.cc (Archive::Archive): Initialize new data member.
1617 (Archive::include_all_members): Return if archive has already been
1618 included.
1619 * gold/archive.h (Archive::include_all_members_): New data member.
1620
cc643b88
NC
16212011-06-02 Nick Clifton <nickc@redhat.com>
1622
1623 * dynobj.h: Fix spelling mistake in comment.
1624 * output.cc: Likewise.
1625
f62a3ca7
DK
16262011-05-31 Doug Kwan <dougkwan@google.com>
1627 Asier Llano
1628
1629 PR gold/12826
cc643b88 1630 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
1631 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1632 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1633 redundant arm_exidx_test.so.
1634 * testsuite/Makefile.in: Regenerate.
1635 (check_SCRIPTS): Add pr12826.sh
1636 (check_DATA): Add pr12826.stdout
1637 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1638 * testsuite/pr12826.sh: New file.
1639 * testsuite/pr12826_1.s: Ditto.
1640 * testsuite/pr12826_1.s: Ditto.
1641
8dbe1edc
ILT
16422011-05-30 Ian Lance Taylor <iant@google.com>
1643
1644 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1645 sections.
1646
c49875be
ILT
16472011-05-29 Ian Lance Taylor <iant@google.com>
1648
1649 PR gold/12804
1650 * testsuite/Makefile.am: Use different file name for two_file_test
1651 temporary file for each incremental test.
1652 * testsuite/Makefile.in: Rebuild.
1653
69d53f7a
ILT
16542011-05-29 Ian Lance Taylor <iant@google.com>
1655
1656 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1657 binary input file is empty.
1658
41d0ab5f
ILT
16592011-05-27 Ian Lance Taylor <iant@google.com>
1660
1661 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1662 (ver_test_9.so): Likewise.
1663 * testsuite/Makefile.in: Rebuild.
1664
89d8a36b
CC
16652011-05-26 Cary Coutant <ccoutant@google.com>
1666
1667 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1668 * incremental.cc (Incremental_inputs::report_input_section): Fix
1669 comment, indentation.
1670 (Incremental_inputs::report_comdat_group): New function.
1671 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1672 of data for incremental input file entry.
1673 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1674 group count, COMDAT group signatures.
1675 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1676 an unchanged input file.
1677 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1678 Initialize new data member.
1679 (Incremental_object_entry::add_comdat_group): New function.
1680 (Incremental_object_entry::get_comdat_group_count): New function.
1681 (Incremental_object_entry::get_comdat_signature_key): New function.
1682 (Incremental_object_entry::groups_): New data member.
1683 (Incremental_inputs::report_comdat_group): New function.
1684 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1685 data for incremental input file entry.
1686 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1687 (Incremental_input_entry_reader::get_input_section): Adjust size of
1688 data for incremental input file entry.
1689 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1690 (Incremental_input_entry_reader::get_comdat_group_signature): New
1691 function.
1692 * object.cc (Sized_relobj::include_section_group): Report kept
1693 COMDAT groups for incremental links.
1694
1706a06f
ILT
16952011-05-24 David Meyer <pdox@google.com>
1696
1697 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1698 with name parameter. Add found_name parameter.
1699 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1700 * dirsearch.h (class Dirsearch): Update declaration.
1701
a10ae760
ILT
17022011-05-24 Ian Lance Taylor <iant@google.com>
1703
1704 * archive.cc (Library_base::should_include_member): Pull in object
1705 from archive if it defines the entry symbol.
1706 * parameters.cc (Parameters::entry): New function.
1707 * parameters.h (class Parameters): Declare entry.
1708 * output.h (class Output_file_header): Remove entry_ field.
1709 * output.cc (Output_file_header::Output_file_header): Remove entry
1710 parameter. Change all callers.
1711 (Output_file_header::entry): Use parameters->entry.
1712 * gold.cc (queue_middle_tasks): Likewise.
1713 * plugin.cc (Plugin_hook::run): Likewise.
1714
aa92d6ed
CC
17152011-05-24 Cary Coutant <ccoutant@google.com>
1716
1717 * gold.cc (queue_initial_tasks): Pass incremental base filename
1718 to Output_file::open_base_file; don't print error message.
1719 * incremental-dump.cc (main): Adjust call to
1720 Output_file::open_for_modification.
1721 * incremental-dump.cc (main): Likewise.
1722 * incremental.cc (Incremental_inputs::report_command_line):
1723 Ignore --incremental-base option when comparing command lines.
1724 Ignore parameter when given as separate argument.
1725 * options.h (class General_options): Add --incremental-base.
1726 * output.cc (Output_file::Output_file):
1727 (Output_file::open_base_file): Add base_name and writable parameters;
1728 read base file into new file; print error message here.
1729 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1730 callers.
1731 * output.h (Output_file::open_for_modification): Rename to...
1732 (Output_file::open_base_file): ...this; add base_name and
1733 writable parameters; adjust all callers.
1734 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1735 callers.
1736 * testsuite/Makefile.am (incremental_test_4): Test
1737 --incremental-base.
1738 * testsuite/Makefile.in: Regenerate.
1739
2eedd706
CC
17402011-05-24 Cary Coutant <ccoutant@google.com>
1741
1742 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1743 incremental_test_4.
1744 * testsuite/Makefile.in: Regenerate.
1745 * testsuite/two_file_test_1_v1.cc: New test source file.
1746 * testsuite/two_file_test_1b_v1.cc: New test source file.
1747 * testsuite/two_file_test_2_v1.cc: New test source file.
1748
0f1c85a6
CC
17492011-05-24 Cary Coutant <ccoutant@google.com>
1750
1751 * dynobj.h (Dynobj::do_dynobj): New function.
1752 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1753 flag and soname for shared objects.
1754 * incremental.cc (Incremental_inputs::report_object): Make
1755 either Incremental_object_entry or Incremental_dynobj_entry; add
1756 soname to string table.
1757 (Incremental_inputs::report_input_section): Add assertion.
1758 (Output_section_incremental_inputs::set_final_data_size): Adjust
1759 type of input file entry for shared libraries; adjust size of
1760 shared library info entry.
1761 (Output_section_incremental_inputs::write_input_files): Write
1762 as_needed flag for shared libraries.
1763 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1764 of input file entry for shared libraries; write soname.
1765 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1766 soname from incremental info.
1767 * incremental.h (enum Incremental_input_flags): Add
1768 INCREMENTAL_INPUT_AS_NEEDED.
1769 (Incremental_input_entry::Incremental_input_entry): Initialize new
1770 data member.
1771 (Incremental_input_entry::set_as_needed): New function.
1772 (Incremental_input_entry::as_needed): New function.
1773 (Incremental_input_entry::do_dynobj_entry): New function.
1774 (Incremental_input_entry::as_needed_): New data member.
1775 (Incremental_object_entry::Incremental_object_entry): Don't check
1776 for shared library.
1777 (Incremental_object_entry::do_type): Likewise.
1778 (class Incremental_dynobj_entry): New class.
1779 (Incremental_input_entry_reader::as_needed): New function.
1780 (Incremental_input_entry_reader::get_soname): New function.
1781 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1782 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1783 size of shared library info entry.
1784 * layout.cc (Layout::finish_dynamic_section): Don't test for
1785 incremental link when adding DT_NEEDED entries.
1786 * object.h (Object::Object): Initialize new data member.
1787 (Object::dynobj): New function.
1788 (Object::set_as_needed): New function.
1789 (Object::as_needed): New function.
1790 (Object::do_dynobj): New function.
1791 (Object::as_needed_): New data member.
1792
6fa2a40b
CC
17932011-05-24 Cary Coutant <ccoutant@google.com>
1794
1795 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1796 info; adjust display of GOT entries.
1797 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1798 vector of input objects; remove file_status_.
1799 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1800 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1801 got_plt reader; call target hooks to reserve GOT entries.
1802 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1803 of input file info header and GOT info entry.
1804 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1805 relocation info.
1806 (Got_plt_view_info::got_descriptor): Remove.
1807 (Got_plt_view_info::sym_index): New data member.
1808 (Got_plt_view_info::input_index): New data member.
1809 (Local_got_offset_visitor::visit): Write input file index.
1810 (Global_got_offset_visitor::visit): Write 0 for input file index.
1811 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1812 with sym_index and input_index.
1813 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1814 incremental info GOT entry; replace got_descriptor with input_index.
1815 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1816 map from input file index to object.
1817 (Sized_relobj_incr::do_layout): Replace direct data member reference
1818 with accessor function.
1819 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1820 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1821 Adjust size of input file info header.
1822 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1823 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1824 (Incremental_input_entry_reader::get_input_section): Adjust size of
1825 input file info header.
1826 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1827 of incremental info GOT entry.
1828 (Incremental_got_plt_reader::get_got_desc): Remove.
1829 (Incremental_got_plt_reader::get_got_symndx): New function.
1830 (Incremental_got_plt_reader::get_got_input_index): New function.
1831 (Sized_incremental_binary::Sized_incremental_binary): Remove
1832 file_status_; add input_objects_.
1833 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1834 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1835 (Sized_incremental_binary::file_is_unchanged): Remove.
1836 (Sized_incremental_binary::set_input_object): New function.
1837 (Sized_incremental_binary::input_object): New function.
1838 (Sized_incremental_binary::file_status_): Remove.
1839 (Sized_incremental_binary::input_objects_): New data member.
1840 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1841 references.
1842 (Sized_relobj_incr::invalid_address): Move to base class.
1843 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1844 class.
1845 (Sized_relobj_incr::do_output_section_offset): Likewise.
1846 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1847 (Sized_relobj_incr::section_offsets_): Likewise.
1848 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1849 function.
1850 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1851 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1852 with accessor function.
1853 (Sized_relobj_file::do_layout): Likewise.
1854 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1855 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1856 (Sized_relobj_file::compute_final_local_value): Replace refs to
1857 section_offsets_ with accessor function.
1858 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1859 * object.h (Relobj::Relobj): Initialize new data members.
1860 (Relobj::add_dyn_reloc): New function.
1861 (Relobj::first_dyn_reloc): New function.
1862 (Relobj::dyn_reloc_count): New function.
1863 (Relobj::first_dyn_reloc_): New data member.
1864 (Relobj::dyn_reloc_count_): New data member.
1865 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1866 references.
1867 (Sized_relobj::Address): New typedef.
1868 (Sized_relobj::invalid_address): Move here from child class.
1869 (Sized_relobj::Sized_relobj): Initialize new data members.
1870 (Sized_relobj::sized_relobj): New function.
1871 (Sized_relobj::is_output_section_offset_invalid): Move here from
1872 child class.
1873 (Sized_relobj::get_output_section_offset): Likewise.
1874 (Sized_relobj::local_has_got_offset): Likewise.
1875 (Sized_relobj::local_got_offset): Likewise.
1876 (Sized_relobj::set_local_got_offset): Likewise.
1877 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1878 (Sized_relobj::clear_got_offsets): New function.
1879 (Sized_relobj::section_offsets): Move here from child class.
1880 (Sized_relobj::do_output_section_offset): Likewise.
1881 (Sized_relobj::do_set_section_offset): Likewise.
1882 (Sized_relobj::Local_got_offsets): Likewise.
1883 (Sized_relobj::local_got_offsets_): Likewise.
1884 (Sized_relobj::section_offsets_): Likewise.
1885 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1886 references.
1887 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1888 class.
1889 (Sized_relobj_file::sized_relobj): New function
1890 (Sized_relobj_file::local_has_got_offset): Move to base class.
1891 (Sized_relobj_file::local_got_offset): Likewise.
1892 (Sized_relobj_file::set_local_got_offset): Likewise.
1893 (Sized_relobj_file::get_output_section_offset): Likewise.
1894 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1895 (Sized_relobj_file::do_output_section_offset): Likewise.
1896 (Sized_relobj_file::do_set_section_offset): Likewise.
1897 (Sized_relobj_file::Local_got_offsets): Likewise.
1898 (Sized_relobj_file::local_got_offsets_): Likewise.
1899 (Sized_relobj_file::section_offsets_): Likewise.
1900 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1901 (all constructors).
1902 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1903 (Output_reloc::get_symbol_index): Likewise.
1904 (Output_reloc::local_section_offset): Likewise.
1905 (Output_reloc::get_address): Likewise.
1906 (Output_reloc::symbol_value): Likewise.
1907 (Output_data_got::reserve_slot): Move to class definition.
1908 (Output_data_got::reserve_local): New function.
1909 (Output_data_got::reserve_slot_for_global): Remove.
1910 (Output_data_got::reserve_global): New function.
1911 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1912 (all constructors, two instantiations).
1913 (Output_reloc::get_relobj): New function (two instantiations).
1914 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1915 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1916 (Output_data_reloc::add_global): Adjust type of relobj.
1917 (Output_data_reloc::add_global_relative): Likewise.
1918 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1919 (Output_data_reloc::add_local): Likewise.
1920 (Output_data_reloc::add_local_relative): Likewise.
1921 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1922 (Output_data_reloc::add_local_section): Likewise.
1923 (Output_data_reloc::add_output_section): Likewise.
1924 (Output_data_reloc::add_absolute): Likewise.
1925 (Output_data_reloc::add_target_specific): Likewise.
1926 (Output_data_got::reserve_slot): Move definition here.
1927 (Output_data_got::reserve_local): New function.
1928 (Output_data_got::reserve_global): New function.
1929 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1930 section_offsets_ with accessor function.
1931 (Sized_relobj_file::write_sections): Likewise.
1932 (Sized_relobj_file::do_relocate_sections): Likewise.
1933 * target.h (Sized_target::reserve_local_got_entry): New function.
1934 (Sized_target::reserve_global_got_entry): New function.
1935 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1936 (Target_x86_64::reserve_global_got_entry): New function.
1937 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1938
4829d394
CC
19392011-05-23 Cary Coutant <ccoutant@google.com>
1940
1941 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1942 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1943 bit when checking got_type.
1944 * incremental.cc (Sized_incremental_binary::setup_readers):
1945 Store symbol table and string table locations; initialize bit vector
1946 of file status flags.
1947 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1948 unchanged files.
1949 (Sized_incremental_binary::do_process_got_plt): New function.
1950 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1951 (Output_section_incremental_inputs::set_final_data_size): Record
1952 file index for each input file.
1953 (Output_section_incremental_inputs::write_got_plt): Store file index
1954 instead of input entry offset for each GOT entry.
1955 * incremental.h
1956 (Incremental_input_entry::Incremental_input_entry): Initialize new
1957 data member.
1958 (Incremental_input_entry::set_offset): Store file index.
1959 (Incremental_input_entry::get_file_index): New function.
1960 (Incremental_input_entry::file_index_): New data member.
1961 (Incremental_binary::process_got_plt): New function.
1962 (Incremental_binary::do_process_got_plt): New function.
1963 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1964 data members.
1965 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1966 (Sized_incremental_binary::set_file_is_unchanged): New function.
1967 (Sized_incremental_binary::file_is_unchanged): New function.
1968 (Sized_incremental_binary::do_process_got_plt): New function.
1969 (Sized_incremental_binary::file_status_): New data member.
1970 (Sized_incremental_binary::main_symtab_loc_): New data member.
1971 (Sized_incremental_binary::main_strtab_loc_): New data member.
1972 * output.cc (Output_data_got::Got_entry::write): Add case
1973 RESERVED_CODE.
1974 (Output_data_got::add_global): Call add_got_entry.
1975 (Output_data_got::add_global_plt): Likewise.
1976 (Output_data_got::add_global_with_rel): Likewise.
1977 (Output_data_got::add_global_with_rela): Likewise.
1978 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1979 (Output_data_got::add_global_pair_with_rela): Likewise.
1980 (Output_data_got::add_local): Call add_got_entry.
1981 (Output_data_got::add_local_plt): Likewise.
1982 (Output_data_got::add_local_with_rel): Likewise.
1983 (Output_data_got::add_local_with_rela): Likewise.
1984 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1985 (Output_data_got::add_local_pair_with_rela): Likewise.
1986 (Output_data_got::reserve_slot): New function.
1987 (Output_data_got::reserve_slot_for_global): New function.
1988 (Output_data_got::add_got_entry): New function.
1989 (Output_data_got::add_got_entry_pair): New function.
1990 (Output_section::add_output_section_data): Edit FIXME.
1991 * output.h
1992 (Output_section_data_build::Output_section_data_build): New
1993 constructor with size parameter.
1994 (Output_data_space::Output_data_space): Likewise.
1995 (Output_data_got::Output_data_got): Initialize new data member; new
1996 constructor with size parameter.
1997 (Output_data_got::add_constant): Call add_got_entry.
1998 (Output_data_got::reserve_slot): New function.
1999 (Output_data_got::reserve_slot_for_global): New function.
2000 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2001 (Output_data_got::add_got_entry): New function.
2002 (Output_data_got::add_got_entry_pair): New function.
2003 (Output_data_got::free_list_): New data member.
2004 * target.h (Sized_target::init_got_plt_for_update): New function.
2005 (Sized_target::register_global_plt_entry): New function.
2006 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2007 Initialize new data member; call init; add constructor with PLT count.
2008 (Output_data_plt_x86_64::init): New function.
2009 (Output_data_plt_x86_64::add_relocation): New function.
2010 (Output_data_plt_x86_64::reserve_slot): New function.
2011 (Output_data_plt_x86_64::free_list_): New data member.
2012 (Target_x86_64::init_got_plt_for_update): New function.
2013 (Target_x86_64::register_global_plt_entry): New function.
2014 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2015 incremental updates.
2016 (Output_data_plt_x86_64::add_relocation): New function.
2017 * testsuite/object_unittest.cc (Object_test): Set default options.
2018
ec69d6da
ILT
20192011-05-16 Ian Lance Taylor <iant@google.com>
2020
2021 * options.h (class General_options): Make -i a synonym for -r.
2022
732e31de
ILT
20232011-05-16 Ian Lance Taylor <iant@google.com>
2024
2025 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2026
403676b5
CC
20272011-05-10 Cary Coutant <ccoutant@google.com>
2028
2029 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2030 strip_all (-s).
2031
5b7b7d6e
ILT
20322011-05-06 Ian Lance Taylor <iant@google.com>
2033
2034 * layout.cc (Layout::layout): If the output section flags change,
2035 update the ordering.
2036
f0f9babf
CC
20372011-04-25 Cary Coutant <ccoutant@google.com>
2038
2039 * incremental-dump.cc (dump_incremental_inputs): Print local
2040 symbol info for each input file.
2041 * incremental.cc
2042 (Output_section_incremental_inputs::set_final_data_size): Add local
2043 symbol info to input file entries in incremental info.
2044 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2045 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2046 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2047 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2048 implementation.
2049 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2050 (Sized_incr_relobj::do_relocate): Write the local symbols.
2051 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2052 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2053 Adjust size of input file header.
2054 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2055 (Incremental_inputs_reader::get_local_symbol_count): New function.
2056 (Incremental_inputs_reader::get_input_section): Adjust size of input
2057 file header.
2058 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2059 (Sized_incr_relobj::This): New typedef.
2060 (Sized_incr_relobj::sym_size): New const data member.
2061 (Sized_incr_relobj::Local_symbol): New struct.
2062 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2063 (Sized_incr_relobj::do_local_symbol_offset): New function.
2064 (Sized_incr_relobj::local_symbol_count_): New data member.
2065 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2066 (Sized_incr_relobj::local_symbol_index_): New data member.
2067 (Sized_incr_relobj::local_symbol_offset_): New data member.
2068 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2069 (Sized_incr_relobj::local_symbols_): New data member.
2070 * object.h (Relobj::output_local_symbol_count): New function.
2071 (Relobj::local_symbol_offset): New function.
2072 (Relobj::do_output_local_symbol_count): New function.
2073 (Relobj::do_local_symbol_offset): New function.
2074 (Sized_relobj::do_output_local_symbol_count): New function.
2075 (Sized_relobj::do_local_symbol_offset): New function.
2076
d0a9ace3
ILT
20772011-04-22 Vladimir Simonov <sv@sw.ru>
2078
2079 * descriptors.cc (set_close_on_exec): New function.
2080 (Descriptors::open): Use set_close_on_exec.
2081 * output.cc (S_ISLNK): Define if not defined.
2082
94a3fc8b
CC
20832011-04-22 Cary Coutant <ccoutant@google.com>
2084
2085 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2086 global symbol map.
2087 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2088 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2089 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2090 relocations.
2091 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2092 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2093 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2094 * incremental.h
2095 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2096 function.
2097 (Incremental_binary::apply_incremental_relocs): New function.
2098 (Incremental_binary::do_apply_incremental_relocs): New function.
2099 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2100 data member.
2101 (Sized_incremental_binary::add_global_symbol): New function.
2102 (Sized_incremental_binary::global_symbol): New function.
2103 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2104 (Sized_incremental_binary::symbol_map_): New data member.
2105 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2106 * target.h (Sized_target::apply_relocation): New function.
2107 * target-reloc.h (apply_relocation): New function.
2108 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2109
c87e4302
DK
21102011-04-22 Doug Kwan <dougkwan@google.com>
2111
2112 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2113 flag of a SHT_ARM_EXIDX section.
2114 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2115 * testsuite/Makefile.in: Regenerate.
2116 * testsuite/arm_exidx_test.s: New file.
2117 * testsuite/arm_exidx_test.sh: Same.
2118
e7782cf6
CC
21192011-04-20 Cary Coutant <ccoutant@google.com>
2120
2121 PR gold/12689
2122 * archive.h (Incremental_archive_entry::Archive_member):
2123 Initialize arg_serial_ (second constructor).
2124
308ecdc7
ILT
21252011-04-17 Ian Lance Taylor <iant@google.com>
2126
2127 * object.cc (Relocate_info::location): Simplify location string.
2128 * errors.cc (Errors::error_at_location): Don't print program
2129 name.
2130 (Errors::warning_at_location): Likewise.
2131 (Errors::undefined_symbol): Likewise.
2132 * testsuite/debug_msg.sh: Update accordingly.
2133
bec5b579
CC
21342011-04-14 Cary Coutant <ccoutant@google.com>
2135
2136 * gold/layout.cc (Layout::symtab_section_offset): New function.
2137 * gold/layout.h (Layout::symtab_section_offset): New function.
2138 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2139
88597d34
ILT
21402011-04-12 Ian Lance Taylor <iant@google.com>
2141
2142 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2143 with MREMAP_MAYMOVE.
2144 * output.h (class Output_file): Add map_is_allocated_ field.
2145 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2146 not available, provide stubs. If mremap is not available, #define
2147 it to gold_mremap.
2148 (MREMAP_MAYMOVE): Define if not defined.
2149 (Output_file::Output_file): Initialize map_is_allocated_.
2150 (Output_file::resize): Check map_is_allocated_.
2151 (Output_file::map_anonymous): If mmap fails, use malloc.
2152 (Output_file::unmap): Don't do anything for an anonymous map.
2153 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2154 is not available, provide stubs.
2155 (File_read::View::~View): Use free rather than delete[].
2156 (File_read::make_view): Use malloc rather than new[]. If mmap
2157 fails, use malloc.
2158 (File_read::find_or_make_view): Use malloc rather than new[].
2159 * gold.h: Remove HAVE_REMAP code.
2160 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2161 exists. Rename mremap to gold_mremap. If mmap is not available
2162 don't do anything.
2163 * configure, config.in: Rebuild.
2164
11e361bc
ILT
21652011-04-11 Ian Lance Taylor <iant@google.com>
2166
2167 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2168 initialize local variable v.
2169
cdc29364
CC
21702011-04-11 Cary Coutant <ccoutant@google.com>
2171
2172 * archive.cc (Archive::include_member): Adjust call to
2173 report_object.
2174 (Add_archive_symbols::run): Track argument serial numbers.
2175 (Lib_group::include_member): Likewise.
2176 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2177 * archive.h (Incremental_archive_entry::Archive_member):
2178 Initialize arg_serial_.
2179 (Archive_member::arg_serial_): New data member.
2180 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2181 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2182 incremental link.
2183 (Sized_dynobj::do_for_all_local_got_entries): New function.
2184 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2185 function.
2186 * fileread.cc (get_mtime): New function.
2187 * fileread.h (get_mtime): New function.
2188 * gold.cc (queue_initial_tasks): Check for incremental update.
2189 (process_incremental_input): New function.
2190 (queue_middle_tasks): Don't force valid target for incremental
2191 update.
2192 * incremental-dump.cc (find_input_containing_global): Adjust
2193 size of symbol info entry.
2194 (dump_incremental_inputs): Dump argument serial number and
2195 in_system_directory flag; bias shndx by 1; print symbol names
2196 when dumping per-file symbol lists; use new symbol info readers.
2197 * incremental.cc
2198 (Output_section_incremental_inputs:update_data_size): New function.
2199 (Sized_incremental_binary::setup_readers): Setup input readers
2200 for each input file; build maps for files added from libraries
2201 and scripts.
2202 (Sized_incremental_binary::check_input_args): New function.
2203 (Sized_incremental_binary::do_check_inputs): Build map of argument
2204 serial numbers to input arguments.
2205 (Sized_incremental_binary::do_file_has_changed): Rename
2206 do_file_is_unchanged to this; compare file modification times.
2207 (Sized_incremental_binary::do_init_layout): New function.
2208 (Sized_incremental_binary::do_reserve_layout): New function.
2209 (Sized_incremental_binary::do_get_input_reader): Remove.
2210 (Sized_incremental_binary::get_symtab_view): New function.
2211 (Incremental_checker::can_incrementally_link_output_file): Remove.
2212 (Incremental_inputs::report_command_line): Exclude --debug options.
2213 (Incremental_inputs::report_archive_begin): Add parameter; track
2214 argument serial numbers; don't put input file entry for archive
2215 before archive members.
2216 (Incremental_inputs::report_archive_end): Put input file entry
2217 for archive after archive members.
2218 (Incremental_inputs::report_object): Add parameter; track argument
2219 serial numbers and in_system_directory flag.
2220 (Incremental_inputs::report_script): Add parameter; track argument
2221 serial numbers.
2222 (Output_section_incremental_inputs::set_final_data_size): Adjust
2223 size of symbol info entry; check for forwarding symbols.
2224 (Output_section_incremental_inputs::write_input_files): Write
2225 in_system_directory flag and argument serial number.
2226 (Output_section_incremental_inputs::write_info_blocks): Map section
2227 indices between incremental info and original input file; store
2228 input section index for each symbol.
2229 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2230 change operator() to visit().
2231 (class Global_got_offset_visitor): Likewise.
2232 (class Global_symbol_visitor_got_plt):
2233 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2234 classes.
2235 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2236 (Sized_incr_relobj::do_read_symbols): New function.
2237 (Sized_incr_relobj::do_layout): New function.
2238 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2239 (Sized_incr_relobj::do_add_symbols): New function.
2240 (Sized_incr_relobj::do_should_include_member): New function.
2241 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2242 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2243 (Sized_incr_relobj::do_section_size): New function.
2244 (Sized_incr_relobj::do_section_name): New function.
2245 (Sized_incr_relobj::do_section_contents): New function.
2246 (Sized_incr_relobj::do_section_flags): New function.
2247 (Sized_incr_relobj::do_section_entsize): New function.
2248 (Sized_incr_relobj::do_section_address): New function.
2249 (Sized_incr_relobj::do_section_type): New function.
2250 (Sized_incr_relobj::do_section_link): New function.
2251 (Sized_incr_relobj::do_section_info): New function.
2252 (Sized_incr_relobj::do_section_addralign): New function.
2253 (Sized_incr_relobj::do_initialize_xindex): New function.
2254 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2255 (Sized_incr_relobj::do_read_relocs): New function.
2256 (Sized_incr_relobj::do_gc_process_relocs): New function.
2257 (Sized_incr_relobj::do_scan_relocs): New function.
2258 (Sized_incr_relobj::do_count_local_symbols): New function.
2259 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2260 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2261 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2262 (Sized_incr_relobj::do_relocate): New function.
2263 (Sized_incr_relobj::do_set_section_offset): New function.
2264 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2265 (Sized_incr_dynobj::do_read_symbols): New function.
2266 (Sized_incr_dynobj::do_layout): New function.
2267 (Sized_incr_dynobj::do_add_symbols): New function.
2268 (Sized_incr_dynobj::do_should_include_member): New function.
2269 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2270 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2271 (Sized_incr_dynobj::do_section_size): New function.
2272 (Sized_incr_dynobj::do_section_name): New function.
2273 (Sized_incr_dynobj::do_section_contents): New function.
2274 (Sized_incr_dynobj::do_section_flags): New function.
2275 (Sized_incr_dynobj::do_section_entsize): New function.
2276 (Sized_incr_dynobj::do_section_address): New function.
2277 (Sized_incr_dynobj::do_section_type): New function.
2278 (Sized_incr_dynobj::do_section_link): New function.
2279 (Sized_incr_dynobj::do_section_info): New function.
2280 (Sized_incr_dynobj::do_section_addralign): New function.
2281 (Sized_incr_dynobj::do_initialize_xindex): New function.
2282 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2283 (make_sized_incremental_object): New function.
2284 (Incremental_library::copy_unused_symbols): New function.
2285 (Incremental_library::do_for_all_unused_symbols): New function.
2286 * incremental.h (enum Incremental_input_flags): New type.
2287 (class Incremental_checker): Remove.
2288 (Incremental_input_entry::Incremental_input_entry): Add argument
2289 serial number.
2290 (Incremental_input_entry::arg_serial): New function.
2291 (Incremental_input_entry::set_is_in_system_directory): New function.
2292 (Incremental_input_entry::is_in_system_directory): New function.
2293 (Incremental_input_entry::arg_serial_): New data member.
2294 (Incremental_input_entry::is_in_system_directory_): New data member.
2295 (class Script_info): Move here from script.h.
2296 (Script_info::Script_info): Add filename parameter.
2297 (Script_info::filename): New function.
2298 (Script_info::filename_): New data member.
2299 (Incremental_script_entry::Incremental_script_entry): Add argument
2300 serial number.
2301 (Incremental_object_entry::Incremental_object_entry): Likewise.
2302 (Incremental_object_entry::add_input_section): Build list of input
2303 sections with map to original shndx.
2304 (Incremental_object_entry::get_input_section_index): New function.
2305 (Incremental_object_entry::shndx_): New data member.
2306 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2307 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2308 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2309 serial number.
2310 (Incremental_inputs::report_archive_begin): Likewise.
2311 (Incremental_inputs::report_object): Likewise.
2312 (Incremental_inputs::report_script): Likewise.
2313 (class Incremental_global_symbol_reader): New class.
2314 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2315 and store flags and input file type.
2316 (Incremental_input_entry_reader::arg_serial): New function.
2317 (Incremental_input_entry_reader::type): Extract type from flags.
2318 (Incremental_input_entry_reader::is_in_system_directory): New function.
2319 (Incremental_input_entry_reader::get_input_section_count): Call
2320 accessor function for type.
2321 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2322 function for type; adjust size of global symbol entry.
2323 (Incremental_input_entry_reader::get_global_symbol_count): Call
2324 accessor function for type.
2325 (Incremental_input_entry_reader::get_object_count): Likewise.
2326 (Incremental_input_entry_reader::get_object_offset): Likewise.
2327 (Incremental_input_entry_reader::get_member_count): Likewise.
2328 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2329 (Incremental_input_entry_reader::get_member_offset): Likewise.
2330 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2331 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2332 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2333 (Incremental_input_entry_reader::get_global_symbol_reader): New
2334 function.
2335 (Incremental_input_entry_reader::get_output_symbol_index): New
2336 function.
2337 (Incremental_input_entry_reader::type_): Remove.
2338 (Incremental_input_entry_reader::flags_): New data member.
2339 (Incremental_inputs_reader::input_file_offset): New function.
2340 (Incremental_inputs_reader::input_file_index): New function.
2341 (Incremental_inputs_reader::input_file): Call input_file_offset.
2342 (Incremental_inputs_reader::input_file_at_offset): New function.
2343 (Incremental_relocs_reader::get_r_type): Reformat.
2344 (Incremental_relocs_reader::get_r_shndx): Reformat.
2345 (Incremental_relocs_reader::get_r_offset): Reformat.
2346 (Incremental_relocs_reader::data): New function.
2347 (Incremental_binary::Incremental_binary): Initialize new data members.
2348 (Incremental_binary::check_inputs): Add cmdline parameter.
2349 (Incremental_binary::file_is_unchanged): Remove.
2350 (Input_reader::arg_serial): New function.
2351 (Input_reader::get_unused_symbol_count): New function.
2352 (Input_reader::get_unused_symbol): New function.
2353 (Input_reader::do_arg_serial): New function.
2354 (Input_reader::do_get_unused_symbol_count): New function.
2355 (Input_reader::do_get_unused_symbol): New function.
2356 (Incremental_binary::input_file_count): New function.
2357 (Incremental_binary::get_input_reader): Change signature to use
2358 index instead of filename.
2359 (Incremental_binary::file_has_changed): New function.
2360 (Incremental_binary::get_input_argument): New function.
2361 (Incremental_binary::get_library): New function.
2362 (Incremental_binary::get_script_info): New function.
2363 (Incremental_binary::init_layout): New function.
2364 (Incremental_binary::reserve_layout): New function.
2365 (Incremental_binary::output_file): New function.
2366 (Incremental_binary::do_check_inputs): New function.
2367 (Incremental_binary::do_file_is_unchanged): Remove.
2368 (Incremental_binary::do_file_has_changed): New function.
2369 (Incremental_binary::do_init_layout): New function.
2370 (Incremental_binary::do_reserve_layout): New function.
2371 (Incremental_binary::do_input_file_count): New function.
2372 (Incremental_binary::do_get_input_reader): Change signature.
2373 (Incremental_binary::input_args_map_): New data member.
2374 (Incremental_binary::library_map_): New data member.
2375 (Incremental_binary::script_map_): New data member.
2376 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2377 new data members.
2378 (Sized_incremental_binary::output_section): New function.
2379 (Sized_incremental_binary::inputs_reader): Add const.
2380 (Sized_incremental_binary::symtab_reader): Add const.
2381 (Sized_incremental_binary::relocs_reader): Add const.
2382 (Sized_incremental_binary::got_plt_reader): Add const.
2383 (Sized_incremental_binary::get_symtab_view): New function.
2384 (Sized_incremental_binary::Inputs_reader): New typedef.
2385 (Sized_incremental_binary::Input_entry_reader): New typedef.
2386 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2387 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2388 (Sized_incremental_binary::do_file_has_changed): New function.
2389 (Sized_incremental_binary::do_init_layout): New function.
2390 (Sized_incremental_binary::do_reserve_layout): New function.
2391 (Sized_input_reader::Inputs_reader): Remove.
2392 (Sized_input_reader::Input_entry_reader): Remove.
2393 (Sized_input_reader::do_arg_serial): New function.
2394 (Sized_input_reader::do_get_unused_symbol_count): New function.
2395 (Sized_input_reader::do_get_unused_symbol): New function.
2396 (Sized_incremental_binary::do_input_file_count): New function.
2397 (Sized_incremental_binary::do_get_input_reader): Change signature;
2398 use index instead of filename.
2399 (Sized_incremental_binary::section_map_): New data member.
2400 (Sized_incremental_binary::input_entry_readers_): New data member.
2401 (class Sized_incr_relobj): New class.
2402 (class Sized_incr_dynobj): New class.
2403 (make_sized_incremental_object): New function.
2404 (class Incremental_library): New class.
2405 * layout.cc (Free_list::num_lists): New static data member.
2406 (Free_list::num_nodes): New static data member.
2407 (Free_list::num_removes): New static data member.
2408 (Free_list::num_remove_visits): New static data member.
2409 (Free_list::num_allocates): New static data member.
2410 (Free_list::num_allocate_visits): New static data member.
2411 (Free_list::init): New function.
2412 (Free_list::remove): New function.
2413 (Free_list::allocate): New function.
2414 (Free_list::dump): New function.
2415 (Free_list::print_stats): New function.
2416 (Layout_task_runner::run): Resize output file for incremental updates.
2417 (Layout::Layout): Initialize new data members.
2418 (Layout::set_incremental_base): New function.
2419 (Layout::init_fixed_output_section): New function.
2420 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2421 incremental updates.
2422 (Layout::create_gold_note): Do not create gold note section for
2423 incremental updates.
2424 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2425 for incremental updates.
2426 (Layout::set_section_offsets): For incremental updates, allocate space
2427 from free list.
2428 (Layout::create_symtab_sections): Layout with offsets relative to
2429 start of section; for incremental updates, allocate space from free
2430 list.
2431 (Layout::create_shdrs): For incremental updates, allocate space from
2432 free list.
2433 (Layout::finish_dynamic_section): For incremental updates, do not
2434 check --as-needed (fixed in subsequent patch).
2435 * layout.h (class Free_list): New class.
2436 (Layout::set_incremental_base): New function.
2437 (Layout::incremental_base): New function.
2438 (Layout::init_fixed_output_section): New function.
2439 (Layout::allocate): New function.
2440 (Layout::incremental_base_): New data member.
2441 (Layout::free_list_): New data member.
2442 * main.cc (main): Print Free_list statistics.
2443 * object.cc (Relobj::finalize_incremental_relocs): Add
2444 clear_counts parameter; clear counts only when clear_counts is set.
2445 (Sized_relobj::Sized_relobj): Initialize new base class.
2446 (Sized_relobj::do_layout): Don't report special sections.
2447 (Sized_relobj::do_for_all_local_got_entries): New function.
2448 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2449 symtab_off to all symbol table offsets.
2450 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2451 * object.h (class Got_offset_list): Move to top of file.
2452 (Object::Object): Allow case where input_file == NULL.
2453 (Object::~Object): Likewise.
2454 (Object::input_file): Assert that input_file != NULL.
2455 (Object::lock): Allow case where input_file == NULL.
2456 (Object::unlock): Likewise.
2457 (Object::is_locked): Likewise.
2458 (Object::token): Likewise.
2459 (Object::release): Likewise.
2460 (Object::is_incremental): New function.
2461 (Object::get_mtime): New function.
2462 (Object::for_all_local_got_entries): New function.
2463 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2464 (Object::set_is_in_system_directory): New function.
2465 (Object::is_in_system_directory): New function.
2466 (Object::do_is_incremental): New function.
2467 (Object::do_get_mtime): New function.
2468 (Object::do_for_all_local_got_entries): New function.
2469 (Object::is_in_system_directory_): New data member.
2470 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2471 (class Sized_relobj_base): New class.
2472 (class Sized_relobj): Derive from Sized_relobj_base.
2473 (class Sized_relobj::Symbols): Redeclare from base class.
2474 (class Sized_relobj::local_got_offset_list): Remove.
2475 (class Sized_relobj::Output_sections): Redeclare from base class.
2476 (class Sized_relobj::do_for_all_local_got_entries): New function.
2477 (class Sized_relobj::write_local_symbols): Add offset parameter.
2478 (class Sized_relobj::local_symbol_offset_): Update comment.
2479 (class Sized_relobj::local_dynsym_offset_): Update comment.
2480 * options.cc (Input_arguments::add_file): Remove const.
2481 * options.h (Input_file_argument::Input_file_argument):
2482 Initialize arg_serial_ (all constructors).
2483 (Input_file_argument::set_arg_serial): New function.
2484 (Input_file_argument::arg_serial): New function.
2485 (Input_file_argument::arg_serial_): New data member.
2486 (Input_arguments::Input_arguments): Initialize file_count_.
2487 (Input_arguments::add_file): Remove const.
2488 (Input_arguments::number_of_input_files): New function.
2489 (Input_arguments::file_count_): New data member.
2490 (Command_line::number_of_input_files): Call
2491 Input_arguments::number_of_input_files.
2492 * output.cc (Output_segment_headers::Output_segment_headers):
2493 Set current size.
2494 (Output_section::Input_section::current_data_size): New function.
2495 (Output_section::Output_section): Initialize new data members.
2496 (Output_section::add_input_section): Don't do merge sections for
2497 an incremental link; allocate space from free list for an
2498 incremental update.
2499 (Output_section::add_output_section_data): Allocate space from
2500 free list for an incremental update.
2501 (Output_section::update_data_size): New function.
2502 (Output_section::set_fixed_layout): New function.
2503 (Output_section::reserve): New function.
2504 (Output_segment::set_section_addresses): Remove const.
2505 (Output_segment::set_section_list_addresses): Remove const; allocate
2506 space from free list for an incremental update.
2507 (Output_segment::set_offset): Adjust size of RELRO segment for an
2508 incremental update.
2509 * output.h (Output_data::current_data_size): Move here from
2510 child classes.
2511 (Output_data::pre_finalize_data_size): New function.
2512 (Output_data::update_data_size): New function.
2513 (Output_section_headers::update_data_size): new function.
2514 (Output_section_data_build::current_data_size): Move to Output_data.
2515 (Output_data_strtab::update_data_size): New function.
2516 (Output_section::current_data_size): Move to Output_data.
2517 (Output_section::set_fixed_layout): New function.
2518 (Output_section::has_fixed_layout): New function.
2519 (Output_section::reserve): New function.
2520 (Output_section::update_data_size): New function.
2521 (Output_section::has_fixed_layout_): New data member.
2522 (Output_section::free_list_): New data member.
2523 (Output_segment::set_section_addresses): Remove const.
2524 (Output_segment::set_section_list_addresses): Remove const.
2525 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2526 New function.
2527 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2528 New function.
2529 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2530 parameter when calling Add_symbols constructor; store argument
2531 serial number for members of a lib group.
2532 (Add_symbols::locks): Allow case where token == NULL.
2533 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2534 (Read_member::~Read_member): New function.
2535 (Read_member::is_runnable): New function.
2536 (Read_member::locks): New function.
2537 (Read_member::run): New function.
2538 (Check_script::~Check_script): New function.
2539 (Check_script::is_runnable): New function.
2540 (Check_script::locks): New function.
2541 (Check_script::run): New function.
2542 (Check_library::~Check_library): New function.
2543 (Check_library::is_runnable): New function.
2544 (Check_library::locks): New function.
2545 (Check_library::run): New function.
2546 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2547 (Add_symbols::library_): New data member.
2548 (class Read_member): New class.
2549 (class Check_script): New class.
2550 (class Check_library): New class.
2551 * reloc.cc (Read_relocs::is_runnable): Allow case where
2552 token == NULL.
2553 (Read_relocs::locks): Likewise.
2554 (Scan_relocs::locks): Likewise.
2555 (Relocate_task::locks): Likewise.
2556 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2557 to clear counters.
2558 (Sized_relobj::incremental_relocs_scan): Fix comment.
2559 (Sized_relobj::do_relocate): Pass output file offset to
2560 write_local_symbols.
2561 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2562 from class declaration.
2563 * script.cc (read_input_script): Allocate Script_info; pass
2564 argument serial number to report_script.
2565 * script.h (class Script_info): Move to incremental.h.
2566 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2567 * symtab.h (Symbol_table::add_from_incrobj): New function.
2568 (Symbol_table::set_file_offset): New function.
2569
b961d0d7
CC
25702011-04-05 Cary Coutant <ccoutant@google.com>
2571
2572 * incremental-dump.cc (dump_incremental_inputs): Change signature
2573 to take a Sized_incremental_binary; change caller. Use readers
2574 in Sized_incremental_binary.
2575 * incremental.cc
2576 (Sized_incremental_binary::find_incremental_inputs_sections):
2577 Rename do_find_incremental_inputs_sections to this.
2578 (Sized_incremental_binary::setup_readers): New function.
2579 (Sized_incremental_binary::do_check_inputs): Check
2580 has_incremental_info_ flag; move setup code to setup_readers;
2581 use input readers.
2582 (Sized_incremental_binary::do_file_is_unchanged): New function.
2583 (Sized_incremental_binary::do_get_input_reader): New function.
2584 * incremental.h (class Incremental_binary): Move to end of file.
2585 (Incremental_binary::file_is_unchanged): New function.
2586 (Incremental_binary::do_file_is_unchanged): New function.
2587 (Incremental_binary::Input_reader): New class.
2588 (Incremental_binary::get_input_reader): New function.
2589 (class Sized_incremental_binary): Move to end of file.
2590 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2591 input section reader classes.
2592 (Sized_incremental_binary::has_incremental_info): New function.
2593 (Sized_incremental_binary::inputs_reader): New function.
2594 (Sized_incremental_binary::symtab_reader): New function.
2595 (Sized_incremental_binary::relocs_reader): New function.
2596 (Sized_incremental_binary::got_plt_reader): New function.
2597 (Sized_incremental_binary::do_file_is_unchanged): New function.
2598 (Sized_incremental_binary::Sized_input_reader): New class.
2599 (Sized_incremental_binary::get_input_reader): New function.
2600 (Sized_incremental_binary::find_incremental_inputs_sections):
2601 Rename do_find_incremental_inputs_sections to this.
2602 (Sized_incremental_binary::setup_readers): New function.
2603 (Sized_incremental_binary::has_incremental_info_): New data member.
2604 (Sized_incremental_binary::inputs_reader_): New data member.
2605 (Sized_incremental_binary::symtab_reader_): New data member.
2606 (Sized_incremental_binary::relocs_reader_): New data member.
2607 (Sized_incremental_binary::got_plt_reader_): New data member.
2608 (Sized_incremental_binary::current_input_file_): New data member.
2609
a869183f
PP
26102011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2611
2612 PR gold/12640
2613 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2614 violation.
2615
26162011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
2617
2618 * archive.cc (Archive::include_member): Adjust call to report_object.
2619 (Add_archive_symbols::run): Add script_info to call to
2620 report_archive_begin.
2621 (Lib_group::include_member): Adjust call to report_object.
2622 (Add_lib_group_symbols::run): Adjust call to report_object.
2623 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2624 blocks. Add object count for script input files.
2625 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2626 script_info parameter; change all callers.
2627 (Incremental_inputs::report_object): Add script_info parameter;
2628 change all callers.
2629 (Incremental_inputs::report_script): Store backpointer to
2630 incremental info entry.
2631 (Output_section_incremental_inputs::set_final_data_size): Record
2632 additional information for scripts.
2633 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2634 * incremental.h (Incremental_script_entry::add_object): New function.
2635 (Incremental_script_entry::get_object_count): New function.
2636 (Incremental_script_entry::get_object): New function.
2637 (Incremental_script_entry::objects_): New data member; adjust
2638 constructor.
2639 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2640 (Incremental_inputs::report_object): Add script_info parameter.
2641 (Incremental_inputs_reader::get_object_count): New function.
2642 (Incremental_inputs_reader::get_object_offset): New function.
2643 * options.cc (Input_arguments::add_file): Return reference to
2644 new input argument.
2645 * options.h (Input_argument::set_script_info): New function.
2646 (Input_argument::script_info): New function.
2647 (Input_argument::script_info_): New data member; adjust all
2648 constructors.
2649 (Input_file_group::add_file): Return reference to new input argument.
2650 (Input_file_lib::add_file): Likewise.
2651 (Input_arguments::add_file): Likewise.
2652 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2653 * script.cc (Parser_closure::Parser_closure): Add script_info
2654 parameter; adjust all callers.
2655 (Parser_closure::script_info): New function.
2656 (Parser_closure::script_info_): New data member.
2657 (read_input_script): Report scripts earlier to incremental info.
2658 (script_add_file): Set script_info in Input_argument.
2659 (script_add_library): Likewise.
2660 * script.h (Script_options::Script_info): Rewrite class.
2661
a869183f 26622011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
2663
2664 * archive.cc (Library_base::should_include_member): Move
2665 method here from class Archive.
2666 (Archive::Archive): Initialize base class.
2667 (Archive::should_include_member): Move to base class.
2668 (Archive::do_for_all_unused_symbols): New function.
2669 (Add_archive_symbols::run): Remove redundant access to
2670 incremental_inputs.
2671 (Lib_group::Lib_group): Initialize base class.
2672 (Lib_group::do_filename): New function.
2673 (Lib_group::include_member): Pass pointer to Lib_group to
2674 report_object.
2675 (Lib_group::do_for_all_unused_symbols): New function.
2676 (Add_lib_group_symbols::run): Report archive information for
2677 incremental links.
2678 * archive.h (class Library_base): New base class.
2679 (class Archive): Derive from Library_base.
2680 (Archive::filename): Move to base class.
2681 (Archive::set_incremental_info): Likewise.
2682 (Archive::incremental_info): Likewise.
2683 (Archive::Should_include): Likewise.
2684 (Archive::should_include_member): Likewise.
2685 (Archive::Armap_entry): Remove.
2686 (Archive::Unused_symbol_iterator): Remove.
2687 (Archive::unused_symbols_begin): Remove.
2688 (Archive::unused_symbols_end): Remove.
2689 (Archive::do_filename): New function.
2690 (Archive::do_get_mtime): New function.
2691 (Archive::do_for_all_unused_symbols): New function.
2692 (Archive::task_): Move to base class.
2693 (Archive::incremental_info_): Likewise.
2694 (class Lib_group): Derive from Library_base.
2695 (Lib_group::do_filename): New function.
2696 (Lib_group::do_get_mtime): New function.
2697 (Lib_group::do_for_all_unused_symbols): New function.
2698 (Lib_group::task_): Move to base class.
2699 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2700 function.
2701 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2702 function.
2703 * incremental.cc (Incremental_inputs::report_archive_begin):
2704 Use Library_base; call library's get_mtime; add incremental inputs
2705 entry before members.
2706 (class Unused_symbol_visitor): New class.
2707 (Incremental_inputs::report_archive_end): Use Library_base; use
2708 visitor class to record unused symbols; don't add incremental inputs
2709 entry after members.
2710 (Incremental_inputs::report_object): Use Library_base.
2711 * incremental.h
2712 (Incremental_archive_entry::Incremental_archive_entry): Remove
2713 unused Archive parameter.
2714 (Incremental_inputs::report_archive_begin): Use Library_base.
2715 (Incremental_inputs::report_archive_end): Likewise.
2716 (Incremental_inputs::report_object): Likewise.
2717 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2718 function.
2719 * object.h (Object::for_all_global_symbols): New function.
2720 (Object::do_for_all_global_symbols): New function.
2721 (Sized_relobj::do_for_all_global_symbols): New function.
2722 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2723 function.
2724 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2725 function.
2726
61ab3e40
ILT
27272011-03-27 Ian Lance Taylor <iant@google.com>
2728
2729 * archive.cc (Archive::interpret_header): Return -1 if something
2730 goes wrong. Change callers accordingly.
2731
30e1f9e6
CC
27322011-03-25 Cary Coutant <ccoutant@google.com>
2733
2734 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2735 * testsuite/Makefile.in: Regenerate.
2736
9370ce59 27372011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
9c793f14
RÁE
2738
2739 * plugin.cc (get_view): New.
2740 (Plugin::load): Pass get_view to the plugin.
2741 (Plugin_manager::get_view): New.
2742
9312bb0a
ILT
27432011-03-21 Ian Lance Taylor <iant@google.com>
2744
2745 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 2746 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 2747
7e12ba9e
ST
27482011-03-21 Sriraman Tallam <tmsriram@google.com>
2749
2750 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2751 Change == to -eq.
2752 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2753 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2754 Change == to -eq.
2755 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2756 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2757
fd7a005d
ILT
27582011-03-14 Ian Lance Taylor <iant@google.com>
2759
2760 * script-sections.cc (Sort_output_sections::script_compare):
2761 Rename from is_before, change return type.
2762 (Sort_output_sections::operator()): Adjust accordingly.
2763
ed16fd1b
ILT
27642011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2765
2766 PR gold/12572
2767 * testsuite/odr_violation2.cc: Add comment to make all error line
2768 numbers double digits.
2769 * testsuite/debug_msg.sh: Adjust expected errors.
2770
71ff8986
ILT
27712011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2772
2773 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2774 but mark earlier ones as non-canonical
2775 (offset_to_iterator): Update search target and example
2776 (do_addr2line): Return extra lines in a vector*
2777 (format_file_lineno): Extract from do_addr2line
2778 (one_addr2line): Add vector* out-param
2779 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2780 when a lineno entry appeared last for its instruction
2781 (Dwarf_line_info): Add vector* out-param
2782 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2783 * symtab.cc (Odr_violation_compare): Include the lineno in the
2784 comparison again.
2785 (linenos_from_loc): New. Combine the canonical line for an
2786 address with its other lines.
2787 (True_if_intersect): New. Helper functor to make
2788 std::set_intersection a query.
2789 (detect_odr_violations): Compare sets of lines instead of just
2790 one line for each function. This became less deterministic, but
2791 has fewer false positives.
2792 * symtab.h: Declarations.
2793 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2794 mix an optimized and non-optimized object in the same binary
2795 (odr_violation2.so): Same.
2796 * testsuite/Makefile.in: Regenerate from Makefile.am.
2797 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2798 * testsuite/debug_msg.sh: Update line numbers and add
2799 assertions.
2800 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2801 non-optimized context.
2802 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2803 isn't inlined, and use OdrDerived in an optimized context.
2804 * testsuite/odr_header1.h: Defines OdrDerived, where
2805 optimization will change the
2806 first-instruction-in-the-destructor's file and line number.
2807 * testsuite/odr_header2.h: Defines OdrBase.
2808
a19fefdc
ILT
28092011-03-09 Ian Lance Taylor <iant@google.com>
2810
2811 * fileread.cc (File_read::clear_views): Don't delete the whole
2812 file view.
2813
ecb351e9
ILT
28142011-03-08 Ian Lance Taylor <iant@google.com>
2815
2816 PR gold/12525
2817 * fileread.cc: #include <climits>.
2818 (GOLD_IOV_MAX): Define.
2819 (File_read::read_multiple): Limit number of entries by iov_max.
2820 * fileread.h (class File_read): Always set max_readv_entries to
2821 128.
2822
b821d13c
ILT
28232011-03-07 Ian Lance Taylor <iant@google.com>
2824
2825 PR gold/12525
2826 * options.h (class General_options): Add -dy and -dn.
2827
89243142
CC
28282011-03-02 Cary Coutant <ccoutant@google.com>
2829
2830 * testsuite/script_test_9.t: Add TLS segment.
2831
d0773f31
ILT
28322011-03-02 Simon Baldwin <simonb@google.com>
2833
2834 * configure.ac: Add check for gnu_indirect_function support in
2835 the toolchain building binutils.
2836 * configure: Rebuild.
2837
9370ce59 28382011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
badc8139
RÁE
2839
2840 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2841 plugin only symbols.
2842 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2843 in plugin files as not needed in the symbol table.
2844
4cf7a849
ST
28452011-02-11 Sriraman Tallam <tmsriram@google.com>
2846
2847 * output.cc (Output_section::add_input_section): Delay fill
2848 generation for section ordering.
2849
b578bd7d
ILT
28502011-02-09 Ian Lance Taylor <iant@google.com>
2851
2852 PR gold/12316
2853 * object.h (class Sized_relobj): Remove clear_local_symbols.
2854 * reloc.cc (Sized_relobj::do_relocate): Don't call
2855 clear_local_symbols.
2856
9370ce59 28572011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
84ced98a
RÁE
2858
2859 * plugin.cc (is_visible_from_outside): Return true for symbols
2860 in the -u option.
2861
55382fb7
ILT
28622011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2863
2864 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2865 filename.
2866
4e271fff
ST
28672011-02-02 Sriraman Tallam <tmsriram@google.com>
2868
2869 * icf.h (is_section_foldable_candidate): Change type of parameter
2870 to std::string.
2871 * icf.cc (Icf::find_identical_sections): Change type of local variable
2872 section_name to be std::string.
2873 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2874
d433c3ac
ILT
28752011-01-25 Ian Lance Taylor <iant@google.com>
2876
2877 * script.cc (script_add_extern): Rewrite to use
2878 add_symbol_reference.
2879
880473a6
DK
28802011-01-25 Doug Kwan <dougkwan@google.com>
2881
d433c3ac 2882 * icf.cc (get_section_contents): Always lock section's object.
880473a6 2883
f30f86fa
ILT
28842011-01-24 Ian Lance Taylor <iant@google.com>
2885
2886 * options.h (class General_options): Accept
2887 --no-detect-odr-violations.
2888
8e51a0b9
ILT
28892011-01-24 Ian Lance Taylor <iant@google.com>
2890
2891 * version.cc (version_string): Bump to 1.11.
2892
0f3b89d8
ILT
28932011-01-24 Ian Lance Taylor <iant@google.com>
2894
2895 * plugin.cc (class Plugin_rescan): Define new class.
2896 (Plugin_manager::claim_file): Set any_claimed_.
2897 (Plugin_manager::save_archive): New function.
2898 (Plugin_manager::save_input_group): New function.
2899 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2900 necessary.
2901 (Plugin_manager::new_undefined_symbol): New function.
2902 (Plugin_manager::rescan): New function.
2903 (Plugin_manager::rescannable_defines): New function.
2904 (Plugin_manager::add_input_file): Set any_added_.
2905 * plugin.h (class Plugin_manager): define new fields rescannable_,
2906 undefined_symbols_, any_claimed_, and any_added_. Declare
2907 Plugin_rescan as friend. Declare new functions.
2908 (Plugin_manager::Rescannable): Define type.
2909 (Plugin_manager::Rescannable_list): Define type.
2910 (Plugin_manager::Undefined_symbol_list): Define type.
2911 (Plugin_manager::Plugin_manager): Initialize new fields.
2912 * archive.cc (Archive::defines_symbol): New function.
2913 (Add_archive_symbols::run): Pass archive to plugins if any.
2914 * archive.h (class Archive): Declare defines_symbol.
2915 * readsyms.cc (Input_group::~Input_group): New function.
2916 (Finish_group::run): Pass input_group to plugins if any.
2917 * readsyms.h (class Input_group): Declare destructor.
2918 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2919 any.
2920
3bb951e5
ILT
29212011-01-10 Ian Lance Taylor <iant@google.com>
2922
2923 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2924 section as relro.
2925 (Layout::set_segment_offsets): Reset increase_relro before calling
2926 set_section_addresses a second time.
2927
0aa45fac
CC
29282011-01-04 Cary Coutant <ccoutant@google.com>
2929
2930 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2931 sections before NOBITS sections.
2932
0db46eb4
L
29332011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2934
2935 * version.cc (print_version): Update copyright to 2011.
2936
829c9745
CC
29372010-12-23 Cary Coutant <ccoutant@google.com>
2938
2939 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2940 of OS to this->add. Add OD parameter to second form of the function.
2941
7500420b
ILT
29422010-12-20 Ian Lance Taylor <iant@google.com>
2943
2944 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2945 second of two consecutive entries with same offset.
2946
f8e9a930
RW
29472010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2948
2949 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2950 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2951 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2952 to avoid unneeded links against $(LDADD).
2953 * testsuite/Makefile.in: Regenerate.
2954
2fbb4320
ILT
29552010-12-15 Ian Lance Taylor <iant@google.com>
2956
2957 PR gold/12324
2958 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2959 for R_X86_64_32 and R_X86_64_PC32.
2960 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2961 ver_matching_def_pic.o.
2962 (ver_matching_def_pic.o): New target.
2963
fedb228d
RW
29642010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2965
2966 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2967 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2968 Move definition before File_read::View member definitions.
2969 (File_read::View::~View): Initialize and hold lock before
2970 updating current_mapped_bytes.
2971
9b547ce6
RW
29722010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2973
2974 * dwarf_reader.cc: Remove outdated comment.
2975 * gold-threads.cc: Fix typo in error message.
2976 * archive.cc: Fix typos in comments.
2977 * archive.h: Likewise.
2978 * arm-reloc-property.cc: Likewise.
2979 * arm-reloc-property.h: Likewise.
2980 * arm-reloc.def: Likewise.
2981 * arm.cc: Likewise.
2982 * attributes.h: Likewise.
2983 * cref.cc: Likewise.
2984 * ehframe.cc: Likewise.
2985 * fileread.h: Likewise.
2986 * gold.h: Likewise.
2987 * i386.cc: Likewise.
2988 * icf.cc: Likewise.
2989 * incremental.h: Likewise.
2990 * int_encoding.cc: Likewise.
2991 * layout.h: Likewise.
2992 * main.cc: Likewise.
2993 * merge.h: Likewise.
2994 * object.cc: Likewise.
2995 * object.h: Likewise.
2996 * options.cc: Likewise.
2997 * readsyms.cc: Likewise.
2998 * reduced_debug_output.cc: Likewise.
2999 * reloc.cc: Likewise.
3000 * script-sections.cc: Likewise.
3001 * sparc.cc: Likewise.
3002 * symtab.h: Likewise.
3003 * target-reloc.h: Likewise.
3004 * target.cc: Likewise.
3005 * target.h: Likewise.
3006 * timer.cc: Likewise.
3007 * timer.h: Likewise.
3008 * x86_64.cc: Likewise.
3009
83e17bd5
CC
30102010-12-09 Cary Coutant <ccoutant@google.com>
3011
3012 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3013 stack.
3014 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3015 parameter; change all callers.
3016 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3017 * options.h (warn_execstack): New option.
3018
017257f8
DK
30192010-12-07 Doug Kwan <dougkwan@google.com>
3020
3021 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3022 like function call relocations.
3023
c20cbc06
ILT
30242010-12-07 Ian Lance Taylor <iant@google.com>
3025
3026 * archive.cc (Archive::get_elf_object_for_member): Permit
3027 punconfigured to be NULL.
3028 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3029 (Archive::include_member): Pass NULL to get_elf_object_for_member
3030 if we searched for the archive and this is the first included
3031 object.
3032
4dbfafcc
ILT
30332010-12-01 Ian Lance Taylor <iant@google.com>
3034
3035 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3036 track_relocs_type_ field.
3037 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3038 Set track_relocs_type_.
3039 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3040 contents when using RELA relocs.
3041 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3042 reloc_map_.
3043 * reloc.cc (Track_relocs::next_addend): New function.
3044 * reloc.h (class Track_relocs): Declare next_addend.
3045
e5e19edd
ILT
30462010-12-01 Ian Lance Taylor <iant@google.com>
3047
3048 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3049 virtual destructor.
3050
9a5ce24c
ILT
30512010-12-01 Ian Lance Taylor <iant@google.com>
3052
3053 * README: Update compilers known to work and fail.
3054
c7791212
NC
30552010-11-23 Matthias Klose <doko@ubuntu.com>
3056
3057 * configure.in: For --enable-gold, handle value `default' instead of
3058 `both*'. Always install ld as ld.bfd, install as ld if gold is
3059 not the default.
3060 * configure: Regenerate.
3061
0ad220c9
DK
30622010-11-18 Doug Kwan <dougkwan@google.com>
3063
3064 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3065 and right_alignment to be zero. Store result alignment only if it is
3066 greater than existing alignment.
3067
ab8056e0
CC
30682010-11-16 Cary Coutant <ccoutant@google.com>
3069
3070 PR gold/12220
3071 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3072 Check for ".zdebug_line".
3073
fd064a5b
CC
30742010-11-16 Doug Kwan <dougkwan@google.com>
3075 Cary Coutant <ccoutant@google.com>
3076
3077 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3078 by reference; adjust all callers.
3079 * output.cc (Output_segment::set_section_addresses): Adjust references
3080 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3081 list is empty.
3082 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3083 end at page boundary.
3084
6fc6ea19
CC
30852010-11-16 Cary Coutant <ccoutant@google.com>
3086
3087 PR gold/12220
3088 * layout.cc (Layout::choose_output_section): Transform names of
3089 compressed sections even when using a script with a SECTIONS clause.
3090 (Layout::output_section_name): Remove code to transform
3091 compressed debug section names.
3092 * output.cc (Output_section::add_input_section): Use uncompressed
3093 section size when tracking input sections.
3094
95a2c8d6
RS
30952010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3096
3097 * symtab.h (Symbol::NON_PIC_REF): Remove.
3098 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3099 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3100 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3101 (Symbol::use_plt_offset): Take a flags argument and pass it
3102 directly to needs_dynamic_reloc. Restrict check for undefined
3103 weak symbols to function calls.
3104 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3105 (Target_arm::Scan::global): Use it.
3106 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3107 (Target_arm::Relocate::relocate): Likewise.
3108 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3109 parameter with an r_type parameter. Use get_reference_flags
3110 to get the flags.
3111 (Target_arm::Relocate::relocate): Update accordingly.
3112 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3113 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3114 (Target_i386::Scan::global): Likewise.
3115 (Target_i386::Relocate::relocate): Likewise.
3116 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3117 parameter with an r_type parameter. Use get_reference_flags
3118 to get the flags.
3119 (Target_i386::Relocate::relocate): Update accordingly.
3120 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3121 (Target_powerpc::Scan::global): Use it.
3122 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3123 (Target_powerpc::Relocate::relocate): Likewise.
3124 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3125 (Target_sparc::Scan::global): Use it.
3126 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3127 (Target_sparc::Relocate::relocate): Likewise.
3128 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3129 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3130 (Target_x86_64::Scan::global): Likewise.
3131 (Target_x86_64::Relocate::relocate): Likewise.
3132
f625ae50
DK
31332010-11-08 Doug Kwan <dougkwan@google.com>
3134 Cary Coutant <ccoutant@google.com>
3135
3136 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3137 (Arm_exidx_merge_section::section_contents_): New data member.
3138 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3139 (Arm_input_section::~Arm_input_section): De-allocate memory.
3140 (Arm_input_section::original_contents_): New data member.
3141 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3142 in parameters instead of calling Object::section_contents without
3143 locking.
3144 (Arm_output_section::group_section): New parameter TASK. Pass it
3145 to callees that need locking objects.
3146 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3147 to lock EXIDX input sections. Fix a formatting issue. Call
3148 Arm_exidx_merged_section::build_contents to create merged section
3149 contents.
3150 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3151 to lock object of stub table owner.
3152 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3153 TEXT_SIZE to initialize data member TEXT_SIZE_.
3154 (Arm_exidx_input_section::addralign): Fix typo in comment.
3155 (Arm_exidx_input_section::text_size): New method.
3156 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3157 that require locking objects. Lock objects before scanning for stubs
3158 and updating local symbols.
3159 (Arm_input_section<big_endian>::init): Copy contents of original
3160 input section.
3161 (Arm_input_section<big_endian>::do_write): Use saved contents of
3162 original input section instead of calling Object::section_contents
3163 without locking.
3164 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3165 size without calling Object::section_size().
3166 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3167 for size. Allocate a buffer for merged EXIDX entries.
3168 (Arm_exidx_merged_section::build_contents): New method.
3169 (Arm_exidx_merged_section::do_write): Move merge section contents
3170 building code to Arm_exidx_merged_section::build_contetns. Write
3171 out contetns in buffer instead of building it on the fly.
3172 (Arm_relobj::make_exidx_input_section): Also pass text section size
3173 to Arm_exidx_input_section constructor.
3174 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3175 (Arm_dynobj::do_read_symbols): Fix memory leak.
3176 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3177 * target.h: (class Task): Add forward declaration.
3178 (Target::relax): Add new parameter TASK and pass it to
3179 Target::do_relax().
3180 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3181
5f9bcf58
CC
31822010-11-05 Cary Coutant <ccoutant@google.com>
3183
3184 PR gold/10708
3185 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3186 object when reading from the file.
3187 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3188 second layout pass.
3189 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3190 when reading section contents.
3191 (get_section_contents): Likewise.
3192 (icf::find_identical_sections): Likewise.
3193 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3194 object when reading from the file.
3195 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3196 the object when doing deferred section layout.
3197
e597fa08
NC
31982010-11-03 Nick Clifton <nickc@redhat.com>
3199
3200 PR gold/12001
3201 * script.h (class Symbol_assignment: name): New member. Returns
3202 the name of the symbol.
3203 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3204 Returns true if the given symbol name is on the list of
3205 assignments wating to be processed.
3206 * archive.cc (should_incldue_member): If the symbol is undefined,
3207 check to see if it is on the list of symbols pending assignment.
3208
3f9a3278
ILT
32092010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3210
3211 * script-sections.cc (Script_sections::find_memory_region): Check
3212 for a NULL output section pointer.
3213
d06fb4d1
DK
32142010-10-29 Doug Kwan <dougkwan@google.com>
3215
3216 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3217 Output_section::add_relaxed_input_section.
3218 * output.cc (Output_section::add_relaxed_input_section): Add new
3219 arguments LAYOUT and NAME. Set section order index.
3220 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3221 Copy section order index.
3222 * output.h (Output_section::add_relaxed_input_section): Add new
3223 arguments LAYOUT and NAME.
3224
90e24de5
ILT
32252010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3226
3227 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3228 NATIVE_OR_CROSS_LINKER.
3229 * testsuite/Makefile.in: Regenerate.
3230
c9484ea5
DK
32312010-10-20 Doug Kwan <dougkwan@google.com>
3232
3233 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3234 without SHF_LINK_ORDER flags.
3235 * layout.cc (Layout::choose_output_section): Do not filter
3236 SHF_LINK_ORDER flag in a relocatable link.
3237
5bc2f5be
CC
32382010-10-17 Cary Coutant <ccoutant@google.com>
3239
3240 * output.h (Output_segment::set_section_addresses): Change function
3241 signature. Update all callers.
3242 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3243 sections.
3244 (Output_segment::set_section_addresses): Align after last TLS
3245 section. Add padding before last relro section instead of after.
3246
0c91cf04
DK
32472010-10-17 Doug Kwan <dougkwan@google.com>
3248
3249 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3250 GOT output section to be writable.
3251
8c21d9d3
CC
32522010-10-14 Cary Coutant <ccoutant@google.com>
3253
3254 * debug.h (DEBUG_INCREMENTAL): New flag.
3255 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3256 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3257 mode.
3258 * incremental.cc (report_command_line): Ignore all forms of
3259 --incremental.
3260 * layout.cc (Layout::Layout): Check parameters for incremental link
3261 mode.
3262 * options.cc (General_options::parse_incremental): New function.
3263 (General_options::parse_no_incremental): New function.
3264 (General_options::parse_incremental_full): New function.
3265 (General_options::parse_incremental_update): New function.
3266 (General_options::incremental_mode_): New data member.
3267 (General_options::finalize): Check incremental_mode_.
3268 * options.h (General_options): Update help text for --incremental.
3269 Add --no-incremental, --incremental-full, --incremental-update.
3270 (General_options::Incremental_mode): New enum type.
3271 (General_options::incremental_mode): New function.
3272 (General_options::incremental_mode_): New data member.
3273 * parameters.cc (Parameters::incremental_mode_): New data member.
3274 (Parameters::set_options): Set incremental_mode_.
3275 (Parameters::set_incremental_full): New function.
3276 (Parameters::incremental): New function.
3277 (Parameters::incremental_update): New function.
3278 (set_parameters_incremental_full): New function.
3279 * parameters.h (Parameters::set_incremental_full): New function.
3280 (Parameters::incremental): New function.
3281 (Parameters::incremental_update): New function.
3282 (Parameters::incremental_mode_): New data member.
3283 (set_parameters_incremental_full): New function.
3284 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3285 incremental link mode.
3286 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3287 (Sized_relobj::do_relocate_sections): Likewise.
3288 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3289 option.
3290 * testsuite/Makefile.in: Regenerate.
3291 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3292
bb32aa18 32932010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
3294
3295 * script-sections.h (class Script_sections): Make
3296 Sections_elements typedef public.
3297 * script-sections.cc (class Sort_output_sections): Add elements_
3298 field. Add constructor which sets it; change all callers.
3299 (Sort_output_sections::is_before): New function.
3300 (Sort_output_sections::operator()): Call is_before.
3301 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3302 conditional.
3303 * testsuite/script_test_10.sh: New test. Test script section
3304 order.
3305 * testsuite/script_test_10.t: Likewise.
3306 * testsuite/script_test_10.s: Likewise.
3307 * testsuite/Makefile.am: Wrap the cross linker tests and the
3308 common tests into NATIVE_OR_CROSS_LINKER.
3309 (check_SCRIPTS): Add script_test_10.sh.
3310 (check_DATA): Add script_test_10.stdout.
3311 (script_test_10.o, script_test_10): New targets.
3312 (script_test_10.stdout): New target.
3313 * configure, testsuite/Makefile.in: Regenerate.
3314
3cef7179
ILT
33152010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3316
3317 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3318 error for the deprecated relocations.
3319 (Target_arm::Scan::global): Likewise.
3320 (Target_arm::Relocate::relocate): Likewise.
3321
7411e9a8
RS
33222010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3323
3324 * fileread.cc (Input_file::find_file): Initialize *found_name
3325 and *namep when using the fallback search for case 4.
3326
6a9da32a
CC
33272010-10-11 Cary Coutant <ccoutant@google.com>
3328
3329 * options.h (class General_options): Redefine -z lazy as an alias for
3330 the negation of -z now.
3331
ac897c20
ILT
33322010-10-11 Ian Lance Taylor <iant@google.com>
3333
3334 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3335 binding.
3336
ea5cae92
NC
33372010-10-06 Nick Clifton <nickc@redhat.com>
3338
3339 * script-sections.cc(class Memory_region): Remove
3340 current_lma_offset_ field. Rename current_vma_offset_ to
3341 current_offset_. Add last_section_ field.
3342 (Memory_region::get_current_vma_address): Rename to
3343 get_current_address.
3344 (Memory_region::get_current_lma_address): Delete.
3345 (Memory_region::increment_vma_offset): Rename to
3346 increment_offset.
3347 (Memory_region::increment_lma_offset): Delete.
3348 (Memory_region::attributes_compatible): New method. Returns
3349 true if the provided section is compatible with the region.
3350 (Memory_region::get_last_section): New method. Returns the last
3351 section to use the region.
3352 (Memory_region::set_last_section): New method. Stores the last
3353 section to use the region.
3354 (Script_sections::block_in_region): New method. Returns true if
3355 a block of memory is contained within a region.
3356 (Script_sections::find_memory_region): New method. Locates a
3357 memory region to be used to set a VMA or LMA address.
3358 (Output_section_definition::set_section_addresses): Add code to
3359 check for addresses set by memory regions.
3360 (Output_segment::set_section_addresses): Remove memory region
3361 walking code.
3362 (Script_sections::create_segment): Add a warning if a header
3363 segment is created outside of any region.
3364 * script-sections.h (class Script_sections): Add prototypes for
3365 find_memory_region and block_in_region methods.
3366 * testsuite/memory_test.s: Use .long instead of .word.
3367 * testsuite/memory_test.t: Add some more output sections.
3368 * testsuite/memory_test.sh: Update expected output.
3369
a9bfd952
DK
33702010-10-02 Doug Kwan <dougkwan@google.com>
3371
3372 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3373 defintion to symtab.h
3374 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3375 declaration to defintion.
3376
bacff3ab
NC
33772010-10-01 Nick Clifton <nickc@redhat.com>
3378
3379 * expression.cc (eval): Replace dummy argument with NULL.
3380 (eval_maybe_dot): Check for a NULL result section pointer.
3381 (Symbol_expression::value): Likewise.
3382 (Dot_expression::value): Likewise.
3383 (BINARY_EXPRESSION): Likewise.
3384 (Max_expression::value): Likewise.
3385 (Min_expression::value): Likewise.
3386 (Absolute_expression::value): Likewise.
3387 (Addr_expression::value_from_output_section): Likewise.
3388 (Loaddddr_expression::value_from_output_section): Likewise.
3389 (Segment_start_expression::value): Likewise.
3390 * script-sections.cc
3391 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3392 argument with NULL.
3393 (Sections_elememt_dot_assignment::set_section_addresses):
3394 Likewise.
3395 (Output_data_expression::do_write_to_buffer): Likewise.
3396 (Output_section_definition::finalize_symbols): Likewise.
3397 (Output_section_definition::set_section_addresses): Likewise.
3398
f81bc8b5
DK
33992010-09-30 Doug Kwan <dougkwan@google.com>
3400
3401 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3402
c95e9f27
ST
34032010-09-28 Sriraman Tallam <tmsriram@google.com>
3404
3405 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 3406 function.
c95e9f27
ST
3407 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3408 virtual function.
3409 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3410 virtual function.
3411 * icf.cc (get_section_contents): Inline merge sections only when
3412 target allows it.
3413
3cac54d2
RW
34142010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3415
3416 * configure: Regenerate.
3417
2904037a
ILT
34182010-09-17 Ian Lance Taylor <iant@google.com>
3419
3420 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
3421 * testsuite/Makefile.am (memory_test.o): New target.
3422 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3423 memory_test.t.
3424 * testsuite/Makefile.in: Rebuild.
2904037a 3425
bca7fb63
DK
34262010-09-17 Doug Kwan <dougkwan@google.com>
3427
3428 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3429 defintion if relocation uses GOT entries of the symbol.
3430 * testsuite/icf_safe_test.sh: Fix test.
3431 * testsuite/icf_safe_so_test.sh: Fix test.
3432
4ef28648
CC
34332010-09-16 Cary Coutant <ccoutant@google.com>
3434
3435 * script_sections.cc (class Memory_region): Remove "NULL" from
3436 vector initializations.
3437
793990de
CC
34382010-09-15 Cary Coutant <ccoutant@google.com>
3439
3440 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3441 Resolve forwarding symbols.
3442
81e015e2
DK
34432010-09-15 Doug Kwan <dougkwan@google.com>
3444
3445 * gold/testsuite/script_test_3.t: Add ARM special sections.
3446 * gold/testsuite/script_test_4.t: Same.
3447 * gold/testsuite/script_test_5.t: Same.
3448 * gold/testsuite/script_test_6.t: Same.
3449 * gold/testsuite/script_test_7.t: Same.
3450 * gold/testsuite/script_test_7.t: Same.
3451 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3452
36171d64
CC
34532010-09-14 Cary Coutant <ccoutant@google.com>
3454
3455 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3456 (Target_x86_64::Relocate::relocate_tls): Replace check for
3457 saw_tls_block_reloc_ with test for executable section.
3458
d89051bd
CC
34592010-09-12 Cary Coutant <ccoutant@google.com>
3460
3461 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3462 position-independent executables to shared libraries need dynamic
3463 relocations.
3464 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3465 position-independent executables.
3466 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3467 * testsuite/Makefile.in: Regenerate.
3468
fca41f0f
NC
34692010-09-10 Nick Clifton <nickc@redhat.com>
3470
3471 PR gold/11997
3472 * testsuite/memory_test.t: Discard any sections that are not
3473 needed.
3474
6695e4b3
L
34752010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3476
3477 PR gold/11996
3478 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3479 "This::" to work around a bug in gcc 4.2.
3480
3481 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3482
0f72bf6f
RÁE
34832010-09-09 Rafael Espindola <espindola@google.com>
3484
3485 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3486 sections with different PF_X flags in the same segment.
3487 (Layout::find_first_load_seg): Search all segments to find the first
3488 one.
3489 * options.h (rosegment): New.
3490
34912010-09-08 Rafael Espindola <espindola@google.com>
a6577478 3492
05a79166 3493 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 3494
aa98ff75
DK
34952010-09-08 Doug Kwan <dougkwan@google.com>
3496
3497 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3498 (Arm_relobj::do_relocate_sections): Add new parameter for output
3499 file to match the parent.
3500 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3501 of local symbols instead of input values. Update code to track
3502 changes in gold::relocate_section.
3503 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3504 (Sized_relobj::compute_final_local_value_internal): New methods.
3505 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3506 body into private version of Sized_relobj::compute_final_local_value.
3507 Call the inline method.
3508 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3509 merged symbol value if there is one.
3510 (Symbol_value::has_output_value): New method defintiion.
3511 (Sized_relobj::Compute_final_local_value_status): New enum type.
3512 (Sized_relobj::compute_final_local_value): New methods.
3513 (Sized_relobj::compute_final_local_value_internal): New methods.
3514 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3515 and arm_cortex_a8.sh.
3516 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3517 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3518 New tests.
3519 * Makefile.in: Regenerate.
3520 * testsuite/arm_bl_out_of_range.s: Update test.
3521 * testsuite/thumb_bl_out_of_range.s: Ditto.
3522 * testsuite/thumb_blx_out_of_range.s: Ditto.
3523 * testsuite/arm_branch_out_of_range.sh: New file.
3524 * testsuite/arm_cortex_a8.sh: Ditto.
3525 * testsuite/arm_cortex_a8_b.s: Ditto.
3526 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3527 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3528 * testsuite/arm_cortex_a8_bl.s: Ditto.
3529 * testsuite/arm_cortex_a8_blx.s: Ditto.
3530 * testsuite/arm_cortex_a8_local.s: Ditto.
3531 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3532 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3533
05a79166
L
35342010-09-08 Rafael Espindola <espindola@google.com>
3535
3536 * Makefile.am (memory_test.stdout): Run readelf with -W.
3537 * Makefile.in: Regenerate.
3538 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3539 64 bit output.
3540
33dbc701
RÁE
35412010-09-08 Rafael Espindola <espindola@google.com>
3542
3543 * script-sections.cc (Script_sections::add_memory_region): Convert
3544 field precision to int.
3545 * script.cc (script_set_section_region, script_set_section_region):
3546 Convert field precision to int.
3547
731ca54a
RÁE
35482010-09-08 Rafael Espindola <espindola@google.com>
3549
3550 * arm.cc (do_finalize_sections): Create the __exidx_start and
3551 __exdix_end symbols even when the section is missing.
3552
7f8cd844
NC
35532010-09-08 Nick Clifton <nickc@redhat.com>
3554
3555 * README: Remove claim that MEMORY is not supported.
3556 * expression.cc (script_exp_function_origin)
3557 (script_exp_function_length): Move from here to ...
3558 * script.cc: ... here.
3559 (script_set_section_region, script_add_memory)
3560 (script_parse_memory_attr, script_include_directive): New
3561 functions.
3562 * script-sections.cc
3563 (class Memory_region): New class.
3564 (class Output_section_definition): Add set_memory_region,
3565 set_section_vma, set_section_lma and get_section_name methods.
3566 (class Script_Sections): Add add_memory_region,
3567 find_memory_region, find_memory_region_origin,
3568 find_memory_region_length and set_memory_region methods.
3569 Have set_section_addresses method walk the list of set memory
3570 regions.
3571 Extend the print methos to display memory regions.
3572 * script-sections.h: Add prototypes for new methods.
3573 Add enum for MEMORY region attributes.
3574 * yyscript.y: Add support for parsing MEMORY regions.
3575 * script-c.h: Add prototypes for new functions.
3576 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3577 * testsuite/Makefile.in: Regenerate.
3578 * testsuite/memory_test.sh: New script.
3579 * testsuite/memory_test.s: New assembler source file.
3580 * testsuite/memory_test.t: New linker script.
3581
a4649286
DK
35822010-08-27 Doug Kwan <dougkwan@google.com>
3583
3584 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3585 reference override an existing dynamic weak reference.
3586 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3587 * testsuite/Makefile.in: Regenerate.
3588 * testsuite/dyn_weak_ref.sh: New file.
3589 * testsuite/dyn_weak_ref_1.c: Ditto.
3590 * testsuite/dyn_weak_ref_2.c: Ditto.
3591
b56648ad
ILT
35922010-08-27 Ian Lance Taylor <iant@google.com>
3593
3594 * incremental.h (class Incremental_input_entry): Add virtual
3595 destructor.
3596
809313cb
ILT
35972010-08-27 Ian Lance Taylor <iant@google.com>
3598
3599 * testsuite/start_lib_test_3.c: Mark t3 as used.
3600
11e32464
NC
36012010-08-27 Nick Clifton <nickc@redhat.com>
3602
3603 * options.cc (version_script): Fix small typo in previous
3604 whitespace tidyup.
3605
ca09d69a
NC
36062010-08-25 Nick Clifton <nickc@redhat.com>
3607
3608 * archive.cc: Formatting fixes: Remove whitespace between
3609 typename and following asterisk. Remove whitespace between
3610 function name and opening parenthesis.
3611 * archive.h: Likewise.
3612 * arm.cc: Likewise.
3613 * attributes.cc: Likewise.
3614 * attributes.h: Likewise.
3615 * common.cc: Likewise.
3616 * copy-relocs.cc: Likewise.
3617 * dirsearch.h: Likewise.
3618 * dynobj.cc: Likewise.
3619 * ehframe.cc: Likewise.
3620 * ehframe.h: Likewise.
3621 * expression.cc: Likewise.
3622 * fileread.cc: Likewise.
3623 * fileread.h: Likewise.
3624 * gc.h: Likewise.
3625 * gold-threads.cc: Likewise.
3626 * gold.cc: Likewise.
3627 * i386.cc: Likewise.
3628 * icf.h: Likewise.
3629 * incremental-dump.cc: Likewise.
3630 * incremental.cc: Likewise.
3631 * layout.cc: Likewise.
3632 * layout.h: Likewise.
3633 * main.cc: Likewise.
3634 * merge.cc: Likewise.
3635 * merge.h: Likewise.
3636 * object.cc: Likewise.
3637 * object.h: Likewise.
3638 * options.cc: Likewise.
3639 * options.h: Likewise.
3640 * output.cc: Likewise.
3641 * output.h: Likewise.
3642 * plugin.cc: Likewise.
3643 * plugin.h: Likewise.
3644 * powerpc.cc: Likewise.
3645 * reloc.cc: Likewise.
3646 * script-c.h: Likewise.
3647 * script-sections.cc: Likewise.
3648 * script.cc: Likewise.
3649 * stringpool.cc: Likewise.
3650 * symtab.cc: Likewise.
3651 * symtab.h: Likewise.
3652 * target.cc: Likewise.
3653 * timer.cc: Likewise.
3654 * timer.h: Likewise.
3655 * version.cc: Likewise.
3656 * x86_64.cc: Likewise.
3657
b8fa8750
NC
36582010-08-24 Nick Clifton <nickc@redhat.com>
3659
3660 PR 11899
3661 * layout.cc (segment_precedes): Sort segments by their physical
3662 addresses, if they have been set.
3663
9919d93b
CC
36642010-08-23 Cary Coutant <ccoutant@google.com>
3665
3666 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3667 symbols data.
3668 (Lib_group::include_member): Unlock object after deleting its
3669 symbols data.
3670 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3671 the bug fixed here.
3672
97b4be1c
CC
36732010-08-19 Neil Vachharajani <nvachhar@google.com>
3674 Cary Coutant <ccoutant@google.com>
3675
3676 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3677 constructor, and set_blocker.
3678 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3679 readsyms_blocker_.
3680 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3681 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3682 * testsuite/Makefile.am (start_lib_test): New test case.
3683 * testsuite/Makefile.in: Regenerate.
3684 * testsuite/start_lib_test_main.c: New file.
3685 * testsuite/start_lib_test_1.c: New file.
3686 * testsuite/start_lib_test_2.c: New file.
3687 * testsuite/start_lib_test_3.c: New file.
3688
dd0b1884
ILT
36892010-08-19 Ian Lance Taylor <iant@google.com>
3690
3691 * Makefile.in: Rebuild with automake 1.11.1.
3692 * aclocal.m4: Likewise.
3693 * testsuite/Makefile.in: Likewise.
3694
7223e9ca
ILT
36952010-08-19 Ian Lance Taylor <iant@google.com>
3696
3697 PR 10893
3698 * i386.cc (class Output_data_plt_i386): Update declarations.
3699 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3700 local_ifuncs_ fields.
3701 (Target_i386::do_plt_section_for_global): New function.
3702 (Target_i386::do_plt_section_for_local): New function.
3703 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3704 parameter; change all callers. Initialize global_ifuncs_ and
3705 local_ifuncs_. If doing a static link define __rel_iplt_start and
3706 __rel_iplt_end.
3707 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3708 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3709 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3710 symbols.
3711 (Target_i386::make_plt_section): New function, broken out of
3712 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3713 (Target_i386::make_plt_entry): Call make_plt_section.
3714 (Target_i386::make_local_ifunc_plt_entry): New function.
3715 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3716 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3717 R_386_IRELATIVE to switch.
3718 (Target_i386::Scan::global): Likewise.
3719 (Target_i386::Relocate::relocate): Likewise.
3720 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3721 switch.
3722 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3723 (Target_x86_64::do_plt_section_for_global): New function.
3724 (Target_x86_64::do_plt_section_for_local): New function.
3725 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3726 parameter; change all callers. If doing a static link define
3727 __rela_iplt_start and __rela_iplt_end.
3728 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3729 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3730 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3731 to point to .plt.
3732 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3733 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3734 switch.
3735 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3736 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3737 R_X86_64_IRELATIVE to switch.
3738 (Target_x86_64::Scan::global): Likewise.
3739 (Target_x86_64::Relocate::relocate): Likewise.
3740 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3741 switch.
3742 * target.h (class Target): Add plt_section_for_global and
3743 plt_section_for_local functions. Add do_plt_section_for_global
3744 and do_plt_section_for_local virtual functions.
3745 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3746 clarifying comments.
3747 (Symbol::use_plt_offset): Handle IFUNC symbol.
3748 * object.cc (Sized_relobj::Sized_relobj): Initialize
3749 local_plt_offsets_.
3750 (Sized_relobj::local_has_plt_offset): New function.
3751 (Sized_relobj::local_plt_offset): New function.
3752 (Sized_relobj::set_local_plt_offset): New function.
3753 (Sized_relobj::do_count): Handle IFUNC symbol.
3754 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3755 a bit away from input_shndx_ field. Add set_is_func_symbol and
3756 is_ifunc_symbol functions.
3757 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3758 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3759 local_plt_offsets_ field.
3760 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3761 * output.h (class Output_section_data): Add non-const
3762 output_section function.
3763 (class Output_data_got): Update declarations.
3764 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3765 Add use_plt_offset parameter to global and local constructors.
3766 Change all callers. Change local_sym_index_ field to 31 bits.
3767 Change GSYM_CODE and CONSTANT_CODE accordingly.
3768 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3769 doing a static link don't set sh_link field.
3770 (Output_data_got::Got_entry::write): Use PLT offset if
3771 appropriate.
3772 (Output_data_got::add_global_plt): New function.
3773 (Output_data_got::add_local_plt): New function.
3774 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3775 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3776 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3777 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3778 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3779 IFUNC conditional.
3780 * testsuite/ifunc-sel.h: New file.
3781 * testsuite/ifuncmain1.c: New file.
3782 * testsuite/ifuncmain1vis.c: New file.
3783 * testsuite/ifuncmod1.c: New file.
3784 * testsuite/ifuncdep2.c: New file.
3785 * testsuite/ifuncmain2.c: New file.
3786 * testsuite/ifuncmain3.c: New file.
3787 * testsuite/ifuncmod3.c: New file.
3788 * testsuite/ifuncmain4.c: New file.
3789 * testsuite/ifuncmain5.c: New file.
3790 * testsuite/ifuncmod5.c: New file.
3791 * testsuite/ifuncmain6pie.c: New file.
3792 * testsuite/ifuncmod6.c: New file.
3793 * testsuite/ifuncmain7.c: New file.
3794 * configure, testsuite/Makefile.in: Rebuild.
3795
56f75c03
ILT
37962010-08-18 Ian Lance Taylor <iant@google.com>
3797
3798 * incremental.cc
3799 (Output_section_incremental_inputs::write_input_files): Add cast
3800 to avoid signed/unsigned comparison warning.
3801 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3802
55455f89
CC
38032010-08-12 Cary Coutant <ccoutant@google.com>
3804
3805 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3806
e2054bcb
ILT
38072010-08-13 Ian Lance Taylor <iant@google.com>
3808
3809 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3810
74f67560
DK
38112010-08-12 Cary Coutant <ccoutant@google.com>
3812 Doug Kwan <dougkwan@google.com>
3813
3814 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3815 defintion overrides non-weak undef, remember that the original undef
3816 is not weak.
3817 * symtab.cc (Symbol_table::sized_write_global): For undef without
3818 an original weak binding, set binding to global in output.
3819 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3820 * testsuite/Makefile.in: Regenerate.
3821 * testsuite/strong_ref_weak_def.sh: New file.
3822 * testsuite/strong_ref_weak_def_1.c: Ditto.
3823 * testsuite/strong_ref_weak_def_2.c: Ditto.
3824
d1238d12
CC
38252010-08-12 Cary Coutant <ccoutant@google.com>
3826
3827 * testsuite/incremental_test.sh: Rewrite.
3828 * testsuite/incremental_test_1.c: Rewrite.
3829 * testsuite/incremental_test_2.c: Rewrite.
3830
0e70b911
CC
38312010-08-12 Cary Coutant <ccoutant@google.com>
3832
3833 * arm.cc (Target_arm::got_size): Add const.
3834 (Target_arm::got_entry_count): New function.
3835 (Target_arm::plt_entry_count): New function.
3836 (Target_arm::first_plt_entry_offset): New function.
3837 (Target_arm::plt_entry_size): New function.
3838 (Output_data_plt_arm::entry_count): New function.
3839 (Output_data_plt_arm::first_plt_entry_offset): New function.
3840 (Output_data_plt_arm::get_plt_entry_size): New function.
3841 * i386.cc (Target_i386::got_size): Add const.
3842 (Target_i386::got_entry_count): New function.
3843 (Target_i386::plt_entry_count): New function.
3844 (Target_i386::first_plt_entry_offset): New function.
3845 (Target_i386::plt_entry_size): New function.
3846 (Output_data_plt_i386::entry_count): New function.
3847 (Output_data_plt_i386::first_plt_entry_offset): New function.
3848 (Output_data_plt_i386::get_plt_entry_size): New function.
3849 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3850 find_incremental_inputs_sections. Dump incremental_got_plt section.
3851 * incremental.cc: Include target.h.
3852 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3853 parameter. Adjust all callers. Find incremental_got_plt section.
3854 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3855 section.
3856 (Output_section_incremental_inputs::set_final_data_size): Calculate
3857 size of incremental_got_plt section.
3858 (Output_section_incremental_inputs::do_write): Write the
3859 incremental_got_plt section.
3860 (Got_plt_view_info): New struct.
3861 (Local_got_offset_visitor): New class.
3862 (Global_got_offset_visitor): New class.
3863 (Global_symbol_visitor_got_plt): New class.
3864 (Output_section_incremental_inputs::write_got_plt): New function.
3865 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3866 Add parameter. Adjust all callers.
3867 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3868 (Incremental_inputs::got_plt_section): New function.
3869 (Incremental_inputs::got_plt_section_): New data member.
3870 (Incremental_got_plt_reader): New class.
3871 * layout.cc (Layout::create_incremental_info_sections): Add the
3872 incremental_got_plt section.
3873 * object.h (Got_offset_list::get_list): New function.
3874 (Got offset_list::for_all_got_offsets): New function.
3875 (Sized_relobj::local_got_offset_list): New function.
3876 * powerpc.cc (Target_powerpc::got_size): Add const.
3877 (Target_powerpc::got_entry_count): New function.
3878 (Target_powerpc::plt_entry_count): New function.
3879 (Target_powerpc::first_plt_entry_offset): New function.
3880 (Target_powerpc::plt_entry_size): New function.
3881 (Output_data_plt_powerpc::entry_count): New function.
3882 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3883 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3884 * sparc.cc (Target_sparc::got_size): Add const.
3885 (Target_sparc::got_entry_count): New function.
3886 (Target_sparc::plt_entry_count): New function.
3887 (Target_sparc::first_plt_entry_offset): New function.
3888 (Target_sparc::plt_entry_size): New function.
3889 (Output_data_plt_sparc::entry_count): New function.
3890 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3891 (Output_data_plt_sparc::get_plt_entry_size): New function.
3892 * symtab.h (Symbol::got_offset_list): New function.
3893 (Symbol_table::for_all_symbols): New function.
3894 * target.h (Sized_target::got_entry_count): New function.
3895 (Sized_target::plt_entry_count): New function.
3896 (Sized_target::plt_entry_size): New function.
3897 * x86_64.cc (Target_x86_64::got_size): Add const.
3898 (Target_x86_64::got_entry_count): New function.
3899 (Target_x86_64::plt_entry_count): New function.
3900 (Target_x86_64::first_plt_entry_offset): New function.
3901 (Target_x86_64::plt_entry_size): New function.
3902 (Output_data_plt_x86_64::entry_count): New function.
3903 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3904 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3905
09ec0418
CC
39062010-08-12 Cary Coutant <ccoutant@google.com>
3907
3908 * archive.cc: Include incremental.h.
3909 (Archive::Archive): Initialize incremental_info_.
3910 (Archive::include_member): Record archive members in incremental info.
3911 (Add_archive_symbols::run): Record begin and end of an archive in
3912 incremental info.
3913 (Lib_group::include_member): Record objects in incremental info.
3914 * archive.h (Incremental_archive_entry): Forward declaration.
3915 (Archive::set_incremental_info): New member function.
3916 (Archive::incremental_info): New member function.
3917 (Archive::Unused_symbol_iterator): New class.
3918 (Archive::unused_symbols_begin): New member function.
3919 (Archive::unused_symbols_end): New member function.
3920 (Archive::incremental_info_): New data member.
3921 * incremental-dump.cc (find_input_containing_global): New function.
3922 (dump_incremental_inputs): Dump new incremental info sections.
3923 * incremental.cc: Include symtab.h.
3924 (Output_section_incremental_inputs): New class.
3925 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3926 new incremental info sections.
3927 (Sized_incremental_binary::do_check_inputs): Likewise.
3928 (Incremental_inputs::report_archive): Remove.
3929 (Incremental_inputs::report_archive_begin): New function.
3930 (Incremental_inputs::report_archive_end): New function.
3931 (Incremental_inputs::report_object): New function.
3932 (Incremental_inputs::finalize_inputs): Remove.
3933 (Incremental_inputs::report_input_section): New function.
3934 (Incremental_inputs::report_script): Rewrite.
3935 (Incremental_inputs::finalize): Do nothing but finalize string table.
3936 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3937 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3938 (Incremental_inputs::create_data_sections): New function.
3939 (Incremental_inputs::relocs_entsize): New function.
3940 (Output_section_incremental_inputs::set_final_data_size): New function.
3941 (Output_section_incremental_inputs::do_write): New function.
3942 (Output_section_incremental_inputs::write_header): New function.
3943 (Output_section_incremental_inputs::write_input_files): New function.
3944 (Output_section_incremental_inputs::write_info_blocks): New function.
3945 (Output_section_incremental_inputs::write_symtab): New function.
3946 * incremental.h (Incremental_script_entry): Forward declaration.
3947 (Incremental_object_entry): Forward declaration.
3948 (Incremental_archive_entry): Forward declaration.
3949 (Incremental_inputs): Forward declaration.
3950 (Incremental_inputs_header_data): Remove.
3951 (Incremental_inputs_header): Remove.
3952 (Incremental_inputs_header_write): Remove.
3953 (Incremental_inputs_entry_data): Remove.
3954 (Incremental_inputs_entry): Remove.
3955 (Incremental_inputs_entry_write): Remove.
3956 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3957 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3958 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3959 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3960 Likewise.
3961 (Incremental_input_entry): New class.
3962 (Incremental_script_entry): New class.
3963 (Incremental_object_entry): New class.
3964 (Incremental_archive_entry): New class.
3965 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3966 (Incremental_inputs::report_inputs): Remove.
3967 (Incremental_inputs::report_archive): Remove.
3968 (Incremental_inputs::report_archive_begin): New function.
3969 (Incremental_inputs::report_archive_end): New function.
3970 (Incremental_inputs::report_object): Change prototype.
3971 (Incremental_inputs::report_input_section): New function.
3972 (Incremental_inputs::report_script): Change prototype.
3973 (Incremental_inputs::get_reloc_count): New function.
3974 (Incremental_inputs::set_reloc_count): New function.
3975 (Incremental_inputs::create_data_sections): New function.
3976 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3977 (Incremental_inputs::inputs_section): New function.
3978 (Incremental_inputs::symtab_section): New function.
3979 (Incremental_inputs::relocs_section): New function.
3980 (Incremental_inputs::get_stringpool): Add const.
3981 (Incremental_inputs::command_line): Add const.
3982 (Incremental_inputs::inputs): Remove.
3983 (Incremental_inputs::command_line_key): New function.
3984 (Incremental_inputs::input_file_count): New function.
3985 (Incremental_inputs::input_files): New function.
3986 (Incremental_inputs::relocs_entsize): New function.
3987 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3988 (Incremental_inputs::finalize_inputs): Remove.
3989 (Incremental_inputs::Input_info): Remove.
3990 (Incremental_inputs::lock_): Remove.
3991 (Incremental_inputs::inputs_): Change type.
3992 (Incremental_inputs::inputs_map_): Remove.
3993 (Incremental_inputs::current_object_entry_): New data member.
3994 (Incremental_inputs::inputs_section_): New data member.
3995 (Incremental_inputs::symtab_section_): New data member.
3996 (Incremental_inputs::relocs_section_): New data member.
3997 (Incremental_inputs::reloc_count_): New data member.
3998 (Incremental_inputs_reader): New class.
3999 (Incremental_symtab_reader): New class.
4000 (Incremental_relocs_reader): New class.
4001 * layout.cc (Layout::finalize): Move finalization of incremental info
4002 and creation of incremental info sections to follow finalization of
4003 symbol table. Set offsets for postprocessing sections.
4004 (Layout::create_incremental_info_sections): Call
4005 Incremental_inputs::create_data_sections. Add incremental symtab
4006 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4007 sections to layout after input sections.
4008 * layout.h (struct Timespec): Forward declaration.
4009 (Layout::incremental_inputs): Add const.
4010 (Layout::create_incremental_info_sections): Add parameter.
4011 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4012 * object.cc: Include incremental.h.
4013 (Relobj::finalize_incremental_relocs): New function.
4014 (Sized_relobj::do_layout): Record input sections in incremental info.
4015 * object.h (Object::output_section): New function.
4016 (Object::output_section_offset): Moved from Relobj.
4017 (Object::get_incremental_reloc_base): New function.
4018 (Object::get_incremental_reloc_count): New function.
4019 (Object::do_output_section): New function.
4020 (Object::do_output_section_offset): Moved from Relobj.
4021 (Object::do_get_incremental_reloc_base): New function.
4022 (Object::do_get_incremental_reloc_count): New function.
4023 (Object::Object): Initialize new data members.
4024 (Relobj::output_section): Renamed do_output_section and moved to
4025 protected.
4026 (Relobj::output_section_offset): Moved to Object.
4027 (Relobj::do_get_incremental_reloc_base): New function.
4028 (Relobj::do_get_incremental_reloc_count): New function.
4029 (Relobj::allocate_incremental_reloc_counts): New function.
4030 (Relobj::count_incremental_reloc): New function.
4031 (Relobj::finalize_incremental_relocs): New function.
4032 (Relobj::next_incremental_reloc_index): New function.
4033 (Relobj::reloc_counts_): New data member.
4034 (Relobj::reloc_bases_): New data member.
4035 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4036 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4037 (Sized_relobj::incremental_relocs_scan): New function.
4038 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4039 (Sized_relobj::incremental_relocs_write): New function.
4040 (Sized_relobj::incremental_relocs_write_reltype): New function.
4041 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4042 incremental link.
4043 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4044 archives and object files elsewhere.
4045 (Add_symbols::run): Report object files here.
4046 (Finish_group::run): Report end of archive at end of group.
4047 * reloc.cc: Include layout.h, incremental.h.
4048 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4049 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4050 (Sized_relobj::incremental_relocs_scan): New function.
4051 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4052 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4053 (Sized_relobj::incremental_relocs_write): New function.
4054 (Sized_relobj::incremental_relocs_write_reltype): New function.
4055 * script.cc (read_input_script): Rewrite test for incremental link.
4056 Change call to Incremental_inputs::report_script.
4057 * symtab.h (Symbol_table::first_global_index): New function.
4058 (Symbol_table::output_count): New function.
4059
ce0d1972
DK
40602010-08-12 Doug Kwan <dougkwan@google.com>
4061
4062 * arm.cc (Target_arm::merge_object_attributes): Check command line
4063 options --no-wchar-size-warning and --no-enum-size-warning.
4064 * options.h (General_options): Add ld-compatible options
4065 --no-enum-size-warning and --no-wchar-size-warning.
4066
6e5710ce
ILT
40672010-08-04 Ian Lance Taylor <iant@google.com>
4068
4069 * x86_64.cc (Target_x86_64::Scan::local): Use
4070 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4071 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4072 (Target_x86_64::Scan::global): Likewise.
4073 (Target_x86_64::Relocate::relocate): Likewise.
4074 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4075 Likewise.
4076
fef830db
CC
40772010-08-03 Cary Coutant <ccoutant@google.com>
4078
4079 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4080 to reserve space in merged_strings vector. Keep total input size
4081 for stats.
4082 (Output_merge_string::do_print_merge_stats): Print total input size.
4083 * merge.h (Output_merge_string): Add input_size_ field.
4084 * stringpool.cc (Stringpool_template::string_length): Move
4085 implementations out of Stringpool_template class and place in
4086 stringpool.h.
4087 * stringpool.h (string_length): Move out of Stringpool_template.
4088
1e3811b0
ILT
40892010-08-03 Ian Lance Taylor <iant@google.com>
4090
4091 PR 11712
4092 * layout.cc (relaxation_loop_body): If address of load segment is
4093 set, adjust address to include headers if possible.
4094
7af0c620
ILT
40952010-08-03 Ian Lance Taylor <iant@google.com>
4096
4097 * version.cc (version_string): Bump to 1.10.
4098
22f0da72
ILT
40992010-08-03 Ian Lance Taylor <iant@google.com>
4100
4101 PR 11805
4102 * layout.h (enum Output_section_order): Define.
4103 (class Layout): Update declarations.
4104 * layout.cc (Layout::get_output_section): Add order parameter.
4105 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4106 is_first_non_relro parameters. Change all callers.
4107 (Layout::choose_output_section): Likewise.
4108 (Layout::add_output_section_data): Likewise.
4109 (Layout::make_output_section): Likewise. Set order.
4110 (Layout::default_section_order): New function.
4111 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4112 * output.cc (Output_section::Output_section): Initialize order_.
4113 Don't initialize deleted fields.
4114 (Output_segment::Output_segment): Don't initialize deleted
4115 fields.
4116 (Output_segment::add_output_section_to_load): New function
4117 replacing add_output_section. Change all callers to call this or
4118 add_output_section_to_nonload.
4119 (Output_segment::add_output_section_to_nonload): New function.
4120 (Output_segment::remove_output_section): Rewrite.
4121 (Output_segment::add_initial_output_data): Likewise.
4122 (Output_segment::has_any_data_sections): Likewise.
4123 (Output_segment::is_first_section_relro): Likewise.
4124 (Output_segment::maximum_alignment): Likewise.
4125 (Output_segment::has_dynamic_reloc): New function replacing
4126 dynamic_reloc_count. Change all callers.
4127 (Output_segment::has_dynamic_reloc_list): New function replacing
4128 dynamic_reloc_count_list. Change all callers.
4129 (Output_segment::set_section_addresses): Rewrite.
4130 (Output_segment::set_offset): Rewrite.
4131 (Output_segment::find_first_and_last_list): Remove.
4132 (Output_segment::set_tls_offsets): Rewrite.
4133 (Output_segment::first_section_load_address): Likewise.
4134 (Output_segment::output_section_count): Likewise.
4135 (Output_segment::section_with_lowest_load_address): Likewise.
4136 (Output_segment::write_section_headers): Likewise.
4137 (Output_segment::print_sections_to_map): Likewise.
4138 * output.h (class Output_data): Remove dynamic_reloc_count_
4139 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4140 (Output_data::add_dynamic_reloc): Rewrite.
4141 (Output_data::has_dynamic_reloc): New function.
4142 (Output_data::dynamic_reloc_count): Remove.
4143 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4144 is_last_relro_, is_first_non_relro_, is_interp_,
4145 is_dynamic_linker_section_ fields. Add order and set_order
4146 functions. Remove is_relro_local, set_is_relro_local,
4147 is_last_relro, set_is_last_relro, is_first_non_relro,
4148 set_is_first_non_relro functions, is_interp, set_is_interp,
4149 is_dynamic_linker_section, and set_is_dynamic_linker_section
4150 functions.
4151 (class Output_segment): Change Output_data_list from std::list to
4152 std:;vector. Add output_lists_ field. Remove output_data_ and
4153 output_bss_ fields. Update declarations.
4154
3ff2ccb0
ILT
41552010-08-02 Ian Lance Taylor <iant@google.com>
4156
4157 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4158 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4159 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4160
88a4108b
ILT
41612010-08-02 Ian Lance Taylor <iant@google.com>
4162
4163 PR 11855
4164 * script.cc (Script_options::Script_options): Initialize
4165 symbol_definitions_ and symbol_references_.
4166 (Script_options::add_symbol_assignment): Update
4167 symbol_definitions_ and symbol_references_.
4168 (Script_options::add_symbol_reference): New function.
4169 (script_symbol): New function.
4170 * script.h (class Script_options): Add symbol_definitions_ and
4171 symbol_references_ fields.
4172 (Script_options::referenced_const_iterator): New type.
4173 (Script_options::referenced_begin): New function.
4174 (Script_options::referenced_end): New function.
4175 (Script_options::is_referenced): New function.
4176 (Script_options::any_unreferenced): New function.
4177 * script-c.h (script_symbol): Declare.
4178 * yyscript.y (exp): Call script_symbol.
4179 * symtab.cc: Include "script.h".
4180 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4181 Change all callers. Check symbols referenced by scripts.
4182 (Symbol_table::add_undefined_symbols_from_command_line): Add
4183 layout parameter. Change all callers.
4184 (Symbol_table::do_add_undefined_symbols_from_command_line):
4185 Likewise. Break out loop body. Check symbols referenced by
4186 scripts.
4187 (Symbol_table::add_undefined_symbol_from_command_line): New
4188 function broken out of
4189 do_add_undefined_symbols_from_command_line.
4190 * symtab.h (class Symbol_table): Update declarations.
4191 * archive.cc: Include "layout.h".
4192 (Archive::should_include_member): Add layout parameter. Change
4193 all callers. Check for symbol mentioned in expression.
4194 * archive.h (class Archive): Update declaration.
4195 * object.cc (Sized_relobj::do_should_include_member): Add layout
4196 parameter.
4197 * object.h (Object::should_include_member): Add layout parameter.
4198 Change all callers.
4199 (Object::do_should_include_member): Add layout parameter.
4200 (class Sized_relobj): Update declaration.
4201 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4202 parameter.
4203 * dynobj.h (class Sized_dynobj): Update declaration.
4204 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4205 layout parameter.
4206 * plugin.h (class Sized_pluginobj): Update declaration.
4207
5f1ab67a
ILT
42082010-08-02 Ian Lance Taylor <iant@google.com>
4209
4210 PR 11866
4211 * output.cc (Output_segment::set_offset): Search for the first and
4212 last sections rather than assuming that the list is in order.
4213 (Output_segment::find_first_and_last_list): New function.
4214 * output.h (class Output_segment): Update declarations.
4215 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4216 (relro_strip_test_SOURCES): New variable.
4217 (relro_strip_test_DEPENDENCIES): New variable.
4218 (relro_strip_test_LDFLAGS): New variable.
4219 (relro_strip_test_LDADD): New variable.
4220 (relro_strip_test.so): New target.
4221
a8df5856
ILT
42222010-08-02 Ian Lance Taylor <iant@google.com>
4223
4224 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4225 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4226 (Target_i386::got_tlsdesc_section): New function.
4227 (Target_i386::got_section): Create space for GOT entries for
4228 TLSDESC relocations.
4229 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4230 R_386_TLS_GOTDESC.
4231 (Target_i386::Scan::global): Likewise.
4232 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4233 using TLSDESC GOT.
4234 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4235 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4236 (Target_x86_64::got_tlsdesc_section): New function.
4237 (Target_x86_64::got_section): Create space for GOT entries for
4238 TLSDESC relocations.
4239 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4240 R_386_TLS_GOTDESC.
4241 (Target_x86_64::Scan::global): Likewise.
4242 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4243 using TLSDESC GOT.
4244
0c10a0a6
ILT
42452010-08-02 Ian Lance Taylor <iant@google.com>
4246
4247 * testsuite/final_layout.sh: Use dc to convert from hex to
4248 decimal.
4249
41cbeecc
ST
42502010-07-29 Sriraman Tallam <tmsriram@google.com>
4251
4252 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4253 paramter to the call to gold::gc_process_relocs.
4254 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4255 paramter to the call to gold::gc_process_relocs.
4256 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4257 parameter to the call to gold::gc_process_relocs.
4258 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4259 template parameter to the call to gold::gc_process_relocs.
4260 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4261 paramter to the call to gold::gc_process_relocs.
4262 * gc.h (get_embedded_addend_size): New function.
4263 (gc_process_relocs): Save the size of the reloc for use by ICF.
4264 * icf.cc (get_section_contents): Get the addend from the text section
4265 for SHT_REL relocation sections.
4266 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4267 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4268 * int_encoding.h (read_from_pointer): New overloaded function.
4269 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4270 * testsuite/icf_sht_rel_addend_test.sh: New file.
4271 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4272 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4273
6ea55b82
RW
42742010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4275
4276 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4277 * Makefile.in: Regenerate.
4278 * testsuite/Makefile.in: Regenerate.
4279
9691462b
ILT
42802010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4281
4282 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4283 * gold/testsuite/debug_msg.cc: Likewise.
4284 * gold/testsuite/odr_violation1.cc
4285 * gold/testsuite/odr_violation2.cc
4286
76897331
CC
42872010-07-21 Cary Coutant <ccoutant@google.com>
4288
4289 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4290 string, and length fields.
4291 (Output_merge_string::Merged_strings_list): New type.
4292 (Output_merge_string::Merged_strings_lists): New typedef.
4293 (Output_merge_string): Replace merged_strings_ with
4294 merged_strings_lists_.
4295 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4296 Merged_strings_list per input object and section. Don't store pointer
4297 to the string. Don't store length with each merged string entry.
4298 (Output_merge_string::finalize_merged_data): Loop over list of merged
4299 strings lists. Recompute length of each merged string.
4300
78384e8f
CC
43012010-07-15 Cary Coutant <ccoutant@google.com>
4302
4303 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4304 here.
4305
783659f9
ILT
43062010-07-14 Ian Lance Taylor <iant@google.com>
4307
4308 * descriptors.cc (Descriptors::open): Report correct name in error
4309 message.
4310
131687b4
DK
43112010-07-13 Doug Kwan <dougkwan@google.com>
4312
4313 * arm.cc (Arm_input_section::Arm_input_section): For a
4314 SHT_ARM_EXIDX section, always keeps the input sections.
4315 (Arm_input_section::set_exidx_section_link): New method.
4316 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4317 has_errors_ to false.
4318 (Arm_exidx_input_section::has_errors,
4319 Arm_exidx_input_section::set_has_errors): New methods.
4320 (Arm_exidx_input_section::has_errors_): New data member.
4321 (Arm_relobj::get_exidx_shndx_list): New method.
4322 (Arm_output_section::append_text_sections_to_list): Do not skip
4323 section without SHF_EXECINSTR.
4324 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4325 errors.
4326 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4327 section header. Make error messages more verbose. Check for
4328 a non-executable section linked to an EXIDX section.
4329 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4330 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4331 check that there is no deferred EXIDX section if we exit early.
4332 Instead of not making an EXIDX section in case of an error, make one
4333 and set the has_errors flag of it.
4334 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4335 in a relocatable link.
4336 (Target_arm::do_relax): Look for the EXIDX output section instead of
4337 assuming that it is called .ARM.exidx.
4338 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4339 section list. Do not check for SHF_EXECINSTR section flags but
4340 skip any input section with errors.
4341 * output.cc (Output_section::Output_section): Initialize
4342 always_keeps_input_sections_ to false.
4343 (Output_section::add_input_section): Check for
4344 always_keeps_input_sections_.
4345 * output.h (Output_section::always_keeps_input_sections,
4346 Output_section::set_always_keeps_input_sections): New methods.
4347 (Output_section::always_keeps_input_sections): New data member.
4348
69517287
RÁE
43492010-07-13 Rafael Espindola <espindola@google.com>
4350
4351 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4352 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4353
82742395
ILT
43542010-07-13 Philip Herron <herron.philip@googlemail.com>
4355 Ian Lance Taylor <iant@google.com>
4356
4357 * output.h (Output_section_lookup_maps::add_merge_section):
4358 Correct check of whether value was inserted.
4359 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4360 (Output_section_lookup_maps::add_relaxed_input_section):
4361 Likewise.
4362 * arm.cc (Target_arm::got_section): Remove used local os.
4363 * i386.cc (Target_i386::got_section): Likewise.
4364 * x86_64.cc (Target_x86_64::got_section): Likewise.
4365 * sparc.cc (Target_sparc::got_section): Likewise.
4366 (Target_sparc::relocate): Remove unused local have_got_offset.
4367 * powerpc.cc (Target_powerpc::relocate): Likewise.
4368
f2d707b5
ILT
43692010-07-13 Ian Lance Taylor <iant@google.com>
4370
241531d6
ILT
4371 * compressed_output.cc (zlib_decompress): Fix signature in
4372 !HAVE_ZLIB_H case.
4373
f2d707b5
ILT
4374 * archive.cc (Archive::include_member): Unlock an external member
4375 of a thin archive. Don't bother to delete an object we know is
4376 NULL.
4377
a2e47362
CC
43782010-07-12 Cary Coutant <ccoutant@google.com>
4379
4380 * compressed_output.cc (zlib_decompress): New function.
4381 (get_uncompressed_size): New function.
4382 (decompress_input_section): New function.
4383 * compressed_output.h (get_uncompressed_size): New function.
4384 (decompress_input_section): New function.
4385 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4386 Handle compressed debug sections.
4387 * layout.cc (is_compressed_debug_section): New function.
4388 (Layout::output_section_name): Map compressed section names to
4389 canonical names.
4390 * layout.h (is_compressed_debug_section): New function.
4391 (is_debug_info_section): Recognize compressed debug sections.
4392 * merge.cc: Include compressed_output.h.
4393 (Output_merge_data::do_add_input_section): Handle compressed
4394 debug sections.
4395 (Output_merge_string::do_add_input_section): Handle compressed
4396 debug sections.
4397 * object.cc: Include compressed_output.h.
4398 (Sized_relobj::Sized_relobj): Initialize new data members.
4399 (build_compressed_section_map): New function.
4400 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4401 * object.h (Object::section_is_compressed): New method.
4402 (Object::do_section_is_compressed): New method.
4403 (Sized_relobj::Compressed_section_map): New type.
4404 (Sized_relobj::do_section_is_compressed): New method.
4405 (Sized_relobj::compressed_sections_): New data member.
4406 * output.cc (Output_section::add_input_section): Handle compressed
4407 debug sections.
4408 * reloc.cc: Include compressed_output.h.
4409 (Sized_relobj::write_sections): Handle compressed debug sections.
4410
ce279a62
CC
44112010-07-08 Cary Coutant <ccoutant@google.com>
4412
4413 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4414 weak when resolving to a dynamic def.
4415 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4416 for weak undef/dynamic def cases. Adjust callers.
4417 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4418 undef_binding_weak_.
4419 (Symbol_table::sized_write_globals): Adjust symbol binding.
4420 (Symbol_table::sized_write_symbol): Add binding parameter.
4421 * symtab.h (Symbol::set_undef_binding): New method.
4422 (Symbol::is_undef_binding_weak): New method.
4423 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4424 (Symbol_table::should_override): Add new parameter.
4425 (Symbol_table::sized_write_symbol): Add new parameter.
4426
4427 * testsuite/weak_undef_file1.cc: Add new test case.
4428 * testsuite/weak_undef_file2.cc: Fix header comment.
4429 * testsuite/weak_undef_test.cc: Add new test case.
4430
b2286c10
DK
44312010-06-29 Doug Kwan <dougkwan@google.com>
4432
4433 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4434 Initialize USE_SYMBOL_.
4435 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4436 definition.
4437 (Arm_reloc_property::uses_symbol_): New data member declaration.
4438 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4439 uses symbol value and symbol is undefined but not weakly undefined.
4440
4802450a
RÁE
44412010-06-28 Rafael Espindola <espindola@google.com>
4442
4443 * plugin.cc (Plugin::load): Use dlerror.
4444
e5ca47ba
ILT
44452010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4446
4447 * symtab.cc (detect_odr_violations): When reporting an ODR
4448 violation, report an object where the symbol is defined.
4449
8a75a161
DK
44502010-06-25 Doug Kwan <dougkwan@google.com>
4451
4452 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4453 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4454 definition.
4455 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4456 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4457 target hook to detect function points.
4458 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4459 * icf.h (Icf::check_section_for_function_pointers): Change type of
4460 parameter SECTION_NAME to const reference to std::string. Use
4461 target hook to determine if section may have unsafe pointers.
4462 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4463 method definition.
4464
42218b9f
RÁE
44652010-06-21 Rafael Espindola <espindola@google.com>
4466
4467 * fileread.cc (Input_file::find_fie): New
4468 (Input_file::open): Use Input_file::find_fie.
4469 * fileread.h (Input_file::find_fie): New
4470 * plugin.cc (set_extra_library_path): New.
4471 (Plugin::load): Add set_extra_library_path to the transfer vector.
4472 (Plugin_manager::set_extra_library_path): New.
4473 (Plugin_manager::add_input_file): Use the extra search path if set.
4474 (set_extra_library_path(): New.
4475 * plugin.h (Plugin_manager): Add set_extra_library_path and
4476 extra_search_path_.
4477
a0506cca
CC
44782010-06-19 Cary Coutant <ccoutant@google.com>
4479
4480 * layout.cc (gdb_sections): Add .debug_types.
4481 (lines_only_debug_sections): Likewise.
4482
6508b958
RÁE
44832010-06-18 Rafael Espindola <espindola@google.com>
4484
4485 * plugin.cc (add_input_file,add_input_library)
4486 (Plugin_manager::add_input_file): Make filename arguments const.
4487 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4488 const.
4489
3e235302
DK
44902010-06-16 Doug Kwan <dougkwan@google.com>
4491
4492 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4493 .ARM.attributes section if we have not merged any input
4494 attributes sections.
4495
106e8a6c
DK
44962010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4497
4498 * arm.cc: Allow combining objects with no EABI version
4499 information.
4500
91ff43fe
RÁE
45012010-06-15 Rafael Espindola <espindola@google.com>
4502
4503 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4504
68ed838c
ILT
45052010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4506
4507 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4508 (struct iovec): Correct !HAVE_READV definition.
4509
f3a2388f
CC
45102010-06-10 Cary Coutant <ccoutant@google.com>
4511
4512 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4513 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4514 reloc sections.
4515 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4516
4517 PR 11683
4518 * symtab.h (Symbol::is_placeholder): New member function.
4519 * target-reloc.h (relocate_section): Check for placeholder symbols.
4520
4521 * testsuite/Makefile.am (plugin_test_8): New test.
4522 (plugin_test_9): New test.
4523 * testsuite/Makefile.in: Regenerate.
4524
e1df38aa
NC
45252010-06-09 Nick Clifton <nickc@redhat.com>
4526
4527 * yyscript.y (input_list_element): Allow strings prefixed with
4528 the '-' character. Treat these as libraries.
4529 * script.cc (script_add_library): New function. Adds a library
4530 specified by "-l<name>" found in an input script.
4531 * script-c.h: Add prototype for script_add_library.
4532
25bbe950
DK
45332010-06-07 Doug Kwan <dougkwan@google.com>
4534
4535 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4536 Restrict stub-group size to be within long conditional branch
4537 range when working around cortex-A8 erratum.
4538
0f32ea4c
ILT
45392010-06-07 Damien Diederen <dd@crosstwine.com>
4540
4541 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4542 #ifdef typo.
4543
8fe2a369
ST
45442010-06-03 Sriraman Tallam <tmsriram@google.com>
4545
4546 PR gold/11658
4547 * output.cc
4548 (Output_section::Input_section_sort_entry::compare_section_ordering):
4549 Change to return non-zero correctly.
4550 (Output_section::Input_section_sort_section_order_index_compare
4551 ::operator()): Change to fix ambiguity in comparisons.
4552
6e9ba2ca
ST
45532010-06-01 Sriraman Tallam <tmsriram@google.com>
4554
4555 * gold.h (is_wildcard_string): New function.
4556 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4557 (Layout::layout_eh_frame): Ditto.
4558 (Layout::find_section_order_index): New method.
4559 (Layout::read_layout_from_file): New method.
4560 * layout.h (Layout::find_section_order_index): New method.
4561 (Layout::read_layout_from_file): New method.
4562 (Layout::input_section_position_): New private member.
4563 (Layout::input_section_glob_): New private member.
4564 * main.cc (main): Call read_layout_from_file here.
4565 * options.h (--section-ordering-file): New option.
4566 * output.cc (Output_section::input_section_order_specified_): New
4567 member.
4568 (Output_section::Output_section): Initialize new member.
4569 (Output_section::add_input_section): Add new parameter.
4570 Keep input sections when --section-ordering-file is used.
4571 (Output_section::set_final_data_size): Sort input sections when
4572 section ordering file is specified.
4573 (Output_section::Input_section_sort_entry): Add new parameter.
4574 Check sorting type.
4575 (Output_section::Input_section_sort_entry::compare_section_ordering):
4576 New method.
4577 (Output_section::Input_section_sort_compare::operator()): Change to
4578 consider section_order_index.
4579 (Output_section::Input_section_sort_init_fini_compare::operator()):
4580 Change to consider section_order_index.
4581 (Output_section::Input_section_sort_section_order_index_compare
4582 ::operator()): New method.
4583 (Output_section::sort_attached_input_sections): Change to sort
4584 according to section order when specified.
e1df38aa
NC
4585 (Output_section::add_input_section<32, true>): Add new parameter.
4586 (Output_section::add_input_section<64, true>): Add new parameter.
4587 (Output_section::add_input_section<32, false>): Add new parameter.
4588 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
4589 * output.h (Output_section::add_input_section): Add new parameter.
4590 (Output_section::input_section_order_specified): New
4591 method.
4592 (Output_section::set_input_section_order_specified): New method.
4593 (Input_section::Input_section): Initialize section_order_index_.
4594 (Input_section::section_order_index): New method.
4595 (Input_section::set_section_order_index): New method.
4596 (Input_section::section_order_index_): New member.
4597 (Input_section::Input_section_sort_section_order_index_compare): New
4598 struct.
4599 (Output_section::input_section_order_specified_): New member.
4600 * script-sections.cc (is_wildcard_string): Delete and move modified
4601 method to gold.h.
4602 (Output_section_element_input::Output_section_element_input): Modify
4603 call to is_wildcard_string.
4604 (Output_section_element_input::Input_section_pattern
4605 ::Input_section_pattern): Ditto.
4606 (Output_section_element_input::Output_section_element_input): Ditto.
4607 * testsuite/Makefile.am (final_layout): New test case.
4608 * testsuite/Makefile.in: Regenerate.
4609 * testsuite/final_layout.cc: New file.
4610 * testsuite/final_layout.sh: New file.
4611
3537c84b
RÁE
46122010-06-01 Rafael Espindola <espindola@google.com>
4613
4614 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4615
105b6afd
RÁE
46162010-06-01 Rafael Espindola <espindola@google.com>
4617
4618 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4619 visibility of symbols.
4620
29e11421
DK
46212010-05-27 Doug Kwan <dougkwan@google.com>
4622
4623 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4624 from start of output section instead of address for a local symbol
4625 in a merged or relaxed section when doing a relocatable link.
4626
5e0f337e
RÁE
46272010-05-26 Rafael Espindola <espindola@google.com>
4628
4629 PR 11604
4630 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4631 adding sections the garbage collector removed.
4632 * gold/testsuite/Makefile.am: Add test.
4633 * gold/testsuite/Makefile.in: Regenerate.
4634 * gold/testsuite/plugin_test_7.sh: New.
4635 * gold/testsuite/plugin_test_7_1.c: New.
4636 * gold/testsuite/plugin_test_7_2.c: New.
4637
f4187277
RÁE
46382010-05-26 Rafael Espindola <espindola@google.com>
4639
4640 * script-sections.cc (Output_section_definition::set_section_addresses):
4641 Check for --section-start.
4642
5c388529
DK
46432010-05-26 Doug Kwan <dougkwan@google.com>
4644
4645 * arm.cc (Arm_scan_relocatable_relocs): New class.
4646 (Target_arm::relocate_special_relocatable): New method.
4647 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4648 (Arm_relocate_functions::thumb_branch_common): Same.
4649 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4650 instead of Default_scan_relocatable_relocs.
4651 * target-reloc.h (relocate_for_relocatable): Let target handle
4652 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4653 * target.h (Sized_target::relocate_special_relocatable): New method.
4654
bca1c3ae
ILT
46552010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4656
4657 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4658
0439c796
DK
46592010-05-23 Doug Kwan <dougkwan@google.com>
4660
4661 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4662 instead of a cast.
4663 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4664 with a direct branch, not a conditional branch, to a stub.
4665 * merge.cc (Output_merge_base::record_input_section): New method
4666 defintion.
4667 (Output_merge_data::do_add_input_section): Record input section if
4668 keeps-input-sections flag is set.
4669 (Output_merge_string::do_add_input_section): Ditto.
4670 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4671 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4672 INPUT_SECTIONS_.
4673 (Output_merge_base::keeps_input_sections,
4674 Output_merge_base::set_keeps_input_sections,
4675 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4676 method definitions.
4677 (Output_merge_base::Input_sections): New type declaration.
4678 (Output_merge_base::input_sections_begin,
4679 Output_merge_base::input_sections_end,
4680 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4681 (Output_merge_base::bool keeps_input_sections_,
4682 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4683 Output_merge_base::input_sections_): New data members.
4684 (Output_merge_data::do_set_keeps_input_sections): New method
4685 defintion.
4686 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4687 * output.cc (Output_section::Input_section::relobj): Move method
4688 defintion from class declaration to here and handle merge sections.
4689 (Output_section::Input_section::shndx): Ditto.
4690 (Output_section::Output_section): Remove initializations of removed
4691 data members and initialize new data member LOOKUP_MAPS_.
4692 (Output_section::add_input_section): Set keeps-input-sections flag
4693 for a newly created merge output section as appropriate. Adjust code
4694 to use Output_section_lookup_maps class.
4695 (Output_section::add_relaxed_input_section): Adjst code for lookup
4696 maps code refactoring.
4697 (Output_section::add_merge_input_section): Add a new parameter
4698 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4699 class. If adding input section to a newly created merge output
4700 section fails, remove the new merge section.
4701 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 4702 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
4703 (Output_section::find_merge_section): Ditto.
4704 (Output_section::build_lookup_maps): New method defintion.
4705 (Output_section::find_relaxed_input_section): Adjust code to use
4706 Output_section_lookup_maps class.
4707 (Output_section::get_input_sections): Export merge sections. Adjust
4708 code to use Output_section_lookup_maps class.
4709 (Output_section:::add_script_input_section): Adjust code to use
4710 Output_section_lookup_maps class. Update lookup maps for merge
4711 sections also.
4712 (Output_section::discard_states): Use Output_section_lookup_maps.
4713 (Output_section::restore_states): Same.
4714 * output.h (Merge_section_properties): Move class defintion out of
4715 Output_section.
4716 (Output_section_lookup_maps): New class.
4717 (Output_section::Input_section::is_merge_section): New method
4718 defintion.
4719 (Output_section::Input_section::relobj): Move defintion out of class
4720 defintion. Declare method only.
4721 (Output_section::Input_section::shndx): Ditto.
4722 (Output_section::Input_section::output_merge_base): New method defintion.
4723 (Output_section::Input_section::u2_.pomb): New union field.
4724 (Output_section::Merge_section_by_properties_map,
4725 Output_section::Output_section_data_by_input_section_map,
4726 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4727 Remove types.
4728 (Output_section::add_merge_input_section): Add new parameter
4729 KEEPS_INPUT_SECTIONS.
4730 (Output_section::build_lookup_maps): New method declaration.
4731 (Output_section::merge_section_map_,
4732 Output_section::merge_section_by_properties_map_,
4733 Output_section::relaxed_input_section_map_,
4734 Output_section::is_relaxed_input_section_map_valid_): Remove data
4735 members.
4736 (Output_section::lookup_maps_): New data member.
4737
76295588
L
47382010-05-21 Doug Kwan <dougkwan@google.com>
4739
4740 PR gold/11619
4741 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4742 avoid a compilation error.
4743
d103a984
RÁE
47442010-05-19 Rafael Espindola <espindola@google.com>
4745
4746 * script-sections.cc (Output_section_definition::allocate_to_segment):
4747 Update the phdrs_list even when the output section is NULL.
4748 * testsuite/Makefile.am: Add test.
4749 * testsuite/Makefile.in: Regenerate.
4750 * testsuite/script_test_9.cc: New.
4751 * testsuite/script_test_9.sh: New.
4752 * testsuite/script_test_9.t: New.
4753
6625d24e
DK
47542010-05-19 Doug Kwan <dougkwan@google.com>
4755
4756 * arm.cc (Arm_input_section::original_size): New method.
4757 (Arm_input_section::do_addralign): Add a cast.
4758 (Arm_input_section::do_output_offset): Remove static cast.
4759 (Arm_input_section::original_addralign,
4760 Arm_input_section::original_size_): Change type to uint32_t.
4761 (Arm_input_section::init): Add safe casts for section alignment
4762 and size.
4763 (Arm_input_section::set_final_data_size): Do not set address and
4764 offset of stub table.
4765 (Arm_output_section::fix_exidx_coverage): Change use of of
4766 Output_section::Simple_input_section to that of
4767 Output_section::Input_section.
4768 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4769 except for the first pass.
4770 * output.cc (Output_section::get_input_sections): Change type of
4771 input_sections to std::list<Input_section>.
4772 (Output_section::add_script_input_section): Rename from
4773 Output_section::add_simple_input_section. Change type of SIS
4774 parameter from Simple_input_section to Input_section.
4775 * output.h (Output_section::Simple_input_section): Remove class.
4776 (Output_section::Input_section): Change class visibility to public.
4777 (Output_section::Input_section::addralign): Use stored alignments
4778 for special input sections if set.
4779 (Output_section::Input_section::set_addralign): New method.
4780 (Output_section::get_input_sections): Change parameter type from
4781 list of Simple_input_section to list of Input_section.
4782 (Output_section::add_script_input_section): Rename from
4783 Output_section::add_simple_input_section. Change first parameter's
4784 type from Simple_input_section to Input_section and remove the
4785 second and third parameters.
4786 * script-sections.cc (Input_section::Input_section_list): Change
4787 type to list of Output_section::Input_section/
4788 (Input_section_info::Input_section_info): Change parameter type of
4789 INPUT_SECTION to Output_section::Input_section.
4790 (Input_section_info::input_section): Change return type.
4791 (Input_section_info::input_section_): Change type to
4792 Output_section::Input_section.
4793 (Output_section_element_input::set_section_addresses): Adjust code
4794 to use Output_section::Input_section instead of
4795 Output_section::Simple_input_section. Adjust code for renaming
4796 of Output_section::add_simple_input_section.
4797 (Orphan_output_section::set_section_addresses): Ditto.
4798
e1e82ea4
RW
47992010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4800
4801 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4802 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4803
91e75c8a
RÁE
48042010-05-18 Rafael Espindola <espindola@google.com>
4805
4806 * options.cc (General_options::finalize): Handle -nostdlib.
4807 * options.h (nostdlib): New option.
4808 * script.cc (script_add_search_dir): Handle -nostdlib.
4809
da59ad79
DK
48102010-05-12 Doug Kwan <dougkwan@google.com>
4811
4812 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4813 attributes section only if there no attributes section after merging.
4814 (Target_arm::merge_object_attributes): Move value of
e1df38aa 4815 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
4816 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4817 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4818 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4819 and arm_attr_merge_7.stdout.
4820 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4821 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4822 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4823 arm_attr_merge_7b.o): New rules.
4824 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4825 arm_attr_merge_7
4826 * testsuite/Makefile.in: Regenerate.
4827 * testsuite/arm_attr_merge.sh: New file.
4828 * testsuite/arm_attr_merge_[67][ab].s: Same.
4829
3e01a7fd
NC
48302010-05-05 Nick Clifton <nickc@redhat.com>
4831
4832 * po/es.po: Updated Spanish translation.
4833
7ad2014a
L
48342010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4835
4836 * Makefile.am (install-exec-local): Properly install gold as
4837 default cross linker.
4838 * Makefile.in: Regenerated.
4839
4fda8867
NC
48402010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4841 Nick Clifton <nickc@redhat.com>
4842
4843 * configure.ac (install_as_default): Define and set to false
4844 unless --enable-gold or --enable-gold=both/gold has been
4845 specified.
4846 * configure: Regenerate.
4847
4848 * Makefile.am (install-exec-local): Install the executable as
4849 'ld.gold'. If install_as_default is true then also install it as
4850 'ld'.
4851 * Makefile.in: Regenerated.
4852
bd288ea2
ILT
48532010-04-24 Ian Lance Taylor <iant@google.com>
4854
4855 * layout.cc (Layout::layout_reloc): In relocatable link don't
4856 combine reloc sections for grouped sections.
4857
ef38fd8a
ST
48582010-04-23 Sriraman Tallam <tmsriram@google.com>
4859
4860 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4861 sections that are not ordinary to icf.
4862 * icf.cc (get_section_contents): Handle relocation pointing to section
4863 with no object or shndx information.
4864 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4865 * testsuite/Makefile.in: Regenerate.
4866 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4867 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4868
f6973bdc
ILT
48692010-04-22 Ian Lance Taylor <iant@google.com>
4870
4871 * expression.cc (Expression::Expression_eval_info): Add
4872 result_alignment_pointer field.
4873 (Expression::eval_with_dot): Add result_alignment_pointer
4874 parameter. Change all callers.
4875 (Expression::eval_maybe_dot): Likewise.
4876 (class Binary_expression): Add alignment_pointer parameter to
4877 left_value and right_value. Change all callers.
4878 (BINARY_EXPRESSION): Set result alignment.
4879 (class Trinary_expression): Add alignment_pointer parameter to
4880 arg2_value and arg3_value. Change all callers.
4881 (Trinary_cond::value): Set result alignment.
4882 (Max_expression::value, Min_expression::value): Likewise.
4883 (Align_expression::value): Likewise.
4884 * script-sections.cc (class Sections_element): Add dot_alignment
4885 parameter to set_section_addresses virtual function. Update
4886 instantiations.
4887 (class Output_section_element): Likewise.
4888 (Script_sections::create_segments): Add dot_alignment parameter.
4889 Change all callers.
4890 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4891 (Script_sections::set_phdrs_clause_addresses): Likewise.
4892 * script-sections.h: Update declarations.
4893 * script.h: Update declarations.
4894 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4895 min_p_align.
4896 * testsuite/script_test_3.t: Set large alignment.
4897 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4898 segment has expected alignment.
4899
9c9c98a5
NC
49002010-04-22 Nick Clifton <nickc@redhat.com>
4901
4902 * po/gold.pot: Updated by the Translation project.
4903 * po/vi.po: Updated Vietnamese translation.
4904
2253bfba
L
49052010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4906
4907 * testsuite/Makefile.am (check_PROGRAMS): Add
4908 icf_virtual_function_folding_test.
4909 * testsuite/Makefile.in: Regenerated.
4910
85fdf906
AH
49112010-04-15 Andrew Haley <aph@redhat.com>
4912
4913 * options.h (merge_exidx_entries): New option.
4914 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4915 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4916 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4917 (Target_arm::merge_exidx_entries): New function.
4918 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4919 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4920 to Arm_exidx_fixup constructor.
4921 Add new arg, merge_exidx_entries.
4922 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4923 Arm_output_section::fix_exidx_coverage.
4924
ce97fa81
ST
49252010-04-18 Sriraman Tallam <tmsriram@google.com>
4926
4927 * icf.cc (get_section_contents): Check for preemptible functions.
4928 Ignore addend when appropriate.
4929 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4930 section folded.
4931 (add_from_relobj): Check for section folded.
4932 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4933 * symtab.h (should_add_dynsym_entry): Add new parameter.
4934 * target-reloc.h (scan_relocs): Check for section folded.
4935 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4936 Check reloc types for function pointers in shared objects.
4937 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4938 case.
4939 (icf_preemptible_functions_test): New test case.
4940 (icf_string_merge_test): New test case.
4941 * testsuite.Makefile.in: Regenerate.
4942 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4943 bar_glob. Refactor code.
4944 * testsuite/icf_preemptible_functions_test.cc: New file.
4945 * testsuite/icf_preemptible_functions_test.sh: New file.
4946 * testsuite/icf_string_merge_test.cc: New file.
4947 * testsuite/icf_string_merge_test.sh: New file.
4948 * testsuite/icf_virtual_function_folding_test.cc: New file.
4949 * testsuite/icf_virtual_function_folding_test.sh: New file.
4950
04ceb17c
DK
49512010-04-14 Doug Kwan <dougkwan@google.com>
4952
4953 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4954 for local symbol recounting if we remove a section due to ICF.
4955 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4956 there are no regular objects in input.
4957
153e7da4
DK
49582010-04-13 Doug Kwan <dougkwan@google.com>
4959
4960 * arm.cc (Arm_input_section::set_final_data_size): Compute
4961 accurate final data size instead of using current data size.
4962
4dbd9faf
DK
49632010-04-09 Doug Kwan <dougkwan@google.com>
4964
4965 * layout.cc (Layout::choose_output_section): Handle script section
4966 types.
4967 (Layout::make_output_section_for_script): Add section type parameter.
4968 Handle script section types.
4969 * layout.h (Layout::make_output_section_for_script): Add section
4970 type parameter.
4971 * output.cc (Output_section::Output_section): Initialize data member
4972 is_noload_.
4973 (Output_section::do_reset_address_and_file_offset): Do not set address
4974 to 0 if section is a NOLOAD section.
4975 * output.h (Output_section::is_noload): New method.
4976 (Output_section::set_is_noload): Ditto.
4977 (Output_section::is_noload_): New data member.
4978 * script-c.h (Script_section_type): New enum type.
4979 (struct Parser_output_section_header): Add new file section_type.
4980 * script-sections.cc (Sections_element::output_section_name): Add
4981 parameter for returning script section type.
4982 (Output_section_definition::output_section_name): Ditto.
4983 (Output_section_definition::section_type)P; New method.
4984 (Output_section_definiton::script_section_type_name): Ditto.
4985 (Output_section_definition::script_section_type_): New data member.
4986 (Output_section_definition::Output_section_definition): Initialize
4987 data member Output_section_definition::script_section_type_.
4988 (Output_section_definition::create_sections): Pass script section type
4989 to Layout::make_output_section_for_script.
4990 (Output_section_definition::output_section_name): Return script
4991 section type to caller.
4992 (Output_section_definition::set_section_address): Do not advance
4993 dot value and load address if section type is NOLOAD. Set address
4994 of NOLOAD sections regardless of section flags.
4995 (Output_section_definition::print): Print section type if it is
4996 not SCRIPT_SECTION_TYPE_NONE.
4997 (Output_section_definition::section_type): New method.
4998 (Output_section_definition::script_section_type_name): Ditto.
4999 (Script_sections::output_section_name): Add new parameter
5000 PSECTION_TYPE for returning script section type. Pass it to
5001 section elements. Handle discard sections.
5002 (Sort_output_sections::operator()): Handle NOLOAD sections.
5003 * script-sections.h (Script_sections::Section_type): New enum type.
5004 (Script_sections::output_section_name): Add a new parameter for
5005 returning script section type.
5006 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5007 INFO and NOLOAD.
5008 * yyscript.y (union): Add new field SECTION_TYPE.
5009 (COPY, DSECT, INFO, NOLOAD): New tokens.
5010 (opt_address_and_section_type): Change type to output_section_header.
5011 (section_type): New non-terminal
5012 (section_header): Handle section type.
2253bfba 5013 (opt_address_and_section_type): Return section type value.
4dbd9faf 5014
721ea635
L
50152010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5016
5017 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5018 * testsuite/plugin_common_test_2.c (foo): Likewise.
5019
6bf924b0
DK
50202010-04-08 Doug Kwan <dougkwan@google.com>
5021
5022 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5023 Output_merge_data.
5024 * output.cc (Output_section::add_merge_input_section): Simplify
5025 code and return status of Output_merge_base::add_input_section.
e1df38aa 5026 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
5027 returns true.
5028
24af6f92
DK
50292010-04-07 Doug Kwan <dougkwan@google.com>
5030
5031 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5032 if section is marked as containing instructions but has no mapping
5033 symbols.
5034 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5035 correct section index.
5036 (Arm_relobj::find_linked_text_section): Ditto.
5037
00698fc5
CC
50382010-04-07 Cary Coutant <ccoutant@google.com>
5039
5040 * archive.cc (include_member): Destroy Read_symbols_data object before
5041 releasing file.
5042 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5043 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5044 (Read_symbols_data::~Read_symbols_data) New destructor.
5045 (Section_relocs::Section_relocs) New constructor.
5046 (Section_relocs::~Section_relocs) New destructor.
5047 (Read_relocs_data::Read_relocs_data) New constructor.
5048 (Read_relocs_data::~Read_relocs_data) New destructor.
5049 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5050 pointers to NULL after deleting.
5051
7296d933
DK
50522010-04-07 Doug Kwan <dougkwan@google.com>
5053
5054 * arm.cc: Replace "endianity" with "endianness" in comments.
5055 (Arm_exidx_cantunwind): Ditto.
5056 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5057 (Arm_relobj::merge_flags_and_attributes): New method.
5058 (Arm_relobj::merge_flags_and_attributes_): New data member.
5059 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5060 (Arm_relobj::scan_sections_for_stubs): Ditto.
5061 (Arm_relobj::do_read_symbols): Check to see if we really want to
5062 merge processor-specific flags and attributes. Exit early if
5063 an object is empty except for section names and the undefined symbol.
5064 (Target_arm::do_finalize_sections): Move check for ELF format to
5065 Arm_relobj::do_read_symbols. Merge processor specific flags and
5066 attributes from a regular object only when we have determined that
5067 it is aapropriate. Do not create an .ARM.attributes section in
5068 output if there is no regular input object.
5069 (Target_arm::merge_processor_specific_flags): Check
5070 --warn-mismatch before printing any error.
5071 (Target_arm::merge_object_attributes): Ditto.
5072 * gold.cc (queue_middle_tasks): Handle the case in which there is
5073 no regular object in input.
5074 * options.cc (General_options::parse_EB): New method.
5075 (General_options::parse_EL): Same.
5076 (General_options::General_options): Initialize endianness_.
5077 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5078 New options.
5079 (General_options::Endianness): New enum.
5080 (General_options::endianness): New method.
5081 (General_options::endianness_): New data member.
5082 * parameters.cc (Parameters::set_options): Check target endianness.
5083 (Parameters::set_target_once): Ditto.
5084 (Parameters::check_target_endianness): New method.
5085 (parameters_force_valid_target): If either -EL or -EB is specified,
5086 use it to define endianness of default target.
5087 * parameters.h (Parameters::check_target_endianness): New method
5088 declaration.
5089 * target.h (class Target): Change "endianity" to "endianness"
5090 in comments.
5091
efc8d4f2
RW
50922010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5093
5094 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5095 * configure: Regenerate.
5096 * Makefile.in: Regenerate.
5097 * testsuite/Makefile.in: Regenerate.
5098
be234d88
CC
50992010-04-06 Cary Coutant <ccoutant@google.com>
5100
5101 gcc PR lto/42757
5102 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5103 prevailing definitions of common symbols.
5104 * testsuite/plugin_test_6.sh: New test case.
5105 * testsuite/plugin_common_test_1.c: New test case.
5106 * testsuite/plugin_common_test_2.c: New test case.
5107 * testsuite/Makefile.am (plugin_test_6): New test case.
5108 * testsuite/Makefile.in: Regenerate.
5109
bd32c6bd
NC
51102010-04-06 Nick Clifton <nickc@redhat.com>
5111
5112 * po/vi.po: New Vietnamese translation.
5113
323c532f
DK
51142010-03-30 Doug Kwan <dougkwan@google.com>
5115
5116 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5117
4fcd97eb
DK
51182010-03-25 Doug Kwan <dougkwan@google.com>
5119
5120 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5121 to avoid a conversion warning on a 32-bit host.
5122
4ebf39db
ILT
51232010-03-24 Ian Lance Taylor <iant@google.com>
5124
5125 * testsuite/script_test_3.t: Add a TLS segment.
5126 * testsuite/Makefile.am (check_PROGRAMS): Add
5127 tls_phdrs_script_test.
5128 (tls_phdrs_script_test_SOURCES): Define.
5129 (tls_phdrs_script_test_DEPENDENCIES): Define.
5130 (tls_phdrs_script_test_LDFLAGS): Define.
5131 (tls_phdrs_script_test_LDADD): Define.
5132 * testsuite/Makefile.in: Rebuild.
5133
4a599bdd
CC
51342010-03-23 Cary Coutant <ccoutant@google.com>
5135
5136 * fileread.cc (find_or_make_view): Fix comment.
5137
6c93b22c
ILT
51382010-03-23 Ian Lance Taylor <iant@google.com>
5139
5140 * script-sections.cc (class Orphan_section_placement): Define
5141 PLACE_TLS and PLACE_TLS_BSS.
5142 (Orphan_section_placement::Orphan_section_placement): Initialize
5143 new places.
5144 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5145 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5146 (tls_script_test_SOURCES): Define.
5147 (tls_script_test_DEPENDENCIES): Define.
5148 (tls_script_test_LDFLAGS): Define.
5149 (tls_script_test_LDADD): Define.
5150 * testsuite/Makefile.in: Rebuild.
5151
a2c7281b
DK
51522010-03-22 Doug Kwan <dougkwan@google.com>
5153
5154 * arm.cc (Arm_relocate_functions::abs8,
5155 Arm_relocate_functions::abs16): Use correct check for overflow
5156 specified in the ARM ELF specs.
5157 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5158 target of a BLX instruction specially.
5159 (Reloc_stub::stub_type_for_reloc): Ditto.
5160 (Relocate::relocate): Use symbolic names instead of numeric relocation
5161 codes to report error.
5162 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5163 workaround.
5164 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5165 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5166 thumb2_blx_out_of_range.stdout
5167 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5168 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5169 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5170 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5171 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5172 thumb2_blx_in_range, thumb2_blx_in_range.o,
5173 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5174 thumb2_blx_out_of_range.o): New rules.
5175 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5176 thumb2_blx_in_range and thumb2_blx_out_of_range.
5177 * testsuite/Makefile.in: Regenerate.
5178 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5179 * testsuite/thumb_blx_in_range.s: New file.
5180 * testsuite/thumb_blx_out_of_range.s: New file.
5181
b0193076
RÁE
51822010-03-22 Rafael Espindola <espindola@google.com>
5183
5184 * archive.cc (Should_include): Move to archive.h.
5185 (should_include_member): Make it a member of Archive.
5186 (Lib_group): New.
5187 (Add_lib_group_symbols): New.
5188 * archive.h: Include options.h.
5189 (Archive_member): Moved from Archive.
5190 (Should_include): Moved from archive.cc.
5191 (Lib_group): New.
5192 (Add_lib_group_symbols): New.
5193 * dynobj.cc (do_should_include_member): New.
5194 * dynobj.h (do_should_include_member): New.
5195 * gold.cc (queue_initial_tasks): Update call to queue.
5196 * main.cc (main): Print lib group stats.
5197 * object.cc (do_should_include_member): New.
5198 * object.h: Include archive.h.
5199 (Object::should_include_member): New.
5200 (Object::do_should_include_member): New.
5201 (Sized_relobj::do_should_include_member): New.
5202 * options.cc (General_options::parse_start_lib): New.
5203 (General_options::parse_end_lib): New.
5204 (Input_arguments::add_file): Handle lib groups.
5205 (Input_arguments::start_group): Check we are not in a lib.
5206 (Input_arguments::start_lib): New.
5207 (Input_arguments::end_lib): New.
5208 * options.h (General_options): Add start_lib and end_lib.
5209 (Input_argument::lib_): New.
5210 (Input_argument::lib): New.
5211 (Input_argument::is_lib): New.
5212 (Input_file_lib): New.
5213 (Input_arguments::in_lib_): New.
5214 (Input_arguments::in_lib): New.
5215 (Input_arguments::start_lib): New.
5216 (Input_arguments::end_lib_): New.
5217 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5218 in unused members as preempted.
5219 (Sized_pluginobj::do_should_include_member): New.
5220 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5221 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5222 return the blocker.
5223 (Read_symbols::do_whole_lib_group): New.
5224 (Read_symbols::do_lib_group): New.
5225 (Read_symbols::do_read_symbols): Handle lib groups.
5226 (Read_symbols::get_name): Handle lib groups.
5227 * readsyms.h (Read_symbols): Add an archive member pointer.
5228 (Read_symbols::do_whole_lib_group): New.
5229 (Read_symbols::do_lib_group): New.
5230 (Read_symbols::member_): New.
5231 * script.cc (read_input_script): Update call to queue_soon.
5232
d099120c
DK
52332010-03-19 Doug Kwan <dougkwan@google.com>
5234
5235 * arm.cc (Stub_table::Stub_table): Initialize new data members
5236 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5237 (Stub_table::add_reloc_stub): Assign stub offset and update
5238 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5239 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5240 New data members.
5241 (Stub_table::update_data_size_and_addralign): Use
5242 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5243 instead of going over all reloc stubs.
5244 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5245 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5246 Stringpool_template::offset_ to size of Stringpool_char.
5247 (Stringpool_template::new_key_offset): Remove code to initialize
5248 Stringpool_template::offset_.
5249 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5250 Stringpool_template::offset_ to zero.
5251
1aa37384
DK
52522010-03-15 Doug Kwan <dougkwan@google.com>
5253
5254 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5255 offset_.
5256 (Stringpool_template::new_key_offset): New method.
5257 (Stringpool_template::add_string): Assign offsets when adding new
5258 strings.
5259 (Stringpool_template::set_string_offsets): Do not set string offsets
5260 when not optimizing.
5261 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5262 member size_.
5263 (Chunked_vector::clear): Clear size_.
5264 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5265 (Chunked_vector::size): Return size_.
5266 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 5267 (Chunked_vector::size_): New data member.
1aa37384
DK
5268 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5269 (Stringpool_template::new_key_offset): New method declaration.
5270 (Stringpool_template::offset_): New data member.
5271
b672b057
RÁE
52722010-03-15 Rafael Espindola <espindola@google.com>
5273
5274 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5275 Add_symbols' constructor.
5276 * readsyms.h (Add_symbols): Remove the input_group member.
5277
b6848d3c
ILT
52782010-03-10 Ian Lance Taylor <iant@google.com>
5279
5280 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5281 target to ask whether a reference to a symbol requires a stack
5282 split.
5283 * target.h (Target::is_call_to_non_split): New function.
5284 (Target::do_is_call_to_non_split): Declare virtual function.
5285 * target.cc: Include "symtab.h".
5286 (Target::do_is_call_to_non_split): New function.
5287 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5288
a2a5469e
CC
52892010-03-10 Cary Coutant <ccoutant@google.com>
5290
5291 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5292 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5293 (File_read::open[2]): Add whole_file_view_ to list of views.
5294 (File_read::make_view): Remove test of whole_file_view_.
5295 (File_read::find_or_make_view): Create whole_file_view_ if
5296 necessary.
5297 (File_read::clear_views): Replace bool parameter with enum;
5298 adjust all callers. Don't delete views with permanent data;
5299 do delete cached views and views from archives if
5300 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5301 if clearing the corresponding view.
5302 * fileread.h (File_read::Clear_views_mode): New enum.
5303 (File_read::View::is_permanent_view): New method.
5304 (File_read::clear_views): Replace bool parameter
5305 with enum; adjust all callers.
5306 * options.h (General_options): Change keep_files_mapped option;
5307 add map_whole_files.
5308 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5309 releasing the file.
5310 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5311 the file.
5312
8861f32b
DM
53132010-03-10 David S. Miller <davem@davemloft.net>
5314
5315 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5316
d62d0f5f
ST
53172010-03-09 Sriraman Tallam <tmsriram@google.com>
5318
5319 * icf.cc (get_section_contents): Add '@' marker after processing the
5320 merge reloc.
5321
9177756d
DK
53222010-03-08 Doug Kwan <dougkwan@google.com>
5323
5324 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5325 due to a conversion warning.
5326 (Arm_relobj::update_output_local_symbol_count): Check for local
5327 symbol with unset output index.
5328
9e9e071b
ILT
53292010-03-05 Ian Lance Taylor <iant@google.com>
5330
5331 * options.h (class General_options): Add --spare-dynamic-tags.
5332 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5333 --spare-dynamic-tags.
5334
a81ee015
ILT
53352010-03-05 Ian Lance Taylor <iant@google.com>
5336
5337 * incremental.cc: Include "libiberty.h".
5338
44ec90b9
RO
53392010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5340
5341 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5342 function, is_info_ member.
5343 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5344 (Versions::Versions): Update caller.
5345 (Versions::define_base_version): Likewise.
5346 (Versions::add_def): Likewise.
5347
0897ed3b
ST
53482010-03-03 Sriraman Tallam <tmsriram@google.com>
5349
5350 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5351 (Scan::possible_function_pointer_reloc): New function.
5352 (Scan::local_reloc_may_be_function_pointer): Change to call
5353 possible_function_pointer_reloc.
5354 (Scan::global_reloc_may_be_function_pointer): Ditto.
5355 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5356 relocations in ".data.rel.ro._ZTV" section.
5357 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5358 * testsuite/icf_safe_so_test.cc: Ditto.
5359 * testsuite/icf_safe_test.cc: Ditto.
5360 * testsuite/icf_safe_test.sh: Ditto.
5361
d3bbad62
ILT
53622010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5363 Ian Lance Taylor <iant@google.com>
5364
5365 * target-reloc.h (relocate_section): Check the symbol table index
5366 for -1U before setting the local symbol index.
5367 (scan_relocatable_relocs): If copying the relocation, record that
5368 the local symbol is required.
5369 * object.h (Symbol_value::is_output_symtab_index_set): New
5370 function.
5371 (Symbol_value::may_be_discarded_from_output_symtab): New
5372 function.
5373 (Symbol_value::has_output_symtab_entry): New function.
5374 (Symbol_value::needs_output_symtab_entry): Remove.
5375 (Symbol_value::output_symtab_index): Make sure the symbol index is
5376 set.
5377 (Symbol_value::set_output_symtab_index): Make sure the symbol
5378 index is not set. Make sure the new index is valid.
5379 (Symbol_value::set_must_have_output_symtab_entry): New function.
5380 (Symbol_value::has_output_dynsym_entry): New function.
5381 (Symbol_value::set_output_dynsym_index): Make sure the new index
5382 is valid.
5383 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5384 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5385 local symbol if permitted.
5386 (Sized_relobj::do_finalize_local_symbols): Call
5387 is_output_symtab_index_set rather than needs_output_symtab_entry.
5388 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5389 rather than needs_output_symtab_entry. Call
5390 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5391 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5392 is_output_symtab_index_set rather than needs_output_symtab_entry.
5393 * testsuite/discard_locals_relocatable_test.c: New file.
5394 * testsuite/discard_locals_test.sh: Test -r.
5395 * testsuite/Makefile.am (check_DATA): Add
5396 discard_locals_relocatable_test1.syms,
5397 discard_local_relocatable_test2.syms.
5398 (MOSTLYCLEANFILES): Likewise. Also add
5399 discard_locals_relocatable_test1.lout and
5400 discard_locals_relocatable_test2.out.
5401 (discard_locals_relocatable_test1.syms): New target.
5402 (discard_locals_relocatable_test.o): New target.
5403 (discard_locals_relocatable_test1.out): New target.
5404 (discard_locals_relocatable_test2.syms): New target.
5405 (discard_locals_relocatable_test2.out): New target.
5406 (various): Add missing ../ld-new dependencies.
5407 * testsuite/Makefile.in: Rebuild.
5408
7e8ccf26
NC
54092010-03-03 Nick Clifton <nickc@redhat.com>
5410
5411 * po/fi.po: New Finnish translation.
5412
2a0ff005
DK
54132010-03-01 Doug Kwan <dougkwan@google.com>
5414
5415 * layout.cc (Layout::Layout): Force section types of .init_array*,
5416 .preinit_array* and .fini_array* sections.
5417 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5418 Fix check of return value of std::string::find.().
5419 (Output_section::Input_section_sort_compare::operator()): Remove
5420 comment about .init_array.
5421 (Output_section::Input_section_sort_init_fini_compare::operator()):
5422 New method.
5423 (Output_section::sort_attached_input_sections): Handle .init_array
5424 and .fini_array specially.
5425 * output.h (Output_section::Inut_section_sort_compare): Update
5426 comment.
5427 (Output_section::Input_section_sort_init_fini_compare): New struct.
5428
c3e4ae29
DK
54292010-02-26 Doug Kwan <dougkwan@google.com>
5430
5431 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5432 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5433 * testsuite/debug_msg.sh: Avoid matching source line number for
5434 use of global variable undef_int.
5435
2fd9ae7a
DK
54362010-02-26 Doug Kwan <dougkwan@google.com>
5437
5438 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5439 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5440 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5441 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5442 * options.cc (General_options::General_options): Initialize member
5443 fix_v4bx_.
5444 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5445 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5446 and rm_no_fix_v4bx.stdout
5447 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5448 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5449 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5450 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5451 and arm_no_fix_v4bx.
5452 * Makefile.in: Regenerate.
5453 * testsuite/arm_fix_v4bx.s: New file.
5454 * testsuite/arm_fix_v4bx.sh: Ditto.
5455
67ec7d0b
DK
54562010-02-24 Doug Kwan <dougkwan@google.com>
5457
5458 * arm.cc (Target_arm::got_section): Make the .got section the first
5459 non RELRO section in the data segment.
5460 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5461 suffixes of section names.
5462
10165461
DK
54632010-02-24 Doug Kwan <dougkwan@google.com>
5464
5465 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5466 flags and attributes merging if an input file is a binary file.
5467 * fileread.cc (Input_file::open): Record format of original file.
5468 * fileread.h (Input_file::Format): New enum type.
5469 (Input_file::Input_file): Initialize data member format_.
5470 (Input_file::format): New method definition.
5471 (Input_file::format_):: New data member.
5472
4a54abbb
DK
54732010-02-24 Doug Kwan <dougkwan@google.com>
5474
5475 * arm.cc (Arm_output_data_got): New class.
5476 (ARM_TCB_SIZE): New constant
5477 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5478 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5479 If user uses a script with a SECTIONS clause, issue only a warning
5480 for a misplaced EXIDX input section. Otherwise, issue an error.
5481 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5482 garbage collection.
5483 (Target_arm::got_mode_index_entry): Handle static linking.
5484 (Target_arm::Scan::local): Ditto.
5485 (Target_arm::Scan::global): Ditto.
5486 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5487 all incorrectly implemented relocations.
e1df38aa 5488 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
5489 Arm_output_section::fix_exidx_coverage.
5490 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5491 from ".ARM.exidx." and ".ARM.extab.".
5492
ca419a6f
ILT
54932010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5494
5495 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5496 section if it does not already exist.
5497 * attributes.cc (Attributes_section_data::Attributes_section_data):
5498 Don't crash if size is zero.
5499
135b9c78
ILT
55002010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5501 Ian Lance Taylor <iant@google.com>
5502
5503 * gold.cc (queue_middle_tasks): If no input files were opened,
5504 exit.
5505 * workqueue.h (Task_function::Task_function): Assert that there is
5506 a blocker.
5507
bb0bfe4f
DK
55082010-02-22 Doug Kwan <dougkwan@google.com>
5509
5510 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5511 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5512 types to avoid warnings due to different uint64_t implementations
5513 on different hosts.
5514
2a2b6d42
DK
55152010-02-21 Doug Kwan <dougkwan@google.com>
5516
5517 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5518 handling of the maximum backward branch offset.
5519 (Arm_relocate_functions::thumb_branch_common): Ditto.
5520 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5521 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 5522 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
5523 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5524 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5525 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5526 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5527 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5528 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5529 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5530 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5531 thumb2_bl_out_of_range.o): New rules.
5532 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5533 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5534 thumb2_bl_out_of_range
5535 * testsuite/Makefile.in: Regenerate.
5536 * testsuite/arm_bl_in_range.s: New file.
5537 * testsuite/arm_bl_out_of_range.s: Ditto.
5538 * testsuite/arm_branch_in_range.sh: Ditto.
5539 * testsuite/arm_branch_range.t: Ditto.
5540 * testsuite/thumb2_branch_range.t: Ditto.
5541 * testsuite/thumb_bl_in_range.s: Ditto.
5542 * testsuite/thumb_bl_out_of_range.s: Ditto.
5543 * testsuite/thumb_branch_range.t: Ditto.
5544
b487ad64
ST
55452010-02-20 Sriraman Tallam <tmsriram@google.com>
5546
5547 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5548 Add reloc offset information.
5549 * icf.cc (get_section_contents): Change iterators to point to the new
5550 vectors. Add reloc offset information to the contents.
5551 * icf.h (Icf::Sections_reachable_info): New typedef.
5552 (Icf::Sections_reachable_list): New typedef.
5553 (Icf::Offset_info): New typedef.
5554 (Icf::Reloc_info): New struct typedef.
5555 (Icf::Reloc_info_list): New typedef.
5556 (Icf::symbol_reloc_list): Delete method.
5557 (Icf::addend_reloc_list): Delete method.
5558 (Icf::section_reloc_list): Delete method.
5559 (Icf::reloc_info_list): New method.
5560 (Icf::reloc_info_list_): New member.
5561
f96accdf
DK
55622010-02-19 Doug Kwan <dougkwan@google.com>
5563
5564 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5565 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5566 * arm.cc (Arm_relocation_functions): New forward declaration.
5567 (Target_arm::Target_arm): Initialize new data members
5568 got_mod_index_offset_ and tls_base_symbol_defined_.
5569 (Target_arm::Relocate::relocate_tls): New method.
5570 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5571 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5572 New methods.
5573 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5574 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5575 (Target_arm::got_mod_index_offset_,
5576 Target_arm::tls_base_symbol_defined_): New data members.
5577 (Target_arm::Scan::local, Target::Scan::global,
5578 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5579 relocations.
5580
c8761b9a
DK
55812010-02-18 Doug Kwan <dougkwan@google.com>
5582
5583 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5584 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5585 text section as a parameter becuase some broken tools may not set
5586 the link in section header.
5587 (Target_arm::has_got_section): New method.
5588 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5589 without any mapping symbol as data only. Remove warning.
5590 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5591 link in its section header, try to discover the link by inspecting the
5592 REL31 relocation at the beginning of the section.
5593 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5594 in error message.
5595 (Target_arm::Scan::global): Treat any reference to the symbol
5596 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5597
21bb3914
ST
55982010-02-12 Sriraman Tallam <tmsriram@google.com>
5599
5600 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5601 (Scan::global_reloc_may_be_function_pointer): New function.
5602 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5603 (Scan::global_reloc_may_be_function_pointer): New function.
5604 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5605 (Scan::global_reloc_may_be_function_pointer): New function.
5606 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5607 (Scan::global_reloc_may_be_function_pointer): New function.
5608 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5609 (Scan::global_reloc_may_be_function_pointer): New function.
5610 (Scan::possible_function_pointer_reloc): New function.
5611 (Target_x86_64::can_check_for_function_pointers): New function.
5612 * gc.h (gc_process_relocs): Scan relocation types to determine if
5613 function pointers were taken for targets that support it.
5614 * icf.cc (Icf::find_identical_sections): Include functions for
5615 folding in safe ICF whose pointer is not taken.
5616 * icf.h (Secn_fptr_taken_set): New typedef.
5617 (fptr_section_id_): New member.
5618 (section_has_function_pointers): New function.
5619 (set_section_has_function_pointers): New function.
5620 (check_section_for_function_pointers): New function.
5621 * options.h: Fix comment for safe ICF option.
5622 * target.h (can_check_for_function_pointers): New function.
5623 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5624 Modify icf_safe_test for X86-64.
5625 * testsuite/Makefile.in: Regenerate.
5626 * testsuite/icf_safe_so_test.cc: New file.
5627 * testsuite/icf_safe_so_test.sh: New file.
5628 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5629 (main): Change to take pointer to function kept_func_3.
5630 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5631 folding is done correctly for X86-64.
5632
0da6fa6c
DM
56332010-02-12 David S. Miller <davem@davemloft.net>
5634
5635 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5636 is_symbolless parameter.
5637 (Output_reloc<SHT_REL>::is_symbolless): New.
5638 (Output_reloc<SHT_REL>::is_symbolless_): New.
5639 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5640 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5641 (Output_reloc<SHT_RELA>::is_symbolless): New.
5642 (Output_data_reloc::add_global): Handle is_symbolless.
5643 (Output_data_reloc::add_global_relative): Likewise.
5644 (Output_data_reloc::add_local): Likewise.
5645 (Output_data_reloc::add_local_relative): Likewise.
5646 (Output_data_reloc::add_symbolless_global_addend): New.
5647 (Output_data_reloc::add_symbolless_local_addend): New.
5648 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5649 is_symbolless.
5650 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5651 instead of ->is_relative_
5652 (Output_reloc::write): Likewise.
5653 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5654 (Output_reloc::write_rel): Simplify.
5655
5656 * sparc.cc (Target_sparc::Scan::local): Use
5657 ->add_symbolless_local_addend as needed.
5658 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5659 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5660 based upon relocation offset.
5661
e4782e83
DK
56622010-02-11 Doug Kwan <dougkwan@google.com>
5663
5664 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5665 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5666 beginning of function.
5667 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5668 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5669 parameter is_32bit in calls to should_apply_static_reloc.
5670 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5671 (check_DATA): Add arm_abs_global.stdout.
5672 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5673 arm_abs_global.stdout): New rules.
5674 (MOSTLLYCLEANFILES): Add arm_abs_global
5675 * Makefile.in: Regenerate.
5676 * testsuite/arm_abs_global.s: New file.
5677 * testsuite/arm_abs_global.sh: Ditto.
5678 * testsuite/arm_abs_lib.s: Ditto.
5679
93ceb764
ILT
56802010-02-11 Ian Lance Taylor <iant@google.com>
5681
5682 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5683 Read_relocs task.
5684 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5685 Allocate_commons_task first.
5686 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5687 task, rather than symtab_lock_.
5688 (Gc_process_relocs::~Gc_process_relocs): New function.
5689 (Gc_process_relocs::is_runnable): Check this_blocker_.
5690 (Gc_process_relocs::locks): Use next_blocker_ rather than
5691 blocker_.
5692 (Scan_relocs::~Scan_relocs): New function.
5693 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5694 symtab_lock_.
5695 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5696 next_blocker_.
5697 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5698 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5699 constructor accordingly.
5700 (class Gc_process_relocs): Likewise.
5701 (class Scan_relocs): Likewise.
5702 * common.h (class Allocate_commons_task): Remove symtab_lock_
5703 field, and corresponding constructor parameter.
5704 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5705 symtab_lock_.
5706 (Allocate_commons_task::locks): Likewise.
5707
114dfbe1
ILT
57082010-02-11 Ian Lance Taylor <iant@google.com>
5709
5710 * gold-threads.h (class Once): Define.
5711 (class Initialize_lock): Rewrite as child of Once.
5712 * gold-threads.cc (class Once_initialize): Define.
5713 (once_pointer_control): New static variable.
5714 (once_pointer, once_arg): New static variables.
5715 (c_run_once): New static function.
5716 (Once::Once, Once::run_once, Once::internal_run): New functions.
5717 (class Initialize_lock_once): Remove.
5718 (initialize_lock_control): Remove.
5719 (initialize_lock_pointer): Remove.
5720 (initialize_lock_once): Remove.
5721 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5722 (Initialize_lock::initialize): Rewrite.
5723 (Initialize_lock::do_run_once): New function.
5724 * archive.cc (Archive::interpret_header): Only clear name if it is
5725 not already empty.
5726 * fileread.cc: Include "gold-threads.h"
5727 (file_counts_lock): New static variable.
5728 (file_counts_initialize_lock): Likewise.
5729 (File_read::release): Only increment counts when using --stats.
5730 Use a lock around the increment.
5731 * parameters.cc (class Set_parameters_target_once): Define.
5732 (set_parameters_target_once): New static variable.
5733 (Parameters::Parameters): Move here from parameters.h.
5734 (Parameters::set_target): Rewrite.
5735 (Parameters::set_target_once): New function.
5736 (Parameters::clear_target): Move here and rewrite.
5737 * parameters.h (class Parameters): Update declarations. Add
5738 set_parameters_target_once_ field.
5739 (Parameters::Parameters): Move to parameters.cc.
5740 (Parameters::clear_target): Likewise.
5741 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5742 task.
5743 (Start_group::~Start_group): New function.
5744 (Start_group::is_runnable): New function.
5745 (Start_group::locks, Start_group::run): New functions.
5746 (Finish_group::run): Change saw_undefined to size_t.
5747 * readsyms.h (class Start_group): Define.
5748 (class Finish_group): Change saw_undefined_ field to size_t.
5749 (Finish_group::Finish_group): Remove saw_undefined and
5750 this_blocker parameters. Change all callers.
5751 (Finish_group::set_saw_undefined): New function.
5752 (Finish_group::set_blocker): New function.
5753 * symtab.h (class Symbol_table): Change saw_undefined to return
5754 size_t. Change saw_undefined_ field to size_t.
5755 * target-select.cc (Set_target_once::do_run_once): New function.
5756 (Target_selector::Target_selector): Initialize set_target_once_
5757 field. Don't initialize lock_ and initialize_lock_ fields.
5758 (Target_selector::instantiate_target): Rewrite.
5759 (Target_selector::set_target): New function.
5760 * target-select.h (class Set_target_once): Define.
5761 (class Target_selector): Update declarations. Make
5762 Set_target_once a friend. Remove lock_ and initialize_lock_
5763 fields. Add set_target_once_ field.
5764
fa17a3f4
ILT
57652010-02-10 Ian Lance Taylor <iant@google.com>
5766
5767 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5768 queueing any tasks.
5769 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5770 (queue_middle_tasks): Add all blockers before queueing any tasks.
5771 (queue_final_tasks): Likewise.
5772 * token.h (Task_token::add_blockers): New function.
5773 * object.h (Input_objects::number_of_relobjs): New function.
5774
c7177d31
ILT
57752010-02-10 Ian Lance Taylor <iant@google.com>
5776
5de0e392
ILT
5777 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5778 shared, not if not position independent.
5779 * x86_64.cc (Relocate::relocate_tls): Likewise.
5780 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5781 (tls_pie_pic_test): New target.
5782 * testsuite/Makefile.in: Rebuild.
5783
c7177d31
ILT
5784 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5785 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5786 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5787 * testsuite/Makefile.in: Rebuild.
5788
684b268a
DM
57892010-02-09 David S. Miller <davem@davemloft.net>
5790
5791 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5792 R_SPARC_RELATIVE using ->add_local_relative().
5793 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5794
612a8d3d
DM
5795 * output.h (Output_data_dynamic::add_section_size): New method
5796 that takes two Output_data objects.
5797 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5798 entry param. Handle it in initializers.
5799 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5800 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5801 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5802 arg.
5803 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5804 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5805 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5806 for dynrel_includes_plt.
5807 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5808 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5809 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5810 before .rela.plt
5811 (Target_sparc::do_finalize_sections): Update to pass true for
5812 dynrel_includes_plt.
5813 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5814 output before .rela.plt
5815 (Target_powerpc::do_finalize_sections): Update to pass true for
5816 dynrel_includes_plt when 32-bit.
5817
cb1be87e
DK
58182010-02-08 Doug Kwan <dougkwan@google.com>
5819
5820 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5821 method.
5822 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5823 Arm_relobj::scan_section_for_cortex_a8_stubs,
5824 Arm_relobj::do_relocation_section): Instead of calling
5825 Output_section::output_address, use faster
5826 Arm_relobj::simple_input_section_output_address.
5827
705b5121
DM
58282010-02-08 David S. Miller <davem@davemloft.net>
5829
5830 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5831 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5832 relocation helper function.
5833
024c4466
DM
5834 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5835 just like R_SPARC_GOT{10,13,22}.
5836 (Target_sparc::Scan::local): Likewise.
5837 (Target_sparc::Relocate:relocate): Likewise.
5838
9109c078
ILT
58392010-02-06 Ian Lance Taylor <iant@google.com>
5840
5841 * configure.ac: Rewrite targetobjs duplicate removal code to use
5842 only shell constructs.
5843 * configure: Rebuild.
5844
cf846138
DK
58452010-02-05 Doug Kwan <dougkwan@google.com>
5846
5847 PR 11247
5848 * arm.cc (Arm_relobj::section_is_scannable): New method.
5849 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5850 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5851
6cfaf60b
DK
58522010-02-04 Doug Kwan <dougkwan@google.com>
5853
5854 PR 11247
5855 * arm-reloc-property.cc (cstdio): Include.
5856 * configure.ac (targetobjs): Remove duplicates.
5857 * configure: Regenerate.
5858 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5859 big and little endian version for a given address size.
5860
5c57f1be
DK
58612010-02-03 Doug Kwan <dougkwan@google.com>
5862
5863 * arm-reloc-property.cc
5864 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5865 definition.
5866 * arm-reloc-property.h
5867 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5868 New method definition.
5869 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5870 declaration.
5871 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5872 overflow to N.
5873 (GOT_PREL): Change implemented to Y.
5874 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5875 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5876 (Arm_relocate_functions::movw_abs_nc): Remove method.
5877 (Arm_relocate_functions::movt_abs): Ditto.
5878 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5879 (Arm_relocate_functions::thm_movt_abs): Ditto.
5880 (Arm_relocate_functions::movw_rel_nc): Ditto.
5881 (Arm_relocate_functions::movw_rel): Ditto.
5882 (Arm_relocate_functions::movt_rel): Ditto.
5883 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5884 (Arm_relocate_functions:thm_movw_rel): Ditto.
5885 (Arm_relocate_functions:thm_movt_rel): Ditto.
5886 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5887 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5888 New method definitions.
5889 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5890 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5891 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5892 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5893 (Target_arm::Relocate::relocate): Check for non-static or
5894 unimplemented relocation code and exit early. Change calls to
5895 Target_arm::reloc_uses_thumb_bit and
5896 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5897 instead. Refactor code to handle similar relocations to increase
5898 code sharing. Remove check for unsupported relocation code in switch
5899 statement.
5900 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5901 relocation property table to find out size. Change error message to
5902 print out the name of a relocation code instead of the numeric value.
5903 (Target_arm::scan_reloc_for_stub): Use relocation property table
5904 instead of calling Target_arm::reloc_uses_thumb_bit().
5905
218c5831
DK
59062010-02-02 Doug Kwan <dougkwan@google.com>
5907
5908 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5909 types of relaxed input section.
5910
0d31c79d
DK
59112010-02-02 Doug Kwan <dougkwan@google.com>
5912
5913 * Makefile.am (HFILES): Add arm-reloc-property.h.
5914 (DEFFILES): New.
5915 (TARGETSOURCES): Add arm-reloc-property.cc
5916 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5917 (libgold_a_SOURCES): $(DEFFILES)
5918 * Makefile.in: Regenerate.
5919 * arm-reloc-property.cc: New file.
5920 * arm-reloc-property.h: New file.
5921 * arm-reloc.def: New file.
5922 * arm.cc: Update comments.
5923 (arm-reloc-property.h): New included header.
5924 (arm_reloc_property_table): New global variable.
5925 (Target_arm::do_select_as_default_target): New method definition.
5926 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5927 arm-reloc-property to targ_extra_obj.
5928 * parameters.cc (set_parameters_target): Call
5929 Target::select_as_default_target().
5930 * target.h (Target::select_as_default_target): New method definition.
5931 (Target::do_select_as_default_target): Same.
5932
546c7457
DK
59332010-02-01 Doug Kwan <dougkwan@google.com>
5934
5935 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5936 first_output_text_section_.
5937 (Arm_exidx_fixup::first_output_text_section): New method definition.
5938 (Arm_exidx_fixup::first_output_text_section_): New data member.
5939 (Arm_exidx_fixup::process_exidx_section): Record the first text
5940 output section seen.
5941 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5942 and entsize in output section header.
5943
11b861d5
DK
59442010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5945
5946 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5947 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5948 (Arm_relocate_functions::thm_alu11): New Method.
5949 (Arm_relocate_functions::thm_pc8): New Method.
5950 (Arm_relocate_functions::thm_pc12): New Method.
5951 (Target_arm::Scan::local): Handle the relocations.
5952 (Target_arm::Scan::global): Likewise.
5953 (Target_arm::Relocate::relocate): Likewise.
5954 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5955
c9a2c125
DK
59562010-01-29 Doug Kwan <dougkwan@google.com>
5957
5958 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5959 of relocation types as ld.
5960
1521477a
DK
59612010-01-29 Doug Kwan <dougkwan@google.com>
5962
5963 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5964 to public.
5965 (Arm_relocate_functions::thumb_branch_common): Ditto.
5966 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5967 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5968 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5969 Arm_relocate_functions::jump24): Remove.
5970 (Target_arm::Relocate::relocate): Adjust code to call
5971 Arm_relocation_functions::arm_branch_common and
5972 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 5973 wrappers. Merge switch-cases together to reduce source code size.
1521477a 5974
e7eca48c
DK
59752010-01-29 Doug Kwan <dougkwan@google.com>
5976
5977 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5978 output_local_symbol_count_needs_update_.
5979 (Arm_relobj::output_local_symbol_count_needs_update,
5980 Arm_relobj::set_output_local_symbol_count_needs_update,
5981 Arm_relobj::update_output_local_symbol_count): New methods.
5982 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5983 member.
5984 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5985 of pointed function as in a R_ARM_PREL31 relocation.
5986 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5987 for output local symbol count updating.
5988 (Target_arm::do_relax): Update output local symbol counts in objects
5989 if necessary.
5990 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5991
02961d7e
ILT
59922010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5993
5994 * arm.cc: Added support for the ARM relocations:
5995 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5996 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5997 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5998 movw_prel_nc).
5999 (Arm_relocate_functions::movw_rel): New method.
6000 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6001 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6002 thm_movw_prel_nc).
6003 (Arm_relocate_functions::thm_movw_rel): New method.
6004 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6005 thm_movt_prel).
6006 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6007 relocations.
6008 (Target_arm::Scan::global): Likewise.
6009 (Target_arm::Relocate::relocate): Likewise.
6010 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6011 Likewise.
6012
b10d2873
ILT
60132010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6014
6015 * arm.cc: Added support for ARM group relocations.
6016 (Target_arm::reloc_needs_sym_origin): New method.
6017 (Arm_relocate_functions::calc_grp_kn): New method.
6018 (Arm_relocate_functions::calc_grp_residual): New method.
6019 (Arm_relocate_functions::calc_grp_gn): New method.
6020 (Arm_relocate_functions::arm_grp_alu): New Method.
6021 (Arm_relocate_functions::arm_grp_ldr): New Method.
6022 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6023 (Arm_relocate_functions::arm_grp_ldc): New Method.
6024 (Target_arm::Scan::local): Handle the ARM group relocations.
6025 (Target_arm::Scan::global): Likewise.
6026 (Target_arm::Relocate::relocate): Likewise.
6027 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6028 Likewise.
6029
2b328d4e
DK
60302010-01-26 Doug Kwan <dougkwan@google.com>
6031
6032 * arm.cc (set): Include.
6033 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6034 pointer type.
6035 (Arm_output_section::Text_section_list): New type.
6036 (Arm_output_section::append_text_sections_to_list): New method.
6037 (Arm_output_section::fix_exidx_coverage): Ditto.
6038 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6039 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6040 Relobj::set_section_offset() instead of
6041 Sized_relobj::invalidate_section_offset().
6042 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6043 parameter for section headers. Ignore relocation sections for
6044 unallocated sections and EXIDX sections.
6045 (Target_arm::fix_exidx_coverage): New method.
6046 (Target_arm::output_section_address_less_than): New type.
6047 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6048 linked text section instead of the EXIDX section.
6049 (Arm_output_section::create_stub_group): Add an assertion to check
6050 that this is not an EXIDX output section.
6051 (Arm_output_section::append_text_sections_to_list): New method.
6052 (Arm_output_section::fix_exidx_coverage): Ditto.
6053 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6054 Arm_relobj::section_needs_reloc_stub_scanning.
6055 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6056 first pass.
6057 (Target_arm::fix_exidx_coverage): New method.
6058 * object.h (Relobj::set_output_section): New method.
6059 (Sized_relobj::invalidate_section_offset): Remove method.
6060 (Sized_relobj::do_invalidate_section_offset): Remove method.
6061 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6062
c7f3c371
DK
60632010-01-25 Doug Kwan <dougkwan@google.com>
6064
6065 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6066 Fix warning due to signed and unsigned comparison on a 32-bit host.
6067
8923b24c
DK
60682010-01-22 Doug Kwan <dougkwan@google.com>
6069
6070 * arm.cc (Target_arm::do_relax): Record an output section for section
6071 offset adjustment it contains any stub table that has changed.
6072 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6073 offsets in an output section if necessary.
6074 * output.cc (Output_section::Output_section): Initialize
6075 section_offsets_need_adjustments_.
6076 (Output_section::add_input_section_for_script): Renamed to
6077 Output_section::add_simple_input_section.
6078 (Output_section::save_states): Add a comment.
6079 (Output_section::discard_states): New method defintion.
6080 (Output_section::adjust_section_offsets): Same.
6081 * output.h (Output_section::add_input_section_for_script): Renamed to
6082 Output_section::add_simple_input_section.
6083 (Output_section::discard_states): New method declaration.
6084 (Output_section::adjust_section_offsets): Same.
6085 (Output_section::section_offsets_need_adjustment,
6086 Output_section::set_section_offsets_need_adjustment): New method
6087 definitions.
6088 (Output_section::section_offsets_need_adjustment_): New data member.
6089 * script-sections.cc
6090 (Output_section_element_input::set_section_address): Adjust code for
6091 renaming of Output_section::add_input_section_for_script.
6092 (Orphan_output_section::set_section_address): Same.
6093
9b2fd367
DK
60942010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6095
6096 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6097 Fix_v4bx enum values .
6098 * gold/options.h (General_options): New option definitions.
6099 (General_options::fix_v4bx): New method.
6100 (General_options::Fix_v4bx): New enum.
6101 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6102 (General_options::parse_fix_v4bx_interworking): New method.
6103
80d0d023
DK
61042010-01-22 Doug Kwan <dougkwan@google.com>
6105
6106 * arm.cc (Arm_exidx_fixup): New class.
6107
af2cdeae
DK
61082010-01-21 Doug Kwan <dougkwan@google.com>
6109
6110 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6111 classes.
6112 (Arm_exidx_section_offset_map): New type.
6113
993d07c1
DK
61142010-01-21 Doug Kwan <dougkwan@google.com>
6115
6116 * arm.cc (Arm_exidx_input_section): New class.
6117 (Arm_relobj::exidx_input_section_by_link,
6118 Arm_relobj::exidx_input_section_by_shndx,
6119 Arm_relobj::make_exidx_input_section): New methods.
6120 (read_arm_attributes_section): Remove.
6121 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6122 information about them.
6123 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6124 to here.
6125
5ac169d4
DK
61262010-01-20 Doug Kwan <dougkwan@google.com>
6127
6128 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6129 Input_section_specifier to Section_id.
6130 (Target_arm::new_arm_input_section: Adjust code for change of key
6131 type.
6132 (Target_arm::find_arm_input_section): Ditto.
6133 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6134 (Section_id): Remove.
6135 (Garbage_collection::Section_id_hash): Remove.
6136 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6137 (Section_id): Remove.
6138 (Icf::Section_id_hash): Remove.
6139 * object.h (Section_id, Const_section_id, Section_id_hash,
6140 Const_section_id_hash): New type definitions.
6141 * output.cc (Output_section::add_relaxed_input_section): Change to
6142 use Const_section_id instead of Input_section_specifier as key type.
6143 (Output_section::add_merge_input_section): Ditto.
6144 (Output_section::build_relaxation_map): Change to use Section_id
6145 instead of Input_section_specifier as key type.
6146 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6147 Ditto.
6148 (Output_section::convert_input_sections_to_relaxed_sections): Change
6149 to use Const_section_id instead of Input_section_specifier as key type.
6150 (Output_section::find_merge_section): Ditto.
6151 (Output_section::find_relaxed_input_section): Ditto.
6152 * output.h (Input_section_specifier): Remove class.
6153 (Output_section::Output_section_data_by_input_section_map): Change
6154 key type to Const_section_id.
6155 (Output_section::Output_relaxed_input_section_by_input_section_map):
6156 Ditto.
6157 (Output_section::Relaxation_map): Change key type to Section_id.
6158
a2162063
ILT
61592010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6160
6161 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6162 (class Arm_v4bx_stub): New class.
6163 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6164 (Stub_factory::make_arm_v4bx_stub): New method.
6165 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6166 (Stub_table::empty): Handle v4bx stubs.
6167 (Stub_table::add_arm_v4bx_stub): New method.
6168 (Stub_table::find_arm_v4bx_stub): New method.
6169 (Arm_relocate_functions::v4bx): New method.
6170 (Target_arm::fix_v4bx): New method.
6171 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6172 (Stub_table::relocate_stubs): Likewise.
6173 (Stub_table::do_write): Likewise.
6174 (Stub_table::update_data_size_and_addralign): Likewise.
6175 (Stub_table::finalize_stubs): Likewise.
6176 (Target_arm::Scan::local): Likewise.
6177 (Target_arm::Scan::global): Likewise.
6178 (Target_arm::do_finalize_sections): Likewise.
6179 (Target_arm::Relocate::relocate): Likewise.
6180 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6181 Likewise.
6182 (Target_arm::scan_reloc_for_stub): Likewise.
6183 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6184
5696ab0b
ILT
61852010-01-19 Ian Lance Taylor <iant@google.com>
6186
6187 * output.cc (Output_section_headers::do_sized_write): Write large
6188 segment count to sh_info field.
6189 (Output_file_header::do_sized_write): For large segment count,
6190 write PN_XNUM to e_phnum field.
6191
800d0f56
ILT
61922010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6193
6194 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6195 (Arm_relocate_functions::thm_jump8): New function.
6196 (Arm_relocate_functions::thm_jump11): New function.
6197 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6198 R_ARM_THM_JUMP11.
6199 (Target_arm::Scan::global): Likewise.
6200 (Target_arm::Relocate::relocate): Likewise.
6201 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6202 Likewise.
6203
41263c05
DK
62042010-01-14 Doug Kwan <dougkwan@google.com>
6205
6206 * arm.cc (map, utility): Include headers.
6207 (Target_arm::apply_cortex_a8_workaround): New method.
6208 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6209 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6210 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6211 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6212 the --[no-]fix-cortex-a8 command line options.
6213 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6214 (Target_arm::relocate_stub): Use addend in instruction template.
6215 * options.h (DEFINE_bool): Set the user-set flag.
6216 (General_options): Add --[no-]-fix-cortex options.
6217 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 6218 : Update fast look-up map after conversion.
41263c05 6219
459e9b03
ST
62202010-01-14 Sriraman Tallam <tmsriram@google.com>
6221
6222 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6223 in the first pass of do_layout.
6224
b521dfe4
DK
62252010-01-13 Doug Kwan <dougkwan@google.com>
6226
6227 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6228 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6229 apparent compiler problem of not folding static constant integral
6230 data members of elfcpp::Elf_sizes<32>.
6231
44272192
DK
62322010-01-13 Doug Kwan <dougkwan@google.com>
6233
6234 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6235 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6236 Arm_relobj::scan_section_for_cortex_a8_erratum,
6237 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6238 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6239 sections to scan for relocation stubs into a new method
6240 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6241 relocation and Cortex-A8 stub scanning.
6242 (Target_arm::do_relax): Force stubs to be after stubbed sections
6243 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 6244 the beginning of a new relaxation pass. Update a comment.
44272192
DK
6245 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6246
44b71ece
ILT
62472010-01-12 Ian Lance Taylor <iant@google.com>
6248
6249 * target-reloc.h (visibility_error): New inline function.
6250 (relocate_section): Call visibility_error.
6251 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6252 (MOSTLYCLEANFILES): Likewise.
6253 (protected_4_pic.o, protected_3.err): New targets.
6254 * testsuite/protected_4.cc: New file.
6255
a120bc7f
DK
62562010-01-12 Doug Kwan <dougkwan@google.com>
6257
6258 * arm.cc (Cortex_a8_reloc): New class.
6259 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6260 and cortex_a8_relocs_info_.
6261 (Target_arm::fix_cortex_a8): New method definition.
6262 (Target_arm::Cortex_a8_relocs_info): New type.
6263 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6264 New data member declarations.
6265 (Target_arm::scan_reloc_for_stub): Record information about
6266 relocations for THUMB branches that might be exempted from the
6267 Cortex-A8 workaround.
6268 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6269 at the beginning of a relaxation pass.
6270
20138696
DK
62712010-01-12 Doug Kwan <dougkwan@google.com>
6272
6273 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6274 (Arm_relobj::Mapping_symbol_position,
6275 Arm_reloj::Mapping_symbol_position_less,
6276 Arm_relobj::Mapping_symbols_info): New types.
6277 (Target_arm::is_mapping_symbol_name): New method definition.
6278 (Arm_relobj::do_count_local_symbols): Save information about mapping
6279 symbols.
6280
089d69dc
DK
62812010-01-11 Doug Kwan <dougkwan@google.com>
6282
6283 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6284 Arm_relocate_functions::thumb32_branch_upper,
6285 Arm_relocate_functions::thumb32_branch_lower,
6286 Arm_relocate_functions::thumb32_cond_branch_offset,
6287 Arm_relocate_functions::thumb32_cond_branch_upper,
6288 Arm_relocate_functions::thumb32_cond_branch_lower,
6289 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6290 branch offset encoding.
6291 (Arm_relocate_functions::thumb_branch_common): Use new branch
6292 offset encoding methods to avoid code duplication.
6293 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6294 (Stub_addend_reader::operator()): Use new branch encoding method
6295 to avoid code duplication.
6296
99e5bff2
DK
62972010-01-11 Doug Kwan <dougkwan@google.com>
6298
6299 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6300 (Target_arm::do_finalize_sections): Define special EXIDX section
6301 symbols only if referenced.
6302 * gc.h (Garbage_collection::add_reference): New method.
6303 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6304 code duplication.
6305
98e090bd
ILT
63062010-01-11 Ian Lance Taylor <iant@google.com>
6307
d0a91bd8
ILT
6308 * script.cc (Version_script_info::build_expression_list_lookup):
6309 Change complaing about duplicate wildcard match from error to
6310 warning.
6311
98e090bd
ILT
6312 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6313 of 2009-12-30.
6314 (Version_script_info::Version_script_info): Initialize globs_,
6315 default_version_, default_is_global_, and exact_. Don't
6316 initialize globals_ or locals_.
6317 (Version_script_info::build_lookup_tables): Build local symbols
6318 first.
6319 (Version_script_info::unquote): New function.
6320 (Version_script_info::add_exact_match): New function.
6321 (Version_script_info::build_expression_list_lookup): Remove lookup
6322 parameter. Add is_global parameter. Change all callers. Handle
6323 wildcard pattern specially. Unquote pattern. Call
6324 add_exact_match.
6325 (Version_script_info::get_name_to_match): New function.
6326 (Version_script_info::get_symbol_version): New function.
6327 (Version_script_info::get_symbol_version_helper): Remove.
6328 (Version_script_info::check_unmatched_names): Call unquote.
6329 * script.h (class Version_script_info): Change get_symbol_version
6330 to be non-inline and add is_global parameter; change all callers.
6331 Rewrite symbol_is_local. Update declarations. Define struct
6332 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6333 Remove globals_ and locals_ members. Add exact_, globs_,
6334 default_version_, is_global_.
6335 (Version_script_info::Glob): Remove pattern, add expression and
6336 is_global. Update constructor. Change all callers.
6337 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6338 default version.
6339 (Versions::symbol_section_contents): If a symbol is undefined, or
6340 defined in a dynamic object, set the version index to
6341 VER_NDX_LOCAL.
6342 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6343 symbol_is_local.
6344 (Symbol_table::add_from_pluginobj): Likewise.
6345 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6346
d56962d3
DK
63472010-01-11 Doug Kwan <dougkwan@google.com>
6348
6349 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6350 (incremental_dump_LDADD): Add linking option for libintl.
6351 * Makefile.in: Regenerate.
6352
94e6ee91
L
63532010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6354
6355 PR gold/11144
6356 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6357 instead of -Ds.
6358 * testsuite/Makefile.in: Regenerated.
6359
e96c574b
DK
63602010-01-10 Doug Kwan <dougkwan@google.com>
6361
6362 * options.h (DEFINE_var): Use parentheses around argument varname__
6363 in macro body to avoid any unintended subsequent substitutions.
6364
7198066b
ILT
63652010-01-10 Ian Lance Taylor <iant@google.com>
6366
ba4d53bf
ILT
6367 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6368 candidates before doing symbol resolution.
6369
7198066b
ILT
6370 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6371 ODR candidates if only one is weak.
6372
a2beed37
ILT
63732010-01-08 Ian Lance Taylor <iant@google.com>
6374
6375 * script.cc (Version_script_info::build_expression_list_lookup):
6376 Don't warn about ambiguous version, just record the ambiguity.
6377 (Version_script_info::get_symbol_version_helper): Give error if
6378 version is ambiguous.
6379
2fb7225c
DK
63802010-01-08 Doug Kwan <dougkwan@google.com>
6381
6382 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6383 prev_data_size_ and prev_addralign_. Remove initializer for
6384 deleted data member has_been_changed_.
6385 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6386 to determine if the table is empty.
6387 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6388 Remove.
6389 (Stub_table::add_reloc_stub): Define method in class definition
6390 instead of just declaring it there.
6391 (Stub_table::add_cortex_a8_stub): New method definition.
6392 (Stub_table::update_data_size_and_addralign): Ditto.
6393 (Stub_table::finalize_stubs): Ditto.
6394 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6395 (Stub_table::do_addralign_): Return address alignment in the
6396 (Stub_table::do_reset_address_and_file_offset): Define method in
6397 class definition instead of declaring it there. Set current data
6398 size to be the data size of the previous pass.
6399 (Stub_table::set_final_data_size): Use current data size as the
6400 final data size.
6401 (Stub_table::relocate_stub): Change parameter type of stub from
6402 Reloc_stub pointer to Stub pointer.
6403 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6404 (Stub_table::Cortex_a8_stub_list): New typedef.
6405 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6406 Stub_table::prev_addralign_): New data member.
6407 (Arm_relobj::Arm_relobj): Initialize data member
6408 section_has_cortex_a8_workaround_.
6409 (Arm_relobj::section_has_cortex_a8_workaround,
6410 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6411 definitions.
6412 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6413 declarations.
6414 (Target_arm::relocate_stub): Change parameter type of stub from
6415 Reloc_stub pointer to Stub pointer.
6416 (Insn_template::size, Insn_template::alignment): Handle
6417 THUMB16_SPECIAL_TYPE.
6418 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6419 Stub_table::update_data_size_and_addralign,
6420 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6421 definitions.
6422 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6423 (Stub_table::do_write): Ditto.
6424 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6425
880cd20d
ILT
64262010-01-08 Ian Lance Taylor <iant@google.com>
6427
6428 PR 11108
6429 * symtab.h (class Symbol): Remove fields is_target_special_ and
6430 has_plt_offset_. Add field is_defined_in_discarded_section_.
6431 (Symbol::is_defined_in_discarded_section): New function.
6432 (Symbol::set_is_defined_in_discarded_section): New function.
6433 (Symbol::has_plt_offset): Rewrite.
6434 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6435 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6436 Don't initialize is_target_special_ or has_plt_offset_.
6437 Initialize is_defined_in_discarded_section_.
6438 (Symbol_table::add_from_relobj): If appropriate, set
6439 is_defined_in_discarded_section.
6440 * resolve.cc (Symbol::override_base_with_special): Don't test
6441 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6442 * target-reloc.h (relocate_section): Do special handling for
6443 symbols defined in discarded sections for global symbols as well
6444 as local symbols.
6445
2703e3eb
ILT
64462010-01-08 Ian Lance Taylor <iant@google.com>
6447
6448 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6449 the SHT_SYMTAB case.
6450
339d40a3
ILT
64512010-01-08 Ian Lance Taylor <iant@google.com>
6452
6453 * object.cc (Sized_relobj::do_layout): Don't get confused if
6454 layout_eh_frame returns NULL.
6455
abecea76
ILT
64562010-01-08 Ian Lance Taylor <iant@google.com>
6457
6458 PR 11084
6459 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6460 dynamic symbol table, use the normal symbol table.
6461 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6462 symbol table.
6463
6b7dd3f3
ILT
64642010-01-08 Ian Lance Taylor <iant@google.com>
6465
6466 PR 11072
6467 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6468 sections.
6469
36c50e63
L
64702010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6471
6472 * version.cc (print_version): Change to "Copyright 2010".
6473
e291e7b9
ILT
64742010-01-08 Ian Lance Taylor <iant@google.com>
6475
6476 PR 10287
6477 PR 11063
6478 * i386.cc (class Target_i386): Change return type of plt_section
6479 to be non-const.
6480 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6481 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6482 tls_desc_rel_ field.
6483 (Output_data_plt_i386::rel_tls_desc): New function.
6484 (Target_i386::rel_tls_desc_section): New function.
6485 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6486 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6487 R_386_TLS_DESC reloc in rel_tls_desc_section.
6488 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6489 Define struct Tlsdesc_info.
6490 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6491 (Target_x86_64::do_reloc_symbol_index): New function.
6492 (Target_x86_64::add_tlsdesc_info): New function.
6493 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6494 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6495 tlsdesc_rel_ field.
6496 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6497 all callers.
6498 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6499 (Target_x86_64::rela_tlsdesc_section): New function.
6500 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6501 handling.
6502 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6503 (Target_x86_64::do_reloc_addend): New function.
6504 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6505 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6506 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6507 (Output_reloc::type): New function.
6508 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6509 (Output_reloc::is_target_specific): New function.
6510 (Output_reloc::target_arg): New function.
6511 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6512 absolute relocs and target specific relocs.
6513 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6514 add_target_specific.
6515 (class Output_data_reloc) [SHT_RELA]: Likewise.
6516 * output.cc (Output_reloc::Output_reloc): Add four new versions
6517 for absolute relocs and target specific relocs.
6518 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6519 (Output_reloc::get_symbol_index): Likewise.
6520 (Output_reloc::local_section_offset): Check that local_sym_index_
6521 is not TARGET_CODE or 0.
6522 (Output_reloc::symbol_value): Likewise.
6523 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6524 reloc.
6525 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6526 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6527 functions.
6528 * layout.cc (add_target_dynamic_tags): Use output section for
6529 DT_PLTRELSZ and DT_JMPREL.
6530
3a44184e
ILT
65312010-01-07 Ian Lance Taylor <iant@google.com>
6532
6533 PR 11061
6534 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6535 function.
6536 (class Output_data_reloc_generic): Define.
6537 (class Output_data_reloc_base): Change base class to
6538 Output_data_reloc_generic. Change add() method to call
6539 bump_relative_reloc_count for a relative reloc. Remove
6540 sort_relocs_ field.
6541 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6542 to sort_relocs().
6543 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6544 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6545 appropriate.
6546 * layout.h (class Layout): Update declaration.
6547
ea715a34
ILT
65482010-01-07 Ian Lance Taylor <iant@google.com>
6549
6550 * output.h (class Output_data): Add const version of
6551 output_section and do_output_section.
6552 (class Output_section_data): Add const version of
6553 do_output_section.
6554 (class Output_section): Likewise.
6555 * layout.cc (Layout::add_target_dynamic_tags): New function.
6556 * layout.h (class Layout): Update declarations.
6557 * arm.cc (Target_arm::do_finalize_sections): Use
6558 add_target_dynamic_tags.
6559 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6560 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6561 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6562 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6563
659948a4
ILT
65642010-01-07 Ian Lance Taylor <iant@google.com>
6565
6566 PR 11042
6567 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6568 object as needed.
6569
9d3b86f6
ILT
65702010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6571 Ian Lance Taylor <iant@google.com>
6572
6573 PR 11019
6574 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6575 Xindex::read_symtab_xindex.
6576
bb0d3eb0
DK
65772010-01-07 Doug Kwan <dougkwan@google.com>
6578
6579 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6580 (Insn_template::thumb16_bcond_insn): New method declaration.
6581 (Insn_template): Fix spelling.
6582 (Stub::thumb16_special): New method declaration.
6583 (Stub::do_write): Define virtual method which was previously pure
6584 virtual.
6585 (Stub::do_thumb16_special): New method declaration.
6586 (Stub::do_fixed_endian_write): New template member.
6587 (Reloc_stub::do_write): Remove.
6588 (Reloc_stub::do_fixed_endian_write): Remove.
6589 (Cortex_a8_stub): New class definition.
6590 (Stub_factory::make_cortex_a8_stub): New method definition.
6591 (Stub_factory::Stub_factory): Add missing static storage class
6592 qualifier for elf32_arm_stub_a8_veneer_blx.
6593
ffeef7df
ILT
65942010-01-07 Ian Lance Taylor <iant@google.com>
6595
dc3f80fe
ILT
6596 PR 10980
6597 * options.h (class General_options): Add --warn-unresolved-symbols
6598 and --error-unresolved-symbols.
6599 * errors.cc (Errors::undefined_symbol): Implement
6600 --warn-unresolved-symbols.
6601
ffeef7df
ILT
6602 * options.h (class General_options): Add -z text and -z textoff.
6603 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6604
f1ec9ded
ST
66052010-01-06 Sriraman Tallam <tmsriram@google.com>
6606
6607 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6608 (Garbage_collection::cident_sections): New function.
6609 (Garbage_collection::add_cident_section): New function.
6610 (Garbage_collection::cident_sections_): New member.
6611 (gc_process_relocs): Add references to sections whose names are C
6612 identifiers.
6613 * gold.h (cident_section_start_prefix): New constant.
6614 (cident_section_stop_prefix): New constant.
6615 (is_cident): New function.
6616 * layout.cc (Layout::define_section_symbols): Replace string constants
6617 with the newly defined constants.
6618 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6619 C identifiers.
6620 * testsuite/Makefile.am: Add gc_orphan_section_test.
6621 * testsuite/Makefile.in: Regenerate.
6622 * testsuite/gc_orphan_section_test.cc: New file.
6623 * testsuite/gc_orphan_section_test.sh: New file.
6624
6eda8c29
ILT
66252010-01-06 Ian Lance Taylor <iant@google.com>
6626
b9674e17
ILT
6627 PR 10980
6628 * options.h (class General_options): Add --warn-shared-textrel.
6629 * layout.cc (Layout::finish_dynamic_section): Implement
6630 --warn-shared-textrel.
6631
6eda8c29
ILT
6632 PR 10980
6633 * options.h (class General_options): Add --warn-multiple-gp.
6634
32dcd44e
ILT
66352010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6636
6637 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6638 $(THREADSLIB) and $(LIBDL).
6639 * Makefile.in: Rebuild.
6640
a192ba05
ILT
66412010-01-06 Ian Lance Taylor <iant@google.com>
6642
6643 PR 10980
6644 * options.cc (General_options::parse_section_start): New function.
6645 (General_options::section_start): New function.
6646 (General_options::General_options): Initialize all members.
6647 * options.h: Include <map>
6648 (class General_options): Add --section-start. Add section_starts_
6649 member.
6650 * layout.cc (Layout::attach_allocated_section_to_segment): If
6651 --section-start was used, set the address of the segment. Remove
6652 local sort_sections.
6653 (Layout::relaxation_loop_body): If the address of the load segment
6654 has been set by --section-start, don't use it.
6655 * output.h (Output_segment::update_flags_for_output_section): New
6656 function.
6657 * output.cc (Output_segment::add_output_section): Call
6658 update_flags_for_output_section.
6659
dde3f402
ILT
66602010-01-05 Ian Lance Taylor <iant@google.com>
6661
62dfdd4d
ILT
6662 PR 10980
6663 * options.h (class General_options): Add --undefined-version.
6664 * script.cc (struct Version_expression): Add was_matched_by_symbol
6665 field.
6666 (Version_script_info::matched_symbol): New function.
6667 (Version_script_info::get_symbol_version_helper): Call
6668 matched_symbol.
6669 (Version_script_info::check_unmatched_names): New function.
6670 * script.h (class Version_script_info): Update declarations.
6671 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6672
9c4ae156
ILT
6673 * options.h (class General_options): Use DEFINE_bool_alias for
6674 allow_multiple_definition.
6675 * resolve.cc (Symbol_table::should_override): Don't test
6676 allow_multiple_definition.
6677
dde3f402
ILT
6678 PR 10980
6679 * options.h (class General_options): Add --cref.
6680 * main.cc (main): Print cref table if --cref. Don't close mapfile
6681 until after printing cref table.
6682 * cref.cc: Include "symtab.h".
6683 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6684 (Cref_table_compare::operator()): New function.
6685 (Cref_inputs::gather_cref): New function.
6686 (filecol): New static const.
6687 (Cref_inputs::print_cref): New function.
6688 (Cref::print_cref): New function.
6689 * cref.h: Include <cstdio>.
6690 (class Cref): Update declarations.
6691 * mapfile.h (Mapfile::file): New function.
6692 * object.h (class Object): Define Symbols. Declare virtual
6693 do_get_global_symbols.
6694 (Object::get_global_symbols): New function.
6695 * object.cc (Input_objects::add_object): Pass object to cref_ if
6696 --cref.
6697 (Input_objects::archive_start): Likewise.
6698 (Input_objects::archive_stop): Likewise.
6699 (Input_objects::print_cref): New function.
6700 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6701 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6702 --cref.
6703 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6704 function.
6705 * plugin.h (class Sized_pluginobj): Update declarations.
6706
8781f709
ILT
67072010-01-05 Ian Lance Taylor <iant@google.com>
6708
6709 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6710 to is_default_version. Rename insdef to insdefault.
6711 (Symbol_table::add_from_relobj): Rename def to is_default_version
6712 and local to is_forced_local.
6713 (Symbol_table::add_from_pluginobj): Likewise.
6714 (Symbol_table::add_from_dynobj): Likewise.
6715 (Symbol_table::define_special_symbol): Rename insdef to
6716 insdefault.
6717
fe35d28d
ILT
67182010-01-04 Ian Lance Taylor <iant@google.com>
6719
30bc8c46
ILT
6720 PR 10980
6721 * options.h (class General_options): Add
6722 --allow-multiple-definition and -z muldefs.
6723 * resolve.cc (Symbol_table::should_override): Don't warn about a
6724 multiple symbol definition if --allow-multiple-definition or -z
6725 muldefs.
6726
7eaea549
ILT
6727 PR 10980
6728 * options.h (class General_options): Add --add-needed and
6729 --copy-dt-needed-entries. Tweak --as-needed help entry.
6730 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6731 error if --copy-dt-needed-entries aka --add-needed is used and
6732 would cause a change in behaviour.
6733
fe35d28d
ILT
6734 PR 10980
6735 * options.h (class General_options): Add -G as a short version of
6736 --shared. Add no-op options -assert, -g, and -i.
6737
55a2bb35
ST
67382010-01-04 Sriraman Tallam <tmsriram@google.com>
6739
6740 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6741 check for .text or .gnu.linkonce.t sections.
6742 * icf.cc (Icf::find_identical_sections): Ditto.
6743 Change the detection for mangled function name within the section
6744 name.
6745 * icf.h (is_section_foldable_candidate): New function.
6746
719328e1
ILT
67472009-12-30 Ian Lance Taylor <iant@google.com>
6748
6749 PR 10980
6750 * options.h (class General_options): Permit two dashes with
6751 --retain-symbols-file.
6752
d7bb5745
ILT
67532009-12-30 Ian Lance Taylor <iant@google.com>
6754
403a15dd
ILT
6755 PR 10979
6756 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6757 don't put the file header and segment headers in the text
6758 segment.
6759
eda294df
ILT
6760 PR 10979
6761 * common.cc (Sort_commons::operator()): Stabilize sort when both
6762 entries are NULL.
6763 (Symbol_table::do_allocate_commons_list): When allocating common
6764 symbols, skip a symbol which is no longer common.
6765 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6766 an object before checking its type.
6767 * testsuite/common_test_2.c: New file.
6768 * testsuite/common_test_3.c: New file.
6769 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6770 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6771 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6772 (common_test_2_pic.o, common_test_2.so): New targets.
6773 (common_test_3_pic.o, common_test_3.so): New targets.
6774 * testsuite/Makefile.in: Rebuild.
6775
d7bb5745
ILT
6776 PR 10979
6777 * script.cc (read_input_script): If we see a new SECTIONS clause,
6778 and we have added an input section, give an error.
6779 * layout.h (class Layout): Add have_added_input_section function.
6780 Add have_added_input_section_ field.
6781 * layout.cc (Layout::Layout): Initialize
6782 have_added_input_section_.
6783 (Layout::layout): Set have_added_input_section_.
6784 (Layout::layout_eh_frame): Likewise.
6785
fc59c572
ILT
67862009-12-30 Ian Lance Taylor <iant@google.com>
6787
6788 PR 10931
6789 * options.h (class General_options): Add --sort-common option.
6790 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6791 * common.cc (Sort_common): Add sort_order parameter to
6792 constructor. Add sort_order_ field.
6793 (Sort_commons::operator): Check sort_order_.
6794 (Symbol_table::allocate_commons): Determine the sort order.
6795 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6796 Change all callers.
6797 (Symbol_table::do_allocate_commons_list): Likewise.
6798
1c74fab0
ILT
67992009-12-30 Ian Lance Taylor <iant@google.com>
6800
6801 PR 10916
6802 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6803 symbols from this object, don't change the visibility of an
6804 undefined symbol.
6805 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6806
6affe781
ILT
68072009-12-30 Ian Lance Taylor <iant@google.com>
6808
6809 PR 10861
6810 * script.h (class Version_script_info): Define Language enum.
6811 Update declarations. Define Glob, Exact, and Lookup types. Add
6812 new fields globals_, locals_, and is_finalized_.
6813 * script.cc: Various formatting fixes.
6814 (class Parser_closure): Change language_stack_ from a vector of
6815 std::string to one of Version_script_info::Language. Adjust all
6816 uses accordingly.
6817 (class Lazy_demangler): Remove.
6818 (struct Version_expression): Change language from std::string to
6819 Version_script_info::Language.
6820 (Version_script_info::Version_script_info): New function.
6821 (Version_script_info::~Version_script_info): Don't call clear.
6822 (Version_script_info::finalize): New function.
6823 (Version_script_info::build_lookup_tables): New function.
6824 (Version_script_info::build_expression_list_lookup): New
6825 function.
6826 (Version_script_info::get_symbol_version_helper): Rewrite to use
6827 lookup tables.
6828 (Version_script_info::print_expression_list): Adjust to use
6829 Version_script_info::Language.
6830 (script_push_lex_into_version_mode): Check that the version script
6831 has not been finalized.
6832 (version_script_push_lang): Change language string to
6833 Version_script_info::Language.
6834 * options.cc (Command_line::version_script): New function.
6835 * options.h (class General_options): Add finalize_dynamic_list
6836 function. Change version_script from declaration to definition.
6837 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6838 * testsuite/version_script.map: Remove duplicate def of foo.
6839 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6840 version_script.map.
6841 * testsuite/Makefile.in: Rebuild.
6842
818bf354
ILT
68432009-12-30 Ian Lance Taylor <iant@google.com>
6844
6845 PR 10843
6846 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6847 if the input symbol index is 0, make the output symbol index 0.
6848
ebcc8304
ILT
68492009-12-30 Ian Lance Taylor <iant@google.com>
6850
6851 PR 10670
6852 * options.h (class General_options): Add -x/--discard-all.
6853 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6854 --discard-all. If the local symbol needs a dynamic entry, check
6855 that before handling --discard-locals.
6856
176fe33f
ILT
68572009-12-30 Ian Lance Taylor <iant@google.com>
6858
bb321bb1
ILT
6859 PR 10450
6860 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6861 flags to PF_R.
6862 (Output_segment::add_output_section): Don't change the flags if
6863 the type is PT_TLS.
6864
176fe33f
ILT
6865 PR 10450
6866 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6867 GNU hash table if they need a dynamic value. Otherwise, don't add
6868 them if they are defined in a dynamic object or are forced local.
6869
e8cd95c7
ILT
68702009-12-29 Ian Lance Taylor <iant@google.com>
6871
1b81fb71
ILT
6872 PR 10450
6873 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6874 .gnu.hash table for a 32-bit target.
6875
8d6d383d
ILT
6876 PR 10450
6877 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6878 regular and a dynamic object only needs a dynamic symbol table
6879 entry if it is externally visible.
6880
e785ec03
ILT
6881 PR 10450
6882 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6883 constructor. Add global_offset_table_ field.
6884 (Target_i386::got_section): Set global_offset_table_.
6885 (Target_i386::do_finalize_sections): Set global_offset_table_
6886 size.
6887 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6888 in constructor. Add global_offset_table_ field.
6889 (Target_x86_64::got_section): Set global_offset_table_.
6890 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6891 size.
6892
1a2dff53
ILT
6893 * layout.cc (Layout::Layout): Initialize increase_relro_.
6894 (Layout::get_output_section): Add is_relro, is_last_relro, and
6895 is_first_non_relro parameters. Change all callers.
6896 (Layout::choose_output_section): Likewise.
6897 (Layout::add_output_section_data): Likewise.
6898 (Layout::make_output_section): Likewise.
6899 (Layout::set_segment_offsets): Clear increase_relro when using a
6900 linker script.
6901 * layout.h (class Layout): Add increase_relro method. Add
6902 increase_relro_ field. Update declarations.
6903 * output.cc (Output_section::Output_section): Initialize
6904 is_last_relro_ and is_first_non_relro_.
6905 (Output_segment::add_output_section): Group relro sections is
6906 do_sort is true. Handle is_last_relro and is_first_non_relro.
6907 (Output_segment::maximum_alignment): Remove relro handling.
6908 (Output_segment::set_section_addresses): Add increase_relro
6909 parameter. Change all callers. Add initial alignment to align
6910 relro sections on separate page. Remove old relro handling.
6911 (Output_segment::set_section_list_addresses): Remove in_relro
6912 parameter. Change all callers.
6913 (Output_segment::set_offset): Add increase parameter. Change all
6914 callers. Remove old relro handling.
6915 * output.h (class Output_section): Add new methods: is_last_relro,
6916 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6917 Add is_last_relro_ and is_first_non_relro_ fields.
6918 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6919 Create separate .got.plt section. Call increase_relro.
6920 * x86_64.cc (Target_x86_64::got_section): Likewise.
6921 * testsuite/relro_script_test.t: Add .got.plt.
6922
f0ba79e2
ILT
6923 PR 10450
6924 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6925 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6926 (Layout::finalize): Call set_dynamic_symbol_size.
6927 (Layout::set_dynamic_symbol_size): New function.
6928 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6929 set_dynamic_symbol_size.
6930
e8cd95c7
ILT
6931 PR 10450
6932 * output.h (class Output_section): Add is_entsize_zero_ field.
6933 * output.cc (Output_section::Output_section): Initialize
6934 is_entsize_zero_.
6935 (Output_section::set_entsize): If two different entsizes are
6936 requested, force it to zero.
6937 (Output_section::add_input_section): Set flags for .debug_str
6938 before updating section flags. Set entsize.
6939 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6940 and SHF_STRING if all input sections have those flags.
6941
3e1b9a8a
RÁE
69422009-12-29 Rafael Espindola <espindola@google.com>
6943
6944 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
6945 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6946 reporting.
3e1b9a8a 6947
3dcad376
ST
69482009-12-29 Sriraman Tallam <tmsriram@google.com>
6949
6950 * options.cc (General_options::parse_version): Allow -v to exit
6951 without an error if there is nothing to link.
6952
084e2665
ILT
69532009-12-29 Ian Lance Taylor <iant@google.com>
6954
6955 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6956 using a version of gcc before 4.1.
6957 * configure: Rebuild.
6958
250acde3
CD
69592009-12-28 Chris Demetriou <cgd@google.com>
6960
6961 * attributes.cc (Output_attributes_section_data::do_write): Use
6962 std::vector::front rather than std::vector::data.
6963
99fff23b
ILT
69642009-12-28 Ian Lance Taylor <iant@google.com>
6965
6966 * symtab.h (class Symbol_table): Add enum Defined.
6967 * resolve.cc (Symbol_table::should_override): Add defined
6968 parameter. Change all callers. Test whether object is NULL
6969 before calling a method on it.
6970 (Symbol_table::report_resolve_problem): Add defined parameter.
6971 Change all callers.
6972 (Symbol_table::should_override_with_special): Likewise.
6973 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6974 parameter. Change all callers.
6975 (Symbol_table::do_define_in_output_data): Likewise.
6976 (Symbol_table::define_in_output_segment): Likewise.
6977 (Symbol_table::do_define_in_output_segment): Likewise.
6978 (Symbol_table::define_as_constant): Likewise.
6979 (Symbol_table::do_define_as_constant): Likewise.
6980 * script.h (class Symbol_assignment): Add is_defsym parameter to
6981 constructor; change all callers.
6982 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6983 parameter. Change all callers. Add is_defsym_ field.
6984 (class Parser_closure): Add parsing_defsym parameter to
6985 constructor; change all callers. Add parsing_defsym accessor
6986 function. Add parsing_defsym_ field.
6987
556bd683
ILT
69882009-12-28 Ian Lance Taylor <iant@google.com>
6989
6990 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 6991 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 6992
1782c879
ILT
69932009-12-23 Ian Lance Taylor <iant@google.com>
6994
6995 * i386.cc (Target_i386::do_calls_non_split): Recognize
6996 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
6997 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6998 -fsplit-stack prologue when using %r11.
1782c879 6999
329ca2b1
ST
70002009-12-21 Sriraman Tallam <tmsriram@google.com>
7001
7002 * options.cc (General_options::parse_version): Make -v continue and do
7003 the link like GNU ld does.
7004
d675ff46
RÁE
70052009-12-17 Rafael Avila de Espindola <espindola@google.com>
7006
7007 * Makefile.am (CCFILES): Add timer.cc.
7008 (HFILES): Add timer.h.
7009 * configure.ac: Check for sysconf and times.
7010 * main.cc: include timer.h.
7011 (main): Use Timer instead of get_run_time.
7012 * timer.cc: New.
7013 * timer.h: New.
7014 * workqueue.cc: include timer.h.
7015 (Workqueue::find_and_run_task):
7016 Report user, sys and wall time.
7017 * Makefile.in: Regenerate.
7018 * config.in: Regenerate.
7019 * configure: Regenerate.
7020
d6344fb5
DK
70212009-12-16 Doug Kwan <dougkwan@google.com>
7022
7023 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7024 sections.
7025 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7026 relaxed input sections.
7027 * output.cc (Output_section::find_relaxed_input_section): Change
7028 return type to Output_relaxed_input_section pointer. Adjust code
7029 for new type of relaxed_input_section_map_.
7030 * output.h (Output_section::find_relaxed_input_section): Change
7031 return type to Output_relaxed_input_section pointer.
7032 (Output_section::Output_relaxed_input_section_by_input_section_map):
7033 New type.
7034 (Output_section::relaxed_input_section_map_): Change type to
7035 Output_section::Output_relaxed_input_section_by_input_section_map.
7036 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7037 input section.
7038
0e0d5469
ILT
70392009-12-15 Ian Lance Taylor <iant@google.com>
7040
7041 * layout.cc (Layout::create_shstrtab): Only write out after input
7042 sections if we are compressing debug sections.
7043
0649a889
ILT
70442009-12-15 Ian Lance Taylor <iant@google.com>
7045
7046 * archive.cc (Archive::add_symbols): Only look up a symbol without
7047 a version if there is, in fact, a version.
7048
2ea97941
ILT
70492009-12-14 Ian Lance Taylor <iant@google.com>
7050
7051 Revert -Wshadow changes, all changes from:
7052 2009-12-11 Doug Kwan <dougkwan@google.com>
7053 2009-12-11 Nick Clifton <nickc@redhat.com>
7054 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7055
b0eec2cc
DK
70562009-12-11 Doug Kwan <dougkwan@google.com>
7057
7058 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7059 due to -Wshadow.
7060 * attributes.cc (Object_attribute::size): Ditto.
7061 (Attributes_section_data::size): Ditto.
7062 (Attributes_section_data::Attributes_section_data): Ditto.
7063 (Output_attributes_section_data::do_write): Ditto.
7064 * attributes.h (Object_attribute::set_type): Ditto.
7065 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7066
91d6fa6a
NC
70672009-12-11 Nick Clifton <nickc@redhat.com>
7068
7069 * archive.cc: Fix shadowed variable warnings.
7070 * arm.cc: Likewise.
7071 * compressed_output.cc: Likewise.
7072 * compressed_output.h: Likewise.
7073 * configure: Likewise.
7074 * dwarf_reader.cc: Likewise.
7075 * dynobj.cc: Likewise.
7076 * dynobj.h: Likewise.
7077 * ehframe.cc: Likewise.
7078 * ehframe.h: Likewise.
7079 * errors.cc: Likewise.
7080 * expression.cc: Likewise.
7081 * fileread.cc: Likewise.
7082 * fileread.h: Likewise.
7083 * freebsd.h: Likewise.
7084 * i386.cc: Likewise.
7085 * icf.cc: Likewise.
7086 * incremental.h: Likewise.
7087 * layout.cc: Likewise.
7088 * layout.h: Likewise.
7089 * mapfile.cc: Likewise.
7090 * merge.cc: Likewise.
7091 * merge.h: Likewise.
7092 * object.cc: Likewise.
7093 * object.h: Likewise.
7094 * options.h: Likewise.
7095 * output.cc: Likewise.
7096 * output.h: Likewise.
7097 * parameters.cc: Likewise.
7098 * plugin.cc: Likewise.
7099 * powerpc.cc: Likewise.
7100 * reduced_debug_output.cc: Likewise.
7101 * reduced_debug_output.h: Likewise.
7102 * reloc.cc: Likewise.
7103 * reloc.h: Likewise.
7104 * resolve.cc: Likewise.
7105 * script-sections.cc: Likewise.
7106 * script.cc: Likewise.
7107 * script.h: Likewise.
7108 * sparc.cc: Likewise.
7109 * symtab.cc: Likewise.
7110 * symtab.h: Likewise.
7111 * target-select.cc: Likewise.
7112 * target-select.h: Likewise.
7113 * token.h: Likewise.
7114 * workqueue.cc: Likewise.
7115 * workqueue.h: Likewise.
7116 * x86_64.cc: Likewise.
7117
a0351a69
DK
71182009-12-10 Doug Kwan <dougkwan@google.com>
7119
7120 * arm.cc (attributes.h): New include.
7121 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7122 (Arm_relobj::~Arm_relobj): Delete object pointed by
7123 attributes_section_data_.
7124 (Arm_relobj::attributes_section_data): New method definition.
7125 (Arm_relobj::attributes_section_data_): New data member declaration.
7126 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7127 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7128 attributes_section_data_.
7129 (Arm_dynobj::attributes_section_data): New method definition.
7130 (Arm_dynobj::attributes_section_data_): New data member declaration.
7131 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7132 initialization value of may_use_blx_ to false.
7133 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7134 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7135 object attributes to compute results instead of hard-coding.
7136 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7137 Target_arm::get_secondary_compatible_arch,
7138 Target_arm::set_secondary_compatible_arch
7139 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7140 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7141 New method declarations.
7142 (Target_arm::get_aeabi_object_attribute): New method definition.
7143 (Target_arm::attributes_section_data_): New data member declaration.
7144 (read_arm_attributes_section): New template definition.
7145 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7146 (Arm_dynobj::do_read_symbols): Ditto.
7147 (Target_arm::do_finalize_sections): Merge attributes sections from
7148 input. Check for BLX use after attributes section merging.
7149 Fix __exidx_start and __exidx_end visibility. Create an
7150 .ARM.attributes section if necessary.
7151 (Target_arm::get_secondary_compatible_arch,
7152 Target_arm::set_secondary_compatible_arch,
7153 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7154 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 7155 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
7156 New method definitions.
7157
b59befec
ILT
71582009-12-09 Ian Lance Taylor <iant@google.com>
7159
7160 * plugin.cc (Plugin::load): Don't cast from void* to a function
7161 pointer.
7162
1276bc89
ILT
71632009-12-09 Ian Lance Taylor <iant@google.com>
7164
7165 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7166 information fields.
7167
2f2de248
L
71682009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7169
7170 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7171 Replace two_file_shared_1.so with two_file_shared_2.so.
7172 * testsuite/Makefile.in: Regenerated.
7173
4f787271
DK
71742009-12-08 Doug Kwan <dougkwan@google.com>
7175
7176 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7177 (HFILES): Add attributes.h and int_encoding.h.
7178 * Makefile.in: Regenerate.
7179 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7180 function definitions to int_encoding.cc
7181 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7182 prototypes to int_encoding.h
7183 * reduced_debug_output.cc (int_encoding.h): New include.
7184 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7185 function definitions to int_encoding.cc
7186 (insert_into_vector, read_from_pointer): Move template definitions to
7187 int_encoding.h
7188 * attributes.cc: New file.
7189 * attributes.h: New file.
7190 * int_encoding.cc: New file.
7191 * int_encoding.h: New file.
7192
20b52f1a
RÁE
71932009-12-07 Rafael Avila de Espindola <espindola@google.com>
7194
7195 PR gold/11055
7196 * incremental-dump.cc (dump_incremental_inputs): New.
7197 (main): Use dump_incremental_inputs.
7198
53d7974c
L
71992009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7200
7201 PR gold/10893
7202 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7203 checking elfcpp::STT_FUNC.
7204 (Target_i386::Relocate::relocate): Likewise.
7205 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7206
7207 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7208 symbols from shared libraries into normal FUNC symbols.
7209
7210 * symtab.h (Symbol): Add is_func and use it.
7211
05a352e6
DK
72122009-12-05 Doug Kwan <dougkwan@google.com>
7213
7214 * arm.cc (Target_arm::arm_info): Initialize new fields
7215 attributes_section and attributes_vendor.
7216 * i386.cc (Target_i386::i386_info): Same.
7217 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7218 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7219 fields attributes_section and attributes_vendor.
53d7974c 7220 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
7221 * target.h (Target::attributes_section, Target::attributes_vendor,
7222 Target::is_attributes_section, Target::attribute_arg_type,
7223 Target::attributes_order): New method definitions.
7224 (Target::Target_info::attributes_section,
7225 Target::Target_info::attributes_vendor): New fields.
7226 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7227 virtual method definitions.
7228 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7229 attributes_section and attributes_vendor.
7230 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7231
f4e5969c
DK
72322009-12-05 Doug Kwan <dougkwan@google.com>
7233
7234 * arm.cc: Update comments about interworking and stub generation.
7235 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7236 considered as non-PIC.
7237 (Arm_relocate_functions::base_abs): Fix formatting.
7238 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7239 of function to use GOT entry address instead of offset.
7240 (Target_arm::Scan::global): Issue an error if a symbol would need a
7241 PLT does not get one because it is untyped. Remove code to create
7242 dynamic symbols for relative branches.
7243 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7244 takes unsigned integer instead of boolean.
7245
1abce4a6
L
72462009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7247
7248 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7249 (two_file_test_LDADD): Likewise.
7250 (common_test_1_LDADD): Likewise.
7251 (exception_test_LDADD) Likewise.
7252 (weak_test_LDADD): Likewise.
7253 (many_sections_test_LDADD): Likewise.
7254 (initpri1_LDADD): Likewise.
7255 (script_test_1_LDADD): Likewise.
7256 (script_test_2_LDADD): Likewise.
7257 (justsyms_LDADD): Likewise.
7258 (binary_test_LDADD): Likewise.
7259 (large_LDADD): Likewise.
7260 * testsuite/Makefile.in: Regenerated.
7261
adcf2816 72622009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 7263
adcf2816
L
7264 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7265 (Symbol_table::override_with_special): Likewise.
7266 (Symbol_table::add_from_object): Likewise.
7267
28e67f5d
RÁE
72682009-12-04 Rafael Avila de Espindola <espindola@google.com>
7269
7270 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7271 Don't set the data_offset twice.
7272
ae10a101
RÁE
72732009-12-04 Rafael Avila de Espindola <espindola@google.com>
7274
7275 * testsuite/Makefile.in: Regenerate.
7276
f59f41f3
DK
72772009-12-03 Doug Kwan <dougkwan@google.com>
7278
7279 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7280 (Target_arm::do_finalize_sections): Add parameter for symbol table
7281 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7282 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7283 parameter for symbol table pointer.
7284 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7285 an additional parameter for a pointer to symbol table.
7286 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7287 parameter for a symbol table pointer.
7288 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7289 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7290 Ditto.
7291 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7292 parameter for a symbol table pointer.
7293
ca55d848
RÁE
72942009-12-03 Rafael Avila de Espindola <espindola@google.com>
7295
7296 * incremental.cc (Incremental_inputs_header)
7297 (Incremental_inputs_header_write, Incremental_inputs_entry)
7298 (Incremental_inputs_entry_write): Move ...
7299 * incremental.h (Incremental_inputs_header)
7300 (Incremental_inputs_header_write, Incremental_inputs_entry)
7301 (Incremental_inputs_entry_write): here.
7302
3aec4f9c
RÁE
73032009-12-02 Rafael Avila de Espindola <espindola@google.com>
7304
7305 * incremental.cc (make_sized_incremental_binary): Set the target.
7306 Error if it is incompatible.
7307 * output.h (Output_file): Add filename method.
7308
9c0ae74d
RÁE
73092009-12-02 Rafael Avila de Espindola <espindola@google.com>
7310
7311 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7312 from the get_* methods.
7313
a45500ae
RÁE
73142009-12-02 Rafael Avila de Espindola <espindola@google.com>
7315
7316 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7317 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7318 Write 0 for the data_offset of scripts.
7319
325e6408
RÁE
73202009-12-02 Rafael Avila de Espindola <espindola@google.com>
7321
7322 * testsuite/Makefile.am: Add the incremental_test.sh test.
7323 * testsuite/incremental_test.sh: New.
7324 * testsuite/incremental_test_1.c: New.
7325 * testsuite/incremental_test_2.c: New.
7326
954c3e2e
RÁE
73272009-12-01 Rafael Avila de Espindola <espindola@google.com>
7328
7329 * incremental-dump.cc (main): Fix typos.
7330
f8086623
RÁE
73312009-11-27 Rafael Avila de Espindola <espindola@google.com>
7332
7333 PR gold/11025
7334 * incremental-dump.cc (main): Use llu to print 64 bit values.
7335
3b0dd6ac
L
73362009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7337 H.J. Lu <hongjiu.lu@intel.com>
7338
7339 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7340 $(LIBDL).
7341 (incremental_dump_LDADD): Likewise.
7342 * Makefile.in: Regenerated.
7343
a6d1ef57 73442009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 7345
a6d1ef57
DK
7346 Revert:
7347
7348 2009-11-25 Doug Kwan <dougkwan@google.com>
7349
7350 * arm.cc (Target_arm::Target_arm): Move method definition
7351 outside of class definition. Add code to handle
7352 --target1-rel, --target1-abs and --target2= options.
7353 (Target_arm::get_reloc_reloc_type): Change method to be
7354 non-static and const.
7355 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7356 New data member declaration.
7357 (Target_arm::Scan::local, Target_arm::Scan::global,
7358 Target_arm::Relocate::relocate,
7359 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7360 Adjust call to Target_arm::get_real_reloc_type.
7361 (Target_arm::get_real_reloc_type): Use command line options
7362 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7363 * options.h (--target1-rel, --target1-abs, --target2): New
7364 ARM-only options.
7365
50aeb7d4
DK
73662009-11-25 Doug Kwan <dougkwan@google.com>
7367
7368 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7369 class definition. Add code to handle --target1-rel, --target1-abs
7370 and --target2= options.
7371 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7372 and const.
7373 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7374 member declaration.
7375 (Target_arm::Scan::local, Target_arm::Scan::global,
7376 Target_arm::Relocate::relocate,
7377 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7378 call to Target_arm::get_real_reloc_type.
7379 (Target_arm::get_real_reloc_type): Use command line options to
7380 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7381 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7382 options.
7383
51938283
DK
73842009-11-25 Doug Kwan <dougkwan@google.com>
7385
7386 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7387 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7388 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7389 formatting.
7390 (Arm_relocate_functions::thm_call): Replace body with a call to
7391 Arm_relocate_functions::thumb_branch_common.
7392 (Arm_relocate_functions::thm_jump24,
7393 Arm_relocate_functions::thm_xpc22): New method definitions.
7394 (Arm_relocate_functions::thumb_branch_common): New method definition.
7395 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7396 operator.
7397 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7398 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7399
e2b8f3c4
RÁE
74002009-11-24 Rafael Avila de Espindola <espindola@google.com>
7401
7402 * Makefile.am: Build incremental-dump
7403 * Makefile.in: Regenerate.
7404 * incremental-dump.cc: New.
7405 * incremental.cc (Incremental_inputs_header_data,
7406 Incremental_inputs_entry_data): Move to incremental.h
7407 * incremental.h: (Incremental_inputs_header_data,
7408 Incremental_inputs_entry_data): Move from incremental.cc
7409
bcba9aec
RÁE
74102009-11-24 Rafael Avila de Espindola <espindola@google.com>
7411
7412 * incremental.cc (Incremental_inputs_header,
7413 Incremental_inputs_header_write, Incremental_inputs_entry,
7414 Incremental_inputs_entry_write): Add a typedef with the data type.
7415
7c3afe08
RÁE
74162009-11-24 Rafael Avila de Espindola <espindola@google.com>
7417
7418 * incremental.cc (Incremental_inputs_header,
7419 Incremental_inputs_header_write, Incremental_inputs_entry,
7420 Incremental_inputs_entry_write): Update comment about which
7421 type has the filed descriptions.
7422
d204b6e9
DK
74232009-11-15 Doug Kwan <dougkwan@google.com>
7424
7425 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7426 (Arm_relocate_functions::arm_branch_common): Change method defintion
7427 in class definition to a method declaration and update list of formal
7428 parameters.
7429 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7430 Arm_relocation_functions::jump24): Adjust call to
7431 Arm_relocate_functions::arm_branch_common. Update list of formal
7432 parameters.
7433 (Arm_relocate_functions::xpc25): New method definition.
7434 (Arm_relocate_functions::arm_branch_common): Move method defintion
7435 out from class definition. Use stubs for mode-switching and extending
7436 branch ranges.
7437 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7438 specially. Change code to enable use of stubs in ARM branches.
7439
43d12afe
DK
74402009-11-10 Doug Kwan <dougkwan@google.com>
7441
7442 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7443 in method declaration.
7444 (Target_arm::relocate_stub): New method declaration.
7445 (Target_arm::default_target): Change to return a pointer instead of
7446 a const reference.
7447 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7448 Target_arm::default_target.
7449 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7450 method definition.
7451 (Target_arm::relocate_section): Adjust view.
7452 (Target_arm::relocate_stub): New method definition.
7453
ac33a407
DK
74542009-11-10 Doug Kwan <dougkwan@google.com>
7455
7456 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7457 a format warning.
7458 * incremental.cc (open_incremental_binary): Initialized local
7459 variables to avoid warnings.
7460 * object.cc (make_elf_object): Ditto.
7461 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7462 a format warning.
e1df38aa 7463
88ee28e9
L
7464009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7465
7466 PR gold/10930
7467 * testsuite/plugin_test.c: Include "config.h".
7468
2daedcd6
DK
74692009-11-09 Doug Kwan <dougkwan@google.com>
7470
7471 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7472 (arm_symbol_value): Remove.
7473 (Arm_relocate_functions::arm_branch_common,
7474 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7475 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7476 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7477 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7478 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7479 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7480 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7481 Arm_relocate_functions::thm_mobw_abs_nc,
7482 Arm_relocate_functions::thm_mov_abs,
7483 Arm_relocate_functions::movw_prel_nc,
7484 Arm_relocate_functions::thm_movt_abs,
7485 Arm_relocate_functions::movt_prel,
7486 Arm_relocate_functions::thm_movw_prel_nc,
7487 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7488 (Target_arm::Relocate::relocate): Only decompose address into two
7489 parts if relocation type uses the thumb-bit and pass the actual
7490 bit instead of a flag indicating that the thumb-bit is used. Adjust
7491 calls to methods in Arm_relocate_functions for this change.
7492
1276bc89 74932009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
7494
7495 PR 10925
7496 * reloc.cc: Instantiate
7497 Sized_relobj::initialize_input_to_output_maps and
7498 Sized_relobj:free_input_to_output_maps.
7499
e53ad1b5
ILT
75002009-11-06 Ian Lance Taylor <iant@google.com>
7501
7502 PR 10876
7503 * defstd.cc (in_segment): Set only_if_ref true for "end".
7504
eb44217c
DK
75052009-11-06 Doug Kwan <dougkwan@google.com>
7506
7507 * arm.cc (class Reloc_stub): Correct a comment.
7508 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7509 (Target_arm::scan_section_for_stubs): New method declaration.
7510 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7511 Change methods from private to protected.
7512 (Target_arm::do_may_relax): New method definition.
7513 (Target_arm::do_relax, Target_arm::group_sections,
7514 Target_arm::scan_reloc_for_stub,
7515 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7516 (Target_arm::arm_input_section_map_): New data member declaration.
7517 (Target_arm::scan_reloc_for_stub,
7518 Target_arm::scan_reloc_section_for_stubs,
7519 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7520 Target_arm::do_relax): New method definitions.
7521
5d329b7d
ILT
75222009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7523
7524 * configure.ac: Check for (struct stat)::st_mtim
7525 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7526 * config.in: Regenerate.
7527 * configure: Regenerate.
7528
96a0d71b
ILT
75292009-11-05 Ian Lance Taylor <iant@google.com>
7530
7531 PR 10910
7532 * output.cc (Output_segment::add_output_section): Add missing
7533 return statement.
7534
594c8e5e
ILT
75352009-11-04 Ian Lance Taylor <iant@google.com>
7536
7537 PR 10880
7538 * object.h (class Object): Add is_needed and set_is_needed
7539 methods. Add is_needed_ field. Make bool fields into bitfields.
7540 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7541 defined in a dynamic object and referenced by a regular object,
7542 set is_needed for the dynamic object.
7543 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7544 if the file is marked with as_needed and it is not needed.
7545
22b127cc
ILT
75462009-11-04 Ian Lance Taylor <iant@google.com>
7547
7548 PR 10887
7549 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7550 tags if data is discarded by linker script.
7551 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7552 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7553 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7554 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7555
f5c870d2
ILT
75562009-11-04 Ian Lance Taylor <iant@google.com>
7557
7558 * layout.cc (Layout::get_output_section): Add is_interp and
7559 is_dynamic_linker_section parameters. Change all callers.
7560 (Layout::choose_output_section): Likewise.
7561 (Layout::make_output_section): Likewise.
7562 (Layout::add_output_section_data): Add is_dynamic_linker_section
7563 parameter. Change all callers.
7564 * layout.h (class Layout): Update declarations.
7565 * output.h (class Output_section): Add is_interp, set_is_interp,
7566 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7567 Add is_interp_, is_dynamic_linker_section_ fields. Change
7568 generate_code_fills_at_write_ to a bitfield.
7569 * output.cc (Output_section::Output_sections): Initialize new
7570 fields.
7571 (Output_segment::add_output_section): Add do_sort parameter.
7572 Change all callers.
7573
1ae4d23b
ILT
75742009-11-03 Ian Lance Taylor <iant@google.com>
7575
7576 PR 10860
7577 * options.h (class General_options): Add --warn-common.
7578 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7579 merging two common symbols.
7580 (Symbol_table::should_override): Handle --warn-common when merging
7581 a common symbol with a defined symbol. Use report_resolve_problem
7582 for multiple definitions.
7583 (Symbol_table::report_resolve_problem): New function.
7584 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7585
55da9579
DK
75862009-11-03 Doug Kwan <dougkwan@google.com>
7587
7588 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7589 stub_factory_.
7590 (Target_arm::stub_factory): New method definition.
7591 (Target_arm::new_arm_input_section,
7592 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7593 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 7594 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
7595 New type definitions.
7596 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7597 member declarations.
7598 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7599 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7600 New method definitions.
7601
37a9ac43
ILT
76022009-11-03 Ian Lance Taylor <iant@google.com>
7603
7604 * options.h (class General_options): Add --warn_constructors.
7605
b3d6a3d4
ILT
76062009-11-03 Ian Lance Taylor <iant@google.com>
7607
7608 PR 10893
7609 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7610 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7611
934b01dd
ILT
76122009-11-03 Ian Lance Taylor <iant@google.com>
7613
7614 PR 10895
7615 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7616 --msgid-bugs-address.
7617 (install-pdf): New target.
7618 (install-data_yes): Look up one directory to find mkinstalldirs.
7619
03c1939b
L
76202009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7621
7622 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7623 tree.
7624
ebd95253
DK
76252009-10-30 Doug Kwan <dougkwan@google.com>
7626
7627 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7628
e9bbb538
DK
76292009-10-30 Doug Kwan <dougkwan@google.com>
7630
7631 * arm.cc (Stub_addend_reader): New struct template definition
7632 and partial specializations.
7633 (Stub_addend_reader::operator()): New method definition for a
7634 partially specialized template.
7635
d5b40221
DK
76362009-10-30 Doug Kwan <dougkwan@google.com>
7637
7638 * arm.cc (Arm_relobj::processor_specific_flags): New method
7639 definition.
7640 (Arm_relobj::do_read_symbols): New method declaration.
7641 (Arm_relobj::processor_specific_flags_): New data member declaration.
7642 (Arm_dynobj): New class definition.
7643 (Target_arm::do_finalize_sections): Add input_objects parameter.
7644 (Target_arm::do_adjust_elf_header): New method declaration.
7645 (Target_arm::are_eabi_versions_compatible,
7646 (Target_arm::merge_processor_specific_flags): New method declaration.
7647 (Target_arm::do_make_elf_object): New overloaded method definitions
7648 and declaration.
7649 (Arm_relobj::do_read_symbols): New method definition.
7650 (Arm_dynobj::do_read_symbols): Ditto.
7651 (Target_arm::do_finalize_sections): Add input_objects parameters.
7652 Merge processor-specific flags from all input objects.
7653 (Target_arm::are_eabi_versions_compatible,
7654 Target_arm::merge_processor_specific_flags,
7655 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7656 New method definitions.
7657 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7658 Input_objects pointer type parameter.
7659 * layout.cc (Layout::finalize): Pass input objects to target's.
7660 finalize_sections function.
7661 * output.cc (Output_file_header::do_sized_write): Set ELF file
7662 header's processor-specific flags.
7663 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7664 Input_objects pointer type parameter.
7665 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7666 * target.h (Input_objects): New forward class declaration.
7667 (Target::processor_specific_flags,
7668 Target::are_processor_specific_flags_sect): New method definitions.
7669 (Target::finalize_sections): Add input_objects parameter.
7670 (Target::Target): Initialize processor_specific_flags_ and
7671 are_processor_specific_flags_set_.
7672 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7673 parameter.
7674 (Target::set_processor_specific_flags): New method definition.
7675 (Target::processor_specific_flags_,
7676 Target::are_processor_specific_flags_set_): New data member
7677 declarations.
7678 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7679 Input_objects pointer type parameter.
7680
ebabffbd
DK
76812009-10-30 Doug Kwan <dougkwan@google.com>
7682
7683 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7684
ad0f2072
ILT
76852009-10-28 Ian Lance Taylor <iant@google.com>
7686
7687 * object.h (class Relobj): Drop options parameter from
7688 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7689 do_scan_relocs, do_relocate. Change all callers.
7690 (class Sized_relobj): Drop options parameters from
7691 do_gc_process_relocs, do_scan_relocs, do_relocate,
7692 do_relocate_sections, relocate_sections, emit_relocs_scan,
7693 emit_relocs_scan_reltype. Change all callers.
7694 (struct Relocate_info): Remove options field and all references to
7695 it.
7696 * reloc.h (class Read_relocs): Remove options constructor
7697 parameter and options_ field. Change all callers.
7698 (class Gc_process_relocs, class Scan_relocs): Likewise.
7699 (class Relocate_task): Likewise.
7700 * target-reloc.h (scan_relocs): Remove options parameter. Change
7701 all callers.
7702 (scan_relocatable_relocs): Likewise.
7703 * target.h (class Sized_target): Remove options parameter from
7704 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7705 all callers.
7706 * gc.h (gc_process_relocs): Remove options parameter. Change all
7707 callers.
7708 * arm.cc: Update functions to remove options parameters.
7709 * i386.cc: Likewise.
7710 * powerpc.cc: Likewise.
7711 * sparc.cc: Likewise.
7712 * x86_64.cc: Likewise.
7713 * testsuite/testfile.cc: Likewise.
7714
8ffa3667
DK
77152009-10-28 Doug Kwan <dougkwan@google.com>
7716
7717 * arm.cc (Arm_relobj): New class definition.
e1df38aa 7718 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
7719 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7720 New method definitions.
7721
40f36857
CC
77222009-10-28 Cary Coutant <ccoutant@google.com>
7723
7724 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7725 (Plugin::cleanup_done_): New member.
7726 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7727 (Plugin_manager::cleanup_done_): Remove.
7728 (Plugin_manager::add_input_file): Edit error message.
7729 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7730 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7731
2c849493
ILT
77322009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7733
7734 * fileread.cc: (File_read::View::~View): Use the new
7735 data_ownership_ filed.
7736 (File_read::~File_read): Dispose the new whole_file_view_.
7737 (File_read::open): Mmap the whole file if needed.
7738 (File_read::open): Use whole_file_view_ instead of contents_.
7739 (File_read::find_view): Use whole_file_view_ if applicable.
7740 (File_read::do_read): Use whole_file_view_ instead of contents_.
7741 (File_read::make_view): Use whole_file_view_ instead of contents_,
7742 update File_read::View::View call.
7743 (File_read::find_or_make_view): Update File_read::View::View
7744 call.
7745 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7746 remove contents_
7747 (File_read::View::Data_ownership): New enum.
7748 (File_read::View::View): Replace bool mapped_ with Data_ownership
7749 argument.
7750 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7751 (File_read::View::data_ownership_): New field.
7752 (File_read::contents_): Remove (replaced by whole_file_view_).
7753 (File_read::whole_file_view_): New field.
7754 * options.h (class General_options): Add --keep-files-mapped.
7755
24998053
CC
77562009-10-27 Cary Coutant <ccoutant@google.com>
7757
7758 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7759 * testsuite/Makefile.am (plugin_test_5): New test case.
7760 * testsuite/Makefile.in: Regenerate.
7761
72adc4fa
DK
77622009-10-25 Doug Kwan <dougkwan@google.com>
7763
7764 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7765 from private to protected to allow access by child class.
7766 (Sized_relobj::do_relocate_sections): New method declaration.
7767 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 7768 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
7769 Sized_relobj::relocate_sections. Instantiate template explicitly
7770 for different target sizes and endianity.
7771
07f508a2
DK
77722009-10-24 Doug Kwan <dougkwan@google.com>
7773
7774 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7775 (Arm_input_section::as_arm_input_section): New method.
7776 (Arm_output_section): New class definition.
7777 (Arm_output_section::create_stub_group,
7778 Arm_output_section::group_sections): New method definitions.
7779
10ad9fe5
DK
77802009-10-22 Doug Kwan <dougkwan@google.com>
7781
7782 * arm.cc (Arm_input_section): New class definition.
7783 (Arm_input_section::init, Arm_input_section:do_write,
7784 Arm_input_section::set_final_data_size,
7785 Arm_input_section::do_reset_address_and_file_offset): New method
7786 definitions.
7787
56ee5e00
DK
77882009-10-21 Doug Kwan <dougkwan@google.com>
7789
7790 * arm.cc (Stub_table, Arm_input_section): New forward class
7791 declarations.
7792 (Stub_table): New class defintion.
7793 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7794 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7795 New method definition.
7796
b569affa
DK
77972009-10-21 Doug Kwan <dougkwan@google.com>
7798
7799 * arm.cc: Update copyright comments.
7800 (Target_arm): New forward class template declaration.
7801 (Arm_address): New type.
7802 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7803 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7804 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7805 constants.
7806 (Insn_template): Same.
7807 (DEF_STUBS): New macro.
7808 (Stub_type): New enum type.
7809 (Stub_template): New class definition.
7810 (Stub): Same.
7811 (Reloc_stub): Same.
7812 (Stub_factory): Same.
7813 (Target_arm::Target_arm): Initialize may_use_blx_ and
7814 should_force_pic_veneer_.
7815 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7816 Target_arm::should_force_pic_veneer,
7817 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7818 Target_arm::using_thumb_only, Target_arm:;default_target): New
7819 method defintions.
7820 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7821 New data member declarations.
7822 (Insn_template::size, Insn_template::alignment): New method defintions.
7823 (Stub_template::Stub_template): New method definition.
7824 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7825 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7826 (Stub_factory::Stub_factory): New method definition.
7827 * gold.h (string_hash): New template.
7828 * output.h (Input_section_specifier::hash_value): Use
7829 gold::string_hash.
7830 (Input_section_specifier::string_hash): Remove.
7831 * stringpool.cc (Stringpool_template::string_hash): Use
7832 gold::string_hash.
7833
6c172549
DK
78342009-10-20 Doug Kwan <dougkwan@google.com>
7835
7836 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7837 symbols of relaxed input sections.
7838 * output.h (Output_section::find_relaxed_input_section): Make
7839 method public.
7840
c5617f2f
DK
78412009-10-16 Doug Kwan <dougkwan@google.com>
7842
7843 * dynobj.cc (Versions::Versions): Initialize version_script_.
7844 Only insert base version symbol definition for a shared object
7845 if version script defines any version versions.
7846 (Versions::define_base_version): New method definition.
7847 (Versions::add_def): Check that base version is not needed.
7848 (Versions::add_need): Define base version lazily.
7849 * dynobj.h (Versions::define_base_version): New method declaration.
7850 (Versions::needs_base_version_): New data member declaration.
7851 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7852 (check_DATA): Add no_version_test.stdout.
7853 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7854 New make rules.
7855 * testsuite/Makefile.in: Regenerate.
7856 * testsuite/no_version_test.c: New file.
7857 * testsuite/no_version_test.sh: Ditto.
7858
3c12dcdb
DK
78592009-10-16 Doug Kwan <dougkwan@google.com>
7860
7861 * expression.cc (class Segment_start_expression): New class definition.
7862 (Segment_start_expression::value): New method definition.
7863 (script_exp_function_segment_start): Return a new
7864 Segment_start_expression.
7865 * gold/script-c.h (script_saw_segment_start_expression): New function
7866 prototype.
7867 * script-sections.cc (Script_sections::Script_sections): Initialize
7868 SAW_SEGMENT_START_EXPRESSION_ to false.
7869 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7870 and -Tbbs options to specify section addresses if given in
7871 command line and no SEGMENT_START expression is seen in a script.
7872 * script-sections.h (Script_sections::saw_segment_start_expression,
7873 Script_sections::set_saw_segment_start_expression): New method
7874 definition.
7875 (Script_sections::saw_segment_start_expression_): New data member
7876 declaration.
7877 * script.cc (script_saw_segment_start_expression): New function.
7878 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7879 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7880 script_test_7.sh and script_test_8.sh.
7881 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7882 script_test_8.stdout.
7883 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7884 (script_test_6, script_test_6.stdout, script_test_7,
7885 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7886 * Makefile.in: Regenerate.
7887 * testsuite/script_test_6.sh: New file.
7888 * testsuite/script_test_6.t: Same.
7889 * testsuite/script_test_7.sh: Same.
7890 * testsuite/script_test_7.t: Same.
7891 * testsuite/script_test_8.sh: Same.
7892
64b1ae37
DK
78932009-10-16 Doug Kwan <dougkwan@google.com>
7894
7895 * output.cc (Output_segment::set_section_list_address): Cast
7896 expressions to unsigned long long type to avoid format warnings.
7897
661be1e2
ILT
78982009-10-15 Ian Lance Taylor <iant@google.com>
7899
12edd763 7900 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 7901 dot assignment to script_sections_.
12edd763
ILT
7902 * script-sections.cc (Script_sections::add_dot_assignment):
7903 Initialize if necessary.
7904
68b6574b
ILT
7905 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7906 program headers with no load segment if there is a linker script.
7907
661be1e2
ILT
7908 * layout.cc (Layout::set_segment_offsets): Align the file offset
7909 to the segment aligment for -N or -n with no load segment.
7910 * output.cc (Output_segment::add_output_section): Don't crash if
7911 the first section is a TLS section.
7912 (Output_segment::set_section_list_addresses): Print an error
7913 message if the address moves backward in a linker script.
7914 * script-sections.cc
7915 (Output_section_element_input::set_section_addresses): Don't
7916 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7917 (Orphan_output_section::set_section_addresses): Likewise.
7918
f15f61a7
DK
79192009-10-15 Doug Kwan <dougkwan@google.com>
7920
7921 * layout.cc (Layout::finish_dynamic_section): Generate tags
7922 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7923 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7924 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7925
82bb573a
ILT
79262009-10-14 Ian Lance Taylor <iant@google.com>
7927
7928 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7929 fields.
7930 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7931 data_shdr fields of relinfo.
7932 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7933 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7934 R_386_TLS_LDO_32, adjust based on section flags.
7935 (Target_i386::Relocate::fix_up_ldo): Remove.
7936
374ad285
ILT
79372009-10-13 Ian Lance Taylor <iant@google.com>
7938
7939 Add support for -pie.
7940 * options.h (class General_options): Add -pie and
7941 --pic-executable.
7942 (General_options::output_is_position_independent): Test -pie.
7943 (General_options::output_is_executable): Return true if not shared
7944 and not relocatable.
7945 (General_options::output_is_pie): Remove.
7946 * options.cc (General_options::finalize): Reject incompatible uses
7947 of -pie.
7948 * gold.cc (queue_middle_tasks): A -pie link is not static.
7949 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7950 * symtab.cc (Symbol::final_value_is_known): Return false if
7951 output_is_position_independent.
7952 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7953 output_is_position_independent.
7954 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7955 output_is_position_independent.
7956 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7957 output_is_position_independent.
7958 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7959 two_file_pie_test.
7960 (basic_pie_test.o, basic_pie_test): New targets.
7961 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7962 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7963 (two_file_pie_test): New target.
7964 * testsuite/Makefile.in: Rebuild.
7965 * README: Remove note saying that -pie is not supported.
7966
c6585162
ILT
79672009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7968
7969 * options.h (class General_options): Add -init and -fini.
7970 * layout.cc (Layout::finish_dynamic_section): Emit
7971 given init and fini functions.
7972
032ce4e9
ST
79732009-10-13 Sriraman Tallam <tmsriram@google.com>
7974
7975 * gc.h (gc_process_relocs): Check if icf is enabled using new
7976 function.
7977 * gold.cc (queue_initial_tasks): Likewise.
7978 (queue_middle_tasks): Likewise.
7979 * object.cc (do_layout): Likewise.
7980 * symtab.cc (is_section_folded): Likewise.
7981 * main.cc (main): Likewise.
7982 * reloc.cc (Read_relocs::run): Likewise.
7983 (Sized_relobj::do_scan_relocs): Likewise.
7984 * icf.cc (is_function_ctor_or_dtor): New function.
7985 (Icf::find_identical_sections): Check if function is ctor or dtor when
7986 safe icf is chosen.
7987 * options.h (General_options::icf): Change option to be an enum.
7988 (Icf_status): New enum.
7989 (icf_enabled): New method.
7990 (icf_safe_folding): New method.
7991 (set_icf_status): New method.
7992 (icf_status_): New variable.
7993 * (options.cc) (General_options::finalize): Set icf_status_.
7994 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7995 icf_test and icf_keep_unique_test to use the --icf enum flag.
7996 * testsuite/icf_safe_test.sh: New file.
e1df38aa 7997 * testsuite/icf_safe_test.cc: New file.
032ce4e9 7998
f345227a
ST
79992009-10-12 Sriraman Tallam <tmsriram@google.com>
8000
8001 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8002 includes to gc.h and icf.h.
8003 * arm.cc: Include gc.h.
8004 * gold.cc: Likewise.
8005 * i386.cc: Likewise.
8006 * powerpc.cc: Likewise.
8007 * sparc.cc: Likewise.
8008 * x86_64.cc: Likewise.
8009 * gc.h: Include icf.h.
8010
1c7814ed
ILT
80112009-10-11 Ian Lance Taylor <iant@google.com>
8012
8013 * plugin.cc: Include "gold.h" before other header files.
8014
ae3b5189
CD
80152009-10-10 Chris Demetriou <cgd@google.com>
8016
8017 * options.h (Input_file_argument::Input_file_type): New enum.
8018 (Input_file_argument::is_lib_): Replace with...
8019 (Input_file_argument::type_): New member.
8020 (Input_file_argument::Input_file_argument): Take Input_file_type
8021 'type' rather than boolean 'is_lib' as second argument.
8022 (Input_file_argument::is_lib): Use type_.
8023 (Input_file_argument::is_searched_file): New function.
8024 (Input_file_argument::may_need_search): Handle is_searched_file.
8025 * options.cc (General_options::parse_library): Support -l:filename.
8026 (General_options::parse_just_symbols): Update for Input_file_argument
8027 changes.
8028 (Command_line::process): Likewise.
8029 * archive.cc (Archive::get_file_and_offset): Likewise.
8030 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8031 * script.cc (read_script_file, script_add_file): Likewise.
8032 * fileread.cc (Input_file::Input_file): Likewise.
8033 (Input_file::will_search_for): Handle is_searched_file.
8034 (Input_file::open): Likewise.
8035 * readsyms.cc (Read_symbols::get_name): Likewise.
8036 * testsuite/Makefile.am (searched_file_test): New test.
8037 * testsuite/Makefile.in: Regenerate.
8038 * testsuite/searched_file_test.cc: New file.
8039 * testsuite/searched_file_test_lib.cc: New file.
8040
f3048a1d
ILT
80412009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8042 Ian Lance Taylor <iant@google.com>
8043
8044 * descriptor.cc: Include <cstdio> and "binary-io.h".
8045 (Descriptors::open): Open the files in binary mode always.
8046 * script.cc (Lex::get_token): Treat \r as whitespace.
8047
d4780e57
ILT
80482009-10-09 Ian Lance Taylor <iant@google.com>
8049
8050 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8051
d9a893b8
ILT
80522009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8053 Ian Lance Taylor <iant@google.com>
8054
8055 * configure.ac: Check for readv function also.
8056 * fileread.cc (readv): Define if not HAVE_READV.
8057 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8058 does not exist.
8059 * config.in: Regenerate.
8060 * configure: Regenerate.
8061
c0a62865
DK
80622009-10-09 Doug Kwan <dougkwan@google.com>
8063
8064 * layout.cc (Layout::make_output_section): Call target hook to make
8065 ordinary output section.
8066 (Layout::finalize): Adjust parameter list of call the
8067 Target::may_relax().
8068 * layout.h (class Layout::section_list): New method.
8069 * merge.h (Output_merge_base::entsize): Change visibility to public.
8070 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8071 New methods.
8072 (Output_merge_string::do_is_string): New method.
8073 * object.cc (Sized_relobj::do_setup): renamed from
8074 Sized_relobj::set_up.
8075 * object.h (Sized_relobj::adjust_shndx,
8076 Sized_relobj::initializ_input_to_output_maps,
8077 Sized_relobj::free_input_to_output_maps): Change visibilities to
8078 protected.
8079 (Sized_relobj::setup): Virtualize.
8080 (Sized_relobj::do_setup): New method declaration.
8081 (Sized_relobj::invalidate_section_offset,
8082 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8083 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8084 * options.cc (parse_int): New function.
8085 * options.h (parse_int): New declaration.
8086 (DEFINE_int): New macro.
8087 (stub_group_size): New option.
8088 * output.cc (Output_section::Output_section): Initialize memebers
8089 merge_section_map_, merge_section_by_properties_map_,
8090 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8091 (Output_section::add_input_section): Handled deferred code-fill
8092 generation and remove an old comment.
8093 (Output_section::add_relaxed_input_section): New method definition.
8094 (Output_section::add_merge_input_section): Use merge section by
8095 properties map to speed to search. Update merge section maps
8096 as appropriate.
8097 (Output_section::build_relaxation_map): New method definition.
8098 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8099 Same.
8100 (Output_section::relax_input_section): Renamed to
8101 Output_section::convert_input_sections_to_relaxed_sections and change
8102 interface to take a vector of pointers to relaxed sections.
8103 (Output_section::find_merge_section,
8104 Output_section::find_relaxed_input_section): New method definitions.
8105 (Output_section::is_input_address_mapped,
8106 Output_section::output_offset, Output_section::output_address):
8107 Use output section data maps to speed up searching.
8108 (Output_section::find_starting_output_address): Add comments.
8109 (Output_section::do_write,
8110 Output_section::write_to_postprocessing_buffer): Do code-fill
8111 generation as appropriate.
8112 (Output_section::get_input_sections): Invalidate relaxed input section
8113 map.
8114 (Output_section::restore_states): Adjust type of checkpoint .
8115 Invalidate relaxed input section map.
8116 * output.h (Output_merge_base): New class declaration.
8117 (Input_section_specifier): New class defintion.
8118 (class Output_relaxed_input_section) Change base class to
8119 Output_section_data_build.
8120 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8121 base class initializer.
8122 (Output_section::add_relaxed_input_section): New method declaration.
8123 (Output_section::Input_section): Change visibility to protected.
8124 (Output_section::Input_section::relobj,
8125 Output_section::Input_section::shndx): Handle relaxed input sections.
8126 Output_section::input_sections) Change visibility to protected. Also
8127 define overload to return a non-const pointer.
8128 (Output_section::Merge_section_properties): New class defintion.
8129 (Output_section::Merge_section_by_properties_map,
8130 Output_section::Output_section_data_by_input_section_map,
8131 Output_section::Relaxation_map): New types.
8132 (Output_section::relax_input_section): Rename method to
8133 Output_section::convert_input_sections_to_relaxed_sections and change
8134 interface to take a vector of relaxed section pointers.
8135 (Output_section::find_merge_section,
8136 Output_section::find_relaxed_input_section,
8137 Output_section::build_relaxation_map,
8138 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8139 New method declarations.
8140 (Output_section::merge_section_map_
8141 Output_section::merge_section_by_properties_map_,
8142 Output_section::relaxed_input_section_map_,
8143 Output_section::is_relaxed_input_section_map_valid_,
8144 Output_section::generate_code_fills_at_write_): New data members.
8145 * script-sections.cc
8146 (Output_section_element_input::set_section_addresses): Call
8147 current_data_size and addralign methods of relaxed input sections.
8148 (Orphan_output_section::set_section_addresses): Call current_data_size
8149 and addralign methods of relaxed input sections.
8150 * symtab.cc (Symbol_table::compute_final_value): Extract template
8151 from the body of Symbol_table::sized_finalize_symbol.
8152 (Symbol_table::sized_finalized_symbol): Call
8153 Symbol_table::compute_final_value.
8154 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8155 (Symbol_table::compute_final_value): New templated method declaration.
8156 * target.cc (Target::do_make_output_section): New method defintion.
8157 * target.h (Target::make_output_section): New method declaration.
8158 (Target::relax): Add more parameters for input objects, symbol table
8159 and layout. Adjust call to do_relax.
8160 (Target::do_make_output_section): New method declaration.
8161 (Target::do_relax): Add parameters for input objects, symbol table
8162 and layout.
8163
d446d6c4
ILT
81642009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8165
8166 * pread.c: Include stdio.h.
8167
bc06c745
ILT
81682009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8169
8170 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8171 defined.
8172
75aea3d0
ILT
81732009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8174
8175 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8176 Change read_shndx type to unsigned int.
8177 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8178 int.
8179 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8180 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8181 Change read_shndx type to unsigned int.
8182 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8183 int.
8184 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8185 * layout.cc (Layout::create_symtab_sections): Cast the result of
8186 local_symcount * symsize to off_t in the gold_assert.
8187
be8fcb75
ILT
81882009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8189
8190 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8191 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8192 R_ARM_BASE_ABS.
8193 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8194 (Arm_relocate_functions::thm_abs5): New function.
8195 (Arm_relocate_functions::abs12): New function.
8196 (Arm_relocate_functions::abs16): New function.
8197 (Arm_relocate_functions::base_abs): New function.
8198 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8199 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8200 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8201 R_ARM_BASE_ABS.
8202 (Scan::global): Likewise.
8203 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8204 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8205 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8206 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8207 R_ARM_BASE_ABS.
8208
c2a122b6
ILT
82092009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8210
8211 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8212 (Arm_relocate_functions::movt_prel): New function.
8213 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8214 (Arm_relocate_functions::thm_movt_prel): New function.
8215 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8216 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8217 (Scan::global, Relocate::relocate): Likewise.
8218 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8219
c4aa1e2d
ILT
82202009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8221
8222 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8223 Incremental_checker.
8224 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8225 unsigned int.
8226 (class Incremental_inputs_header): New class.
8227 (Incremental_inputs_header_writer): Edit comment.
8228 (Incremental_inputs_entry): New class.
8229 (Incremental_inputs_entry_writer): Edit comment.
8230 (Sized_incremental_binary::do_find_incremental_inputs_section):
8231 Add *strtab_shndx parameter, fill it.
8232 (Sized_incremental_binary::do_check_inputs): New method.
8233 (Incremental_checker::can_incrementally_link_output_file): Use
8234 Sized_incremental_binary::check_inputs.
8235 (Incremental_inputs::report_command_line): Save command line in
8236 command_line_.
8237 * incremental.h:
8238 (Incremental_binary::find_incremental_inputs_section): New
8239 method.
8240 (Incremental_binary::do_find_incremental_inputs_section): Add
8241 strtab_shndx parameter.
8242 (Incremental_binary::do_check_inputs): New pure virtual method.
8243 (Sized_incremental_binary::do_check_inputs): Declare.
8244 (Incremental_checker::Incremental_checker): Add incremental_inputs
8245 parameter, use it to initialize incremental_inputs_.
8246 (Incremental_checker::incremental_inputs_): New field.
8247 (Incremental_checker::command_line): New method.
8248 (Incremental_checker::inputs): New method.
8249 (Incremental_checker::command_line_): New field.
8250
c549a694
ILT
82512009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8252
8253 * incremental.cc: Include <cstdarg> and "target-select.h".
8254 (vexplain_no_incremental): New function.
8255 (explain_no_incremental): New function.
8256 (Incremental_binary::error): New method.
8257 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8258 method.
8259 (make_sized_incremental_binary): New function.
8260 (open_incremental_binary): New function.
8261 (can_incrementally_link_file): Add checks if output is ELF and has
8262 inputs section.
8263 * incremental.h: Include "elfcpp_file.h" and "output.h".
8264 (Incremental_binary): New class.
8265 (Sized_incremental_binary): New class.
8266 (open_incremental_binary): Declare.
8267 * object.cc (is_elf_object): Use
8268 elfcpp::Elf_recognizer::is_elf_file.
8269 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8270 * output.h (Output_file::filesize): New method.
8271
fd3c5f0b
ILT
82722009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8273
8274 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8275 New function.
8276 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8277 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8278 function.
8279 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8280 function.
8281 (Arm_relocate_functions::movw_abs_nc): New function.
8282 (Arm_relocate_functions::movt_abs): New function.
8283 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8284 (Arm_relocate_functions::thm_movt_abs): New function.
8285 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8286 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8287 (Scan::global): Likewise.
8288 (Relocate::relocate): Likewise.
8289 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8290
7f5309a5
ILT
82912009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8292
8293 * arm.cc (Arm_relocate_functions::got_prel) New function.
8294 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8295 (Relocate::relocate): Likewise.
8296 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8297
364c7fa5
ILT
82982009-10-06 Ian Lance Taylor <iant@google.com>
8299
8300 * options.h (class General_options): Define
8301 split_stack_adjust_size parameter.
8302 * object.h (class Object): Add uses_split_stack_ and
8303 has_no_split_stack_ fields. Add uses_split_stack and
8304 has_no_split_stack accessor functions. Declare
8305 handle_split_stack_section.
8306 (class Reloc_symbol_changes): Define.
8307 (class Sized_relobj): Define Function_offsets. Declare
8308 split_stack_adjust, split_stack_adjust_reltype, and
8309 find_functions.
8310 * object.cc (Object::handle_split_stack_section): New function.
8311 (Sized_relobj::do_layout): Call handle_split_stack_section.
8312 * dynobj.cc (Sized_dynobj::do_layout): Call
8313 handle_split_stack_section.
8314 * reloc.cc (Sized_relobj::relocate_sections): Call
8315 split_stack_adjust for executable sections in split_stack
8316 objects. Pass reloc_map to relocate_section.
8317 (Sized_relobj::split_stack_adjust): New function.
8318 (Sized_relobj::split_stack_adjust_reltype): New function.
8319 (Sized_relobj::find_functions): New function.
8320 * target-reloc.h: Include "object.h".
8321 (relocate_section): Add reloc_symbol_changes parameter. Change
8322 all callers.
8323 * target.h (class Target): Add calls_non_split method. Declare
8324 do_calls_non_split virtual method. Declare match_view and
8325 set_view_to_nop.
8326 * target.cc: Include "elfcpp.h".
8327 (Target::do_calls_non_split): New function.
8328 (Target::match_view): New function.
8329 (Target::set_view_to_nop): New function.
8330 * gold.cc (queue_middle_tasks): Give an error if mixing
8331 split-stack and non-split-stack objects with -r.
8332 * i386.cc (Target_i386::relocate_section): Add
8333 reloc_symbol_changes parameter.
8334 (Target_i386::do_calls_non_split): New function.
8335 * x86_64.cc (Target_x86_64::relocate_section): Add
8336 reloc_symbol_changes parameter.
8337 (Target_x86_64::do_calls_non_split): New function.
8338 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8339 parameter.
8340 * powerpc.cc (Target_powerpc::relocate_section): Add
8341 reloc_symbol_changes parameter.
8342 * sparc.cc (Target_sparc::relocate_section): Add
8343 reloc_symbol_changes parameter.
8344 * configure.ac: Call AM_CONDITIONAL for the default target.
8345 * configure: Rebuild.
8346 * testsuite/Makefile.am (TEST_AS): New variable.
8347 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8348 (check_DATA): Add split_i386 and split_x86_64 files.
8349 (SPLIT_DEFSYMS): Define.
8350 (split_i386_[1234n].o): New targets.
8351 (split_i386_[124]): New targets.
8352 (split_i386_[1234r].stdout): New targets.
8353 (split_x86_64_[1234n].o): New targets.
8354 (split_x86_64_[124]): New targets.
8355 (split_x86_64_[1234r].stdout): New targets.
8356 (MOSTLYCLEANFILES): Add new executables.
8357 * testsuite/split_i386.sh: New file.
8358 * testsuite/split_x86_64.sh: New file.
8359 * testsuite/split_i386_1.s: New file.
8360 * testsuite/split_i386_2.s: New file.
8361 * testsuite/split_i386_3.s: New file.
8362 * testsuite/split_i386_4.s: New file.
8363 * testsuite/split_i386_n.s: New file.
8364 * testsuite/split_x86_64_1.s: New file.
8365 * testsuite/split_x86_64_2.s: New file.
8366 * testsuite/split_x86_64_3.s: New file.
8367 * testsuite/split_x86_64_4.s: New file.
8368 * testsuite/split_x86_64_n.s: New file.
8369 * testsuite/testfile.cc (Target_test): Update relocation_section
8370 function.
8371 * testsuite/Makefile.in: Rebuild.
8372
e8a9fcda
ILT
83732009-10-06 Ian Lance Taylor <iant@google.com>
8374
8375 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8376 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8377 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8378 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8379 the address on ldo_addrs_.
8380 (Target_i386::Relocate::fix_up_ldo): New function.
8381
e99daf92
ILT
83822009-10-06 Rafael Espindola <espindola@google.com>
8383
8384 * plugin.cc (add_input_library): New.
8385 (Plugin::load): Add add_input_library to tv.
8386 (Plugin_manager::add_input_file): Add the is_lib argument.
8387 (add_input_file): Update call to Plugin_manager::add_input_file.
8388 (add_input_library): New.
8389 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8390
966d4097
DK
83912009-09-30 Doug Kwan <dougkwan@google.com>
8392
8393 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8394 symbol and call Symbol::may_need_copy_reloc to determine if
8395 a copy reloc is needed.
8396 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8397 nocopyreloc is given in command line.
8398 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8399 given in command line.
8400 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8401 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8402 of the removed Target_i386::may_need_copy_reloc.
8403 * options.h (copyreloc): New option with default value false.
8404 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8405 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8406 instead of the removed Target_powerpc::may_need_copy_reloc.
8407 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8408 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8409 instead of the removed Target_sparc::may_need_copy_reloc.
8410 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8411 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8412 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8413 instead of the removed Target_x86_64::may_need_copy_reloc.
8414
029ba973
ILT
84152009-09-30 Ian Lance Taylor <iant@google.com>
8416
8417 * object.h (class Object): Remove target_ field, and target,
8418 sized_target, and set_target methods.
8419 (Object::sized_target): Remove.
8420 (class Sized_relobj): Update declarations. Remove sized_target.
8421 * object.cc (Sized_relobj::setup): Remove target parameter.
8422 Change all callers.
8423 (Input_objects::add_object): Don't do anything with the target.
8424 (make_elf_sized_object): Add punconfigured parameter. Change all
8425 callers. Set or test parameter target.
8426 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8427 Change all callers.
8428 * parameters.cc (Parameters::set_target): Change parameter type to
8429 be non-const.
8430 (Parameters::default_target): Remove.
8431 (set_parameters_target): Change parameter type to be non-const.
8432 (parameters_force_valid_target): New function.
8433 (parameters_clear_target): New function.
8434 * parameters.h (class Parameters): Update declarations. Remove
8435 default_target method. Add sized_target and clear_target
8436 methods. Change target_ to be non-const.
8437 (set_parameters_target): Update declaration.
8438 (parameters_force_valid_target): Declare.
8439 (parameters_clear_target): Declare.
8440 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8441 as NULL if we aren't searching.
8442 (Add_symbols::run): Don't check for compatible target.
8443 * fileread.cc (Input_file::open_binary): Call
8444 parameters_force_valid_target.
8445 * gold.cc (queue_middle_tasks): Likewise.
8446 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8447 set_target on object.
8448 * dynobj.h (class Sized_dynobj): Update declarations.
8449 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8450 make_elf_object returns NULL.
8451 (Archive::include_member): Don't check whether object target is
8452 compatible.
8453 * output.cc (Output_section::add_input_section): Get target from
8454 parameters.
8455 (Output_section::relax_input_section): Likewise.
8456 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8457 parameters.
8458 (Sized_relobj::do_scan_relocs): Likewise.
8459 (Sized_relobj::relocate_sections): Likewise.
8460 * resolve.cc (Symbol_table::resolve): Likewise.
8461 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8462 parameter. Change all callers.
8463 (Symbol_table::add_from_object): Get target from parameters.
8464 (Symbol_table::add_from_relobj): Don't check object target.
8465 (Symbol_table::add_from_dynobj): Likewise.
8466 (Symbol_table::define_special_symbol): Get target from
8467 parameters.
8468 * symtab.h (class Symbol_table): Update declaration.
8469 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8470 parameter. Change all callers. Clear parameter target.
8471 (Binary_test): Test target here.
8472 * testsuite/object_unittest.cc (gold_testsuite): Remove
8473 target_test_pointer parameter. Change all callers.
8474 (Object_test): Test target here.
8475
a6a22b83
ILT
84762009-09-26 Ian Lance Taylor <iant@google.com>
8477
8478 * testsuite/initpri1.c: Don't try to use constructor priorities if
8479 compiling with gcc before 4.3.
8480
6a8f49fe
ILT
84812009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8482
8483 * testsuite/retain_symbols_file_test.sh (check_present): Change
8484 output file name to retain_symbols_file_test.stdout.
8485 (check_absent): Likewise.
8486
8c604651
CS
84872009-09-18 Craig Silverstein <csilvers@google.com>
8488
8489 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8490 * options.cc: Include <cerrno> and <fstream>.
8491 (General_options::finalize): Parse -retain-symbols-file tag.
8492 * options.h: New flag.
8493 (General_options): New method should_retain_symbol, new
8494 variable symbols_to_retain.
8495 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8496 should_retain_symbol map.
8497 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8498 * testsuite/Makefile.in: Regenerate.
8499 * testsuite/retain_symbols_file_test.sh: New file.
8500
ca58b19f
NC
85012009-09-18 Nick Clifton <nickc@redhat.com>
8502
8503 * po/es.po: Updated Spanish translation.
8504
20e6d0d6
DK
85052009-09-17 Doug Kwan <dougkwan@google.com>
8506
8507 * debug.h (DEBUG_RELAXATION): New constant.
8508 (DEBUG_ALL): Add DEBUG_RELAXATION.
8509 (debug_string_to_enum): Add relaxation debug option.
8510 * layout.cc
8511 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8512 Layout::Relaxation_debug_check::read_sections,
8513 Layout::Relaxation_debug_check::read_sections): New method definitions.
8514 (Layout::Layout): Initialize data members
8515 record_output_section_data_from_scrips_,
8516 script_output_section_data_list_ and relaxation_debug_check_.
8517 (Layout::save_segments, Layout::restore_segments,
8518 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8519 Layout::relaxation_loop_body): New method definitions.
8520 (Layout::finalize): Support relaxation. Move section layout code to
8521 Layout::relaxation_loop_body.
8522 (Layout::set_asection_address_from_script): Move code for orphan
8523 section placement out.
8524 (Layout::place_orphan_sections_in_script): New method definition.
8525 * layout.h (Output_segment_headers, Output_file_header):
8526 New forward class declarations.
8527 (Layout::~Layout): Define.
8528 (Layout::new_output_section_data_from_script): New method definition.
8529 (Layout::place_orphan_sections_in_script): New method declaration.
8530 (Layout::Segment_states): New type declaration.
8531 (Layout::save_segments, Layout::restore_segments,
8532 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8533 Layout::relaxation_loop_body): New method declarations.
8534 (Layout::Output_section_data_list): New type declaration.
8535 (Layout::Relaxation_debug_check): New class definition.
8536 (Layout::record_output_section_data_from_script_,
8537 Layout::script_output_section_data_list_, Layout::segment_states_,
8538 Layout::relaxation_debug_check_): New data members.
8539 * output.cc: (Output_section_headers::do_size): New method definition.
8540 (Output_section_headers::Output_section_headers): Move size
8541 computation to Output_section_headers::do_size.
8542 (Output_segment_headers::do_size): New method definition.
e1df38aa 8543 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
8544 Output_file_header::do_size and call it.
8545 (Output_file_header::do_size): New method definition.
8546 (Output_data_group::Output_data_group): Adjust call to
8547 Output_section_data.
8548 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8549 (Output_symtab_xindex::do_write): Add array bound check.
8550 (Output_section::Input_section::print_to_mapfile): Handle
8551 RELAXED_INPUT_SECTION_CODE.
8552 (Output_section::Output_section): Initialize data member checkpoint_.
8553 (Output_section::~Output_section): Delete checkpoint object pointed
8554 by checkpoint_.
8555 (Output_section::add_input_section): Always add an Input_section if
8556 relaxing.
8557 (Output_section::add_merge_input_section): Add assert.
8558 (Output_section::relax_input_section): New method definition.
8559 (Output_section::set_final_data_size): Set load address to zero for
8560 an unallocated section.
8561 (Output_section::do_address_and_file_offset_have_reset_values):
8562 New method definition.
8563 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8564 Handle relaxed input section.
8565 (Output_section::sort_attached_input_sections): Checkpoint input
8566 section list lazily.
8567 (Output_section::get_input_sections): Change type of input_sections to
8568 list of Simple_input_section pointers. Checkpoint input section list
8569 lazily. Also handle relaxed input sections.
8570 (Output_section::add_input_section_for_script): Take a reference to
8571 a Simple_input_section object instead of Relobj pointer and section
8572 index as parameter. Handle relaxed input sections.
8573 (Output_section::save_states, Output_section::restore_states): New
8574 method definitions.
8575 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8576 (Output_data::is_data_size_fixed): New method definition.
8577 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8578 if it is fixed.
8579 (Output_data::address_and_file_offset_have_reset_values): New method
8580 definition.
8581 (Output_data::do_address_and_file_offset_have_reset_values): New method
8582 definition.
8583 (Output_data::set_data_size): Check that data size is not fixed.
8584 (Output_data::fix_data_size): New method definition.
8585 (Output_data::is_data_size_fixed_): New data member.
8586 (Output_section_headers::set_final_data_size): New method definition.
8587 (Output_section_headers::do_size): New method declaration.
8588 (Output_segment_headers::set_final_data_size): New method definition.
8589 (Output_segment_headers::do_size): New method declaration.
8590 (Output_file_header::set_final_data_size)::New method definition.
8591 (Output_file_header::do_size)::New method declaration.
8592 (Output_section_data::Output_section_data): Add new parameter
8593 is_data_size_fixed and use it to fix data size.
8594 (Output_data_const::Output_data_const): Adjust call to base class
8595 constructor and fix data size.
8596 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8597 base class constructor and fix data size.
8598 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8599 base class constructor and fix data size.
8600 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8601 class constructor and fix data size.
8602 (Output_data_group::set_final_data_size): New method definition.
8603 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8604 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8605 class constructor and fix data size.
8606 (Output_relaxed_input_section): New class definition.
8607 (Output_section::Simple_input_section): New class definition.
8608 (Output_section::get_input_sections): Adjust parameter list.
8609 (Output_section::add_input_section_for_script): Same.
8610 (Output_section::save_states, Output_section::restore_states,
8611 Output_section::do_address_and_file_offset_have_reset_values,
8612 (Output_section::Input_section::Input_section): Handle
8613 RELAXED_INPUT_SECTION_CODE. Add new overload for
8614 Output_relaxed_input_section.
8615 (Output_section::Input_section::is_input_section,
8616 Output_section::Input_section::set_output_section): Handle relaxed
8617 input section.
8618 (Output_section::Input_section::is_relaxed_input_section,
8619 Output_section::Input_section::output_section_data,
8620 Output_section::Input_section::relaxed_input_section): New method
8621 definitions.
8622 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8623 value.
8624 (Output_section::Input_section::u1_): Update comments.
8625 (Output_section::Input_section::u2_): Add new union member poris.
8626 (Output_section::Checkpoint_output_section): New classs definition.
8627 (Output_section::relax_input_section): New method declaration.
8628 (Output_section::checkpoint_): New data member.
8629 (Output_segment): Update comments.
8630 (Output_segment::Output_segment): Un-privatize copy constructor.
8631 (Output_segment::operator=): Un-privatize.
8632 * script-sections.cc (Output_section_element::Input_section_list):
8633 Change element type to Output_section::Simple_input_section.
8634 (Output_section_element_dot_assignment::set_section_addresses):
8635 Register output section data for relaxation clean up.
8636 (Output_data_exression::Output_data_expression): Adjust call to base
8637 constructor to fix data size.
8638 (Output_section_element_data::set_section_addresses): Register
8639 Output_data_expression object for relaxation clean up.
8640 (struct Input_section_info): Replace Relobj pointer and section index
8641 pair with Output_section::Simple_input_section and Convert struct to a
8642 class.
8643 (Input_section_sorter::operator()): Adjust access to
e1df38aa 8644 Input_section_info data member to use accessors.
20e6d0d6
DK
8645 (Output_section_element_input::set_section_addresses): Use layout
8646 parameter. Adjust code to use Output_section::Simple_input_section
8647 and Input_secction_info classes. Register filler for relaxation
8648 clean up.
8649 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8650 and section index pair with Output_section::Simple_input_section
8651 class. Adjust code accordingly.
8652 (Phdrs_element::release_segment): New method definition.
8653 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8654 segment list.
8655 (Script_sections::release_segments): New method definition.
8656 * gold/script-sections.h (Script_sections::release_segments): New
8657 method declaration.
8658 * gold/target.h (Target::may_relax, Target::relax,
8659 Target::do_may_relax, Target::do_relax): New method definitions.
8660
5e445df6
ILT
86612009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8662
8663 * arm.cc (has_signed_unsigned_overflow): New function.
8664 (Arm_relocate_functions::abs8): New function.
8665 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8666 (Target_arm::Scan::global): Likewise.
8667 (Target_arm::relocate::relocate): Likewise.
8668 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8669 Likewise.
8670
8c604651 86712009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
8672
8673 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8674 * testsuite/Makefile.in: Regenerate.
8675
1e9cc1c2
NC
86762009-09-11 Nick Clifton <nickc@redhat.com>
8677
8678 * po/gold.pot: Updated by the Translation project.
8679
6a89f575
CC
86802009-09-08 Cary Coutant <ccoutant@google.com>
8681
8682 * output.cc (Output_file::open): Add execute permission to empty file.
8683 * testsuite/Makefile.am (permission_test): New test.
8684 * testsuite/Makefile.in: Regenerate.
8685
fdcac5af
ILT
86862009-09-02 Ian Lance Taylor <iant@google.com>
8687
8688 * output.cc (Output_file::resize): Call map_no_anonymous rather
8689 than map.
8690
44453f85
ILT
86912009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8692
8693 * gold.cc: Include "incremental.h".
8694 (queue_initial_tasks): Call Incremental_checker methods.
8695 * incremental.cc: Include "output.h".
8696 (Incremental_checker::can_incrementally_link_output_file): New
8697 method.
8698 * incremental.h (Incremental_checker): New class.
8699
8700 * output.cc (Output_file::open_for_modification): New method.
8701 (Output_file::map_anonymous): Changed return type to bool. Record
8702 map in base_ field.
8703 (Output_file::map_no_anonymous): New method, broken out of map.
8704 (Output_file::map): Use map_no_anonymous and map_anonymous.
8705 * output.h (class Output_file): Update declarations.
8706
293c1386
CC
87072009-08-24 Cary Coutant <ccoutant@google.com>
8708
8709 * options.h (Command_line::Pre_options): New class.
8710 (Command_line::pre_options): New member.
8711 * options.cc (gold::options::ready_to_register): New variable.
8712 (One_option::register_option): Do nothing if not registering options.
8713 Assert if same short option registered twice.
8714 (General_options::General_options): Turn off option registration when
8715 done constructing.
8716 (Command_line::Pre_options::Pre_options): New constructor.
8717
f773f3d2
CC
87182009-08-24 Cary Coutant <ccoutant@google.com>
8719
06a73cfe
CC
8720 * options.h (General_options::no_keep_memory): Remove incorrect
8721 short option.
f773f3d2 8722
a15af8e2
RW
87232009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8724
8725 * Makefile.am (am__skiplex, am__skipyacc): New.
8726 * Makefile.in: Regenerate.
8727
c462b41b
RW
87282009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8729
14ec8efd
RW
8730 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8731 (INCLUDES): ... this.
8732 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8733 (AM_CPPFLAGS): Renamed from ...
8734 (INCLUDE): ... this.
8735 * Makefile.in, testsuite/Makefile.in: Regenerate.
8736
81ecdfbb
RW
8737 * Makefile.in: Regenerate.
8738 * aclocal.m4: Likewise.
8739 * config.in: Likewise.
8740 * configure: Likewise.
8741 * testsuite/Makefile.in: Likewise.
8742
c462b41b
RW
8743 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8744 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8745 * Makefile.in: Regenerate.
8746 * testsuite/Makefile.in: Regenerate.
8747
2da73f13
CC
87482009-08-19 Cary Coutant <ccoutant@google.com>
8749
8750 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8751 symbols in shared libraries overridden by hidden or internal symbols
8752 in the main program.
8753
2db70501
CD
87542009-08-19 Chris Demetriou <cgd@google.com>
8755
8756 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8757 checking source file names in error messages.
8758
f733487b
DK
87592009-08-18 Doug Kwan <dougkwan@google.com>
8760
8761 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8762 an elcpp::Ehdr as parameter. Adjust call to set_target.
8763 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8764 an elfcpp::Ehdr as parameter.
8765 * object.cc (Object::set_target): Remove the version that looks up
8766 a target and sets it.
8767 (Sized_relobj::setup): Take a Target object instead of
8768 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8769 (make_elf_sized_object): Find target and ask target to
8770 make an ELF object.
8771 * object.h: (Object::set_target): Remove the version that looks up
8772 a target and sets it.
8773 (Sized_relobj::setup): Take a Target object instead of
8774 an elfcpp:Ehdr as parameter.
8775 * target.cc: Include dynobj.h.
8776 (Target::do_make_elf_object_implementation): New.
8777 (Target::do_make_elf_object): New.
8778 * target.h (Target::make_elf_object): New template declaration.
8779 (Target::do_make_elf_object): New method declarations.
8780 (Target::do_make_elf_object_implementation): New template declaration.
8781
cc70f101
ILT
87822009-08-14 Ian Lance Taylor <iant@google.com>
8783
8784 * gold.h (FUNCTION_NAME): Define.
8785 (gold_unreachable): Use FUNCTION_NAME.
8786
ef5e0cb1
ST
87872009-08-12 Sriraman Tallam <tmsriram@google.com>
8788
8789 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8790 symbol in the --keep-unique list is not found.
8791
48c187ce
ST
87922009-08-12 Sriraman Tallam <tmsriram@google.com>
8793
8794 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8795 been maked as --keep-unique.
8796 (Icf::unfold_section): New function.
8797 * icf.h (Icf::unfold_section): New function.
8798 * options.h (General_options::keep_unique): New option.
8799 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8800 * testsuite/Makefile.in: Regenerate.
8801 * testsuite/icf_keep_unique_test.sh: New file.
8802 * testsuite/icf_keep_unique_test.cc: New file.
8803
645afe0c
CC
88042009-08-12 Cary Coutant <ccoutant@google.com>
8805
8806 PR 10471
8807 * resolve.cc (Symbol_table::resolve): Check for references from
8808 dynamic objects to hidden and internal symbols.
8809 * testsuite/Makefile.am (hidden_test.sh): New test.
8810 * testsuite/Makefile.in: Regenerate.
8811 * testsuite/hidden_test.sh: New script.
8812 * testsuite/hidden_test_1.c: New test source.
8813 * testsuite/hidden_test_main.c: New test source.
8814
11af873f
DK
88152009-08-11 Doug Kwan <dougkwan@google.com>
8816
8817 * arm.cc: Update comments.
8818 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8819 segment to locate the .ARM.exidx section if present.
8820
b9f7d72d
DK
88212009-08-09 Doug Kwan <dougkwan@google.com>
8822
8823 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8824 patch.
8825
ddd3c53c
ST
88262009-08-07 Sriraman Tallam <tmsriram@google.com>
8827 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8828 compiler warnings.
8829
27721062
ST
88302009-08-06 Sriraman Tallam <tmsriram@google.com>
8831
8832 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8833 valid tls_segment only for non-debug-section relocations.
8834 * testsuite/Makefile.am: Add gc_tls_test.
8835 * testsuite/Makefile.in: Regenerate.
8836 * testsuite/gc_tls_test.cc: New file.
8837 * testsuite/gc_tls_test.sh: New file.
8838
ef15dade 88392009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 8840
ef15dade
ST
8841 * icf.cc: New file.
8842 * icf.h: New file.
8843 * Makefile.am (CCFILES): Add icf.cc.
8844 (HFILES): Add icf.h
8845 * Makefile.in: Regenerate.
8846 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8847 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8848 section, symbol and addend information for the relocs.
8849 * gold.cc (queue_middle_tasks): Call identical code folding.
8850 * gold.h: Add defines for multimap.
8851 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8852 to the call of finalize_local_symbols.
8853 * main.cc (main): Create object of class Icf.
8854 * object.cc (Sized_relobj::do_layout): Allow this function to be
8855 called twice during icf.
8856 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8857 to sections marked as identical by icf.
8858 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8859 when available.
8860 (Sized_relobj::do_section_entsize): New function.
8861 * object.h (Object::section_entsize): New function.
8862 (Object::do_section_entsize): New pure virtual function.
8863 (Relobj::finalize_local_symbols): Add new parameter.
8864 (Relobj::do_section_entsize): New function.
8865 * options.h (General_options::icf): New option.
8866 (General_options::icf_iterations): New option.
8867 (General_options::print_icf_sections): New option.
8868 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8869 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8870 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8871 icf.
8872 * symtab.cc (Symbol_table::is_section_folded): New function.
8873 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8874 to sections marked as identical by icf.
8875 * symtab.h (Symbol_table::set_icf): New function.
8876 (Symbol_table::icf): New function.
8877 (Symbol_table::is_section_folded): New function.
8878 (Symbol_table::icf_): New data member.
8879 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8880 * testsuite/Makefile.am: Add commands to build icf_test.
8881 * testsuite/Makefile.in: Regenerate.
8882 * testsuite/icf_test.sh: New file.
8883 * testsuite/icf_test.cc: New file.
8884
c3b65ac4
CD
88852009-07-24 Chris Demetriou <cgd@google.com>
8886
8887 * layout.cc (is_compressible_debug_section): Fix incorrect
8888 comment about compressed section names.
8889
1caf2c51
ILT
88902009-07-20 Ian Lance Taylor <ian@airs.com>
8891
8892 PR 10419
8893 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8894
1ef4d87f
ILT
88952009-07-16 Ian Lance Taylor <iant@google.com>
8896
8897 PR 10400
8898 * layout.h: #include <map>.
8899 (class Kept_section): Change from struct to class. Add accessors
8900 and setters. Add section size to Comdat_group mapping. Change
8901 Comdat_group to std::map. Add is_comdat_ field. Add
8902 linkonce_size field in union.
8903 (class Layout): Update declaration of find_or_add_kept_section.
8904 Don't declare find_kept_object.
8905 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8906 parameter. Add object, shndx, is_comdat, and is_group_name
8907 parameters. Change all callers. Adjust for new Kept_section.
8908 (Layout::find_kept_object): Remove.
8909 * object.cc (Sized_relobj::include_section_group): Update use of
8910 Kept_section. Rename secnum to shndx. Only record
8911 Kept_comdat_section if sections are the same size.
8912 (Sized_relobj::include_linkonce_section): Update use of
8913 Kept_section. Only record Kept_comdat_section if sections are the
8914 same size. Set size of linkonce section.
8915 (Sized_relobj::map_to_kept_section): Update call to
8916 get_kept_comdat_section.
8917 * object.h (class Sized_relobj): Rename fields in
8918 Kept_comdat_section to drop trailing underscores; change object
8919 field to Relobj*. Change Kept_comdat_section_table to store
8920 struct rather than pointer.
8921 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8922 Add kept_object and kept_shndx parameters. Change all callers.
8923 (Sized_relobj::get_kept_comdat_section): Change return type to
8924 bool. Add kept_object and kept_shndx parameters. Change all
8925 callers.
8926 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8927 Layout::find_or_add_kept_section.
8928
37c3b7b0
ILT
89292009-07-09 Ian Lance Taylor <iant@google.com>
8930
8931 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8932 Reserve space in the hash table.
8933
98fa85cb
ILT
89342009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8935
8936 * fileread.cc (File_read::get_mtime): New method.
8937 * fileread.h (Timespec): New structure.
8938 (File_read::get_mtime): New method.
8939 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8940 Renamed from timestamp_nsec.
8941 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8942 Elf_Xword.
e1df38aa 8943 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 8944 timestamp_nsec.
e1df38aa 8945 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
8946 (Incremental_inputs::report_obejct): Save mtime; style fix.
8947 (Incremental_inputs::report_script): Save mtime; style fix.
8948 (Incremental_inputs::finalize_inputs): Style fix.
8949 (Incremental_inputs::finalize): Style fix.
8950 (Incremental_inputs::create_input_section_data): Store inputs
8951 mtime.
8952 * incremental.h (Incremental_inputs::report_script): Add mtime
8953 argument.
8954 (Incremental_inputs::Input_info::Input_info): Intialize only one
8955 union member.
8956 (Incremental_inputs::Input_info::archive): Move to nameless
8957 union.
8958 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8959 (Incremental_inputs::Input_info::script): Move to nameless union.
8960 (Incremental_inputs::mtime): New field.
8961 * script.cc (read_input_script): Pass file mtime to
8962 Incremental_input.
8963 * script.h (Script_info::inputs): Style fix.
8964
c9d70757
ILT
89652009-07-01 Ian Lance Taylor <ian@airs.com>
8966
8967 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8968 instead of 32.
8969
9c547ec3
ILT
89702009-06-24 Ian Lance Taylor <iant@google.com>
8971
8972 PR 10156
8973 * layout.cc (Layout::choose_output_section): If we find an
8974 existing section, update the flags.
8975 (Layout::create_notes): New function, broken out of
8976 Layout::finalize.
8977 (Layout::finalize): Don't create note sections.
8978 (Layout::create_note): Don't crash if linker script discards
8979 section.
8980 (Layout::create_gold_note): Likewise.
8981 (Layout::create_build_id): Likewise. Don't set
8982 after_input_sections on the section.
8983 (Layout::create_executable_stack_info): Remove target parameter.
8984 Change caller.
8985 * layout.h (class Layout): Declare create_notes. Update
8986 declaration of create_executable_stack_info.
8987 * gold.cc (queue_middle_tasks): Call create_notes.
8988 * output.cc (Output_section::update_flags_for_input_section): Move
8989 here from output.h. If SHF_ALLOC flag is newly set, mark address
8990 invalid.
8991 * output.h (Output_data::mark_address_invalid): New function.
8992 (class Output_section): Only declare, not define,
8993 update_flags_for_input_section. Remove set_flags.
8994
55458500
ILT
89952009-06-24 Ian Lance Taylor <iant@google.com>
8996
8997 * script-sections.cc (Output_section_definition::
8998 set_section_addresses): Rename shadowing local load_address to
8999 laddr.
9000
1307d6cd
ILT
90012009-06-24 Ian Lance Taylor <iant@google.com>
9002
9003 PR 10244
9004 * reloc.cc (relocate_sections): Skip empty relocation sections.
9005
ec3f783e
ILT
90062009-06-23 Ian Lance Taylor <iant@google.com>
9007
9008 PR 10156
9009 * layout.cc (Layout::create_note): Use choose_output_section
9010 rather than make_output_section.
9011
459c9f1c
ILT
90122009-06-23 Ian Lance Taylor <iant@google.com>
9013
9014 PR 10237
9015 * options.cc (General_options::parse_V): Set printed_version_.
9016 (General_options::General_options): Initialize printed_version_.
9017 * options.h (class General_options): Add printed_version_ field.
9018 * gold.cc (queue_initial_tasks): If there are no input files,
9019 don't give a fatal error if we printed the version information.
9020 (queue_middle_tasks): If using -r with a shared object, give a
9021 fatal error rather than an ordinary error.
9022
1518dc8f
ILT
90232009-06-23 Ian Lance Taylor <iant@google.com>
9024
9025 PR 10219
9026 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9027 (Layout::make_output_section): Set have_stabstr_section_ if we see
9028 a .stab*str section.
9029 (Layout::finalize): Call link_stabs_sections.
9030 (Layout::link_stabs_sections): New file.
9031 * layout.h (class Layout): Add have_stabstr_section_ field.
9032 Declare link_stabs_sections.
9033
3d857b98
DK
90342009-06-23 Doug Kwan <dougkwan@google.com>
9035
9036 * Makefile.am (libgold_a_LIBADD): New.
9037 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9038 * Makefile.in: Regenerate.
9039 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9040 * configure: Regenerate.
9041 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9042 * fileread.cc: Include sys/state.h
9043 * gold.h: Declare memmem and strndup if found missing.
9044 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9045
0639a6f6
ILT
90462009-06-23 Ian Lance Taylor <iant@google.com>
9047
9048 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9049 * configure: Rebuild.
9050
8d63875c
ILT
90512009-06-23 Ian Lance Taylor <iant@google.com>
9052
9053 PR 10147
9054 * object.cc (Object::section_contents): Don't try to get a view if
9055 the section has length zero.
9056 (Object::handle_gnu_warning_section): If the section is empty, use
9057 the name of the section as the warning.
9058
f7c8a183
ILT
90592009-06-23 Ian Lance Taylor <iant@google.com>
9060
9061 PR 10133
9062 * stringpool.h (class Stringpool_template): Add optimize_ field.
9063 (Stringpool_template::set_optimize): New function.
9064 * stringpool.cc (Stringpool_template::Stringpool_template):
9065 Initialize optimize_ field.
9066 (Stringpool_template::set_string_offsets): Test local optimize
9067 fild rather than parameter.
9068 * layout.cc (Layout::Layout): Call set_optimize on the section
9069 name stringpool.
9070
e6a307ba
ILT
90712009-06-22 Ian Lance Taylor <iant@google.com>
9072
9073 PR 10030
9074 * yyscript.y: Parse TARGET.
9075 * script.cc (script_set_target): New function.
9076 * script-c.h (script_set_target): Declare.
9077 * options.cc (General_options::string_to_object_format): Rename
9078 from string_to_object_format in anonymous namespace. Change
9079 callers.
9080 * options.h (class General_options): Declare
9081 string_to_object_format.
9082
3ee173de
ILT
90832009-06-22 Ian Lance Taylor <iant@google.com>
9084
9085 * script-sections.cc (Script_sections::create_segments): Don't put
9086 program headers in a PT_LOAD segment if -n or -N.
9087
90882009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
9089
9090 PR 10141
9091 * options.h (class General_options): Add -z lazy and -z now. Sort
9092 -z options into alphabetical order.
9093 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9094
cd6739a1 90952009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
9096
9097 * layout.cc (Layout::make_output_section): Call
9098 Target::new_output_section.
9099 (Layout::attach_allocated_section_to_segment): Put large section
9100 sections in a separate load segment with the large segment flag
9101 set.
9102 (Layout::segment_precedes): Sort large data segments after other
9103 load segments.
9104 (align_file_offset): New static function.
9105 (Layout::set_segment_offsets): Use align_file_offset.
9106 * output.h (class Output_section): Add is_small_section_ and
9107 is_large_section_ fields.
9108 (Output_section::is_small_section): New function.
9109 (Output_section::set_is_small_section): New function.
9110 (Output_section::is_large_section): New function.
9111 (Output_section::set_is_large_section): New function.
9112 (Output_section::is_large_data_section): New function.
9113 (class Output_segment): Add is_large_data_segment_ field.
9114 (Output_segment::is_large_data_segment): New function.
9115 (Output_segment::set_is_large_data_segment): New function.
9116 * output.cc (Output_section::Output_section): Initialize new
9117 fields.
9118 (Output_segment::Output_segment): Likewise.
9119 (Output_segment::add_output_section): Add assertion that large
9120 data sections always go in large data segments. Force small data
9121 sections to the end of the list of data sections. Force small BSS
9122 sections to the start of the list of BSS sections. For large BSS
9123 sections to the end of the list of BSS sections.
9124 * symtab.h (class Symbol): Declare is_common_shndx.
9125 (Symbol::is_defined): Check Symbol::is_common_shndx.
9126 (Symbol::is_common): Likewise.
9127 (class Symbol_table): Define enum Commons_section_type. Update
9128 declarations. Add small_commons_ and large_commons_ fields.
9129 * symtab.cc (Symbol::is_common_shndx): New function.
9130 (Symbol_table::Symbol_table): Initialize new fields.
9131 (Symbol_table::add_from_object): Put small and large common
9132 symbols in the right list.
9133 (Symbol_table::sized_finalized_symbol): Check
9134 Symbol::is_common_shndx.
9135 (Symbol_table::sized_write_globals): Likewise.
9136 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9137 common symbol lists. Don't call do_allocate_commons_list if the
9138 list is empty.
9139 (Symbol_table::do_allocate_commons_list): Remove is_tls
9140 parameter. Add comons_section_type parameter. Change all
9141 callers. Handle small and large common symbols.
9142 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9143 Symbol::is_common_shndx.
9144 * resolve.cc (symbol_to_bits): Likewise.
9145 * target.h (Target::small_common_shndx): New function.
9146 (Target::small_common_section_flags): New function.
9147 (Target::large_common_shndx): New function.
9148 (Target::large_common_section_flags): New function.
9149 (Target::new_output_section): New function.
9150 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9151 small_common_section_flags, and large_common_section_flags
9152 fields.
9153 (Target::do_new_output_section): New virtual function.
9154 * arm.cc (Target_arm::arm_info): Initialize new fields.
9155 * i386.cc (Target_i386::i386_info): Likewise.
9156 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9157 Likewise.
9158 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9159 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9160 (Target_x86_64::do_new_output_section): New function.
9161 * configure.ac: Define conditional MCMODEL_MEDIUM.
9162 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9163 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9164 (large_LDFLAGS): Define.
9165 * testsuite/large.c: New file.
9166 * testsuite/testfile.cc (Target_test::test_target_info):
9167 Initialize new fields.
9168 * configure, testsuite/Makefile.in: Rebuild.
9169
bb04269c
DK
91702009-06-05 Doug Kwan <dougkwan@google.com>
9171
9172 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 9173 * Makefile.in: Regenerate.
bb04269c
DK
9174 * i386.cc (class Target_i386): Define new virtual method to
9175 override do_is_local_label_name in parent.
9176 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9177 local symbols if --discard-locals or -X is given.
9178 * options.h (class General_options): Declare new options
9179 '--discard-locals' and '-X' for discarding locals.
9180 * target.h (class Target): Define new methods is_local_label_name.
9181 Declare new virtual method do_is_local_label_name.
9182 * target.cc: New file.
9183 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9184 (check_SCRIPTS): Add discard_locals_test.sh.
9185 (check_DATA): Add discard_local_tests.syms.
9186 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9187 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9188 * testsuite/Makefile.in: Regenerate.
9189 * testsuite/discard_locals_test.c: New file.
9190 * testsuite/discard_locals_test.sh: Same.
9191
805bb01c
DK
91922009-06-05 Doug Kwan <dougkwan@google.com>
9193
9194 * object.cc (Sized_relobj::Sized_relobj): Initialize
9195 discarded_eh_frame_shndx_ to -1U.
9196 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9197 section.
9198 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9199 a discarded .eh_frame section.
9200 (Sized_relobj::do_finalize_local_symbols): Ditto.
9201 * object.h (class Sized_relobj): Declare new member
9202 discarded_eh_frame_shndx_.
9203 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9204 (local_labels_test.o, local_labels_test): New rules.
9205 * testsuite/Makefile.in: Regenerate.
9206
1dcd334d
DK
92072009-06-04 Doug Kwan <dougkwan@google.com>
9208
9209 * layout.cc (Layout::section_name_mapping): Add mapping for
9210 special ARM sections.
9211
96d49306
DK
92122009-06-03 Doug Kwan <dougkwan@google.com>
9213
9214 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9215 (utils::has_overflow): Same.
9216
dff16297
ILT
92172009-06-03 Ian Lance Taylor <iant@google.com>
9218
9219 * layout.cc (Layout::section_name_mapping): New array, replacing
9220 Layout::linkonce_mapping.
9221 (Layout::section_name_mapping_count): New variable, replacing
9222 Layout::linkonce_mapping_count.
9223 (Layout::linkonce_output_name): Remove.
9224 (Layout::output_section_name): Rewrite.
9225 * layout.h (class Layout): Rename Linkonce_mapping to
9226 Section_name_mapping, linkonce_mapping to section_name_mapping,
9227 linkonce_mapping_count to section_name_mapping_count. Don't
9228 declare linkonce_output_name.
9229
c121c671
DK
92302009-06-03 Doug Kwan <dougkwan@google.com>
9231
9232 * gold/arm.cc (namespace utils): New.
9233 (Target_arm::reloc_is_non_pic): Define new method.
9234 (class Arm_relocate_functions): New.
9235 (Target_arm::Relocate::relocate): Handle relocation types used by
9236 Android.
9237
07800fab
ILT
92382009-06-03 Ian Lance Taylor <iant@google.com>
9239
9240 * arm.cc (Target_arm::scan::global): Use || instead of |.
9241
c121c671
DK
92422009-06-02 Doug Kwan <dougkwan@google.com>
9243
9244 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9245 issued_non_pic_error_.
9246 (class Target_arm::Scan): Declare new method check_non_pic.
9247 Define new method symbol_needs_plt_entry.
9248 Declare new data member issued_non_pic_error_.
9249 (class Target_arm::Relocate): Declare new method
9250 should_apply_static_reloc.
9251 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9252 (Target_arm::Scan::check_non_pic): Define new method.
9253 (Target_arm::Scan::local): Handle a small subset of reloc types used
9254 by Android.
9255 (Target_arm::Scan::local): Same.
9256 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9257
b19b0c6d
ILT
92582009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9259
9260 * incremental.cc (Incremental_inputs::report_command_line): Filter
9261 out --incremental-* options.
9262
94cdfcff
DK
92632009-05-29 Doug Kwan <dougkwan@google.com>
9264
9265 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9266 template class.
9267 (class Target_arm): Update comment.
9268 (Target_arm::Target_arm): Initialize new data members GOT_,
9269 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9270 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9271 and Target_arm::rel_dyn_section.
9272 Declare new_enum Target_arm::Got_type.
9273 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9274 and DYNBSS_.
9275 Update commments for member do_dynsym_value.
9276 (Target_arm::got_size, Target_arm::plt_section,
9277 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9278 new methods inside class defintion.
9279 (Target_arm::got_section): Define new method.
9280 (Target_arm::rel_dyn_section): Same.
9281 (Output_data_plt_arm): New template class.
9282 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9283 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9284 (Output_data_plt_arm::add_entry): Same.
9285 (Output_data_plt_arm::first_plt_entry): Define new
9286 static data member for PLT instruction template.
9287 (Output_data_plt_arm::plt_entry): Same.
9288 (Output_data_plt_arm::do_write): Define new method.
9289 (Target_arm::make_plt_entry): Same.
9290 (Target_arm::do_finalize_sections): Same.
9291 (Target_arm::do_dynsym_value): Same.
9292
4a657b0d
DK
92932009-05-28 Doug Kwan <dougkwan@google.com>
9294
9295 * Makefile.am (TARGETSOURCES): Add arm.cc.
9296 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9297 * Makefile.in: Regenerate.
9298 * arm.cc: New file.
9299 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9300
e7ae8c36
DK
93012009-05-26 Doug Kwan <dougkwan@google.com>
9302
9303 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9304 (General_options::check_excluded_libs): Strip off directories in
9305 archive name before matching like GNU ld does.
9306 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9307 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9308 (exclude_libs_test_LDFLAGS): Add linker option
9309 -Wl,--exclude-libs,libexclude_libs_test_3
9310 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9311 an explicit archive without using -l.
9312 (alt/libexclude_libs_test_3.a): New make rule.
9313 * testsuite/Makefile.in: Regenerate.
9314 * testsuite/exclude_libs_test.c : Declare lib3_default().
9315 (main): Call it.
9316 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9317 * exclude_libs_test_3.c: New file.
9318
f12e7348
NC
93192009-05-26 Nick Clifton <nickc@redhat.com>
9320
9321 * po/id.po: New Indonesian translation.
9322 * po/gold.pot: Updated template file.
9323
4daadc0d
ST
93242009-05-22 Sriraman Tallam <tmsriram@google.com>
9325
e1df38aa 9326 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
9327 gc_comdat_test files. Add -Wl,--gc-sections to build
9328 gc_comdat_test.
9329 * testsuite/Makefile.in: Regenerate.
9330 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9331
531813ad
ST
93322009-05-21 Sriraman Tallam <tmsriram@google.com>
9333
9334 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9335 kept comdat section was garbage collected.
9336 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9337 * testsuite/Makefile.in: Regenerate.
9338 * testsuite/gc_comdat_test.sh: New file.
9339 * testsuite/gc_comdat_test_1.cc: New file.
9340 * testsuite/gc_comdat_test_2.cc: New file.
9341
65514900
CC
93422009-05-19 Doug Kwan <dougkwan@google.com>
9343
9344 * archive.cc (Archive::Archive): Move constructor from archive.h
9345 to here. Initialize no_export_.
9346 (Archive::get_elf_object_for_member): Set no_export flag of object.
9347 * archive.h (Archive::Archive): Move constructor body to
9348 archive.cc.
9349 (Archive::no_export): New method.
9350 (Archive::no_export_): New field.
9351 * object.h (Object::Object): Initialize no_export_ to false.
9352 (Object::no_export, Object::set_no_export): New methods.
9353 (Object::no_export_): New field.
9354 * options.cc (General_options::parse_exclude_libs): New method.
9355 (General_options::check_excluded_libs) Same.
9356 * options.h (exclude_libs): New option.
9357 (General_options::check_excluded_libs): New method declaration.
9358 (General_options::excluded_libs_): New field.
9359 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9360 default or protected visibility if an object has no-export flag set.
9361 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9362 (check_SCRIPTS): Add exclude_libs_test.sh.
9363 (check_DATA): Add exclude_libs_test.syms.
9364 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9365 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9366 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9367 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9368 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9369 libexclude_libs_test_2.a): New rules.
9370 * testsuite/Makefile.in: Regenerate.
9371 * testsuite/exclude_libs_test.c: New file.
9372 * testsuite/exclude_libs_test.sh: Ditto.
9373 * testsuite/exclude_libs_test_1.c: Ditto.
9374 * testsuite/exclude_libs_test_2.c: Ditto.
9375
1b77ea50
ILT
93762009-05-15 Ian Lance Taylor <iant@google.com>
9377
9378 * configure.ac: Check for declarations for cases where libiberty.h
9379 checks HAVE_DECL_xxx.
9380 * configure, config.in: Rebuild.
9381
072fe7ce
ILT
93822009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9383
9384 * gold.h (Incremental_argument_list): Remove (invalid) forward
9385 declaration.
9386 * incremental.cc (Incremental_inputs::report_achive): New method.
9387 (Incremental_inputs::report_object): New method.
9388 (Incremental_inputs::report_script): New method.
9389 (Incremental_inputs::finalize_inputs): New method.
9390 (Incremental_inputs::finalize): Call finalize_inputs().
9391 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9392 Create inputs entries.
9393 * incremental.h (Incremental_input_type): New enum.
9394 (Incremental_inputs::Incremental_input): Initialize new fields.
9395 (Incremental_inputs::report_inputs): New method.
9396 (Incremental_inputs::report_achive): New method.
9397 (Incremental_inputs::report_object): New method.
9398 (Incremental_inputs::report_script): New method.
9399 (Incremental_inputs::finalize_inputs): New method.
9400 (Incremental_inputs::Input_info): New struct.
9401 (Incremental_inputs::Input_info_map): New typedef.
9402 (Incremental_inputs::lock_): New field.
9403 (Incremental_inputs::Inputs_): New field.
9404 (Incremental_inputs::Inputs_map): New field.
9405 * main.cc (main): Call Incremental_input::report_inputs.
9406 * options.h (Input_argument_list): Typedef moved from
9407 Input_arguments.
9408 (Input_file_group::Files): Remove, use ::Input_argument_list.
9409 (Input_file_group::Input_argument_list): Remove, use
9410 ::Input_argument_list.
9411 * plugin.cc (Plugin_manager::add_input_file): Add error in
9412 incremental build.
9413 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9414 functions.
9415 * script.cc (read_input_script): Call
9416 Incremental_input::report_script.
9417 * script.h (Script_info): New class.
9418
b0481b0b
ILT
94192009-04-27 Ian Lance Taylor <iant@google.com>
9420
9421 * x86_64.cc (do_adjust_output_section): Set entsize to
9422 plt_entry_size.
9423
b22a5a41 94242009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
9425
9426 * output.cc (Output_file::close): After short writes, continue
9427 writing from the correct offset in the buffer being written.
9428
40fde488
CD
94292009-04-23 Chris Demetriou <cgd@google.com>
9430
9431 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9432 * configure: Regenerate.
9433 * config.in: Regenerate.
9434 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9435 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9436
3ce2c28e
ILT
94372009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9438
9439 * incremental.cc (Incremental_inputs_header_data): Renamed from
9440 Incremental_input_header_data.
9441 (Incremental_inputs_header_data::data_size): New field.
9442 (Incremental_inputs_header_data::put_input_file_count): Renamed
9443 from input_file_count.
9444 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9445 from command_line_offset.
9446 (Incremental_inputs_header_data::put_reserved): Renamed from
9447 put_reserved.
9448 (Incremental_inputs_entry_data): Renamed from
9449 Incremental_input_entry_data.
9450 (Incremental_inputs_entry_data::data_size): New field.
9451 (Incremental_inputs::report_command_line): New method.
9452 (Incremental_inputs::finalize): New method.
9453 (Incremental_inputs::create_incremental_inputs_data): New method.
9454 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9455 * incremental.h: New file.
9456 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9457 (Layout::finalize): Create incremental inputs section in
9458 incremental builds.
9459 (Layout::create_incremental_info_sections): New method.
9460 * layout.h (Layout::incremental_inputs): New method.
9461 (Layout::create_incremental_info_sections): New method.
9462 (Layout::incremental_inputs_): New field.
9463 * main.cc (main): Notify Incremental_input of the command line.
9464
e55bde5e
ILT
94652009-04-01 Ian Lance Taylor <iant@google.com>
9466 Mikolaj Zalewski <mikolajz@google.com>
9467
9468 * gold.h (reserve_unordered_map): Define, three versions, one for
9469 each version of Unordered_map.
9470 * layout.cc (Layout::Layout): Remove options parameter. Add
9471 number_of_input_files parameter. Don't initialize options_.
9472 Initialize number_of_input_files_ and resized_signatures_. Move
9473 sections_are_attached_.
9474 (Layout::layout_group): Reserve space for group_signatures_.
9475 (Layout::find_or_add_kept_section): Change name parameter to be a
9476 reference. Resize signatures_ map when it gets large enough.
9477 (Layout::layout_eh_frame): Use parameters->options() instead of
9478 this->options_.
9479 (Layout::make_output_section): Likewise.
9480 (Layout::attach_allocated_section_to_segment): Likewise.
9481 (Layout::finalize, Layout::create_executable_stack): Likewise.
9482 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9483 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9484 * layout.h (class Layout): Update declarations. Remove options_
9485 field. Add number_of_input_files_ and resized_signatures_
9486 fields. Move sections_are_attached_ field.
9487 * main.cc (main): Pass number of input files to Layout
9488 constructor. Don't pass options.
9489
154b857c
ILT
94902009-03-30 Ian Lance Taylor <iant@google.com>
9491
9492 * ffsll.c (ffsll): Correct implementation.
9493
2f35ab9b
ILT
94942009-03-27 Ian Lance Taylor <iant@google.com>
9495
fd03461a
ILT
9496 * ffsll.c: New file.
9497 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9498 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9499 * ftruncate.c (ftruncate): Declare before definition.
9500 * mremap.c (mremap): Likewise.
9501 * pread.c (pread): Likewise.
9502 * configure, Makefile.in, config.in: Rebuild.
9503
2f35ab9b
ILT
9504 * mremap.c: New file.
9505 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9506 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9507 (mremap): Declare if HAVE_MREMAP is not defined.
9508 * configure, Makefile.in, config.in: Rebuild.
9509
33aea2fd
CC
95102009-03-27 Cary Coutant <ccoutant@google.com>
9511
9512 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9513 position independent.
9514 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9515 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9516
6d479619
CC
95172009-03-24 Cary Coutant <ccoutant@google.com>
9518
9519 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9520 an executable.
9521 (needs_dynamic_reloc): Likewise.
9522
afc06bb8
ILT
95232009-03-24 Ian Lance Taylor <iant@google.com>
9524
9525 * yyscript.y (file_cmd): Recognize EXTERN.
9526 (extern_name_list, extern_name_list_body): New nonterminals.
9527 * script.cc (script_add_extern): Define.
9528 * script-c.h (script_add_extern): Declare.
9529
f6060a4d
ILT
95302009-03-24 Rafael Avila de Espindola <espindola@google.com>
9531
9532 * object.cc (is_elf_object): Define.
9533 * object.h (is_elf_object): Declare.
9534 * archive.cc (Archive::get_elf_object_for_member): Call
9535 is_elf_object.
33aea2fd 9536 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 9537
26736d8e
ILT
95382009-03-24 Elliott Hughes <enh@google.com>
9539
9540 * output.cc (Output_file::map_anonymous): Define.
9541 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9542 try an anonymous one. Report the size if the mmap fails.
9543 * output.h (class Output_file): Declare map_anonymous.
9544
22fd9730
ILT
95452009-03-24 Ian Lance Taylor <iant@google.com>
9546
9547 * target-select.cc (instantiate_target): Don't acquire the lock if
9548 the instantiated_target_ field has already been set.
9549
cb010894
ILT
95502009-03-23 Ian Lance Taylor <iant@google.com>
9551
7f055c20
ILT
9552 * gold-threads.h (class Initialize_lock): Define.
9553 * gold-threads.cc (class Initialize_lock_once): Define.
9554 (initialize_lock_control): New static variable.
9555 (initialize_lock_pointer): New static variable.
9556 (initialize_lock_once): New static function.
9557 (Initialize_lock::Initialize_lock): Define.
9558 (Initialize_lock::initialize): Define.
9559 * target-select.h: Include "gold-threads.h".
9560 (class Target_selector): Add lock_ and initialize_lock_ fields.
9561 Don't define instantiate_target, just declare it.
9562 * target-select.cc (Target_selector::Target_selector): Initialize
9563 new fields.
9564 (Target_selector::instantiate_target): Define.
9565 * descriptors.h: Include "gold-threads.h".
9566 (class Descriptors): Add initialize_lock_ field.
9567 * descriptors.cc (Descriptors::Descriptors): Initialize new
9568 field.
9569 (Descriptors::open): Use initialize_lock_ field
9570 * errors.h (class Errors): Add initialize_lock_ field.
9571 * errors.cc (Errors::Errors): Initialize new field.
9572 (Errors::initialize_lock): Use initialize_lock_ field.
9573 * powerpc.cc (class Target_selector_powerpc): Remove
9574 instantiated_target_ field. In do_recognize call
9575 instantiate_target rather than do_instantiate_target. In
9576 do_instantiate_target just allocate a new target.
9577 * sparc.cc (class Target_selector_sparc): Likewise.
9578
36959681
ILT
9579 * freebsd.h: New file.
9580 * i386.cc: Include "freebsd.h".
9581 (Target_i386): Derive from Target_freebsd rather than
9582 Sized_target.
9583 (Target_selector_i386): Derive from Target_selector_freebsd rather
9584 than Target_selector.
9585 * x86_64.cc: Include "freebsd.h".
9586 (Target_x86_64): Derive from Target_freebsd rather than
9587 Sized_target.
9588 (Target_selector_x86_64): Derive from Target_selector_freebsd
9589 rather than Target_selector.
9590 * target.h (class Target): Add adjust_elf_header and
9591 do_adjust_elf_header.
9592 * output.cc (Output_file_header:: do_sized_write): Call target
9593 adjust_elf_header routine.
9594 * configure.tgt: Set targ_osabi.
9595 * configure.ac: Define GOLD_DEFAULT_OSABI.
9596 * parameters.cc (Parameters::default_target): Pass
9597 GOLD_DEFAULT_OSABI to select_target.
9598 * target-select.h (class Target_selector): Make instantiate_target
9599 protected rather than private.
9600 * Makefile.am (HFILES): Add freebsd.h.
9601 * configure, Makefile.in, config.in: Rebuild.
9602
cb010894
ILT
9603 * merge.cc (do_add_input_section): Correct pend value. Change
9604 message about last entry not being null terminated from error to
9605 warning.
9606
0e879927
ILT
96072009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9608
9609 * incremental.cc: New file.
9610 * Makefile.am (CCFILES): Add incremental.cc.
9611 * Makefile.in: Rebuild.
9612
41105937
PP
96132009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9614
9615 * layout.cc (Layout::output_section_name): Preserve names
9616 of '.note.' sections.
e1df38aa 9617
60439920
ILT
96182009-03-19 Ian Lance Taylor <iant@google.com>
9619
9620 * descriptors.cc (Descriptors::open): Check that the options are
9621 valid before using them.
9622
0d371ad3
ILT
96232009-03-18 Ian Lance Taylor <iant@google.com>
9624
9625 * script-sections.h: Include <list>.
9626 (class Script_sections): Change Sections_elements from std::vector
9627 to std::list. Typedef public Elements_iterator. Add
9628 orphan_section_placement_, data_segment_align_start_, and
9629 saw_data_segment_align_ fields. Remove data_segment_align_index_
9630 field.
9631 * script-sections.cc (class Orphan_section_placement): New class.
9632 (class Sections_element): Add virtual functions is_relro and
9633 orphan_section_init. Remove virtual function place_orphan_here.
9634 (class Output_section_definition): Add is_relro and
9635 orphan_section_init. Remove place_orphan_here.
9636 (class Orphan_output_section): Likewise.
9637 (Script_sections::Script_sections): Update for field changes.
9638 (Script_sections::data_segment_align): Set saw_data_segment_align_
9639 and data_segment_align_start_, not data_segment_align_index.
9640 (Script_sections::data_segment_relro_end): Check
9641 saw_data_segment_align_. Use data_segment_align_start_ rather
9642 than data_segment_align_index_.
9643 (Script_sections::place_orphan): Rewrite to use
9644 Orphan_section_placement.
9645
9201d894
ILT
96462009-03-17 Ian Lance Taylor <iant@google.com>
9647
9c5b8369
ILT
9648 * archive.cc (Archive::add_symbols): Check for a version attached
9649 to the symbol name in the archive map.
9650 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9651 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9652 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9653 (ver_test_11.a): New target.
9654 * testsuite/Makefile.in: Rebuild.
9655
9201d894
ILT
9656 * configure.ac: Check for chsize and posix_fallocate. Replace
9657 ftruncate.
9658 * ftruncate.c: New file, from gnulib.
9659 * output.cc (posix_fallocate): Define dummy version if not
9660 HAVE_POSIX_FALLOCATE.
9661 (Output_file::map): Call posix_fallocate rather than lseek and
9662 write.
9663 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9664 * configure, Makefile.in, config.in: Rebuild.
9665
ef4ab7a8 96662009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 9667
ef4ab7a8
PP
9668 * layout.h (Layout::create_note): Add section_name parameter.
9669 * layout.cc (Layout::create_note): Likewise.
9670 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 9671
8c500701
ILT
96722009-03-17 Ian Lance Taylor <iant@google.com>
9673
e85b18e1
ILT
9674 * descriptors.cc: Include "options.h".
9675 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9676 (Descriptors::open): Always use O_CLOEXEC when opening a new
9677 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9678 then set FD_CLOEXEC.
9679
9efe6174
ILT
9680 * sparc.cc (class Target_sparc): Add has_got_section.
9681 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9682 make sure we have a GOT section.
9683
9684 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9685 (Target_sparc::Scan::local): Likewise.
9686 (Target_sparc::Scan::global): Likewise.
9687 (Target_sparc::Relocate::relocate): Likewise.
9688 (Target_sparc::Relocate::relocate_tls): Likewise.
9689
8c500701
ILT
9690 * symtab.cc (Symbol_table::define_default_version): New function,
9691 broken out of add_from_object.
9692 (Symbol_table::add_from_object): Call define_default_version.
9693 (Symbol_table::define_special_symbol): Add resolve_oldsym
9694 parameter. Change all callers. If the version for a symbol comes
9695 from a version script, resolve it with the symbol with the same
9696 name with no version. Also add the symbol without a version if
9697 appropriate.
9698 (do_define_in_output_data): If resolving with oldsym, don't delete
9699 sym.
9700 (do_define_in_output_segment): Likewise.
9701 (do_define_as_constant): Likewise.
9702 * symtab.h (class Symbol_table): Update declarations.
9703
f1ed28fb
ILT
97042009-03-13 Ian Lance Taylor <iant@google.com>
9705
15f8229b
ILT
9706 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9707 (Read_symbols::requeue): New function.
9708 (Read_symbols::do_read_symbols): If make_elf_object fails because
9709 the target type is not configured, and the file was searched for,
9710 issue a warning and retry with the next directory.
9711 (Add_symbols::run): If the file has an incompatible format, and
9712 it was searched for, requeue the Read_symbols task. On error,
9713 release the object.
9714 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9715 dirindex parameter to constructor. Change all callers. Declare
9716 incompatible_warning and requeue.
9717 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9718 input_argument_ and input_group_ fields. Add them to
9719 constructor. Change all callers.
9720 (class Read_script): Add dirindex_ field. Add it to constructor.
9721 Change all callers.
9722 * archive.cc (Archive::setup): Remove input_objects parameter.
9723 Change all callers.
9724 (Archive::get_file_and_offset): Likewise.
9725 (Archive::read_all_symbols): Likewise.
9726 (Archive::read_symbols): Likewise.
9727 (Archive::get_elf_object_for_member): Remove input_objects
9728 parameter. Add punconfigured parameter. Change all callers.
9729 (Archive::add_symbols): Change return type to bool. Check return
9730 value of include_member.
9731 (Archive::include_all_members): Likewise.
9732 (Archive::include_member): Change return type to bool. Return
9733 false if first included object has incompatible target. Set
9734 included_member_ field.
9735 (Add_archive_symbols::run): If add_symbols returns false, requeue
9736 Read_symbols task.
9737 * archive.h (class Archive): Add included_member_ field.
9738 Initialize it in constructor. Add input_file and searched_for
9739 methods. Update declarations.
9740 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9741 input_argument_ fields. Add them to constructor. Change all
9742 callers.
9743 * script.cc: Include "target-select.h".
9744 (class Parser_closure): Add skip_on_incompatible_target_ and
9745 found_incompatible_target_ fields. Add
9746 skip_on_incompatible_target parameter to constructor. Change all
9747 callers. Add methods skip_on_incompatible_target,
9748 clear_skip_on_incompatible_target, found_incompatible_target, and
9749 set_found_incompatible_target.
9750 (read_input_script): Add dirindex parameter. Change all callers.
9751 If parser finds an incompatible target, requeue Read_symbols
9752 task.
9753 (script_set_symbol): Clear skip_on_incompatible_target in
9754 closure.
9755 (script_add_assertion, script_parse_option): Likewise.
9756 (script_start_sections, script_add_phdr): Likewise.
9757 (script_check_output_format): New function.
9758 * script.h (read_input_script): Update declaration.
9759 * script-c.h (script_check_output_format): Declare.
9760 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9761 (ignore_cmd): Remove OUTPUT_FORMAT.
9762 * fileread.cc (Input_file::Input_file): Add explicit this.
9763 (Input_file::will_search_for): New function.
9764 (Input_file::open): Add pindex parameter. Change all callers.
9765 * fileread.h (class Input_file): Add input_file_argument method.
9766 Declare will_search_for. Update declarations.
9767 * object.cc (make_elf_object): Add punconfigured parameter.
9768 Change all callers.
9769 * object.h (class Object): Make input_file public. Add
9770 searched_for method.
9771 (make_elf_object): Update declaration.
9772 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9773 restart search.
9774 * dirsearch.h (class Dirsearch): Update declaration.
9775 * options.h (class General_options): Add --warn-search-mismatch.
9776 * parameters.cc (Parameters::is_compatible_target): New function.
9777 * parameters.h (class Parameters): Declare is_compatible_target.
9778 * workqueue.cc (Workqueue::add_blocker): New function.
9779 * workqueue.h (class Workqueue): Declare add_blocker.
9780
f1ed28fb
ILT
9781 * fileread.cc (Input_file::open): Remove options parameter.
9782 Change all callers.
9783 (Input_file::open_binary): Likewise.
9784 * script.cc (read_input_script): Likewise.
9785 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9786 options parameter from constructor. Change all callers.
9787 (class Read_script): Likewise.
9788 * fileread.h (class Input_file): Update declarations.
9789 * script.h (read_input_script): Update declaration.
9790
34dd024a
NC
97912009-03-10 Nick Clifton <nickc@redhat.com>
9792
9793 * po/es.po: New Spanish translation.
9794
6d71b17c
CC
97952009-03-06 Cary Coutant <ccoutant@google.com>
9796
9797 * options.cc (parse_short_option): Keep dash_z from registering itself.
9798
031cdbed
ILT
97992009-03-03 Ian Lance Taylor <iant@google.com>
9800
9801 PR 9918
9802 * target-reloc.h (relocate_section): Pass output_section to
9803 relocate.
9804 * i386.cc (Target_i386::should_apply_static_reloc): Add
9805 output_section parameter. Change all callers.
9806 (Target_i386::Relocate::relocate): Add output_section parameter.
9807 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9808 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9809 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9810 * testsuite/two_file_shared.sh: New script.
9811 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9812 (check_DATA): Add two_file_shared.dbg.
9813 (two_file_shared.dbg): New target.
9814 * testsuite/Makefile.in: Rebuild.
9815
15d5fa16
ILT
98162009-03-01 Ian Lance Taylor <iant@google.com>
9817
9818 * configure.ac: Check for byteswap.h.
9819 * configure: Rebuild.
9820 * config.in: Rebuild.
9821
8a4c0b0d
ILT
98222009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9823
9824 * layout.cc (Layout::find_or_add_kept_section): New function.
9825 (Layout::add_comdat): Removed.
9826 * layout.h (struct Kept_section): Move out of class Layout.
9827 Remove trailing underscores from field names. Add group_sections
9828 field. Rename group_ field to is_group. Change all uses.
9829 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9830 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9831 comdat_groups_ field.
9832 (Sized_relobj::include_section_group): Use
9833 find_or_add_kept_section and Kept_section::group_sections.
9834 (Sized_relobj::include_linkonce_section): Likewise.
9835 * object.cc (class Sized_relobj): Don't define Comdat_group or
9836 Comdat_group_table. Remove find_comdat_group and
9837 add_comdat_group. Remove comdat_groups_ field.
9838 * plugin.cc (include_comdat_group): Use
9839 Layout::find_or_add_kept_section.
9840
b4ecf66b
ILT
98412009-02-28 Ian Lance Taylor <iant@google.com>
9842
14359ca0
ILT
9843 * README: --gc-sections and map files are now supported. Document
9844 some build requirements.
9845
b4ecf66b
ILT
9846 PR 6992
9847 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9848 relocatable link set the value of the section symbol to zero.
9849 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9850 relocatable link don't include the section address in the local
9851 symbol value.
9852
0602e05a
ILT
98532009-02-27 Ian Lance Taylor <iant@google.com>
9854
fd9d194f
ILT
9855 PR 6811
9856 * options.h (class Search_directory): Add is_system_directory.
9857 (class General_options): Declare is_in_system_directory.
9858 * options.cc (get_relative_sysroot): Make static.
9859 (get_default_sysroot): Make static.
9860 (General_optoins::is_in_system_directory): New function.
9861 * fileread.cc (Input_file::is_in_system_directory): New function.
9862 * fileread.h (class Input_file): Declare is_in_system_directory.
9863 * object.h (class Object): Add is_in_system_directory.
9864 (class Input_objects): Remove system_library_directory_ field.
9865 * object.cc (Input_objects::add_object): Don't set
9866 system_library_directory_.
9867 (input_objects::found_in_system_library_directory): Remove.
9868 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9869 parameter. Change all callers.
9870 (Symbol_table::sized_write_globals): Likewise.
9871 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9872 Call Object::is_in_system_directory.
9873 * symtab.h (class Symbol_table): Update declarations.
9874
61edd21f
ILT
9875 PR 5990
9876 * descriptors.h (Open_descriptor): Add is_on_stack field.
9877 * descriptors.cc (Descriptors::open): If the descriptor is on the
9878 top of the stack, remove it. Initialize is_on_stack field.
9879 (Descriptors::release): Only add pod to stack if it is not on the
9880 stack already.
9881 (Descriptors::close_some_descriptor): Clear stack_next and
9882 is_on_stack fields.
9883
e29e076a
ILT
9884 PR 7091
9885 * output.cc (Output_section::find_starting_output_address): Rename
9886 from starting_output_address; add PADDR parameter; change return
9887 type.
9888 * output.h (class Output_section): Declare
9889 find_starting_output_address instead of starting_output_address.
9890 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9891 section symbol for which we can't find a merge section.
9892
0602e05a
ILT
9893 PR 9836
9894 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9895 hidden or internal, force the symbol to be local.
9896 * resolve.cc (Symbol::override_visibility): Define.
9897 (Symbol::override_base): Use override_visibility.
9898 (Symbol_table::resolve): Likewise.
9899 (Symbol::override_base_with_special): Likewise.
9900 (Symbol_table::override_with_special): If the visibility is hidden
9901 or internal, force the symbol to be local.
9902 * symtab.h (class Symbol): Add set_visibility and
9903 override_visibility.
9904 * testsuite/ver_test_1.sh: New file.
9905 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9906 (check_DATA): Add ver_test_1.syms.
9907 (ver_test_1.syms): New target.
9908 * testsuite/Makefile.in: Rebuild.
9909
401a9a73
CC
99102009-02-25 Cary Coutant <ccoutant@google.com>
9911
9912 * layout.cc (Layout::choose_output_section): Don't rename sections
9913 when using a linker script that has a SECTIONS clause.
9914 * Makefile.in: Regenerate.
9915
9916 * testsuite/Makefile.am (script_test_5.sh): New test case.
9917 * testsuite/Makefile.in: Regenerate.
9918 * testsuite/script_test_5.cc: New file.
9919 * testsuite/script_test_5.sh: New file.
9920 * testsuite/script_test_5.t: New file.
9921
f488e4b0
CC
99222009-02-13 Rafael Avila de Espindola <espindola@google.com>
9923
9924 * archive.cc (Archive::include_member): Update calls to add_symbols.
9925 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9926 the Layout argument.
9927 * dynobj.h (do_add_symbols): Add the Layout argument.
9928 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9929 Layout argument.
9930 * object.h (Object::add_symbols): Add the Layout argument.
9931 (Object::do_add_symbols): Add the Layout argument.
9932 (Sized_relobj::do_add_symbols): Add the Layout argument.
9933 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9934 Unify the two versions.
9935 (Add_plugin_symbols): Remove.
9936 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9937 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9938 (Add_plugin_symbols): Remove.
9939 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9940 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9941 (Add_symbols::run): Make it work with Pulginobj.
9942
89dd1680
ILT
99432009-02-06 Ian Lance Taylor <iant@google.com>
9944
9945 * object.cc (Sized_relobj::do_layout): Make info message start
9946 with lower case letter.
9947
266d0a74
ILT
99482009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9949
602b464e
ILT
9950 * binary.cc: Fix file comment.
9951
266d0a74
ILT
9952 * options.h (enum Incremental_disposition): Define.
9953 (class General_options): Add new options: --incremental,
9954 --incremental_changed, --incremental_unchanged,
9955 --incremental_unknown. Add incremental_disposition_ and
9956 implicit_incremental_ fields.
9957 (General_options::incremental_disposition): New function.
9958 (class Position_dependent_options): Add incremental_disposition
9959 option.
9960 (Position_dependent_options::copy_from_options): Set incremental
9961 dispositions.
9962 * options.cc (General_options::parse_incremental_changed): New
9963 function.
9964 (General_options::parse_incremental_unchanged): New function.
9965 (General_options::parse_incremental_unknown): New function.
9966 (General_options::General_options): Initialize new fields
9967 incremental_disposition_ and implicit_incremental_.
9968 (General_options::finalize): Check for uasge of --incremental-*
9969 without --incremental.
9970
f073bbf7
CD
99712009-02-06 Chris Demetriou <cgd@google.com>
9972
9973 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9974 pointer and to report location as the file name associated with
9975 the symbol.
9976 (gold_undefined_symbol_at_location): New function to replace the
9977 old gold_undefined_symbol functionality.
9978 * target-reloc.h (relocate_section): Update to use
9979 gold_undefined_symbol_at_location.
9980 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9981 Call gold_undefined_symbol function rather than gold_error.
9982 * errors.h (Errors::undefined_symbol): Take location as a
9983 string, rather than calculating it from a relocation.
9984 * errors.cc (Errors::fatal): Print "fatal error:" before the
9985 formatted message.
9986 (Errors::error, Errors::error_at_location): Print "error: "
9987 before the formatted message.
9988 (Errors::undefined_symbol): Take location as a string, rather
9989 than calculating it from a relocation.
9990 (gold_undefined_symbol_at_location): New function akin to
9991 old gold_undefined_symbol, calculates location from relocation.
9992 (gold_undefined_symbol): Change to take only a Symbol pointer
9993 and to report location as the file name associated with the symbol.
9994 * testsuite/debug_msg.sh: Update for changed error messages.
9995 * testsuite/undef_symbol.sh: Likewise.
9996
8e94a90c
ILT
99972009-02-04 Duncan Sands <baldrick@free.fr>
9998
9999 PR 9812
10000 * reduced_debug_output.h
10001 (Output_reduced_debug_abbrev_section::failed): Use format for
10002 gold_warning.
10003 (Output_reduced_debug_info_section::faild): Likewise.
10004
88a0e15b
ILT
100052009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10006
10007 * script.cc (Lazy_demangler): New class.
10008 (Version_script_info::get_symbol_version_helper): Demangle a
10009 symbol only once.
10010
5efc7cd2
CC
100112009-01-29 Cary Coutant <ccoutant@google.com>
10012
10013 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10014 to __tls_get_addr.
10015 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10016
e0ebcf42
ILT
100172009-01-28 Ian Lance Taylor <iant@google.com>
10018
5efc7cd2 10019 * version.cc (version_string): Bump to 1.9.
75fe7426 10020
e0ebcf42
ILT
10021 * gold.h: Include <cstring> and <stdint.h>.
10022 * version.cc: Include <cstdio>.
10023 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10024 warning.
10025 * reduced_debug_output.cc (insert_into_vector): Rename from
10026 Insert_into_vector; change all callers. Use Swap_unaligned to
10027 avoid aliasing issue; remove union since it is unnecessary.
10028
8e2813be 100292009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
10030
10031 * Makefile.am (CCFILES): Add gc.cc.
10032 (HFILES): Add gc.h.
10033 * Makefile.in: Regenerate.
10034 * gold.cc (Gc_runner): New class.
10035 (queue_initial_tasks): Call garbage collection related tasks
10036 when corresponding options are invoked.
10037 (queue_middle_gc_tasks): New function.
10038 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10039 processed early before laying out sections during garbage collection.
10040 * gold.h (queue_middle_gc_tasks): New function.
10041 (is_prefix_of): Move from "layout.cc".
10042 * i386.cc (Target_i386::gc_process_relocs): New function.
10043 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10044 * main.cc (main): Create object of class "Garbage_collection".
10045 * object.cc (Relobj::copy_symbols_data): New function.
10046 (Relobj::is_section_name_included): New function.
e1df38aa
NC
10047 (Sized_relobj::do_layout): Allow this function to be called twice
10048 during garbage collection and defer layout of section during the
6d03d481
ST
10049 first call.
10050 * object.h (Relobj::get_symbols_data): New function.
10051 (Relobj::is_section_name_included): New function.
10052 (Relobj::copy_symbols_data): New function.
10053 (Relobj::set_symbols_data): New function.
10054 (Relobj::get_relocs_data): New function.
10055 (Relobj::set_relocs_data): New function.
10056 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10057 (Relobj::gc_process_relocs): New function.
10058 (Relobj::do_gc_process_relocs): New pure virtual function.
10059 (Relobj::sd_): New data member.
10060 (Sized_relobj::is_output_section_offset_invalid): New function.
10061 (Sized_relobj::do_gc_process_relocs): New function.
10062 * options.h (General_options::gc_sections): Modify to not be a no-op.
10063 (General_options::print_gc_sections): New option.
10064 * plugin.cc (Plugin_finish::run): Remove function call to
10065 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10066 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10067 * reloc.cc (Read_relocs::run): Add task to process relocs and
10068 determine unreferenced sections when doing garbage collection.
10069 (Gc_process_relocs): New class.
10070 (Sized_relobj::do_gc_process_relocs): New function.
10071 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10072 sections that are garbage collected.
10073 * reloc.h (Gc_process_relocs): New class.
10074 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10075 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10076 symbols whose corresponding sections are garbage collected.
10077 (Symbol_table::Symbol_table): Add new parameter for the garbage
10078 collection object.
10079 (Symbol_table::gc_mark_undef_symbols): New function.
10080 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10081 (Symbol_table::gc_mark_dyn_syms): New function.
10082 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10083 as garbage.
10084 (Symbol_table::add_from_object): Likewise.
10085 (Symbol_table::add_from_relobj): When building shared objects, do not
10086 treat externally visible symbols as garbage.
10087 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10088 table information for static and relocatable links.
10089 * symtab.h (Symbol_table::set_gc): New function.
10090 (Symbol_table::gc): New function.
10091 (Symbol_table::gc_mark_undef_symbols): New function.
10092 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10093 (Symbol_table::gc_mark_dyn_syms): New function.
10094 (Symbol_table::gc_): New data member.
e1df38aa 10095 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
10096 function.
10097 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10098 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10099
3b293544
CF
101002009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10101
10102 * options.h (General_options::gc_sections): Define as a no-op for now.
10103 (General_options::no_keep_memory): Ditto.
10104 (General_options::Bshareable): Define.
10105 * options.cc (General_options::finalize): Honor -Bshareable.
10106
83d22aa8
AS
101072009-01-20 Andreas Schwab <schwab@suse.de>
10108
10109 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10110 read the value in the contents, since we don't use it. Use the
10111 template endianness when writing.
10112 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10113
cd536b21
AS
101142009-01-19 Andreas Schwab <schwab@suse.de>
10115
10116 * configure.tgt (powerpc64-*): Fix targ_obj.
10117
99e9a495
ILT
101182009-01-15 Ian Lance Taylor <iant@google.com>
10119
10120 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10121 local symbols when stripping all symbols.
10122
bbbfea06
CC
101232009-01-14 Cary Coutant <ccoutant@google.com>
10124
99e9a495 10125 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 10126
0f7c0701
CC
101272009-01-14 Cary Coutant <ccoutant@google.com>
10128
10129 * archive.cc (Archive::get_elf_object_for_member): Remove call
10130 to File_read::claim_for_plugin.
10131 * descriptors.cc (Descriptors::open): Remove reference to
10132 is_claimed.
10133 (Descriptors::claim_for_plugin): Remove.
10134 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10135 (Descriptors::is_claimed): Remove.
10136 (claim_descriptor_for_plugin): Remove.
10137 * fileread.cc (File_read::claim_for_plugin): Remove.
10138 * fileread.h (File_read::claim_for_plugin): Remove.
10139 (File_read::descriptor): Reopen descriptor if necessary.
10140 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10141 (Plugin_manager::all_symbols_read): Add task parameter. Change
10142 all callers.
10143 (Plugin_manager::get_input_file): New function.
10144 (Plugin_manager::release_input_file): New function.
10145 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10146 corresponding data member.
10147 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10148 and pass to base constructor. Change all callers.
10149 (get_input_file, release_input_file): New functions.
10150 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10151 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10152 (Plugin_manager::all_symbols_read): Add task parameter.
10153 (Plugin_manager::get_input_file): New function.
10154 (Plugin_manager::release_input_file): New function.
10155 (Plugin_manager::task_): New data member.
10156 (Pluginobj::Pluginobj): Add filesize parameter.
10157 (Pluginobj::filename): New function.
10158 (Pluginobj::descriptor): New function.
10159 (Pluginobj::filesize): New function.
10160 (Pluginobj::filesize_): New data member.
10161 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10162 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10163 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10164
10165 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10166 with archive libraries.
10167 * testsuite/Makefile.in: Regenerate.
10168 * testsuite/plugin_test.c (struct sym_info): New type.
10169 (get_input_file, release_input_file): New static variables.
10170 (onload): Capture new transfer vector entries.
10171 (claim_file_hook): Stop reading at end of file according to filesize.
10172 Factor out parsing of readelf output into separate function.
10173 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10174 APIs and get the source file name from the symbol table. Convert
10175 source file name to corresponding object file name. Print info
10176 message when adding new input files.
10177 (parse_readelf_line): New function.
10178 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10179 * testsuite/plugin_test_2.sh: Likewise.
10180 * testsuite/plugin_test_3.sh: Likewise.
10181 * testsuite/plugin_test_4.sh: New test case.
10182
62a6d109
ILT
101832009-01-07 Ian Lance Taylor <iant@google.com>
10184
10185 * version.cc (version_string): Bump to 1.8.
10186
483620e8
CC
101872008-12-23 Cary Coutant <ccoutant@google.com>
10188
10189 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10190 * plugin.cc (Plugin_manager::finish): Rename as
10191 layout_deferred_objects. Move cleanup to separate function.
10192 (Plugin_manager::cleanup): New function.
10193 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10194 separately.
10195 * plugin.h (Plugin_manager::finish): Rename as
10196 layout_deferred_objects.
10197 (Plugin_manager::cleanup): New function.
10198 (Plugin_manager::cleanup_done): New field.
10199
d66a9eb3
CC
102002008-12-23 Cary Coutant <ccoutant@google.com>
10201
10202 * plugin.cc (is_visible_from_outside): New function.
10203 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10204 so we don't return "IR only" status for exported symbols or -r links.
10205
10206 * testsuite/Makefile.am (plugin_test_3): New test case.
10207 * testsuite/Makefile.in: Regenerate.
10208 * testsuite/plugin_test_3.sh: New file.
10209
5995b570
CC
102102008-12-22 Cary Coutant <ccoutant@google.com>
10211
10212 * object.cc (Sized_relobj::layout_section): New function.
10213 (Sized_relobj::do_layout): Defer layout of input sections until after
10214 plugin has provided replacement files.
10215 (Sized_relobj::do_layout_deferred_sections): New function.
10216 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10217 (Relobj::layout_deferred_sections): New function.
10218 (Relobj::do_layout_deferred_sections): New function.
10219 (Sized_relobj::do_layout_deferred_sections): New function.
10220 (Sized_relobj::layout_section): New function.
10221 (Sized_relobj::Deferred_layout): New structure.
10222 (Sized_relobj::deferred_layout_): New field.
10223 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10224 Change all callers. Layout deferred sections.
10225 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10226 references.
10227 (Plugin_hook::run): Move code from do_plugin_hook inline.
10228 (Plugin_hook::do_plugin_hook): Remove.
10229 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10230 (Plugin_manager::finish): Renamed, was cleanup.
10231 (Plugin_manager::should_defer_layout): New function.
10232 (Plugin_manager::add_deferred_layout_object): New function.
10233 (Plugin_manager::Deferred_layout_list): New type.
10234 (Plugin_manager::deferred_layout_objects_): New field.
10235 (Plugin_hook::do_plugin_hook): Remove.
10236
ee769c88
ILT
102372008-12-17 Ian Lance Taylor <iant@google.com>
10238
10239 * options.h (class General_options): Add --no case for
10240 --export-dynamic.
10241
abc8dcba
CC
102422008-12-16 Cary Coutant <ccoutant@google.com>
10243
10244 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10245 vector.
10246 (Plugin_manager::claim_file): Create plugin object even if
10247 plugin did not call the add_symbols callback.
10248 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10249 asking for more symbols than were added.
10250 * testsuite/Makefile.am (plugin_test_1): Add test case with
10251 no global symbols.
10252 (empty.syms): New target.
10253 * testsuite/Makefile.in: Regenerate.
10254 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10255 message. Don't call add_symbols if no globals.
10256 (all_symbols_read_hook): Don't provide replacement for empty
10257 claimed file.
10258
b0074644
ILT
102592008-12-12 Ian Lance Taylor <iant@google.com>
10260
68943102
ILT
10261 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10262 r_type == 0 for a local symbol with r_sym == 0.
10263 (scan_relocatable_relocs): Pass r_sym to
10264 local_non_section_strategy.
10265 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10266 r_sym parameter.
10267
b0074644
ILT
10268 * configure.ac: Update test for TLS descriptors: they are
10269 supported as of glibc 2.9.
10270 * configure: Rebuild.
10271
c2508178
ILT
102722008-12-11 Ian Lance Taylor <iant@google.com>
10273
10274 PR 7091
10275 * target-reloc.h (Default_scan_relocatable_relocs): For each
10276 function, map r_type == 0 to RELOC_DISCARD.
10277
2756a258
CC
102782008-12-10 Cary Coutant <ccoutant@google.com>
10279
10280 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10281 object to override a kept COMDAT group from a plugin object.
10282
bb6f53d3
ILT
102832008-12-09 Ian Lance Taylor <iant@google.com>
10284
fbc558e1
ILT
10285 PR 7088
10286 * yyscript.y (file_cmd): Handle INPUT.
10287
bb6f53d3
ILT
10288 * testsuite/initpri1.c: Change all declarations to be full
10289 prototypes by adding void, to avoid compiler warnings.
10290
4674ecfc
CC
102912008-12-05 Rafael Avila de Espindola <espindola@google.com>
10292
10293 * options.cc (General_options::parse_plugin_opt): New.
10294 (General_options::add_plugin): The argument now is just the filename.
10295 (General_options::add_plugin_option): New.
10296 * options.h (plugin_opt): New.
10297 (add_plugin): Change argument name.
10298 (add_plugin_option): New.
10299 * plugin.cc (Plugin::load): Don't parse the plugin option.
10300 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10301 (Plugin::add_option): New.
10302 (Plugin::args_): Change type.
10303 (Plugin::filename_): New.
10304 (Plugin_manager::add_plugin_option): New.
10305 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10306 * testsuite/Makefile.in: Regenerate.
10307
fd06b4aa
CC
103082008-12-05 Cary Coutant <ccoutant@google.com>
10309
10310 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10311 Handle --strip-lto-sections option.
10312 * options.h (strip_lto_sections): New option.
10313
6c52134c
CC
103142008-12-01 Cary Coutant <ccoutant@google.com>
10315
10316 * plugin.cc (ld_plugin_message): Change format parameter to const.
10317 Fix mismatch between new[] and delete.
10318
a45248e0
CC
103192008-11-14 Cary Coutant <ccoutant@google.com>
10320
10321 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10322 instead of -1U.
10323
c82fbeee
CS
103242008-11-05 Craig Silverstein <csilvers@google.com>
10325
10326 * options.cc (General_options::parse_dynamic_list): New function.
10327 * options.h (General_options): New flags dynamic_list,
10328 dynamic_list_data, dynamic_list_cpp_new, and
10329 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10330 (General_options::in_dynamic_list): New function.
10331 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10332 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10333 (Lex::can_continue_name): Likewise.
10334 (yylex): Likewise.
10335 (read_script_file): New parameter script_options.
10336 (read_dynamic_list): New function.
10337 (Script_options::define_dynamic_list): New function.
10338 (dynamic_list_keyword_parsecodes): New variable.
10339 (dynamic_list_keywords): New variable.
10340 * script.h (Script_options::define_dynamic_list): New function
10341 prototype.
10342 (read_dynamic_list): New function prototype.
10343 * symtab.cc (strprefix): New macro.
10344 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10345 dynamic_list_data, dynamic_list_cpp_new, and
10346 dynamic_list_cpp_typeinfo.
10347 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10348 (dynamic_list_expr): New rule.
10349 (dynamic_list_nodes): Likewise.
10350 (dynamic_list_node): Likewise.
10351 * testsuite/Makefile.am (dynamic_list): New test.
10352 * testsuite/Makefile.in: Regenerated.
10353 * testsuite/dynamic_list.t: New file.
10354 * testsuite/dynamic_list.sh: New file.
10355
e0bb29a5
CS
103562008-11-05 Craig Silverstein <csilvers@google.com>
10357
10358 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10359 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10360 (t11_last): Likewise.
10361 * testsuite/ver_test_6.c (main): Likewise.
10362
4e1e25e0
CC
103632008-10-07 Cary Coutant <ccoutant@google.com>
10364
10365 * options.c (General_options::finalize): Add check for -static and
10366 -shared.
10367 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10368 is not empty.
10369
92f03fcb
CC
103702008-10-02 Cary Coutant <ccoutant@google.com>
10371
10372 * plugin.cc (make_sized_plugin_object): Fix conditional
10373 compilation to work when not all targets are enabled.
10374
fbd8a257
CC
103752008-09-29 Cary Coutant <ccoutant@google.com>
10376
10377 * archive.cc (Archive::get_file_and_offset): Use filename instead
10378 of name to get library path.
10379 (Archive::include_member): Unlock external member of a thin archive.
10380
10381 * testsuite/Makefile.am (TEST_AR): New variable.
10382 (thin_archive_test_1): New test.
10383 (thin_archive_test_2): New test.
81636b3f
CC
10384 * testsuite/Makefile.in: Regenerate.
10385 * testsuite/thin_archive_main.cc: New file.
10386 * testsuite/thin_archive_test_1.cc: New file.
10387 * testsuite/thin_archive_test_2.cc: New file.
10388 * testsuite/thin_archive_test_3.cc: New file.
10389 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 10390
eff45813
CC
103912008-09-29 Cary Coutant <ccoutant@google.com>
10392
10393 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10394 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10395 instead of -1U.
10396 (Sized_relobj::do_finalize_local_symbols): Likewise.
10397 (Sized_relobj::map_to_kept_section): Likewise.
10398 * object.h (Sized_relobj::invalid_address): New constant.
10399 (Sized_relobj::do_output_section_offset): Check for invalid_address
10400 and return -1ULL.
10401 * output.cc (Output_reloc::local_section_offset): Use constant
10402 invalid_address instead of -1U.
10403 (Output_reloc::get_address): Likewise.
10404 (Output_section::output_address): Change -1U to -1ULL.
10405 * output.h (Output_reloc::invalid_address): New constant.
10406 * reloc.cc (Sized_relobj::write_sections): Use constant
10407 invalid_address instead of -1U.
10408 (Sized_relobj::relocate_sections): Likewise.
10409 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10410 values for merge sections.
10411 * target-reloc.h (relocate_for_relocatable): Use constant
10412 invalid_address instead of -1U.
10413
89fc3421
CC
104142008-09-19 Cary Coutant <ccoutant@google.com>
10415
10416 Add plugin functionality for link-time optimization (LTO).
10417 * configure.ac (plugins): Add --enable-plugins option.
10418 * configure: Regenerate.
10419 * config.in: Regenerate.
10420 * Makefile.am (LIBDL): New variable.
10421 (CCFILES): Add plugin.cc.
10422 (HFILES): Add plugin.h.
10423 (ldadd_var): Add LIBDL.
10424 * Makefile.in: Regenerate.
10425
10426 * archive.cc: Include "plugin.h".
10427 (Archive::setup): Don't preread archive symbols when using a plugin.
10428 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10429 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10430 files.
10431 (Archive::include_member): Add symbols from plugin objects.
10432 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10433 * descriptors.cc (Descriptors::open): Check for file descriptors
10434 abandoned by plugins.
10435 (Descriptors::claim_for_plugin): New function.
10436 * descriptors.h (Descriptors::claim_for_plugin): New function.
10437 (Open_descriptor::is_claimed): New field.
10438 (claim_descriptor_for_plugin): New function.
10439 * fileread.cc (File_read::claim_for_plugin): New function.
10440 * fileread.h (File_read::claim_for_plugin): New function.
10441 (File_read::descriptor): New function.
10442 * gold.cc: Include "plugin.h".
10443 (queue_initial_tasks): Add task to call plugin hooks for generating
10444 new object files.
10445 * main.cc: Include "plugin.h".
10446 (main): Load plugin libraries.
10447 * object.h (Pluginobj): Declare.
10448 (Object::pluginobj): New function.
10449 (Object::do_pluginobj): New function.
10450 (Object::set_target): New function.
10451 * options.cc: Include "plugin.h".
10452 (General_options::parse_plugin): New function.
10453 (General_options::General_options): Initialize plugins_ field.
10454 (General_options::add_plugin): New function.
10455 * options.h (Plugin_manager): Declare.
10456 (General_options): Add --plugin option.
10457 (General_options::has_plugins): New function.
10458 (General_options::plugins): New function.
10459 (General_options::add_plugin): New function.
10460 (General_options::plugins_): New field.
10461 * plugin.cc: New file.
10462 * plugin.h: New file.
10463 * readsyms.cc: Include "plugin.h".
10464 (Read_symbols::do_read_symbols): Check for archive before checking
10465 for ELF file. Call plugin hooks to claim files.
10466 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10467 from a real object file; force override when processing replacement
10468 files.
10469 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10470 (Symbol::init_base_object): Likewise.
10471 (Symbol::init_base_output_data): Likewise.
10472 (Symbol::init_base_output_segment): Likewise.
10473 (Symbol::init_base_constant): Likewise.
10474 (Symbol::init_base_undefined): Likewise.
10475 (Symbol::output_section): Assert that object is not a plugin.
10476 (Symbol_table::add_from_pluginobj): New function.
10477 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10478 undefined.
10479 (Symbol_table::sized_write_globals): Likewise.
10480 (Symbol_table::add_from_pluginobj): Instantiate template.
10481 * symtab.h (Sized_pluginobj): Declare.
10482 (Symbol::in_real_elf): New function.
10483 (Symbol::set_in_real_elf): New function.
10484 (Symbol::in_real_elf_): New field.
10485 (Symbol_table::add_from_pluginobj): New function.
10486
10487 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10488 (LIBDL): New variable.
10489 (LDADD): Add LIBDL.
10490 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10491 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10492 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10493 (MOSTLYCLEANFILES): Likewise.
10494 * testsuite/Makefile.in: Regenerate.
10495 * testsuite/plugin_test.c: New file.
10496 * testsuite/plugin_test_1.sh: New file.
10497 * testsuite/plugin_test_2.sh: New file.
10498
de31bda5
ILT
104992008-09-16 Ian Lance Taylor <iant@google.com>
10500
9c2d0ef9
ILT
10501 * target-reloc.h (relocate_section): Check whether a symbol is
10502 defined by the ABI before reporting an undefined symbol error.
10503 * target.h (Target::is_defined_by_abi): Make parameter const.
10504 (Target::do_is_defined_by_abi): Likewise.
10505 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10506 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10507 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10508 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10509 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10510 * testsuite/Makefile.in: Rebuild.
10511
de31bda5
ILT
10512 * fileread.cc (make_view): Add casts to avoid warning.
10513
9fa33bee
AO
105142008-09-16 Alexandre Oliva <aoliva@redhat.com>
10515
10516 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10517 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10518
183fd0e3
AO
105192008-09-16 Alexandre Oliva <aoliva@redhat.com>
10520
10521 * options.h (General_options::output_is_executable): New.
10522 (General_options::output_is_pie): New.
10523 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10524 for shared libraries.
10525 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10526
7be8330a
CD
105272008-09-11 Chris Demetriou <cgd@google.com>
10528
10529 * options.h (origin): New -z option.
10530 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10531 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10532 in DT_FLAGS_1.
10533
a9caad02
CC
105342008-09-05 Cary Coutant <ccoutant@google.com>
10535
10536 * fileread.cc (File_read::make_view): Add check for attempt to map
10537 beyond end of file.
10538
ae6dce4d
CC
105392008-09-05 Cary Coutant <ccoutant@google.com>
10540
10541 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10542 explicit instantiations.
10543
d7ab2a47
KVH
105442008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10545
10546 PR gold/6858
10547 * options.cc (General_options::finalize): Allow undefined symbols
10548 in shlibs if linking -shared.
10549
10550 PR gold/6859
10551 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10552 symbols as not needing a dynsym entry.
10553
1e52a9c1
CS
105542008-08-20 Craig Silverstein <csilvers@google.com>
10555
10556 * fileread.cc (File_read::open): Do not lock the file unless it
10557 was successfully opened.
10558
d85c80a3
CC
105592008-08-14 Cary Coutant <ccoutant@google.com>
10560
10561 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10562 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10563 * testsuite/tls_test.cc (struct int128): 128-bit struct
10564 for testing TLS relocs with non-zero addend.
10565 (v12): New TLS variable.
10566 (t12): New test.
10567 (t_last): Add check for v12.
10568 * testsuite/tls_test.h (t12): New function.
10569 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10570
2d924fd9
ILT
105712008-08-13 Ian Lance Taylor <iant@google.com>
10572
10573 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10574 set tls_segment_ or relro_segment_.
10575 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10576 when appropriate.
10577 * output.h (Output_section::clear_is_relro): New function.
10578 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10579 sections specially even when output_data_ is empty.
10580 (Output_segment::maximum_alignment): When first section is relro,
10581 only force alignment for PT_LOAD segments.
10582 * script.cc (script_data_segment_align): New function.
10583 (script_data_segment_relro_end): New function.
10584 * script-c.h (script_data_segment_align): Declare.
10585 (script_data_segment_relro_end): Declare.
10586 * script-sections.h (class Script_sections): Declare
10587 data_segment_align and data_segment_relro_end. Add fields
10588 segment_align_index_ and saw_relro_end_.
10589 * script-sections.cc (class Sections_element): Add set_is_relro
10590 virtual function. Add new bool* parameter to place_orphan_here.
10591 Add get_output_section virtual function.
10592 (class Output_section_definition): Add set_is_relro. Add new
10593 bool* parameter to place_orphan_here. Add get_output_section.
10594 Add is_relro_ field.
10595 (Output_section_definition::Output_section_definition): Initialize
10596 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10597 and is_relro_ fields.
10598 (Output_section_definition::place_orphan_here): Add is_relro
10599 parameter.
10600 (Output_section_definition::set_section_addresses): Set relro for
10601 output section.
10602 (Output_section_definition::alternate_constraint): Likewise.
10603 (class Orphan_output_section): Add new bool* parameter to
10604 place_orphan_here. Add get_output_section.
10605 (Orphan_output_section::place_orphan_here): Add is_relro
10606 parameter.
10607 (Script_sections::Script_sections): Initialize
10608 data_segment_align_index_ and saw_relro_end_.
10609 (Script_sections::data_segment_align): New function.
10610 (Script_sections::data_segment_relro_end): New function.
10611 (Script_sections::place_orphan): Set or clear is_relro.
10612 (Script_sections::set_section_addresses): Force alignment of first
10613 TLS section.
10614 * yyscript.y (exp): Call script_data_segment_align and
10615 script_data_segment_relro_end.
10616 * testsuite/relro_script_test.t: New file.
10617 * testsuite/relro_test.cc (using_script): Declare.
10618 (t1, t2): Test using_script.
10619 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10620 (relro_script_test_SOURCES): Define.
10621 (relro_script_test_DEPENDENCIES): Define.
10622 (relro_script_test_LDFLAGS): Define.
10623 (relro_script_test_LDADD): Define.
10624 (relro_script_test.so): New target.
10625 * testsuite/Makefile.in: Rebuild.
10626
f827c9a9
CC
106272008-08-06 Cary Coutant <ccoutant@google.com>
10628
10629 * archive.cc (Archive::total_archives, Archive::total_members)
10630 (Archive::total_members_loaded): New variables.
10631 (Archive::setup): Add parameter. Add option to preread
10632 archive symbols.
10633 (Archive::read_armap): Add counter.
10634 (Archive::get_file_and_offset): New function.
10635 (Archive::get_elf_object_for_member): New function.
10636 (Archive::read_all_symbols): New function.
10637 (Archive::read_symbols): New function.
10638 (Archive::add_symbols): Add counters.
10639 (Archive::include_all_members): Use armap to find members if it's
10640 already built.
10641 (Archive::include_member): Skip reading symbols if already read.
10642 Factored code into Archive::get_file_and_offset and
10643 Archive::get_elf_object_for_member. Changed call to
10644 Mapfile::report_include_archive_member.
10645 (Archive::print_stats): New function.
10646 * archive.h: Declare Object and Read_symbols_data classes.
10647 (Archive::Archive): Add initializers for new members.
10648 (Archive::setup): Add parameter.
10649 (Archive::print_stats): New function.
10650 (Archive::total_archives, Archive::total_members)
10651 (Archive::total_members_loaded): New variables.
10652 (Archive::get_file_and_offset): New function.
10653 (Archive::get_elf_object_for_member): New function.
10654 (Archive::read_all_symbols): New function.
10655 (Archive::read_symbols): New function.
10656 (Archive::Archive_member): New class.
10657 (Archive::members_): New member.
10658 (Archive::num_members_): New member.
10659 * main.cc: Include archive.h.
10660 (main): Call Archive::print_stats.
10661 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10662 archive parameter; member_name is now the fully-decorated name.
10663 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10664 * options.h: (General_options): Add --preread-archive-symbols option.
10665 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10666 Archive::setup.
10667
de4c45bd
ILT
106682008-08-04 Ian Lance Taylor <iant@google.com>
10669
10670 * symtab.h (Symbol::use_plt_offset): New function.
10671 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10672 * powerpc.cc (Relocate::relocate): Likewise.
10673 * sparc.cc (Relocate::relocate): Likewise.
10674 * x86_64.cc (Relocate::relocate): Likewise.
10675 * testsuite/weak_plt.sh: New test.
10676 * testsuite/weak_plt_main.cc: New test.
10677 * testsuite/weak_plt_shared.cc: New test.
10678 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10679 (check_PROGRAMS): Add weak_plt.
10680 (check_DATA): Add weak_plt_shared.so.
10681 (weak_plt_main_pic.o, weak_plt): New targets.
10682 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10683 * testsuite/Makefile.in: Rebuild.
10684
10685 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10686 gcctestdir/ld.
10687 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10688 * testsuite/Makefile.in: Rebuild.
10689
323ee3f4
AM
106902008-08-04 Alan Modra <amodra@bigpond.net.au>
10691
10692 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10693 * Makefile.in: Regenerate.
10694 * po/POTFILES.in: Regenerate.
10695
7c07ecec
ILT
106962008-07-29 Ian Lance Taylor <iant@google.com>
10697
10698 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10699 symbols before other symbols.
10700 * testsuite/script_test_2.cc (test_addr): Declare.
10701 (test_addr_alias): Declare.
10702 (main): Check that test_addr and test_addr_alias have the right
cd536b21 10703 values.
7c07ecec
ILT
10704 * testsuite/script_test_2.t: Define test_addr_alias and
10705 test_addr.
10706
5778530e
ILT
107072008-07-24 Ian Lance Taylor <iant@google.com>
10708
2a00e4fb
ILT
10709 PR 5990
10710 * descriptors.cc: New file.
10711 * descriptors.h: New file.
10712 * gold-threads.h (class Hold_optional_lock): New class.
10713 * fileread.cc: Include "descriptors.h".
10714 (File_read::~File_read): Release descriptor rather than closing
10715 it.
10716 (File_read::open) [file]: Call open_descriptor rather than open.
10717 Set is_descriptor_opened_.
10718 (File_read::open) [memory]: Assert that descriptor is not open.
10719 (File_read::reopen_descriptor): New function.
10720 (File_read::release): Release descriptor.
10721 (File_read::do_read): Make non-const. Reopen descriptor.
10722 (File_read::read): Make non-const.
10723 (File_read::make_view): Reopen descriptor.
10724 (File_read::do_readv): Likewise.
10725 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10726 Update declarations.
10727 * layout.cc: Include "descriptors.h".
10728 (Layout::create_build_id): Use open_descriptor rather than open.
10729 * output.cc: Include "descriptors.h".
10730 (Output_file::open): Use open_descriptor rather than open.
10731 * archive.cc (Archive::const_iterator): Change Archive to be
10732 non-const.
10733 (Archive::begin, Archive::end): Make non-const.
10734 (Archive::count_members): Likewise.
10735 * archive.h (class Archive): Update declarations.
10736 * object.h (Object::read): Make non-const.
10737 * Makefile.am (CCFILES): Add descriptors.cc.
10738 (HFILES): Add descriptors.h.
10739 * Makefile.in: Rebuild.
10740
801647d1
ILT
10741 PR 6716
10742 * gold.h: Always include <clocale>. Add Solaris workarounds
10743 following code in binutils/sysdep.h.
10744
5edd166e
ILT
10745 PR 6048
10746 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10747 this->eh_frame_hdr_ is NULL before using it.
10748
c89ad728
ILT
10749 * dynobj.cc (Versions::Versions): Update comment.
10750
aa86f06b
ILT
10751 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10752 the base version name.
10753
5778530e
ILT
10754 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10755 array size plus one.
10756 (Stringpool_template::set_string_offsets): Subtract one from key
10757 before using it as an array index.
10758 (Stringpool_template::get_offset_with_length): Likewise.
10759 (Stringpool_template::write_to_buffer): Likewise.
10760 * stringpool.h (Stringpool_template::get_offset_from_key):
10761 Likewise.
10762
057ead22
ILT
107632008-07-23 Ian Lance Taylor <iant@google.com>
10764
7f649c59
ILT
10765 PR 6658
10766 * object.h (Merged_symbol_value::value): Do our best to handle a
10767 negative addend.
10768
057ead22
ILT
10769 PR 6647
10770 * script.cc (Version_script_info::get_versions): Don't add empty
10771 version tag to return value.
10772 (Version_script_info::get_symbol_version_helper): Change return
10773 type to bool. Add pversion parameter. Change all callers.
10774 (script_register_vers_node): Don't require a non-NULL tag.
10775 * script.h (class Version_script_info): Update declarations.
10776 (Version_script_info::get_symbol_version): Change return type to
10777 bool. Add version parameter. Change all callers.
10778 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10779 handling. Handle an empty version from a version script.
10780 (Symbol_table::define_special_symbol): Likewise.
10781 * testsuite/ver_test_10.script: New file.
10782 * testsuite/ver_test_10.sh: New file.
10783 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10784 (check_DATA): Add ver_test_10.syms.
10785 (ver_test_10.syms, ver_test_10.so): New target.
10786 * testsuite/Makefile.in: Rebuild.
10787
58e54ac2
CD
107882008-07-23 Simon Baldwin <simonb@google.com>
10789
10790 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10791 to zero for undefined symbols from dynamic libraries.
10792
95d14cd3
ILT
107932008-07-23 Ian Lance Taylor <iant@google.com>
10794
10795 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10796 Change all callers.
10797 * symtab.h (class Symbol_table): Update declaration.
10798 * testsuite/ver_test_9.cc: New file.
10799 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10800 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10801 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10802 (ver_test_9.so, ver_test_9.o): New targets.
10803 * testsuite/Makefile.in: Rebuild.
10804
92de84a6
ILT
108052008-07-22 Ian Lance Taylor <iant@google.com>
10806
34810851
ILT
10807 * options.h (class General_options): Define --check-sections.
10808 * layout.cc (Layout::set_segment_offsets): Handle
10809 --check-sections.
10810
af6156ef
ILT
10811 * options.h (class General_options): Define -n/--nmagic and
10812 -N/--omagic.
10813 * options.cc (General_options::finalize): For -n/--nmagic or
10814 -N/--omagic, set -static.
10815 * layout.cc (Layout::attach_allocated_section_to_segment): If
10816 -N/--omagic, don't put read-only and read-write sections in
10817 different segments.
10818 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10819 finding a read-only segment.
10820 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10821 don't set the minimum segment alignment to the common page size,
10822 and don't set the file offset to the address modulo the page size.
10823 * script-sections.cc (Script_sections::create_segments): If
10824 -n/--omagic, don't put read-only and read-write sections in
10825 different segments.
10826
92de84a6
ILT
10827 * cref.cc: New file.
10828 * cref.h: New file.
10829 * options.h (class General_options): Add --print-symbol-counts.
10830 * main.cc (main): Issue defined symbol report if requested.
10831 * archive.cc (Archive::interpret_header): Make into a const member
10832 function.
10833 (Archive::add_symbols): Call Input_objects::archive_start and
10834 archive_stop.
10835 (Archive::const_iterator): Define new class.
10836 (Archive::begin, Archive::end): New functions.
10837 (Archive::include_all_members): Rewrite to use iterator.
10838 (Archive::count_members): New function.
10839 * archive.h (class Archive): Update declarations.
10840 (Archive::filename): New function.
10841 * object.cc: Include "cref.h".
10842 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10843 (Sized_relobj::do_get_global_symbol_counts): New function.
10844 (Input_objects::add_object): Add object to cross-referencer.
10845 (Input_objects::archive_start): New function.
10846 (Input_objects::archive_stop): New function.
10847 (Input_objects::print_symbol_counts): New function.
10848 * object.h: Declare Cref and Archive.
10849 (Object::get_global_symbol_counts): New function.
10850 (Object::do_get_global_symbol_counts): New pure virtual function.
10851 (class Sized_relobj): Add defined_count_ field. Update
10852 declarations.
10853 (class Input_objects): Add cref_ field. Update constructor.
10854 Update declarations.
10855 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10856 defined_count_.
10857 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10858 symbol counts.
10859 (Sized_dynobj::do_get_global_symbol_counts): New function.
10860 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10861 defined_count_. Update declarations. Define Symbols typedef.
10862 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10863 parameter. Change all callers.
10864 (Symbol_table::add_from_dynobj): Add sympointers and defined
10865 parameters. Change all callers.
10866 * symtab.h (class Symbol_table): Update declarations.
10867 * Makefile.am (CCFILES): Add cref.cc.
10868 (HFILES): Add cref.h.
10869 * Makefile.in: Rebuild.
10870
3f7c5e1d
CD
108712008-07-22 Simon Baldwin <simonb@google.com>
10872
10873 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10874 to zero when writing undefined symbols.
10875
e0b64032
ILT
108762008-07-22 Ian Lance Taylor <iant@google.com>
10877
10878 * output.cc (Output_section::add_input_section): Don't try to
10879 merge empty merge sections.
10880
096b02cf
CS
108812008-07-21 Craig Silverstein <csilvers@google.com>
10882
10883 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10884 Include symbol version in error message.
cd536b21 10885
1d1f116d
CD
108862008-07-20 Chris Demetriou <cgd@google.com>
10887
cd536b21 10888 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
10889 (RANDOM_SEED_CFLAGS): New substituted variable.
10890 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10891 * configure: Rebuild.
10892 * Makefile.in: Likewise.
10893 * testsuite/Makefile.in: Likewise.
10894
a18f591e
ILT
108952008-07-18 Ian Lance Taylor <iant@google.com>
10896
10897 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10898 where we see NAME/NULL and NAME/VERSION as separate symbols.
10899 * testsuite/ver_test_main.cc (main): Call t4.
10900 (t4, t4_2a): Define.
10901 * testsuite/ver_test_2.cc (t4_2): Define.
10902 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10903 * testsuite/ver_test_4.cc (t4_2a): Define.
10904 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10905 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10906
c6e3f6ed
ILT
109072008-07-17 Ian Lance Taylor <iant@google.com>
10908
10909 * dynobj.cc (Versions::add_def): If we give an error about a
10910 missing version, go ahead and create the version anyhow.
10911
ef9beddf
ILT
109122008-07-10 Ian Lance Taylor <iant@google.com>
10913
10914 Handle output sections with more than 0x7fffffff bytes.
10915 * object.h (class Relobj): Change map_to_output_ to
10916 output_sections_, and just keep a section pointer. Change all
10917 uses. Move comdat group support to Sized_relobj.
10918 (Relobj::is_section_specially_mapped): Remove.
10919 (Relobj::output_section): Remove poff parameter. Change all
10920 callers.
10921 (Relobj::output_section_offset): New function.
10922 (Relobj::set_section_offset): Rewrite.
10923 (Relobj::map_to_output): Remove.
10924 (Relobj::output_sections): New function.
10925 (Relobj::do_output_section_offset): New pure virtual function.
10926 (Relobj::do_set_section_offset): Likewise.
10927 (class Sized_relobj): Add section_offsets_ field. Add comdat
10928 group support from Relobj. Update declarations.
10929 (Sized_relobj::get_output_section_offset): New function.
10930 (Sized_relobj::do_output_section_offset): New function.
10931 (Sized_relobj::do_set_section_offset): New function.
10932 * object.cc (Relobj::output_section_address): Remove.
10933 (Sized_relobj::Sized_relobj): Initialize new fields.
10934 (Sized_relobj::include_section_group): Cast find_kept_object to
10935 Sized_relobj.
10936 (Sized_relobj::include_linkonce_section): Likewise.
10937 (Sized_relobj::do_layout): Use separate arrays for output section
10938 and output offset.
10939 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10940 output_sections.
10941 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10942 output_sections and section_offsets.
10943 (Sized_relobj::write_local_symbols): Likewise.
10944 (map_to_kept_section): Compute output address directly.
10945 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10946 output_sections and section_offsets.
10947 (Sized_relobj::write_sections): Likewise.
10948 (Sized_relobj::relocate_sections): Likewise.
10949 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10950 * output.h (class Output_reloc): Update declarations. Change
10951 u2_.relobj to Sized_relobj*.
10952 (class Output_data_reloc): Change add functions to use
10953 Sized_relobj*.
10954 * output.cc (Output_reloc::Output_reloc): Change relobj to
10955 Sized_relobj*.
10956 (Output_reloc::local_section_offset): Change return type to
10957 Elf_Addr. Use get_output_section_offset.
10958 (Output_reloc::get_address): Likewise.
10959 (Output_section::is_input_address_mapped): Don't call
10960 is_section_specially_mapped.
10961 (Output_section::output_offset): Likewise.
10962 (Output_section::output_address): Likewise.
10963 (Output_section::starting_output_address): Likewise.
10964 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10965 parameter to Sized_relobj*.
10966 (Copy_relocs::need_copy_reloc): Likewise.
10967 (Copy_relocs::save): Likewise.
10968 * copy-relocs.h (class Copy_relocs): Update declarations.
10969 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10970 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10971 * target-reloc.h (relocate_for_relocatable): Change
10972 offset_in_output_section type to Elf_Addr. Change code that uses
10973 it as well.
10974 * layout.cc (Layout::layout): Always set *off.
10975 * mapfile.cc (Mapfile::print_input_section): Use
10976 output_section_offset.
10977 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10978 Sized_relobj*.
10979 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10980 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10981 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10982
5cb66f97
ILT
109832008-07-03 Ian Lance Taylor <iant@google.com>
10984
10985 * layout.cc (Layout::include_section): Do not discard unrecognized
10986 SHT_STRTAB sections.
10987
afe47622
CS
109882008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10989
10990 * script.cc (Lex::can_continue_name): Make '?' allowable in
10991 version-script names.
10992 * testsuite/version_script.map: Change glob pattern to use '?'
10993
5adf9721
ILT
109942008-06-30 Manish Singh <yosh@gimp.org>
10995
10996 PR 6585
10997 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10998 Correct typo.
10999
e6fde208
ILT
110002008-06-30 Ian Lance Taylor <iant@google.com>
11001
11002 PR 6660
11003 PR 6682
11004 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11005 versions]: Don't try to read the value in the contents, since we
11006 don't use it. Use the template endianness when writing.
11007
3f2e6a2d
CC
110082008-06-25 Cary Coutant <ccoutant@google.com>
11009
11010 * fileread.cc (File_read::make_view): Assert on zero-length view.
11011 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11012 symbol table when there are no symbols to read.
11013
c43d3a48
CS
110142008-06-23 Craig Silverstein <csilvers@google.com>
11015
11016 * version.cc (version_string): Bump to 1.7
11017
5f494ea0
CS
110182008-06-18 Craig Silverstein <csilvers@google.com>
11019
11020 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11021 constant 0xFFFF to type Valtype.
11022 (Powerpc_relocate_functions::rel16_ha): Likewise.
11023
c42e122e
ILT
110242008-06-17 Ian Lance Taylor <iant@google.com>
11025
f34787f8
ILT
11026 * output.h (Output_section::Input_section): Initialize p2align_ to
11027 zero for Output_section_data constructors.
11028 (Output_section::Input_section::addralign): If not an input
11029 section, return the alignment of the Output_section_data.
11030 * testsuite/copy_test.cc: New file.
11031 * testsuite/copy_test_1.cc: New file.
11032 * testsuite/copy_test_2.cc: New file.
11033 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11034 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11035 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11036 (copy_test_1_pic.o, copy_test_1.so): New targets.
11037 (copy_test_2_pic.o, copy_test_2.so): New targets.
11038 * testsuite/Makefile.in: Rebuild.
11039
c42e122e
ILT
11040 * script-sections.cc (Script_sections::place_orphan): Initialize
11041 local variable exact.
11042
ce3ac18a
DE
110432008-06-13 David Edelsohn <edelsohn@gnu.org>
11044
11045 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11046
42cacb20
DE
110472008-06-12 David Edelsohn <edelsohn@gnu.org>
11048 David S. Miller <davem@davemloft.net>
11049
11050 * powerpc.cc: New file.
11051 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11052 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11053 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11054 * Makefile.in: Rebuild.
11055
7b308235
ILT
110562008-06-09 Ian Lance Taylor <iant@google.com>
11057
11058 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11059 <exception>.
11060 (throwing, orig_terminate): New static variables.
11061 (terminate_handler): New static function.
11062 (t2): Set terminate handler.
11063
f0b886e3
ILT
110642008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11065
11066 PR 6584
cd536b21 11067 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
11068 alignment.
11069
3e90f135
CC
110702008-05-30 Cary Coutant <ccoutant@google.com>
11071
11072 * archive.cc (Archive::include_all_members) Correct to step
11073 over symbol table and extended name table in thin archives.
11074
e09ad04a
ILT
110752008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11076
11077 PR 6407
11078 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11079 calculation.
11080
62b01cb5
ILT
110812008-05-28 Caleb Howe <cshowe@google.com>
11082
11083 * reduced_debug_output.cc: New file.
11084 * reduced_debug_output.h: New file.
92de84a6 11085 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
11086 * options.cc (General_options::finalize): Add strip_debug_non_line
11087 to the strip heirarchy.
11088 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11089 fields.
11090 * layout.cc: Include "reduced_debug_output.h".
11091 (Layout::Layout): Initialize new fields.
11092 (line_only_debug_sections): New static array.
11093 (is_lines_only_debug_sections): New static inline function.
11094 (Layout::include_section): Handle --strip-debug-non-line.
11095 (Layout::make_output_section): If --strip-debug-non-line, build
11096 new output sections for .debug_abbrev and .debug_info.
11097 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11098 gold. Warn about possible overflow.
11099 (read_signed_LEB_128): Likewise.
11100 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11101 (read_signed_LEB_128): Declare.
11102 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11103 (HFILES): Add reduced_debug_output.h.
11104 * Makefile.in: Rebuild.
11105
7d9e3d98
ILT
111062008-05-21 Ian Lance Taylor <iant@google.com>
11107
11108 * mapfile.cc: New file.
11109 * mapfile.h: New file.
11110 * options.h (class General_options): Add -M/--print-map and -Map.
11111 * options.cc (General_options::finalize): Make -M equivalent to
11112 -Map -.
11113 * main.cc: Include <cstdio> and "mapfile.h".
11114 (main): Open mapfile if requested.
11115 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11116 constructor. Change caller.
11117 (queue_initial_tasks): Add mapfile parameter. Change caller.
11118 (queue_middle_tasks): Likewise.
11119 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11120 declarations.
11121 * archive.cc: Include "mapfile.h".
11122 (Archive::add_symbols): Add mapfile parameter. Change all
11123 callers. Pass mapfile, symbol, and reason to include_member.
11124 (Archive::include_all_members): Add mapfile parameter. Change all
11125 callers.
11126 (Archive::include_member): Add mapfile, sym, and why parameters.
11127 Change all callers. Report inclusion to map file.
11128 * archive.h: Include "fileread.h".
11129 (class Archive): Update declarations.
11130 (Archive::file): New const method.
11131 (class Add_archive_symbols): Add mapfile_ field. Update
11132 constructor. Change all callers.
11133 * readsyms.h (class Read_symbols): Likewise.
11134 (class Finish_group): Likewise.
11135 (class Read_script): Likewise.
11136 * common.cc: Include "mapfile.h".
11137 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11138 all callers.
11139 (Symbol_table::do_allocate_commons): Likewise.
11140 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11141 symbol allocation to mapfile.
11142 * common.h (class Allocate_commons_task): Add mapfile_ field.
11143 Update constructor. Change all callers.
11144 * symtab.h (class Symbol_table): Update declarations.
11145 * layout.cc: Include "mapfile.h".
11146 (Layout_task_runner::run): Print information to mapfile.
11147 (Layout::create_gold_note): Change Output_data_fixed_space to
11148 Output_data_zero_fill.
11149 (Layout::create_build_id): Likewise.
11150 (Layout::print_to_mapfile): New function.
11151 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11152 constructor. Change caller.
11153 (class Layout): Declare print_to_mapfile.
11154 * output.cc (Output_section::Input_section::print_to_mapfile): New
11155 function.
11156 (Output_section::add_input_section): If producing a map, always
11157 add to input_sections_ list.
11158 (Output_section::do_print_to_mapfile): New function.
11159 (Output_segment::print_sections_to_mapfile): New function.
11160 (Output_segment::print_section_list_to_mapfile): New function.
11161 * output.h: Include "mapfile.h".
11162 (Output_data::print_to_mapfile): New function.
11163 (Output_data::do_print_to_mapfile): New virtual function.
11164 (Output_segment_headers::do_print_to_mapfile): New function.
11165 (Output_file_header::do_print_to_mapfile): New function.
11166 (Output_data_const::do_print_to_mapfile): New function.
11167 (class Output_data_const_buffer): Add map_name_ field. Update
11168 constructor. Change all callers. Add do_print_to_mapfile
11169 function.
11170 (class Output_data_fixed_space): Likewise.
11171 (class Output_data_space): Likewise.
11172 (class Output_data_zero_fill): New class.
11173 (Output_data_strtab::do_print_to_mapfile): New function.
11174 (Output_data_reloc_base::do_print_to_mapfile): New function.
11175 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11176 (Output_data_group::do_print_to_mapfile): New function.
11177 (Output_data_got::do_print_to_mapfile): New function.
11178 (Output_data_dynamic::do_print_to_mapfile): New function.
11179 (Output_symtab_xindex::do_print_to_mapfile): New function.
11180 (class Output_section): Declare do_print_to_mapflie. Declare
11181 print_to_mapfile in Input_section.
11182 (class Output_segment): Declare new functions.
11183 * object.h (Sized_relobj::symbol_count): New function.
11184 * script-sections.cc
11185 (Output_section_element_dot_assignment::set_section_addresses):
11186 Change Output_data_fixed_space to Output_data_zero_fill.
11187 (Output_data_expression::do_print_to_mapfile): New function.
11188 * script.cc (read_input_script): Add mapfile parameter. Change
11189 all callers.
11190 * script.h (read_input_script): Update declaration.
11191 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11192 (Eh_frame::do_print_to_mapfile): New function.
11193 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11194 (Output_merge_string::do_print_to_mapfile): New function.
11195 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11196 function.
11197 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11198 function.
11199 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11200 function.
11201 * Makefile.am (CCFILES): Add mapfile.cc.
11202 (HFILES): Add mapfile.h.
11203 * Makefile.in: Rebuild.
11204
9f1d377b
ILT
112052008-05-19 Ian Lance Taylor <iant@google.com>
11206
11207 * options.h (class General_options): Add -z relro.
11208 * layout.cc (Layout::Layout): Initialize relro_segment_.
11209 (Layout::add_output_section_data): Return the output section.
11210 (Layout::make_output_section): Rcognize relro sections and mark
11211 them appropriately.
11212 (Layout::attach_allocated_section_to_segment): Put relro sections
11213 in a PT_GNU_RELRO segment.
11214 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11215 section as relro.
11216 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11217 PT_TLS segments.
11218 (Layout::linkonce_mapping): Map d.rel.ro.local to
11219 .data.rel.ro.local.
11220 (Layout::output_section_name): Us .data.rel.ro.local for any
11221 section which begins with that.
11222 * layout.h (class Layout): Update add_output_section_data
11223 declaration. Add relro_segment_ field.
11224 * output.cc (Output_section::Output_section): Initialize is_relro_
11225 and is_relro_local_ fields.
11226 (Output_segment::add_output_section): Group relro sections.
11227 (Output_segment::is_first_section_relro): New function.
11228 (Output_segment::maximum_alignment): If there is a relro section,
11229 align the segment to the common page size.
11230 (Output_segment::set_section_addresses): Track whether we are
11231 looking at relro sections. If the last section is a relro
11232 section, align to the common page size.
11233 (Output_segment::set_section_list_addresses): Add in_relro
11234 parameter. Change all callers. Align to the page size when
11235 moving from relro to non-relro section.
11236 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11237 segment.
11238 * output.h (class Output_section): Add is_relro_ and
11239 is_relro_local_ fields.
11240 (Output_section::is_relro): New function.
11241 (Output_section::set_is_relro): New function.
11242 (Output_section::is_relro_local): New function.
11243 (Output_section::set_is_relro_local): New function.
11244 (class Output_segment): Update declarations.
11245 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11246 * sparc.cc (Target_sparc::got_section): Likewise.
11247 * x86_64.cc (Target_x86_64::got_section): Likewise.
11248 * testsuite/relro_test_main.cc: New file.
11249 * testsuite/relro_test.cc: New file.
11250 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11251 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11252 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11253 (relro_test.so, relro_test_pic.o): New targets.
11254 * testsuite/Makefile.in: Rebuild.
11255
a984ee1d
ILT
112562008-05-16 Ian Lance Taylor <iant@google.com>
11257
01676dcd
ILT
11258 * output.cc (Output_segment::add_output_section): Remove front
11259 parameter.
11260 * output.h (class Output_segment): Remove
11261 add_initial_output_section and overloaded add_output_section.
11262 Update declaration of remaining add_output_section.
11263 * layout.cc (Layout::create_interp): Call add_output_section
11264 rather than add_initial_output_section.
11265 (Layout::finish_dynamic_section): Likewise.
11266
497897f9
ILT
11267 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11268 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11269 know the dynamic type.
11270 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11271 field. Initialize it in constructor.
11272 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11273 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11274 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11275 reloc.
11276
a984ee1d
ILT
11277 * output.cc (Output_reloc::get_address): Change return type to
11278 Elf_Addr.
11279 * output.h (class Output_reloc): Update get_address declaration.
11280 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11281 for section addresses.
11282
55ba0940
ILT
112832008-05-09 Ian Lance Taylor <iant@google.com>
11284
11285 PR 6493
11286 * gold.cc (gold_nomem): Use return value of write.
11287
75517b77
ILT
112882008-05-08 Ian Lance Taylor <iant@google.com>
11289
11290 * symtab.c (Symbol::init_base_output_data): Add version
11291 parameter. Change all callers.
11292 (Symbol::init_base_output_segment): Likewise.
11293 (Symbol::init_base_constant): Likewise.
11294 (Symbol::init_base_undefined): Likewise.
11295 (Sized_symbol::init_output_data): Likewise.
11296 (Sized_symbol::init_output_segment): Likewise.
11297 (Sized_symbol::init_constant): Likewise.
11298 (Sized_symbol::init_undefined): Likewise.
11299 (Symbol_table::do_define_in_output_data): If the new symbol has a
11300 version, mark it as the default.
11301 (Symbol_table::do_define_in_output_segment): Likewise.
11302 (Symbol_table::do_define_as_constant): Likewise.
11303 * symtab.h (class Symbol): Update declarations.
11304 (class Sized_symbol): Likewise.
11305 * resolve.cc (Symbol::override_version): New function.
c42e122e 11306 (Symbol::override_base): Call override_version.
75517b77
ILT
11307 (Symbol::override_base_with_special): Likewise.
11308 * testsuite/ver_script_8.script: New file.
11309 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11310 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11311 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11312 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11313
f1f70eae
ILT
113142008-05-06 Ian Lance Taylor <iant@google.com>
11315
f3e9c5c5
ILT
11316 PR 6049
11317 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11318 functions.
11319 (class General_options): Remove existing --undefined, and add
11320 --no-undefined instead. Add new --undefined as synonym for -u.
11321 * archive.cc (Archive::add_symbols): Check whether symbol was
11322 named with -u.
11323 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11324 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11325 all uses. Add IS_UNDEFINED. Update declarations to split
11326 different versions of init_base. Declare init_base_undefined.
11327 (Symbol::is_defined): Handle IS_UNDEFINED.
11328 (Symbol::is_undefined): Likewise.
11329 (Symbol::is_weak_undefined): Call is_undefined.
11330 (Symbol::is_absolute): Handle IS_CONSTANT.
11331 (class Sized_symbol): Update declarations to split different
11332 versions of init. Declare init_undefined.
11333 (class Symbol_table): Declare new functions.
11334 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11335 Change all callers.
11336 (Symbol::init_base_output_data): Likewise.
11337 (Symbol::init_base_output_segment): Likewise.
11338 (Symbol::init_base_constant): Likewise.
11339 (Symbol::init_base_undefined): New function.
11340 (Sized_symbol::init_object): Rename from init. Change all
11341 callers.
11342 (Sized_symbol::init_output_data): Likewise.
11343 (Sized_symbol::init_output_segment): Likewise.
11344 (Sized_symbol::init_constant): Likewise.
11345 (Sized_symbol::init_undefined): New function.
11346 (Symbol_table::add_undefined_symbols_from_command_line): New
11347 function.
11348 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11349 function.
11350 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11351 (Symbol::output_section): Likewise.
11352 (Symbol::set_output_section): Likewise.
11353 (Symbol_table::sized_finalize_symbol): Likewise.
11354 (Symbol_table::sized_write_globals): Likewise.
11355 * resolve.cc (Symbol_table::should_override): Likewise.
11356 (Symbol::override_base_with_special): Likewise.
11357
8bdcdf2c
ILT
11358 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11359 symbol, change it to have default visibility.
11360 * testsuite/protected_1.cc: New file.
11361 * testsuite/protected_2.cc: New file.
11362 * testsuite/protected_3.cc: New file.
11363 * testsuite/protected_main_1.cc: New file.
11364 * testsuite/protected_main_2.cc: New file.
11365 * testsuite/protected_main_3.cc: New file.
11366 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11367 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11368 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11369 (protected_1.so): New target.
11370 (protected_1_pic.o, protected_2_pic.o): New targets.
11371 (protected_3_pic.o): New target.
11372 (check_PROGRAMS): Add protected_2.
11373 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11374 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11375 * testsuite/Makefile.in: Rebuild.
11376
2b706932
ILT
11377 * options.h (DEFINE_var): Add set_user_set_##varname__.
11378 (DEFINE_bool_alias): New macro.
11379 (class General_options): Define -Bstatic using DEFINE_bool_alias
11380 rather than DEFINE_special. Add --undefined as an alias for -z
11381 defs.
11382 * options.cc (General_options::parse_Bstatic): Remove.
11383
d82a5bcc
ILT
11384 * options.h (class General_options): Add --fatal-warnings.
11385 * main.cc (main): Implement --fatal-warnings.
11386 * errors.h (Errors::warning_count): New function.
11387
f1f70eae
ILT
11388 * options.h (class General_options): Add -Bsymbolic-functions.
11389 * symtab.h (Symbol::is_preemptible): Check for
11390 -Bsymbolic-functions.
11391
8825ac63
ILT
113922008-05-05 Ian Lance Taylor <iant@google.com>
11393
d98bc257
ILT
11394 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11395 as noVARNAME rather than no-VARNAME.
11396 (class General_options): Add option -z combreloc.
11397 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11398 get_address.
11399 (Output_reloc::sort_before) [SHT_REL]: New function.
11400 (Output_reloc::sort_before) [SHT_RELA]: New function.
11401 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11402 Sort_relocs_comparison.
11403 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11404 parameter. Change all callers.
11405 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11406 sort_relocs parameter. Change all callers.
11407 * output.cc (Output_reloc::get_address): New function, broken out
11408 of write_rel.
11409 (Output_reloc::write_rel): Call it.
11410 (Output_reloc::compare): New function.
11411 (Output_data_reloc_base::do_write): Optionally sort relocs.
11412
60b2b4e7
ILT
11413 * configure.ac: If targ_extra_obj is set, link it in.
11414 * configure.tgt: Initialize all variables.
11415 (x86_64*): Set targ_extra_obj and targ_extra_size.
11416 * configure: Rebuild.
11417
8825ac63
ILT
11418 * object.cc (Sized_relobj::include_section_group): Adjust section
11419 indexes read from group data. Build vector to pass to
11420 layout_group.
11421 * layout.cc (Layout::layout_group): Add flags and shndxes
11422 parameters. Remove contents parameter. Change caller. Update
11423 explicit instantiations.
11424 * layout.h (class Layout): Update layout_group declaration.
11425 * output.cc (Output_data_group::Output_data_group): Add flags and
11426 input_shndxes parameters. Remove contents parameter. Change
11427 caller.
11428 (Output_data_group::do_write): Change input_sections_ to
11429 input_shndxes_.
11430 * output.h (class Output_data_group): Update constructor
11431 declaration. Rename input_sections_ to input_shndxes_.
11432 * testsuite/many_sections_test.cc: Add template.
11433
e94cf127
CC
114342008-04-30 Cary Coutant <ccoutant@google.com>
11435
4418b2d5
CC
11436 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11437
e94cf127
CC
11438 * layout.cc (Layout::include_section): Refactored check for debug
11439 info section.
11440 (Layout::add_comdat): Add new parameters. Change type
11441 of signature parameter. Add object and shndx to signatures table.
11442 (Layout::find_kept_object): New function.
11443 * layout.h: Include <cstring>.
11444 (Layout::is_debug_info_section): New function.
11445 (Layout::add_comdat): Add new parameters.
11446 (Layout::find_kept_object): New function.
11447 (Layout::Kept_section): New struct.
11448 (Layout::Signatures): Change type of map range.
11449 * object.cc (Relobj::output_section_address): New function.
11450 (Sized_relobj::include_section_group): Add new parameters. Change
11451 calls to Layout::add_comdat. Change to build table of kept comdat
11452 groups and table mapping discarded sections to kept sections.
11453 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11454 (Sized_relobj::do_layout): Change calls to include_section_group and
11455 include_linkonce_section.
11456 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11457 value to zero when section is discarded.
11458 (Sized_relobj::map_to_kept_section): New function.
11459 * object.h (Relobj::output_section_address): New function.
11460 (Relobj::Comdat_group): New type.
11461 (Relobj::find_comdat_group): New function.
11462 (Relobj::Comdat_group_table): New type.
11463 (Relobj::Kept_comdat_section): New type.
11464 (Relobj::Kept_comdat_section_table): New type.
11465 (Relobj::add_comdat_group): New function.
11466 (Relobj::set_kept_comdat_section): New function.
11467 (Relobj::get_kept_comdat_section): New function.
11468 (Relobj::comdat_groups_): New field.
11469 (Relobj::kept_comdat_sections_): New field.
11470 (Symbol_value::input_value): Update comment.
11471 (Sized_relobj::map_to_kept_section) New function.
11472 (Sized_relobj::include_linkonce_section): Add new parameter.
11473 * target-reloc.h (Comdat_behavior): New type.
11474 (get_comdat_behavior): New function.
11475 (relocate_section): Add code to map a discarded section to the
11476 corresponding kept section when applying a relocation.
11477
e4e5049b
CS
114782008-04-30 Craig Silverstein <csilvers@google.com>
11479
11480 * dwarf_reader.cc (next_generation_count): New static var.
11481 (Addr2line_cache_entry): New struct.
11482 (addr2line_cache): New static var.
11483 (Dwarf_line_info::one_addr2line): Added caching.
11484 (Dwarf_line_info::clear_addr2line_cache): New function.
11485 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11486 cache-size parameter.
11487 (Dwarf_line_info::one_addr2line_cache): New function.
11488 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11489 new cache-size argument to one_addr2line(), and clear cache.
11490
d09e9154
CC
114912008-04-28 Cary Coutant <ccoutant@google.com>
11492
11493 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11494 R_386_PC8 relocations.
11495
7ef73768
ILT
114962008-04-23 Ian Lance Taylor <iant@google.com>
11497
55438702
ILT
11498 * object.cc (Sized_relobj::include_section_group): Check for
11499 invalid section group.
11500
c165fb93
ILT
11501 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11502 header size.
11503
7ef73768
ILT
11504 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11505 than read for file header.
11506 * archive.cc (Archive::include_member): Likewise.
11507
6194aaab
L
115082008-04-23 Paolo Bonzini <bonzini@gnu.org>
11509
11510 * aclocal.m4: Regenerate.
11511 * configure: Regenerate.
11512
d491d34e
ILT
115132008-04-19 Ian Lance Taylor <iant@google.com>
11514
5ea2bac6
ILT
11515 * version.cc (version_string): Bump to 1.6.
11516
7bc3e21a
ILT
11517 * testsuite/Makefile.am (many_sections_r_test): New target.
11518 (many_sections_r_test_SOURCES): Remove.
11519 (many_sections_r_test_DEPENDENCIES): Remove.
11520 (many_sections_r_test_LDFLAGS): Remove.
11521 (many_sections_r_test_LDADD): Remove.
11522
7fcd3aa9
ILT
11523 * object.cc (Sized_relobj::do_add_symbols): Always pass
11524 local_symbol_count_ to add_from_relobj.
11525
4c94d6ae
ILT
11526 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11527 every thousand variables.
11528 * testsuite/Makefile.in: Rebuild.
11529
d491d34e
ILT
11530 * object.cc (Xindex::initialize_symtab_xindex): New function.
11531 (Xindex::read_symtab_xindex): New function.
11532 (Xindex::sym_xindex_to_shndx): New function.
11533 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11534 available.
11535 (Sized_relobj::do_initialize_xindex): New function.
11536 (Sized_relobj::do_read_symbols): Adjust section links.
11537 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11538 parameter. Change all callers.
11539 (Sized_relobj::include_section_group): Adjust section links and
11540 symbol section indexes.
11541 (Sized_relobj::do_layout): Adjust section links.
11542 (Sized_relobj::do_count_local_symbols): Adjust section links and
11543 symbol section indexes.
11544 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11545 ordinary and special symbols.
11546 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11547 dynsym_xindex parameters. Change all callers. Adjust section
11548 links. Use SHN_XINDEX when needed.
11549 (Sized_relobj::get_symbol_location_info): Adjust section links.
11550 Don't get fooled by special symbols.
11551 * object.h (class Xindex): Define.
11552 (class Object): Add xindex_ parameter. Declare virtual functoin
11553 do_initialize_xindex.
11554 (Object::adjust_sym_shndx): New function.
11555 (Object::set_xindex): New protected function.
11556 (class Symbol_value): Add is_ordinary_shndx_ field.
11557 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11558 (Symbol_value::value): Assert ordinary section.
11559 (Symbol_value::initialize_input_to_output_map): Likewise.
11560 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11561 Change all callers.
11562 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11563 all callers.
11564 (class Sized_relobj): Update declarations.
11565 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11566 parameter. Change all callers.
11567 (Sized_relobj::adjust_shndx): New function.
11568 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11569 field.
11570 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11571 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11572 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11573 (Sized_dynobj::read_dynsym_section): Adjust section links.
11574 (Sized_dynobj::read_dynamic): Likewise.
11575 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11576 section links.
11577 (Sized_dynobj::do_initialize_xindex): New function.
11578 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11579 do_initialize_xindex.
11580 (Sized_dynobj::adjust_shndx): New function.
11581 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11582 dynsym_xindex_ fields.
11583 (Layout::finalize): Add a call to set_section_indexes before
11584 creating the symtab sections.
11585 (Layout::set_section_indexes): Don't do anything if the section
11586 already has a section index.
11587 (Layout::create_symtab_sections): Add shnum parameter. Change
11588 caller. Create .symtab_shndx section if needed.
11589 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11590 caller.
11591 (Layout::allocated_output_section_count): New function.
11592 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11593 needed.
11594 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11595 fields. Update declarations.
11596 (Layout::symtab_xindex): New function.
11597 (Layout::dynsym_xindex): New function.
11598 (class Write_symbols_task): Add layout_ field.
11599 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11600 Change caller.
11601 * output.cc (Output_section_headers::Output_section_headers): Add
11602 shstrtab_section parameter. Change all callers.
11603 (Output_section_headers::do_sized_write): Store overflow values
11604 for section count and section string table section index in
11605 section header zero.
11606 (Output_file_header::do_sized_write): Check for overflow of
11607 section count and section string table section index.
11608 (Output_symtab_xindex::do_write): New function.
11609 (Output_symtab_xindex::endian_do_write): New function.
11610 * output.h (class Output_section_headers): Add shstrtab_section_.
11611 Update declarations.
11612 (class Output_symtab_xindex): Define.
11613 (Output_section::has_out_shndx): New function.
11614 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11615 field.
11616 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11617 Change all callers.
11618 (Sized_symbol::init): Likewise.
11619 (Symbol::output_section): Check for ordinary symbol.
11620 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11621 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11622 callers.
11623 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11624 Change all callers. Simplify handling of symbols from sections
11625 not included in the link.
11626 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11627 distinction.
11628 (Weak_alias_sorter::operator()): Assert that symbols are
11629 ordinary.
11630 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11631 distinction.
11632 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11633 parameters. Change all callers.
11634 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11635 symbol distinction. Use SHN_XINDEX when needed.
11636 (Symbol_table::write_section_symbol): Add symtab_xindex
11637 parameter. Change all callers.
11638 (Symbol_table::sized_write_section_symbol): Likewise. Use
11639 SHN_XINDEX when needed.
11640 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11641 declarations.
11642 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11643 (Symbol::is_defined): Check is_ordinary.
11644 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11645 (Symbol::is_absolute, Symbol::is_common): Likewise.
11646 (class Sized_symbol): Update declarations.
11647 (class Symbol_table): Update declarations.
11648 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11649 parameters. Change all callers.
11650 (Sized_symbol::override): Likewise.
11651 (Symbol_table::override): Likewise.
11652 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11653 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11654 is_ordinary, and orig_st_shndx parameters. Change all callers.
11655 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11656 to be in an ordinary section.
11657 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11658 object and is_ordinary parameters. Change all callers.
11659 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11660 Change all callers. Don't add undefined or non-ordinary symbols
11661 to reloc_map_.
11662 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11663 Change all callers.
11664 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11665 declarations.
11666 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11667 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11668 (Sized_relobj::relocate_sections): Likewise.
11669 * target-reloc.h (scan_relocs): Adjust section symbol index.
11670 (scan_relocatable_relocs): Likewise.
11671 * i386.cc (Scan::local): Check for ordinary symbols.
11672 * sparc.cc (Scan::local): Likewise.
11673 * x86_64.cc (Scan::local): Likewise.
11674 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11675 to symbol_section_and_value.
11676 * testsuite/many_sections_test.cc: New file.
11677 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11678 (check_PROGRAMS): Add many_sections_test.
11679 (many_sections_test_SOURCES): Define.
11680 (many_sections_test_DEPENDENCIES): Define.
11681 (many_sections_test_LDFLAGS): Define.
11682 (BUILT_SOURCES): Add many_sections_define.h.
11683 (many_sections_define.h): New target.
11684 (BUILT_SOURCES): Add many_sections_check.h.
11685 (many_sections_check.h): New target.
11686 (check_PROGRAMS): Add many_sections_r_test.
11687 (many_sections_r_test_SOURCES): Define.
11688 (many_sections_r_test_DEPENDENCIES): Define.
11689 (many_sections_r_test_LDFLAGS): Define.
11690 (many_sections_r_test_LDADD): Define.
11691 (many_sections_r_test.o): New target.
11692 * testsuite/Makefile.in: Rebuild.
11693
c5818ff1
CC
116942008-04-17 Cary Coutant <ccoutant@google.com>
11695
11696 * errors.cc (Errors::info): New function.
11697 (gold_info): New function.
11698 * errors.h (Errors::info): New function.
11699 * gold.h (gold_info): New function.
11700 * object.cc (Input_objects::add_object): Print trace output.
11701 * options.cc (options::parse_set): New function.
11702 (General_options::parse_wrap): Deleted.
11703 (General_options::General_options): Deleted initializer.
11704 * options.h (options::String_set): New typedef.
11705 (options::parse_set): New function.
11706 (DEFINE_set): New macro.
11707 (General_options::wrap): Changed to use DEFINE_set. Changed
11708 callers of any_wrap_symbols and is_wrap_symbol.
11709 (General_options::trace, General_options::trace_symbol):
11710 New options.
11711 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11712 (General_options::wrap_symbols_): Deleted.
11713 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11714
b5be4a7c
DM
117152008-04-17 David S. Miller <davem@davemloft.net>
11716
11717 * options.cc (General_options::parse_V): New function.
11718 * options.h: Add entries for -V and -Qy.
11719
155a0dd7
ILT
117202008-04-17 Ian Lance Taylor <iant@google.com>
11721
11722 * common.cc (Symbol_table::allocate_commons): Remove options
11723 parameter. Change caller.
11724 (Symbol_table::do_allocate_commons): Remove options parameter.
11725 Change caller. Just call do_allocate_commons_list twice.
11726 (Symbol_table::do_allocate_commons_list): New function, broken out
11727 of do_allocate_commons.
11728 * common.h (class Allocate_commons_task): Remove options_ field.
11729 Update constructor.
11730 * symtab.cc (Symbol_table::Symbol_table): Initialize
11731 tls_commons_.
11732 (Symbol_table::add_from_object): Put TLS common symbols on
11733 tls_commons_ list.
11734 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11735 which are IN_OUTPUT_DATA.
11736 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11737 allocate_commons and do_allocate_commons declarations. Declare
11738 do_allocate_commons_list.
11739 * gold.cc (queue_middle_tasks): Update creation of
11740 Allocate_commons_task to not pass options.
11741 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11742 (TLS_TEST_C_FLAGS): New variable.
11743 (tls_test_c_pic.o): New target.
11744 (tls_test_shared.so): Link in tls_test_c_pic.o.
11745 (tls_test_c_pic_ie.o): New target.
11746 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11747 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11748 (tls_test_c.o): New target.
11749 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11750 (tls_pic_test_LDADD): Likewise.
11751 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11752 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11753 (tls_test_c_gnu2.o): New target.
11754 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11755 tls_test_c_gnu2.o.
11756 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11757 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11758 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11759 * testsuite/tls_test.cc: Include "config.h".
11760 (t_last): Call t11_last.
11761 * testsuite/tls_test.h (t11, t11_last): Declare.
11762 * testsuite/tls_test_c.c: New file.
11763 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11764 * configure.ac: Check for OpenMP support.
11765 * configure, config.in, Makefile.in: Rebuild.
11766 * testsuite/Makefile.in: Rebuild.
11767
edfbb029
CC
117682008-04-16 Cary Coutant <ccoutant@google.com>
11769
11770 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11771 (Target_i386::tls_base_symbol_defined_): New field.
11772 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11773 (Target_i386::Scan::global): Likewise.
11774 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11775 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11776 (Target_x86_64::tls_base_symbol_defined_): New field.
11777 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11778 (Target_x86_64::Scan::global): Likewise.
11779
f3c69fca
CC
117802008-04-16 Cary Coutant <ccoutant@google.com>
11781
11782 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11783 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11784 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11785 building shared libraries.
11786 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11787 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11788 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11789 * testsuite/Makefile.in: Rebuild.
11790 * testsuite/weak_undef.h: New file.
11791 * testsuite/weak_undef_file1.cc: Add extra test cases.
11792 * testsuite/weak_undef_file2.cc: Likewise.
11793 * testsuite/weak_undef_test.cc: Likewise.
11794
7c414435
DM
117952008-04-16 David S. Miller <davem@davemloft.net>
11796
32b769e1
DM
11797 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11798 Add issued_non_pic_error_ field. Declare check_non_pic.
11799 (Target_sparc::Scan::check_non_pic): New function.
11800 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11801 (Target_sparc::Scan::global): Likewise.
11802
11936fb1
DM
11803 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11804 * configure: Rebuild.
11805
7c414435
DM
11806 * options.h (DEFINE_enable): New macro.
11807 (new_dtags): New enable option.
11808 (initfirst, interpose, loadfltr, nodefaultlib,
11809 nodelete, nodlopen, nodump): New -z options.
11810 * layout.cc (Layout:finish_dynamic_section): If new
11811 dtags enabled, emit DT_RUNPATH. Also, emit a
11812 DT_FLAGS_1 containing any specified -z flags.
11813
85c7bf8b
ILT
118142008-04-16 Ian Lance Taylor <iant@google.com>
11815
12c0daef
ILT
11816 * copy-relocs.cc: New file.
11817 * copy-relocs.h: New file.
11818 * reloc.cc: Remove Copy_relocs code.
11819 * reloc.h: Likewise.
11820 * reloc-types.h (struct Reloc_types) [both versions]: Add
11821 get_reloc_addend_noerror.
11822 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11823 variants of add_global which take an addend which must be zero.
11824 * i386.cc: Include "copy-relocs.h".
11825 (class Target_i386): Change type of copy_relocs_ to variable,
11826 update initializer.
11827 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11828 Change all callers.
11829 (Target_i386::do_finalize_sections): Change handling of
11830 copy_relocs_.
11831 * sparc.cc: Include "copy-relocs.h".
11832 (class Target_sparc): Change type of copy_relocs_ to variable,
11833 update initializer.
11834 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11835 Change all callers.
11836 (Target_sparc::do_finalize_sections): Change handling of
11837 copy_relocs_.
11838 * x86_64.cc: Include "copy-relocs.h".
11839 (class Target_x86_64): Change type of copy_relocs_ to variable,
11840 update initializer.
11841 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11842 class. Change all callers.
11843 (Target_x86_64::do_finalize_sections): Change handling of
11844 copy_relocs_.
11845 * Makefile.am (CCFILES): Add copy-relocs.cc.
11846 (HFILES): Add copy-relocs.h.
11847
4f4995b6
ILT
11848 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11849
85c7bf8b
ILT
11850 * testsuite/script_test_4.sh: Permit leading zeroes.
11851
4f2a9edd
ILT
118522008-04-15 Ian Lance Taylor <iant@google.com>
11853
e6188289
ILT
11854 * script-sections.cc (Script_sections::create_segments): Use
11855 header_size_adjustment even when there is enough room for the
11856 headers.
11857 * testsuite/script_test_4.sh: New file.
11858 * testsuite/script_test_4.t: New file.
11859 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11860 (check_DATA): Add script_test_4.stdout.
11861 (MOSTLYCLEANFILES): Likewise.
11862 (script_test_4): New target.
11863 (script_test_4.stdout): New target.
11864 * testsuite/Makefile.in: Rebuild.
11865
4f2a9edd
ILT
11866 * sparc.cc: Add definitions for Output_data_plt_sparc class
11867 constants.
11868
f5314dd5
DM
118692008-04-14 David S. Miller <davem@davemloft.net>
11870
11871 * sparc.cc: New file.
11872 * Makefile.am (TARGETSOURCES): Add sparc.cc
11873 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11874 * configure.tgt: Document targ_extra_size and
11875 targ_extra_big_endian. Add entries for sparc-* and
11876 sparc64-*.
11877 * configure.ac: Handle targ_extra_size and
11878 targ_extra_big_endian.
11879 * Makefile.in: Rebuild.
11880 * configure: Likewise.
11881 * po/POTFILES.in: Likewise.
11882 * po/gold.pot: Likewise.
11883
154e0e9a
ILT
118842008-04-14 Ian Lance Taylor <iant@google.com>
11885
11886 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11887 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11888 in the name/type/flags to section mapping. Don't call
11889 allocate_output_section.
11890 (Layout::choose_output_section): Change parameter from adjust_name
11891 to is_input_section. Don't permit input sections after sections
11892 are attached to segments. Don't call allocate_output_section.
11893 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11894 not write_enable_output_section.
11895 (Layout::make_output_section): Don't push to
11896 unattached_section_list_ nor call attach_to_segment. Call
11897 attach_section_to_segment if sections are attached.
11898 (Layout::attach_sections_to_segments): New function.
11899 (Layout::attach_section_to_segment): New function.
11900 (Layout::attach_allocated_section_to_segment): Rename from
11901 attach_to_segment. Remove flags parameter.
11902 (Layout::allocate_output_section): Remove function.
11903 (Layout::write_enable_output_section): Remove function.
11904 * layout.h (class Layout): Update for above changes. Add new
11905 field sections_are_attached_.
11906 * output.h (Output_section::update_flags_for_input_section): New
11907 function.
11908 * output.cc (Output_section::add_input_section): Call
11909 update_flags_for_input_section.
11910 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11911
009a67a2
CC
119122008-04-11 Cary Coutant <ccoutant@google.com>
11913
11914 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11915 thought unnecessary.
11916 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11917
759b1a24
ILT
119182008-04-11 Ian Lance Taylor <iant@google.com>
11919
11920 * output.h (class Output_section_data): Remove inline definition
11921 of set_addralign.
11922 * output.cc (Output_section_data::set_addralign): New function.
11923
c2b45e22
CC
119242008-04-11 Cary Coutant <ccoutant@google.com>
11925
11926 Add support for TLS descriptors for i386 and x86_64.
11927 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11928 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11929 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11930 GOT_TYPE_TLS_DESC.
11931 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11932 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11933 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11934 relocations.
11935 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11936 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11937 Fix problem with initial-exec relocations.
11938 (Target_i386::Relocate::relocate_tls): Likewise.
11939 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11940 relaxation.
11941 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11942 support for section-plus-offset dynamic table entries.
11943 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11944 (Output_data_dynamic::Dynamic_entry): Add support for
11945 section-plus-offset dynamic table entries.
11946 (Output_data_dynamic::Classification): Likewise.
11947 (Output_data_dynamic::classification_): Renamed offset_.
11948 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11949 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11950 (Target_x86_64::make_plt_section): New function.
11951 (Target_x86_64::reserve_tlsdesc_entries): New function.
11952 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11953 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11954 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11955 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11956 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11957 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11958 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11959 add extra PLT entry for TLS descriptors.
11960 (Output_data_plt_x86_64::got_): New field.
11961 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11962 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11963 fields.
11964 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11965 descriptors.
11966 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11967 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11968 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11969 R_386_TLS_DESC_CALL relocations.
11970 (Target_x86_64::Scan::global): Likewise.
11971 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11972 for TLS descriptors.
11973 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11974 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11975 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11976 GD-to-IE relaxation.
11977 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11978 and TLS_DESCRIPTORS.
11979 * Makefile.in: Rebuild.
11980 * configure: Rebuild.
11981 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11982 (tls_test_shared2.so): New target.
11983 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11984 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11985 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11986 (tls_shared_gd_to_ie_test_LDADD): New variable.
11987 (tls_shared_gnu2_gd_to_ie_test): New target.
11988 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11989 New targets.
11990 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11991 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11992 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11993 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11994 (tls_shared_gnu2_test): New target.
11995 (tls_test_gnu2_shared.so): New target.
11996 (tls_shared_gnu2_test_SOURCES): New variable.
11997 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11998 (tls_shared_gnu2_test_LDFLAGS): New variable.
11999 (tls_shared_gnu2_test_LDADD): New variable.
12000 * testsuite/Makefile.in: Rebuild.
12001 * testsuite/Makefile.
12002
83bfb6b7
ILT
120032008-04-11 Ian Lance Taylor <iant@google.com>
12004
12005 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12006 justsyms.t.
12007 * testsuite/Makefile.in: Rebuild.
12008
12009 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12010 long.
12011 * testsuite/script_test_2.cc (main): Adjust test.
12012
706e1f5e
ILT
120132008-04-11 David S. Miller <davem@davemloft.net>
12014 Ian Lance Taylor <iant@google.com>
12015
12016 * options.h (General_options): Add entries for '-Y' and
12017 '-relax'.
12018 * options.cc (General_options:finalize): If -Y was used, add those
12019 entries to the library path instead of the default "/lib" and
12020 "/usr/lib".
12021
7c98e6bb
DM
120222008-04-11 David S. Miller <davem@davemloft.net>
12023
12024 * testsuite/justsyms.t: Start at 0x100.
12025 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
12026 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12027 long.
12028 * testsuite/script_test_2.cc: Adjust string and section length
12029 checks.
7c98e6bb 12030
99a37bfd
ILT
120312008-04-09 Ian Lance Taylor <iant@google.com>
12032
2cefc357
ILT
12033 PR gold/5996
12034 * script-sections.cc (Sections_element::allocate_to_segment): Add
12035 orphan parameter.
12036 (Output_section_definition::allocate_to_segment): Likewise.
12037 (Orphan_output_section::allocate_to_segment): Likewise.
12038 (Script_sections::attach_sections_using_phdrs_clause): Don't
12039 propagate non-PT_LOAD segments to orphan sections.
12040 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12041 readelf rather than objdump.
12042 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12043 .interp section and PT_INTERP segment are the same size.
12044 * testsuite/Makefile.in: Rebuild.
12045
99a37bfd
ILT
12046 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12047 aliases for symbols defined in the same object.
12048 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12049 (weak_alias_test_SOURCES): New variable.
12050 (weak_alias_test_DEPENDENCIES): New variable.
12051 (weak_alias_test_LDFLAGS): New variable.
12052 (weak_alias_test_LDADD): New variable.
12053 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12054 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12055 (weak_alias_test_3.o): New target.
12056 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12057 * testsuite/weak_alias_test_main.cc: New file.
12058 * testsuite/weak_alias_test_1.cc: New file.
12059 * testsuite/weak_alias_test_2.cc: New file.
12060 * testsuite/weak_alias_test_3.cc: New file.
12061
780e49c5
ILT
120622008-04-08 Ian Lance Taylor <iant@google.com>
12063
cdb0b8f5
ILT
12064 * options.h (class General_options): Add --noinhibit-exec option.
12065 * main.cc (main): Check --noinhibit-exec.
12066
0864d551
ILT
12067 * options.h (class General_options): Define --wrap as a special
12068 option. Add wrap_symbols_ field.
12069 (General_options::any_wrap_symbols): New function.
12070 (General_options::is_wrap_symbol): New function.
12071 * options.cc (General_options::parse_wrap): New function.
12072 (General_options::General_options): Initialize wrap_symbols_.
12073 * symtab.cc (Symbol_table::wrap_symbol): New function.
12074 (Symbol_table::add_from_object): Handle --wrap.
12075 * symtab.h (class Symbol_table): Declare wrap_symbol.
12076 * target.h (Target::wrap_char): New function.
12077 (Target::Target_info): Add wrap_char field.
12078 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12079 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12080 * testsuite/testfile.cc (Target_test::test_target_info):
12081 Likewise.
12082
789aa6de
ILT
12083 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12084 there is one.
12085
2c38906f
ILT
12086 * layout.h (class Layout): Add added_eh_frame_data_ field.
12087 * layout.cc (Layout::Layout): Initialize new field.
12088 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12089 output section until we find a section we merged successfully.
12090 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12091 that the size be non-zero.
12092
780e49c5
ILT
12093 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12094 qualifier.
12095
7fcd0256
ILT
120962008-04-08 Craig Silverstein <csilvers@google.com>
12097
12098 * configure.ac: Export new conditional variable HAVE_ZLIB.
12099 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12100 on HAVE_ZLIB.
12101 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12102 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12103
6835af53
ILT
121042008-04-07 Ian Lance Taylor <iant@google.com>
12105
e24f324c
ILT
12106 * version.cc (version_string): Set to "1.5".
12107
a036edd8
ILT
12108 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12109 Add issued_non_pic_error_ field. Declare check_non_pic.
12110 (Target_x86_64::Scan::check_non_pic): New function.
12111 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12112 (Target_x86_64::Scan::global): Likewise.
12113
624f8810
ILT
12114 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12115 addend parameter. Change caller. Handle merge sections.
12116 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12117 Address to Addend. Don't add in the result of
12118 local_section_offset, pass down the addend and use the returned
12119 value.
12120 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12121 Update declarations of local_section_offset and symbol_value.
12122 * testsuite/two_file_test_1.cc (t18): New function.
12123 * testsuite/two_file_test_2.cc (f18): New function.
12124 * testsuite/two_file_test_main.cc (main): Call t18.
12125 * testsuite/two_file_test.h (t18, f18): Declare.
12126
6835af53
ILT
12127 * configure.ac: Don't test for objdump, c++filt, or readelf.
12128 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12129 conditionals.
12130 (TEST_READELF): New variable.
12131 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12132 (check_PROGRAMS): Add two_file_strip_test.
12133 (two_file_strip_test): New target.
12134 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12135 (two_file_same_shared_strip_test_SOURCES): New variable.
12136 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12137 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12138 (two_file_same_shared_strip_test_LDADD): New variable.
12139 (two_file_shared_strip.so): New target.
12140 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12141 (ver_test_5.syms, ver_test_7.syms): Likewise.
12142 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12143 (strip_test_3.stdout): Use TEST_OBJDUMP.
12144 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12145
86925eef
CC
121462008-04-04 Cary Coutant <ccoutant@google.com>
12147
12148 * symtab.h (Symbol::is_weak_undefined): New function.
12149 (Symbol::is_strong_undefined): New function.
12150 (Symbol::is_absolute): New function.
12151 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12152 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12153 absolute symbols.
12154 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12155 (weak_undef_test): New target.
12156 * testsuite/Makefile.in: Rebuild.
12157 * testsuite/weak_undef_file1.cc: New file.
12158 * testsuite/weak_undef_file2.cc: New file.
12159 * testsuite/weak_undef_test.cc: New file.
12160
126f3ece
ILT
121612008-04-03 Craig Silverstein <csilvers@google.com>
12162
12163 * compressed_output.h (class Output_compressed_section): Use
12164 unsigned buffer.
12165 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12166 add zlib header.
12167 (zlib_compressed_suffix): Removed.
12168 (Output_compressed_section::set_final_data_size): Use unsigned
12169 buffers.
12170 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12171 Fix linker invocation.
12172 (flagstest_o_specialfile_and_compress_debug_sections):
12173 Likewise.
12174 * testsuite/Makefile.in: Regenerated.
12175
deae2a14
DM
121762008-04-02 David S. Miller <davem@davemloft.net>
12177
12178 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12179 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12180
70752818
ILT
121812008-04-02 Craig Silverstein <csilvers@google.com>
12182
12183 * TODO: New file.
12184
39d0cb0e
ILT
121852008-04-02 Ian Lance Taylor <iant@google.com>
12186
12187 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12188 parameters. Update for new key type to views_. Change all
12189 callers.
12190 (File_read::read): Adjust for byteshift in returned view.
12191 (File_read::add_view): New function, broken out of
12192 find_and_make_view.
12193 (File_read::make_view): New function, broken out of
12194 find_and_make_view.
12195 (File_read::find_or_make_view): Add offset and aligned
12196 parameters. Rewrite accordingly. Change all callers.
12197 (File_read::get_view): Add offset and aligned parameters. Adjust
12198 for byteshift in return value.
12199 (File_read::get_lasting_view): Likewise.
12200 * fileread.h (class File_read): Update declarations.
12201 (class File_read::View): Add byteshift_ field. Add byteshift to
12202 constructor. Add byteshift method.
12203 * archive.h (Archive::clear_uncached_views): New function.
12204 (Archive::get_view): Add aligned parameter. Change all callers.
12205 * object.h (Object::get_view): Add aligned parameter. Change all
12206 callers.
12207 (Object::get_lasting_view): Likewise.
12208
12209 * fileread.cc (File_read::release): Don't call clear_views if
12210 there are multiple objects.
12211 * fileread.h (File_read::clear_uncached_views): New function.
12212 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12213 on the archive.
12214
a1207466
CC
122152008-03-31 Cary Coutant <ccoutant@google.com>
12216
12217 Add thin archive support.
12218 * archive.cc (Archive::armagt): New const.
12219 (Archive::setup): Remove task parameter and calls to unlock.
12220 (Archive::unlock_nested_archives): New function.
12221 (Archive::read_header): Add nested_off parameter. Change
12222 all callers.
12223 (Archive::interpret_header): Likewise.
12224 (Archive::include_all_members): Change to handle thin
12225 archives.
12226 (Archive::include_member): Likewise.
12227 * archive.h (Archive::Archive): Add new parameters and
12228 initializers.
12229 (Archive::armagt): New const.
12230 (Archive::setup): Remove task parameter.
12231 (Archive::unlock_nested_archives): New function.
12232 (Archive::read_header): Add nested_off parameter.
12233 (Archive::interpret_header): Likewise.
12234 (Archive::Nested_archive_table): New typedef.
12235 (Archive::is_thin_archive_): New field.
12236 (Archive::nested_archives_): New field.
12237 (Archive::options_): New field.
12238 (Archive::dirpath_): New field.
12239 (Archive::task_): New field.
12240 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12241 for thin archives. Pass additional parameters to
12242 Archive::Archive. Unlock the archive file after calling
12243 Archive::setup.
cd536b21 12244
479f6503
ILT
122452008-03-29 Ian Lance Taylor <iant@google.com>
12246
686c8caf
ILT
12247 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12248 version symbol to be local.
12249 * testsuite/ver_test_4.sh: New file.
12250 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12251 (check_DATA): Add ver_test_4.syms.
12252 (ver_test_4.syms): New target.
12253 * testsuite/Makefile.in: Rebuild.
12254
ab794b6b
ILT
12255 * output.cc
12256 (Output_section::Input_section_sort_entry::has_priority): New
12257 function.
12258 (Output_section::Input_section_sort_entry::match_file_name): New
12259 function.
12260 (Output_section::Input_section_sort_entry::match_section_name):
12261 Remove.
12262 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12263 Remove.
12264 (Output_section::Input_section_sort_entry::match_section_file):
12265 Remove.
12266 (Output_section::Input_section_sort_compare::operator()): Rewrite
12267 using new Input_section_sort_entry functions. Sort crtbegin and
12268 crtend first. Sort sections with no priority before sections with
12269 a priority.
12270 * testsuite/initpri1.c (d3): Check j != 4.
12271 (cd5): New constructor/destructor function.
12272 (main): Check j != 2.
12273
479f6503
ILT
12274 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12275 new symbol when resolving, don't call set_is_default.
12276 * testsuite/ver_test_7.cc: New file.
12277 * testsuite/ver_test_7.sh: New file.
12278 * testsuite/Makefile.am (ver_test_7.so): New target.
12279 (ver_test_7.o): New target.
12280 (check_SCRIPTS): Add ver_test_7.sh.
12281 (check_DATA): Add ver_test_7.syms.
12282 (ver_test_7.syms): New target.
12283
2fd32231
ILT
122842008-03-28 Ian Lance Taylor <iant@google.com>
12285
12286 * layout.cc (Layout::layout): If we see an input section with a
12287 name that needs sorting, set the must_sort flag for the output
12288 section.
12289 (Layout::make_output_section): If the name of the output section
12290 indicates that it might require sorting, set the may_sort flag.
12291 * output.h (Output_section::may_sort_attached_input_sections): New
12292 function.
12293 (Output_section::set_may_sort_attached_input_sections): New
12294 function.
12295 (Output_section::must_sort_attached_input_sections): New
12296 function.
12297 (Output_section::set_must_sort_attached_input_sections): New
12298 function.
12299 (class Output_section): Declare Input_section_sort_entry. Define
12300 Input_section_sort_compare. Declare
12301 sort_attached_input_sections. Add new fields:
12302 may_sort_attached_input_sections_,
12303 must_sort_attached_input_sections_,
12304 attached_input_sections_are_sorted_.
12305 * output.cc (Output_section::Output_section): Initialize new
12306 fields.
12307 (Output_section::add_input_section): Add an entry to
12308 input_sections_ if may_sort or must_sort are true.
12309 (Output_section::set_final_data_size): Call
12310 sort_attached_input_sections if necessary.
12311 (Output_section::Input_section_sort_entry): Define new class.
12312 (Output_section::Input_section_sort_compare::operator()): New
12313 function.
12314 (Output_section::sort_attached_input_sections): New function.
12315 * configure.ac: Check whether the compiler supports constructor
12316 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12317 * testsuite/initpri1.c: New file.
12318 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12319 CONSTRUCTOR_PRIORITY.
12320 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12321 (initpri1_LDFLAGS): New variable.
12322 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12323
18e6b24e
ILT
123242008-03-27 Ian Lance Taylor <iant@google.com>
12325
49bdd526
ILT
12326 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12327 * testsuite/common_test_1.c: New file.
12328 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12329 (common_test_1_SOURCES): New variable.
12330 (common_test_1_DEPENDENCIES): New variable.
12331 (common_test_1_LDFLAGS): New variable.
12332
18e6b24e
ILT
12333 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12334 and commons_ correctly when NAME/VERSION does not override
12335 NAME/NULL.
12336 * testsuite/ver_test_6.c: New file.
12337 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12338 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12339 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12340
04bf7072
ILT
123412008-03-26 Ian Lance Taylor <iant@google.com>
12342
5871526f
ILT
12343 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12344 of an undefined symbol from a version script.
12345 * testsuite/Makefile.am (ver_test_5.so): New target.
12346 (ver_test_5.o): New target.
12347 (check_SCRIPTS): Add ver_test_5.sh.
12348 (check_DATA): Add ver_test_5.syms.
12349 (ver_test_5.syms): New target.
12350 * testsuite/ver_test_5.cc: New file.
12351 * testsuite/ver_test_5.script: New file.
12352 * testsuite/ver_test_5.sh: New file.
12353 * Makefile.in, testsuite/Makefile.in: Rebuild.
12354
04bf7072
ILT
12355 PR gold/5986
12356 Fix problems building gold with gcc 4.3.0.
12357 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12358 (gold_error_at_location, gold_warning_at_location): Use it.
12359 * configure.ac: Check whether we can compile and use a template
12360 function with a printf attribute.
12361 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12362 when jumping over bytes.
12363 * object.cc: Instantiate Object::read_section_data.
12364 * debug.h: Include <cstring>
12365 * dwarf_reader.cc: Include <algorithm>
12366 * main.cc: Include <cstring>.
12367 * options.cc: Include <cstring>.
12368 * output.cc: Include <cstring>.
12369 * script.cc: Include <cstring>.
12370 * script.h: Include <string>.
12371 * symtab.cc: Include <cstring> and <algorithm>.
12372 * target-select.cc: Include <cstring>.
12373 * version.cc: Include <string>.
12374 * testsuite/testmain.cc: Include <cstdlib>.
12375 * configure, config.in: Rebuild.
12376
874c5b28
ILT
123772008-03-25 Ian Lance Taylor <iant@google.com>
12378
819d6c3a
ILT
12379 * options.cc: Include "../bfd/bfdver.h".
12380 (options::help): Print bug reporting address.
12381
f4b2c6f5
ILT
12382 * version.cc (print_version): Adjust output for current value of
12383 BFD_VERSION_STRING.
12384
12385 * NEWS: New file.
12386
e96caa79
ILT
12387 * options.cc (options::help): Print list of supported targets.
12388 * target-select.h: Include <vector>.
12389 (class Target_selector): Make machine_, size_, and is_big_endian_
12390 fields const. Add bfd_name_ and instantiated_target_ fields.
12391 (Target_selector::Target_selector): Add bfd_name parameter.
12392 (Target_selector::recognize): Make non-virtual, call
12393 do_recognize.
12394 (Target_selector::recognize_by_name): Make non-virtual, call
12395 do_recognize_by_name.
12396 (Target_selector::supported_names): New function.
12397 (Target_selector::bfd_name): New function.
12398 (Target_selector::do_instantiate_target): New pure virtual
12399 function.
12400 (Target_selector::do_recognize): New virtual function.
12401 (Target_selector::do_recognize_by_name): New virtual function.
12402 (Target_selector::instantiate_target): New private function.
12403 (supported_target_names): Declare.
12404 * target-select.cc (Target_selector::Target_selector): Update for
12405 new parameter and fields.
12406 (select_target_by_name): Check that the name matches before
12407 calling recognize_by_name.
12408 (supported_target_names): New function.
12409 * i386.cc (class Target_selector_i386): Update Target_selector
12410 constructor call. Remove recognize and recognize_by_name. Add
12411 do_instantiate_target.
12412 * x86_64.cc (class Target_selector_x86_64): Likewise.
12413 * testsuite/testfile.cc (class Target_selector_test): Update for
12414 changes to Target_selector.
12415
874c5b28
ILT
12416 * README: Rewrite, with some notes on unsupported features.
12417
0a65a3a7
CC
124182008-03-24 Cary Coutant <ccoutant@google.com>
12419
12420 * i386.cc (Target_i386::Got_type): New enum declaration.
12421 (Target_i386::Scan::local): Updated callers of Output_data_got
12422 member functions.
12423 (Target_i386::Scan::global): Likewise.
12424 (Target_i386::Relocate::relocate): Likewise.
12425 (Target_i386::Relocate::relocate_tls): Likewise.
12426 * object.h (Got_offset_list): New class.
12427 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12428 (Sized_relobj::local_got_offset): Likewise.
12429 (Sized_relobj::set_local_got_offset): Likewise.
12430 (Sized_relobj::local_has_tls_got_offset): Removed.
12431 (Sized_relobj::local_tls_got_offset): Removed.
12432 (Sized_relobj::set_local_tls_got_offset): Removed.
12433 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12434 * output.cc (Output_data_got::add_global): Added got_type parameter.
12435 (Output_data_got::add_global_with_rel): Likewise.
12436 (Output_data_got::add_global_with_rela): Likewise.
12437 (Output_data_got::add_global_pair_with_rel): New function.
12438 (Output_data_got::add_global_pair_with_rela): New function.
12439 (Output_data_got::add_local): Added got_type parameter.
12440 (Output_data_got::add_local_with_rel): Likewise.
12441 (Output_data_got::add_local_with_rela): Likewise.
12442 (Output_data_got::add_local_pair_with_rel): New function.
12443 (Output_data_got::add_local_pair_with_rela): New function.
12444 (Output_data_got::add_global_tls): Removed.
12445 (Output_data_got::add_global_tls_with_rel): Removed.
12446 (Output_data_got::add_global_tls_with_rela): Removed.
12447 (Output_data_got::add_local_tls): Removed.
12448 (Output_data_got::add_local_tls_with_rel): Removed.
12449 (Output_data_got::add_local_tls_with_rela): Removed.
12450 * output.h (Output_data_got::add_global): Added got_type parameter.
12451 (Output_data_got::add_global_with_rel): Likewise.
12452 (Output_data_got::add_global_with_rela): Likewise.
12453 (Output_data_got::add_global_pair_with_rel): New function.
12454 (Output_data_got::add_global_pair_with_rela): New function.
12455 (Output_data_got::add_local): Added got_type parameter.
12456 (Output_data_got::add_local_with_rel): Likewise.
12457 (Output_data_got::add_local_with_rela): Likewise.
12458 (Output_data_got::add_local_pair_with_rel): New function.
12459 (Output_data_got::add_local_pair_with_rela): New function.
12460 (Output_data_got::add_global_tls): Removed.
12461 (Output_data_got::add_global_tls_with_rel): Removed.
12462 (Output_data_got::add_global_tls_with_rela): Removed.
12463 (Output_data_got::add_local_tls): Removed.
12464 (Output_data_got::add_local_tls_with_rel): Removed.
12465 (Output_data_got::add_local_tls_with_rela): Removed.
12466 * resolve.cc (Symbol::override_base_with_special): Removed
12467 reference to has_got_offset_ field.
12468 * symtab.cc (Symbol::init_fields): Replaced initialization
12469 of got_offset_ with got_offsets_. Removed initialization
12470 of has_got_offset_
53fcba31 12471 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
12472 (Symbol::got_offset): Likewise.
12473 (Symbol::set_got_offset): Likewise.
12474 (Symbol::has_tls_got_offset): Removed.
12475 (Symbol::tls_got_offset): Removed.
12476 (Symbol::set_tls_got_offset): Removed.
12477 (Symbol::got_offset_): Removed.
12478 (Symbol::tls_mod_got_offset_): Removed.
12479 (Symbol::tls_pair_got_offset_): Removed.
12480 (Symbol::got_offsets_): New field.
12481 (Symbol::has_got_offset): Removed.
12482 (Symbol::has_tls_mod_got_offset): Removed.
12483 (Symbol::has_tls_pair_got_offset): Removed.
12484 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12485 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12486 member functions.
12487 (Target_x86_64::Scan::global): Likewise.
12488 (Target_x86_64::Relocate::relocate): Likewise.
12489 (Target_x86_64::Relocate::relocate_tls): Likewise.
12490
bd52eafb
BE
124912008-03-25 Ben Elliston <bje@au.ibm.com>
12492
12493 * yyscript.y: Fix spelling error in comment.
12494
8b105e34
ILT
124952008-03-24 Ian Lance Taylor <iant@google.com>
12496
8ed814a9
ILT
12497 * options.h (class General_options): Define build_id option.
12498 * layout.h (class Layout): Declare write_build_id, create_note,
12499 create_build_id. Add build_id_note_ member.
12500 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12501 "libiberty.h", "md5.h", "sha1.h".
12502 (Layout::Layout): Initialize eh_frame_data_,
12503 eh_frame_hdr_section_, and build_id_note_.
12504 (Layout::finalize): Call create_build_id.
12505 (Layout::create_note): New function, broken out of
12506 Layout::create_gold_note.
12507 (Layout::create_gold_note): Call create_note.
12508 (Layout::create_build_id): New function.
12509 (Layout::write_build_id): New function.
12510 (Close_task_runner::run): Call write_build_id.
12511
8b105e34
ILT
12512 * x86_64.cc: Correct license to GPLv3.
12513
086a1841
ILT
125142008-03-23 Ian Lance Taylor <iant@google.com>
12515
12516 * options.cc: Include "demangle.h".
12517 (parse_optional_string): New function.
12518 (parse_long_option): Handle takes_optional_argument.
12519 (parse_short_option): Update dash_z initializer. Handle
12520 takes_optional_argument.
12521 (General_options::General_options): Initialize do_demangle_.
12522 (General_options::finalize): Set do_demangle_. Handle demangling
12523 style.
12524 * options.h (parse_optional_string): Declare.
12525 (struct One_option): Add optional_arg field. Update constructor.
12526 Update call constructor calls. Add takes_optional_argument
12527 function.
12528 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12529 (DEFINE_optional_string): Define.
12530 (General_options::demangle): Change from DEFINE_bool to
12531 DEFINE_optional_string.
12532 (General_options::no_demangle): New function.
12533 (General_options::do_demangle): New function.
12534 (General_options::set_do_demangle): New function.
12535 (General_options::execstack_status_): Move definition to end of
12536 class definition.
12537 (General_options::static_): Likewise.
12538 (General_options::do_demangle_): New field.
12539 * object.cc (big_endian>::get_symbol_location_info): Call
12540 Options::do_demangle, not Options::demangle.
12541 * symtab.cc (demangle): Likewise.
12542
cbb93e63
ILT
125432008-03-22 Ian Lance Taylor <iant@google.com>
12544
12545 * gold.h: Include <cstddef> and <sys/types.h>
12546 * options.h: Include <cstring>.
12547
ec531623
ILT
125482008-03-21 Ian Lance Taylor <iant@google.com>
12549
12550 * Added source code to GNU binutils.
This page took 0.720872 seconds and 4 git commands to generate.