PR gdb/13596:
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
90cff06f
DK
12012-02-02 Doug Kwan <dougkwan@google.com>
2
3 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4 position independent outputs, not just shared objects.
5
63887f3d
L
62012-01-30 H.J. Lu <hongjiu.lu@intel.com>
7
8 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
9 * configure: Regenerated.
10
bef2b434
ILT
112012-01-27 Ian Lance Taylor <iant@google.com>
12
13 * reloc.h (Bits): New class with static functions, copied from
14 namespace utils in arm.cc.
15 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
16 instead.
17
c335b55d
L
182012-01-27 H.J. Lu <hongjiu.lu@intel.com>
19
20 * incremental.cc (write_info_blocks): Correct relocation offset.
21
41194d9f
L
222012-01-27 H.J. Lu <hongjiu.lu@intel.com>
23
24 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
25 (Relocate::tls_gd_to_le): Likewise.
26
1bae613c
L
272012-01-27 H.J. Lu <hongjiu.lu@intel.com>
28
29 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
30
24482ca0
L
312012-01-27 H.J. Lu <hongjiu.lu@intel.com>
32
33 * configure.ac: Check if -mcmodel=medium works.
34 * configure: Regenerated.
35
c2c7840a
CC
362012-01-24 Cary Coutant <ccoutant@google.com>
37
38 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
39 definition and ...
40 (read_unsigned_LEB_128_x): ... this new function.
41 (read_signed_LEB_128): Replaced with inline definition and ...
42 (read_signed_LEB_128_x): ... this new function.
43 * int_encoding.h (read_unsigned_LEB_128_x): New function.
44 (read_unsigned_LEB_128): Add inline definition.
45 (read_signed_LEB_128_x): New function.
46 (read_signed_LEB_128): Add inline definition.
47 * testsuite/Makefile.am (leb128_unittest): New unit test.
48 * testsuite/Makefile.in: Regenerate.
49 * testsuite/leb128_unittest.cc: New unit test.
50
833de760 512012-01-23 Ian Lance Taylor <iant@google.com>
9dee3b3c
ILT
52
53 PR gold/13617
54 * i386.cc (Target_i386::do_code_fill): When using a jmp
55 instruction, pad with nop instructions.
56 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
57
618d6666
L
582012-01-22 H.J. Lu <hongjiu.lu@intel.com>
59
60 * x86_64.cc (gc_process_relocs): Add typename on types used in
61 template.
62 (scan_relocs): Likewise.
63 (relocate_section): Likewise.
64 (apply_relocation): Likewise.
65
3660ff06
L
662012-01-10 H.J. Lu <hongjiu.lu@intel.com>
67
68 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
69 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
70 under x32.
71
fc51264f
L
722012-01-09 H.J. Lu <hongjiu.lu@intel.com>
73
74 * x86_64.cc: Initial support for x32.
75
dd74ae06
CC
762012-01-03 Cary Coutant <ccoutant@google.com>
77
78 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
79 Use abstract base class for GOT.
80 * gold/output.h (class Output_data_got_base): New abstract base class.
81 (class Output_data_got): Derive from new base class, adjust ctors.
82 (Output_data_got::reserve_slot): Make virtual; rename to
83 do_reserve_slot; Adjust callers.
84 * gold/target.h (Sized_target::init_got_plt_for_update): Return
85 pointer to abstract base class.
86 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
87
83896202
ILT
882011-12-18 Ian Lance Taylor <iant@google.com>
89
90 * object.h (Relobj::local_symbol_value): New function.
91 (Relobj::local_plt_offset): New function.
92 (Relobj::local_has_got_offset): New function.
93 (Relobj::local_got_offset): New function.
94 (Relobj::set_local_got_offset): New function.
95 (Relobj::do_local_symbol_value): New pure virtual function.
96 (Relobj::do_local_plt_offset): Likewise.
97 (Relobj::do_local_has_got_offset): Likewise.
98 (Relobj::do_local_got_offset): Likewise.
99 (Relobj::do_set_local_got_offset): Likewise.
100 (Sized_relobj::do_local_has_got_offset): Rename from
101 local_has_got_offset.
102 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
103 (Sized_relobj::do_set_local_got_offset): Rename from
104 set_local_got_offset.
105 (Sized_relobj_file::do_local_plt_offset): Rename from
106 local_plt_offset.
107 (Sized_relobj_file::do_local_symbol_value): New function.
108 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
109 local_plt_offset.
110 * output.cc (Output_data_got::Got_entry::write): Change object to
111 Relobj. Use local_symbol_value.
112 (Output_data_got::add_global_with_rel): Change rel_dyn to
113 Output_data_reloc_generic*. Use add_global_generic.
114 (Output_data_got::add_global_with_rela): Remove. Change all
115 callers to use add_global_with_rel.
116 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
117 Output_data_reloc_generic*. Use add_global_generic.
118 (Output_data_got::add_global_pair_with_rela): Remove. Change all
119 callers to use add_global_pair_with_rel.
120 (Output_data_got::add_local): Change object to Relobj*.
121 (Output_data_got::add_local_plt): Likewise.
122 (Output_data_got::add_local_with_rel): Change object to Relobj*,
123 change rel_dyn to Output_data_reloc_generic*. Use
124 add_local_generic.
125 (Output_data_got::add_local_with_rela): Remove. Change all
126 callers to use all_local_with_rel.
127 (Output_data_got::add_local_pair_with_rel): Change object to
128 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
129 add_output_section_generic.
130 (Output_data_got::add_local_pair_with_rela): Remove. Change all
131 callers to use add_local_pair_with_rel.
132 (Output_data_got::reserve_local): Change object to Relobj*.
133 * output.h: (class Output_data_reloc_generic): Add pure virtual
134 declarations for add_global_generic, add_local_generic,
135 add_output_section_generic.
136 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
137 functions for Output_data_reloc_generic. Update declarations for
138 changes listed in output.cc.
139 (class Output_data_got): Change template parameter to got_size.
140 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
141 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
142 function.
143 (Sized_relobj_incr::do_local_plt_offset): New function.
144 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
145 add_global_generic.
146
76677ad0
CC
1472011-12-17 Cary Coutant <ccoutant@google.com>
148
149 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
150 * resolve.cc (Symbol_table::resolve): Likewise.
151 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
152 arrays.
153 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
154
8b8dd8d5
ILT
1552011-12-16 Ian Lance Taylor <iant@google.com>
156
157 * output.h (Output_data_reloc_generic::add): Only call
158 add_dynamic_reloc if this is a dynamic reloc section.
159
d55525b9
L
1602011-12-15 H.J. Lu <hongjiu.lu@intel.com>
161
162 PR gold/13505
163 * target-reloc.h (apply_relocation): Replace <64, false> with
164 <size, big_endian>.
165
ff81c7c1
NC
1662011-11-25 Nick Clifton <nickc@redhat.com>
167
168 * po/it.po: New Italian translation.
169
628f39be
SA
1702011-11-17 Sterling Augustine <saugustine@google.com>
171
172 * script.cc (script_include_directive): Implement.
173 (read_script_file): New local variables name and search_path. Update
174 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
175 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
176 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
177
98ef3ea4
SA
1782011-11-11 Sterling Augustine <saugustine@google.com>
179
180 * yyscript.y (section_cmd): Add support for INCLUDE directive.
181 (file_or_sections_cmd): Likewise.
182
f4a8b6d7
DK
1832011-11-11 Doug Kwan <dougkwan@google.com>
184
185 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
186 if --just-symbols is given.
187
29ab395d
DK
1882011-11-10 Doug Kwan <dougkwan@google.com>
189
190 PR gold/13362
191 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
192 when processing data relocs.
193 * reloc.h (Relocate_functions::rel_unaligned): New method.
194 (Relocate_functions::pcrel_unaligned): Ditto.
195 (Relocate_functions::rel32_unaligned): Ditto.
196 (Relocate_functions::pcrel32_unaligned): Ditto.
197
2c339f71
DK
1982011-11-09 Doug Kwan <dougkwan@google.com>
199
200 PR gold/13362
201 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
202 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
203 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
204 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
205 (Relocate_functions::rel_unaligned): New.
206 (Relocate_functions::rel32_unaligned): New.
207 * target-reloc.h (relocate_for_relocatable): Add code to handle
208 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
209 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
210 arm_unaligned_reloc_r): New targets.
211 * testsuite/Makefile.in: Regenerate.
212 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
213 linking.
214
3f3cddf1
ILT
2152011-11-02 Ian Lance Taylor <iant@google.com>
216
217 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
218 NATIVE_LINKER.
219 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
220 * options.cc (General_options::finalize): Use library search path
221 from configure script if specified. If not native and no sysroot,
222 only search TOOLLIBDIR.
223 * options.h (Search_directory::Search_directory): Change name to
224 const std::string&.
225 (General_options::add_to_library_path_with_sysroot): Change arg to
226 const std::string&.
227 * configure, Makefile.in, config.in: Rebuild.
228
a8e2273b
ILT
2292011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
230
231 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
232 we are working around the ARM1176 Erratum.
233 * options.h (General_options::fix_arm1176): Add option.
234 * testsuite/Makefile.am: Add testcases, and keep current ones
235 working.
236 * testsuite/Makefile.in: Regenerate.
237 * testsuite/arm_fix_1176.s: New file.
238 * testsuite/arm_fix_1176.sh: Likewise.
239
cd6eab1c
ILT
2402011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
241
242 * arm.cc (Target_arm::Target_arm): Remove initialisation of
243 may_use_blx_.
244 (Target_arm::may_use_blx): Remove method.
245 (Target_arm::set_may_use_blx): Likewise.
246 (Target_arm::may_use_v4t_interworking): New method.
247 (Target_arm::may_use_v5t_interworking): Likewise.
248 (Target_arm::may_use_blx_): Remove member variable.
249 (Arm_relocate_functions::arm_branch_common): Check for v5T
250 interworking.
251 (Arm_relocate_functions::thumb_branch_common): Likewise.
252 (Reloc_stub::stub_type_for_reloc): Likewise.
253 (Target_arm::do_finalize_sections): Correct interworking checks.
254 * testsuite/Makefile.am: Add new tests.
255 * testsuite/Makefile.in: Regenerate.
256 * testsuite/arm_farcall_arm_arm.s: New test.
257 * testsuite/arm_farcall_arm_arm.sh: Likewise.
258 * testsuite/arm_farcall_arm_thumb.s: Likewise.
259 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
260 * testsuite/arm_farcall_thumb_arm.s: Likewise.
261 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
262 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
263 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
264
286adcf4
CC
2652011-10-31 Cary Coutant <ccoutant@google.com>
266
267 PR gold/13023
268 * expression.cc (Expression::eval_with_dot): Add
269 is_section_dot_assignment parameter.
270 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
271 absolute and assigning to dot within a section.
272 * script-sections.cc
273 (Output_section_element_assignment::set_section_addresses): Pass
274 dot_section to set_if_absolute.
275 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
276 as is_section_dot_assignment flag to eval_with_dot.
277 (Output_section_element_dot_assignment::set_section_addresses):
278 Likewise.
279 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
280 parameter. Also set value if relative to dot_section; set the
281 symbol's output_section.
282 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
283 parameter. Adjust all callers.
284 (Expression::eval_maybe_dot): Likewise.
285 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
286 Adjust all callers.
287 * testsuite/script_test_2.t: Test assignment of an absolute value
288 to dot within an output section element.
289
9634ed06
CC
2902011-10-31 Cary Coutant <ccoutant@google.com>
291
292 * options.h (class General_options): Add --[no-]gnu-unique options.
293 * symtab.cc (Symbol_table::sized_write_globals): Convert
294 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
295
de4101c7
CC
2962011-10-31 Cary Coutant <ccoutant@google.com>
297
298 PR gold/13359
299 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
300 unnecessary assertion.
301 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
302
7257cc92
ST
3032011-10-31 Sriraman Tallam <tmsriram@google.com>
304
305 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
306 gc_mark_symbol.
307 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
308 gc_mark_symbol.
309 Change to just keep the section associated with symbol.
310 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
311 they are externally visible and --export-dynamic is turned on.
312 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
313
bfc34b3f
ILT
3142011-10-19 Ian Lance Taylor <iant@google.com>
315
316 PR gold/13163
317 * script-sections.cc
318 (Output_section_element_dot_assignment::needs_output_section): New
319 function.
320
ea0d8c47
ILT
3212011-10-19 Ian Lance Taylor <iant@google.com>
322
323 PR gold/13204
324 * layout.cc (Layout::segment_precedes): Don't assert failure if a
325 --section-start option was seen.
326 * options.h (General_options::any_section_start): New function.
327
abd242a9
DM
3282011-10-18 David S. Miller <davem@davemloft.net>
329
330 PR binutils/13301
331 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
332 member to track relocation locations that have moved during TLS
333 reloc optimizations.
334 (Target_sparc::Relocate::Relocate): Initialize to NULL.
335 (Target_sparc::Relocate::relocate): Adjust view down by 4
336 bytes if it matches reloc_adjust_addr_.
337 (Target_sparc::Relocate::relocate_tls): Always move the
338 __tls_get_addr call delay slot instruction forward 4 bytes when
339 performing relaxation.
340
bab9090f
CC
3412011-10-18 Cary Coutant <ccoutant@google.com>
342
343 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
344 (Output_file::map_no_anonymous): Check for non-zero
345 return code from posix_fallocate.
346
f7c5b166
CC
3472011-10-17 Cary Coutant <ccoutant@google.com>
348
349 PR gold/13245
350 * plugin.cc (is_visible_from_outside): Check for symbols
351 referenced from dynamic objects.
352 * resolve.cc (Symbol_table::resolve): Don't count references
353 from dynamic objects as references from real ELF files.
354 * testsuite/plugin_test_2.sh: Adjust expected result.
355
b490c0bb
CC
3562011-10-17 Cary Coutant <ccoutant@google.com>
357
358 * gold.cc: Include timer.h.
359 (queue_middle_tasks): Stamp time.
360 (queue_final_tasks): Likewise.
361 * main.cc (main): Store timer in parameters. Print timers
362 for each pass.
363 * parameters.cc (Parameters::Parameters): Initialize timer_.
364 (Parameters::set_timer): New function.
365 (set_parameters_timer): New function.
366 * parameters.h (Parameters::set_timer): New function.
367 (Parameters::timer): New function.
368 (Parameters::timer_): New data member.
369 (set_parameters_timer): New function.
370 * timer.cc (Timer::stamp): New function.
371 (Timer::get_pass_time): New function.
372 * timer.h (Timer::stamp): New function.
373 (Timer::get_pass_time): New function.
374 (Timer::pass_times_): New data member.
375
f475cf7b
CC
3762011-10-17 Cary Coutant <ccoutant@google.com>
377
378 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
379 task for members of lib groups.
380
cdd7e244
CC
3812011-10-17 Cary Coutant <ccoutant@google.com>
382
383 PR gold/13288
4f95c8b4 384 * fileread.cc (File_read::find_view): Add assert.
cdd7e244
CC
385 (File_read::make_view): Move bounds check (replace with assert)...
386 (File_read::find_or_make_view): ... to here.
387
dfb45471
CC
3882011-10-12 Cary Coutant <ccoutant@google.com>
389
4f95c8b4 390 * output.cc (Output_file::open_base_file): Handle case where
dfb45471
CC
391 ::read returns less than requested size.
392
53bbcc1b
CC
3932011-10-10 Cary Coutant <ccoutant@google.com>
394
4f95c8b4 395 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
53bbcc1b
CC
396 Initialize defined_count_.
397 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
398 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
399 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
400 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
401 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4f95c8b4 402 * incremental.h (Sized_relobj_incr::defined_count_): New data
53bbcc1b
CC
403 member.
404 (Sized_incr_dynobj::defined_count_): New data member.
4f95c8b4 405 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
53bbcc1b
CC
406 Return zeroes instead of internal error.
407
397b129b
CC
4082011-10-10 Cary Coutant <ccoutant@google.com>
409
410 PR gold/13249
4f95c8b4 411 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
397b129b 412 (Output_reloc::symbol_value): Return PLT offset if flag is set.
4f95c8b4 413 * output.h (class Output_reloc): Add use_plt_offset flag.
397b129b
CC
414 (Output_reloc::type_): Adjust size of bit field.
415 (Output_reloc::use_plt_offset_): New bit field.
416 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
417 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
418 flag. Adjust all callers.
4f95c8b4 419 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
397b129b
CC
420 creating RELATIVE relocations.
421
d5698657
NC
4222011-10-10 Nick Clifton <nickc@redhat.com>
423
424 * po/es.po: Updated Spanish translation.
425 * po/fi.po: Updated Finnish translation.
426
6a59a5c2
DN
4272011-10-03 Diego Novillo <dnovillo@google.com>
428
429 * options.cc (parse_uint): Fix dereference of RETVAL.
430
f0558624
ST
4312011-09-29 Sriraman Tallam <tmsriram@google.com>
432
433 * layout.h (section_order_map_): New member.
434 (get_section_order_map): New member function.
435 * output.cc (Output_section::add_input_section): Check for patterns
436 only when --section-ordering-file is specified.
437 * gold.cc (queue_middle_tasks): Delay updating order of sections till
438 output_sections have been formed.
439 * layout.cc (Layout_Layout): Initialize section_order_map_.
440 * plugin.cc (update_section_order): Store order in order_map. Do not
441 update the order.
442 * testsuite/Makefile.am: Add test case for plugin_final_layout.
443 * testsuite/Makefile.in: Regenerate.
444 * testsuite/plugin_section_order.c: New file.
445 * testsuite/plugin_final_layout.cc: New file.
446 * testsuite/plugin_final_layout.sh: New file.
447
a7dac153
CC
4482011-09-29 Cary Coutant <ccoutant@google.com>
449
4f95c8b4 450 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
a7dac153 451 Check for NULL.
4f95c8b4 452 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
a7dac153
CC
453 symbols during incremental update.
454 (Symbol_table::add_from_dynobj): Likewise.
455
eebd87a5
ILT
4562011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
457 Ian Lance Taylor <iant@google.com>
458
459 * symtab.cc (Symbol_table::define_special_symbol): Always
460 canonicalize version string.
461
403a3331
CC
4622011-09-26 Cary Coutant <ccoutant@google.com>
463
4f95c8b4
CC
464 * gold.cc (queue_initial_tasks): Move option checks ...
465 * options.cc (General_options::finalize): ... to here. Disable
403a3331
CC
466 some options; make others fatal.
467
235061c2
CC
4682011-09-26 Cary Coutant <ccoutant@google.com>
469
470 gcc PR lto/47247
471 * plugin.cc (get_symbols_v2): New function.
472 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
473 (is_referenced_from_outside): New function.
474 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
475 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
476 (get_symbols): Pass version parameter.
477 (get_symbols_v2): New function.
478 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
479 parameter.
480 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
481 (onload): Add LDPT_GET_SYMBOLS_V2.
482 (all_symbols_read_hook): Use get_symbols_v2; check for
483 LDPR_PREVAILING_DEF_IRONLY_EXP.
484 * testsuite/plugin_test_3.sh: Update expected results.
485
dc87f620
ILT
4862011-09-23 Simon Baldwin <simonb@google.com>
487
488 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
489 configuration options.
490 * configure: Regenerate.
491 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
492 * Makefile.in: Regenerate.
493 * testsuite/Makefile.in: Regenerate.
494
a8279f82
ST
4952011-09-19 Sriraman Tallam <tmsriram@google.com>
496
497 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
498
0c9350c8
CC
4992011-09-19 Cary Coutant <ccoutant@google.com>
500
501 * incremental.cc (can_incremental_update): Fix typo in comment.
502 * incremental.h (can_incremental_update): Likewise.
503
aa06ae28
CC
5042011-09-18 Cary Coutant <ccoutant@google.com>
505
506 * incremental.cc (can_incremental_update): New function.
507 * incremental.h (can_incremental_update): New function.
508 * layout.cc (Layout::init_fixed_output_section): Call it.
509 (Layout::make_output_section): Don't allow patch space in .eh_frame.
510 * object.cc (Sized_relobj_file::do_layout): Call
511 can_incremental_update.
512
ebb300b2
CC
5132011-09-13 Cary Coutant <ccoutant@google.com>
514
515 * configure.ac: Check for glibc support for gnu_indirect_function
516 support with static linking, setting automake conditional
517 IFUNC_STATIC.
518 * Makefile.in: Regenerate.
519 * configure: Regenerate.
520
521 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
522 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
523 for IFUNC_STATIC.
524 * testsuite/Makefile.in: Regenerate.
525
1206d0d5
CC
5262011-09-13 Cary Coutant <ccoutant@google.com>
527
528 * incremental.cc (Sized_relobj_incr::do_layout): Call
529 report_comdat_group for kept comdat sections.
530 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
531 * testsuite/Makefile.in: Regenerate.
532 * testsuite/incr_comdat_test_1.cc: New source file.
533 * testsuite/incr_comdat_test_2_v1.cc: New source file.
534 * testsuite/incr_comdat_test_2_v2.cc: New source file.
535 * testsuite/incr_comdat_test_2_v3.cc: New source file.
536
40b29874
ILT
5372011-09-13 Ian Lance Taylor <iant@google.com>
538
539 * object.cc (Sized_relobj_file::do_layout): Remove unused local
540 variable external_symbols_offset.
541
1b045aac
ILT
5422011-09-12 Ian Lance Taylor <iant@google.com>
543
544 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
545 triggered if object has no symbols.
546
24c6c55a
DM
5472011-09-09 David S. Miller <davem@davemloft.net>
548
549 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
550 (Output_fill_debug_line::do_write): Likewise.
551
66570254
CC
5522011-08-29 Cary Coutant <ccoutant@google.com>
553
554 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
555 casts to match formatting specs.
556 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
557
8ea8cd50
CC
5582011-08-26 Cary Coutant <ccoutant@google.com>
559
560 * layout.cc (Free_list::allocate): Provide guarantee of minimum
561 remaining hole size when allocating.
562 (Layout::make_output_section): Set fill methods for debug sections.
563 * layout.h (Free_list::Free_list_node): Move from private to
564 public.
565 (Free_list::set_min_hole_size): New function.
566 (Free_list::begin, Free_list::end): New functions.
567 (Free_list::min_hole_): New data member.
568 * output.cc: Include dwarf.h.
569 (Output_fill_debug_info::do_minimum_hole_size): New function.
570 (Output_fill_debug_info::do_write): New function.
571 (Output_fill_debug_line::do_minimum_hole_size): New function.
572 (Output_fill_debug_line::do_write): New function.
573 (Output_section::Output_section): Initialize new data member.
574 (Output_section::set_final_data_size): Ensure patch space is larger
575 than minimum hole size.
576 (Output_section::do_write): Fill holes in debug sections.
577 * output.h (Output_fill): New class.
578 (Output_fill_debug_info): New class.
579 (Output_fill_debug_line): New class.
580 (Output_section::set_free_space_fill): New function.
581 (Output_section::free_space_fill_): New data member.
582 * testsuite/Makefile.am (incremental_test_3): Add
583 --incremental-patch option.
584 (incremental_test_4): Likewise.
585 (incremental_test_5): Likewise.
586 (incremental_test_6): Likewise.
587 (incremental_copy_test): Likewise.
588 (incremental_common_test_1): Likewise.
589 * testsuite/Makefile.in: Regenerate.
590
7cf80422
NC
5912011-08-26 Nick Clifton <nickc@redhat.com>
592
593 * po/es.po: Updated Spanish translation.
594
c3f7b0e5
CC
5952011-08-01 Cary Coutant <ccoutant@google.com>
596
597 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
598 * gold/testsuite/Makefile.in: Regenerate.
599 * gold/testsuite/justsyms_exec.c: New source file.
600 * gold/testsuite/justsyms_lib.c: New source file.
601
9590bf25
CC
6022011-08-01 Cary Coutant <ccoutant@google.com>
603
604 * layout.cc (Layout::set_segment_offsets): Don't realign text
605 segment if -Ttext was specified.
606 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
607 file type.
608 * object.h (Sized_relobj_file::e_type): New function.
609 (Sized_relobj_file::e_type_): New data member.
610 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
611 base address for ET_EXEC files.
612 * target.cc (Target::do_make_elf_object_implementation): Allow
613 ET_EXEC files with --just-symbols option.
614
dcd8d12e
CC
6152011-07-28 Cary Coutant <ccoutant@google.com>
616
617 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
618 Add thread_number parameter.
619 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
620 * workqueue-threads.cc
621 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
622 current thread if its thread number is greater than desired thread
623 count.
624 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
625 Add thread_number parameter.
626 (Workqueue::should_cancel_thread): Likewise.
627 (Workqueue::find_runnable_or_wait): Pass thread_number to
628 should_cancel_thread.
629 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
630 parameter.
631
804eb480
ST
6322011-07-22 Sriraman Tallam <tmsriram@google.com>
633
634 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
635 only after checking if it cannot be forced local.
636 * symtab.h (is_externally_visible): Check if the symbol is not forced
637 local.
638
f1ddb600
ILT
6392011-07-15 Ian Lance Taylor <iant@google.com>
640
641 * options.h (class General_options): Add --print-output-format.
642 Move -EL next to -EB, for better --help output.
643 * target-select.cc: Include <cstdio>, "options.h", and
644 "parameters.h".
645 (Target_selector::do_target_bfd_name): New function.
646 (print_output_format): New function.
647 * target-select.h (class Target_selector): Update declarations.
648 (Target_selector::target_bfd_name): New function.
649 (print_output_format): Declare.
650 * main.cc: Include "target-select.h".
651 (main): Handle --print-output-format.
652 * gold.cc: Include "target-select.h".
653 (queue_initial_tasks): Handle --print-output-format when there are
654 no input files.
655 * parameters.cc (parameters_force_valid_target): Give a better
656 error message if -EB/-EL does not match target.
657 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
658 function.
659
7d172687
ILT
6602011-07-15 Ian Lance Taylor <iant@google.com>
661
662 * i386.cc (class Output_data_plt_i386): Add layout_ field.
663 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
664 (Output_data_plt_i386::do_write): Write address of .dynamic
665 section to first entry in .got.plt section.
666 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
667 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
668 Initialize layout_.
669 (Output_data_plt_x86_64::do_write): Write address of .dynamic
670 section to first entry in .got.plt section.
671 * layout.h (Layout::dynamic_section): New function.
672
e9552f7e
ST
6732011-07-13 Sriraman Tallam <tmsriram@google.com>
674
675 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
676 to claim_file call.
677 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
678 input_section_position_, and input_section_glob_.
679 (read_layout_from_file): Call function section_ordering_specified.
680 * layout.h (is_section_ordering_specified): New function.
681 (section_ordering_specified): New function.
682 (section_ordering_specified_): New boolean member.
683 * main.cc(main): Call load_plugins after layout object is defined.
684 * output.cc (Output_section::add_input_section): Use
685 function section_ordering_specified to check if section ordering is
686 needed.
687 * output.cc (Output_section::add_relaxed_input_section): Use
688 function section_ordering_specified to check if section ordering is
689 needed.
690 (Output_section::update_section_layout): New function.
691 (Output_section::sort_attached_input_sections): Check if input section
692 must be reordered.
693 * output.h (Output_section::update_section_layout): New function.
694 * plugin.cc (get_section_count): New function.
695 (get_section_type): New function.
696 (get_section_name): New function.
697 (get_section_contents): New function.
698 (update_section_order): New function.
699 (allow_section_ordering): New function.
700 (Plugin::load): Add the new interfaces to the transfer vector.
701 (Plugin_manager::load_plugins): New parameter.
702 (Plugin_manager::all_symbols_read): New parameter.
703 (Plugin_manager::claim_file): New parameter. Save the elf object for
704 unclaimed objects.
705 (Plugin_manager::get_elf_object): New function.
706 (Plugin_manager::get_view): Change to directly use the bool to check
707 if get_view is called from claim_file_hook.
708 * plugin.h (input_objects): New function
709 (Plugin__manager::load_plugins): New parameter.
710 (Plugin_manager::claim_file): New parameter.
711 (Plugin_manager::get_elf_object): New function.
712 (Plugin_manager::in_claim_file_handler): New function.
713 (Plugin_manager::in_claim_file_handler_): New member.
714 (layout): New function.
715 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
716 handler with an extra parameter. Make the elf object before calling
717 claim_file handler.
718 * testsuite/plugin_test.c (get_section_count): New function pointer.
719 (get_section_type): New function pointer.
720 (get_section_name): New function pointer.
721 (get_section_contents): New function pointer.
722 (update_section_order): New function pointer.
723 (allow_section_ordering): New function pointer.
724 (onload): Check if the new interfaces exist.
725
9446efde
ILT
7262011-07-13 Ian Lance Taylor <iant@google.com>
727
728 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
729 relro section.
730 * x86_64.cc (Target_x86_64::got_section): Likewise.
731 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
732 (relro_now_test_SOURCES): New variable.
733 (relro_now_test_DEPENDENCIES): New variable.
734 (relro_now_test_LDFLAGS): New variable.
735 (relro_now_test_LDADD): New variable.
736 (relro_now_test.so): New target.
737 * testsuite/Makefile.in: Rebuild.
738
07aa62f2
ILT
7392011-07-12 Ian Lance Taylor <iant@google.com>
740
741 PR gold/12980
742 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
743 GLOB_DAT relocation rather than a RELATIVE relocation for a
744 protected symbol when creating a shared library.
745 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
746 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
747 * testsuite/protected_main_1.cc (main): Test that protected
748 function has same address.
749
e2153196
ILT
7502011-07-11 Ian Lance Taylor <iant@google.com>
751
752 PR gold/12979
753 * options.h (class General_options): Add -Bgroup.
754 * options.cc (General_options::finalize): If -Bgroup is set,
755 default to --unresolved-symbols=report-all.
756 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
757 * target-reloc.h (issue_undefined_symbol_error): Handle
758 --unresolved-symbols=report-all.
759
6daf5215
ILT
7602011-07-08 Ian Lance Taylor <iant@google.com>
761
762 PR gold/11985
763 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
764 if linker script discards key sections.
765 (Layout::create_dynamic_symtab): Likewise.
766 (Layout::assign_local_dynsym_offsets): Likewise.
767 (Layout::sized_create_version_sections): Likewise.
768 (Layout::create_interp): Likewise.
769 (Layout::finish_dynamic_section): Likewise.
770 (Layout::set_dynamic_symbol_size): Likewise.
771
beabb2c6
ILT
7722011-07-08 Ian Lance Taylor <iant@google.com>
773
774 PR gold/12386
775 * options.h (class General_options): Add --unresolved-symbols.
776 * target-reloc.h (issue_undefined_symbol_error): Check
777 --unresolved-symbols. Add comments.
778
9c16daf1
ILT
7792011-07-08 Ian Lance Taylor <iant@google.com>
780
781 * testsuite/odr_violation2.cc (Ordering::operator()): Make
782 expression more complex.
783
191f1a2d
ILT
7842011-07-08 Ian Lance Taylor <iant@google.com>
785
786 PR gold/11317
787 * target-reloc.h (issue_undefined_symbol_error): New inline
788 function, broken out of relocate_section.
789 (relocate_section): Call issue_undefined_symbol_error.
790 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
791 there is no TLS segment if we are about to issue an undefined
792 symbol error.
793 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
794
62855347
ILT
7952011-07-08 Ian Lance Taylor <iant@google.com>
796
797 PR gold/12279
798 * resolve.cc (Symbol_table::should_override): Add fromtype
799 parameter. Change all callers. Give error when linking together
800 TLS and non-TLS symbol.
801 (Symbol_table::should_override_with_special): Add fromtype
802 parameter. Change all callers.
803 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
804 there is no TLS segment if we have reported some errors.
805 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
806
67181c72
ILT
8072011-07-08 Ian Lance Taylor <iant@google.com>
808
809 PR gold/12372
810 * target.h (Target::plt_address_for_global): New function.
811 (Target::plt_address_for_local): New function.
812 (Target::plt_section_for_global): Remove.
813 (Target::plt_section_for_local): Remove.
814 (Target::do_plt_address_for_global): New virtual function.
815 (Target::do_plt_address_for_local): New virtual function.
816 (Target::do_plt_section_for_global): Remove.
817 (Target::do_plt_section_for_local): Remove.
818 (Target::register_global_plt_entry): Add Symbol_table and Layout
819 parameters.
820 * output.cc (Output_data_got::Got_entry::write): Use
821 plt_address_for_global and plt_address_for_local.
822 * layout.cc (Layout::add_target_dynamic_tags): Use size and
823 address of output section.
824 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
825 got_irelative_, and irelative_count_ fields. Update
826 declarations.
827 (Output_data_plt_i386::has_irelative_section): New function.
828 (Output_data_plt_i386::entry_count): Add irelative_count_.
829 (Output_data_plt_i386::set_final_data_size): Likewise.
830 (class Target_i386): Add got_irelative_ and rel_irelative_
831 fields. Update declarations.
832 (Target_i386::Target_i386): Initialize new fields.
833 (Target_i386::do_plt_address_for_global): New function replacing
834 do_plt_section_for_global.
835 (Target_i386::do_plt_address_for_local): New function replacing
836 do_plt_section_for_local.
837 (Target_i386::got_section): Create got_irelative_.
838 (Target_i386::rel_irelative_section): New function.
839 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
840 fields. Don't define __rel_iplt_{start,end}.
841 (Output_data_plt_i386::add_entry): Add symtab and layout
842 parameters. Change all callers. Use different PLT and GOT for
843 IFUNC symbols.
844 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
845 layout parameters. Change all callers. Use different PLT and
846 GOT.
847 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
848 (Output_data_plt_i386::rel_irelative): New function.
849 (Output_data_plt_i386::address_for_global): New function.
850 (Output_data_plt_i386::address_for_local): New function.
851 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
852 IRELATIVE GOT when changing IFUNC GOT entries.
853 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
854 reloc.
855 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
856 if we didn't create an IRELATIVE GOT.
857 (Target_i386::Relocate::relocate): Use plt_address_for_global and
858 plt_address_for_local.
859 (Target_i386::do_dynsym_value): Use plt_address_for_global.
860 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
861 got_irelative_, and irelative_count_ fields. Update
862 declarations.
863 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
864 Initialize new fields. Remove symtab parameter. Change all
865 callers.
866 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
867 irelative_count_.
868 (Output_data_plt_x86_64::has_irelative_section): New function.
869 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
870 (class Target_x86_64): Add got_irelative_ and rel_irelative_
871 fields. Update declarations.
872 (Target_x86_64::Target_x86_64): Initialize new fields.
873 (Target_x86_64::do_plt_address_for_global): New function replacing
874 do_plt_section_for_global.
875 (Target_x86_64::do_plt_address_for_local): New function replacing
876 do_plt_section_for_local.
877 (Target_x86_64::got_section): Create got_irelative_.
878 (Target_x86_64::rela_irelative_section): New function.
879 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
880 all callers. Don't create __rel_iplt_{start,end}.
881 (Output_data_plt_x86_64::add_entry): Add symtab and layout
882 parameters. Change all callers. Use different PLT and GOT for
883 IFUNC symbols.
884 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
885 layout parameters. Change all callers. Use different PLT and
886 GOT.
887 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
888 parameters. Change all callers. Use different PLT and GOT for
889 IFUNC symbols.
890 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
891 (Output_data_plt_x86_64::rela_irelative): New function.
892 (Output_data_plt_x86_64::address_for_global): New function.
893 (Output_data_plt_x86_64::address_for_local): New function.
894 (Output_data_plt_x86_64::set_final_data_size): Likewise.
895 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
896 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
897 (Target_x86_64::register_global_plt_entry): Add symtab and layout
898 parameters.
899 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
900 reloc.
901 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
902 symbols if we didn't create an IRELATIVE GOT.
903 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
904 plt_address_for_local.
905 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
906 * testsuite/ifuncvar1.c: New test file.
907 * testsuite/ifuncvar2.c: New test file.
908 * testsuite/ifuncvar3.c: New test file.
909 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
910 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
911 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
912 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
913 * testsuite/Makefile.in: Rebuild.
914
33c15b45
CC
9152011-07-07 Cary Coutant <ccoutant@google.com>
916
917 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
918 (two_file_test_1_ndebug.o): Likewise.
919 (two_file_test_1b_ndebug.o): Likewise.
920 (two_file_test_2_ndebug.o): Likewise.
921 (two_file_test_main_ndebug.o): Likewise.
922 (incremental_test_2): Link with no-debug versions.
923
f48b5fb7
CC
9242011-07-06 Cary Coutant <ccoutant@google.com>
925
926 * gold/incremental.cc
927 (Output_section_incremental_inputs::write_info_blocks): Check for
928 hidden and internal symbols.
929
221597a5
CC
9302011-07-06 Cary Coutant <ccoutant@google.com>
931
932 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
933 Check disposition for startup file.
934 (Incremental_inputs::report_command_line): Ignore
935 --incremental-startup-unchanged option.
936 * options.cc (General_options::parse_incremental_startup_unchanged):
937 New function.
938 (General_options::General_options): Initialize new data member.
939 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
940 (General_options): Add --incremental-startup-unchanged option.
941 (General_options::incremental_startup_disposition): New function.
942 (General_options::incremental_startup_disposition_): New data member.
943
e24719f6
CC
9442011-07-06 Cary Coutant <ccoutant@google.com>
945
946 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
947 input file index to Script_info ctor.
948 (Sized_incremental_binary::do_file_has_changed): Find the
949 command-line argument for files named in scripts.
950 * incremental.h (Script_info::Script_info): New ctor
951 with input file index.
952 (Script_info::input_file_index): New function.
953 (Script_info::input_file_index_): New data member.
954 (Incremental_binary::get_library): Add const.
955 (Incremental_binary::get_script_info): Add const.
956 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
957 * testsuite/Makefile.am (incremental_test_5): New test case.
958 (incremental_test_6): New test case.
959 * testsuite/Makefile.in: Regenerate.
960
8f7c81e8
CC
9612011-07-06 Cary Coutant <ccoutant@google.com>
962
963 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
964 debug output when command lines differ.
965
9fbd3822
CC
9662011-07-06 Cary Coutant <ccoutant@google.com>
967
968 * incremental.cc (Incremental_inputs::report_command_line): Ignore
969 --incremental-patch option.
970 * layout.cc (Free_list::allocate): Extend allocation beyond original
971 end if enabled.
972 (Layout::make_output_section): Mark sections that should get
973 patch space.
974 * options.cc (parse_percent): New function.
975 * options.h (parse_percent): New function.
976 (DEFINE_percent): New macro.
977 (General_options): Add --incremental-patch option.
978 * output.cc (Output_section::Output_section): Initialize new data
979 members.
980 (Output_section::add_input_section): Print section name when out
981 of patch space.
982 (Output_section::add_output_section_data): Likewise.
983 (Output_section::set_final_data_size): Add patch space when
984 doing --incremental-full.
985 (Output_section::do_reset_address_and_file_offset): Remove patch
986 space.
987 (Output_segment::set_section_list_addresses): Print debug output
988 only if --incremental-update.
989 * output.h (Output_section::set_is_patch_space_allowed): New function.
990 (Output_section::is_patch_space_allowed_): New data member.
991 (Output_section::patch_space_): New data member.
992 * parameters.cc (Parameters::incremental_full): New function.
993 * parameters.h (Parameters::incremental_full): New function
994 * testsuite/Makefile.am (incremental_test_2): Add test for
995 --incremental-patch option.
996 * testsuite/Makefile.in: Regenerate.
997 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
998 (t18): Remove function body.
999
f6cccc2c
DK
10002011-07-05 Doug Kwan <dougkwan@google.com>
1001
1002 PR gold/12771
1003 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1004 Arm_Address type for relocation result.
1005 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1006 overflow check.
1007 (Arm_relocate_functions::abs32): Use unaligned access.
1008 (Arm_relocate_functions::rel32): Ditto.
1009 (Arm_relocate_functions::prel31): Ditto.
1010 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1011 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1012 static data relocations.
1013 * testsuite/Makefile.in: Regnerate.
1014 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1015
28a13fec
ILT
10162011-07-05 Ian Lance Taylor <iant@google.com>
1017
1018 PR gold/12392
1019 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1020 symbols if necessary.
1021 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1022
24d47b34
ILT
10232011-07-05 Ian Lance Taylor <iant@google.com>
1024
1025 PR gold/12952
1026 * resolve.cc (Symbol::override_base_with_special): Simply override
1027 version with special symbol version, ignoring previous version.
1028
41f9cbbe
ILT
10292011-07-05 Ian Lance Taylor <iant@google.com>
1030
1031 * object.cc (Sized_relobj_file::include_section_group): Add
1032 information to comment about signature location.
1033
886288f1
ILT
10342011-07-02 Ian Lance Taylor <iant@google.com>
1035
1036 PR gold/12957
1037 * options.h (class General_options): Add -f and -F.
1038 * options.cc (General_options::finalize): Fatal error if -f/-F
1039 are used without -shared.
1040 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1041
ae3a6d4f
ILT
10422011-07-02 Ian Lance Taylor <iant@google.com>
1043
1044 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1045
21131061
ILT
10462011-07-01 Ian Lance Taylor <iant@google.com>
1047
1048 PR gold/12525
1049 PR gold/12952
1050 * resolve.cc (Symbol::override_base_with_special): Don't override
1051 the version if the overriding symbol has a different name.
1052 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1053 all callers. If we give an error about an undefined version,
1054 define the base version if necessary.
1055 * dynobj.h (class Versions): Update declaration.
1056 * testsuite/weak_alias_test_5.cc: New file.
1057 * testsuite/weak_alias_test.script: New file.
1058 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1059 and versioned_alias have the right value, and call t2.
1060 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1061 weak_alias_test_5.so.
1062 (weak_alias_test_LDADD): Likewise.
1063 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1064 * testsuite/Makefile.in: Rebuild.
1065
611062c0
ILT
10662011-07-01 Ian Lance Taylor <iant@google.com>
1067
1068 PR gold/12525
1069 * options.h (class General_options): Support -z notext.
1070 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1071 -Wl,-z,notext.
1072 (two_file_shared_nonpic.so): Likewise.
1073 (two_file_shared_mixed.so): Likewise.
1074 (two_file_shared_mixed_1.so): Likewise.
1075 (weak_undef_lib_nonpic.so): Likewise.
1076 (alt/weak_undef_lib_nonpic.so): Likewise.
1077 (tls_test_shared_nonpic.so): Likewise.
1078 * testsuite/Makefile.in: Rebuild.
1079
328c7c2f
ILT
10802011-07-01 Ian Lance Taylor <iant@google.com>
1081
1082 PR gold/12525
1083 * configure.ac: Test whether static linking works, setting
1084 the automake conditional HAVE_STATIC.
1085 * testsuite/Makefile.am: Disable tests using -static if
1086 HAVE_STATIC is not true.
1087 * configure, testsuite/Makefile.in: Rebuild.
1088
02d7cd44
ILT
10892011-07-01 Ian Lance Taylor <iant@google.com>
1090
1091 PR gold/12525
1092 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1093 Assert if we see DW_EH_PE_indirect.
1094 * target.h (Target::ehframe_datarel_base): New function.
1095 (Target::do_ehframe_datarel_base): New target function.
1096 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1097 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1098 function.
1099
07a60597
ILT
11002011-07-01 Ian Lance Taylor <iant@google.com>
1101
1102 PR gold/12571
1103 * options.h (class General_options): Add
1104 --ld-generated-unwind-info.
1105 * ehframe.cc (Fde::write): Add address parameter. Change all
1106 callers. If associated with PLT, fill in address and size.
1107 (Cie::set_output_offset): Only add merge mapping if there is an
1108 object.
1109 (Cie::write): Add address parameter. Change all callers.
1110 (Eh_frame::add_ehframe_for_plt): New function.
1111 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1112 input_offset_ fields into union u_, with new plt field.
1113 (Fde::Fde): Adjust for new union field.
1114 (Fde::Fde) [Output_data version]: New constructor.
1115 (Fde::add_mapping): Only add merge mapping if there is an object.
1116 (class Cie): Update declarations.
1117 (class Eh_frame): Declare add_ehframe_for_plt.
1118 * layout.cc (Layout::layout_eh_frame): Break out code into
1119 make_eh_frame_section, and call it.
1120 (Layout::make_eh_frame_section): New function.
1121 (Layout::add_eh_frame_for_plt): New function.
1122 * layout.h (class Layout): Update declarations.
1123 * merge.cc (Merge_map::add_mapping): Add assertion.
1124 * i386.cc: Include "dwarf.h".
1125 (class Output_data_plt_i386): Make first_plt_entry,
1126 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1127 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1128 and plt_eh_frame_fde.
1129 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1130 boundary. Call add_eh_frame_for_plt if appropriate.
1131 * x86_64.cc: Include "dwarf.h".
1132 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1133 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1134 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1135 and plt_eh_frame_fde.
1136 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1137 appropriate.
1138
14788a3f
ILT
11392011-06-29 Ian Lance Taylor <iant@google.com>
1140
1141 PR gold/12629
1142 * object.cc (Sized_relobj_file::layout_section): Change shdr
1143 parameter to be const.
1144 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1145 out of do_layout.
1146 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1147 appropriate. Call layout_eh_frame_section.
1148 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1149 sections.
1150 * object.h (class Sized_relobj_file): Update declarations.
1151
6c21fce1
ILT
11522011-06-29 Ian Lance Taylor <iant@google.com>
1153
37e41b03 1154 PR gold/12652
6c21fce1
ILT
1155 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1156 modifier.
1157 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1158
4d5e4e62
ILT
11592011-06-29 Ian Lance Taylor <iant@google.com>
1160
1161 PR gold/12675
1162 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1163 SHT_X86_64_UNWIND.
1164 * layout.cc (Layout::layout_eh_frame): Likewise.
1165
886f533a
ILT
11662011-06-29 Ian Lance Taylor <iant@google.com>
1167
1168 PR gold/12695
1169 * layout.cc (Layout::symtab_section_shndx): New function.
1170 * layout.h (class Layout): Declare symtab_section_shndx.
1171 * output.cc (Output_section::write_header): Call it.
1172
f3ae1b28
ILT
11732011-06-29 Ian Lance Taylor <iant@google.com>
1174
1175 PR gold/12818
1176 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1177 symbols which are not used in a relocation.
1178
aecf301f
ILT
11792011-06-28 Ian Lance Taylor <iant@google.com>
1180
1181 PR gold/12898
1182 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1183 script create indistinguishable segments.
1184 (Layout::set_segment_offsets): Use stable_sort when sorting
1185 segments. Pass this to Compare_segments constructor.
1186 * layout.h (class Layout): Make segment_precedes non-static.
1187 (class Compare_segments): Change from struct to class. Add
1188 layout_ field. Add constructor.
1189 * script-sections.cc
1190 (Script_sections::attach_sections_using_phdrs_clause): Rename
1191 local orphan to is_orphan. Don't report failure to put empty
1192 section in segment. On attachment failure, report name of
1193 section, and attach to first PT_LOAD segment.
1194
03ef7571
ILT
11952011-06-28 Ian Lance Taylor <iant@google.com>
1196
1197 PR gold/12934
1198 * target-select.cc (Target_selector::Target_selector): Add
1199 emulation parameter. Change all callers.
1200 (select_target_by_bfd_name): Rename from select_target_by_name.
1201 Change all callers.
1202 (select_target_by_emulation): New function.
1203 (supported_emulation_names): New function.
1204 * target-select.h (class Target_selector): Add emulation_ field.
1205 Update declarations.
1206 (Target_selector::recognize_by_bfd_name): Rename from
1207 recognize_by_name. Change all callers.
1208 (Target_selector::supported_bfd_names): Rename from
1209 supported_names. Change all callers.
1210 (Target_selector::recognize_by_emulation): New function.
1211 (Target_selector::supported_emulations): New function.
1212 (Target_selector::emulation): New function.
1213 (Target_selector::do_recognize_by_bfd_name): Rename from
1214 do_recognize_by_name. Change all callers.
1215 (Target_selector::do_supported_bfd_names): Rename from
1216 do_supported_names. Change all callers.
1217 (Target_selector::do_recognize_by_emulation): New function.
1218 (Target_selector::do_supported_emulations): New function.
1219 (select_target_by_bfd_name): Change name in declaration.
1220 (select_target_by_emulation): Declare.
1221 (supported_emulation_names): Declare.
1222 * parameters.cc (parameters_force_valid_target): Try to find
1223 target based on emulation from -m option.
1224 * options.h (class General_options): Change doc string for -m.
1225 * options.cc (help): Print emulations.
1226 (General_options::parse_V): Likewise.
1227 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1228 Add emulation parameter. Change all callers.
1229
200b2bb9
ILT
12302011-06-28 Ian Lance Taylor <iant@google.com>
1231
1232 * target.h (class Target): Add osabi_ field.
1233 (Target::osabi): New function.
1234 (Target::set_osabi): New function.
1235 (Target::Target): Initialize osabi_.
1236 (Target::do_adjust_elf_header): Make pure virtual.
1237 (Sized_target::do_adjust_elf_header): Declare.
1238 * target.cc (Sized_target::do_adjust_elf_header): New function.
1239 (class Sized_target): Instantiate all versions.
1240 * freebsd.h (class Target_freebsd): Remove.
1241 (Target_selector_freebsd::do_recognize): Call set_osabi on
1242 Target.
1243 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1244 (Target_selector_freebsd::set_osabi): Remove.
1245 * i386.cc (class Target_i386): Inherit from Sized_target rather
1246 than Target_freebsd.
1247 * x86_64.cc (class Target_x86_64): Likewise.
1248
b3ce541e
ILT
12492011-06-28 Ian Lance Taylor <iant@google.com>
1250
1251 * target.h (Target::can_check_for_function_pointers): Rewrite.
1252 Make non-virtual.
1253 (Target::can_icf_inline_merge_sections): Likewise.
1254 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1255 (Target::Target_info): Add can_icf_inline_merge_sections field.
1256 (Target::do_can_check_for_function_pointers): New virtual
1257 function.
1258 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1259 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1260 from can_check_for_function_pointers, move in file.
1261 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1262 section_may_have_icf_unsafe_poineters, move in file.
1263 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1264 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1265 Rename from can_check_for_function_pointers, move in file.
1266 (Target_i386::can_icf_inline_merge_sections): Remove.
1267 (Target_i386::i386_info): Initialize
1268 can_icf_inline_merge_sections.
1269 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1270 Initialize can_icf_inline_merge_sections.
1271 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1272 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1273 Rename from can_check_for_function_pointers, move in file.
1274 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1275 (Target_x86_64::x86_64_info): Initialize
1276 can_icf_inline_merge_sections.
1277 * testsuite/testfile.cc (Target_test::test_target_info):
1278 Likewise.
1279 * icf.cc (get_section_contents): Correct formatting.
1280
6d1c4efb
ILT
12812011-06-27 Ian Lance Taylor <iant@google.com>
1282
1283 * symtab.cc (Symbol::versioned_name): New function.
1284 (Symbol_table::add_to_final_symtab): Use versioned_name when
1285 appropriate.
1286 (Symbol_table::sized_write_symbol): Likewise.
1287 * symtab.h (class Symbol): Declare versioned_name.
1288 * stringpool.h (class Stringpool_template): Add variant of add
1289 which takes a std::basic_string.
1290 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1291 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1292 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1293 (ver_test_12.o): New target.
1294 * testsuite/Makefile.in: Rebuild.
1295
57eb9b50
DK
12962011-06-27 Doug Kwan <dougkwan@google.com>
1297
1298 * arm.cc (Arm_relocate_functions::thm_jump8,
1299 Arm_relocate_functions::thm_jump11): Use a wider signed
1300 type to compute offset.
1301 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1302 arm_thm_jump8.
1303 * testsuite/Makefile.in: Regenerate.
1304 * testsuite/arm_branch_in_range.sh: Check test results of
1305 arm_thm_jump11 and arm_thm_jump8.
1306 * testsuite/arm_thm_jump11.s: New test source file.
1307 * testsuite/arm_thm_jump11.t: New linker script.
1308 * testsuite/arm_thm_jump8.s: New test source file.
1309 * testsuite/arm_thm_jump8.t: New linker script.
1310
487b39df
ILT
13112011-06-24 Ian Lance Taylor <iant@google.com>
1312
1313 * layout.cc: Include "object.h".
1314 (ctors_sections_in_init_array): New static variable.
1315 (Layout::is_ctors_in_init_array): New function.
1316 (Layout::layout): Add entry to ctors_sections_in_init_array if
1317 appropriate.
1318 * layout.h (class Layout): Declare is_ctors_in_init_array.
1319 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1320 is_ctors_reverse_view is set.
1321 (Sized_relobj_file::write_sections): Add layout parameter. Change
1322 all callers. Set is_ctors_reverse_view field of View_size.
1323 (Sized_relobj_file::reverse_words): New function.
1324 * object.h (Sized_relobj_file::View_size): Add
1325 is_ctors_reverse_view field.
1326 (class Sized_relobj_file): Update declarations.
1327 * testsuite/initpri3.c: New test.
1328 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1329 initpri3b.
1330 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1331 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1332 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1333 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1334 * testsuite/Makefile.in: Rebuild.
1335
472076e4
CC
13362011-06-24 Cary Coutant <ccoutant@google.com>
1337
1338 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1339 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1340 (debug_msg_cdebug.err): New targets.
1341 * testsuite/Makefile.in: Regenerate.
1342 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1343 Fix checks for link with shared library.
1344
a60af0db
DK
13452011-06-24 Doug Kwan <dougkwan@google.com>
1346
1347 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1348 skip empty text sections.
1349 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1350
5393d741
ILT
13512011-06-22 Ian Lance Taylor <iant@google.com>
1352
1353 PR gold/12910
1354 * options.h (class General_options): Add --ctors-in-init-array.
1355 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1356 friends as SHT_PROGBITS for merging sections.
1357 (Layout::layout): Remove special handling of .init_array and
1358 friends. Don't sort if doing relocatable link. Sort for .ctors
1359 and .dtors if ctors_in_init_array.
1360 (Layout::make_output_section): Force correct section types for
1361 .init_array and friends. Don't sort if doing relocatable link,
1362 Don't sort .ctors and .dtors if ctors_in_init_array.
1363 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1364 (Layout::output_section_name): Add relobj parameter. Change all
1365 callers. Handle .ctors. and .dtors. in code rather than table.
1366 Handle .ctors and .dtors if ctors_in_init_array.
1367 (Layout::match_file_name): New function, moved from output.cc.
1368 * layout.h (class Layout): Update declarations.
1369 * output.cc: Include "layout.h".
1370 (Input_section_sort_entry::get_priority): New function.
1371 (Input_section_sort_entry::match_file_name): Just call
1372 Layout::match_file_name.
1373 (Output_section::Input_section_sort_init_fini_compare::operator()):
1374 Handle .ctors and .dtors. Sort by explicit priority rather than
1375 by name.
1376 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1377 * testsuite/initpri2.c: New test.
1378 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1379 (check_PROGRAMS): Add initpri2.
1380 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1381 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1382 * configure, testsuite/Makefile.in: Rebuild.
1383
e1f74f98
ILT
13842011-06-19 Ian Lance Taylor <iant@google.com>
1385
1386 PR gold/12880
1387 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1388 .interp section to a PT_INTERP segment even if we have seen a
1389 --dynamic-linker option. Don't do it if we have seen a PHDRS
1390 clause in a linker script.
1391 (Layout::finalize): Don't create a .interp section if we've
1392 already create a PT_INTERP segment.
1393 (Layout::create_interp): Always call choose_output_section (revert
1394 patch of 2011-06-17). Don't create PT_INTERP segment.
1395 * script-sections.cc
1396 (Script_sections::create_note_and_tls_segments): Add a .interp
1397 section to a PT_INTERP segment even if we have seen a
1398 --dynamic-linker option.
1399
766f91bb
ILT
14002011-06-18 Ian Lance Taylor <iant@google.com>
1401
1402 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1403 merely because a non-PT_LOAD segment has a dynamic reloc.
1404
0d212c3a
ILT
14052011-06-18 Ian Lance Taylor <iant@google.com>
1406
1407 * layout.cc (Layout::finish_dynamic_section): Don't create
1408 DT_FLAGS entry if not needed.
1409
911a5072
ILT
14102011-06-18 Ian Lance Taylor <iant@google.com>
1411
1412 PR gold/12745
1413 * layout.cc (Layout::layout_eh_frame): Correct handling of
1414 writable .eh_frame section.
1415
534b4e5f
ILT
14162011-06-17 Ian Lance Taylor <iant@google.com>
1417
1418 PR gold/12893
1419 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1420 symbol is redefined with the exact same object and value.
1421
10b4f102
ILT
14222011-06-17 Ian Lance Taylor <iant@google.com>
1423
1424 PR gold/12880
1425 * layout.h (class Layout): Add interp_segment_ field.
1426 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1427 (Layout::attach_allocated_section_to_segment): If making shared
1428 library, put .interp section in PT_INTERP segment.
1429 (Layout::finalize): Also call create_interp if -dynamic-linker
1430 option was used.
1431 (Layout::create_interp): Assert that there is no PT_INTERP
1432 segment. If not using a SECTIONS clause, use make_output_section.
1433 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1434 * script-sections.cc
1435 (Script_sections::create_note_and_tls_segments): If making shared
1436 library, put .interp section in PT_INTERP segment.
1437
a29b0dad
ILT
14382011-06-17 Ian Lance Taylor <iant@google.com>
1439
e588ea8d
ILT
1440 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1441 when making a shared library.
1442
14432011-06-17 Ian Lance Taylor <iant@google.com>
1444
1445 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1446 parameter. Change all callers. Don't issue warning about PC32
1447 against locally defined symbol.
a29b0dad 1448
9d3b0698
ILT
14492011-06-16 Ian Lance Taylor <iant@google.com>
1450
1451 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1452 occurs in same object.
1453
85b0f90c
AM
14542011-06-14 Alan Modra <amodra@gmail.com>
1455
1456 * po/POTFILES.in: Regenerate.
1457
a94907d9
ILT
14582011-06-09 Ian Lance Taylor <iant@google.com>
1459
1460 * script-sections.cc
1461 (Orphan_output_section::set_section_addresses): For a relocatable
1462 link set address to 0.
1463
4fb3a1c3
CC
14642011-06-09 Cary Coutant <ccoutant@google.com>
1465
1466 PR gold/12804
1467 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1468 used with --compress-debug-sections.
1469 * gold/object.cc (Sized_relobj_file::do_layout): Report
1470 uncompressed size of compressed input sections.
1471
61220854
CC
14722011-06-08 Cary Coutant <ccoutant@google.com>
1473
1474 PR gold/12804
1475 * testsuite/two_file_test_2_v1.cc: Change initialization of
1476 v2 to keep it in .data.
1477
e6455dfb
CC
14782011-06-07 Cary Coutant <ccoutant@google.com>
1479
1480 * common.cc (Symbol_table::do_allocate_commons_list): Call
1481 gold_fallback.
1482 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1483 (Errors::fallback): New function.
1484 (gold_fallback): New function.
1485 * errors.h (Errors::fallback): New function.
1486 * gold.cc (gold_exit): Change status parameter to enum; adjust
1487 all callers.
1488 (queue_initial_tasks): Call gold_fallback.
1489 * gold.h: Include cstdlib.
1490 (Exit_status): New enum type.
1491 (gold_exit): Change status parameter to enum.
1492 (gold_fallback): New function.
1493 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1494 (Layout::create_symtab_sections): Likewise.
1495 (Layout::create_shdrs): Likewise.
1496 * main.cc (main): Adjust call to gold_exit.
1497 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1498 (Output_data_got::add_got_entry_pair): Likewise.
1499 (Output_section::add_input_section): Likewise.
1500 (Output_section::add_output_section_data): Likewise.
1501 (Output_segment::set_section_list_addresses): Likewise.
1502 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1503
fb0e076f
CC
15042011-06-07 Cary Coutant <ccoutant@google.com>
1505
1506 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1507 for incremental links.
1508 * output.cc (Output_segment::set_section_list_addresses): Remove
1509 FIXME and test for TLS or BSS.
1510
a5ee4d5d
CC
15112011-06-07 Cary Coutant <ccoutant@google.com>
1512
1513 * testsuite/Makefile.am: Add incremental_copy_test,
1514 incremental_common_test_1.
1515 * testsuite/Makefile.in: Regenerate.
1516 * testsuite/common_test_1_v1.c: New source file.
1517 * testsuite/common_test_1_v2.c: New source file.
1518 * testsuite/copy_test_v1.cc: New source file.
1519
5146f448
CC
15202011-06-07 Cary Coutant <ccoutant@google.com>
1521
1522 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1523 update, allocate common from bss section's free list.
1524 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1525 linker-defined symbols.
1526 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1527 Skip GOT and PLT entries that are no longer referenced.
1528 (Output_section_incremental_inputs::write_info_blocks): Mark
1529 linker-defined symbols.
1530 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1531 * output.cc (Output_section::allocate): New function.
1532 * output.h (Output_section::allocate): New function.
1533 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1534 linker-defined symbols.
1535 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1536 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1537 (Symbol::init_base_output_data): Likewise.
1538 (Symbol::init_base_output_segment): Likewise.
1539 (Symbol::init_base_constant): Likewise.
1540 (Sized_symbol::init_output_data): Likewise.
1541 (Sized_symbol::init_output_segment): Likewise.
1542 (Sized_symbol::init_constant): Likewise.
1543 (Symbol_table::do_define_in_output_data): Likewise.
1544 (Symbol_table::do_define_in_output_segment): Likewise.
1545 (Symbol_table::do_define_as_constant): Likewise.
1546 * symtab.h (Symbol::is_predefined): New function.
1547 (Symbol::init_base_output_data): Add is_predefined parameter.
1548 (Symbol::init_base_output_segment): Likewise.
1549 (Symbol::init_base_constant): Likewise.
1550 (Symbol::is_predefined_): New data member.
1551 (Sized_symbol::init_output_data): Add is_predefined parameter.
1552 (Sized_symbol::init_output_segment): Likewise.
1553 (Sized_symbol::init_constant): Likewise.
1554 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1555
26d3c67d
CC
15562011-06-07 Cary Coutant <ccoutant@google.com>
1557
1558 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1559 instead of emit_copy_reloc.
1560 (Copy_relocs::emit_copy_reloc): Refactor.
1561 (Copy_relocs::make_copy_reloc): New function.
1562 (Copy_relocs::add_copy_reloc): Remove.
1563 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1564 section.
1565 (Copy_relocs::make_copy_reloc): New function.
1566 (Copy_relocs::add_copy_reloc): Remove.
1567 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1568 unchanged input files.
1569 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1570 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1571 Reserve BSS space for COPY relocations.
1572 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1573 (Output_section_incremental_inputs::write_info_blocks): Record
1574 whether a symbol is copied from a shared object.
1575 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1576 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1577 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1578 (Incremental_input_entry_reader::get_output_symbol_index): Add
1579 is_copy parameter.
1580 (Incremental_binary::emit_copy_relocs): New function.
1581 (Incremental_binary::do_emit_copy_relocs): New function.
1582 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1583 new data member.
1584 (Sized_incremental_binary::add_copy_reloc): New function.
1585 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1586 (Sized_incremental_binary::Copy_reloc): New struct.
1587 (Sized_incremental_binary::Copy_relocs): New typedef.
1588 (Sized_incremental_binary::copy_relocs_): New data member.
1589 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1590 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1591 * target.h (Sized_target::emit_copy_reloc): New function.
1592 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1593
7cdb37d9
CC
15942011-06-02 Cary Coutant <ccoutant@google.com>
1595
1596 PR gold/12163
1597 * gold/archive.cc (Archive::Archive): Initialize new data member.
1598 (Archive::include_all_members): Return if archive has already been
1599 included.
1600 * gold/archive.h (Archive::include_all_members_): New data member.
1601
cc643b88
NC
16022011-06-02 Nick Clifton <nickc@redhat.com>
1603
1604 * dynobj.h: Fix spelling mistake in comment.
1605 * output.cc: Likewise.
1606
f62a3ca7
DK
16072011-05-31 Doug Kwan <dougkwan@google.com>
1608 Asier Llano
1609
1610 PR gold/12826
cc643b88 1611 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
1612 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1613 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1614 redundant arm_exidx_test.so.
1615 * testsuite/Makefile.in: Regenerate.
1616 (check_SCRIPTS): Add pr12826.sh
1617 (check_DATA): Add pr12826.stdout
1618 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1619 * testsuite/pr12826.sh: New file.
1620 * testsuite/pr12826_1.s: Ditto.
1621 * testsuite/pr12826_1.s: Ditto.
1622
8dbe1edc
ILT
16232011-05-30 Ian Lance Taylor <iant@google.com>
1624
1625 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1626 sections.
1627
c49875be
ILT
16282011-05-29 Ian Lance Taylor <iant@google.com>
1629
1630 PR gold/12804
1631 * testsuite/Makefile.am: Use different file name for two_file_test
1632 temporary file for each incremental test.
1633 * testsuite/Makefile.in: Rebuild.
1634
69d53f7a
ILT
16352011-05-29 Ian Lance Taylor <iant@google.com>
1636
1637 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1638 binary input file is empty.
1639
41d0ab5f
ILT
16402011-05-27 Ian Lance Taylor <iant@google.com>
1641
1642 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1643 (ver_test_9.so): Likewise.
1644 * testsuite/Makefile.in: Rebuild.
1645
89d8a36b
CC
16462011-05-26 Cary Coutant <ccoutant@google.com>
1647
1648 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1649 * incremental.cc (Incremental_inputs::report_input_section): Fix
1650 comment, indentation.
1651 (Incremental_inputs::report_comdat_group): New function.
1652 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1653 of data for incremental input file entry.
1654 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1655 group count, COMDAT group signatures.
1656 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1657 an unchanged input file.
1658 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1659 Initialize new data member.
1660 (Incremental_object_entry::add_comdat_group): New function.
1661 (Incremental_object_entry::get_comdat_group_count): New function.
1662 (Incremental_object_entry::get_comdat_signature_key): New function.
1663 (Incremental_object_entry::groups_): New data member.
1664 (Incremental_inputs::report_comdat_group): New function.
1665 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1666 data for incremental input file entry.
1667 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1668 (Incremental_input_entry_reader::get_input_section): Adjust size of
1669 data for incremental input file entry.
1670 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1671 (Incremental_input_entry_reader::get_comdat_group_signature): New
1672 function.
1673 * object.cc (Sized_relobj::include_section_group): Report kept
1674 COMDAT groups for incremental links.
1675
1706a06f
ILT
16762011-05-24 David Meyer <pdox@google.com>
1677
1678 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1679 with name parameter. Add found_name parameter.
1680 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1681 * dirsearch.h (class Dirsearch): Update declaration.
1682
a10ae760
ILT
16832011-05-24 Ian Lance Taylor <iant@google.com>
1684
1685 * archive.cc (Library_base::should_include_member): Pull in object
1686 from archive if it defines the entry symbol.
1687 * parameters.cc (Parameters::entry): New function.
1688 * parameters.h (class Parameters): Declare entry.
1689 * output.h (class Output_file_header): Remove entry_ field.
1690 * output.cc (Output_file_header::Output_file_header): Remove entry
1691 parameter. Change all callers.
1692 (Output_file_header::entry): Use parameters->entry.
1693 * gold.cc (queue_middle_tasks): Likewise.
1694 * plugin.cc (Plugin_hook::run): Likewise.
1695
aa92d6ed
CC
16962011-05-24 Cary Coutant <ccoutant@google.com>
1697
1698 * gold.cc (queue_initial_tasks): Pass incremental base filename
1699 to Output_file::open_base_file; don't print error message.
1700 * incremental-dump.cc (main): Adjust call to
1701 Output_file::open_for_modification.
1702 * incremental-dump.cc (main): Likewise.
1703 * incremental.cc (Incremental_inputs::report_command_line):
1704 Ignore --incremental-base option when comparing command lines.
1705 Ignore parameter when given as separate argument.
1706 * options.h (class General_options): Add --incremental-base.
1707 * output.cc (Output_file::Output_file):
1708 (Output_file::open_base_file): Add base_name and writable parameters;
1709 read base file into new file; print error message here.
1710 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1711 callers.
1712 * output.h (Output_file::open_for_modification): Rename to...
1713 (Output_file::open_base_file): ...this; add base_name and
1714 writable parameters; adjust all callers.
1715 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1716 callers.
1717 * testsuite/Makefile.am (incremental_test_4): Test
1718 --incremental-base.
1719 * testsuite/Makefile.in: Regenerate.
1720
2eedd706
CC
17212011-05-24 Cary Coutant <ccoutant@google.com>
1722
1723 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1724 incremental_test_4.
1725 * testsuite/Makefile.in: Regenerate.
1726 * testsuite/two_file_test_1_v1.cc: New test source file.
1727 * testsuite/two_file_test_1b_v1.cc: New test source file.
1728 * testsuite/two_file_test_2_v1.cc: New test source file.
1729
0f1c85a6
CC
17302011-05-24 Cary Coutant <ccoutant@google.com>
1731
1732 * dynobj.h (Dynobj::do_dynobj): New function.
1733 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1734 flag and soname for shared objects.
1735 * incremental.cc (Incremental_inputs::report_object): Make
1736 either Incremental_object_entry or Incremental_dynobj_entry; add
1737 soname to string table.
1738 (Incremental_inputs::report_input_section): Add assertion.
1739 (Output_section_incremental_inputs::set_final_data_size): Adjust
1740 type of input file entry for shared libraries; adjust size of
1741 shared library info entry.
1742 (Output_section_incremental_inputs::write_input_files): Write
1743 as_needed flag for shared libraries.
1744 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1745 of input file entry for shared libraries; write soname.
1746 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1747 soname from incremental info.
1748 * incremental.h (enum Incremental_input_flags): Add
1749 INCREMENTAL_INPUT_AS_NEEDED.
1750 (Incremental_input_entry::Incremental_input_entry): Initialize new
1751 data member.
1752 (Incremental_input_entry::set_as_needed): New function.
1753 (Incremental_input_entry::as_needed): New function.
1754 (Incremental_input_entry::do_dynobj_entry): New function.
1755 (Incremental_input_entry::as_needed_): New data member.
1756 (Incremental_object_entry::Incremental_object_entry): Don't check
1757 for shared library.
1758 (Incremental_object_entry::do_type): Likewise.
1759 (class Incremental_dynobj_entry): New class.
1760 (Incremental_input_entry_reader::as_needed): New function.
1761 (Incremental_input_entry_reader::get_soname): New function.
1762 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1763 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1764 size of shared library info entry.
1765 * layout.cc (Layout::finish_dynamic_section): Don't test for
1766 incremental link when adding DT_NEEDED entries.
1767 * object.h (Object::Object): Initialize new data member.
1768 (Object::dynobj): New function.
1769 (Object::set_as_needed): New function.
1770 (Object::as_needed): New function.
1771 (Object::do_dynobj): New function.
1772 (Object::as_needed_): New data member.
1773
6fa2a40b
CC
17742011-05-24 Cary Coutant <ccoutant@google.com>
1775
1776 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1777 info; adjust display of GOT entries.
1778 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1779 vector of input objects; remove file_status_.
1780 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1781 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1782 got_plt reader; call target hooks to reserve GOT entries.
1783 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1784 of input file info header and GOT info entry.
1785 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1786 relocation info.
1787 (Got_plt_view_info::got_descriptor): Remove.
1788 (Got_plt_view_info::sym_index): New data member.
1789 (Got_plt_view_info::input_index): New data member.
1790 (Local_got_offset_visitor::visit): Write input file index.
1791 (Global_got_offset_visitor::visit): Write 0 for input file index.
1792 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1793 with sym_index and input_index.
1794 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1795 incremental info GOT entry; replace got_descriptor with input_index.
1796 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1797 map from input file index to object.
1798 (Sized_relobj_incr::do_layout): Replace direct data member reference
1799 with accessor function.
1800 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1801 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1802 Adjust size of input file info header.
1803 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1804 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1805 (Incremental_input_entry_reader::get_input_section): Adjust size of
1806 input file info header.
1807 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1808 of incremental info GOT entry.
1809 (Incremental_got_plt_reader::get_got_desc): Remove.
1810 (Incremental_got_plt_reader::get_got_symndx): New function.
1811 (Incremental_got_plt_reader::get_got_input_index): New function.
1812 (Sized_incremental_binary::Sized_incremental_binary): Remove
1813 file_status_; add input_objects_.
1814 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1815 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1816 (Sized_incremental_binary::file_is_unchanged): Remove.
1817 (Sized_incremental_binary::set_input_object): New function.
1818 (Sized_incremental_binary::input_object): New function.
1819 (Sized_incremental_binary::file_status_): Remove.
1820 (Sized_incremental_binary::input_objects_): New data member.
1821 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1822 references.
1823 (Sized_relobj_incr::invalid_address): Move to base class.
1824 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1825 class.
1826 (Sized_relobj_incr::do_output_section_offset): Likewise.
1827 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1828 (Sized_relobj_incr::section_offsets_): Likewise.
1829 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1830 function.
1831 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1832 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1833 with accessor function.
1834 (Sized_relobj_file::do_layout): Likewise.
1835 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1836 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1837 (Sized_relobj_file::compute_final_local_value): Replace refs to
1838 section_offsets_ with accessor function.
1839 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1840 * object.h (Relobj::Relobj): Initialize new data members.
1841 (Relobj::add_dyn_reloc): New function.
1842 (Relobj::first_dyn_reloc): New function.
1843 (Relobj::dyn_reloc_count): New function.
1844 (Relobj::first_dyn_reloc_): New data member.
1845 (Relobj::dyn_reloc_count_): New data member.
1846 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1847 references.
1848 (Sized_relobj::Address): New typedef.
1849 (Sized_relobj::invalid_address): Move here from child class.
1850 (Sized_relobj::Sized_relobj): Initialize new data members.
1851 (Sized_relobj::sized_relobj): New function.
1852 (Sized_relobj::is_output_section_offset_invalid): Move here from
1853 child class.
1854 (Sized_relobj::get_output_section_offset): Likewise.
1855 (Sized_relobj::local_has_got_offset): Likewise.
1856 (Sized_relobj::local_got_offset): Likewise.
1857 (Sized_relobj::set_local_got_offset): Likewise.
1858 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1859 (Sized_relobj::clear_got_offsets): New function.
1860 (Sized_relobj::section_offsets): Move here from child class.
1861 (Sized_relobj::do_output_section_offset): Likewise.
1862 (Sized_relobj::do_set_section_offset): Likewise.
1863 (Sized_relobj::Local_got_offsets): Likewise.
1864 (Sized_relobj::local_got_offsets_): Likewise.
1865 (Sized_relobj::section_offsets_): Likewise.
1866 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1867 references.
1868 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1869 class.
1870 (Sized_relobj_file::sized_relobj): New function
1871 (Sized_relobj_file::local_has_got_offset): Move to base class.
1872 (Sized_relobj_file::local_got_offset): Likewise.
1873 (Sized_relobj_file::set_local_got_offset): Likewise.
1874 (Sized_relobj_file::get_output_section_offset): Likewise.
1875 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1876 (Sized_relobj_file::do_output_section_offset): Likewise.
1877 (Sized_relobj_file::do_set_section_offset): Likewise.
1878 (Sized_relobj_file::Local_got_offsets): Likewise.
1879 (Sized_relobj_file::local_got_offsets_): Likewise.
1880 (Sized_relobj_file::section_offsets_): Likewise.
1881 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1882 (all constructors).
1883 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1884 (Output_reloc::get_symbol_index): Likewise.
1885 (Output_reloc::local_section_offset): Likewise.
1886 (Output_reloc::get_address): Likewise.
1887 (Output_reloc::symbol_value): Likewise.
1888 (Output_data_got::reserve_slot): Move to class definition.
1889 (Output_data_got::reserve_local): New function.
1890 (Output_data_got::reserve_slot_for_global): Remove.
1891 (Output_data_got::reserve_global): New function.
1892 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1893 (all constructors, two instantiations).
1894 (Output_reloc::get_relobj): New function (two instantiations).
1895 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1896 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1897 (Output_data_reloc::add_global): Adjust type of relobj.
1898 (Output_data_reloc::add_global_relative): Likewise.
1899 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1900 (Output_data_reloc::add_local): Likewise.
1901 (Output_data_reloc::add_local_relative): Likewise.
1902 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1903 (Output_data_reloc::add_local_section): Likewise.
1904 (Output_data_reloc::add_output_section): Likewise.
1905 (Output_data_reloc::add_absolute): Likewise.
1906 (Output_data_reloc::add_target_specific): Likewise.
1907 (Output_data_got::reserve_slot): Move definition here.
1908 (Output_data_got::reserve_local): New function.
1909 (Output_data_got::reserve_global): New function.
1910 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1911 section_offsets_ with accessor function.
1912 (Sized_relobj_file::write_sections): Likewise.
1913 (Sized_relobj_file::do_relocate_sections): Likewise.
1914 * target.h (Sized_target::reserve_local_got_entry): New function.
1915 (Sized_target::reserve_global_got_entry): New function.
1916 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1917 (Target_x86_64::reserve_global_got_entry): New function.
1918 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1919
4829d394
CC
19202011-05-23 Cary Coutant <ccoutant@google.com>
1921
1922 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1923 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1924 bit when checking got_type.
1925 * incremental.cc (Sized_incremental_binary::setup_readers):
1926 Store symbol table and string table locations; initialize bit vector
1927 of file status flags.
1928 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1929 unchanged files.
1930 (Sized_incremental_binary::do_process_got_plt): New function.
1931 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1932 (Output_section_incremental_inputs::set_final_data_size): Record
1933 file index for each input file.
1934 (Output_section_incremental_inputs::write_got_plt): Store file index
1935 instead of input entry offset for each GOT entry.
1936 * incremental.h
1937 (Incremental_input_entry::Incremental_input_entry): Initialize new
1938 data member.
1939 (Incremental_input_entry::set_offset): Store file index.
1940 (Incremental_input_entry::get_file_index): New function.
1941 (Incremental_input_entry::file_index_): New data member.
1942 (Incremental_binary::process_got_plt): New function.
1943 (Incremental_binary::do_process_got_plt): New function.
1944 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1945 data members.
1946 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1947 (Sized_incremental_binary::set_file_is_unchanged): New function.
1948 (Sized_incremental_binary::file_is_unchanged): New function.
1949 (Sized_incremental_binary::do_process_got_plt): New function.
1950 (Sized_incremental_binary::file_status_): New data member.
1951 (Sized_incremental_binary::main_symtab_loc_): New data member.
1952 (Sized_incremental_binary::main_strtab_loc_): New data member.
1953 * output.cc (Output_data_got::Got_entry::write): Add case
1954 RESERVED_CODE.
1955 (Output_data_got::add_global): Call add_got_entry.
1956 (Output_data_got::add_global_plt): Likewise.
1957 (Output_data_got::add_global_with_rel): Likewise.
1958 (Output_data_got::add_global_with_rela): Likewise.
1959 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1960 (Output_data_got::add_global_pair_with_rela): Likewise.
1961 (Output_data_got::add_local): Call add_got_entry.
1962 (Output_data_got::add_local_plt): Likewise.
1963 (Output_data_got::add_local_with_rel): Likewise.
1964 (Output_data_got::add_local_with_rela): Likewise.
1965 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1966 (Output_data_got::add_local_pair_with_rela): Likewise.
1967 (Output_data_got::reserve_slot): New function.
1968 (Output_data_got::reserve_slot_for_global): New function.
1969 (Output_data_got::add_got_entry): New function.
1970 (Output_data_got::add_got_entry_pair): New function.
1971 (Output_section::add_output_section_data): Edit FIXME.
1972 * output.h
1973 (Output_section_data_build::Output_section_data_build): New
1974 constructor with size parameter.
1975 (Output_data_space::Output_data_space): Likewise.
1976 (Output_data_got::Output_data_got): Initialize new data member; new
1977 constructor with size parameter.
1978 (Output_data_got::add_constant): Call add_got_entry.
1979 (Output_data_got::reserve_slot): New function.
1980 (Output_data_got::reserve_slot_for_global): New function.
1981 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1982 (Output_data_got::add_got_entry): New function.
1983 (Output_data_got::add_got_entry_pair): New function.
1984 (Output_data_got::free_list_): New data member.
1985 * target.h (Sized_target::init_got_plt_for_update): New function.
1986 (Sized_target::register_global_plt_entry): New function.
1987 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1988 Initialize new data member; call init; add constructor with PLT count.
1989 (Output_data_plt_x86_64::init): New function.
1990 (Output_data_plt_x86_64::add_relocation): New function.
1991 (Output_data_plt_x86_64::reserve_slot): New function.
1992 (Output_data_plt_x86_64::free_list_): New data member.
1993 (Target_x86_64::init_got_plt_for_update): New function.
1994 (Target_x86_64::register_global_plt_entry): New function.
1995 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1996 incremental updates.
1997 (Output_data_plt_x86_64::add_relocation): New function.
1998 * testsuite/object_unittest.cc (Object_test): Set default options.
1999
ec69d6da
ILT
20002011-05-16 Ian Lance Taylor <iant@google.com>
2001
2002 * options.h (class General_options): Make -i a synonym for -r.
2003
732e31de
ILT
20042011-05-16 Ian Lance Taylor <iant@google.com>
2005
2006 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2007
403676b5
CC
20082011-05-10 Cary Coutant <ccoutant@google.com>
2009
2010 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2011 strip_all (-s).
2012
5b7b7d6e
ILT
20132011-05-06 Ian Lance Taylor <iant@google.com>
2014
2015 * layout.cc (Layout::layout): If the output section flags change,
2016 update the ordering.
2017
f0f9babf
CC
20182011-04-25 Cary Coutant <ccoutant@google.com>
2019
2020 * incremental-dump.cc (dump_incremental_inputs): Print local
2021 symbol info for each input file.
2022 * incremental.cc
2023 (Output_section_incremental_inputs::set_final_data_size): Add local
2024 symbol info to input file entries in incremental info.
2025 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2026 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2027 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2028 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2029 implementation.
2030 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2031 (Sized_incr_relobj::do_relocate): Write the local symbols.
2032 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2033 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2034 Adjust size of input file header.
2035 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2036 (Incremental_inputs_reader::get_local_symbol_count): New function.
2037 (Incremental_inputs_reader::get_input_section): Adjust size of input
2038 file header.
2039 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2040 (Sized_incr_relobj::This): New typedef.
2041 (Sized_incr_relobj::sym_size): New const data member.
2042 (Sized_incr_relobj::Local_symbol): New struct.
2043 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2044 (Sized_incr_relobj::do_local_symbol_offset): New function.
2045 (Sized_incr_relobj::local_symbol_count_): New data member.
2046 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2047 (Sized_incr_relobj::local_symbol_index_): New data member.
2048 (Sized_incr_relobj::local_symbol_offset_): New data member.
2049 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2050 (Sized_incr_relobj::local_symbols_): New data member.
2051 * object.h (Relobj::output_local_symbol_count): New function.
2052 (Relobj::local_symbol_offset): New function.
2053 (Relobj::do_output_local_symbol_count): New function.
2054 (Relobj::do_local_symbol_offset): New function.
2055 (Sized_relobj::do_output_local_symbol_count): New function.
2056 (Sized_relobj::do_local_symbol_offset): New function.
2057
d0a9ace3
ILT
20582011-04-22 Vladimir Simonov <sv@sw.ru>
2059
2060 * descriptors.cc (set_close_on_exec): New function.
2061 (Descriptors::open): Use set_close_on_exec.
2062 * output.cc (S_ISLNK): Define if not defined.
2063
94a3fc8b
CC
20642011-04-22 Cary Coutant <ccoutant@google.com>
2065
2066 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2067 global symbol map.
2068 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2069 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2070 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2071 relocations.
2072 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2073 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2074 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2075 * incremental.h
2076 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2077 function.
2078 (Incremental_binary::apply_incremental_relocs): New function.
2079 (Incremental_binary::do_apply_incremental_relocs): New function.
2080 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2081 data member.
2082 (Sized_incremental_binary::add_global_symbol): New function.
2083 (Sized_incremental_binary::global_symbol): New function.
2084 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2085 (Sized_incremental_binary::symbol_map_): New data member.
2086 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2087 * target.h (Sized_target::apply_relocation): New function.
2088 * target-reloc.h (apply_relocation): New function.
2089 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2090
c87e4302
DK
20912011-04-22 Doug Kwan <dougkwan@google.com>
2092
2093 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2094 flag of a SHT_ARM_EXIDX section.
2095 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2096 * testsuite/Makefile.in: Regenerate.
2097 * testsuite/arm_exidx_test.s: New file.
2098 * testsuite/arm_exidx_test.sh: Same.
2099
e7782cf6
CC
21002011-04-20 Cary Coutant <ccoutant@google.com>
2101
2102 PR gold/12689
2103 * archive.h (Incremental_archive_entry::Archive_member):
2104 Initialize arg_serial_ (second constructor).
2105
308ecdc7
ILT
21062011-04-17 Ian Lance Taylor <iant@google.com>
2107
2108 * object.cc (Relocate_info::location): Simplify location string.
2109 * errors.cc (Errors::error_at_location): Don't print program
2110 name.
2111 (Errors::warning_at_location): Likewise.
2112 (Errors::undefined_symbol): Likewise.
2113 * testsuite/debug_msg.sh: Update accordingly.
2114
bec5b579
CC
21152011-04-14 Cary Coutant <ccoutant@google.com>
2116
2117 * gold/layout.cc (Layout::symtab_section_offset): New function.
2118 * gold/layout.h (Layout::symtab_section_offset): New function.
2119 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2120
88597d34
ILT
21212011-04-12 Ian Lance Taylor <iant@google.com>
2122
2123 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2124 with MREMAP_MAYMOVE.
2125 * output.h (class Output_file): Add map_is_allocated_ field.
2126 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2127 not available, provide stubs. If mremap is not available, #define
2128 it to gold_mremap.
2129 (MREMAP_MAYMOVE): Define if not defined.
2130 (Output_file::Output_file): Initialize map_is_allocated_.
2131 (Output_file::resize): Check map_is_allocated_.
2132 (Output_file::map_anonymous): If mmap fails, use malloc.
2133 (Output_file::unmap): Don't do anything for an anonymous map.
2134 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2135 is not available, provide stubs.
2136 (File_read::View::~View): Use free rather than delete[].
2137 (File_read::make_view): Use malloc rather than new[]. If mmap
2138 fails, use malloc.
2139 (File_read::find_or_make_view): Use malloc rather than new[].
2140 * gold.h: Remove HAVE_REMAP code.
2141 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2142 exists. Rename mremap to gold_mremap. If mmap is not available
2143 don't do anything.
2144 * configure, config.in: Rebuild.
2145
11e361bc
ILT
21462011-04-11 Ian Lance Taylor <iant@google.com>
2147
2148 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2149 initialize local variable v.
2150
cdc29364
CC
21512011-04-11 Cary Coutant <ccoutant@google.com>
2152
2153 * archive.cc (Archive::include_member): Adjust call to
2154 report_object.
2155 (Add_archive_symbols::run): Track argument serial numbers.
2156 (Lib_group::include_member): Likewise.
2157 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2158 * archive.h (Incremental_archive_entry::Archive_member):
2159 Initialize arg_serial_.
2160 (Archive_member::arg_serial_): New data member.
2161 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2162 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2163 incremental link.
2164 (Sized_dynobj::do_for_all_local_got_entries): New function.
2165 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2166 function.
2167 * fileread.cc (get_mtime): New function.
2168 * fileread.h (get_mtime): New function.
2169 * gold.cc (queue_initial_tasks): Check for incremental update.
2170 (process_incremental_input): New function.
2171 (queue_middle_tasks): Don't force valid target for incremental
2172 update.
2173 * incremental-dump.cc (find_input_containing_global): Adjust
2174 size of symbol info entry.
2175 (dump_incremental_inputs): Dump argument serial number and
2176 in_system_directory flag; bias shndx by 1; print symbol names
2177 when dumping per-file symbol lists; use new symbol info readers.
2178 * incremental.cc
2179 (Output_section_incremental_inputs:update_data_size): New function.
2180 (Sized_incremental_binary::setup_readers): Setup input readers
2181 for each input file; build maps for files added from libraries
2182 and scripts.
2183 (Sized_incremental_binary::check_input_args): New function.
2184 (Sized_incremental_binary::do_check_inputs): Build map of argument
2185 serial numbers to input arguments.
2186 (Sized_incremental_binary::do_file_has_changed): Rename
2187 do_file_is_unchanged to this; compare file modification times.
2188 (Sized_incremental_binary::do_init_layout): New function.
2189 (Sized_incremental_binary::do_reserve_layout): New function.
2190 (Sized_incremental_binary::do_get_input_reader): Remove.
2191 (Sized_incremental_binary::get_symtab_view): New function.
2192 (Incremental_checker::can_incrementally_link_output_file): Remove.
2193 (Incremental_inputs::report_command_line): Exclude --debug options.
2194 (Incremental_inputs::report_archive_begin): Add parameter; track
2195 argument serial numbers; don't put input file entry for archive
2196 before archive members.
2197 (Incremental_inputs::report_archive_end): Put input file entry
2198 for archive after archive members.
2199 (Incremental_inputs::report_object): Add parameter; track argument
2200 serial numbers and in_system_directory flag.
2201 (Incremental_inputs::report_script): Add parameter; track argument
2202 serial numbers.
2203 (Output_section_incremental_inputs::set_final_data_size): Adjust
2204 size of symbol info entry; check for forwarding symbols.
2205 (Output_section_incremental_inputs::write_input_files): Write
2206 in_system_directory flag and argument serial number.
2207 (Output_section_incremental_inputs::write_info_blocks): Map section
2208 indices between incremental info and original input file; store
2209 input section index for each symbol.
2210 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2211 change operator() to visit().
2212 (class Global_got_offset_visitor): Likewise.
2213 (class Global_symbol_visitor_got_plt):
2214 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2215 classes.
2216 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2217 (Sized_incr_relobj::do_read_symbols): New function.
2218 (Sized_incr_relobj::do_layout): New function.
2219 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2220 (Sized_incr_relobj::do_add_symbols): New function.
2221 (Sized_incr_relobj::do_should_include_member): New function.
2222 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2223 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2224 (Sized_incr_relobj::do_section_size): New function.
2225 (Sized_incr_relobj::do_section_name): New function.
2226 (Sized_incr_relobj::do_section_contents): New function.
2227 (Sized_incr_relobj::do_section_flags): New function.
2228 (Sized_incr_relobj::do_section_entsize): New function.
2229 (Sized_incr_relobj::do_section_address): New function.
2230 (Sized_incr_relobj::do_section_type): New function.
2231 (Sized_incr_relobj::do_section_link): New function.
2232 (Sized_incr_relobj::do_section_info): New function.
2233 (Sized_incr_relobj::do_section_addralign): New function.
2234 (Sized_incr_relobj::do_initialize_xindex): New function.
2235 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2236 (Sized_incr_relobj::do_read_relocs): New function.
2237 (Sized_incr_relobj::do_gc_process_relocs): New function.
2238 (Sized_incr_relobj::do_scan_relocs): New function.
2239 (Sized_incr_relobj::do_count_local_symbols): New function.
2240 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2241 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2242 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2243 (Sized_incr_relobj::do_relocate): New function.
2244 (Sized_incr_relobj::do_set_section_offset): New function.
2245 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2246 (Sized_incr_dynobj::do_read_symbols): New function.
2247 (Sized_incr_dynobj::do_layout): New function.
2248 (Sized_incr_dynobj::do_add_symbols): New function.
2249 (Sized_incr_dynobj::do_should_include_member): New function.
2250 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2251 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2252 (Sized_incr_dynobj::do_section_size): New function.
2253 (Sized_incr_dynobj::do_section_name): New function.
2254 (Sized_incr_dynobj::do_section_contents): New function.
2255 (Sized_incr_dynobj::do_section_flags): New function.
2256 (Sized_incr_dynobj::do_section_entsize): New function.
2257 (Sized_incr_dynobj::do_section_address): New function.
2258 (Sized_incr_dynobj::do_section_type): New function.
2259 (Sized_incr_dynobj::do_section_link): New function.
2260 (Sized_incr_dynobj::do_section_info): New function.
2261 (Sized_incr_dynobj::do_section_addralign): New function.
2262 (Sized_incr_dynobj::do_initialize_xindex): New function.
2263 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2264 (make_sized_incremental_object): New function.
2265 (Incremental_library::copy_unused_symbols): New function.
2266 (Incremental_library::do_for_all_unused_symbols): New function.
2267 * incremental.h (enum Incremental_input_flags): New type.
2268 (class Incremental_checker): Remove.
2269 (Incremental_input_entry::Incremental_input_entry): Add argument
2270 serial number.
2271 (Incremental_input_entry::arg_serial): New function.
2272 (Incremental_input_entry::set_is_in_system_directory): New function.
2273 (Incremental_input_entry::is_in_system_directory): New function.
2274 (Incremental_input_entry::arg_serial_): New data member.
2275 (Incremental_input_entry::is_in_system_directory_): New data member.
2276 (class Script_info): Move here from script.h.
2277 (Script_info::Script_info): Add filename parameter.
2278 (Script_info::filename): New function.
2279 (Script_info::filename_): New data member.
2280 (Incremental_script_entry::Incremental_script_entry): Add argument
2281 serial number.
2282 (Incremental_object_entry::Incremental_object_entry): Likewise.
2283 (Incremental_object_entry::add_input_section): Build list of input
2284 sections with map to original shndx.
2285 (Incremental_object_entry::get_input_section_index): New function.
2286 (Incremental_object_entry::shndx_): New data member.
2287 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2288 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2289 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2290 serial number.
2291 (Incremental_inputs::report_archive_begin): Likewise.
2292 (Incremental_inputs::report_object): Likewise.
2293 (Incremental_inputs::report_script): Likewise.
2294 (class Incremental_global_symbol_reader): New class.
2295 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2296 and store flags and input file type.
2297 (Incremental_input_entry_reader::arg_serial): New function.
2298 (Incremental_input_entry_reader::type): Extract type from flags.
2299 (Incremental_input_entry_reader::is_in_system_directory): New function.
2300 (Incremental_input_entry_reader::get_input_section_count): Call
2301 accessor function for type.
2302 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2303 function for type; adjust size of global symbol entry.
2304 (Incremental_input_entry_reader::get_global_symbol_count): Call
2305 accessor function for type.
2306 (Incremental_input_entry_reader::get_object_count): Likewise.
2307 (Incremental_input_entry_reader::get_object_offset): Likewise.
2308 (Incremental_input_entry_reader::get_member_count): Likewise.
2309 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2310 (Incremental_input_entry_reader::get_member_offset): Likewise.
2311 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2312 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2313 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2314 (Incremental_input_entry_reader::get_global_symbol_reader): New
2315 function.
2316 (Incremental_input_entry_reader::get_output_symbol_index): New
2317 function.
2318 (Incremental_input_entry_reader::type_): Remove.
2319 (Incremental_input_entry_reader::flags_): New data member.
2320 (Incremental_inputs_reader::input_file_offset): New function.
2321 (Incremental_inputs_reader::input_file_index): New function.
2322 (Incremental_inputs_reader::input_file): Call input_file_offset.
2323 (Incremental_inputs_reader::input_file_at_offset): New function.
2324 (Incremental_relocs_reader::get_r_type): Reformat.
2325 (Incremental_relocs_reader::get_r_shndx): Reformat.
2326 (Incremental_relocs_reader::get_r_offset): Reformat.
2327 (Incremental_relocs_reader::data): New function.
2328 (Incremental_binary::Incremental_binary): Initialize new data members.
2329 (Incremental_binary::check_inputs): Add cmdline parameter.
2330 (Incremental_binary::file_is_unchanged): Remove.
2331 (Input_reader::arg_serial): New function.
2332 (Input_reader::get_unused_symbol_count): New function.
2333 (Input_reader::get_unused_symbol): New function.
2334 (Input_reader::do_arg_serial): New function.
2335 (Input_reader::do_get_unused_symbol_count): New function.
2336 (Input_reader::do_get_unused_symbol): New function.
2337 (Incremental_binary::input_file_count): New function.
2338 (Incremental_binary::get_input_reader): Change signature to use
2339 index instead of filename.
2340 (Incremental_binary::file_has_changed): New function.
2341 (Incremental_binary::get_input_argument): New function.
2342 (Incremental_binary::get_library): New function.
2343 (Incremental_binary::get_script_info): New function.
2344 (Incremental_binary::init_layout): New function.
2345 (Incremental_binary::reserve_layout): New function.
2346 (Incremental_binary::output_file): New function.
2347 (Incremental_binary::do_check_inputs): New function.
2348 (Incremental_binary::do_file_is_unchanged): Remove.
2349 (Incremental_binary::do_file_has_changed): New function.
2350 (Incremental_binary::do_init_layout): New function.
2351 (Incremental_binary::do_reserve_layout): New function.
2352 (Incremental_binary::do_input_file_count): New function.
2353 (Incremental_binary::do_get_input_reader): Change signature.
2354 (Incremental_binary::input_args_map_): New data member.
2355 (Incremental_binary::library_map_): New data member.
2356 (Incremental_binary::script_map_): New data member.
2357 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2358 new data members.
2359 (Sized_incremental_binary::output_section): New function.
2360 (Sized_incremental_binary::inputs_reader): Add const.
2361 (Sized_incremental_binary::symtab_reader): Add const.
2362 (Sized_incremental_binary::relocs_reader): Add const.
2363 (Sized_incremental_binary::got_plt_reader): Add const.
2364 (Sized_incremental_binary::get_symtab_view): New function.
2365 (Sized_incremental_binary::Inputs_reader): New typedef.
2366 (Sized_incremental_binary::Input_entry_reader): New typedef.
2367 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2368 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2369 (Sized_incremental_binary::do_file_has_changed): New function.
2370 (Sized_incremental_binary::do_init_layout): New function.
2371 (Sized_incremental_binary::do_reserve_layout): New function.
2372 (Sized_input_reader::Inputs_reader): Remove.
2373 (Sized_input_reader::Input_entry_reader): Remove.
2374 (Sized_input_reader::do_arg_serial): New function.
2375 (Sized_input_reader::do_get_unused_symbol_count): New function.
2376 (Sized_input_reader::do_get_unused_symbol): New function.
2377 (Sized_incremental_binary::do_input_file_count): New function.
2378 (Sized_incremental_binary::do_get_input_reader): Change signature;
2379 use index instead of filename.
2380 (Sized_incremental_binary::section_map_): New data member.
2381 (Sized_incremental_binary::input_entry_readers_): New data member.
2382 (class Sized_incr_relobj): New class.
2383 (class Sized_incr_dynobj): New class.
2384 (make_sized_incremental_object): New function.
2385 (class Incremental_library): New class.
2386 * layout.cc (Free_list::num_lists): New static data member.
2387 (Free_list::num_nodes): New static data member.
2388 (Free_list::num_removes): New static data member.
2389 (Free_list::num_remove_visits): New static data member.
2390 (Free_list::num_allocates): New static data member.
2391 (Free_list::num_allocate_visits): New static data member.
2392 (Free_list::init): New function.
2393 (Free_list::remove): New function.
2394 (Free_list::allocate): New function.
2395 (Free_list::dump): New function.
2396 (Free_list::print_stats): New function.
2397 (Layout_task_runner::run): Resize output file for incremental updates.
2398 (Layout::Layout): Initialize new data members.
2399 (Layout::set_incremental_base): New function.
2400 (Layout::init_fixed_output_section): New function.
2401 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2402 incremental updates.
2403 (Layout::create_gold_note): Do not create gold note section for
2404 incremental updates.
2405 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2406 for incremental updates.
2407 (Layout::set_section_offsets): For incremental updates, allocate space
2408 from free list.
2409 (Layout::create_symtab_sections): Layout with offsets relative to
2410 start of section; for incremental updates, allocate space from free
2411 list.
2412 (Layout::create_shdrs): For incremental updates, allocate space from
2413 free list.
2414 (Layout::finish_dynamic_section): For incremental updates, do not
2415 check --as-needed (fixed in subsequent patch).
2416 * layout.h (class Free_list): New class.
2417 (Layout::set_incremental_base): New function.
2418 (Layout::incremental_base): New function.
2419 (Layout::init_fixed_output_section): New function.
2420 (Layout::allocate): New function.
2421 (Layout::incremental_base_): New data member.
2422 (Layout::free_list_): New data member.
2423 * main.cc (main): Print Free_list statistics.
2424 * object.cc (Relobj::finalize_incremental_relocs): Add
2425 clear_counts parameter; clear counts only when clear_counts is set.
2426 (Sized_relobj::Sized_relobj): Initialize new base class.
2427 (Sized_relobj::do_layout): Don't report special sections.
2428 (Sized_relobj::do_for_all_local_got_entries): New function.
2429 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2430 symtab_off to all symbol table offsets.
2431 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2432 * object.h (class Got_offset_list): Move to top of file.
2433 (Object::Object): Allow case where input_file == NULL.
2434 (Object::~Object): Likewise.
2435 (Object::input_file): Assert that input_file != NULL.
2436 (Object::lock): Allow case where input_file == NULL.
2437 (Object::unlock): Likewise.
2438 (Object::is_locked): Likewise.
2439 (Object::token): Likewise.
2440 (Object::release): Likewise.
2441 (Object::is_incremental): New function.
2442 (Object::get_mtime): New function.
2443 (Object::for_all_local_got_entries): New function.
2444 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2445 (Object::set_is_in_system_directory): New function.
2446 (Object::is_in_system_directory): New function.
2447 (Object::do_is_incremental): New function.
2448 (Object::do_get_mtime): New function.
2449 (Object::do_for_all_local_got_entries): New function.
2450 (Object::is_in_system_directory_): New data member.
2451 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2452 (class Sized_relobj_base): New class.
2453 (class Sized_relobj): Derive from Sized_relobj_base.
2454 (class Sized_relobj::Symbols): Redeclare from base class.
2455 (class Sized_relobj::local_got_offset_list): Remove.
2456 (class Sized_relobj::Output_sections): Redeclare from base class.
2457 (class Sized_relobj::do_for_all_local_got_entries): New function.
2458 (class Sized_relobj::write_local_symbols): Add offset parameter.
2459 (class Sized_relobj::local_symbol_offset_): Update comment.
2460 (class Sized_relobj::local_dynsym_offset_): Update comment.
2461 * options.cc (Input_arguments::add_file): Remove const.
2462 * options.h (Input_file_argument::Input_file_argument):
2463 Initialize arg_serial_ (all constructors).
2464 (Input_file_argument::set_arg_serial): New function.
2465 (Input_file_argument::arg_serial): New function.
2466 (Input_file_argument::arg_serial_): New data member.
2467 (Input_arguments::Input_arguments): Initialize file_count_.
2468 (Input_arguments::add_file): Remove const.
2469 (Input_arguments::number_of_input_files): New function.
2470 (Input_arguments::file_count_): New data member.
2471 (Command_line::number_of_input_files): Call
2472 Input_arguments::number_of_input_files.
2473 * output.cc (Output_segment_headers::Output_segment_headers):
2474 Set current size.
2475 (Output_section::Input_section::current_data_size): New function.
2476 (Output_section::Output_section): Initialize new data members.
2477 (Output_section::add_input_section): Don't do merge sections for
2478 an incremental link; allocate space from free list for an
2479 incremental update.
2480 (Output_section::add_output_section_data): Allocate space from
2481 free list for an incremental update.
2482 (Output_section::update_data_size): New function.
2483 (Output_section::set_fixed_layout): New function.
2484 (Output_section::reserve): New function.
2485 (Output_segment::set_section_addresses): Remove const.
2486 (Output_segment::set_section_list_addresses): Remove const; allocate
2487 space from free list for an incremental update.
2488 (Output_segment::set_offset): Adjust size of RELRO segment for an
2489 incremental update.
2490 * output.h (Output_data::current_data_size): Move here from
2491 child classes.
2492 (Output_data::pre_finalize_data_size): New function.
2493 (Output_data::update_data_size): New function.
2494 (Output_section_headers::update_data_size): new function.
2495 (Output_section_data_build::current_data_size): Move to Output_data.
2496 (Output_data_strtab::update_data_size): New function.
2497 (Output_section::current_data_size): Move to Output_data.
2498 (Output_section::set_fixed_layout): New function.
2499 (Output_section::has_fixed_layout): New function.
2500 (Output_section::reserve): New function.
2501 (Output_section::update_data_size): New function.
2502 (Output_section::has_fixed_layout_): New data member.
2503 (Output_section::free_list_): New data member.
2504 (Output_segment::set_section_addresses): Remove const.
2505 (Output_segment::set_section_list_addresses): Remove const.
2506 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2507 New function.
2508 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2509 New function.
2510 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2511 parameter when calling Add_symbols constructor; store argument
2512 serial number for members of a lib group.
2513 (Add_symbols::locks): Allow case where token == NULL.
2514 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2515 (Read_member::~Read_member): New function.
2516 (Read_member::is_runnable): New function.
2517 (Read_member::locks): New function.
2518 (Read_member::run): New function.
2519 (Check_script::~Check_script): New function.
2520 (Check_script::is_runnable): New function.
2521 (Check_script::locks): New function.
2522 (Check_script::run): New function.
2523 (Check_library::~Check_library): New function.
2524 (Check_library::is_runnable): New function.
2525 (Check_library::locks): New function.
2526 (Check_library::run): New function.
2527 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2528 (Add_symbols::library_): New data member.
2529 (class Read_member): New class.
2530 (class Check_script): New class.
2531 (class Check_library): New class.
2532 * reloc.cc (Read_relocs::is_runnable): Allow case where
2533 token == NULL.
2534 (Read_relocs::locks): Likewise.
2535 (Scan_relocs::locks): Likewise.
2536 (Relocate_task::locks): Likewise.
2537 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2538 to clear counters.
2539 (Sized_relobj::incremental_relocs_scan): Fix comment.
2540 (Sized_relobj::do_relocate): Pass output file offset to
2541 write_local_symbols.
2542 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2543 from class declaration.
2544 * script.cc (read_input_script): Allocate Script_info; pass
2545 argument serial number to report_script.
2546 * script.h (class Script_info): Move to incremental.h.
2547 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2548 * symtab.h (Symbol_table::add_from_incrobj): New function.
2549 (Symbol_table::set_file_offset): New function.
2550
b961d0d7
CC
25512011-04-05 Cary Coutant <ccoutant@google.com>
2552
2553 * incremental-dump.cc (dump_incremental_inputs): Change signature
2554 to take a Sized_incremental_binary; change caller. Use readers
2555 in Sized_incremental_binary.
2556 * incremental.cc
2557 (Sized_incremental_binary::find_incremental_inputs_sections):
2558 Rename do_find_incremental_inputs_sections to this.
2559 (Sized_incremental_binary::setup_readers): New function.
2560 (Sized_incremental_binary::do_check_inputs): Check
2561 has_incremental_info_ flag; move setup code to setup_readers;
2562 use input readers.
2563 (Sized_incremental_binary::do_file_is_unchanged): New function.
2564 (Sized_incremental_binary::do_get_input_reader): New function.
2565 * incremental.h (class Incremental_binary): Move to end of file.
2566 (Incremental_binary::file_is_unchanged): New function.
2567 (Incremental_binary::do_file_is_unchanged): New function.
2568 (Incremental_binary::Input_reader): New class.
2569 (Incremental_binary::get_input_reader): New function.
2570 (class Sized_incremental_binary): Move to end of file.
2571 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2572 input section reader classes.
2573 (Sized_incremental_binary::has_incremental_info): New function.
2574 (Sized_incremental_binary::inputs_reader): New function.
2575 (Sized_incremental_binary::symtab_reader): New function.
2576 (Sized_incremental_binary::relocs_reader): New function.
2577 (Sized_incremental_binary::got_plt_reader): New function.
2578 (Sized_incremental_binary::do_file_is_unchanged): New function.
2579 (Sized_incremental_binary::Sized_input_reader): New class.
2580 (Sized_incremental_binary::get_input_reader): New function.
2581 (Sized_incremental_binary::find_incremental_inputs_sections):
2582 Rename do_find_incremental_inputs_sections to this.
2583 (Sized_incremental_binary::setup_readers): New function.
2584 (Sized_incremental_binary::has_incremental_info_): New data member.
2585 (Sized_incremental_binary::inputs_reader_): New data member.
2586 (Sized_incremental_binary::symtab_reader_): New data member.
2587 (Sized_incremental_binary::relocs_reader_): New data member.
2588 (Sized_incremental_binary::got_plt_reader_): New data member.
2589 (Sized_incremental_binary::current_input_file_): New data member.
2590
a869183f
PP
25912011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2592
2593 PR gold/12640
2594 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2595 violation.
2596
25972011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
2598
2599 * archive.cc (Archive::include_member): Adjust call to report_object.
2600 (Add_archive_symbols::run): Add script_info to call to
2601 report_archive_begin.
2602 (Lib_group::include_member): Adjust call to report_object.
2603 (Add_lib_group_symbols::run): Adjust call to report_object.
2604 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2605 blocks. Add object count for script input files.
2606 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2607 script_info parameter; change all callers.
2608 (Incremental_inputs::report_object): Add script_info parameter;
2609 change all callers.
2610 (Incremental_inputs::report_script): Store backpointer to
2611 incremental info entry.
2612 (Output_section_incremental_inputs::set_final_data_size): Record
2613 additional information for scripts.
2614 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2615 * incremental.h (Incremental_script_entry::add_object): New function.
2616 (Incremental_script_entry::get_object_count): New function.
2617 (Incremental_script_entry::get_object): New function.
2618 (Incremental_script_entry::objects_): New data member; adjust
2619 constructor.
2620 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2621 (Incremental_inputs::report_object): Add script_info parameter.
2622 (Incremental_inputs_reader::get_object_count): New function.
2623 (Incremental_inputs_reader::get_object_offset): New function.
2624 * options.cc (Input_arguments::add_file): Return reference to
2625 new input argument.
2626 * options.h (Input_argument::set_script_info): New function.
2627 (Input_argument::script_info): New function.
2628 (Input_argument::script_info_): New data member; adjust all
2629 constructors.
2630 (Input_file_group::add_file): Return reference to new input argument.
2631 (Input_file_lib::add_file): Likewise.
2632 (Input_arguments::add_file): Likewise.
2633 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2634 * script.cc (Parser_closure::Parser_closure): Add script_info
2635 parameter; adjust all callers.
2636 (Parser_closure::script_info): New function.
2637 (Parser_closure::script_info_): New data member.
2638 (read_input_script): Report scripts earlier to incremental info.
2639 (script_add_file): Set script_info in Input_argument.
2640 (script_add_library): Likewise.
2641 * script.h (Script_options::Script_info): Rewrite class.
2642
a869183f 26432011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
2644
2645 * archive.cc (Library_base::should_include_member): Move
2646 method here from class Archive.
2647 (Archive::Archive): Initialize base class.
2648 (Archive::should_include_member): Move to base class.
2649 (Archive::do_for_all_unused_symbols): New function.
2650 (Add_archive_symbols::run): Remove redundant access to
2651 incremental_inputs.
2652 (Lib_group::Lib_group): Initialize base class.
2653 (Lib_group::do_filename): New function.
2654 (Lib_group::include_member): Pass pointer to Lib_group to
2655 report_object.
2656 (Lib_group::do_for_all_unused_symbols): New function.
2657 (Add_lib_group_symbols::run): Report archive information for
2658 incremental links.
2659 * archive.h (class Library_base): New base class.
2660 (class Archive): Derive from Library_base.
2661 (Archive::filename): Move to base class.
2662 (Archive::set_incremental_info): Likewise.
2663 (Archive::incremental_info): Likewise.
2664 (Archive::Should_include): Likewise.
2665 (Archive::should_include_member): Likewise.
2666 (Archive::Armap_entry): Remove.
2667 (Archive::Unused_symbol_iterator): Remove.
2668 (Archive::unused_symbols_begin): Remove.
2669 (Archive::unused_symbols_end): Remove.
2670 (Archive::do_filename): New function.
2671 (Archive::do_get_mtime): New function.
2672 (Archive::do_for_all_unused_symbols): New function.
2673 (Archive::task_): Move to base class.
2674 (Archive::incremental_info_): Likewise.
2675 (class Lib_group): Derive from Library_base.
2676 (Lib_group::do_filename): New function.
2677 (Lib_group::do_get_mtime): New function.
2678 (Lib_group::do_for_all_unused_symbols): New function.
2679 (Lib_group::task_): Move to base class.
2680 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2681 function.
2682 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2683 function.
2684 * incremental.cc (Incremental_inputs::report_archive_begin):
2685 Use Library_base; call library's get_mtime; add incremental inputs
2686 entry before members.
2687 (class Unused_symbol_visitor): New class.
2688 (Incremental_inputs::report_archive_end): Use Library_base; use
2689 visitor class to record unused symbols; don't add incremental inputs
2690 entry after members.
2691 (Incremental_inputs::report_object): Use Library_base.
2692 * incremental.h
2693 (Incremental_archive_entry::Incremental_archive_entry): Remove
2694 unused Archive parameter.
2695 (Incremental_inputs::report_archive_begin): Use Library_base.
2696 (Incremental_inputs::report_archive_end): Likewise.
2697 (Incremental_inputs::report_object): Likewise.
2698 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2699 function.
2700 * object.h (Object::for_all_global_symbols): New function.
2701 (Object::do_for_all_global_symbols): New function.
2702 (Sized_relobj::do_for_all_global_symbols): New function.
2703 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2704 function.
2705 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2706 function.
2707
61ab3e40
ILT
27082011-03-27 Ian Lance Taylor <iant@google.com>
2709
2710 * archive.cc (Archive::interpret_header): Return -1 if something
2711 goes wrong. Change callers accordingly.
2712
30e1f9e6
CC
27132011-03-25 Cary Coutant <ccoutant@google.com>
2714
2715 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2716 * testsuite/Makefile.in: Regenerate.
2717
9370ce59 27182011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
9c793f14
RÁE
2719
2720 * plugin.cc (get_view): New.
2721 (Plugin::load): Pass get_view to the plugin.
2722 (Plugin_manager::get_view): New.
2723
9312bb0a
ILT
27242011-03-21 Ian Lance Taylor <iant@google.com>
2725
2726 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 2727 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 2728
7e12ba9e
ST
27292011-03-21 Sriraman Tallam <tmsriram@google.com>
2730
2731 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2732 Change == to -eq.
2733 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2734 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2735 Change == to -eq.
2736 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2737 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2738
fd7a005d
ILT
27392011-03-14 Ian Lance Taylor <iant@google.com>
2740
2741 * script-sections.cc (Sort_output_sections::script_compare):
2742 Rename from is_before, change return type.
2743 (Sort_output_sections::operator()): Adjust accordingly.
2744
ed16fd1b
ILT
27452011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2746
2747 PR gold/12572
2748 * testsuite/odr_violation2.cc: Add comment to make all error line
2749 numbers double digits.
2750 * testsuite/debug_msg.sh: Adjust expected errors.
2751
71ff8986
ILT
27522011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2753
2754 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2755 but mark earlier ones as non-canonical
2756 (offset_to_iterator): Update search target and example
2757 (do_addr2line): Return extra lines in a vector*
2758 (format_file_lineno): Extract from do_addr2line
2759 (one_addr2line): Add vector* out-param
2760 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2761 when a lineno entry appeared last for its instruction
2762 (Dwarf_line_info): Add vector* out-param
2763 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2764 * symtab.cc (Odr_violation_compare): Include the lineno in the
2765 comparison again.
2766 (linenos_from_loc): New. Combine the canonical line for an
2767 address with its other lines.
2768 (True_if_intersect): New. Helper functor to make
2769 std::set_intersection a query.
2770 (detect_odr_violations): Compare sets of lines instead of just
2771 one line for each function. This became less deterministic, but
2772 has fewer false positives.
2773 * symtab.h: Declarations.
2774 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2775 mix an optimized and non-optimized object in the same binary
2776 (odr_violation2.so): Same.
2777 * testsuite/Makefile.in: Regenerate from Makefile.am.
2778 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2779 * testsuite/debug_msg.sh: Update line numbers and add
2780 assertions.
2781 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2782 non-optimized context.
2783 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2784 isn't inlined, and use OdrDerived in an optimized context.
2785 * testsuite/odr_header1.h: Defines OdrDerived, where
2786 optimization will change the
2787 first-instruction-in-the-destructor's file and line number.
2788 * testsuite/odr_header2.h: Defines OdrBase.
2789
a19fefdc
ILT
27902011-03-09 Ian Lance Taylor <iant@google.com>
2791
2792 * fileread.cc (File_read::clear_views): Don't delete the whole
2793 file view.
2794
ecb351e9
ILT
27952011-03-08 Ian Lance Taylor <iant@google.com>
2796
2797 PR gold/12525
2798 * fileread.cc: #include <climits>.
2799 (GOLD_IOV_MAX): Define.
2800 (File_read::read_multiple): Limit number of entries by iov_max.
2801 * fileread.h (class File_read): Always set max_readv_entries to
2802 128.
2803
b821d13c
ILT
28042011-03-07 Ian Lance Taylor <iant@google.com>
2805
2806 PR gold/12525
2807 * options.h (class General_options): Add -dy and -dn.
2808
89243142
CC
28092011-03-02 Cary Coutant <ccoutant@google.com>
2810
2811 * testsuite/script_test_9.t: Add TLS segment.
2812
d0773f31
ILT
28132011-03-02 Simon Baldwin <simonb@google.com>
2814
2815 * configure.ac: Add check for gnu_indirect_function support in
2816 the toolchain building binutils.
2817 * configure: Rebuild.
2818
9370ce59 28192011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
badc8139
RÁE
2820
2821 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2822 plugin only symbols.
2823 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2824 in plugin files as not needed in the symbol table.
2825
4cf7a849
ST
28262011-02-11 Sriraman Tallam <tmsriram@google.com>
2827
2828 * output.cc (Output_section::add_input_section): Delay fill
2829 generation for section ordering.
2830
b578bd7d
ILT
28312011-02-09 Ian Lance Taylor <iant@google.com>
2832
2833 PR gold/12316
2834 * object.h (class Sized_relobj): Remove clear_local_symbols.
2835 * reloc.cc (Sized_relobj::do_relocate): Don't call
2836 clear_local_symbols.
2837
9370ce59 28382011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
84ced98a
RÁE
2839
2840 * plugin.cc (is_visible_from_outside): Return true for symbols
2841 in the -u option.
2842
55382fb7
ILT
28432011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2844
2845 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2846 filename.
2847
4e271fff
ST
28482011-02-02 Sriraman Tallam <tmsriram@google.com>
2849
2850 * icf.h (is_section_foldable_candidate): Change type of parameter
2851 to std::string.
2852 * icf.cc (Icf::find_identical_sections): Change type of local variable
2853 section_name to be std::string.
2854 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2855
d433c3ac
ILT
28562011-01-25 Ian Lance Taylor <iant@google.com>
2857
2858 * script.cc (script_add_extern): Rewrite to use
2859 add_symbol_reference.
2860
880473a6
DK
28612011-01-25 Doug Kwan <dougkwan@google.com>
2862
d433c3ac 2863 * icf.cc (get_section_contents): Always lock section's object.
880473a6 2864
f30f86fa
ILT
28652011-01-24 Ian Lance Taylor <iant@google.com>
2866
2867 * options.h (class General_options): Accept
2868 --no-detect-odr-violations.
2869
8e51a0b9
ILT
28702011-01-24 Ian Lance Taylor <iant@google.com>
2871
2872 * version.cc (version_string): Bump to 1.11.
2873
0f3b89d8
ILT
28742011-01-24 Ian Lance Taylor <iant@google.com>
2875
2876 * plugin.cc (class Plugin_rescan): Define new class.
2877 (Plugin_manager::claim_file): Set any_claimed_.
2878 (Plugin_manager::save_archive): New function.
2879 (Plugin_manager::save_input_group): New function.
2880 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2881 necessary.
2882 (Plugin_manager::new_undefined_symbol): New function.
2883 (Plugin_manager::rescan): New function.
2884 (Plugin_manager::rescannable_defines): New function.
2885 (Plugin_manager::add_input_file): Set any_added_.
2886 * plugin.h (class Plugin_manager): define new fields rescannable_,
2887 undefined_symbols_, any_claimed_, and any_added_. Declare
2888 Plugin_rescan as friend. Declare new functions.
2889 (Plugin_manager::Rescannable): Define type.
2890 (Plugin_manager::Rescannable_list): Define type.
2891 (Plugin_manager::Undefined_symbol_list): Define type.
2892 (Plugin_manager::Plugin_manager): Initialize new fields.
2893 * archive.cc (Archive::defines_symbol): New function.
2894 (Add_archive_symbols::run): Pass archive to plugins if any.
2895 * archive.h (class Archive): Declare defines_symbol.
2896 * readsyms.cc (Input_group::~Input_group): New function.
2897 (Finish_group::run): Pass input_group to plugins if any.
2898 * readsyms.h (class Input_group): Declare destructor.
2899 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2900 any.
2901
3bb951e5
ILT
29022011-01-10 Ian Lance Taylor <iant@google.com>
2903
2904 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2905 section as relro.
2906 (Layout::set_segment_offsets): Reset increase_relro before calling
2907 set_section_addresses a second time.
2908
0aa45fac
CC
29092011-01-04 Cary Coutant <ccoutant@google.com>
2910
2911 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2912 sections before NOBITS sections.
2913
0db46eb4
L
29142011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2915
2916 * version.cc (print_version): Update copyright to 2011.
2917
829c9745
CC
29182010-12-23 Cary Coutant <ccoutant@google.com>
2919
2920 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2921 of OS to this->add. Add OD parameter to second form of the function.
2922
7500420b
ILT
29232010-12-20 Ian Lance Taylor <iant@google.com>
2924
2925 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2926 second of two consecutive entries with same offset.
2927
f8e9a930
RW
29282010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2929
2930 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2931 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2932 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2933 to avoid unneeded links against $(LDADD).
2934 * testsuite/Makefile.in: Regenerate.
2935
2fbb4320
ILT
29362010-12-15 Ian Lance Taylor <iant@google.com>
2937
2938 PR gold/12324
2939 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2940 for R_X86_64_32 and R_X86_64_PC32.
2941 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2942 ver_matching_def_pic.o.
2943 (ver_matching_def_pic.o): New target.
2944
fedb228d
RW
29452010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2946
2947 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2948 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2949 Move definition before File_read::View member definitions.
2950 (File_read::View::~View): Initialize and hold lock before
2951 updating current_mapped_bytes.
2952
9b547ce6
RW
29532010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2954
2955 * dwarf_reader.cc: Remove outdated comment.
2956 * gold-threads.cc: Fix typo in error message.
2957 * archive.cc: Fix typos in comments.
2958 * archive.h: Likewise.
2959 * arm-reloc-property.cc: Likewise.
2960 * arm-reloc-property.h: Likewise.
2961 * arm-reloc.def: Likewise.
2962 * arm.cc: Likewise.
2963 * attributes.h: Likewise.
2964 * cref.cc: Likewise.
2965 * ehframe.cc: Likewise.
2966 * fileread.h: Likewise.
2967 * gold.h: Likewise.
2968 * i386.cc: Likewise.
2969 * icf.cc: Likewise.
2970 * incremental.h: Likewise.
2971 * int_encoding.cc: Likewise.
2972 * layout.h: Likewise.
2973 * main.cc: Likewise.
2974 * merge.h: Likewise.
2975 * object.cc: Likewise.
2976 * object.h: Likewise.
2977 * options.cc: Likewise.
2978 * readsyms.cc: Likewise.
2979 * reduced_debug_output.cc: Likewise.
2980 * reloc.cc: Likewise.
2981 * script-sections.cc: Likewise.
2982 * sparc.cc: Likewise.
2983 * symtab.h: Likewise.
2984 * target-reloc.h: Likewise.
2985 * target.cc: Likewise.
2986 * target.h: Likewise.
2987 * timer.cc: Likewise.
2988 * timer.h: Likewise.
2989 * x86_64.cc: Likewise.
2990
83e17bd5
CC
29912010-12-09 Cary Coutant <ccoutant@google.com>
2992
2993 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2994 stack.
2995 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2996 parameter; change all callers.
2997 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2998 * options.h (warn_execstack): New option.
2999
017257f8
DK
30002010-12-07 Doug Kwan <dougkwan@google.com>
3001
3002 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3003 like function call relocations.
3004
c20cbc06
ILT
30052010-12-07 Ian Lance Taylor <iant@google.com>
3006
3007 * archive.cc (Archive::get_elf_object_for_member): Permit
3008 punconfigured to be NULL.
3009 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3010 (Archive::include_member): Pass NULL to get_elf_object_for_member
3011 if we searched for the archive and this is the first included
3012 object.
3013
4dbfafcc
ILT
30142010-12-01 Ian Lance Taylor <iant@google.com>
3015
3016 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3017 track_relocs_type_ field.
3018 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3019 Set track_relocs_type_.
3020 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3021 contents when using RELA relocs.
3022 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3023 reloc_map_.
3024 * reloc.cc (Track_relocs::next_addend): New function.
3025 * reloc.h (class Track_relocs): Declare next_addend.
3026
e5e19edd
ILT
30272010-12-01 Ian Lance Taylor <iant@google.com>
3028
3029 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3030 virtual destructor.
3031
9a5ce24c
ILT
30322010-12-01 Ian Lance Taylor <iant@google.com>
3033
3034 * README: Update compilers known to work and fail.
3035
c7791212
NC
30362010-11-23 Matthias Klose <doko@ubuntu.com>
3037
3038 * configure.in: For --enable-gold, handle value `default' instead of
3039 `both*'. Always install ld as ld.bfd, install as ld if gold is
3040 not the default.
3041 * configure: Regenerate.
3042
0ad220c9
DK
30432010-11-18 Doug Kwan <dougkwan@google.com>
3044
3045 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3046 and right_alignment to be zero. Store result alignment only if it is
3047 greater than existing alignment.
3048
ab8056e0
CC
30492010-11-16 Cary Coutant <ccoutant@google.com>
3050
3051 PR gold/12220
3052 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3053 Check for ".zdebug_line".
3054
fd064a5b
CC
30552010-11-16 Doug Kwan <dougkwan@google.com>
3056 Cary Coutant <ccoutant@google.com>
3057
3058 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3059 by reference; adjust all callers.
3060 * output.cc (Output_segment::set_section_addresses): Adjust references
3061 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3062 list is empty.
3063 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3064 end at page boundary.
3065
6fc6ea19
CC
30662010-11-16 Cary Coutant <ccoutant@google.com>
3067
3068 PR gold/12220
3069 * layout.cc (Layout::choose_output_section): Transform names of
3070 compressed sections even when using a script with a SECTIONS clause.
3071 (Layout::output_section_name): Remove code to transform
3072 compressed debug section names.
3073 * output.cc (Output_section::add_input_section): Use uncompressed
3074 section size when tracking input sections.
3075
95a2c8d6
RS
30762010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3077
3078 * symtab.h (Symbol::NON_PIC_REF): Remove.
3079 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3080 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3081 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3082 (Symbol::use_plt_offset): Take a flags argument and pass it
3083 directly to needs_dynamic_reloc. Restrict check for undefined
3084 weak symbols to function calls.
3085 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3086 (Target_arm::Scan::global): Use it.
3087 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3088 (Target_arm::Relocate::relocate): Likewise.
3089 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3090 parameter with an r_type parameter. Use get_reference_flags
3091 to get the flags.
3092 (Target_arm::Relocate::relocate): Update accordingly.
3093 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3094 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3095 (Target_i386::Scan::global): Likewise.
3096 (Target_i386::Relocate::relocate): Likewise.
3097 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3098 parameter with an r_type parameter. Use get_reference_flags
3099 to get the flags.
3100 (Target_i386::Relocate::relocate): Update accordingly.
3101 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3102 (Target_powerpc::Scan::global): Use it.
3103 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3104 (Target_powerpc::Relocate::relocate): Likewise.
3105 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3106 (Target_sparc::Scan::global): Use it.
3107 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3108 (Target_sparc::Relocate::relocate): Likewise.
3109 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3110 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3111 (Target_x86_64::Scan::global): Likewise.
3112 (Target_x86_64::Relocate::relocate): Likewise.
3113
f625ae50
DK
31142010-11-08 Doug Kwan <dougkwan@google.com>
3115 Cary Coutant <ccoutant@google.com>
3116
3117 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3118 (Arm_exidx_merge_section::section_contents_): New data member.
3119 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3120 (Arm_input_section::~Arm_input_section): De-allocate memory.
3121 (Arm_input_section::original_contents_): New data member.
3122 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3123 in parameters instead of calling Object::section_contents without
3124 locking.
3125 (Arm_output_section::group_section): New parameter TASK. Pass it
3126 to callees that need locking objects.
3127 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3128 to lock EXIDX input sections. Fix a formatting issue. Call
3129 Arm_exidx_merged_section::build_contents to create merged section
3130 contents.
3131 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3132 to lock object of stub table owner.
3133 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3134 TEXT_SIZE to initialize data member TEXT_SIZE_.
3135 (Arm_exidx_input_section::addralign): Fix typo in comment.
3136 (Arm_exidx_input_section::text_size): New method.
3137 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3138 that require locking objects. Lock objects before scanning for stubs
3139 and updating local symbols.
3140 (Arm_input_section<big_endian>::init): Copy contents of original
3141 input section.
3142 (Arm_input_section<big_endian>::do_write): Use saved contents of
3143 original input section instead of calling Object::section_contents
3144 without locking.
3145 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3146 size without calling Object::section_size().
3147 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3148 for size. Allocate a buffer for merged EXIDX entries.
3149 (Arm_exidx_merged_section::build_contents): New method.
3150 (Arm_exidx_merged_section::do_write): Move merge section contents
3151 building code to Arm_exidx_merged_section::build_contetns. Write
3152 out contetns in buffer instead of building it on the fly.
3153 (Arm_relobj::make_exidx_input_section): Also pass text section size
3154 to Arm_exidx_input_section constructor.
3155 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3156 (Arm_dynobj::do_read_symbols): Fix memory leak.
3157 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3158 * target.h: (class Task): Add forward declaration.
3159 (Target::relax): Add new parameter TASK and pass it to
3160 Target::do_relax().
3161 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3162
5f9bcf58
CC
31632010-11-05 Cary Coutant <ccoutant@google.com>
3164
3165 PR gold/10708
3166 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3167 object when reading from the file.
3168 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3169 second layout pass.
3170 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3171 when reading section contents.
3172 (get_section_contents): Likewise.
3173 (icf::find_identical_sections): Likewise.
3174 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3175 object when reading from the file.
3176 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3177 the object when doing deferred section layout.
3178
e597fa08
NC
31792010-11-03 Nick Clifton <nickc@redhat.com>
3180
3181 PR gold/12001
3182 * script.h (class Symbol_assignment: name): New member. Returns
3183 the name of the symbol.
3184 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3185 Returns true if the given symbol name is on the list of
3186 assignments wating to be processed.
3187 * archive.cc (should_incldue_member): If the symbol is undefined,
3188 check to see if it is on the list of symbols pending assignment.
3189
3f9a3278
ILT
31902010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3191
3192 * script-sections.cc (Script_sections::find_memory_region): Check
3193 for a NULL output section pointer.
3194
d06fb4d1
DK
31952010-10-29 Doug Kwan <dougkwan@google.com>
3196
3197 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3198 Output_section::add_relaxed_input_section.
3199 * output.cc (Output_section::add_relaxed_input_section): Add new
3200 arguments LAYOUT and NAME. Set section order index.
3201 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3202 Copy section order index.
3203 * output.h (Output_section::add_relaxed_input_section): Add new
3204 arguments LAYOUT and NAME.
3205
90e24de5
ILT
32062010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3207
3208 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3209 NATIVE_OR_CROSS_LINKER.
3210 * testsuite/Makefile.in: Regenerate.
3211
c9484ea5
DK
32122010-10-20 Doug Kwan <dougkwan@google.com>
3213
3214 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3215 without SHF_LINK_ORDER flags.
3216 * layout.cc (Layout::choose_output_section): Do not filter
3217 SHF_LINK_ORDER flag in a relocatable link.
3218
5bc2f5be
CC
32192010-10-17 Cary Coutant <ccoutant@google.com>
3220
3221 * output.h (Output_segment::set_section_addresses): Change function
3222 signature. Update all callers.
3223 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3224 sections.
3225 (Output_segment::set_section_addresses): Align after last TLS
3226 section. Add padding before last relro section instead of after.
3227
0c91cf04
DK
32282010-10-17 Doug Kwan <dougkwan@google.com>
3229
3230 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3231 GOT output section to be writable.
3232
8c21d9d3
CC
32332010-10-14 Cary Coutant <ccoutant@google.com>
3234
3235 * debug.h (DEBUG_INCREMENTAL): New flag.
3236 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3237 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3238 mode.
3239 * incremental.cc (report_command_line): Ignore all forms of
3240 --incremental.
3241 * layout.cc (Layout::Layout): Check parameters for incremental link
3242 mode.
3243 * options.cc (General_options::parse_incremental): New function.
3244 (General_options::parse_no_incremental): New function.
3245 (General_options::parse_incremental_full): New function.
3246 (General_options::parse_incremental_update): New function.
3247 (General_options::incremental_mode_): New data member.
3248 (General_options::finalize): Check incremental_mode_.
3249 * options.h (General_options): Update help text for --incremental.
3250 Add --no-incremental, --incremental-full, --incremental-update.
3251 (General_options::Incremental_mode): New enum type.
3252 (General_options::incremental_mode): New function.
3253 (General_options::incremental_mode_): New data member.
3254 * parameters.cc (Parameters::incremental_mode_): New data member.
3255 (Parameters::set_options): Set incremental_mode_.
3256 (Parameters::set_incremental_full): New function.
3257 (Parameters::incremental): New function.
3258 (Parameters::incremental_update): New function.
3259 (set_parameters_incremental_full): New function.
3260 * parameters.h (Parameters::set_incremental_full): New function.
3261 (Parameters::incremental): New function.
3262 (Parameters::incremental_update): New function.
3263 (Parameters::incremental_mode_): New data member.
3264 (set_parameters_incremental_full): New function.
3265 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3266 incremental link mode.
3267 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3268 (Sized_relobj::do_relocate_sections): Likewise.
3269 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3270 option.
3271 * testsuite/Makefile.in: Regenerate.
3272 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3273
bb32aa18 32742010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
3275
3276 * script-sections.h (class Script_sections): Make
3277 Sections_elements typedef public.
3278 * script-sections.cc (class Sort_output_sections): Add elements_
3279 field. Add constructor which sets it; change all callers.
3280 (Sort_output_sections::is_before): New function.
3281 (Sort_output_sections::operator()): Call is_before.
3282 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3283 conditional.
3284 * testsuite/script_test_10.sh: New test. Test script section
3285 order.
3286 * testsuite/script_test_10.t: Likewise.
3287 * testsuite/script_test_10.s: Likewise.
3288 * testsuite/Makefile.am: Wrap the cross linker tests and the
3289 common tests into NATIVE_OR_CROSS_LINKER.
3290 (check_SCRIPTS): Add script_test_10.sh.
3291 (check_DATA): Add script_test_10.stdout.
3292 (script_test_10.o, script_test_10): New targets.
3293 (script_test_10.stdout): New target.
3294 * configure, testsuite/Makefile.in: Regenerate.
3295
3cef7179
ILT
32962010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3297
3298 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3299 error for the deprecated relocations.
3300 (Target_arm::Scan::global): Likewise.
3301 (Target_arm::Relocate::relocate): Likewise.
3302
7411e9a8
RS
33032010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3304
3305 * fileread.cc (Input_file::find_file): Initialize *found_name
3306 and *namep when using the fallback search for case 4.
3307
6a9da32a
CC
33082010-10-11 Cary Coutant <ccoutant@google.com>
3309
3310 * options.h (class General_options): Redefine -z lazy as an alias for
3311 the negation of -z now.
3312
ac897c20
ILT
33132010-10-11 Ian Lance Taylor <iant@google.com>
3314
3315 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3316 binding.
3317
ea5cae92
NC
33182010-10-06 Nick Clifton <nickc@redhat.com>
3319
3320 * script-sections.cc(class Memory_region): Remove
3321 current_lma_offset_ field. Rename current_vma_offset_ to
3322 current_offset_. Add last_section_ field.
3323 (Memory_region::get_current_vma_address): Rename to
3324 get_current_address.
3325 (Memory_region::get_current_lma_address): Delete.
3326 (Memory_region::increment_vma_offset): Rename to
3327 increment_offset.
3328 (Memory_region::increment_lma_offset): Delete.
3329 (Memory_region::attributes_compatible): New method. Returns
3330 true if the provided section is compatible with the region.
3331 (Memory_region::get_last_section): New method. Returns the last
3332 section to use the region.
3333 (Memory_region::set_last_section): New method. Stores the last
3334 section to use the region.
3335 (Script_sections::block_in_region): New method. Returns true if
3336 a block of memory is contained within a region.
3337 (Script_sections::find_memory_region): New method. Locates a
3338 memory region to be used to set a VMA or LMA address.
3339 (Output_section_definition::set_section_addresses): Add code to
3340 check for addresses set by memory regions.
3341 (Output_segment::set_section_addresses): Remove memory region
3342 walking code.
3343 (Script_sections::create_segment): Add a warning if a header
3344 segment is created outside of any region.
3345 * script-sections.h (class Script_sections): Add prototypes for
3346 find_memory_region and block_in_region methods.
3347 * testsuite/memory_test.s: Use .long instead of .word.
3348 * testsuite/memory_test.t: Add some more output sections.
3349 * testsuite/memory_test.sh: Update expected output.
3350
a9bfd952
DK
33512010-10-02 Doug Kwan <dougkwan@google.com>
3352
3353 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3354 defintion to symtab.h
3355 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3356 declaration to defintion.
3357
bacff3ab
NC
33582010-10-01 Nick Clifton <nickc@redhat.com>
3359
3360 * expression.cc (eval): Replace dummy argument with NULL.
3361 (eval_maybe_dot): Check for a NULL result section pointer.
3362 (Symbol_expression::value): Likewise.
3363 (Dot_expression::value): Likewise.
3364 (BINARY_EXPRESSION): Likewise.
3365 (Max_expression::value): Likewise.
3366 (Min_expression::value): Likewise.
3367 (Absolute_expression::value): Likewise.
3368 (Addr_expression::value_from_output_section): Likewise.
3369 (Loaddddr_expression::value_from_output_section): Likewise.
3370 (Segment_start_expression::value): Likewise.
3371 * script-sections.cc
3372 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3373 argument with NULL.
3374 (Sections_elememt_dot_assignment::set_section_addresses):
3375 Likewise.
3376 (Output_data_expression::do_write_to_buffer): Likewise.
3377 (Output_section_definition::finalize_symbols): Likewise.
3378 (Output_section_definition::set_section_addresses): Likewise.
3379
f81bc8b5
DK
33802010-09-30 Doug Kwan <dougkwan@google.com>
3381
3382 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3383
c95e9f27
ST
33842010-09-28 Sriraman Tallam <tmsriram@google.com>
3385
3386 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 3387 function.
c95e9f27
ST
3388 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3389 virtual function.
3390 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3391 virtual function.
3392 * icf.cc (get_section_contents): Inline merge sections only when
3393 target allows it.
3394
3cac54d2
RW
33952010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3396
3397 * configure: Regenerate.
3398
2904037a
ILT
33992010-09-17 Ian Lance Taylor <iant@google.com>
3400
3401 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
3402 * testsuite/Makefile.am (memory_test.o): New target.
3403 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3404 memory_test.t.
3405 * testsuite/Makefile.in: Rebuild.
2904037a 3406
bca7fb63
DK
34072010-09-17 Doug Kwan <dougkwan@google.com>
3408
3409 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3410 defintion if relocation uses GOT entries of the symbol.
3411 * testsuite/icf_safe_test.sh: Fix test.
3412 * testsuite/icf_safe_so_test.sh: Fix test.
3413
4ef28648
CC
34142010-09-16 Cary Coutant <ccoutant@google.com>
3415
3416 * script_sections.cc (class Memory_region): Remove "NULL" from
3417 vector initializations.
3418
793990de
CC
34192010-09-15 Cary Coutant <ccoutant@google.com>
3420
3421 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3422 Resolve forwarding symbols.
3423
81e015e2
DK
34242010-09-15 Doug Kwan <dougkwan@google.com>
3425
3426 * gold/testsuite/script_test_3.t: Add ARM special sections.
3427 * gold/testsuite/script_test_4.t: Same.
3428 * gold/testsuite/script_test_5.t: Same.
3429 * gold/testsuite/script_test_6.t: Same.
3430 * gold/testsuite/script_test_7.t: Same.
3431 * gold/testsuite/script_test_7.t: Same.
3432 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3433
36171d64
CC
34342010-09-14 Cary Coutant <ccoutant@google.com>
3435
3436 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3437 (Target_x86_64::Relocate::relocate_tls): Replace check for
3438 saw_tls_block_reloc_ with test for executable section.
3439
d89051bd
CC
34402010-09-12 Cary Coutant <ccoutant@google.com>
3441
3442 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3443 position-independent executables to shared libraries need dynamic
3444 relocations.
3445 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3446 position-independent executables.
3447 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3448 * testsuite/Makefile.in: Regenerate.
3449
fca41f0f
NC
34502010-09-10 Nick Clifton <nickc@redhat.com>
3451
3452 PR gold/11997
3453 * testsuite/memory_test.t: Discard any sections that are not
3454 needed.
3455
6695e4b3
L
34562010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3457
3458 PR gold/11996
3459 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3460 "This::" to work around a bug in gcc 4.2.
3461
3462 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3463
0f72bf6f
RÁE
34642010-09-09 Rafael Espindola <espindola@google.com>
3465
3466 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3467 sections with different PF_X flags in the same segment.
3468 (Layout::find_first_load_seg): Search all segments to find the first
3469 one.
3470 * options.h (rosegment): New.
3471
34722010-09-08 Rafael Espindola <espindola@google.com>
a6577478 3473
05a79166 3474 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 3475
aa98ff75
DK
34762010-09-08 Doug Kwan <dougkwan@google.com>
3477
3478 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3479 (Arm_relobj::do_relocate_sections): Add new parameter for output
3480 file to match the parent.
3481 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3482 of local symbols instead of input values. Update code to track
3483 changes in gold::relocate_section.
3484 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3485 (Sized_relobj::compute_final_local_value_internal): New methods.
3486 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3487 body into private version of Sized_relobj::compute_final_local_value.
3488 Call the inline method.
3489 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3490 merged symbol value if there is one.
3491 (Symbol_value::has_output_value): New method defintiion.
3492 (Sized_relobj::Compute_final_local_value_status): New enum type.
3493 (Sized_relobj::compute_final_local_value): New methods.
3494 (Sized_relobj::compute_final_local_value_internal): New methods.
3495 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3496 and arm_cortex_a8.sh.
3497 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3498 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3499 New tests.
3500 * Makefile.in: Regenerate.
3501 * testsuite/arm_bl_out_of_range.s: Update test.
3502 * testsuite/thumb_bl_out_of_range.s: Ditto.
3503 * testsuite/thumb_blx_out_of_range.s: Ditto.
3504 * testsuite/arm_branch_out_of_range.sh: New file.
3505 * testsuite/arm_cortex_a8.sh: Ditto.
3506 * testsuite/arm_cortex_a8_b.s: Ditto.
3507 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3508 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3509 * testsuite/arm_cortex_a8_bl.s: Ditto.
3510 * testsuite/arm_cortex_a8_blx.s: Ditto.
3511 * testsuite/arm_cortex_a8_local.s: Ditto.
3512 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3513 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3514
05a79166
L
35152010-09-08 Rafael Espindola <espindola@google.com>
3516
3517 * Makefile.am (memory_test.stdout): Run readelf with -W.
3518 * Makefile.in: Regenerate.
3519 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3520 64 bit output.
3521
33dbc701
RÁE
35222010-09-08 Rafael Espindola <espindola@google.com>
3523
3524 * script-sections.cc (Script_sections::add_memory_region): Convert
3525 field precision to int.
3526 * script.cc (script_set_section_region, script_set_section_region):
3527 Convert field precision to int.
3528
731ca54a
RÁE
35292010-09-08 Rafael Espindola <espindola@google.com>
3530
3531 * arm.cc (do_finalize_sections): Create the __exidx_start and
3532 __exdix_end symbols even when the section is missing.
3533
7f8cd844
NC
35342010-09-08 Nick Clifton <nickc@redhat.com>
3535
3536 * README: Remove claim that MEMORY is not supported.
3537 * expression.cc (script_exp_function_origin)
3538 (script_exp_function_length): Move from here to ...
3539 * script.cc: ... here.
3540 (script_set_section_region, script_add_memory)
3541 (script_parse_memory_attr, script_include_directive): New
3542 functions.
3543 * script-sections.cc
3544 (class Memory_region): New class.
3545 (class Output_section_definition): Add set_memory_region,
3546 set_section_vma, set_section_lma and get_section_name methods.
3547 (class Script_Sections): Add add_memory_region,
3548 find_memory_region, find_memory_region_origin,
3549 find_memory_region_length and set_memory_region methods.
3550 Have set_section_addresses method walk the list of set memory
3551 regions.
3552 Extend the print methos to display memory regions.
3553 * script-sections.h: Add prototypes for new methods.
3554 Add enum for MEMORY region attributes.
3555 * yyscript.y: Add support for parsing MEMORY regions.
3556 * script-c.h: Add prototypes for new functions.
3557 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3558 * testsuite/Makefile.in: Regenerate.
3559 * testsuite/memory_test.sh: New script.
3560 * testsuite/memory_test.s: New assembler source file.
3561 * testsuite/memory_test.t: New linker script.
3562
a4649286
DK
35632010-08-27 Doug Kwan <dougkwan@google.com>
3564
3565 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3566 reference override an existing dynamic weak reference.
3567 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3568 * testsuite/Makefile.in: Regenerate.
3569 * testsuite/dyn_weak_ref.sh: New file.
3570 * testsuite/dyn_weak_ref_1.c: Ditto.
3571 * testsuite/dyn_weak_ref_2.c: Ditto.
3572
b56648ad
ILT
35732010-08-27 Ian Lance Taylor <iant@google.com>
3574
3575 * incremental.h (class Incremental_input_entry): Add virtual
3576 destructor.
3577
809313cb
ILT
35782010-08-27 Ian Lance Taylor <iant@google.com>
3579
3580 * testsuite/start_lib_test_3.c: Mark t3 as used.
3581
11e32464
NC
35822010-08-27 Nick Clifton <nickc@redhat.com>
3583
3584 * options.cc (version_script): Fix small typo in previous
3585 whitespace tidyup.
3586
ca09d69a
NC
35872010-08-25 Nick Clifton <nickc@redhat.com>
3588
3589 * archive.cc: Formatting fixes: Remove whitespace between
3590 typename and following asterisk. Remove whitespace between
3591 function name and opening parenthesis.
3592 * archive.h: Likewise.
3593 * arm.cc: Likewise.
3594 * attributes.cc: Likewise.
3595 * attributes.h: Likewise.
3596 * common.cc: Likewise.
3597 * copy-relocs.cc: Likewise.
3598 * dirsearch.h: Likewise.
3599 * dynobj.cc: Likewise.
3600 * ehframe.cc: Likewise.
3601 * ehframe.h: Likewise.
3602 * expression.cc: Likewise.
3603 * fileread.cc: Likewise.
3604 * fileread.h: Likewise.
3605 * gc.h: Likewise.
3606 * gold-threads.cc: Likewise.
3607 * gold.cc: Likewise.
3608 * i386.cc: Likewise.
3609 * icf.h: Likewise.
3610 * incremental-dump.cc: Likewise.
3611 * incremental.cc: Likewise.
3612 * layout.cc: Likewise.
3613 * layout.h: Likewise.
3614 * main.cc: Likewise.
3615 * merge.cc: Likewise.
3616 * merge.h: Likewise.
3617 * object.cc: Likewise.
3618 * object.h: Likewise.
3619 * options.cc: Likewise.
3620 * options.h: Likewise.
3621 * output.cc: Likewise.
3622 * output.h: Likewise.
3623 * plugin.cc: Likewise.
3624 * plugin.h: Likewise.
3625 * powerpc.cc: Likewise.
3626 * reloc.cc: Likewise.
3627 * script-c.h: Likewise.
3628 * script-sections.cc: Likewise.
3629 * script.cc: Likewise.
3630 * stringpool.cc: Likewise.
3631 * symtab.cc: Likewise.
3632 * symtab.h: Likewise.
3633 * target.cc: Likewise.
3634 * timer.cc: Likewise.
3635 * timer.h: Likewise.
3636 * version.cc: Likewise.
3637 * x86_64.cc: Likewise.
3638
b8fa8750
NC
36392010-08-24 Nick Clifton <nickc@redhat.com>
3640
3641 PR 11899
3642 * layout.cc (segment_precedes): Sort segments by their physical
3643 addresses, if they have been set.
3644
9919d93b
CC
36452010-08-23 Cary Coutant <ccoutant@google.com>
3646
3647 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3648 symbols data.
3649 (Lib_group::include_member): Unlock object after deleting its
3650 symbols data.
3651 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3652 the bug fixed here.
3653
97b4be1c
CC
36542010-08-19 Neil Vachharajani <nvachhar@google.com>
3655 Cary Coutant <ccoutant@google.com>
3656
3657 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3658 constructor, and set_blocker.
3659 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3660 readsyms_blocker_.
3661 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3662 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3663 * testsuite/Makefile.am (start_lib_test): New test case.
3664 * testsuite/Makefile.in: Regenerate.
3665 * testsuite/start_lib_test_main.c: New file.
3666 * testsuite/start_lib_test_1.c: New file.
3667 * testsuite/start_lib_test_2.c: New file.
3668 * testsuite/start_lib_test_3.c: New file.
3669
dd0b1884
ILT
36702010-08-19 Ian Lance Taylor <iant@google.com>
3671
3672 * Makefile.in: Rebuild with automake 1.11.1.
3673 * aclocal.m4: Likewise.
3674 * testsuite/Makefile.in: Likewise.
3675
7223e9ca
ILT
36762010-08-19 Ian Lance Taylor <iant@google.com>
3677
3678 PR 10893
3679 * i386.cc (class Output_data_plt_i386): Update declarations.
3680 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3681 local_ifuncs_ fields.
3682 (Target_i386::do_plt_section_for_global): New function.
3683 (Target_i386::do_plt_section_for_local): New function.
3684 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3685 parameter; change all callers. Initialize global_ifuncs_ and
3686 local_ifuncs_. If doing a static link define __rel_iplt_start and
3687 __rel_iplt_end.
3688 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3689 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3690 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3691 symbols.
3692 (Target_i386::make_plt_section): New function, broken out of
3693 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3694 (Target_i386::make_plt_entry): Call make_plt_section.
3695 (Target_i386::make_local_ifunc_plt_entry): New function.
3696 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3697 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3698 R_386_IRELATIVE to switch.
3699 (Target_i386::Scan::global): Likewise.
3700 (Target_i386::Relocate::relocate): Likewise.
3701 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3702 switch.
3703 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3704 (Target_x86_64::do_plt_section_for_global): New function.
3705 (Target_x86_64::do_plt_section_for_local): New function.
3706 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3707 parameter; change all callers. If doing a static link define
3708 __rela_iplt_start and __rela_iplt_end.
3709 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3710 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3711 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3712 to point to .plt.
3713 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3714 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3715 switch.
3716 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3717 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3718 R_X86_64_IRELATIVE to switch.
3719 (Target_x86_64::Scan::global): Likewise.
3720 (Target_x86_64::Relocate::relocate): Likewise.
3721 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3722 switch.
3723 * target.h (class Target): Add plt_section_for_global and
3724 plt_section_for_local functions. Add do_plt_section_for_global
3725 and do_plt_section_for_local virtual functions.
3726 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3727 clarifying comments.
3728 (Symbol::use_plt_offset): Handle IFUNC symbol.
3729 * object.cc (Sized_relobj::Sized_relobj): Initialize
3730 local_plt_offsets_.
3731 (Sized_relobj::local_has_plt_offset): New function.
3732 (Sized_relobj::local_plt_offset): New function.
3733 (Sized_relobj::set_local_plt_offset): New function.
3734 (Sized_relobj::do_count): Handle IFUNC symbol.
3735 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3736 a bit away from input_shndx_ field. Add set_is_func_symbol and
3737 is_ifunc_symbol functions.
3738 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3739 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3740 local_plt_offsets_ field.
3741 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3742 * output.h (class Output_section_data): Add non-const
3743 output_section function.
3744 (class Output_data_got): Update declarations.
3745 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3746 Add use_plt_offset parameter to global and local constructors.
3747 Change all callers. Change local_sym_index_ field to 31 bits.
3748 Change GSYM_CODE and CONSTANT_CODE accordingly.
3749 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3750 doing a static link don't set sh_link field.
3751 (Output_data_got::Got_entry::write): Use PLT offset if
3752 appropriate.
3753 (Output_data_got::add_global_plt): New function.
3754 (Output_data_got::add_local_plt): New function.
3755 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3756 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3757 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3758 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3759 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3760 IFUNC conditional.
3761 * testsuite/ifunc-sel.h: New file.
3762 * testsuite/ifuncmain1.c: New file.
3763 * testsuite/ifuncmain1vis.c: New file.
3764 * testsuite/ifuncmod1.c: New file.
3765 * testsuite/ifuncdep2.c: New file.
3766 * testsuite/ifuncmain2.c: New file.
3767 * testsuite/ifuncmain3.c: New file.
3768 * testsuite/ifuncmod3.c: New file.
3769 * testsuite/ifuncmain4.c: New file.
3770 * testsuite/ifuncmain5.c: New file.
3771 * testsuite/ifuncmod5.c: New file.
3772 * testsuite/ifuncmain6pie.c: New file.
3773 * testsuite/ifuncmod6.c: New file.
3774 * testsuite/ifuncmain7.c: New file.
3775 * configure, testsuite/Makefile.in: Rebuild.
3776
56f75c03
ILT
37772010-08-18 Ian Lance Taylor <iant@google.com>
3778
3779 * incremental.cc
3780 (Output_section_incremental_inputs::write_input_files): Add cast
3781 to avoid signed/unsigned comparison warning.
3782 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3783
55455f89
CC
37842010-08-12 Cary Coutant <ccoutant@google.com>
3785
3786 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3787
e2054bcb
ILT
37882010-08-13 Ian Lance Taylor <iant@google.com>
3789
3790 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3791
74f67560
DK
37922010-08-12 Cary Coutant <ccoutant@google.com>
3793 Doug Kwan <dougkwan@google.com>
3794
3795 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3796 defintion overrides non-weak undef, remember that the original undef
3797 is not weak.
3798 * symtab.cc (Symbol_table::sized_write_global): For undef without
3799 an original weak binding, set binding to global in output.
3800 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3801 * testsuite/Makefile.in: Regenerate.
3802 * testsuite/strong_ref_weak_def.sh: New file.
3803 * testsuite/strong_ref_weak_def_1.c: Ditto.
3804 * testsuite/strong_ref_weak_def_2.c: Ditto.
3805
d1238d12
CC
38062010-08-12 Cary Coutant <ccoutant@google.com>
3807
3808 * testsuite/incremental_test.sh: Rewrite.
3809 * testsuite/incremental_test_1.c: Rewrite.
3810 * testsuite/incremental_test_2.c: Rewrite.
3811
0e70b911
CC
38122010-08-12 Cary Coutant <ccoutant@google.com>
3813
3814 * arm.cc (Target_arm::got_size): Add const.
3815 (Target_arm::got_entry_count): New function.
3816 (Target_arm::plt_entry_count): New function.
3817 (Target_arm::first_plt_entry_offset): New function.
3818 (Target_arm::plt_entry_size): New function.
3819 (Output_data_plt_arm::entry_count): New function.
3820 (Output_data_plt_arm::first_plt_entry_offset): New function.
3821 (Output_data_plt_arm::get_plt_entry_size): New function.
3822 * i386.cc (Target_i386::got_size): Add const.
3823 (Target_i386::got_entry_count): New function.
3824 (Target_i386::plt_entry_count): New function.
3825 (Target_i386::first_plt_entry_offset): New function.
3826 (Target_i386::plt_entry_size): New function.
3827 (Output_data_plt_i386::entry_count): New function.
3828 (Output_data_plt_i386::first_plt_entry_offset): New function.
3829 (Output_data_plt_i386::get_plt_entry_size): New function.
3830 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3831 find_incremental_inputs_sections. Dump incremental_got_plt section.
3832 * incremental.cc: Include target.h.
3833 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3834 parameter. Adjust all callers. Find incremental_got_plt section.
3835 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3836 section.
3837 (Output_section_incremental_inputs::set_final_data_size): Calculate
3838 size of incremental_got_plt section.
3839 (Output_section_incremental_inputs::do_write): Write the
3840 incremental_got_plt section.
3841 (Got_plt_view_info): New struct.
3842 (Local_got_offset_visitor): New class.
3843 (Global_got_offset_visitor): New class.
3844 (Global_symbol_visitor_got_plt): New class.
3845 (Output_section_incremental_inputs::write_got_plt): New function.
3846 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3847 Add parameter. Adjust all callers.
3848 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3849 (Incremental_inputs::got_plt_section): New function.
3850 (Incremental_inputs::got_plt_section_): New data member.
3851 (Incremental_got_plt_reader): New class.
3852 * layout.cc (Layout::create_incremental_info_sections): Add the
3853 incremental_got_plt section.
3854 * object.h (Got_offset_list::get_list): New function.
3855 (Got offset_list::for_all_got_offsets): New function.
3856 (Sized_relobj::local_got_offset_list): New function.
3857 * powerpc.cc (Target_powerpc::got_size): Add const.
3858 (Target_powerpc::got_entry_count): New function.
3859 (Target_powerpc::plt_entry_count): New function.
3860 (Target_powerpc::first_plt_entry_offset): New function.
3861 (Target_powerpc::plt_entry_size): New function.
3862 (Output_data_plt_powerpc::entry_count): New function.
3863 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3864 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3865 * sparc.cc (Target_sparc::got_size): Add const.
3866 (Target_sparc::got_entry_count): New function.
3867 (Target_sparc::plt_entry_count): New function.
3868 (Target_sparc::first_plt_entry_offset): New function.
3869 (Target_sparc::plt_entry_size): New function.
3870 (Output_data_plt_sparc::entry_count): New function.
3871 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3872 (Output_data_plt_sparc::get_plt_entry_size): New function.
3873 * symtab.h (Symbol::got_offset_list): New function.
3874 (Symbol_table::for_all_symbols): New function.
3875 * target.h (Sized_target::got_entry_count): New function.
3876 (Sized_target::plt_entry_count): New function.
3877 (Sized_target::plt_entry_size): New function.
3878 * x86_64.cc (Target_x86_64::got_size): Add const.
3879 (Target_x86_64::got_entry_count): New function.
3880 (Target_x86_64::plt_entry_count): New function.
3881 (Target_x86_64::first_plt_entry_offset): New function.
3882 (Target_x86_64::plt_entry_size): New function.
3883 (Output_data_plt_x86_64::entry_count): New function.
3884 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3885 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3886
09ec0418
CC
38872010-08-12 Cary Coutant <ccoutant@google.com>
3888
3889 * archive.cc: Include incremental.h.
3890 (Archive::Archive): Initialize incremental_info_.
3891 (Archive::include_member): Record archive members in incremental info.
3892 (Add_archive_symbols::run): Record begin and end of an archive in
3893 incremental info.
3894 (Lib_group::include_member): Record objects in incremental info.
3895 * archive.h (Incremental_archive_entry): Forward declaration.
3896 (Archive::set_incremental_info): New member function.
3897 (Archive::incremental_info): New member function.
3898 (Archive::Unused_symbol_iterator): New class.
3899 (Archive::unused_symbols_begin): New member function.
3900 (Archive::unused_symbols_end): New member function.
3901 (Archive::incremental_info_): New data member.
3902 * incremental-dump.cc (find_input_containing_global): New function.
3903 (dump_incremental_inputs): Dump new incremental info sections.
3904 * incremental.cc: Include symtab.h.
3905 (Output_section_incremental_inputs): New class.
3906 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3907 new incremental info sections.
3908 (Sized_incremental_binary::do_check_inputs): Likewise.
3909 (Incremental_inputs::report_archive): Remove.
3910 (Incremental_inputs::report_archive_begin): New function.
3911 (Incremental_inputs::report_archive_end): New function.
3912 (Incremental_inputs::report_object): New function.
3913 (Incremental_inputs::finalize_inputs): Remove.
3914 (Incremental_inputs::report_input_section): New function.
3915 (Incremental_inputs::report_script): Rewrite.
3916 (Incremental_inputs::finalize): Do nothing but finalize string table.
3917 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3918 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3919 (Incremental_inputs::create_data_sections): New function.
3920 (Incremental_inputs::relocs_entsize): New function.
3921 (Output_section_incremental_inputs::set_final_data_size): New function.
3922 (Output_section_incremental_inputs::do_write): New function.
3923 (Output_section_incremental_inputs::write_header): New function.
3924 (Output_section_incremental_inputs::write_input_files): New function.
3925 (Output_section_incremental_inputs::write_info_blocks): New function.
3926 (Output_section_incremental_inputs::write_symtab): New function.
3927 * incremental.h (Incremental_script_entry): Forward declaration.
3928 (Incremental_object_entry): Forward declaration.
3929 (Incremental_archive_entry): Forward declaration.
3930 (Incremental_inputs): Forward declaration.
3931 (Incremental_inputs_header_data): Remove.
3932 (Incremental_inputs_header): Remove.
3933 (Incremental_inputs_header_write): Remove.
3934 (Incremental_inputs_entry_data): Remove.
3935 (Incremental_inputs_entry): Remove.
3936 (Incremental_inputs_entry_write): Remove.
3937 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3938 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3939 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3940 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3941 Likewise.
3942 (Incremental_input_entry): New class.
3943 (Incremental_script_entry): New class.
3944 (Incremental_object_entry): New class.
3945 (Incremental_archive_entry): New class.
3946 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3947 (Incremental_inputs::report_inputs): Remove.
3948 (Incremental_inputs::report_archive): Remove.
3949 (Incremental_inputs::report_archive_begin): New function.
3950 (Incremental_inputs::report_archive_end): New function.
3951 (Incremental_inputs::report_object): Change prototype.
3952 (Incremental_inputs::report_input_section): New function.
3953 (Incremental_inputs::report_script): Change prototype.
3954 (Incremental_inputs::get_reloc_count): New function.
3955 (Incremental_inputs::set_reloc_count): New function.
3956 (Incremental_inputs::create_data_sections): New function.
3957 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3958 (Incremental_inputs::inputs_section): New function.
3959 (Incremental_inputs::symtab_section): New function.
3960 (Incremental_inputs::relocs_section): New function.
3961 (Incremental_inputs::get_stringpool): Add const.
3962 (Incremental_inputs::command_line): Add const.
3963 (Incremental_inputs::inputs): Remove.
3964 (Incremental_inputs::command_line_key): New function.
3965 (Incremental_inputs::input_file_count): New function.
3966 (Incremental_inputs::input_files): New function.
3967 (Incremental_inputs::relocs_entsize): New function.
3968 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3969 (Incremental_inputs::finalize_inputs): Remove.
3970 (Incremental_inputs::Input_info): Remove.
3971 (Incremental_inputs::lock_): Remove.
3972 (Incremental_inputs::inputs_): Change type.
3973 (Incremental_inputs::inputs_map_): Remove.
3974 (Incremental_inputs::current_object_entry_): New data member.
3975 (Incremental_inputs::inputs_section_): New data member.
3976 (Incremental_inputs::symtab_section_): New data member.
3977 (Incremental_inputs::relocs_section_): New data member.
3978 (Incremental_inputs::reloc_count_): New data member.
3979 (Incremental_inputs_reader): New class.
3980 (Incremental_symtab_reader): New class.
3981 (Incremental_relocs_reader): New class.
3982 * layout.cc (Layout::finalize): Move finalization of incremental info
3983 and creation of incremental info sections to follow finalization of
3984 symbol table. Set offsets for postprocessing sections.
3985 (Layout::create_incremental_info_sections): Call
3986 Incremental_inputs::create_data_sections. Add incremental symtab
3987 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3988 sections to layout after input sections.
3989 * layout.h (struct Timespec): Forward declaration.
3990 (Layout::incremental_inputs): Add const.
3991 (Layout::create_incremental_info_sections): Add parameter.
3992 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3993 * object.cc: Include incremental.h.
3994 (Relobj::finalize_incremental_relocs): New function.
3995 (Sized_relobj::do_layout): Record input sections in incremental info.
3996 * object.h (Object::output_section): New function.
3997 (Object::output_section_offset): Moved from Relobj.
3998 (Object::get_incremental_reloc_base): New function.
3999 (Object::get_incremental_reloc_count): New function.
4000 (Object::do_output_section): New function.
4001 (Object::do_output_section_offset): Moved from Relobj.
4002 (Object::do_get_incremental_reloc_base): New function.
4003 (Object::do_get_incremental_reloc_count): New function.
4004 (Object::Object): Initialize new data members.
4005 (Relobj::output_section): Renamed do_output_section and moved to
4006 protected.
4007 (Relobj::output_section_offset): Moved to Object.
4008 (Relobj::do_get_incremental_reloc_base): New function.
4009 (Relobj::do_get_incremental_reloc_count): New function.
4010 (Relobj::allocate_incremental_reloc_counts): New function.
4011 (Relobj::count_incremental_reloc): New function.
4012 (Relobj::finalize_incremental_relocs): New function.
4013 (Relobj::next_incremental_reloc_index): New function.
4014 (Relobj::reloc_counts_): New data member.
4015 (Relobj::reloc_bases_): New data member.
4016 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4017 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4018 (Sized_relobj::incremental_relocs_scan): New function.
4019 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4020 (Sized_relobj::incremental_relocs_write): New function.
4021 (Sized_relobj::incremental_relocs_write_reltype): New function.
4022 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4023 incremental link.
4024 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4025 archives and object files elsewhere.
4026 (Add_symbols::run): Report object files here.
4027 (Finish_group::run): Report end of archive at end of group.
4028 * reloc.cc: Include layout.h, incremental.h.
4029 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4030 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4031 (Sized_relobj::incremental_relocs_scan): New function.
4032 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4033 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4034 (Sized_relobj::incremental_relocs_write): New function.
4035 (Sized_relobj::incremental_relocs_write_reltype): New function.
4036 * script.cc (read_input_script): Rewrite test for incremental link.
4037 Change call to Incremental_inputs::report_script.
4038 * symtab.h (Symbol_table::first_global_index): New function.
4039 (Symbol_table::output_count): New function.
4040
ce0d1972
DK
40412010-08-12 Doug Kwan <dougkwan@google.com>
4042
4043 * arm.cc (Target_arm::merge_object_attributes): Check command line
4044 options --no-wchar-size-warning and --no-enum-size-warning.
4045 * options.h (General_options): Add ld-compatible options
4046 --no-enum-size-warning and --no-wchar-size-warning.
4047
6e5710ce
ILT
40482010-08-04 Ian Lance Taylor <iant@google.com>
4049
4050 * x86_64.cc (Target_x86_64::Scan::local): Use
4051 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4052 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4053 (Target_x86_64::Scan::global): Likewise.
4054 (Target_x86_64::Relocate::relocate): Likewise.
4055 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4056 Likewise.
4057
fef830db
CC
40582010-08-03 Cary Coutant <ccoutant@google.com>
4059
4060 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4061 to reserve space in merged_strings vector. Keep total input size
4062 for stats.
4063 (Output_merge_string::do_print_merge_stats): Print total input size.
4064 * merge.h (Output_merge_string): Add input_size_ field.
4065 * stringpool.cc (Stringpool_template::string_length): Move
4066 implementations out of Stringpool_template class and place in
4067 stringpool.h.
4068 * stringpool.h (string_length): Move out of Stringpool_template.
4069
1e3811b0
ILT
40702010-08-03 Ian Lance Taylor <iant@google.com>
4071
4072 PR 11712
4073 * layout.cc (relaxation_loop_body): If address of load segment is
4074 set, adjust address to include headers if possible.
4075
7af0c620
ILT
40762010-08-03 Ian Lance Taylor <iant@google.com>
4077
4078 * version.cc (version_string): Bump to 1.10.
4079
22f0da72
ILT
40802010-08-03 Ian Lance Taylor <iant@google.com>
4081
4082 PR 11805
4083 * layout.h (enum Output_section_order): Define.
4084 (class Layout): Update declarations.
4085 * layout.cc (Layout::get_output_section): Add order parameter.
4086 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4087 is_first_non_relro parameters. Change all callers.
4088 (Layout::choose_output_section): Likewise.
4089 (Layout::add_output_section_data): Likewise.
4090 (Layout::make_output_section): Likewise. Set order.
4091 (Layout::default_section_order): New function.
4092 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4093 * output.cc (Output_section::Output_section): Initialize order_.
4094 Don't initialize deleted fields.
4095 (Output_segment::Output_segment): Don't initialize deleted
4096 fields.
4097 (Output_segment::add_output_section_to_load): New function
4098 replacing add_output_section. Change all callers to call this or
4099 add_output_section_to_nonload.
4100 (Output_segment::add_output_section_to_nonload): New function.
4101 (Output_segment::remove_output_section): Rewrite.
4102 (Output_segment::add_initial_output_data): Likewise.
4103 (Output_segment::has_any_data_sections): Likewise.
4104 (Output_segment::is_first_section_relro): Likewise.
4105 (Output_segment::maximum_alignment): Likewise.
4106 (Output_segment::has_dynamic_reloc): New function replacing
4107 dynamic_reloc_count. Change all callers.
4108 (Output_segment::has_dynamic_reloc_list): New function replacing
4109 dynamic_reloc_count_list. Change all callers.
4110 (Output_segment::set_section_addresses): Rewrite.
4111 (Output_segment::set_offset): Rewrite.
4112 (Output_segment::find_first_and_last_list): Remove.
4113 (Output_segment::set_tls_offsets): Rewrite.
4114 (Output_segment::first_section_load_address): Likewise.
4115 (Output_segment::output_section_count): Likewise.
4116 (Output_segment::section_with_lowest_load_address): Likewise.
4117 (Output_segment::write_section_headers): Likewise.
4118 (Output_segment::print_sections_to_map): Likewise.
4119 * output.h (class Output_data): Remove dynamic_reloc_count_
4120 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4121 (Output_data::add_dynamic_reloc): Rewrite.
4122 (Output_data::has_dynamic_reloc): New function.
4123 (Output_data::dynamic_reloc_count): Remove.
4124 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4125 is_last_relro_, is_first_non_relro_, is_interp_,
4126 is_dynamic_linker_section_ fields. Add order and set_order
4127 functions. Remove is_relro_local, set_is_relro_local,
4128 is_last_relro, set_is_last_relro, is_first_non_relro,
4129 set_is_first_non_relro functions, is_interp, set_is_interp,
4130 is_dynamic_linker_section, and set_is_dynamic_linker_section
4131 functions.
4132 (class Output_segment): Change Output_data_list from std::list to
4133 std:;vector. Add output_lists_ field. Remove output_data_ and
4134 output_bss_ fields. Update declarations.
4135
3ff2ccb0
ILT
41362010-08-02 Ian Lance Taylor <iant@google.com>
4137
4138 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4139 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4140 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4141
88a4108b
ILT
41422010-08-02 Ian Lance Taylor <iant@google.com>
4143
4144 PR 11855
4145 * script.cc (Script_options::Script_options): Initialize
4146 symbol_definitions_ and symbol_references_.
4147 (Script_options::add_symbol_assignment): Update
4148 symbol_definitions_ and symbol_references_.
4149 (Script_options::add_symbol_reference): New function.
4150 (script_symbol): New function.
4151 * script.h (class Script_options): Add symbol_definitions_ and
4152 symbol_references_ fields.
4153 (Script_options::referenced_const_iterator): New type.
4154 (Script_options::referenced_begin): New function.
4155 (Script_options::referenced_end): New function.
4156 (Script_options::is_referenced): New function.
4157 (Script_options::any_unreferenced): New function.
4158 * script-c.h (script_symbol): Declare.
4159 * yyscript.y (exp): Call script_symbol.
4160 * symtab.cc: Include "script.h".
4161 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4162 Change all callers. Check symbols referenced by scripts.
4163 (Symbol_table::add_undefined_symbols_from_command_line): Add
4164 layout parameter. Change all callers.
4165 (Symbol_table::do_add_undefined_symbols_from_command_line):
4166 Likewise. Break out loop body. Check symbols referenced by
4167 scripts.
4168 (Symbol_table::add_undefined_symbol_from_command_line): New
4169 function broken out of
4170 do_add_undefined_symbols_from_command_line.
4171 * symtab.h (class Symbol_table): Update declarations.
4172 * archive.cc: Include "layout.h".
4173 (Archive::should_include_member): Add layout parameter. Change
4174 all callers. Check for symbol mentioned in expression.
4175 * archive.h (class Archive): Update declaration.
4176 * object.cc (Sized_relobj::do_should_include_member): Add layout
4177 parameter.
4178 * object.h (Object::should_include_member): Add layout parameter.
4179 Change all callers.
4180 (Object::do_should_include_member): Add layout parameter.
4181 (class Sized_relobj): Update declaration.
4182 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4183 parameter.
4184 * dynobj.h (class Sized_dynobj): Update declaration.
4185 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4186 layout parameter.
4187 * plugin.h (class Sized_pluginobj): Update declaration.
4188
5f1ab67a
ILT
41892010-08-02 Ian Lance Taylor <iant@google.com>
4190
4191 PR 11866
4192 * output.cc (Output_segment::set_offset): Search for the first and
4193 last sections rather than assuming that the list is in order.
4194 (Output_segment::find_first_and_last_list): New function.
4195 * output.h (class Output_segment): Update declarations.
4196 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4197 (relro_strip_test_SOURCES): New variable.
4198 (relro_strip_test_DEPENDENCIES): New variable.
4199 (relro_strip_test_LDFLAGS): New variable.
4200 (relro_strip_test_LDADD): New variable.
4201 (relro_strip_test.so): New target.
4202
a8df5856
ILT
42032010-08-02 Ian Lance Taylor <iant@google.com>
4204
4205 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4206 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4207 (Target_i386::got_tlsdesc_section): New function.
4208 (Target_i386::got_section): Create space for GOT entries for
4209 TLSDESC relocations.
4210 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4211 R_386_TLS_GOTDESC.
4212 (Target_i386::Scan::global): Likewise.
4213 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4214 using TLSDESC GOT.
4215 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4216 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4217 (Target_x86_64::got_tlsdesc_section): New function.
4218 (Target_x86_64::got_section): Create space for GOT entries for
4219 TLSDESC relocations.
4220 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4221 R_386_TLS_GOTDESC.
4222 (Target_x86_64::Scan::global): Likewise.
4223 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4224 using TLSDESC GOT.
4225
0c10a0a6
ILT
42262010-08-02 Ian Lance Taylor <iant@google.com>
4227
4228 * testsuite/final_layout.sh: Use dc to convert from hex to
4229 decimal.
4230
41cbeecc
ST
42312010-07-29 Sriraman Tallam <tmsriram@google.com>
4232
4233 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4234 paramter to the call to gold::gc_process_relocs.
4235 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4236 paramter to the call to gold::gc_process_relocs.
4237 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4238 parameter to the call to gold::gc_process_relocs.
4239 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4240 template parameter to the call to gold::gc_process_relocs.
4241 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4242 paramter to the call to gold::gc_process_relocs.
4243 * gc.h (get_embedded_addend_size): New function.
4244 (gc_process_relocs): Save the size of the reloc for use by ICF.
4245 * icf.cc (get_section_contents): Get the addend from the text section
4246 for SHT_REL relocation sections.
4247 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4248 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4249 * int_encoding.h (read_from_pointer): New overloaded function.
4250 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4251 * testsuite/icf_sht_rel_addend_test.sh: New file.
4252 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4253 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4254
6ea55b82
RW
42552010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4256
4257 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4258 * Makefile.in: Regenerate.
4259 * testsuite/Makefile.in: Regenerate.
4260
9691462b
ILT
42612010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4262
4263 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4264 * gold/testsuite/debug_msg.cc: Likewise.
4265 * gold/testsuite/odr_violation1.cc
4266 * gold/testsuite/odr_violation2.cc
4267
76897331
CC
42682010-07-21 Cary Coutant <ccoutant@google.com>
4269
4270 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4271 string, and length fields.
4272 (Output_merge_string::Merged_strings_list): New type.
4273 (Output_merge_string::Merged_strings_lists): New typedef.
4274 (Output_merge_string): Replace merged_strings_ with
4275 merged_strings_lists_.
4276 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4277 Merged_strings_list per input object and section. Don't store pointer
4278 to the string. Don't store length with each merged string entry.
4279 (Output_merge_string::finalize_merged_data): Loop over list of merged
4280 strings lists. Recompute length of each merged string.
4281
78384e8f
CC
42822010-07-15 Cary Coutant <ccoutant@google.com>
4283
4284 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4285 here.
4286
783659f9
ILT
42872010-07-14 Ian Lance Taylor <iant@google.com>
4288
4289 * descriptors.cc (Descriptors::open): Report correct name in error
4290 message.
4291
131687b4
DK
42922010-07-13 Doug Kwan <dougkwan@google.com>
4293
4294 * arm.cc (Arm_input_section::Arm_input_section): For a
4295 SHT_ARM_EXIDX section, always keeps the input sections.
4296 (Arm_input_section::set_exidx_section_link): New method.
4297 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4298 has_errors_ to false.
4299 (Arm_exidx_input_section::has_errors,
4300 Arm_exidx_input_section::set_has_errors): New methods.
4301 (Arm_exidx_input_section::has_errors_): New data member.
4302 (Arm_relobj::get_exidx_shndx_list): New method.
4303 (Arm_output_section::append_text_sections_to_list): Do not skip
4304 section without SHF_EXECINSTR.
4305 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4306 errors.
4307 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4308 section header. Make error messages more verbose. Check for
4309 a non-executable section linked to an EXIDX section.
4310 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4311 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4312 check that there is no deferred EXIDX section if we exit early.
4313 Instead of not making an EXIDX section in case of an error, make one
4314 and set the has_errors flag of it.
4315 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4316 in a relocatable link.
4317 (Target_arm::do_relax): Look for the EXIDX output section instead of
4318 assuming that it is called .ARM.exidx.
4319 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4320 section list. Do not check for SHF_EXECINSTR section flags but
4321 skip any input section with errors.
4322 * output.cc (Output_section::Output_section): Initialize
4323 always_keeps_input_sections_ to false.
4324 (Output_section::add_input_section): Check for
4325 always_keeps_input_sections_.
4326 * output.h (Output_section::always_keeps_input_sections,
4327 Output_section::set_always_keeps_input_sections): New methods.
4328 (Output_section::always_keeps_input_sections): New data member.
4329
69517287
RÁE
43302010-07-13 Rafael Espindola <espindola@google.com>
4331
4332 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4333 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4334
82742395
ILT
43352010-07-13 Philip Herron <herron.philip@googlemail.com>
4336 Ian Lance Taylor <iant@google.com>
4337
4338 * output.h (Output_section_lookup_maps::add_merge_section):
4339 Correct check of whether value was inserted.
4340 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4341 (Output_section_lookup_maps::add_relaxed_input_section):
4342 Likewise.
4343 * arm.cc (Target_arm::got_section): Remove used local os.
4344 * i386.cc (Target_i386::got_section): Likewise.
4345 * x86_64.cc (Target_x86_64::got_section): Likewise.
4346 * sparc.cc (Target_sparc::got_section): Likewise.
4347 (Target_sparc::relocate): Remove unused local have_got_offset.
4348 * powerpc.cc (Target_powerpc::relocate): Likewise.
4349
f2d707b5
ILT
43502010-07-13 Ian Lance Taylor <iant@google.com>
4351
241531d6
ILT
4352 * compressed_output.cc (zlib_decompress): Fix signature in
4353 !HAVE_ZLIB_H case.
4354
f2d707b5
ILT
4355 * archive.cc (Archive::include_member): Unlock an external member
4356 of a thin archive. Don't bother to delete an object we know is
4357 NULL.
4358
a2e47362
CC
43592010-07-12 Cary Coutant <ccoutant@google.com>
4360
4361 * compressed_output.cc (zlib_decompress): New function.
4362 (get_uncompressed_size): New function.
4363 (decompress_input_section): New function.
4364 * compressed_output.h (get_uncompressed_size): New function.
4365 (decompress_input_section): New function.
4366 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4367 Handle compressed debug sections.
4368 * layout.cc (is_compressed_debug_section): New function.
4369 (Layout::output_section_name): Map compressed section names to
4370 canonical names.
4371 * layout.h (is_compressed_debug_section): New function.
4372 (is_debug_info_section): Recognize compressed debug sections.
4373 * merge.cc: Include compressed_output.h.
4374 (Output_merge_data::do_add_input_section): Handle compressed
4375 debug sections.
4376 (Output_merge_string::do_add_input_section): Handle compressed
4377 debug sections.
4378 * object.cc: Include compressed_output.h.
4379 (Sized_relobj::Sized_relobj): Initialize new data members.
4380 (build_compressed_section_map): New function.
4381 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4382 * object.h (Object::section_is_compressed): New method.
4383 (Object::do_section_is_compressed): New method.
4384 (Sized_relobj::Compressed_section_map): New type.
4385 (Sized_relobj::do_section_is_compressed): New method.
4386 (Sized_relobj::compressed_sections_): New data member.
4387 * output.cc (Output_section::add_input_section): Handle compressed
4388 debug sections.
4389 * reloc.cc: Include compressed_output.h.
4390 (Sized_relobj::write_sections): Handle compressed debug sections.
4391
ce279a62
CC
43922010-07-08 Cary Coutant <ccoutant@google.com>
4393
4394 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4395 weak when resolving to a dynamic def.
4396 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4397 for weak undef/dynamic def cases. Adjust callers.
4398 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4399 undef_binding_weak_.
4400 (Symbol_table::sized_write_globals): Adjust symbol binding.
4401 (Symbol_table::sized_write_symbol): Add binding parameter.
4402 * symtab.h (Symbol::set_undef_binding): New method.
4403 (Symbol::is_undef_binding_weak): New method.
4404 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4405 (Symbol_table::should_override): Add new parameter.
4406 (Symbol_table::sized_write_symbol): Add new parameter.
4407
4408 * testsuite/weak_undef_file1.cc: Add new test case.
4409 * testsuite/weak_undef_file2.cc: Fix header comment.
4410 * testsuite/weak_undef_test.cc: Add new test case.
4411
b2286c10
DK
44122010-06-29 Doug Kwan <dougkwan@google.com>
4413
4414 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4415 Initialize USE_SYMBOL_.
4416 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4417 definition.
4418 (Arm_reloc_property::uses_symbol_): New data member declaration.
4419 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4420 uses symbol value and symbol is undefined but not weakly undefined.
4421
4802450a
RÁE
44222010-06-28 Rafael Espindola <espindola@google.com>
4423
4424 * plugin.cc (Plugin::load): Use dlerror.
4425
e5ca47ba
ILT
44262010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4427
4428 * symtab.cc (detect_odr_violations): When reporting an ODR
4429 violation, report an object where the symbol is defined.
4430
8a75a161
DK
44312010-06-25 Doug Kwan <dougkwan@google.com>
4432
4433 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4434 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4435 definition.
4436 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4437 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4438 target hook to detect function points.
4439 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4440 * icf.h (Icf::check_section_for_function_pointers): Change type of
4441 parameter SECTION_NAME to const reference to std::string. Use
4442 target hook to determine if section may have unsafe pointers.
4443 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4444 method definition.
4445
42218b9f
RÁE
44462010-06-21 Rafael Espindola <espindola@google.com>
4447
4448 * fileread.cc (Input_file::find_fie): New
4449 (Input_file::open): Use Input_file::find_fie.
4450 * fileread.h (Input_file::find_fie): New
4451 * plugin.cc (set_extra_library_path): New.
4452 (Plugin::load): Add set_extra_library_path to the transfer vector.
4453 (Plugin_manager::set_extra_library_path): New.
4454 (Plugin_manager::add_input_file): Use the extra search path if set.
4455 (set_extra_library_path(): New.
4456 * plugin.h (Plugin_manager): Add set_extra_library_path and
4457 extra_search_path_.
4458
a0506cca
CC
44592010-06-19 Cary Coutant <ccoutant@google.com>
4460
4461 * layout.cc (gdb_sections): Add .debug_types.
4462 (lines_only_debug_sections): Likewise.
4463
6508b958
RÁE
44642010-06-18 Rafael Espindola <espindola@google.com>
4465
4466 * plugin.cc (add_input_file,add_input_library)
4467 (Plugin_manager::add_input_file): Make filename arguments const.
4468 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4469 const.
4470
3e235302
DK
44712010-06-16 Doug Kwan <dougkwan@google.com>
4472
4473 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4474 .ARM.attributes section if we have not merged any input
4475 attributes sections.
4476
106e8a6c
DK
44772010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4478
4479 * arm.cc: Allow combining objects with no EABI version
4480 information.
4481
91ff43fe
RÁE
44822010-06-15 Rafael Espindola <espindola@google.com>
4483
4484 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4485
68ed838c
ILT
44862010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4487
4488 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4489 (struct iovec): Correct !HAVE_READV definition.
4490
f3a2388f
CC
44912010-06-10 Cary Coutant <ccoutant@google.com>
4492
4493 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4494 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4495 reloc sections.
4496 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4497
4498 PR 11683
4499 * symtab.h (Symbol::is_placeholder): New member function.
4500 * target-reloc.h (relocate_section): Check for placeholder symbols.
4501
4502 * testsuite/Makefile.am (plugin_test_8): New test.
4503 (plugin_test_9): New test.
4504 * testsuite/Makefile.in: Regenerate.
4505
e1df38aa
NC
45062010-06-09 Nick Clifton <nickc@redhat.com>
4507
4508 * yyscript.y (input_list_element): Allow strings prefixed with
4509 the '-' character. Treat these as libraries.
4510 * script.cc (script_add_library): New function. Adds a library
4511 specified by "-l<name>" found in an input script.
4512 * script-c.h: Add prototype for script_add_library.
4513
25bbe950
DK
45142010-06-07 Doug Kwan <dougkwan@google.com>
4515
4516 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4517 Restrict stub-group size to be within long conditional branch
4518 range when working around cortex-A8 erratum.
4519
0f32ea4c
ILT
45202010-06-07 Damien Diederen <dd@crosstwine.com>
4521
4522 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4523 #ifdef typo.
4524
8fe2a369
ST
45252010-06-03 Sriraman Tallam <tmsriram@google.com>
4526
4527 PR gold/11658
4528 * output.cc
4529 (Output_section::Input_section_sort_entry::compare_section_ordering):
4530 Change to return non-zero correctly.
4531 (Output_section::Input_section_sort_section_order_index_compare
4532 ::operator()): Change to fix ambiguity in comparisons.
4533
6e9ba2ca
ST
45342010-06-01 Sriraman Tallam <tmsriram@google.com>
4535
4536 * gold.h (is_wildcard_string): New function.
4537 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4538 (Layout::layout_eh_frame): Ditto.
4539 (Layout::find_section_order_index): New method.
4540 (Layout::read_layout_from_file): New method.
4541 * layout.h (Layout::find_section_order_index): New method.
4542 (Layout::read_layout_from_file): New method.
4543 (Layout::input_section_position_): New private member.
4544 (Layout::input_section_glob_): New private member.
4545 * main.cc (main): Call read_layout_from_file here.
4546 * options.h (--section-ordering-file): New option.
4547 * output.cc (Output_section::input_section_order_specified_): New
4548 member.
4549 (Output_section::Output_section): Initialize new member.
4550 (Output_section::add_input_section): Add new parameter.
4551 Keep input sections when --section-ordering-file is used.
4552 (Output_section::set_final_data_size): Sort input sections when
4553 section ordering file is specified.
4554 (Output_section::Input_section_sort_entry): Add new parameter.
4555 Check sorting type.
4556 (Output_section::Input_section_sort_entry::compare_section_ordering):
4557 New method.
4558 (Output_section::Input_section_sort_compare::operator()): Change to
4559 consider section_order_index.
4560 (Output_section::Input_section_sort_init_fini_compare::operator()):
4561 Change to consider section_order_index.
4562 (Output_section::Input_section_sort_section_order_index_compare
4563 ::operator()): New method.
4564 (Output_section::sort_attached_input_sections): Change to sort
4565 according to section order when specified.
e1df38aa
NC
4566 (Output_section::add_input_section<32, true>): Add new parameter.
4567 (Output_section::add_input_section<64, true>): Add new parameter.
4568 (Output_section::add_input_section<32, false>): Add new parameter.
4569 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
4570 * output.h (Output_section::add_input_section): Add new parameter.
4571 (Output_section::input_section_order_specified): New
4572 method.
4573 (Output_section::set_input_section_order_specified): New method.
4574 (Input_section::Input_section): Initialize section_order_index_.
4575 (Input_section::section_order_index): New method.
4576 (Input_section::set_section_order_index): New method.
4577 (Input_section::section_order_index_): New member.
4578 (Input_section::Input_section_sort_section_order_index_compare): New
4579 struct.
4580 (Output_section::input_section_order_specified_): New member.
4581 * script-sections.cc (is_wildcard_string): Delete and move modified
4582 method to gold.h.
4583 (Output_section_element_input::Output_section_element_input): Modify
4584 call to is_wildcard_string.
4585 (Output_section_element_input::Input_section_pattern
4586 ::Input_section_pattern): Ditto.
4587 (Output_section_element_input::Output_section_element_input): Ditto.
4588 * testsuite/Makefile.am (final_layout): New test case.
4589 * testsuite/Makefile.in: Regenerate.
4590 * testsuite/final_layout.cc: New file.
4591 * testsuite/final_layout.sh: New file.
4592
3537c84b
RÁE
45932010-06-01 Rafael Espindola <espindola@google.com>
4594
4595 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4596
105b6afd
RÁE
45972010-06-01 Rafael Espindola <espindola@google.com>
4598
4599 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4600 visibility of symbols.
4601
29e11421
DK
46022010-05-27 Doug Kwan <dougkwan@google.com>
4603
4604 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4605 from start of output section instead of address for a local symbol
4606 in a merged or relaxed section when doing a relocatable link.
4607
5e0f337e
RÁE
46082010-05-26 Rafael Espindola <espindola@google.com>
4609
4610 PR 11604
4611 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4612 adding sections the garbage collector removed.
4613 * gold/testsuite/Makefile.am: Add test.
4614 * gold/testsuite/Makefile.in: Regenerate.
4615 * gold/testsuite/plugin_test_7.sh: New.
4616 * gold/testsuite/plugin_test_7_1.c: New.
4617 * gold/testsuite/plugin_test_7_2.c: New.
4618
f4187277
RÁE
46192010-05-26 Rafael Espindola <espindola@google.com>
4620
4621 * script-sections.cc (Output_section_definition::set_section_addresses):
4622 Check for --section-start.
4623
5c388529
DK
46242010-05-26 Doug Kwan <dougkwan@google.com>
4625
4626 * arm.cc (Arm_scan_relocatable_relocs): New class.
4627 (Target_arm::relocate_special_relocatable): New method.
4628 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4629 (Arm_relocate_functions::thumb_branch_common): Same.
4630 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4631 instead of Default_scan_relocatable_relocs.
4632 * target-reloc.h (relocate_for_relocatable): Let target handle
4633 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4634 * target.h (Sized_target::relocate_special_relocatable): New method.
4635
bca1c3ae
ILT
46362010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4637
4638 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4639
0439c796
DK
46402010-05-23 Doug Kwan <dougkwan@google.com>
4641
4642 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4643 instead of a cast.
4644 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4645 with a direct branch, not a conditional branch, to a stub.
4646 * merge.cc (Output_merge_base::record_input_section): New method
4647 defintion.
4648 (Output_merge_data::do_add_input_section): Record input section if
4649 keeps-input-sections flag is set.
4650 (Output_merge_string::do_add_input_section): Ditto.
4651 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4652 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4653 INPUT_SECTIONS_.
4654 (Output_merge_base::keeps_input_sections,
4655 Output_merge_base::set_keeps_input_sections,
4656 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4657 method definitions.
4658 (Output_merge_base::Input_sections): New type declaration.
4659 (Output_merge_base::input_sections_begin,
4660 Output_merge_base::input_sections_end,
4661 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4662 (Output_merge_base::bool keeps_input_sections_,
4663 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4664 Output_merge_base::input_sections_): New data members.
4665 (Output_merge_data::do_set_keeps_input_sections): New method
4666 defintion.
4667 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4668 * output.cc (Output_section::Input_section::relobj): Move method
4669 defintion from class declaration to here and handle merge sections.
4670 (Output_section::Input_section::shndx): Ditto.
4671 (Output_section::Output_section): Remove initializations of removed
4672 data members and initialize new data member LOOKUP_MAPS_.
4673 (Output_section::add_input_section): Set keeps-input-sections flag
4674 for a newly created merge output section as appropriate. Adjust code
4675 to use Output_section_lookup_maps class.
4676 (Output_section::add_relaxed_input_section): Adjst code for lookup
4677 maps code refactoring.
4678 (Output_section::add_merge_input_section): Add a new parameter
4679 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4680 class. If adding input section to a newly created merge output
4681 section fails, remove the new merge section.
4682 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 4683 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
4684 (Output_section::find_merge_section): Ditto.
4685 (Output_section::build_lookup_maps): New method defintion.
4686 (Output_section::find_relaxed_input_section): Adjust code to use
4687 Output_section_lookup_maps class.
4688 (Output_section::get_input_sections): Export merge sections. Adjust
4689 code to use Output_section_lookup_maps class.
4690 (Output_section:::add_script_input_section): Adjust code to use
4691 Output_section_lookup_maps class. Update lookup maps for merge
4692 sections also.
4693 (Output_section::discard_states): Use Output_section_lookup_maps.
4694 (Output_section::restore_states): Same.
4695 * output.h (Merge_section_properties): Move class defintion out of
4696 Output_section.
4697 (Output_section_lookup_maps): New class.
4698 (Output_section::Input_section::is_merge_section): New method
4699 defintion.
4700 (Output_section::Input_section::relobj): Move defintion out of class
4701 defintion. Declare method only.
4702 (Output_section::Input_section::shndx): Ditto.
4703 (Output_section::Input_section::output_merge_base): New method defintion.
4704 (Output_section::Input_section::u2_.pomb): New union field.
4705 (Output_section::Merge_section_by_properties_map,
4706 Output_section::Output_section_data_by_input_section_map,
4707 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4708 Remove types.
4709 (Output_section::add_merge_input_section): Add new parameter
4710 KEEPS_INPUT_SECTIONS.
4711 (Output_section::build_lookup_maps): New method declaration.
4712 (Output_section::merge_section_map_,
4713 Output_section::merge_section_by_properties_map_,
4714 Output_section::relaxed_input_section_map_,
4715 Output_section::is_relaxed_input_section_map_valid_): Remove data
4716 members.
4717 (Output_section::lookup_maps_): New data member.
4718
76295588
L
47192010-05-21 Doug Kwan <dougkwan@google.com>
4720
4721 PR gold/11619
4722 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4723 avoid a compilation error.
4724
d103a984
RÁE
47252010-05-19 Rafael Espindola <espindola@google.com>
4726
4727 * script-sections.cc (Output_section_definition::allocate_to_segment):
4728 Update the phdrs_list even when the output section is NULL.
4729 * testsuite/Makefile.am: Add test.
4730 * testsuite/Makefile.in: Regenerate.
4731 * testsuite/script_test_9.cc: New.
4732 * testsuite/script_test_9.sh: New.
4733 * testsuite/script_test_9.t: New.
4734
6625d24e
DK
47352010-05-19 Doug Kwan <dougkwan@google.com>
4736
4737 * arm.cc (Arm_input_section::original_size): New method.
4738 (Arm_input_section::do_addralign): Add a cast.
4739 (Arm_input_section::do_output_offset): Remove static cast.
4740 (Arm_input_section::original_addralign,
4741 Arm_input_section::original_size_): Change type to uint32_t.
4742 (Arm_input_section::init): Add safe casts for section alignment
4743 and size.
4744 (Arm_input_section::set_final_data_size): Do not set address and
4745 offset of stub table.
4746 (Arm_output_section::fix_exidx_coverage): Change use of of
4747 Output_section::Simple_input_section to that of
4748 Output_section::Input_section.
4749 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4750 except for the first pass.
4751 * output.cc (Output_section::get_input_sections): Change type of
4752 input_sections to std::list<Input_section>.
4753 (Output_section::add_script_input_section): Rename from
4754 Output_section::add_simple_input_section. Change type of SIS
4755 parameter from Simple_input_section to Input_section.
4756 * output.h (Output_section::Simple_input_section): Remove class.
4757 (Output_section::Input_section): Change class visibility to public.
4758 (Output_section::Input_section::addralign): Use stored alignments
4759 for special input sections if set.
4760 (Output_section::Input_section::set_addralign): New method.
4761 (Output_section::get_input_sections): Change parameter type from
4762 list of Simple_input_section to list of Input_section.
4763 (Output_section::add_script_input_section): Rename from
4764 Output_section::add_simple_input_section. Change first parameter's
4765 type from Simple_input_section to Input_section and remove the
4766 second and third parameters.
4767 * script-sections.cc (Input_section::Input_section_list): Change
4768 type to list of Output_section::Input_section/
4769 (Input_section_info::Input_section_info): Change parameter type of
4770 INPUT_SECTION to Output_section::Input_section.
4771 (Input_section_info::input_section): Change return type.
4772 (Input_section_info::input_section_): Change type to
4773 Output_section::Input_section.
4774 (Output_section_element_input::set_section_addresses): Adjust code
4775 to use Output_section::Input_section instead of
4776 Output_section::Simple_input_section. Adjust code for renaming
4777 of Output_section::add_simple_input_section.
4778 (Orphan_output_section::set_section_addresses): Ditto.
4779
e1e82ea4
RW
47802010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4781
4782 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4783 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4784
91e75c8a
RÁE
47852010-05-18 Rafael Espindola <espindola@google.com>
4786
4787 * options.cc (General_options::finalize): Handle -nostdlib.
4788 * options.h (nostdlib): New option.
4789 * script.cc (script_add_search_dir): Handle -nostdlib.
4790
da59ad79
DK
47912010-05-12 Doug Kwan <dougkwan@google.com>
4792
4793 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4794 attributes section only if there no attributes section after merging.
4795 (Target_arm::merge_object_attributes): Move value of
e1df38aa 4796 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
4797 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4798 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4799 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4800 and arm_attr_merge_7.stdout.
4801 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4802 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4803 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4804 arm_attr_merge_7b.o): New rules.
4805 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4806 arm_attr_merge_7
4807 * testsuite/Makefile.in: Regenerate.
4808 * testsuite/arm_attr_merge.sh: New file.
4809 * testsuite/arm_attr_merge_[67][ab].s: Same.
4810
3e01a7fd
NC
48112010-05-05 Nick Clifton <nickc@redhat.com>
4812
4813 * po/es.po: Updated Spanish translation.
4814
7ad2014a
L
48152010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4816
4817 * Makefile.am (install-exec-local): Properly install gold as
4818 default cross linker.
4819 * Makefile.in: Regenerated.
4820
4fda8867
NC
48212010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4822 Nick Clifton <nickc@redhat.com>
4823
4824 * configure.ac (install_as_default): Define and set to false
4825 unless --enable-gold or --enable-gold=both/gold has been
4826 specified.
4827 * configure: Regenerate.
4828
4829 * Makefile.am (install-exec-local): Install the executable as
4830 'ld.gold'. If install_as_default is true then also install it as
4831 'ld'.
4832 * Makefile.in: Regenerated.
4833
bd288ea2
ILT
48342010-04-24 Ian Lance Taylor <iant@google.com>
4835
4836 * layout.cc (Layout::layout_reloc): In relocatable link don't
4837 combine reloc sections for grouped sections.
4838
ef38fd8a
ST
48392010-04-23 Sriraman Tallam <tmsriram@google.com>
4840
4841 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4842 sections that are not ordinary to icf.
4843 * icf.cc (get_section_contents): Handle relocation pointing to section
4844 with no object or shndx information.
4845 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4846 * testsuite/Makefile.in: Regenerate.
4847 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4848 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4849
f6973bdc
ILT
48502010-04-22 Ian Lance Taylor <iant@google.com>
4851
4852 * expression.cc (Expression::Expression_eval_info): Add
4853 result_alignment_pointer field.
4854 (Expression::eval_with_dot): Add result_alignment_pointer
4855 parameter. Change all callers.
4856 (Expression::eval_maybe_dot): Likewise.
4857 (class Binary_expression): Add alignment_pointer parameter to
4858 left_value and right_value. Change all callers.
4859 (BINARY_EXPRESSION): Set result alignment.
4860 (class Trinary_expression): Add alignment_pointer parameter to
4861 arg2_value and arg3_value. Change all callers.
4862 (Trinary_cond::value): Set result alignment.
4863 (Max_expression::value, Min_expression::value): Likewise.
4864 (Align_expression::value): Likewise.
4865 * script-sections.cc (class Sections_element): Add dot_alignment
4866 parameter to set_section_addresses virtual function. Update
4867 instantiations.
4868 (class Output_section_element): Likewise.
4869 (Script_sections::create_segments): Add dot_alignment parameter.
4870 Change all callers.
4871 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4872 (Script_sections::set_phdrs_clause_addresses): Likewise.
4873 * script-sections.h: Update declarations.
4874 * script.h: Update declarations.
4875 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4876 min_p_align.
4877 * testsuite/script_test_3.t: Set large alignment.
4878 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4879 segment has expected alignment.
4880
9c9c98a5
NC
48812010-04-22 Nick Clifton <nickc@redhat.com>
4882
4883 * po/gold.pot: Updated by the Translation project.
4884 * po/vi.po: Updated Vietnamese translation.
4885
2253bfba
L
48862010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4887
4888 * testsuite/Makefile.am (check_PROGRAMS): Add
4889 icf_virtual_function_folding_test.
4890 * testsuite/Makefile.in: Regenerated.
4891
85fdf906
AH
48922010-04-15 Andrew Haley <aph@redhat.com>
4893
4894 * options.h (merge_exidx_entries): New option.
4895 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4896 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4897 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4898 (Target_arm::merge_exidx_entries): New function.
4899 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4900 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4901 to Arm_exidx_fixup constructor.
4902 Add new arg, merge_exidx_entries.
4903 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4904 Arm_output_section::fix_exidx_coverage.
4905
ce97fa81
ST
49062010-04-18 Sriraman Tallam <tmsriram@google.com>
4907
4908 * icf.cc (get_section_contents): Check for preemptible functions.
4909 Ignore addend when appropriate.
4910 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4911 section folded.
4912 (add_from_relobj): Check for section folded.
4913 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4914 * symtab.h (should_add_dynsym_entry): Add new parameter.
4915 * target-reloc.h (scan_relocs): Check for section folded.
4916 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4917 Check reloc types for function pointers in shared objects.
4918 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4919 case.
4920 (icf_preemptible_functions_test): New test case.
4921 (icf_string_merge_test): New test case.
4922 * testsuite.Makefile.in: Regenerate.
4923 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4924 bar_glob. Refactor code.
4925 * testsuite/icf_preemptible_functions_test.cc: New file.
4926 * testsuite/icf_preemptible_functions_test.sh: New file.
4927 * testsuite/icf_string_merge_test.cc: New file.
4928 * testsuite/icf_string_merge_test.sh: New file.
4929 * testsuite/icf_virtual_function_folding_test.cc: New file.
4930 * testsuite/icf_virtual_function_folding_test.sh: New file.
4931
04ceb17c
DK
49322010-04-14 Doug Kwan <dougkwan@google.com>
4933
4934 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4935 for local symbol recounting if we remove a section due to ICF.
4936 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4937 there are no regular objects in input.
4938
153e7da4
DK
49392010-04-13 Doug Kwan <dougkwan@google.com>
4940
4941 * arm.cc (Arm_input_section::set_final_data_size): Compute
4942 accurate final data size instead of using current data size.
4943
4dbd9faf
DK
49442010-04-09 Doug Kwan <dougkwan@google.com>
4945
4946 * layout.cc (Layout::choose_output_section): Handle script section
4947 types.
4948 (Layout::make_output_section_for_script): Add section type parameter.
4949 Handle script section types.
4950 * layout.h (Layout::make_output_section_for_script): Add section
4951 type parameter.
4952 * output.cc (Output_section::Output_section): Initialize data member
4953 is_noload_.
4954 (Output_section::do_reset_address_and_file_offset): Do not set address
4955 to 0 if section is a NOLOAD section.
4956 * output.h (Output_section::is_noload): New method.
4957 (Output_section::set_is_noload): Ditto.
4958 (Output_section::is_noload_): New data member.
4959 * script-c.h (Script_section_type): New enum type.
4960 (struct Parser_output_section_header): Add new file section_type.
4961 * script-sections.cc (Sections_element::output_section_name): Add
4962 parameter for returning script section type.
4963 (Output_section_definition::output_section_name): Ditto.
4964 (Output_section_definition::section_type)P; New method.
4965 (Output_section_definiton::script_section_type_name): Ditto.
4966 (Output_section_definition::script_section_type_): New data member.
4967 (Output_section_definition::Output_section_definition): Initialize
4968 data member Output_section_definition::script_section_type_.
4969 (Output_section_definition::create_sections): Pass script section type
4970 to Layout::make_output_section_for_script.
4971 (Output_section_definition::output_section_name): Return script
4972 section type to caller.
4973 (Output_section_definition::set_section_address): Do not advance
4974 dot value and load address if section type is NOLOAD. Set address
4975 of NOLOAD sections regardless of section flags.
4976 (Output_section_definition::print): Print section type if it is
4977 not SCRIPT_SECTION_TYPE_NONE.
4978 (Output_section_definition::section_type): New method.
4979 (Output_section_definition::script_section_type_name): Ditto.
4980 (Script_sections::output_section_name): Add new parameter
4981 PSECTION_TYPE for returning script section type. Pass it to
4982 section elements. Handle discard sections.
4983 (Sort_output_sections::operator()): Handle NOLOAD sections.
4984 * script-sections.h (Script_sections::Section_type): New enum type.
4985 (Script_sections::output_section_name): Add a new parameter for
4986 returning script section type.
4987 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4988 INFO and NOLOAD.
4989 * yyscript.y (union): Add new field SECTION_TYPE.
4990 (COPY, DSECT, INFO, NOLOAD): New tokens.
4991 (opt_address_and_section_type): Change type to output_section_header.
4992 (section_type): New non-terminal
4993 (section_header): Handle section type.
2253bfba 4994 (opt_address_and_section_type): Return section type value.
4dbd9faf 4995
721ea635
L
49962010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4997
4998 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4999 * testsuite/plugin_common_test_2.c (foo): Likewise.
5000
6bf924b0
DK
50012010-04-08 Doug Kwan <dougkwan@google.com>
5002
5003 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5004 Output_merge_data.
5005 * output.cc (Output_section::add_merge_input_section): Simplify
5006 code and return status of Output_merge_base::add_input_section.
e1df38aa 5007 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
5008 returns true.
5009
24af6f92
DK
50102010-04-07 Doug Kwan <dougkwan@google.com>
5011
5012 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5013 if section is marked as containing instructions but has no mapping
5014 symbols.
5015 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5016 correct section index.
5017 (Arm_relobj::find_linked_text_section): Ditto.
5018
00698fc5
CC
50192010-04-07 Cary Coutant <ccoutant@google.com>
5020
5021 * archive.cc (include_member): Destroy Read_symbols_data object before
5022 releasing file.
5023 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5024 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5025 (Read_symbols_data::~Read_symbols_data) New destructor.
5026 (Section_relocs::Section_relocs) New constructor.
5027 (Section_relocs::~Section_relocs) New destructor.
5028 (Read_relocs_data::Read_relocs_data) New constructor.
5029 (Read_relocs_data::~Read_relocs_data) New destructor.
5030 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5031 pointers to NULL after deleting.
5032
7296d933
DK
50332010-04-07 Doug Kwan <dougkwan@google.com>
5034
5035 * arm.cc: Replace "endianity" with "endianness" in comments.
5036 (Arm_exidx_cantunwind): Ditto.
5037 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5038 (Arm_relobj::merge_flags_and_attributes): New method.
5039 (Arm_relobj::merge_flags_and_attributes_): New data member.
5040 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5041 (Arm_relobj::scan_sections_for_stubs): Ditto.
5042 (Arm_relobj::do_read_symbols): Check to see if we really want to
5043 merge processor-specific flags and attributes. Exit early if
5044 an object is empty except for section names and the undefined symbol.
5045 (Target_arm::do_finalize_sections): Move check for ELF format to
5046 Arm_relobj::do_read_symbols. Merge processor specific flags and
5047 attributes from a regular object only when we have determined that
5048 it is aapropriate. Do not create an .ARM.attributes section in
5049 output if there is no regular input object.
5050 (Target_arm::merge_processor_specific_flags): Check
5051 --warn-mismatch before printing any error.
5052 (Target_arm::merge_object_attributes): Ditto.
5053 * gold.cc (queue_middle_tasks): Handle the case in which there is
5054 no regular object in input.
5055 * options.cc (General_options::parse_EB): New method.
5056 (General_options::parse_EL): Same.
5057 (General_options::General_options): Initialize endianness_.
5058 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5059 New options.
5060 (General_options::Endianness): New enum.
5061 (General_options::endianness): New method.
5062 (General_options::endianness_): New data member.
5063 * parameters.cc (Parameters::set_options): Check target endianness.
5064 (Parameters::set_target_once): Ditto.
5065 (Parameters::check_target_endianness): New method.
5066 (parameters_force_valid_target): If either -EL or -EB is specified,
5067 use it to define endianness of default target.
5068 * parameters.h (Parameters::check_target_endianness): New method
5069 declaration.
5070 * target.h (class Target): Change "endianity" to "endianness"
5071 in comments.
5072
efc8d4f2
RW
50732010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5074
5075 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5076 * configure: Regenerate.
5077 * Makefile.in: Regenerate.
5078 * testsuite/Makefile.in: Regenerate.
5079
be234d88
CC
50802010-04-06 Cary Coutant <ccoutant@google.com>
5081
5082 gcc PR lto/42757
5083 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5084 prevailing definitions of common symbols.
5085 * testsuite/plugin_test_6.sh: New test case.
5086 * testsuite/plugin_common_test_1.c: New test case.
5087 * testsuite/plugin_common_test_2.c: New test case.
5088 * testsuite/Makefile.am (plugin_test_6): New test case.
5089 * testsuite/Makefile.in: Regenerate.
5090
bd32c6bd
NC
50912010-04-06 Nick Clifton <nickc@redhat.com>
5092
5093 * po/vi.po: New Vietnamese translation.
5094
323c532f
DK
50952010-03-30 Doug Kwan <dougkwan@google.com>
5096
5097 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5098
4fcd97eb
DK
50992010-03-25 Doug Kwan <dougkwan@google.com>
5100
5101 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5102 to avoid a conversion warning on a 32-bit host.
5103
4ebf39db
ILT
51042010-03-24 Ian Lance Taylor <iant@google.com>
5105
5106 * testsuite/script_test_3.t: Add a TLS segment.
5107 * testsuite/Makefile.am (check_PROGRAMS): Add
5108 tls_phdrs_script_test.
5109 (tls_phdrs_script_test_SOURCES): Define.
5110 (tls_phdrs_script_test_DEPENDENCIES): Define.
5111 (tls_phdrs_script_test_LDFLAGS): Define.
5112 (tls_phdrs_script_test_LDADD): Define.
5113 * testsuite/Makefile.in: Rebuild.
5114
4a599bdd
CC
51152010-03-23 Cary Coutant <ccoutant@google.com>
5116
5117 * fileread.cc (find_or_make_view): Fix comment.
5118
6c93b22c
ILT
51192010-03-23 Ian Lance Taylor <iant@google.com>
5120
5121 * script-sections.cc (class Orphan_section_placement): Define
5122 PLACE_TLS and PLACE_TLS_BSS.
5123 (Orphan_section_placement::Orphan_section_placement): Initialize
5124 new places.
5125 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5126 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5127 (tls_script_test_SOURCES): Define.
5128 (tls_script_test_DEPENDENCIES): Define.
5129 (tls_script_test_LDFLAGS): Define.
5130 (tls_script_test_LDADD): Define.
5131 * testsuite/Makefile.in: Rebuild.
5132
a2c7281b
DK
51332010-03-22 Doug Kwan <dougkwan@google.com>
5134
5135 * arm.cc (Arm_relocate_functions::abs8,
5136 Arm_relocate_functions::abs16): Use correct check for overflow
5137 specified in the ARM ELF specs.
5138 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5139 target of a BLX instruction specially.
5140 (Reloc_stub::stub_type_for_reloc): Ditto.
5141 (Relocate::relocate): Use symbolic names instead of numeric relocation
5142 codes to report error.
5143 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5144 workaround.
5145 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5146 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5147 thumb2_blx_out_of_range.stdout
5148 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5149 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5150 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5151 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5152 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5153 thumb2_blx_in_range, thumb2_blx_in_range.o,
5154 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5155 thumb2_blx_out_of_range.o): New rules.
5156 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5157 thumb2_blx_in_range and thumb2_blx_out_of_range.
5158 * testsuite/Makefile.in: Regenerate.
5159 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5160 * testsuite/thumb_blx_in_range.s: New file.
5161 * testsuite/thumb_blx_out_of_range.s: New file.
5162
b0193076
RÁE
51632010-03-22 Rafael Espindola <espindola@google.com>
5164
5165 * archive.cc (Should_include): Move to archive.h.
5166 (should_include_member): Make it a member of Archive.
5167 (Lib_group): New.
5168 (Add_lib_group_symbols): New.
5169 * archive.h: Include options.h.
5170 (Archive_member): Moved from Archive.
5171 (Should_include): Moved from archive.cc.
5172 (Lib_group): New.
5173 (Add_lib_group_symbols): New.
5174 * dynobj.cc (do_should_include_member): New.
5175 * dynobj.h (do_should_include_member): New.
5176 * gold.cc (queue_initial_tasks): Update call to queue.
5177 * main.cc (main): Print lib group stats.
5178 * object.cc (do_should_include_member): New.
5179 * object.h: Include archive.h.
5180 (Object::should_include_member): New.
5181 (Object::do_should_include_member): New.
5182 (Sized_relobj::do_should_include_member): New.
5183 * options.cc (General_options::parse_start_lib): New.
5184 (General_options::parse_end_lib): New.
5185 (Input_arguments::add_file): Handle lib groups.
5186 (Input_arguments::start_group): Check we are not in a lib.
5187 (Input_arguments::start_lib): New.
5188 (Input_arguments::end_lib): New.
5189 * options.h (General_options): Add start_lib and end_lib.
5190 (Input_argument::lib_): New.
5191 (Input_argument::lib): New.
5192 (Input_argument::is_lib): New.
5193 (Input_file_lib): New.
5194 (Input_arguments::in_lib_): New.
5195 (Input_arguments::in_lib): New.
5196 (Input_arguments::start_lib): New.
5197 (Input_arguments::end_lib_): New.
5198 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5199 in unused members as preempted.
5200 (Sized_pluginobj::do_should_include_member): New.
5201 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5202 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5203 return the blocker.
5204 (Read_symbols::do_whole_lib_group): New.
5205 (Read_symbols::do_lib_group): New.
5206 (Read_symbols::do_read_symbols): Handle lib groups.
5207 (Read_symbols::get_name): Handle lib groups.
5208 * readsyms.h (Read_symbols): Add an archive member pointer.
5209 (Read_symbols::do_whole_lib_group): New.
5210 (Read_symbols::do_lib_group): New.
5211 (Read_symbols::member_): New.
5212 * script.cc (read_input_script): Update call to queue_soon.
5213
d099120c
DK
52142010-03-19 Doug Kwan <dougkwan@google.com>
5215
5216 * arm.cc (Stub_table::Stub_table): Initialize new data members
5217 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5218 (Stub_table::add_reloc_stub): Assign stub offset and update
5219 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5220 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5221 New data members.
5222 (Stub_table::update_data_size_and_addralign): Use
5223 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5224 instead of going over all reloc stubs.
5225 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5226 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5227 Stringpool_template::offset_ to size of Stringpool_char.
5228 (Stringpool_template::new_key_offset): Remove code to initialize
5229 Stringpool_template::offset_.
5230 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5231 Stringpool_template::offset_ to zero.
5232
1aa37384
DK
52332010-03-15 Doug Kwan <dougkwan@google.com>
5234
5235 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5236 offset_.
5237 (Stringpool_template::new_key_offset): New method.
5238 (Stringpool_template::add_string): Assign offsets when adding new
5239 strings.
5240 (Stringpool_template::set_string_offsets): Do not set string offsets
5241 when not optimizing.
5242 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5243 member size_.
5244 (Chunked_vector::clear): Clear size_.
5245 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5246 (Chunked_vector::size): Return size_.
5247 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 5248 (Chunked_vector::size_): New data member.
1aa37384
DK
5249 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5250 (Stringpool_template::new_key_offset): New method declaration.
5251 (Stringpool_template::offset_): New data member.
5252
b672b057
RÁE
52532010-03-15 Rafael Espindola <espindola@google.com>
5254
5255 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5256 Add_symbols' constructor.
5257 * readsyms.h (Add_symbols): Remove the input_group member.
5258
b6848d3c
ILT
52592010-03-10 Ian Lance Taylor <iant@google.com>
5260
5261 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5262 target to ask whether a reference to a symbol requires a stack
5263 split.
5264 * target.h (Target::is_call_to_non_split): New function.
5265 (Target::do_is_call_to_non_split): Declare virtual function.
5266 * target.cc: Include "symtab.h".
5267 (Target::do_is_call_to_non_split): New function.
5268 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5269
a2a5469e
CC
52702010-03-10 Cary Coutant <ccoutant@google.com>
5271
5272 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5273 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5274 (File_read::open[2]): Add whole_file_view_ to list of views.
5275 (File_read::make_view): Remove test of whole_file_view_.
5276 (File_read::find_or_make_view): Create whole_file_view_ if
5277 necessary.
5278 (File_read::clear_views): Replace bool parameter with enum;
5279 adjust all callers. Don't delete views with permanent data;
5280 do delete cached views and views from archives if
5281 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5282 if clearing the corresponding view.
5283 * fileread.h (File_read::Clear_views_mode): New enum.
5284 (File_read::View::is_permanent_view): New method.
5285 (File_read::clear_views): Replace bool parameter
5286 with enum; adjust all callers.
5287 * options.h (General_options): Change keep_files_mapped option;
5288 add map_whole_files.
5289 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5290 releasing the file.
5291 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5292 the file.
5293
8861f32b
DM
52942010-03-10 David S. Miller <davem@davemloft.net>
5295
5296 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5297
d62d0f5f
ST
52982010-03-09 Sriraman Tallam <tmsriram@google.com>
5299
5300 * icf.cc (get_section_contents): Add '@' marker after processing the
5301 merge reloc.
5302
9177756d
DK
53032010-03-08 Doug Kwan <dougkwan@google.com>
5304
5305 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5306 due to a conversion warning.
5307 (Arm_relobj::update_output_local_symbol_count): Check for local
5308 symbol with unset output index.
5309
9e9e071b
ILT
53102010-03-05 Ian Lance Taylor <iant@google.com>
5311
5312 * options.h (class General_options): Add --spare-dynamic-tags.
5313 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5314 --spare-dynamic-tags.
5315
a81ee015
ILT
53162010-03-05 Ian Lance Taylor <iant@google.com>
5317
5318 * incremental.cc: Include "libiberty.h".
5319
44ec90b9
RO
53202010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5321
5322 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5323 function, is_info_ member.
5324 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5325 (Versions::Versions): Update caller.
5326 (Versions::define_base_version): Likewise.
5327 (Versions::add_def): Likewise.
5328
0897ed3b
ST
53292010-03-03 Sriraman Tallam <tmsriram@google.com>
5330
5331 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5332 (Scan::possible_function_pointer_reloc): New function.
5333 (Scan::local_reloc_may_be_function_pointer): Change to call
5334 possible_function_pointer_reloc.
5335 (Scan::global_reloc_may_be_function_pointer): Ditto.
5336 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5337 relocations in ".data.rel.ro._ZTV" section.
5338 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5339 * testsuite/icf_safe_so_test.cc: Ditto.
5340 * testsuite/icf_safe_test.cc: Ditto.
5341 * testsuite/icf_safe_test.sh: Ditto.
5342
d3bbad62
ILT
53432010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5344 Ian Lance Taylor <iant@google.com>
5345
5346 * target-reloc.h (relocate_section): Check the symbol table index
5347 for -1U before setting the local symbol index.
5348 (scan_relocatable_relocs): If copying the relocation, record that
5349 the local symbol is required.
5350 * object.h (Symbol_value::is_output_symtab_index_set): New
5351 function.
5352 (Symbol_value::may_be_discarded_from_output_symtab): New
5353 function.
5354 (Symbol_value::has_output_symtab_entry): New function.
5355 (Symbol_value::needs_output_symtab_entry): Remove.
5356 (Symbol_value::output_symtab_index): Make sure the symbol index is
5357 set.
5358 (Symbol_value::set_output_symtab_index): Make sure the symbol
5359 index is not set. Make sure the new index is valid.
5360 (Symbol_value::set_must_have_output_symtab_entry): New function.
5361 (Symbol_value::has_output_dynsym_entry): New function.
5362 (Symbol_value::set_output_dynsym_index): Make sure the new index
5363 is valid.
5364 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5365 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5366 local symbol if permitted.
5367 (Sized_relobj::do_finalize_local_symbols): Call
5368 is_output_symtab_index_set rather than needs_output_symtab_entry.
5369 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5370 rather than needs_output_symtab_entry. Call
5371 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5372 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5373 is_output_symtab_index_set rather than needs_output_symtab_entry.
5374 * testsuite/discard_locals_relocatable_test.c: New file.
5375 * testsuite/discard_locals_test.sh: Test -r.
5376 * testsuite/Makefile.am (check_DATA): Add
5377 discard_locals_relocatable_test1.syms,
5378 discard_local_relocatable_test2.syms.
5379 (MOSTLYCLEANFILES): Likewise. Also add
5380 discard_locals_relocatable_test1.lout and
5381 discard_locals_relocatable_test2.out.
5382 (discard_locals_relocatable_test1.syms): New target.
5383 (discard_locals_relocatable_test.o): New target.
5384 (discard_locals_relocatable_test1.out): New target.
5385 (discard_locals_relocatable_test2.syms): New target.
5386 (discard_locals_relocatable_test2.out): New target.
5387 (various): Add missing ../ld-new dependencies.
5388 * testsuite/Makefile.in: Rebuild.
5389
7e8ccf26
NC
53902010-03-03 Nick Clifton <nickc@redhat.com>
5391
5392 * po/fi.po: New Finnish translation.
5393
2a0ff005
DK
53942010-03-01 Doug Kwan <dougkwan@google.com>
5395
5396 * layout.cc (Layout::Layout): Force section types of .init_array*,
5397 .preinit_array* and .fini_array* sections.
5398 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5399 Fix check of return value of std::string::find.().
5400 (Output_section::Input_section_sort_compare::operator()): Remove
5401 comment about .init_array.
5402 (Output_section::Input_section_sort_init_fini_compare::operator()):
5403 New method.
5404 (Output_section::sort_attached_input_sections): Handle .init_array
5405 and .fini_array specially.
5406 * output.h (Output_section::Inut_section_sort_compare): Update
5407 comment.
5408 (Output_section::Input_section_sort_init_fini_compare): New struct.
5409
c3e4ae29
DK
54102010-02-26 Doug Kwan <dougkwan@google.com>
5411
5412 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5413 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5414 * testsuite/debug_msg.sh: Avoid matching source line number for
5415 use of global variable undef_int.
5416
2fd9ae7a
DK
54172010-02-26 Doug Kwan <dougkwan@google.com>
5418
5419 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5420 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5421 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5422 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5423 * options.cc (General_options::General_options): Initialize member
5424 fix_v4bx_.
5425 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5426 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5427 and rm_no_fix_v4bx.stdout
5428 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5429 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5430 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5431 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5432 and arm_no_fix_v4bx.
5433 * Makefile.in: Regenerate.
5434 * testsuite/arm_fix_v4bx.s: New file.
5435 * testsuite/arm_fix_v4bx.sh: Ditto.
5436
67ec7d0b
DK
54372010-02-24 Doug Kwan <dougkwan@google.com>
5438
5439 * arm.cc (Target_arm::got_section): Make the .got section the first
5440 non RELRO section in the data segment.
5441 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5442 suffixes of section names.
5443
10165461
DK
54442010-02-24 Doug Kwan <dougkwan@google.com>
5445
5446 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5447 flags and attributes merging if an input file is a binary file.
5448 * fileread.cc (Input_file::open): Record format of original file.
5449 * fileread.h (Input_file::Format): New enum type.
5450 (Input_file::Input_file): Initialize data member format_.
5451 (Input_file::format): New method definition.
5452 (Input_file::format_):: New data member.
5453
4a54abbb
DK
54542010-02-24 Doug Kwan <dougkwan@google.com>
5455
5456 * arm.cc (Arm_output_data_got): New class.
5457 (ARM_TCB_SIZE): New constant
5458 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5459 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5460 If user uses a script with a SECTIONS clause, issue only a warning
5461 for a misplaced EXIDX input section. Otherwise, issue an error.
5462 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5463 garbage collection.
5464 (Target_arm::got_mode_index_entry): Handle static linking.
5465 (Target_arm::Scan::local): Ditto.
5466 (Target_arm::Scan::global): Ditto.
5467 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5468 all incorrectly implemented relocations.
e1df38aa 5469 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
5470 Arm_output_section::fix_exidx_coverage.
5471 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5472 from ".ARM.exidx." and ".ARM.extab.".
5473
ca419a6f
ILT
54742010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5475
5476 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5477 section if it does not already exist.
5478 * attributes.cc (Attributes_section_data::Attributes_section_data):
5479 Don't crash if size is zero.
5480
135b9c78
ILT
54812010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5482 Ian Lance Taylor <iant@google.com>
5483
5484 * gold.cc (queue_middle_tasks): If no input files were opened,
5485 exit.
5486 * workqueue.h (Task_function::Task_function): Assert that there is
5487 a blocker.
5488
bb0bfe4f
DK
54892010-02-22 Doug Kwan <dougkwan@google.com>
5490
5491 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5492 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5493 types to avoid warnings due to different uint64_t implementations
5494 on different hosts.
5495
2a2b6d42
DK
54962010-02-21 Doug Kwan <dougkwan@google.com>
5497
5498 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5499 handling of the maximum backward branch offset.
5500 (Arm_relocate_functions::thumb_branch_common): Ditto.
5501 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5502 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 5503 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
5504 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5505 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5506 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5507 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5508 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5509 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5510 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5511 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5512 thumb2_bl_out_of_range.o): New rules.
5513 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5514 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5515 thumb2_bl_out_of_range
5516 * testsuite/Makefile.in: Regenerate.
5517 * testsuite/arm_bl_in_range.s: New file.
5518 * testsuite/arm_bl_out_of_range.s: Ditto.
5519 * testsuite/arm_branch_in_range.sh: Ditto.
5520 * testsuite/arm_branch_range.t: Ditto.
5521 * testsuite/thumb2_branch_range.t: Ditto.
5522 * testsuite/thumb_bl_in_range.s: Ditto.
5523 * testsuite/thumb_bl_out_of_range.s: Ditto.
5524 * testsuite/thumb_branch_range.t: Ditto.
5525
b487ad64
ST
55262010-02-20 Sriraman Tallam <tmsriram@google.com>
5527
5528 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5529 Add reloc offset information.
5530 * icf.cc (get_section_contents): Change iterators to point to the new
5531 vectors. Add reloc offset information to the contents.
5532 * icf.h (Icf::Sections_reachable_info): New typedef.
5533 (Icf::Sections_reachable_list): New typedef.
5534 (Icf::Offset_info): New typedef.
5535 (Icf::Reloc_info): New struct typedef.
5536 (Icf::Reloc_info_list): New typedef.
5537 (Icf::symbol_reloc_list): Delete method.
5538 (Icf::addend_reloc_list): Delete method.
5539 (Icf::section_reloc_list): Delete method.
5540 (Icf::reloc_info_list): New method.
5541 (Icf::reloc_info_list_): New member.
5542
f96accdf
DK
55432010-02-19 Doug Kwan <dougkwan@google.com>
5544
5545 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5546 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5547 * arm.cc (Arm_relocation_functions): New forward declaration.
5548 (Target_arm::Target_arm): Initialize new data members
5549 got_mod_index_offset_ and tls_base_symbol_defined_.
5550 (Target_arm::Relocate::relocate_tls): New method.
5551 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5552 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5553 New methods.
5554 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5555 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5556 (Target_arm::got_mod_index_offset_,
5557 Target_arm::tls_base_symbol_defined_): New data members.
5558 (Target_arm::Scan::local, Target::Scan::global,
5559 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5560 relocations.
5561
c8761b9a
DK
55622010-02-18 Doug Kwan <dougkwan@google.com>
5563
5564 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5565 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5566 text section as a parameter becuase some broken tools may not set
5567 the link in section header.
5568 (Target_arm::has_got_section): New method.
5569 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5570 without any mapping symbol as data only. Remove warning.
5571 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5572 link in its section header, try to discover the link by inspecting the
5573 REL31 relocation at the beginning of the section.
5574 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5575 in error message.
5576 (Target_arm::Scan::global): Treat any reference to the symbol
5577 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5578
21bb3914
ST
55792010-02-12 Sriraman Tallam <tmsriram@google.com>
5580
5581 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5582 (Scan::global_reloc_may_be_function_pointer): New function.
5583 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5584 (Scan::global_reloc_may_be_function_pointer): New function.
5585 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5586 (Scan::global_reloc_may_be_function_pointer): New function.
5587 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5588 (Scan::global_reloc_may_be_function_pointer): New function.
5589 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5590 (Scan::global_reloc_may_be_function_pointer): New function.
5591 (Scan::possible_function_pointer_reloc): New function.
5592 (Target_x86_64::can_check_for_function_pointers): New function.
5593 * gc.h (gc_process_relocs): Scan relocation types to determine if
5594 function pointers were taken for targets that support it.
5595 * icf.cc (Icf::find_identical_sections): Include functions for
5596 folding in safe ICF whose pointer is not taken.
5597 * icf.h (Secn_fptr_taken_set): New typedef.
5598 (fptr_section_id_): New member.
5599 (section_has_function_pointers): New function.
5600 (set_section_has_function_pointers): New function.
5601 (check_section_for_function_pointers): New function.
5602 * options.h: Fix comment for safe ICF option.
5603 * target.h (can_check_for_function_pointers): New function.
5604 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5605 Modify icf_safe_test for X86-64.
5606 * testsuite/Makefile.in: Regenerate.
5607 * testsuite/icf_safe_so_test.cc: New file.
5608 * testsuite/icf_safe_so_test.sh: New file.
5609 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5610 (main): Change to take pointer to function kept_func_3.
5611 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5612 folding is done correctly for X86-64.
5613
0da6fa6c
DM
56142010-02-12 David S. Miller <davem@davemloft.net>
5615
5616 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5617 is_symbolless parameter.
5618 (Output_reloc<SHT_REL>::is_symbolless): New.
5619 (Output_reloc<SHT_REL>::is_symbolless_): New.
5620 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5621 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5622 (Output_reloc<SHT_RELA>::is_symbolless): New.
5623 (Output_data_reloc::add_global): Handle is_symbolless.
5624 (Output_data_reloc::add_global_relative): Likewise.
5625 (Output_data_reloc::add_local): Likewise.
5626 (Output_data_reloc::add_local_relative): Likewise.
5627 (Output_data_reloc::add_symbolless_global_addend): New.
5628 (Output_data_reloc::add_symbolless_local_addend): New.
5629 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5630 is_symbolless.
5631 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5632 instead of ->is_relative_
5633 (Output_reloc::write): Likewise.
5634 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5635 (Output_reloc::write_rel): Simplify.
5636
5637 * sparc.cc (Target_sparc::Scan::local): Use
5638 ->add_symbolless_local_addend as needed.
5639 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5640 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5641 based upon relocation offset.
5642
e4782e83
DK
56432010-02-11 Doug Kwan <dougkwan@google.com>
5644
5645 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5646 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5647 beginning of function.
5648 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5649 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5650 parameter is_32bit in calls to should_apply_static_reloc.
5651 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5652 (check_DATA): Add arm_abs_global.stdout.
5653 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5654 arm_abs_global.stdout): New rules.
5655 (MOSTLLYCLEANFILES): Add arm_abs_global
5656 * Makefile.in: Regenerate.
5657 * testsuite/arm_abs_global.s: New file.
5658 * testsuite/arm_abs_global.sh: Ditto.
5659 * testsuite/arm_abs_lib.s: Ditto.
5660
93ceb764
ILT
56612010-02-11 Ian Lance Taylor <iant@google.com>
5662
5663 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5664 Read_relocs task.
5665 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5666 Allocate_commons_task first.
5667 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5668 task, rather than symtab_lock_.
5669 (Gc_process_relocs::~Gc_process_relocs): New function.
5670 (Gc_process_relocs::is_runnable): Check this_blocker_.
5671 (Gc_process_relocs::locks): Use next_blocker_ rather than
5672 blocker_.
5673 (Scan_relocs::~Scan_relocs): New function.
5674 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5675 symtab_lock_.
5676 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5677 next_blocker_.
5678 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5679 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5680 constructor accordingly.
5681 (class Gc_process_relocs): Likewise.
5682 (class Scan_relocs): Likewise.
5683 * common.h (class Allocate_commons_task): Remove symtab_lock_
5684 field, and corresponding constructor parameter.
5685 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5686 symtab_lock_.
5687 (Allocate_commons_task::locks): Likewise.
5688
114dfbe1
ILT
56892010-02-11 Ian Lance Taylor <iant@google.com>
5690
5691 * gold-threads.h (class Once): Define.
5692 (class Initialize_lock): Rewrite as child of Once.
5693 * gold-threads.cc (class Once_initialize): Define.
5694 (once_pointer_control): New static variable.
5695 (once_pointer, once_arg): New static variables.
5696 (c_run_once): New static function.
5697 (Once::Once, Once::run_once, Once::internal_run): New functions.
5698 (class Initialize_lock_once): Remove.
5699 (initialize_lock_control): Remove.
5700 (initialize_lock_pointer): Remove.
5701 (initialize_lock_once): Remove.
5702 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5703 (Initialize_lock::initialize): Rewrite.
5704 (Initialize_lock::do_run_once): New function.
5705 * archive.cc (Archive::interpret_header): Only clear name if it is
5706 not already empty.
5707 * fileread.cc: Include "gold-threads.h"
5708 (file_counts_lock): New static variable.
5709 (file_counts_initialize_lock): Likewise.
5710 (File_read::release): Only increment counts when using --stats.
5711 Use a lock around the increment.
5712 * parameters.cc (class Set_parameters_target_once): Define.
5713 (set_parameters_target_once): New static variable.
5714 (Parameters::Parameters): Move here from parameters.h.
5715 (Parameters::set_target): Rewrite.
5716 (Parameters::set_target_once): New function.
5717 (Parameters::clear_target): Move here and rewrite.
5718 * parameters.h (class Parameters): Update declarations. Add
5719 set_parameters_target_once_ field.
5720 (Parameters::Parameters): Move to parameters.cc.
5721 (Parameters::clear_target): Likewise.
5722 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5723 task.
5724 (Start_group::~Start_group): New function.
5725 (Start_group::is_runnable): New function.
5726 (Start_group::locks, Start_group::run): New functions.
5727 (Finish_group::run): Change saw_undefined to size_t.
5728 * readsyms.h (class Start_group): Define.
5729 (class Finish_group): Change saw_undefined_ field to size_t.
5730 (Finish_group::Finish_group): Remove saw_undefined and
5731 this_blocker parameters. Change all callers.
5732 (Finish_group::set_saw_undefined): New function.
5733 (Finish_group::set_blocker): New function.
5734 * symtab.h (class Symbol_table): Change saw_undefined to return
5735 size_t. Change saw_undefined_ field to size_t.
5736 * target-select.cc (Set_target_once::do_run_once): New function.
5737 (Target_selector::Target_selector): Initialize set_target_once_
5738 field. Don't initialize lock_ and initialize_lock_ fields.
5739 (Target_selector::instantiate_target): Rewrite.
5740 (Target_selector::set_target): New function.
5741 * target-select.h (class Set_target_once): Define.
5742 (class Target_selector): Update declarations. Make
5743 Set_target_once a friend. Remove lock_ and initialize_lock_
5744 fields. Add set_target_once_ field.
5745
fa17a3f4
ILT
57462010-02-10 Ian Lance Taylor <iant@google.com>
5747
5748 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5749 queueing any tasks.
5750 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5751 (queue_middle_tasks): Add all blockers before queueing any tasks.
5752 (queue_final_tasks): Likewise.
5753 * token.h (Task_token::add_blockers): New function.
5754 * object.h (Input_objects::number_of_relobjs): New function.
5755
c7177d31
ILT
57562010-02-10 Ian Lance Taylor <iant@google.com>
5757
5de0e392
ILT
5758 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5759 shared, not if not position independent.
5760 * x86_64.cc (Relocate::relocate_tls): Likewise.
5761 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5762 (tls_pie_pic_test): New target.
5763 * testsuite/Makefile.in: Rebuild.
5764
c7177d31
ILT
5765 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5766 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5767 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5768 * testsuite/Makefile.in: Rebuild.
5769
684b268a
DM
57702010-02-09 David S. Miller <davem@davemloft.net>
5771
5772 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5773 R_SPARC_RELATIVE using ->add_local_relative().
5774 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5775
612a8d3d
DM
5776 * output.h (Output_data_dynamic::add_section_size): New method
5777 that takes two Output_data objects.
5778 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5779 entry param. Handle it in initializers.
5780 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5781 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5782 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5783 arg.
5784 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5785 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5786 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5787 for dynrel_includes_plt.
5788 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5789 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5790 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5791 before .rela.plt
5792 (Target_sparc::do_finalize_sections): Update to pass true for
5793 dynrel_includes_plt.
5794 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5795 output before .rela.plt
5796 (Target_powerpc::do_finalize_sections): Update to pass true for
5797 dynrel_includes_plt when 32-bit.
5798
cb1be87e
DK
57992010-02-08 Doug Kwan <dougkwan@google.com>
5800
5801 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5802 method.
5803 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5804 Arm_relobj::scan_section_for_cortex_a8_stubs,
5805 Arm_relobj::do_relocation_section): Instead of calling
5806 Output_section::output_address, use faster
5807 Arm_relobj::simple_input_section_output_address.
5808
705b5121
DM
58092010-02-08 David S. Miller <davem@davemloft.net>
5810
5811 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5812 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5813 relocation helper function.
5814
024c4466
DM
5815 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5816 just like R_SPARC_GOT{10,13,22}.
5817 (Target_sparc::Scan::local): Likewise.
5818 (Target_sparc::Relocate:relocate): Likewise.
5819
9109c078
ILT
58202010-02-06 Ian Lance Taylor <iant@google.com>
5821
5822 * configure.ac: Rewrite targetobjs duplicate removal code to use
5823 only shell constructs.
5824 * configure: Rebuild.
5825
cf846138
DK
58262010-02-05 Doug Kwan <dougkwan@google.com>
5827
5828 PR 11247
5829 * arm.cc (Arm_relobj::section_is_scannable): New method.
5830 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5831 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5832
6cfaf60b
DK
58332010-02-04 Doug Kwan <dougkwan@google.com>
5834
5835 PR 11247
5836 * arm-reloc-property.cc (cstdio): Include.
5837 * configure.ac (targetobjs): Remove duplicates.
5838 * configure: Regenerate.
5839 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5840 big and little endian version for a given address size.
5841
5c57f1be
DK
58422010-02-03 Doug Kwan <dougkwan@google.com>
5843
5844 * arm-reloc-property.cc
5845 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5846 definition.
5847 * arm-reloc-property.h
5848 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5849 New method definition.
5850 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5851 declaration.
5852 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5853 overflow to N.
5854 (GOT_PREL): Change implemented to Y.
5855 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5856 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5857 (Arm_relocate_functions::movw_abs_nc): Remove method.
5858 (Arm_relocate_functions::movt_abs): Ditto.
5859 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5860 (Arm_relocate_functions::thm_movt_abs): Ditto.
5861 (Arm_relocate_functions::movw_rel_nc): Ditto.
5862 (Arm_relocate_functions::movw_rel): Ditto.
5863 (Arm_relocate_functions::movt_rel): Ditto.
5864 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5865 (Arm_relocate_functions:thm_movw_rel): Ditto.
5866 (Arm_relocate_functions:thm_movt_rel): Ditto.
5867 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5868 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5869 New method definitions.
5870 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5871 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5872 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5873 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5874 (Target_arm::Relocate::relocate): Check for non-static or
5875 unimplemented relocation code and exit early. Change calls to
5876 Target_arm::reloc_uses_thumb_bit and
5877 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5878 instead. Refactor code to handle similar relocations to increase
5879 code sharing. Remove check for unsupported relocation code in switch
5880 statement.
5881 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5882 relocation property table to find out size. Change error message to
5883 print out the name of a relocation code instead of the numeric value.
5884 (Target_arm::scan_reloc_for_stub): Use relocation property table
5885 instead of calling Target_arm::reloc_uses_thumb_bit().
5886
218c5831
DK
58872010-02-02 Doug Kwan <dougkwan@google.com>
5888
5889 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5890 types of relaxed input section.
5891
0d31c79d
DK
58922010-02-02 Doug Kwan <dougkwan@google.com>
5893
5894 * Makefile.am (HFILES): Add arm-reloc-property.h.
5895 (DEFFILES): New.
5896 (TARGETSOURCES): Add arm-reloc-property.cc
5897 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5898 (libgold_a_SOURCES): $(DEFFILES)
5899 * Makefile.in: Regenerate.
5900 * arm-reloc-property.cc: New file.
5901 * arm-reloc-property.h: New file.
5902 * arm-reloc.def: New file.
5903 * arm.cc: Update comments.
5904 (arm-reloc-property.h): New included header.
5905 (arm_reloc_property_table): New global variable.
5906 (Target_arm::do_select_as_default_target): New method definition.
5907 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5908 arm-reloc-property to targ_extra_obj.
5909 * parameters.cc (set_parameters_target): Call
5910 Target::select_as_default_target().
5911 * target.h (Target::select_as_default_target): New method definition.
5912 (Target::do_select_as_default_target): Same.
5913
546c7457
DK
59142010-02-01 Doug Kwan <dougkwan@google.com>
5915
5916 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5917 first_output_text_section_.
5918 (Arm_exidx_fixup::first_output_text_section): New method definition.
5919 (Arm_exidx_fixup::first_output_text_section_): New data member.
5920 (Arm_exidx_fixup::process_exidx_section): Record the first text
5921 output section seen.
5922 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5923 and entsize in output section header.
5924
11b861d5
DK
59252010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5926
5927 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5928 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5929 (Arm_relocate_functions::thm_alu11): New Method.
5930 (Arm_relocate_functions::thm_pc8): New Method.
5931 (Arm_relocate_functions::thm_pc12): New Method.
5932 (Target_arm::Scan::local): Handle the relocations.
5933 (Target_arm::Scan::global): Likewise.
5934 (Target_arm::Relocate::relocate): Likewise.
5935 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5936
c9a2c125
DK
59372010-01-29 Doug Kwan <dougkwan@google.com>
5938
5939 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5940 of relocation types as ld.
5941
1521477a
DK
59422010-01-29 Doug Kwan <dougkwan@google.com>
5943
5944 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5945 to public.
5946 (Arm_relocate_functions::thumb_branch_common): Ditto.
5947 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5948 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5949 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5950 Arm_relocate_functions::jump24): Remove.
5951 (Target_arm::Relocate::relocate): Adjust code to call
5952 Arm_relocation_functions::arm_branch_common and
5953 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 5954 wrappers. Merge switch-cases together to reduce source code size.
1521477a 5955
e7eca48c
DK
59562010-01-29 Doug Kwan <dougkwan@google.com>
5957
5958 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5959 output_local_symbol_count_needs_update_.
5960 (Arm_relobj::output_local_symbol_count_needs_update,
5961 Arm_relobj::set_output_local_symbol_count_needs_update,
5962 Arm_relobj::update_output_local_symbol_count): New methods.
5963 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5964 member.
5965 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5966 of pointed function as in a R_ARM_PREL31 relocation.
5967 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5968 for output local symbol count updating.
5969 (Target_arm::do_relax): Update output local symbol counts in objects
5970 if necessary.
5971 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5972
02961d7e
ILT
59732010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5974
5975 * arm.cc: Added support for the ARM relocations:
5976 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5977 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5978 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5979 movw_prel_nc).
5980 (Arm_relocate_functions::movw_rel): New method.
5981 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5982 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5983 thm_movw_prel_nc).
5984 (Arm_relocate_functions::thm_movw_rel): New method.
5985 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5986 thm_movt_prel).
5987 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5988 relocations.
5989 (Target_arm::Scan::global): Likewise.
5990 (Target_arm::Relocate::relocate): Likewise.
5991 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5992 Likewise.
5993
b10d2873
ILT
59942010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5995
5996 * arm.cc: Added support for ARM group relocations.
5997 (Target_arm::reloc_needs_sym_origin): New method.
5998 (Arm_relocate_functions::calc_grp_kn): New method.
5999 (Arm_relocate_functions::calc_grp_residual): New method.
6000 (Arm_relocate_functions::calc_grp_gn): New method.
6001 (Arm_relocate_functions::arm_grp_alu): New Method.
6002 (Arm_relocate_functions::arm_grp_ldr): New Method.
6003 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6004 (Arm_relocate_functions::arm_grp_ldc): New Method.
6005 (Target_arm::Scan::local): Handle the ARM group relocations.
6006 (Target_arm::Scan::global): Likewise.
6007 (Target_arm::Relocate::relocate): Likewise.
6008 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6009 Likewise.
6010
2b328d4e
DK
60112010-01-26 Doug Kwan <dougkwan@google.com>
6012
6013 * arm.cc (set): Include.
6014 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6015 pointer type.
6016 (Arm_output_section::Text_section_list): New type.
6017 (Arm_output_section::append_text_sections_to_list): New method.
6018 (Arm_output_section::fix_exidx_coverage): Ditto.
6019 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6020 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6021 Relobj::set_section_offset() instead of
6022 Sized_relobj::invalidate_section_offset().
6023 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6024 parameter for section headers. Ignore relocation sections for
6025 unallocated sections and EXIDX sections.
6026 (Target_arm::fix_exidx_coverage): New method.
6027 (Target_arm::output_section_address_less_than): New type.
6028 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6029 linked text section instead of the EXIDX section.
6030 (Arm_output_section::create_stub_group): Add an assertion to check
6031 that this is not an EXIDX output section.
6032 (Arm_output_section::append_text_sections_to_list): New method.
6033 (Arm_output_section::fix_exidx_coverage): Ditto.
6034 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6035 Arm_relobj::section_needs_reloc_stub_scanning.
6036 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6037 first pass.
6038 (Target_arm::fix_exidx_coverage): New method.
6039 * object.h (Relobj::set_output_section): New method.
6040 (Sized_relobj::invalidate_section_offset): Remove method.
6041 (Sized_relobj::do_invalidate_section_offset): Remove method.
6042 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6043
c7f3c371
DK
60442010-01-25 Doug Kwan <dougkwan@google.com>
6045
6046 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6047 Fix warning due to signed and unsigned comparison on a 32-bit host.
6048
8923b24c
DK
60492010-01-22 Doug Kwan <dougkwan@google.com>
6050
6051 * arm.cc (Target_arm::do_relax): Record an output section for section
6052 offset adjustment it contains any stub table that has changed.
6053 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6054 offsets in an output section if necessary.
6055 * output.cc (Output_section::Output_section): Initialize
6056 section_offsets_need_adjustments_.
6057 (Output_section::add_input_section_for_script): Renamed to
6058 Output_section::add_simple_input_section.
6059 (Output_section::save_states): Add a comment.
6060 (Output_section::discard_states): New method defintion.
6061 (Output_section::adjust_section_offsets): Same.
6062 * output.h (Output_section::add_input_section_for_script): Renamed to
6063 Output_section::add_simple_input_section.
6064 (Output_section::discard_states): New method declaration.
6065 (Output_section::adjust_section_offsets): Same.
6066 (Output_section::section_offsets_need_adjustment,
6067 Output_section::set_section_offsets_need_adjustment): New method
6068 definitions.
6069 (Output_section::section_offsets_need_adjustment_): New data member.
6070 * script-sections.cc
6071 (Output_section_element_input::set_section_address): Adjust code for
6072 renaming of Output_section::add_input_section_for_script.
6073 (Orphan_output_section::set_section_address): Same.
6074
9b2fd367
DK
60752010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6076
6077 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6078 Fix_v4bx enum values .
6079 * gold/options.h (General_options): New option definitions.
6080 (General_options::fix_v4bx): New method.
6081 (General_options::Fix_v4bx): New enum.
6082 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6083 (General_options::parse_fix_v4bx_interworking): New method.
6084
80d0d023
DK
60852010-01-22 Doug Kwan <dougkwan@google.com>
6086
6087 * arm.cc (Arm_exidx_fixup): New class.
6088
af2cdeae
DK
60892010-01-21 Doug Kwan <dougkwan@google.com>
6090
6091 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6092 classes.
6093 (Arm_exidx_section_offset_map): New type.
6094
993d07c1
DK
60952010-01-21 Doug Kwan <dougkwan@google.com>
6096
6097 * arm.cc (Arm_exidx_input_section): New class.
6098 (Arm_relobj::exidx_input_section_by_link,
6099 Arm_relobj::exidx_input_section_by_shndx,
6100 Arm_relobj::make_exidx_input_section): New methods.
6101 (read_arm_attributes_section): Remove.
6102 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6103 information about them.
6104 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6105 to here.
6106
5ac169d4
DK
61072010-01-20 Doug Kwan <dougkwan@google.com>
6108
6109 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6110 Input_section_specifier to Section_id.
6111 (Target_arm::new_arm_input_section: Adjust code for change of key
6112 type.
6113 (Target_arm::find_arm_input_section): Ditto.
6114 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6115 (Section_id): Remove.
6116 (Garbage_collection::Section_id_hash): Remove.
6117 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6118 (Section_id): Remove.
6119 (Icf::Section_id_hash): Remove.
6120 * object.h (Section_id, Const_section_id, Section_id_hash,
6121 Const_section_id_hash): New type definitions.
6122 * output.cc (Output_section::add_relaxed_input_section): Change to
6123 use Const_section_id instead of Input_section_specifier as key type.
6124 (Output_section::add_merge_input_section): Ditto.
6125 (Output_section::build_relaxation_map): Change to use Section_id
6126 instead of Input_section_specifier as key type.
6127 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6128 Ditto.
6129 (Output_section::convert_input_sections_to_relaxed_sections): Change
6130 to use Const_section_id instead of Input_section_specifier as key type.
6131 (Output_section::find_merge_section): Ditto.
6132 (Output_section::find_relaxed_input_section): Ditto.
6133 * output.h (Input_section_specifier): Remove class.
6134 (Output_section::Output_section_data_by_input_section_map): Change
6135 key type to Const_section_id.
6136 (Output_section::Output_relaxed_input_section_by_input_section_map):
6137 Ditto.
6138 (Output_section::Relaxation_map): Change key type to Section_id.
6139
a2162063
ILT
61402010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6141
6142 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6143 (class Arm_v4bx_stub): New class.
6144 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6145 (Stub_factory::make_arm_v4bx_stub): New method.
6146 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6147 (Stub_table::empty): Handle v4bx stubs.
6148 (Stub_table::add_arm_v4bx_stub): New method.
6149 (Stub_table::find_arm_v4bx_stub): New method.
6150 (Arm_relocate_functions::v4bx): New method.
6151 (Target_arm::fix_v4bx): New method.
6152 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6153 (Stub_table::relocate_stubs): Likewise.
6154 (Stub_table::do_write): Likewise.
6155 (Stub_table::update_data_size_and_addralign): Likewise.
6156 (Stub_table::finalize_stubs): Likewise.
6157 (Target_arm::Scan::local): Likewise.
6158 (Target_arm::Scan::global): Likewise.
6159 (Target_arm::do_finalize_sections): Likewise.
6160 (Target_arm::Relocate::relocate): Likewise.
6161 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6162 Likewise.
6163 (Target_arm::scan_reloc_for_stub): Likewise.
6164 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6165
5696ab0b
ILT
61662010-01-19 Ian Lance Taylor <iant@google.com>
6167
6168 * output.cc (Output_section_headers::do_sized_write): Write large
6169 segment count to sh_info field.
6170 (Output_file_header::do_sized_write): For large segment count,
6171 write PN_XNUM to e_phnum field.
6172
800d0f56
ILT
61732010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6174
6175 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6176 (Arm_relocate_functions::thm_jump8): New function.
6177 (Arm_relocate_functions::thm_jump11): New function.
6178 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6179 R_ARM_THM_JUMP11.
6180 (Target_arm::Scan::global): Likewise.
6181 (Target_arm::Relocate::relocate): Likewise.
6182 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6183 Likewise.
6184
41263c05
DK
61852010-01-14 Doug Kwan <dougkwan@google.com>
6186
6187 * arm.cc (map, utility): Include headers.
6188 (Target_arm::apply_cortex_a8_workaround): New method.
6189 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6190 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6191 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6192 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6193 the --[no-]fix-cortex-a8 command line options.
6194 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6195 (Target_arm::relocate_stub): Use addend in instruction template.
6196 * options.h (DEFINE_bool): Set the user-set flag.
6197 (General_options): Add --[no-]-fix-cortex options.
6198 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 6199 : Update fast look-up map after conversion.
41263c05 6200
459e9b03
ST
62012010-01-14 Sriraman Tallam <tmsriram@google.com>
6202
6203 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6204 in the first pass of do_layout.
6205
b521dfe4
DK
62062010-01-13 Doug Kwan <dougkwan@google.com>
6207
6208 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6209 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6210 apparent compiler problem of not folding static constant integral
6211 data members of elfcpp::Elf_sizes<32>.
6212
44272192
DK
62132010-01-13 Doug Kwan <dougkwan@google.com>
6214
6215 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6216 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6217 Arm_relobj::scan_section_for_cortex_a8_erratum,
6218 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6219 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6220 sections to scan for relocation stubs into a new method
6221 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6222 relocation and Cortex-A8 stub scanning.
6223 (Target_arm::do_relax): Force stubs to be after stubbed sections
6224 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 6225 the beginning of a new relaxation pass. Update a comment.
44272192
DK
6226 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6227
44b71ece
ILT
62282010-01-12 Ian Lance Taylor <iant@google.com>
6229
6230 * target-reloc.h (visibility_error): New inline function.
6231 (relocate_section): Call visibility_error.
6232 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6233 (MOSTLYCLEANFILES): Likewise.
6234 (protected_4_pic.o, protected_3.err): New targets.
6235 * testsuite/protected_4.cc: New file.
6236
a120bc7f
DK
62372010-01-12 Doug Kwan <dougkwan@google.com>
6238
6239 * arm.cc (Cortex_a8_reloc): New class.
6240 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6241 and cortex_a8_relocs_info_.
6242 (Target_arm::fix_cortex_a8): New method definition.
6243 (Target_arm::Cortex_a8_relocs_info): New type.
6244 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6245 New data member declarations.
6246 (Target_arm::scan_reloc_for_stub): Record information about
6247 relocations for THUMB branches that might be exempted from the
6248 Cortex-A8 workaround.
6249 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6250 at the beginning of a relaxation pass.
6251
20138696
DK
62522010-01-12 Doug Kwan <dougkwan@google.com>
6253
6254 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6255 (Arm_relobj::Mapping_symbol_position,
6256 Arm_reloj::Mapping_symbol_position_less,
6257 Arm_relobj::Mapping_symbols_info): New types.
6258 (Target_arm::is_mapping_symbol_name): New method definition.
6259 (Arm_relobj::do_count_local_symbols): Save information about mapping
6260 symbols.
6261
089d69dc
DK
62622010-01-11 Doug Kwan <dougkwan@google.com>
6263
6264 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6265 Arm_relocate_functions::thumb32_branch_upper,
6266 Arm_relocate_functions::thumb32_branch_lower,
6267 Arm_relocate_functions::thumb32_cond_branch_offset,
6268 Arm_relocate_functions::thumb32_cond_branch_upper,
6269 Arm_relocate_functions::thumb32_cond_branch_lower,
6270 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6271 branch offset encoding.
6272 (Arm_relocate_functions::thumb_branch_common): Use new branch
6273 offset encoding methods to avoid code duplication.
6274 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6275 (Stub_addend_reader::operator()): Use new branch encoding method
6276 to avoid code duplication.
6277
99e5bff2
DK
62782010-01-11 Doug Kwan <dougkwan@google.com>
6279
6280 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6281 (Target_arm::do_finalize_sections): Define special EXIDX section
6282 symbols only if referenced.
6283 * gc.h (Garbage_collection::add_reference): New method.
6284 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6285 code duplication.
6286
98e090bd
ILT
62872010-01-11 Ian Lance Taylor <iant@google.com>
6288
d0a91bd8
ILT
6289 * script.cc (Version_script_info::build_expression_list_lookup):
6290 Change complaing about duplicate wildcard match from error to
6291 warning.
6292
98e090bd
ILT
6293 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6294 of 2009-12-30.
6295 (Version_script_info::Version_script_info): Initialize globs_,
6296 default_version_, default_is_global_, and exact_. Don't
6297 initialize globals_ or locals_.
6298 (Version_script_info::build_lookup_tables): Build local symbols
6299 first.
6300 (Version_script_info::unquote): New function.
6301 (Version_script_info::add_exact_match): New function.
6302 (Version_script_info::build_expression_list_lookup): Remove lookup
6303 parameter. Add is_global parameter. Change all callers. Handle
6304 wildcard pattern specially. Unquote pattern. Call
6305 add_exact_match.
6306 (Version_script_info::get_name_to_match): New function.
6307 (Version_script_info::get_symbol_version): New function.
6308 (Version_script_info::get_symbol_version_helper): Remove.
6309 (Version_script_info::check_unmatched_names): Call unquote.
6310 * script.h (class Version_script_info): Change get_symbol_version
6311 to be non-inline and add is_global parameter; change all callers.
6312 Rewrite symbol_is_local. Update declarations. Define struct
6313 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6314 Remove globals_ and locals_ members. Add exact_, globs_,
6315 default_version_, is_global_.
6316 (Version_script_info::Glob): Remove pattern, add expression and
6317 is_global. Update constructor. Change all callers.
6318 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6319 default version.
6320 (Versions::symbol_section_contents): If a symbol is undefined, or
6321 defined in a dynamic object, set the version index to
6322 VER_NDX_LOCAL.
6323 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6324 symbol_is_local.
6325 (Symbol_table::add_from_pluginobj): Likewise.
6326 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6327
d56962d3
DK
63282010-01-11 Doug Kwan <dougkwan@google.com>
6329
6330 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6331 (incremental_dump_LDADD): Add linking option for libintl.
6332 * Makefile.in: Regenerate.
6333
94e6ee91
L
63342010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6335
6336 PR gold/11144
6337 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6338 instead of -Ds.
6339 * testsuite/Makefile.in: Regenerated.
6340
e96c574b
DK
63412010-01-10 Doug Kwan <dougkwan@google.com>
6342
6343 * options.h (DEFINE_var): Use parentheses around argument varname__
6344 in macro body to avoid any unintended subsequent substitutions.
6345
7198066b
ILT
63462010-01-10 Ian Lance Taylor <iant@google.com>
6347
ba4d53bf
ILT
6348 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6349 candidates before doing symbol resolution.
6350
7198066b
ILT
6351 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6352 ODR candidates if only one is weak.
6353
a2beed37
ILT
63542010-01-08 Ian Lance Taylor <iant@google.com>
6355
6356 * script.cc (Version_script_info::build_expression_list_lookup):
6357 Don't warn about ambiguous version, just record the ambiguity.
6358 (Version_script_info::get_symbol_version_helper): Give error if
6359 version is ambiguous.
6360
2fb7225c
DK
63612010-01-08 Doug Kwan <dougkwan@google.com>
6362
6363 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6364 prev_data_size_ and prev_addralign_. Remove initializer for
6365 deleted data member has_been_changed_.
6366 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6367 to determine if the table is empty.
6368 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6369 Remove.
6370 (Stub_table::add_reloc_stub): Define method in class definition
6371 instead of just declaring it there.
6372 (Stub_table::add_cortex_a8_stub): New method definition.
6373 (Stub_table::update_data_size_and_addralign): Ditto.
6374 (Stub_table::finalize_stubs): Ditto.
6375 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6376 (Stub_table::do_addralign_): Return address alignment in the
6377 (Stub_table::do_reset_address_and_file_offset): Define method in
6378 class definition instead of declaring it there. Set current data
6379 size to be the data size of the previous pass.
6380 (Stub_table::set_final_data_size): Use current data size as the
6381 final data size.
6382 (Stub_table::relocate_stub): Change parameter type of stub from
6383 Reloc_stub pointer to Stub pointer.
6384 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6385 (Stub_table::Cortex_a8_stub_list): New typedef.
6386 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6387 Stub_table::prev_addralign_): New data member.
6388 (Arm_relobj::Arm_relobj): Initialize data member
6389 section_has_cortex_a8_workaround_.
6390 (Arm_relobj::section_has_cortex_a8_workaround,
6391 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6392 definitions.
6393 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6394 declarations.
6395 (Target_arm::relocate_stub): Change parameter type of stub from
6396 Reloc_stub pointer to Stub pointer.
6397 (Insn_template::size, Insn_template::alignment): Handle
6398 THUMB16_SPECIAL_TYPE.
6399 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6400 Stub_table::update_data_size_and_addralign,
6401 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6402 definitions.
6403 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6404 (Stub_table::do_write): Ditto.
6405 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6406
880cd20d
ILT
64072010-01-08 Ian Lance Taylor <iant@google.com>
6408
6409 PR 11108
6410 * symtab.h (class Symbol): Remove fields is_target_special_ and
6411 has_plt_offset_. Add field is_defined_in_discarded_section_.
6412 (Symbol::is_defined_in_discarded_section): New function.
6413 (Symbol::set_is_defined_in_discarded_section): New function.
6414 (Symbol::has_plt_offset): Rewrite.
6415 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6416 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6417 Don't initialize is_target_special_ or has_plt_offset_.
6418 Initialize is_defined_in_discarded_section_.
6419 (Symbol_table::add_from_relobj): If appropriate, set
6420 is_defined_in_discarded_section.
6421 * resolve.cc (Symbol::override_base_with_special): Don't test
6422 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6423 * target-reloc.h (relocate_section): Do special handling for
6424 symbols defined in discarded sections for global symbols as well
6425 as local symbols.
6426
2703e3eb
ILT
64272010-01-08 Ian Lance Taylor <iant@google.com>
6428
6429 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6430 the SHT_SYMTAB case.
6431
339d40a3
ILT
64322010-01-08 Ian Lance Taylor <iant@google.com>
6433
6434 * object.cc (Sized_relobj::do_layout): Don't get confused if
6435 layout_eh_frame returns NULL.
6436
abecea76
ILT
64372010-01-08 Ian Lance Taylor <iant@google.com>
6438
6439 PR 11084
6440 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6441 dynamic symbol table, use the normal symbol table.
6442 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6443 symbol table.
6444
6b7dd3f3
ILT
64452010-01-08 Ian Lance Taylor <iant@google.com>
6446
6447 PR 11072
6448 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6449 sections.
6450
36c50e63
L
64512010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6452
6453 * version.cc (print_version): Change to "Copyright 2010".
6454
e291e7b9
ILT
64552010-01-08 Ian Lance Taylor <iant@google.com>
6456
6457 PR 10287
6458 PR 11063
6459 * i386.cc (class Target_i386): Change return type of plt_section
6460 to be non-const.
6461 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6462 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6463 tls_desc_rel_ field.
6464 (Output_data_plt_i386::rel_tls_desc): New function.
6465 (Target_i386::rel_tls_desc_section): New function.
6466 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6467 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6468 R_386_TLS_DESC reloc in rel_tls_desc_section.
6469 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6470 Define struct Tlsdesc_info.
6471 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6472 (Target_x86_64::do_reloc_symbol_index): New function.
6473 (Target_x86_64::add_tlsdesc_info): New function.
6474 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6475 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6476 tlsdesc_rel_ field.
6477 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6478 all callers.
6479 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6480 (Target_x86_64::rela_tlsdesc_section): New function.
6481 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6482 handling.
6483 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6484 (Target_x86_64::do_reloc_addend): New function.
6485 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6486 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6487 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6488 (Output_reloc::type): New function.
6489 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6490 (Output_reloc::is_target_specific): New function.
6491 (Output_reloc::target_arg): New function.
6492 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6493 absolute relocs and target specific relocs.
6494 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6495 add_target_specific.
6496 (class Output_data_reloc) [SHT_RELA]: Likewise.
6497 * output.cc (Output_reloc::Output_reloc): Add four new versions
6498 for absolute relocs and target specific relocs.
6499 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6500 (Output_reloc::get_symbol_index): Likewise.
6501 (Output_reloc::local_section_offset): Check that local_sym_index_
6502 is not TARGET_CODE or 0.
6503 (Output_reloc::symbol_value): Likewise.
6504 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6505 reloc.
6506 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6507 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6508 functions.
6509 * layout.cc (add_target_dynamic_tags): Use output section for
6510 DT_PLTRELSZ and DT_JMPREL.
6511
3a44184e
ILT
65122010-01-07 Ian Lance Taylor <iant@google.com>
6513
6514 PR 11061
6515 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6516 function.
6517 (class Output_data_reloc_generic): Define.
6518 (class Output_data_reloc_base): Change base class to
6519 Output_data_reloc_generic. Change add() method to call
6520 bump_relative_reloc_count for a relative reloc. Remove
6521 sort_relocs_ field.
6522 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6523 to sort_relocs().
6524 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6525 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6526 appropriate.
6527 * layout.h (class Layout): Update declaration.
6528
ea715a34
ILT
65292010-01-07 Ian Lance Taylor <iant@google.com>
6530
6531 * output.h (class Output_data): Add const version of
6532 output_section and do_output_section.
6533 (class Output_section_data): Add const version of
6534 do_output_section.
6535 (class Output_section): Likewise.
6536 * layout.cc (Layout::add_target_dynamic_tags): New function.
6537 * layout.h (class Layout): Update declarations.
6538 * arm.cc (Target_arm::do_finalize_sections): Use
6539 add_target_dynamic_tags.
6540 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6541 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6542 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6543 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6544
659948a4
ILT
65452010-01-07 Ian Lance Taylor <iant@google.com>
6546
6547 PR 11042
6548 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6549 object as needed.
6550
9d3b86f6
ILT
65512010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6552 Ian Lance Taylor <iant@google.com>
6553
6554 PR 11019
6555 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6556 Xindex::read_symtab_xindex.
6557
bb0d3eb0
DK
65582010-01-07 Doug Kwan <dougkwan@google.com>
6559
6560 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6561 (Insn_template::thumb16_bcond_insn): New method declaration.
6562 (Insn_template): Fix spelling.
6563 (Stub::thumb16_special): New method declaration.
6564 (Stub::do_write): Define virtual method which was previously pure
6565 virtual.
6566 (Stub::do_thumb16_special): New method declaration.
6567 (Stub::do_fixed_endian_write): New template member.
6568 (Reloc_stub::do_write): Remove.
6569 (Reloc_stub::do_fixed_endian_write): Remove.
6570 (Cortex_a8_stub): New class definition.
6571 (Stub_factory::make_cortex_a8_stub): New method definition.
6572 (Stub_factory::Stub_factory): Add missing static storage class
6573 qualifier for elf32_arm_stub_a8_veneer_blx.
6574
ffeef7df
ILT
65752010-01-07 Ian Lance Taylor <iant@google.com>
6576
dc3f80fe
ILT
6577 PR 10980
6578 * options.h (class General_options): Add --warn-unresolved-symbols
6579 and --error-unresolved-symbols.
6580 * errors.cc (Errors::undefined_symbol): Implement
6581 --warn-unresolved-symbols.
6582
ffeef7df
ILT
6583 * options.h (class General_options): Add -z text and -z textoff.
6584 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6585
f1ec9ded
ST
65862010-01-06 Sriraman Tallam <tmsriram@google.com>
6587
6588 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6589 (Garbage_collection::cident_sections): New function.
6590 (Garbage_collection::add_cident_section): New function.
6591 (Garbage_collection::cident_sections_): New member.
6592 (gc_process_relocs): Add references to sections whose names are C
6593 identifiers.
6594 * gold.h (cident_section_start_prefix): New constant.
6595 (cident_section_stop_prefix): New constant.
6596 (is_cident): New function.
6597 * layout.cc (Layout::define_section_symbols): Replace string constants
6598 with the newly defined constants.
6599 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6600 C identifiers.
6601 * testsuite/Makefile.am: Add gc_orphan_section_test.
6602 * testsuite/Makefile.in: Regenerate.
6603 * testsuite/gc_orphan_section_test.cc: New file.
6604 * testsuite/gc_orphan_section_test.sh: New file.
6605
6eda8c29
ILT
66062010-01-06 Ian Lance Taylor <iant@google.com>
6607
b9674e17
ILT
6608 PR 10980
6609 * options.h (class General_options): Add --warn-shared-textrel.
6610 * layout.cc (Layout::finish_dynamic_section): Implement
6611 --warn-shared-textrel.
6612
6eda8c29
ILT
6613 PR 10980
6614 * options.h (class General_options): Add --warn-multiple-gp.
6615
32dcd44e
ILT
66162010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6617
6618 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6619 $(THREADSLIB) and $(LIBDL).
6620 * Makefile.in: Rebuild.
6621
a192ba05
ILT
66222010-01-06 Ian Lance Taylor <iant@google.com>
6623
6624 PR 10980
6625 * options.cc (General_options::parse_section_start): New function.
6626 (General_options::section_start): New function.
6627 (General_options::General_options): Initialize all members.
6628 * options.h: Include <map>
6629 (class General_options): Add --section-start. Add section_starts_
6630 member.
6631 * layout.cc (Layout::attach_allocated_section_to_segment): If
6632 --section-start was used, set the address of the segment. Remove
6633 local sort_sections.
6634 (Layout::relaxation_loop_body): If the address of the load segment
6635 has been set by --section-start, don't use it.
6636 * output.h (Output_segment::update_flags_for_output_section): New
6637 function.
6638 * output.cc (Output_segment::add_output_section): Call
6639 update_flags_for_output_section.
6640
dde3f402
ILT
66412010-01-05 Ian Lance Taylor <iant@google.com>
6642
62dfdd4d
ILT
6643 PR 10980
6644 * options.h (class General_options): Add --undefined-version.
6645 * script.cc (struct Version_expression): Add was_matched_by_symbol
6646 field.
6647 (Version_script_info::matched_symbol): New function.
6648 (Version_script_info::get_symbol_version_helper): Call
6649 matched_symbol.
6650 (Version_script_info::check_unmatched_names): New function.
6651 * script.h (class Version_script_info): Update declarations.
6652 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6653
9c4ae156
ILT
6654 * options.h (class General_options): Use DEFINE_bool_alias for
6655 allow_multiple_definition.
6656 * resolve.cc (Symbol_table::should_override): Don't test
6657 allow_multiple_definition.
6658
dde3f402
ILT
6659 PR 10980
6660 * options.h (class General_options): Add --cref.
6661 * main.cc (main): Print cref table if --cref. Don't close mapfile
6662 until after printing cref table.
6663 * cref.cc: Include "symtab.h".
6664 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6665 (Cref_table_compare::operator()): New function.
6666 (Cref_inputs::gather_cref): New function.
6667 (filecol): New static const.
6668 (Cref_inputs::print_cref): New function.
6669 (Cref::print_cref): New function.
6670 * cref.h: Include <cstdio>.
6671 (class Cref): Update declarations.
6672 * mapfile.h (Mapfile::file): New function.
6673 * object.h (class Object): Define Symbols. Declare virtual
6674 do_get_global_symbols.
6675 (Object::get_global_symbols): New function.
6676 * object.cc (Input_objects::add_object): Pass object to cref_ if
6677 --cref.
6678 (Input_objects::archive_start): Likewise.
6679 (Input_objects::archive_stop): Likewise.
6680 (Input_objects::print_cref): New function.
6681 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6682 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6683 --cref.
6684 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6685 function.
6686 * plugin.h (class Sized_pluginobj): Update declarations.
6687
8781f709
ILT
66882010-01-05 Ian Lance Taylor <iant@google.com>
6689
6690 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6691 to is_default_version. Rename insdef to insdefault.
6692 (Symbol_table::add_from_relobj): Rename def to is_default_version
6693 and local to is_forced_local.
6694 (Symbol_table::add_from_pluginobj): Likewise.
6695 (Symbol_table::add_from_dynobj): Likewise.
6696 (Symbol_table::define_special_symbol): Rename insdef to
6697 insdefault.
6698
fe35d28d
ILT
66992010-01-04 Ian Lance Taylor <iant@google.com>
6700
30bc8c46
ILT
6701 PR 10980
6702 * options.h (class General_options): Add
6703 --allow-multiple-definition and -z muldefs.
6704 * resolve.cc (Symbol_table::should_override): Don't warn about a
6705 multiple symbol definition if --allow-multiple-definition or -z
6706 muldefs.
6707
7eaea549
ILT
6708 PR 10980
6709 * options.h (class General_options): Add --add-needed and
6710 --copy-dt-needed-entries. Tweak --as-needed help entry.
6711 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6712 error if --copy-dt-needed-entries aka --add-needed is used and
6713 would cause a change in behaviour.
6714
fe35d28d
ILT
6715 PR 10980
6716 * options.h (class General_options): Add -G as a short version of
6717 --shared. Add no-op options -assert, -g, and -i.
6718
55a2bb35
ST
67192010-01-04 Sriraman Tallam <tmsriram@google.com>
6720
6721 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6722 check for .text or .gnu.linkonce.t sections.
6723 * icf.cc (Icf::find_identical_sections): Ditto.
6724 Change the detection for mangled function name within the section
6725 name.
6726 * icf.h (is_section_foldable_candidate): New function.
6727
719328e1
ILT
67282009-12-30 Ian Lance Taylor <iant@google.com>
6729
6730 PR 10980
6731 * options.h (class General_options): Permit two dashes with
6732 --retain-symbols-file.
6733
d7bb5745
ILT
67342009-12-30 Ian Lance Taylor <iant@google.com>
6735
403a15dd
ILT
6736 PR 10979
6737 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6738 don't put the file header and segment headers in the text
6739 segment.
6740
eda294df
ILT
6741 PR 10979
6742 * common.cc (Sort_commons::operator()): Stabilize sort when both
6743 entries are NULL.
6744 (Symbol_table::do_allocate_commons_list): When allocating common
6745 symbols, skip a symbol which is no longer common.
6746 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6747 an object before checking its type.
6748 * testsuite/common_test_2.c: New file.
6749 * testsuite/common_test_3.c: New file.
6750 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6751 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6752 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6753 (common_test_2_pic.o, common_test_2.so): New targets.
6754 (common_test_3_pic.o, common_test_3.so): New targets.
6755 * testsuite/Makefile.in: Rebuild.
6756
d7bb5745
ILT
6757 PR 10979
6758 * script.cc (read_input_script): If we see a new SECTIONS clause,
6759 and we have added an input section, give an error.
6760 * layout.h (class Layout): Add have_added_input_section function.
6761 Add have_added_input_section_ field.
6762 * layout.cc (Layout::Layout): Initialize
6763 have_added_input_section_.
6764 (Layout::layout): Set have_added_input_section_.
6765 (Layout::layout_eh_frame): Likewise.
6766
fc59c572
ILT
67672009-12-30 Ian Lance Taylor <iant@google.com>
6768
6769 PR 10931
6770 * options.h (class General_options): Add --sort-common option.
6771 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6772 * common.cc (Sort_common): Add sort_order parameter to
6773 constructor. Add sort_order_ field.
6774 (Sort_commons::operator): Check sort_order_.
6775 (Symbol_table::allocate_commons): Determine the sort order.
6776 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6777 Change all callers.
6778 (Symbol_table::do_allocate_commons_list): Likewise.
6779
1c74fab0
ILT
67802009-12-30 Ian Lance Taylor <iant@google.com>
6781
6782 PR 10916
6783 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6784 symbols from this object, don't change the visibility of an
6785 undefined symbol.
6786 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6787
6affe781
ILT
67882009-12-30 Ian Lance Taylor <iant@google.com>
6789
6790 PR 10861
6791 * script.h (class Version_script_info): Define Language enum.
6792 Update declarations. Define Glob, Exact, and Lookup types. Add
6793 new fields globals_, locals_, and is_finalized_.
6794 * script.cc: Various formatting fixes.
6795 (class Parser_closure): Change language_stack_ from a vector of
6796 std::string to one of Version_script_info::Language. Adjust all
6797 uses accordingly.
6798 (class Lazy_demangler): Remove.
6799 (struct Version_expression): Change language from std::string to
6800 Version_script_info::Language.
6801 (Version_script_info::Version_script_info): New function.
6802 (Version_script_info::~Version_script_info): Don't call clear.
6803 (Version_script_info::finalize): New function.
6804 (Version_script_info::build_lookup_tables): New function.
6805 (Version_script_info::build_expression_list_lookup): New
6806 function.
6807 (Version_script_info::get_symbol_version_helper): Rewrite to use
6808 lookup tables.
6809 (Version_script_info::print_expression_list): Adjust to use
6810 Version_script_info::Language.
6811 (script_push_lex_into_version_mode): Check that the version script
6812 has not been finalized.
6813 (version_script_push_lang): Change language string to
6814 Version_script_info::Language.
6815 * options.cc (Command_line::version_script): New function.
6816 * options.h (class General_options): Add finalize_dynamic_list
6817 function. Change version_script from declaration to definition.
6818 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6819 * testsuite/version_script.map: Remove duplicate def of foo.
6820 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6821 version_script.map.
6822 * testsuite/Makefile.in: Rebuild.
6823
818bf354
ILT
68242009-12-30 Ian Lance Taylor <iant@google.com>
6825
6826 PR 10843
6827 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6828 if the input symbol index is 0, make the output symbol index 0.
6829
ebcc8304
ILT
68302009-12-30 Ian Lance Taylor <iant@google.com>
6831
6832 PR 10670
6833 * options.h (class General_options): Add -x/--discard-all.
6834 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6835 --discard-all. If the local symbol needs a dynamic entry, check
6836 that before handling --discard-locals.
6837
176fe33f
ILT
68382009-12-30 Ian Lance Taylor <iant@google.com>
6839
bb321bb1
ILT
6840 PR 10450
6841 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6842 flags to PF_R.
6843 (Output_segment::add_output_section): Don't change the flags if
6844 the type is PT_TLS.
6845
176fe33f
ILT
6846 PR 10450
6847 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6848 GNU hash table if they need a dynamic value. Otherwise, don't add
6849 them if they are defined in a dynamic object or are forced local.
6850
e8cd95c7
ILT
68512009-12-29 Ian Lance Taylor <iant@google.com>
6852
1b81fb71
ILT
6853 PR 10450
6854 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6855 .gnu.hash table for a 32-bit target.
6856
8d6d383d
ILT
6857 PR 10450
6858 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6859 regular and a dynamic object only needs a dynamic symbol table
6860 entry if it is externally visible.
6861
e785ec03
ILT
6862 PR 10450
6863 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6864 constructor. Add global_offset_table_ field.
6865 (Target_i386::got_section): Set global_offset_table_.
6866 (Target_i386::do_finalize_sections): Set global_offset_table_
6867 size.
6868 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6869 in constructor. Add global_offset_table_ field.
6870 (Target_x86_64::got_section): Set global_offset_table_.
6871 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6872 size.
6873
1a2dff53
ILT
6874 * layout.cc (Layout::Layout): Initialize increase_relro_.
6875 (Layout::get_output_section): Add is_relro, is_last_relro, and
6876 is_first_non_relro parameters. Change all callers.
6877 (Layout::choose_output_section): Likewise.
6878 (Layout::add_output_section_data): Likewise.
6879 (Layout::make_output_section): Likewise.
6880 (Layout::set_segment_offsets): Clear increase_relro when using a
6881 linker script.
6882 * layout.h (class Layout): Add increase_relro method. Add
6883 increase_relro_ field. Update declarations.
6884 * output.cc (Output_section::Output_section): Initialize
6885 is_last_relro_ and is_first_non_relro_.
6886 (Output_segment::add_output_section): Group relro sections is
6887 do_sort is true. Handle is_last_relro and is_first_non_relro.
6888 (Output_segment::maximum_alignment): Remove relro handling.
6889 (Output_segment::set_section_addresses): Add increase_relro
6890 parameter. Change all callers. Add initial alignment to align
6891 relro sections on separate page. Remove old relro handling.
6892 (Output_segment::set_section_list_addresses): Remove in_relro
6893 parameter. Change all callers.
6894 (Output_segment::set_offset): Add increase parameter. Change all
6895 callers. Remove old relro handling.
6896 * output.h (class Output_section): Add new methods: is_last_relro,
6897 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6898 Add is_last_relro_ and is_first_non_relro_ fields.
6899 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6900 Create separate .got.plt section. Call increase_relro.
6901 * x86_64.cc (Target_x86_64::got_section): Likewise.
6902 * testsuite/relro_script_test.t: Add .got.plt.
6903
f0ba79e2
ILT
6904 PR 10450
6905 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6906 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6907 (Layout::finalize): Call set_dynamic_symbol_size.
6908 (Layout::set_dynamic_symbol_size): New function.
6909 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6910 set_dynamic_symbol_size.
6911
e8cd95c7
ILT
6912 PR 10450
6913 * output.h (class Output_section): Add is_entsize_zero_ field.
6914 * output.cc (Output_section::Output_section): Initialize
6915 is_entsize_zero_.
6916 (Output_section::set_entsize): If two different entsizes are
6917 requested, force it to zero.
6918 (Output_section::add_input_section): Set flags for .debug_str
6919 before updating section flags. Set entsize.
6920 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6921 and SHF_STRING if all input sections have those flags.
6922
3e1b9a8a
RÁE
69232009-12-29 Rafael Espindola <espindola@google.com>
6924
6925 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
6926 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6927 reporting.
3e1b9a8a 6928
3dcad376
ST
69292009-12-29 Sriraman Tallam <tmsriram@google.com>
6930
6931 * options.cc (General_options::parse_version): Allow -v to exit
6932 without an error if there is nothing to link.
6933
084e2665
ILT
69342009-12-29 Ian Lance Taylor <iant@google.com>
6935
6936 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6937 using a version of gcc before 4.1.
6938 * configure: Rebuild.
6939
250acde3
CD
69402009-12-28 Chris Demetriou <cgd@google.com>
6941
6942 * attributes.cc (Output_attributes_section_data::do_write): Use
6943 std::vector::front rather than std::vector::data.
6944
99fff23b
ILT
69452009-12-28 Ian Lance Taylor <iant@google.com>
6946
6947 * symtab.h (class Symbol_table): Add enum Defined.
6948 * resolve.cc (Symbol_table::should_override): Add defined
6949 parameter. Change all callers. Test whether object is NULL
6950 before calling a method on it.
6951 (Symbol_table::report_resolve_problem): Add defined parameter.
6952 Change all callers.
6953 (Symbol_table::should_override_with_special): Likewise.
6954 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6955 parameter. Change all callers.
6956 (Symbol_table::do_define_in_output_data): Likewise.
6957 (Symbol_table::define_in_output_segment): Likewise.
6958 (Symbol_table::do_define_in_output_segment): Likewise.
6959 (Symbol_table::define_as_constant): Likewise.
6960 (Symbol_table::do_define_as_constant): Likewise.
6961 * script.h (class Symbol_assignment): Add is_defsym parameter to
6962 constructor; change all callers.
6963 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6964 parameter. Change all callers. Add is_defsym_ field.
6965 (class Parser_closure): Add parsing_defsym parameter to
6966 constructor; change all callers. Add parsing_defsym accessor
6967 function. Add parsing_defsym_ field.
6968
556bd683
ILT
69692009-12-28 Ian Lance Taylor <iant@google.com>
6970
6971 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 6972 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 6973
1782c879
ILT
69742009-12-23 Ian Lance Taylor <iant@google.com>
6975
6976 * i386.cc (Target_i386::do_calls_non_split): Recognize
6977 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
6978 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6979 -fsplit-stack prologue when using %r11.
1782c879 6980
329ca2b1
ST
69812009-12-21 Sriraman Tallam <tmsriram@google.com>
6982
6983 * options.cc (General_options::parse_version): Make -v continue and do
6984 the link like GNU ld does.
6985
d675ff46
RÁE
69862009-12-17 Rafael Avila de Espindola <espindola@google.com>
6987
6988 * Makefile.am (CCFILES): Add timer.cc.
6989 (HFILES): Add timer.h.
6990 * configure.ac: Check for sysconf and times.
6991 * main.cc: include timer.h.
6992 (main): Use Timer instead of get_run_time.
6993 * timer.cc: New.
6994 * timer.h: New.
6995 * workqueue.cc: include timer.h.
6996 (Workqueue::find_and_run_task):
6997 Report user, sys and wall time.
6998 * Makefile.in: Regenerate.
6999 * config.in: Regenerate.
7000 * configure: Regenerate.
7001
d6344fb5
DK
70022009-12-16 Doug Kwan <dougkwan@google.com>
7003
7004 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7005 sections.
7006 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7007 relaxed input sections.
7008 * output.cc (Output_section::find_relaxed_input_section): Change
7009 return type to Output_relaxed_input_section pointer. Adjust code
7010 for new type of relaxed_input_section_map_.
7011 * output.h (Output_section::find_relaxed_input_section): Change
7012 return type to Output_relaxed_input_section pointer.
7013 (Output_section::Output_relaxed_input_section_by_input_section_map):
7014 New type.
7015 (Output_section::relaxed_input_section_map_): Change type to
7016 Output_section::Output_relaxed_input_section_by_input_section_map.
7017 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7018 input section.
7019
0e0d5469
ILT
70202009-12-15 Ian Lance Taylor <iant@google.com>
7021
7022 * layout.cc (Layout::create_shstrtab): Only write out after input
7023 sections if we are compressing debug sections.
7024
0649a889
ILT
70252009-12-15 Ian Lance Taylor <iant@google.com>
7026
7027 * archive.cc (Archive::add_symbols): Only look up a symbol without
7028 a version if there is, in fact, a version.
7029
2ea97941
ILT
70302009-12-14 Ian Lance Taylor <iant@google.com>
7031
7032 Revert -Wshadow changes, all changes from:
7033 2009-12-11 Doug Kwan <dougkwan@google.com>
7034 2009-12-11 Nick Clifton <nickc@redhat.com>
7035 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7036
b0eec2cc
DK
70372009-12-11 Doug Kwan <dougkwan@google.com>
7038
7039 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7040 due to -Wshadow.
7041 * attributes.cc (Object_attribute::size): Ditto.
7042 (Attributes_section_data::size): Ditto.
7043 (Attributes_section_data::Attributes_section_data): Ditto.
7044 (Output_attributes_section_data::do_write): Ditto.
7045 * attributes.h (Object_attribute::set_type): Ditto.
7046 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7047
91d6fa6a
NC
70482009-12-11 Nick Clifton <nickc@redhat.com>
7049
7050 * archive.cc: Fix shadowed variable warnings.
7051 * arm.cc: Likewise.
7052 * compressed_output.cc: Likewise.
7053 * compressed_output.h: Likewise.
7054 * configure: Likewise.
7055 * dwarf_reader.cc: Likewise.
7056 * dynobj.cc: Likewise.
7057 * dynobj.h: Likewise.
7058 * ehframe.cc: Likewise.
7059 * ehframe.h: Likewise.
7060 * errors.cc: Likewise.
7061 * expression.cc: Likewise.
7062 * fileread.cc: Likewise.
7063 * fileread.h: Likewise.
7064 * freebsd.h: Likewise.
7065 * i386.cc: Likewise.
7066 * icf.cc: Likewise.
7067 * incremental.h: Likewise.
7068 * layout.cc: Likewise.
7069 * layout.h: Likewise.
7070 * mapfile.cc: Likewise.
7071 * merge.cc: Likewise.
7072 * merge.h: Likewise.
7073 * object.cc: Likewise.
7074 * object.h: Likewise.
7075 * options.h: Likewise.
7076 * output.cc: Likewise.
7077 * output.h: Likewise.
7078 * parameters.cc: Likewise.
7079 * plugin.cc: Likewise.
7080 * powerpc.cc: Likewise.
7081 * reduced_debug_output.cc: Likewise.
7082 * reduced_debug_output.h: Likewise.
7083 * reloc.cc: Likewise.
7084 * reloc.h: Likewise.
7085 * resolve.cc: Likewise.
7086 * script-sections.cc: Likewise.
7087 * script.cc: Likewise.
7088 * script.h: Likewise.
7089 * sparc.cc: Likewise.
7090 * symtab.cc: Likewise.
7091 * symtab.h: Likewise.
7092 * target-select.cc: Likewise.
7093 * target-select.h: Likewise.
7094 * token.h: Likewise.
7095 * workqueue.cc: Likewise.
7096 * workqueue.h: Likewise.
7097 * x86_64.cc: Likewise.
7098
a0351a69
DK
70992009-12-10 Doug Kwan <dougkwan@google.com>
7100
7101 * arm.cc (attributes.h): New include.
7102 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7103 (Arm_relobj::~Arm_relobj): Delete object pointed by
7104 attributes_section_data_.
7105 (Arm_relobj::attributes_section_data): New method definition.
7106 (Arm_relobj::attributes_section_data_): New data member declaration.
7107 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7108 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7109 attributes_section_data_.
7110 (Arm_dynobj::attributes_section_data): New method definition.
7111 (Arm_dynobj::attributes_section_data_): New data member declaration.
7112 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7113 initialization value of may_use_blx_ to false.
7114 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7115 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7116 object attributes to compute results instead of hard-coding.
7117 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7118 Target_arm::get_secondary_compatible_arch,
7119 Target_arm::set_secondary_compatible_arch
7120 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7121 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7122 New method declarations.
7123 (Target_arm::get_aeabi_object_attribute): New method definition.
7124 (Target_arm::attributes_section_data_): New data member declaration.
7125 (read_arm_attributes_section): New template definition.
7126 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7127 (Arm_dynobj::do_read_symbols): Ditto.
7128 (Target_arm::do_finalize_sections): Merge attributes sections from
7129 input. Check for BLX use after attributes section merging.
7130 Fix __exidx_start and __exidx_end visibility. Create an
7131 .ARM.attributes section if necessary.
7132 (Target_arm::get_secondary_compatible_arch,
7133 Target_arm::set_secondary_compatible_arch,
7134 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7135 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 7136 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
7137 New method definitions.
7138
b59befec
ILT
71392009-12-09 Ian Lance Taylor <iant@google.com>
7140
7141 * plugin.cc (Plugin::load): Don't cast from void* to a function
7142 pointer.
7143
1276bc89
ILT
71442009-12-09 Ian Lance Taylor <iant@google.com>
7145
7146 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7147 information fields.
7148
2f2de248
L
71492009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7150
7151 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7152 Replace two_file_shared_1.so with two_file_shared_2.so.
7153 * testsuite/Makefile.in: Regenerated.
7154
4f787271
DK
71552009-12-08 Doug Kwan <dougkwan@google.com>
7156
7157 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7158 (HFILES): Add attributes.h and int_encoding.h.
7159 * Makefile.in: Regenerate.
7160 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7161 function definitions to int_encoding.cc
7162 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7163 prototypes to int_encoding.h
7164 * reduced_debug_output.cc (int_encoding.h): New include.
7165 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7166 function definitions to int_encoding.cc
7167 (insert_into_vector, read_from_pointer): Move template definitions to
7168 int_encoding.h
7169 * attributes.cc: New file.
7170 * attributes.h: New file.
7171 * int_encoding.cc: New file.
7172 * int_encoding.h: New file.
7173
20b52f1a
RÁE
71742009-12-07 Rafael Avila de Espindola <espindola@google.com>
7175
7176 PR gold/11055
7177 * incremental-dump.cc (dump_incremental_inputs): New.
7178 (main): Use dump_incremental_inputs.
7179
53d7974c
L
71802009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7181
7182 PR gold/10893
7183 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7184 checking elfcpp::STT_FUNC.
7185 (Target_i386::Relocate::relocate): Likewise.
7186 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7187
7188 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7189 symbols from shared libraries into normal FUNC symbols.
7190
7191 * symtab.h (Symbol): Add is_func and use it.
7192
05a352e6
DK
71932009-12-05 Doug Kwan <dougkwan@google.com>
7194
7195 * arm.cc (Target_arm::arm_info): Initialize new fields
7196 attributes_section and attributes_vendor.
7197 * i386.cc (Target_i386::i386_info): Same.
7198 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7199 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7200 fields attributes_section and attributes_vendor.
53d7974c 7201 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
7202 * target.h (Target::attributes_section, Target::attributes_vendor,
7203 Target::is_attributes_section, Target::attribute_arg_type,
7204 Target::attributes_order): New method definitions.
7205 (Target::Target_info::attributes_section,
7206 Target::Target_info::attributes_vendor): New fields.
7207 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7208 virtual method definitions.
7209 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7210 attributes_section and attributes_vendor.
7211 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7212
f4e5969c
DK
72132009-12-05 Doug Kwan <dougkwan@google.com>
7214
7215 * arm.cc: Update comments about interworking and stub generation.
7216 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7217 considered as non-PIC.
7218 (Arm_relocate_functions::base_abs): Fix formatting.
7219 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7220 of function to use GOT entry address instead of offset.
7221 (Target_arm::Scan::global): Issue an error if a symbol would need a
7222 PLT does not get one because it is untyped. Remove code to create
7223 dynamic symbols for relative branches.
7224 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7225 takes unsigned integer instead of boolean.
7226
1abce4a6
L
72272009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7228
7229 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7230 (two_file_test_LDADD): Likewise.
7231 (common_test_1_LDADD): Likewise.
7232 (exception_test_LDADD) Likewise.
7233 (weak_test_LDADD): Likewise.
7234 (many_sections_test_LDADD): Likewise.
7235 (initpri1_LDADD): Likewise.
7236 (script_test_1_LDADD): Likewise.
7237 (script_test_2_LDADD): Likewise.
7238 (justsyms_LDADD): Likewise.
7239 (binary_test_LDADD): Likewise.
7240 (large_LDADD): Likewise.
7241 * testsuite/Makefile.in: Regenerated.
7242
adcf2816 72432009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 7244
adcf2816
L
7245 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7246 (Symbol_table::override_with_special): Likewise.
7247 (Symbol_table::add_from_object): Likewise.
7248
28e67f5d
RÁE
72492009-12-04 Rafael Avila de Espindola <espindola@google.com>
7250
7251 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7252 Don't set the data_offset twice.
7253
ae10a101
RÁE
72542009-12-04 Rafael Avila de Espindola <espindola@google.com>
7255
7256 * testsuite/Makefile.in: Regenerate.
7257
f59f41f3
DK
72582009-12-03 Doug Kwan <dougkwan@google.com>
7259
7260 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7261 (Target_arm::do_finalize_sections): Add parameter for symbol table
7262 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7263 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7264 parameter for symbol table pointer.
7265 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7266 an additional parameter for a pointer to symbol table.
7267 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7268 parameter for a symbol table pointer.
7269 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7270 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7271 Ditto.
7272 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7273 parameter for a symbol table pointer.
7274
ca55d848
RÁE
72752009-12-03 Rafael Avila de Espindola <espindola@google.com>
7276
7277 * incremental.cc (Incremental_inputs_header)
7278 (Incremental_inputs_header_write, Incremental_inputs_entry)
7279 (Incremental_inputs_entry_write): Move ...
7280 * incremental.h (Incremental_inputs_header)
7281 (Incremental_inputs_header_write, Incremental_inputs_entry)
7282 (Incremental_inputs_entry_write): here.
7283
3aec4f9c
RÁE
72842009-12-02 Rafael Avila de Espindola <espindola@google.com>
7285
7286 * incremental.cc (make_sized_incremental_binary): Set the target.
7287 Error if it is incompatible.
7288 * output.h (Output_file): Add filename method.
7289
9c0ae74d
RÁE
72902009-12-02 Rafael Avila de Espindola <espindola@google.com>
7291
7292 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7293 from the get_* methods.
7294
a45500ae
RÁE
72952009-12-02 Rafael Avila de Espindola <espindola@google.com>
7296
7297 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7298 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7299 Write 0 for the data_offset of scripts.
7300
325e6408
RÁE
73012009-12-02 Rafael Avila de Espindola <espindola@google.com>
7302
7303 * testsuite/Makefile.am: Add the incremental_test.sh test.
7304 * testsuite/incremental_test.sh: New.
7305 * testsuite/incremental_test_1.c: New.
7306 * testsuite/incremental_test_2.c: New.
7307
954c3e2e
RÁE
73082009-12-01 Rafael Avila de Espindola <espindola@google.com>
7309
7310 * incremental-dump.cc (main): Fix typos.
7311
f8086623
RÁE
73122009-11-27 Rafael Avila de Espindola <espindola@google.com>
7313
7314 PR gold/11025
7315 * incremental-dump.cc (main): Use llu to print 64 bit values.
7316
3b0dd6ac
L
73172009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7318 H.J. Lu <hongjiu.lu@intel.com>
7319
7320 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7321 $(LIBDL).
7322 (incremental_dump_LDADD): Likewise.
7323 * Makefile.in: Regenerated.
7324
a6d1ef57 73252009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 7326
a6d1ef57
DK
7327 Revert:
7328
7329 2009-11-25 Doug Kwan <dougkwan@google.com>
7330
7331 * arm.cc (Target_arm::Target_arm): Move method definition
7332 outside of class definition. Add code to handle
7333 --target1-rel, --target1-abs and --target2= options.
7334 (Target_arm::get_reloc_reloc_type): Change method to be
7335 non-static and const.
7336 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7337 New data member declaration.
7338 (Target_arm::Scan::local, Target_arm::Scan::global,
7339 Target_arm::Relocate::relocate,
7340 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7341 Adjust call to Target_arm::get_real_reloc_type.
7342 (Target_arm::get_real_reloc_type): Use command line options
7343 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7344 * options.h (--target1-rel, --target1-abs, --target2): New
7345 ARM-only options.
7346
50aeb7d4
DK
73472009-11-25 Doug Kwan <dougkwan@google.com>
7348
7349 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7350 class definition. Add code to handle --target1-rel, --target1-abs
7351 and --target2= options.
7352 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7353 and const.
7354 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7355 member declaration.
7356 (Target_arm::Scan::local, Target_arm::Scan::global,
7357 Target_arm::Relocate::relocate,
7358 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7359 call to Target_arm::get_real_reloc_type.
7360 (Target_arm::get_real_reloc_type): Use command line options to
7361 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7362 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7363 options.
7364
51938283
DK
73652009-11-25 Doug Kwan <dougkwan@google.com>
7366
7367 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7368 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7369 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7370 formatting.
7371 (Arm_relocate_functions::thm_call): Replace body with a call to
7372 Arm_relocate_functions::thumb_branch_common.
7373 (Arm_relocate_functions::thm_jump24,
7374 Arm_relocate_functions::thm_xpc22): New method definitions.
7375 (Arm_relocate_functions::thumb_branch_common): New method definition.
7376 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7377 operator.
7378 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7379 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7380
e2b8f3c4
RÁE
73812009-11-24 Rafael Avila de Espindola <espindola@google.com>
7382
7383 * Makefile.am: Build incremental-dump
7384 * Makefile.in: Regenerate.
7385 * incremental-dump.cc: New.
7386 * incremental.cc (Incremental_inputs_header_data,
7387 Incremental_inputs_entry_data): Move to incremental.h
7388 * incremental.h: (Incremental_inputs_header_data,
7389 Incremental_inputs_entry_data): Move from incremental.cc
7390
bcba9aec
RÁE
73912009-11-24 Rafael Avila de Espindola <espindola@google.com>
7392
7393 * incremental.cc (Incremental_inputs_header,
7394 Incremental_inputs_header_write, Incremental_inputs_entry,
7395 Incremental_inputs_entry_write): Add a typedef with the data type.
7396
7c3afe08
RÁE
73972009-11-24 Rafael Avila de Espindola <espindola@google.com>
7398
7399 * incremental.cc (Incremental_inputs_header,
7400 Incremental_inputs_header_write, Incremental_inputs_entry,
7401 Incremental_inputs_entry_write): Update comment about which
7402 type has the filed descriptions.
7403
d204b6e9
DK
74042009-11-15 Doug Kwan <dougkwan@google.com>
7405
7406 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7407 (Arm_relocate_functions::arm_branch_common): Change method defintion
7408 in class definition to a method declaration and update list of formal
7409 parameters.
7410 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7411 Arm_relocation_functions::jump24): Adjust call to
7412 Arm_relocate_functions::arm_branch_common. Update list of formal
7413 parameters.
7414 (Arm_relocate_functions::xpc25): New method definition.
7415 (Arm_relocate_functions::arm_branch_common): Move method defintion
7416 out from class definition. Use stubs for mode-switching and extending
7417 branch ranges.
7418 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7419 specially. Change code to enable use of stubs in ARM branches.
7420
43d12afe
DK
74212009-11-10 Doug Kwan <dougkwan@google.com>
7422
7423 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7424 in method declaration.
7425 (Target_arm::relocate_stub): New method declaration.
7426 (Target_arm::default_target): Change to return a pointer instead of
7427 a const reference.
7428 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7429 Target_arm::default_target.
7430 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7431 method definition.
7432 (Target_arm::relocate_section): Adjust view.
7433 (Target_arm::relocate_stub): New method definition.
7434
ac33a407
DK
74352009-11-10 Doug Kwan <dougkwan@google.com>
7436
7437 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7438 a format warning.
7439 * incremental.cc (open_incremental_binary): Initialized local
7440 variables to avoid warnings.
7441 * object.cc (make_elf_object): Ditto.
7442 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7443 a format warning.
e1df38aa 7444
88ee28e9
L
7445009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7446
7447 PR gold/10930
7448 * testsuite/plugin_test.c: Include "config.h".
7449
2daedcd6
DK
74502009-11-09 Doug Kwan <dougkwan@google.com>
7451
7452 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7453 (arm_symbol_value): Remove.
7454 (Arm_relocate_functions::arm_branch_common,
7455 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7456 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7457 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7458 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7459 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7460 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7461 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7462 Arm_relocate_functions::thm_mobw_abs_nc,
7463 Arm_relocate_functions::thm_mov_abs,
7464 Arm_relocate_functions::movw_prel_nc,
7465 Arm_relocate_functions::thm_movt_abs,
7466 Arm_relocate_functions::movt_prel,
7467 Arm_relocate_functions::thm_movw_prel_nc,
7468 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7469 (Target_arm::Relocate::relocate): Only decompose address into two
7470 parts if relocation type uses the thumb-bit and pass the actual
7471 bit instead of a flag indicating that the thumb-bit is used. Adjust
7472 calls to methods in Arm_relocate_functions for this change.
7473
1276bc89 74742009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
7475
7476 PR 10925
7477 * reloc.cc: Instantiate
7478 Sized_relobj::initialize_input_to_output_maps and
7479 Sized_relobj:free_input_to_output_maps.
7480
e53ad1b5
ILT
74812009-11-06 Ian Lance Taylor <iant@google.com>
7482
7483 PR 10876
7484 * defstd.cc (in_segment): Set only_if_ref true for "end".
7485
eb44217c
DK
74862009-11-06 Doug Kwan <dougkwan@google.com>
7487
7488 * arm.cc (class Reloc_stub): Correct a comment.
7489 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7490 (Target_arm::scan_section_for_stubs): New method declaration.
7491 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7492 Change methods from private to protected.
7493 (Target_arm::do_may_relax): New method definition.
7494 (Target_arm::do_relax, Target_arm::group_sections,
7495 Target_arm::scan_reloc_for_stub,
7496 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7497 (Target_arm::arm_input_section_map_): New data member declaration.
7498 (Target_arm::scan_reloc_for_stub,
7499 Target_arm::scan_reloc_section_for_stubs,
7500 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7501 Target_arm::do_relax): New method definitions.
7502
5d329b7d
ILT
75032009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7504
7505 * configure.ac: Check for (struct stat)::st_mtim
7506 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7507 * config.in: Regenerate.
7508 * configure: Regenerate.
7509
96a0d71b
ILT
75102009-11-05 Ian Lance Taylor <iant@google.com>
7511
7512 PR 10910
7513 * output.cc (Output_segment::add_output_section): Add missing
7514 return statement.
7515
594c8e5e
ILT
75162009-11-04 Ian Lance Taylor <iant@google.com>
7517
7518 PR 10880
7519 * object.h (class Object): Add is_needed and set_is_needed
7520 methods. Add is_needed_ field. Make bool fields into bitfields.
7521 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7522 defined in a dynamic object and referenced by a regular object,
7523 set is_needed for the dynamic object.
7524 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7525 if the file is marked with as_needed and it is not needed.
7526
22b127cc
ILT
75272009-11-04 Ian Lance Taylor <iant@google.com>
7528
7529 PR 10887
7530 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7531 tags if data is discarded by linker script.
7532 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7533 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7534 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7535 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7536
f5c870d2
ILT
75372009-11-04 Ian Lance Taylor <iant@google.com>
7538
7539 * layout.cc (Layout::get_output_section): Add is_interp and
7540 is_dynamic_linker_section parameters. Change all callers.
7541 (Layout::choose_output_section): Likewise.
7542 (Layout::make_output_section): Likewise.
7543 (Layout::add_output_section_data): Add is_dynamic_linker_section
7544 parameter. Change all callers.
7545 * layout.h (class Layout): Update declarations.
7546 * output.h (class Output_section): Add is_interp, set_is_interp,
7547 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7548 Add is_interp_, is_dynamic_linker_section_ fields. Change
7549 generate_code_fills_at_write_ to a bitfield.
7550 * output.cc (Output_section::Output_sections): Initialize new
7551 fields.
7552 (Output_segment::add_output_section): Add do_sort parameter.
7553 Change all callers.
7554
1ae4d23b
ILT
75552009-11-03 Ian Lance Taylor <iant@google.com>
7556
7557 PR 10860
7558 * options.h (class General_options): Add --warn-common.
7559 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7560 merging two common symbols.
7561 (Symbol_table::should_override): Handle --warn-common when merging
7562 a common symbol with a defined symbol. Use report_resolve_problem
7563 for multiple definitions.
7564 (Symbol_table::report_resolve_problem): New function.
7565 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7566
55da9579
DK
75672009-11-03 Doug Kwan <dougkwan@google.com>
7568
7569 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7570 stub_factory_.
7571 (Target_arm::stub_factory): New method definition.
7572 (Target_arm::new_arm_input_section,
7573 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7574 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 7575 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
7576 New type definitions.
7577 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7578 member declarations.
7579 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7580 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7581 New method definitions.
7582
37a9ac43
ILT
75832009-11-03 Ian Lance Taylor <iant@google.com>
7584
7585 * options.h (class General_options): Add --warn_constructors.
7586
b3d6a3d4
ILT
75872009-11-03 Ian Lance Taylor <iant@google.com>
7588
7589 PR 10893
7590 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7591 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7592
934b01dd
ILT
75932009-11-03 Ian Lance Taylor <iant@google.com>
7594
7595 PR 10895
7596 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7597 --msgid-bugs-address.
7598 (install-pdf): New target.
7599 (install-data_yes): Look up one directory to find mkinstalldirs.
7600
03c1939b
L
76012009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7602
7603 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7604 tree.
7605
ebd95253
DK
76062009-10-30 Doug Kwan <dougkwan@google.com>
7607
7608 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7609
e9bbb538
DK
76102009-10-30 Doug Kwan <dougkwan@google.com>
7611
7612 * arm.cc (Stub_addend_reader): New struct template definition
7613 and partial specializations.
7614 (Stub_addend_reader::operator()): New method definition for a
7615 partially specialized template.
7616
d5b40221
DK
76172009-10-30 Doug Kwan <dougkwan@google.com>
7618
7619 * arm.cc (Arm_relobj::processor_specific_flags): New method
7620 definition.
7621 (Arm_relobj::do_read_symbols): New method declaration.
7622 (Arm_relobj::processor_specific_flags_): New data member declaration.
7623 (Arm_dynobj): New class definition.
7624 (Target_arm::do_finalize_sections): Add input_objects parameter.
7625 (Target_arm::do_adjust_elf_header): New method declaration.
7626 (Target_arm::are_eabi_versions_compatible,
7627 (Target_arm::merge_processor_specific_flags): New method declaration.
7628 (Target_arm::do_make_elf_object): New overloaded method definitions
7629 and declaration.
7630 (Arm_relobj::do_read_symbols): New method definition.
7631 (Arm_dynobj::do_read_symbols): Ditto.
7632 (Target_arm::do_finalize_sections): Add input_objects parameters.
7633 Merge processor-specific flags from all input objects.
7634 (Target_arm::are_eabi_versions_compatible,
7635 Target_arm::merge_processor_specific_flags,
7636 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7637 New method definitions.
7638 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7639 Input_objects pointer type parameter.
7640 * layout.cc (Layout::finalize): Pass input objects to target's.
7641 finalize_sections function.
7642 * output.cc (Output_file_header::do_sized_write): Set ELF file
7643 header's processor-specific flags.
7644 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7645 Input_objects pointer type parameter.
7646 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7647 * target.h (Input_objects): New forward class declaration.
7648 (Target::processor_specific_flags,
7649 Target::are_processor_specific_flags_sect): New method definitions.
7650 (Target::finalize_sections): Add input_objects parameter.
7651 (Target::Target): Initialize processor_specific_flags_ and
7652 are_processor_specific_flags_set_.
7653 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7654 parameter.
7655 (Target::set_processor_specific_flags): New method definition.
7656 (Target::processor_specific_flags_,
7657 Target::are_processor_specific_flags_set_): New data member
7658 declarations.
7659 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7660 Input_objects pointer type parameter.
7661
ebabffbd
DK
76622009-10-30 Doug Kwan <dougkwan@google.com>
7663
7664 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7665
ad0f2072
ILT
76662009-10-28 Ian Lance Taylor <iant@google.com>
7667
7668 * object.h (class Relobj): Drop options parameter from
7669 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7670 do_scan_relocs, do_relocate. Change all callers.
7671 (class Sized_relobj): Drop options parameters from
7672 do_gc_process_relocs, do_scan_relocs, do_relocate,
7673 do_relocate_sections, relocate_sections, emit_relocs_scan,
7674 emit_relocs_scan_reltype. Change all callers.
7675 (struct Relocate_info): Remove options field and all references to
7676 it.
7677 * reloc.h (class Read_relocs): Remove options constructor
7678 parameter and options_ field. Change all callers.
7679 (class Gc_process_relocs, class Scan_relocs): Likewise.
7680 (class Relocate_task): Likewise.
7681 * target-reloc.h (scan_relocs): Remove options parameter. Change
7682 all callers.
7683 (scan_relocatable_relocs): Likewise.
7684 * target.h (class Sized_target): Remove options parameter from
7685 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7686 all callers.
7687 * gc.h (gc_process_relocs): Remove options parameter. Change all
7688 callers.
7689 * arm.cc: Update functions to remove options parameters.
7690 * i386.cc: Likewise.
7691 * powerpc.cc: Likewise.
7692 * sparc.cc: Likewise.
7693 * x86_64.cc: Likewise.
7694 * testsuite/testfile.cc: Likewise.
7695
8ffa3667
DK
76962009-10-28 Doug Kwan <dougkwan@google.com>
7697
7698 * arm.cc (Arm_relobj): New class definition.
e1df38aa 7699 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
7700 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7701 New method definitions.
7702
40f36857
CC
77032009-10-28 Cary Coutant <ccoutant@google.com>
7704
7705 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7706 (Plugin::cleanup_done_): New member.
7707 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7708 (Plugin_manager::cleanup_done_): Remove.
7709 (Plugin_manager::add_input_file): Edit error message.
7710 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7711 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7712
2c849493
ILT
77132009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7714
7715 * fileread.cc: (File_read::View::~View): Use the new
7716 data_ownership_ filed.
7717 (File_read::~File_read): Dispose the new whole_file_view_.
7718 (File_read::open): Mmap the whole file if needed.
7719 (File_read::open): Use whole_file_view_ instead of contents_.
7720 (File_read::find_view): Use whole_file_view_ if applicable.
7721 (File_read::do_read): Use whole_file_view_ instead of contents_.
7722 (File_read::make_view): Use whole_file_view_ instead of contents_,
7723 update File_read::View::View call.
7724 (File_read::find_or_make_view): Update File_read::View::View
7725 call.
7726 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7727 remove contents_
7728 (File_read::View::Data_ownership): New enum.
7729 (File_read::View::View): Replace bool mapped_ with Data_ownership
7730 argument.
7731 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7732 (File_read::View::data_ownership_): New field.
7733 (File_read::contents_): Remove (replaced by whole_file_view_).
7734 (File_read::whole_file_view_): New field.
7735 * options.h (class General_options): Add --keep-files-mapped.
7736
24998053
CC
77372009-10-27 Cary Coutant <ccoutant@google.com>
7738
7739 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7740 * testsuite/Makefile.am (plugin_test_5): New test case.
7741 * testsuite/Makefile.in: Regenerate.
7742
72adc4fa
DK
77432009-10-25 Doug Kwan <dougkwan@google.com>
7744
7745 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7746 from private to protected to allow access by child class.
7747 (Sized_relobj::do_relocate_sections): New method declaration.
7748 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 7749 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
7750 Sized_relobj::relocate_sections. Instantiate template explicitly
7751 for different target sizes and endianity.
7752
07f508a2
DK
77532009-10-24 Doug Kwan <dougkwan@google.com>
7754
7755 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7756 (Arm_input_section::as_arm_input_section): New method.
7757 (Arm_output_section): New class definition.
7758 (Arm_output_section::create_stub_group,
7759 Arm_output_section::group_sections): New method definitions.
7760
10ad9fe5
DK
77612009-10-22 Doug Kwan <dougkwan@google.com>
7762
7763 * arm.cc (Arm_input_section): New class definition.
7764 (Arm_input_section::init, Arm_input_section:do_write,
7765 Arm_input_section::set_final_data_size,
7766 Arm_input_section::do_reset_address_and_file_offset): New method
7767 definitions.
7768
56ee5e00
DK
77692009-10-21 Doug Kwan <dougkwan@google.com>
7770
7771 * arm.cc (Stub_table, Arm_input_section): New forward class
7772 declarations.
7773 (Stub_table): New class defintion.
7774 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7775 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7776 New method definition.
7777
b569affa
DK
77782009-10-21 Doug Kwan <dougkwan@google.com>
7779
7780 * arm.cc: Update copyright comments.
7781 (Target_arm): New forward class template declaration.
7782 (Arm_address): New type.
7783 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7784 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7785 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7786 constants.
7787 (Insn_template): Same.
7788 (DEF_STUBS): New macro.
7789 (Stub_type): New enum type.
7790 (Stub_template): New class definition.
7791 (Stub): Same.
7792 (Reloc_stub): Same.
7793 (Stub_factory): Same.
7794 (Target_arm::Target_arm): Initialize may_use_blx_ and
7795 should_force_pic_veneer_.
7796 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7797 Target_arm::should_force_pic_veneer,
7798 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7799 Target_arm::using_thumb_only, Target_arm:;default_target): New
7800 method defintions.
7801 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7802 New data member declarations.
7803 (Insn_template::size, Insn_template::alignment): New method defintions.
7804 (Stub_template::Stub_template): New method definition.
7805 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7806 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7807 (Stub_factory::Stub_factory): New method definition.
7808 * gold.h (string_hash): New template.
7809 * output.h (Input_section_specifier::hash_value): Use
7810 gold::string_hash.
7811 (Input_section_specifier::string_hash): Remove.
7812 * stringpool.cc (Stringpool_template::string_hash): Use
7813 gold::string_hash.
7814
6c172549
DK
78152009-10-20 Doug Kwan <dougkwan@google.com>
7816
7817 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7818 symbols of relaxed input sections.
7819 * output.h (Output_section::find_relaxed_input_section): Make
7820 method public.
7821
c5617f2f
DK
78222009-10-16 Doug Kwan <dougkwan@google.com>
7823
7824 * dynobj.cc (Versions::Versions): Initialize version_script_.
7825 Only insert base version symbol definition for a shared object
7826 if version script defines any version versions.
7827 (Versions::define_base_version): New method definition.
7828 (Versions::add_def): Check that base version is not needed.
7829 (Versions::add_need): Define base version lazily.
7830 * dynobj.h (Versions::define_base_version): New method declaration.
7831 (Versions::needs_base_version_): New data member declaration.
7832 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7833 (check_DATA): Add no_version_test.stdout.
7834 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7835 New make rules.
7836 * testsuite/Makefile.in: Regenerate.
7837 * testsuite/no_version_test.c: New file.
7838 * testsuite/no_version_test.sh: Ditto.
7839
3c12dcdb
DK
78402009-10-16 Doug Kwan <dougkwan@google.com>
7841
7842 * expression.cc (class Segment_start_expression): New class definition.
7843 (Segment_start_expression::value): New method definition.
7844 (script_exp_function_segment_start): Return a new
7845 Segment_start_expression.
7846 * gold/script-c.h (script_saw_segment_start_expression): New function
7847 prototype.
7848 * script-sections.cc (Script_sections::Script_sections): Initialize
7849 SAW_SEGMENT_START_EXPRESSION_ to false.
7850 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7851 and -Tbbs options to specify section addresses if given in
7852 command line and no SEGMENT_START expression is seen in a script.
7853 * script-sections.h (Script_sections::saw_segment_start_expression,
7854 Script_sections::set_saw_segment_start_expression): New method
7855 definition.
7856 (Script_sections::saw_segment_start_expression_): New data member
7857 declaration.
7858 * script.cc (script_saw_segment_start_expression): New function.
7859 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7860 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7861 script_test_7.sh and script_test_8.sh.
7862 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7863 script_test_8.stdout.
7864 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7865 (script_test_6, script_test_6.stdout, script_test_7,
7866 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7867 * Makefile.in: Regenerate.
7868 * testsuite/script_test_6.sh: New file.
7869 * testsuite/script_test_6.t: Same.
7870 * testsuite/script_test_7.sh: Same.
7871 * testsuite/script_test_7.t: Same.
7872 * testsuite/script_test_8.sh: Same.
7873
64b1ae37
DK
78742009-10-16 Doug Kwan <dougkwan@google.com>
7875
7876 * output.cc (Output_segment::set_section_list_address): Cast
7877 expressions to unsigned long long type to avoid format warnings.
7878
661be1e2
ILT
78792009-10-15 Ian Lance Taylor <iant@google.com>
7880
12edd763 7881 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 7882 dot assignment to script_sections_.
12edd763
ILT
7883 * script-sections.cc (Script_sections::add_dot_assignment):
7884 Initialize if necessary.
7885
68b6574b
ILT
7886 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7887 program headers with no load segment if there is a linker script.
7888
661be1e2
ILT
7889 * layout.cc (Layout::set_segment_offsets): Align the file offset
7890 to the segment aligment for -N or -n with no load segment.
7891 * output.cc (Output_segment::add_output_section): Don't crash if
7892 the first section is a TLS section.
7893 (Output_segment::set_section_list_addresses): Print an error
7894 message if the address moves backward in a linker script.
7895 * script-sections.cc
7896 (Output_section_element_input::set_section_addresses): Don't
7897 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7898 (Orphan_output_section::set_section_addresses): Likewise.
7899
f15f61a7
DK
79002009-10-15 Doug Kwan <dougkwan@google.com>
7901
7902 * layout.cc (Layout::finish_dynamic_section): Generate tags
7903 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7904 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7905 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7906
82bb573a
ILT
79072009-10-14 Ian Lance Taylor <iant@google.com>
7908
7909 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7910 fields.
7911 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7912 data_shdr fields of relinfo.
7913 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7914 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7915 R_386_TLS_LDO_32, adjust based on section flags.
7916 (Target_i386::Relocate::fix_up_ldo): Remove.
7917
374ad285
ILT
79182009-10-13 Ian Lance Taylor <iant@google.com>
7919
7920 Add support for -pie.
7921 * options.h (class General_options): Add -pie and
7922 --pic-executable.
7923 (General_options::output_is_position_independent): Test -pie.
7924 (General_options::output_is_executable): Return true if not shared
7925 and not relocatable.
7926 (General_options::output_is_pie): Remove.
7927 * options.cc (General_options::finalize): Reject incompatible uses
7928 of -pie.
7929 * gold.cc (queue_middle_tasks): A -pie link is not static.
7930 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7931 * symtab.cc (Symbol::final_value_is_known): Return false if
7932 output_is_position_independent.
7933 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7934 output_is_position_independent.
7935 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7936 output_is_position_independent.
7937 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7938 output_is_position_independent.
7939 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7940 two_file_pie_test.
7941 (basic_pie_test.o, basic_pie_test): New targets.
7942 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7943 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7944 (two_file_pie_test): New target.
7945 * testsuite/Makefile.in: Rebuild.
7946 * README: Remove note saying that -pie is not supported.
7947
c6585162
ILT
79482009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7949
7950 * options.h (class General_options): Add -init and -fini.
7951 * layout.cc (Layout::finish_dynamic_section): Emit
7952 given init and fini functions.
7953
032ce4e9
ST
79542009-10-13 Sriraman Tallam <tmsriram@google.com>
7955
7956 * gc.h (gc_process_relocs): Check if icf is enabled using new
7957 function.
7958 * gold.cc (queue_initial_tasks): Likewise.
7959 (queue_middle_tasks): Likewise.
7960 * object.cc (do_layout): Likewise.
7961 * symtab.cc (is_section_folded): Likewise.
7962 * main.cc (main): Likewise.
7963 * reloc.cc (Read_relocs::run): Likewise.
7964 (Sized_relobj::do_scan_relocs): Likewise.
7965 * icf.cc (is_function_ctor_or_dtor): New function.
7966 (Icf::find_identical_sections): Check if function is ctor or dtor when
7967 safe icf is chosen.
7968 * options.h (General_options::icf): Change option to be an enum.
7969 (Icf_status): New enum.
7970 (icf_enabled): New method.
7971 (icf_safe_folding): New method.
7972 (set_icf_status): New method.
7973 (icf_status_): New variable.
7974 * (options.cc) (General_options::finalize): Set icf_status_.
7975 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7976 icf_test and icf_keep_unique_test to use the --icf enum flag.
7977 * testsuite/icf_safe_test.sh: New file.
e1df38aa 7978 * testsuite/icf_safe_test.cc: New file.
032ce4e9 7979
f345227a
ST
79802009-10-12 Sriraman Tallam <tmsriram@google.com>
7981
7982 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7983 includes to gc.h and icf.h.
7984 * arm.cc: Include gc.h.
7985 * gold.cc: Likewise.
7986 * i386.cc: Likewise.
7987 * powerpc.cc: Likewise.
7988 * sparc.cc: Likewise.
7989 * x86_64.cc: Likewise.
7990 * gc.h: Include icf.h.
7991
1c7814ed
ILT
79922009-10-11 Ian Lance Taylor <iant@google.com>
7993
7994 * plugin.cc: Include "gold.h" before other header files.
7995
ae3b5189
CD
79962009-10-10 Chris Demetriou <cgd@google.com>
7997
7998 * options.h (Input_file_argument::Input_file_type): New enum.
7999 (Input_file_argument::is_lib_): Replace with...
8000 (Input_file_argument::type_): New member.
8001 (Input_file_argument::Input_file_argument): Take Input_file_type
8002 'type' rather than boolean 'is_lib' as second argument.
8003 (Input_file_argument::is_lib): Use type_.
8004 (Input_file_argument::is_searched_file): New function.
8005 (Input_file_argument::may_need_search): Handle is_searched_file.
8006 * options.cc (General_options::parse_library): Support -l:filename.
8007 (General_options::parse_just_symbols): Update for Input_file_argument
8008 changes.
8009 (Command_line::process): Likewise.
8010 * archive.cc (Archive::get_file_and_offset): Likewise.
8011 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8012 * script.cc (read_script_file, script_add_file): Likewise.
8013 * fileread.cc (Input_file::Input_file): Likewise.
8014 (Input_file::will_search_for): Handle is_searched_file.
8015 (Input_file::open): Likewise.
8016 * readsyms.cc (Read_symbols::get_name): Likewise.
8017 * testsuite/Makefile.am (searched_file_test): New test.
8018 * testsuite/Makefile.in: Regenerate.
8019 * testsuite/searched_file_test.cc: New file.
8020 * testsuite/searched_file_test_lib.cc: New file.
8021
f3048a1d
ILT
80222009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8023 Ian Lance Taylor <iant@google.com>
8024
8025 * descriptor.cc: Include <cstdio> and "binary-io.h".
8026 (Descriptors::open): Open the files in binary mode always.
8027 * script.cc (Lex::get_token): Treat \r as whitespace.
8028
d4780e57
ILT
80292009-10-09 Ian Lance Taylor <iant@google.com>
8030
8031 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8032
d9a893b8
ILT
80332009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8034 Ian Lance Taylor <iant@google.com>
8035
8036 * configure.ac: Check for readv function also.
8037 * fileread.cc (readv): Define if not HAVE_READV.
8038 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8039 does not exist.
8040 * config.in: Regenerate.
8041 * configure: Regenerate.
8042
c0a62865
DK
80432009-10-09 Doug Kwan <dougkwan@google.com>
8044
8045 * layout.cc (Layout::make_output_section): Call target hook to make
8046 ordinary output section.
8047 (Layout::finalize): Adjust parameter list of call the
8048 Target::may_relax().
8049 * layout.h (class Layout::section_list): New method.
8050 * merge.h (Output_merge_base::entsize): Change visibility to public.
8051 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8052 New methods.
8053 (Output_merge_string::do_is_string): New method.
8054 * object.cc (Sized_relobj::do_setup): renamed from
8055 Sized_relobj::set_up.
8056 * object.h (Sized_relobj::adjust_shndx,
8057 Sized_relobj::initializ_input_to_output_maps,
8058 Sized_relobj::free_input_to_output_maps): Change visibilities to
8059 protected.
8060 (Sized_relobj::setup): Virtualize.
8061 (Sized_relobj::do_setup): New method declaration.
8062 (Sized_relobj::invalidate_section_offset,
8063 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8064 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8065 * options.cc (parse_int): New function.
8066 * options.h (parse_int): New declaration.
8067 (DEFINE_int): New macro.
8068 (stub_group_size): New option.
8069 * output.cc (Output_section::Output_section): Initialize memebers
8070 merge_section_map_, merge_section_by_properties_map_,
8071 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8072 (Output_section::add_input_section): Handled deferred code-fill
8073 generation and remove an old comment.
8074 (Output_section::add_relaxed_input_section): New method definition.
8075 (Output_section::add_merge_input_section): Use merge section by
8076 properties map to speed to search. Update merge section maps
8077 as appropriate.
8078 (Output_section::build_relaxation_map): New method definition.
8079 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8080 Same.
8081 (Output_section::relax_input_section): Renamed to
8082 Output_section::convert_input_sections_to_relaxed_sections and change
8083 interface to take a vector of pointers to relaxed sections.
8084 (Output_section::find_merge_section,
8085 Output_section::find_relaxed_input_section): New method definitions.
8086 (Output_section::is_input_address_mapped,
8087 Output_section::output_offset, Output_section::output_address):
8088 Use output section data maps to speed up searching.
8089 (Output_section::find_starting_output_address): Add comments.
8090 (Output_section::do_write,
8091 Output_section::write_to_postprocessing_buffer): Do code-fill
8092 generation as appropriate.
8093 (Output_section::get_input_sections): Invalidate relaxed input section
8094 map.
8095 (Output_section::restore_states): Adjust type of checkpoint .
8096 Invalidate relaxed input section map.
8097 * output.h (Output_merge_base): New class declaration.
8098 (Input_section_specifier): New class defintion.
8099 (class Output_relaxed_input_section) Change base class to
8100 Output_section_data_build.
8101 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8102 base class initializer.
8103 (Output_section::add_relaxed_input_section): New method declaration.
8104 (Output_section::Input_section): Change visibility to protected.
8105 (Output_section::Input_section::relobj,
8106 Output_section::Input_section::shndx): Handle relaxed input sections.
8107 Output_section::input_sections) Change visibility to protected. Also
8108 define overload to return a non-const pointer.
8109 (Output_section::Merge_section_properties): New class defintion.
8110 (Output_section::Merge_section_by_properties_map,
8111 Output_section::Output_section_data_by_input_section_map,
8112 Output_section::Relaxation_map): New types.
8113 (Output_section::relax_input_section): Rename method to
8114 Output_section::convert_input_sections_to_relaxed_sections and change
8115 interface to take a vector of relaxed section pointers.
8116 (Output_section::find_merge_section,
8117 Output_section::find_relaxed_input_section,
8118 Output_section::build_relaxation_map,
8119 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8120 New method declarations.
8121 (Output_section::merge_section_map_
8122 Output_section::merge_section_by_properties_map_,
8123 Output_section::relaxed_input_section_map_,
8124 Output_section::is_relaxed_input_section_map_valid_,
8125 Output_section::generate_code_fills_at_write_): New data members.
8126 * script-sections.cc
8127 (Output_section_element_input::set_section_addresses): Call
8128 current_data_size and addralign methods of relaxed input sections.
8129 (Orphan_output_section::set_section_addresses): Call current_data_size
8130 and addralign methods of relaxed input sections.
8131 * symtab.cc (Symbol_table::compute_final_value): Extract template
8132 from the body of Symbol_table::sized_finalize_symbol.
8133 (Symbol_table::sized_finalized_symbol): Call
8134 Symbol_table::compute_final_value.
8135 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8136 (Symbol_table::compute_final_value): New templated method declaration.
8137 * target.cc (Target::do_make_output_section): New method defintion.
8138 * target.h (Target::make_output_section): New method declaration.
8139 (Target::relax): Add more parameters for input objects, symbol table
8140 and layout. Adjust call to do_relax.
8141 (Target::do_make_output_section): New method declaration.
8142 (Target::do_relax): Add parameters for input objects, symbol table
8143 and layout.
8144
d446d6c4
ILT
81452009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8146
8147 * pread.c: Include stdio.h.
8148
bc06c745
ILT
81492009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8150
8151 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8152 defined.
8153
75aea3d0
ILT
81542009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8155
8156 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8157 Change read_shndx type to unsigned int.
8158 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8159 int.
8160 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8161 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8162 Change read_shndx type to unsigned int.
8163 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8164 int.
8165 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8166 * layout.cc (Layout::create_symtab_sections): Cast the result of
8167 local_symcount * symsize to off_t in the gold_assert.
8168
be8fcb75
ILT
81692009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8170
8171 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8172 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8173 R_ARM_BASE_ABS.
8174 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8175 (Arm_relocate_functions::thm_abs5): New function.
8176 (Arm_relocate_functions::abs12): New function.
8177 (Arm_relocate_functions::abs16): New function.
8178 (Arm_relocate_functions::base_abs): New function.
8179 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8180 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8181 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8182 R_ARM_BASE_ABS.
8183 (Scan::global): Likewise.
8184 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8185 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8186 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8187 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8188 R_ARM_BASE_ABS.
8189
c2a122b6
ILT
81902009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8191
8192 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8193 (Arm_relocate_functions::movt_prel): New function.
8194 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8195 (Arm_relocate_functions::thm_movt_prel): New function.
8196 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8197 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8198 (Scan::global, Relocate::relocate): Likewise.
8199 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8200
c4aa1e2d
ILT
82012009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8202
8203 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8204 Incremental_checker.
8205 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8206 unsigned int.
8207 (class Incremental_inputs_header): New class.
8208 (Incremental_inputs_header_writer): Edit comment.
8209 (Incremental_inputs_entry): New class.
8210 (Incremental_inputs_entry_writer): Edit comment.
8211 (Sized_incremental_binary::do_find_incremental_inputs_section):
8212 Add *strtab_shndx parameter, fill it.
8213 (Sized_incremental_binary::do_check_inputs): New method.
8214 (Incremental_checker::can_incrementally_link_output_file): Use
8215 Sized_incremental_binary::check_inputs.
8216 (Incremental_inputs::report_command_line): Save command line in
8217 command_line_.
8218 * incremental.h:
8219 (Incremental_binary::find_incremental_inputs_section): New
8220 method.
8221 (Incremental_binary::do_find_incremental_inputs_section): Add
8222 strtab_shndx parameter.
8223 (Incremental_binary::do_check_inputs): New pure virtual method.
8224 (Sized_incremental_binary::do_check_inputs): Declare.
8225 (Incremental_checker::Incremental_checker): Add incremental_inputs
8226 parameter, use it to initialize incremental_inputs_.
8227 (Incremental_checker::incremental_inputs_): New field.
8228 (Incremental_checker::command_line): New method.
8229 (Incremental_checker::inputs): New method.
8230 (Incremental_checker::command_line_): New field.
8231
c549a694
ILT
82322009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8233
8234 * incremental.cc: Include <cstdarg> and "target-select.h".
8235 (vexplain_no_incremental): New function.
8236 (explain_no_incremental): New function.
8237 (Incremental_binary::error): New method.
8238 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8239 method.
8240 (make_sized_incremental_binary): New function.
8241 (open_incremental_binary): New function.
8242 (can_incrementally_link_file): Add checks if output is ELF and has
8243 inputs section.
8244 * incremental.h: Include "elfcpp_file.h" and "output.h".
8245 (Incremental_binary): New class.
8246 (Sized_incremental_binary): New class.
8247 (open_incremental_binary): Declare.
8248 * object.cc (is_elf_object): Use
8249 elfcpp::Elf_recognizer::is_elf_file.
8250 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8251 * output.h (Output_file::filesize): New method.
8252
fd3c5f0b
ILT
82532009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8254
8255 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8256 New function.
8257 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8258 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8259 function.
8260 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8261 function.
8262 (Arm_relocate_functions::movw_abs_nc): New function.
8263 (Arm_relocate_functions::movt_abs): New function.
8264 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8265 (Arm_relocate_functions::thm_movt_abs): New function.
8266 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8267 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8268 (Scan::global): Likewise.
8269 (Relocate::relocate): Likewise.
8270 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8271
7f5309a5
ILT
82722009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8273
8274 * arm.cc (Arm_relocate_functions::got_prel) New function.
8275 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8276 (Relocate::relocate): Likewise.
8277 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8278
364c7fa5
ILT
82792009-10-06 Ian Lance Taylor <iant@google.com>
8280
8281 * options.h (class General_options): Define
8282 split_stack_adjust_size parameter.
8283 * object.h (class Object): Add uses_split_stack_ and
8284 has_no_split_stack_ fields. Add uses_split_stack and
8285 has_no_split_stack accessor functions. Declare
8286 handle_split_stack_section.
8287 (class Reloc_symbol_changes): Define.
8288 (class Sized_relobj): Define Function_offsets. Declare
8289 split_stack_adjust, split_stack_adjust_reltype, and
8290 find_functions.
8291 * object.cc (Object::handle_split_stack_section): New function.
8292 (Sized_relobj::do_layout): Call handle_split_stack_section.
8293 * dynobj.cc (Sized_dynobj::do_layout): Call
8294 handle_split_stack_section.
8295 * reloc.cc (Sized_relobj::relocate_sections): Call
8296 split_stack_adjust for executable sections in split_stack
8297 objects. Pass reloc_map to relocate_section.
8298 (Sized_relobj::split_stack_adjust): New function.
8299 (Sized_relobj::split_stack_adjust_reltype): New function.
8300 (Sized_relobj::find_functions): New function.
8301 * target-reloc.h: Include "object.h".
8302 (relocate_section): Add reloc_symbol_changes parameter. Change
8303 all callers.
8304 * target.h (class Target): Add calls_non_split method. Declare
8305 do_calls_non_split virtual method. Declare match_view and
8306 set_view_to_nop.
8307 * target.cc: Include "elfcpp.h".
8308 (Target::do_calls_non_split): New function.
8309 (Target::match_view): New function.
8310 (Target::set_view_to_nop): New function.
8311 * gold.cc (queue_middle_tasks): Give an error if mixing
8312 split-stack and non-split-stack objects with -r.
8313 * i386.cc (Target_i386::relocate_section): Add
8314 reloc_symbol_changes parameter.
8315 (Target_i386::do_calls_non_split): New function.
8316 * x86_64.cc (Target_x86_64::relocate_section): Add
8317 reloc_symbol_changes parameter.
8318 (Target_x86_64::do_calls_non_split): New function.
8319 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8320 parameter.
8321 * powerpc.cc (Target_powerpc::relocate_section): Add
8322 reloc_symbol_changes parameter.
8323 * sparc.cc (Target_sparc::relocate_section): Add
8324 reloc_symbol_changes parameter.
8325 * configure.ac: Call AM_CONDITIONAL for the default target.
8326 * configure: Rebuild.
8327 * testsuite/Makefile.am (TEST_AS): New variable.
8328 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8329 (check_DATA): Add split_i386 and split_x86_64 files.
8330 (SPLIT_DEFSYMS): Define.
8331 (split_i386_[1234n].o): New targets.
8332 (split_i386_[124]): New targets.
8333 (split_i386_[1234r].stdout): New targets.
8334 (split_x86_64_[1234n].o): New targets.
8335 (split_x86_64_[124]): New targets.
8336 (split_x86_64_[1234r].stdout): New targets.
8337 (MOSTLYCLEANFILES): Add new executables.
8338 * testsuite/split_i386.sh: New file.
8339 * testsuite/split_x86_64.sh: New file.
8340 * testsuite/split_i386_1.s: New file.
8341 * testsuite/split_i386_2.s: New file.
8342 * testsuite/split_i386_3.s: New file.
8343 * testsuite/split_i386_4.s: New file.
8344 * testsuite/split_i386_n.s: New file.
8345 * testsuite/split_x86_64_1.s: New file.
8346 * testsuite/split_x86_64_2.s: New file.
8347 * testsuite/split_x86_64_3.s: New file.
8348 * testsuite/split_x86_64_4.s: New file.
8349 * testsuite/split_x86_64_n.s: New file.
8350 * testsuite/testfile.cc (Target_test): Update relocation_section
8351 function.
8352 * testsuite/Makefile.in: Rebuild.
8353
e8a9fcda
ILT
83542009-10-06 Ian Lance Taylor <iant@google.com>
8355
8356 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8357 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8358 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8359 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8360 the address on ldo_addrs_.
8361 (Target_i386::Relocate::fix_up_ldo): New function.
8362
e99daf92
ILT
83632009-10-06 Rafael Espindola <espindola@google.com>
8364
8365 * plugin.cc (add_input_library): New.
8366 (Plugin::load): Add add_input_library to tv.
8367 (Plugin_manager::add_input_file): Add the is_lib argument.
8368 (add_input_file): Update call to Plugin_manager::add_input_file.
8369 (add_input_library): New.
8370 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8371
966d4097
DK
83722009-09-30 Doug Kwan <dougkwan@google.com>
8373
8374 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8375 symbol and call Symbol::may_need_copy_reloc to determine if
8376 a copy reloc is needed.
8377 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8378 nocopyreloc is given in command line.
8379 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8380 given in command line.
8381 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8382 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8383 of the removed Target_i386::may_need_copy_reloc.
8384 * options.h (copyreloc): New option with default value false.
8385 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8386 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8387 instead of the removed Target_powerpc::may_need_copy_reloc.
8388 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8389 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8390 instead of the removed Target_sparc::may_need_copy_reloc.
8391 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8392 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8393 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8394 instead of the removed Target_x86_64::may_need_copy_reloc.
8395
029ba973
ILT
83962009-09-30 Ian Lance Taylor <iant@google.com>
8397
8398 * object.h (class Object): Remove target_ field, and target,
8399 sized_target, and set_target methods.
8400 (Object::sized_target): Remove.
8401 (class Sized_relobj): Update declarations. Remove sized_target.
8402 * object.cc (Sized_relobj::setup): Remove target parameter.
8403 Change all callers.
8404 (Input_objects::add_object): Don't do anything with the target.
8405 (make_elf_sized_object): Add punconfigured parameter. Change all
8406 callers. Set or test parameter target.
8407 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8408 Change all callers.
8409 * parameters.cc (Parameters::set_target): Change parameter type to
8410 be non-const.
8411 (Parameters::default_target): Remove.
8412 (set_parameters_target): Change parameter type to be non-const.
8413 (parameters_force_valid_target): New function.
8414 (parameters_clear_target): New function.
8415 * parameters.h (class Parameters): Update declarations. Remove
8416 default_target method. Add sized_target and clear_target
8417 methods. Change target_ to be non-const.
8418 (set_parameters_target): Update declaration.
8419 (parameters_force_valid_target): Declare.
8420 (parameters_clear_target): Declare.
8421 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8422 as NULL if we aren't searching.
8423 (Add_symbols::run): Don't check for compatible target.
8424 * fileread.cc (Input_file::open_binary): Call
8425 parameters_force_valid_target.
8426 * gold.cc (queue_middle_tasks): Likewise.
8427 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8428 set_target on object.
8429 * dynobj.h (class Sized_dynobj): Update declarations.
8430 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8431 make_elf_object returns NULL.
8432 (Archive::include_member): Don't check whether object target is
8433 compatible.
8434 * output.cc (Output_section::add_input_section): Get target from
8435 parameters.
8436 (Output_section::relax_input_section): Likewise.
8437 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8438 parameters.
8439 (Sized_relobj::do_scan_relocs): Likewise.
8440 (Sized_relobj::relocate_sections): Likewise.
8441 * resolve.cc (Symbol_table::resolve): Likewise.
8442 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8443 parameter. Change all callers.
8444 (Symbol_table::add_from_object): Get target from parameters.
8445 (Symbol_table::add_from_relobj): Don't check object target.
8446 (Symbol_table::add_from_dynobj): Likewise.
8447 (Symbol_table::define_special_symbol): Get target from
8448 parameters.
8449 * symtab.h (class Symbol_table): Update declaration.
8450 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8451 parameter. Change all callers. Clear parameter target.
8452 (Binary_test): Test target here.
8453 * testsuite/object_unittest.cc (gold_testsuite): Remove
8454 target_test_pointer parameter. Change all callers.
8455 (Object_test): Test target here.
8456
a6a22b83
ILT
84572009-09-26 Ian Lance Taylor <iant@google.com>
8458
8459 * testsuite/initpri1.c: Don't try to use constructor priorities if
8460 compiling with gcc before 4.3.
8461
6a8f49fe
ILT
84622009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8463
8464 * testsuite/retain_symbols_file_test.sh (check_present): Change
8465 output file name to retain_symbols_file_test.stdout.
8466 (check_absent): Likewise.
8467
8c604651
CS
84682009-09-18 Craig Silverstein <csilvers@google.com>
8469
8470 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8471 * options.cc: Include <cerrno> and <fstream>.
8472 (General_options::finalize): Parse -retain-symbols-file tag.
8473 * options.h: New flag.
8474 (General_options): New method should_retain_symbol, new
8475 variable symbols_to_retain.
8476 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8477 should_retain_symbol map.
8478 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8479 * testsuite/Makefile.in: Regenerate.
8480 * testsuite/retain_symbols_file_test.sh: New file.
8481
ca58b19f
NC
84822009-09-18 Nick Clifton <nickc@redhat.com>
8483
8484 * po/es.po: Updated Spanish translation.
8485
20e6d0d6
DK
84862009-09-17 Doug Kwan <dougkwan@google.com>
8487
8488 * debug.h (DEBUG_RELAXATION): New constant.
8489 (DEBUG_ALL): Add DEBUG_RELAXATION.
8490 (debug_string_to_enum): Add relaxation debug option.
8491 * layout.cc
8492 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8493 Layout::Relaxation_debug_check::read_sections,
8494 Layout::Relaxation_debug_check::read_sections): New method definitions.
8495 (Layout::Layout): Initialize data members
8496 record_output_section_data_from_scrips_,
8497 script_output_section_data_list_ and relaxation_debug_check_.
8498 (Layout::save_segments, Layout::restore_segments,
8499 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8500 Layout::relaxation_loop_body): New method definitions.
8501 (Layout::finalize): Support relaxation. Move section layout code to
8502 Layout::relaxation_loop_body.
8503 (Layout::set_asection_address_from_script): Move code for orphan
8504 section placement out.
8505 (Layout::place_orphan_sections_in_script): New method definition.
8506 * layout.h (Output_segment_headers, Output_file_header):
8507 New forward class declarations.
8508 (Layout::~Layout): Define.
8509 (Layout::new_output_section_data_from_script): New method definition.
8510 (Layout::place_orphan_sections_in_script): New method declaration.
8511 (Layout::Segment_states): New type declaration.
8512 (Layout::save_segments, Layout::restore_segments,
8513 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8514 Layout::relaxation_loop_body): New method declarations.
8515 (Layout::Output_section_data_list): New type declaration.
8516 (Layout::Relaxation_debug_check): New class definition.
8517 (Layout::record_output_section_data_from_script_,
8518 Layout::script_output_section_data_list_, Layout::segment_states_,
8519 Layout::relaxation_debug_check_): New data members.
8520 * output.cc: (Output_section_headers::do_size): New method definition.
8521 (Output_section_headers::Output_section_headers): Move size
8522 computation to Output_section_headers::do_size.
8523 (Output_segment_headers::do_size): New method definition.
e1df38aa 8524 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
8525 Output_file_header::do_size and call it.
8526 (Output_file_header::do_size): New method definition.
8527 (Output_data_group::Output_data_group): Adjust call to
8528 Output_section_data.
8529 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8530 (Output_symtab_xindex::do_write): Add array bound check.
8531 (Output_section::Input_section::print_to_mapfile): Handle
8532 RELAXED_INPUT_SECTION_CODE.
8533 (Output_section::Output_section): Initialize data member checkpoint_.
8534 (Output_section::~Output_section): Delete checkpoint object pointed
8535 by checkpoint_.
8536 (Output_section::add_input_section): Always add an Input_section if
8537 relaxing.
8538 (Output_section::add_merge_input_section): Add assert.
8539 (Output_section::relax_input_section): New method definition.
8540 (Output_section::set_final_data_size): Set load address to zero for
8541 an unallocated section.
8542 (Output_section::do_address_and_file_offset_have_reset_values):
8543 New method definition.
8544 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8545 Handle relaxed input section.
8546 (Output_section::sort_attached_input_sections): Checkpoint input
8547 section list lazily.
8548 (Output_section::get_input_sections): Change type of input_sections to
8549 list of Simple_input_section pointers. Checkpoint input section list
8550 lazily. Also handle relaxed input sections.
8551 (Output_section::add_input_section_for_script): Take a reference to
8552 a Simple_input_section object instead of Relobj pointer and section
8553 index as parameter. Handle relaxed input sections.
8554 (Output_section::save_states, Output_section::restore_states): New
8555 method definitions.
8556 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8557 (Output_data::is_data_size_fixed): New method definition.
8558 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8559 if it is fixed.
8560 (Output_data::address_and_file_offset_have_reset_values): New method
8561 definition.
8562 (Output_data::do_address_and_file_offset_have_reset_values): New method
8563 definition.
8564 (Output_data::set_data_size): Check that data size is not fixed.
8565 (Output_data::fix_data_size): New method definition.
8566 (Output_data::is_data_size_fixed_): New data member.
8567 (Output_section_headers::set_final_data_size): New method definition.
8568 (Output_section_headers::do_size): New method declaration.
8569 (Output_segment_headers::set_final_data_size): New method definition.
8570 (Output_segment_headers::do_size): New method declaration.
8571 (Output_file_header::set_final_data_size)::New method definition.
8572 (Output_file_header::do_size)::New method declaration.
8573 (Output_section_data::Output_section_data): Add new parameter
8574 is_data_size_fixed and use it to fix data size.
8575 (Output_data_const::Output_data_const): Adjust call to base class
8576 constructor and fix data size.
8577 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8578 base class constructor and fix data size.
8579 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8580 base class constructor and fix data size.
8581 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8582 class constructor and fix data size.
8583 (Output_data_group::set_final_data_size): New method definition.
8584 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8585 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8586 class constructor and fix data size.
8587 (Output_relaxed_input_section): New class definition.
8588 (Output_section::Simple_input_section): New class definition.
8589 (Output_section::get_input_sections): Adjust parameter list.
8590 (Output_section::add_input_section_for_script): Same.
8591 (Output_section::save_states, Output_section::restore_states,
8592 Output_section::do_address_and_file_offset_have_reset_values,
8593 (Output_section::Input_section::Input_section): Handle
8594 RELAXED_INPUT_SECTION_CODE. Add new overload for
8595 Output_relaxed_input_section.
8596 (Output_section::Input_section::is_input_section,
8597 Output_section::Input_section::set_output_section): Handle relaxed
8598 input section.
8599 (Output_section::Input_section::is_relaxed_input_section,
8600 Output_section::Input_section::output_section_data,
8601 Output_section::Input_section::relaxed_input_section): New method
8602 definitions.
8603 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8604 value.
8605 (Output_section::Input_section::u1_): Update comments.
8606 (Output_section::Input_section::u2_): Add new union member poris.
8607 (Output_section::Checkpoint_output_section): New classs definition.
8608 (Output_section::relax_input_section): New method declaration.
8609 (Output_section::checkpoint_): New data member.
8610 (Output_segment): Update comments.
8611 (Output_segment::Output_segment): Un-privatize copy constructor.
8612 (Output_segment::operator=): Un-privatize.
8613 * script-sections.cc (Output_section_element::Input_section_list):
8614 Change element type to Output_section::Simple_input_section.
8615 (Output_section_element_dot_assignment::set_section_addresses):
8616 Register output section data for relaxation clean up.
8617 (Output_data_exression::Output_data_expression): Adjust call to base
8618 constructor to fix data size.
8619 (Output_section_element_data::set_section_addresses): Register
8620 Output_data_expression object for relaxation clean up.
8621 (struct Input_section_info): Replace Relobj pointer and section index
8622 pair with Output_section::Simple_input_section and Convert struct to a
8623 class.
8624 (Input_section_sorter::operator()): Adjust access to
e1df38aa 8625 Input_section_info data member to use accessors.
20e6d0d6
DK
8626 (Output_section_element_input::set_section_addresses): Use layout
8627 parameter. Adjust code to use Output_section::Simple_input_section
8628 and Input_secction_info classes. Register filler for relaxation
8629 clean up.
8630 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8631 and section index pair with Output_section::Simple_input_section
8632 class. Adjust code accordingly.
8633 (Phdrs_element::release_segment): New method definition.
8634 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8635 segment list.
8636 (Script_sections::release_segments): New method definition.
8637 * gold/script-sections.h (Script_sections::release_segments): New
8638 method declaration.
8639 * gold/target.h (Target::may_relax, Target::relax,
8640 Target::do_may_relax, Target::do_relax): New method definitions.
8641
5e445df6
ILT
86422009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8643
8644 * arm.cc (has_signed_unsigned_overflow): New function.
8645 (Arm_relocate_functions::abs8): New function.
8646 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8647 (Target_arm::Scan::global): Likewise.
8648 (Target_arm::relocate::relocate): Likewise.
8649 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8650 Likewise.
8651
8c604651 86522009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
8653
8654 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8655 * testsuite/Makefile.in: Regenerate.
8656
1e9cc1c2
NC
86572009-09-11 Nick Clifton <nickc@redhat.com>
8658
8659 * po/gold.pot: Updated by the Translation project.
8660
6a89f575
CC
86612009-09-08 Cary Coutant <ccoutant@google.com>
8662
8663 * output.cc (Output_file::open): Add execute permission to empty file.
8664 * testsuite/Makefile.am (permission_test): New test.
8665 * testsuite/Makefile.in: Regenerate.
8666
fdcac5af
ILT
86672009-09-02 Ian Lance Taylor <iant@google.com>
8668
8669 * output.cc (Output_file::resize): Call map_no_anonymous rather
8670 than map.
8671
44453f85
ILT
86722009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8673
8674 * gold.cc: Include "incremental.h".
8675 (queue_initial_tasks): Call Incremental_checker methods.
8676 * incremental.cc: Include "output.h".
8677 (Incremental_checker::can_incrementally_link_output_file): New
8678 method.
8679 * incremental.h (Incremental_checker): New class.
8680
8681 * output.cc (Output_file::open_for_modification): New method.
8682 (Output_file::map_anonymous): Changed return type to bool. Record
8683 map in base_ field.
8684 (Output_file::map_no_anonymous): New method, broken out of map.
8685 (Output_file::map): Use map_no_anonymous and map_anonymous.
8686 * output.h (class Output_file): Update declarations.
8687
293c1386
CC
86882009-08-24 Cary Coutant <ccoutant@google.com>
8689
8690 * options.h (Command_line::Pre_options): New class.
8691 (Command_line::pre_options): New member.
8692 * options.cc (gold::options::ready_to_register): New variable.
8693 (One_option::register_option): Do nothing if not registering options.
8694 Assert if same short option registered twice.
8695 (General_options::General_options): Turn off option registration when
8696 done constructing.
8697 (Command_line::Pre_options::Pre_options): New constructor.
8698
f773f3d2
CC
86992009-08-24 Cary Coutant <ccoutant@google.com>
8700
06a73cfe
CC
8701 * options.h (General_options::no_keep_memory): Remove incorrect
8702 short option.
f773f3d2 8703
a15af8e2
RW
87042009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8705
8706 * Makefile.am (am__skiplex, am__skipyacc): New.
8707 * Makefile.in: Regenerate.
8708
c462b41b
RW
87092009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8710
14ec8efd
RW
8711 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8712 (INCLUDES): ... this.
8713 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8714 (AM_CPPFLAGS): Renamed from ...
8715 (INCLUDE): ... this.
8716 * Makefile.in, testsuite/Makefile.in: Regenerate.
8717
81ecdfbb
RW
8718 * Makefile.in: Regenerate.
8719 * aclocal.m4: Likewise.
8720 * config.in: Likewise.
8721 * configure: Likewise.
8722 * testsuite/Makefile.in: Likewise.
8723
c462b41b
RW
8724 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8725 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8726 * Makefile.in: Regenerate.
8727 * testsuite/Makefile.in: Regenerate.
8728
2da73f13
CC
87292009-08-19 Cary Coutant <ccoutant@google.com>
8730
8731 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8732 symbols in shared libraries overridden by hidden or internal symbols
8733 in the main program.
8734
2db70501
CD
87352009-08-19 Chris Demetriou <cgd@google.com>
8736
8737 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8738 checking source file names in error messages.
8739
f733487b
DK
87402009-08-18 Doug Kwan <dougkwan@google.com>
8741
8742 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8743 an elcpp::Ehdr as parameter. Adjust call to set_target.
8744 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8745 an elfcpp::Ehdr as parameter.
8746 * object.cc (Object::set_target): Remove the version that looks up
8747 a target and sets it.
8748 (Sized_relobj::setup): Take a Target object instead of
8749 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8750 (make_elf_sized_object): Find target and ask target to
8751 make an ELF object.
8752 * object.h: (Object::set_target): Remove the version that looks up
8753 a target and sets it.
8754 (Sized_relobj::setup): Take a Target object instead of
8755 an elfcpp:Ehdr as parameter.
8756 * target.cc: Include dynobj.h.
8757 (Target::do_make_elf_object_implementation): New.
8758 (Target::do_make_elf_object): New.
8759 * target.h (Target::make_elf_object): New template declaration.
8760 (Target::do_make_elf_object): New method declarations.
8761 (Target::do_make_elf_object_implementation): New template declaration.
8762
cc70f101
ILT
87632009-08-14 Ian Lance Taylor <iant@google.com>
8764
8765 * gold.h (FUNCTION_NAME): Define.
8766 (gold_unreachable): Use FUNCTION_NAME.
8767
ef5e0cb1
ST
87682009-08-12 Sriraman Tallam <tmsriram@google.com>
8769
8770 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8771 symbol in the --keep-unique list is not found.
8772
48c187ce
ST
87732009-08-12 Sriraman Tallam <tmsriram@google.com>
8774
8775 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8776 been maked as --keep-unique.
8777 (Icf::unfold_section): New function.
8778 * icf.h (Icf::unfold_section): New function.
8779 * options.h (General_options::keep_unique): New option.
8780 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8781 * testsuite/Makefile.in: Regenerate.
8782 * testsuite/icf_keep_unique_test.sh: New file.
8783 * testsuite/icf_keep_unique_test.cc: New file.
8784
645afe0c
CC
87852009-08-12 Cary Coutant <ccoutant@google.com>
8786
8787 PR 10471
8788 * resolve.cc (Symbol_table::resolve): Check for references from
8789 dynamic objects to hidden and internal symbols.
8790 * testsuite/Makefile.am (hidden_test.sh): New test.
8791 * testsuite/Makefile.in: Regenerate.
8792 * testsuite/hidden_test.sh: New script.
8793 * testsuite/hidden_test_1.c: New test source.
8794 * testsuite/hidden_test_main.c: New test source.
8795
11af873f
DK
87962009-08-11 Doug Kwan <dougkwan@google.com>
8797
8798 * arm.cc: Update comments.
8799 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8800 segment to locate the .ARM.exidx section if present.
8801
b9f7d72d
DK
88022009-08-09 Doug Kwan <dougkwan@google.com>
8803
8804 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8805 patch.
8806
ddd3c53c
ST
88072009-08-07 Sriraman Tallam <tmsriram@google.com>
8808 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8809 compiler warnings.
8810
27721062
ST
88112009-08-06 Sriraman Tallam <tmsriram@google.com>
8812
8813 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8814 valid tls_segment only for non-debug-section relocations.
8815 * testsuite/Makefile.am: Add gc_tls_test.
8816 * testsuite/Makefile.in: Regenerate.
8817 * testsuite/gc_tls_test.cc: New file.
8818 * testsuite/gc_tls_test.sh: New file.
8819
ef15dade 88202009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 8821
ef15dade
ST
8822 * icf.cc: New file.
8823 * icf.h: New file.
8824 * Makefile.am (CCFILES): Add icf.cc.
8825 (HFILES): Add icf.h
8826 * Makefile.in: Regenerate.
8827 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8828 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8829 section, symbol and addend information for the relocs.
8830 * gold.cc (queue_middle_tasks): Call identical code folding.
8831 * gold.h: Add defines for multimap.
8832 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8833 to the call of finalize_local_symbols.
8834 * main.cc (main): Create object of class Icf.
8835 * object.cc (Sized_relobj::do_layout): Allow this function to be
8836 called twice during icf.
8837 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8838 to sections marked as identical by icf.
8839 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8840 when available.
8841 (Sized_relobj::do_section_entsize): New function.
8842 * object.h (Object::section_entsize): New function.
8843 (Object::do_section_entsize): New pure virtual function.
8844 (Relobj::finalize_local_symbols): Add new parameter.
8845 (Relobj::do_section_entsize): New function.
8846 * options.h (General_options::icf): New option.
8847 (General_options::icf_iterations): New option.
8848 (General_options::print_icf_sections): New option.
8849 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8850 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8851 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8852 icf.
8853 * symtab.cc (Symbol_table::is_section_folded): New function.
8854 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8855 to sections marked as identical by icf.
8856 * symtab.h (Symbol_table::set_icf): New function.
8857 (Symbol_table::icf): New function.
8858 (Symbol_table::is_section_folded): New function.
8859 (Symbol_table::icf_): New data member.
8860 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8861 * testsuite/Makefile.am: Add commands to build icf_test.
8862 * testsuite/Makefile.in: Regenerate.
8863 * testsuite/icf_test.sh: New file.
8864 * testsuite/icf_test.cc: New file.
8865
c3b65ac4
CD
88662009-07-24 Chris Demetriou <cgd@google.com>
8867
8868 * layout.cc (is_compressible_debug_section): Fix incorrect
8869 comment about compressed section names.
8870
1caf2c51
ILT
88712009-07-20 Ian Lance Taylor <ian@airs.com>
8872
8873 PR 10419
8874 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8875
1ef4d87f
ILT
88762009-07-16 Ian Lance Taylor <iant@google.com>
8877
8878 PR 10400
8879 * layout.h: #include <map>.
8880 (class Kept_section): Change from struct to class. Add accessors
8881 and setters. Add section size to Comdat_group mapping. Change
8882 Comdat_group to std::map. Add is_comdat_ field. Add
8883 linkonce_size field in union.
8884 (class Layout): Update declaration of find_or_add_kept_section.
8885 Don't declare find_kept_object.
8886 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8887 parameter. Add object, shndx, is_comdat, and is_group_name
8888 parameters. Change all callers. Adjust for new Kept_section.
8889 (Layout::find_kept_object): Remove.
8890 * object.cc (Sized_relobj::include_section_group): Update use of
8891 Kept_section. Rename secnum to shndx. Only record
8892 Kept_comdat_section if sections are the same size.
8893 (Sized_relobj::include_linkonce_section): Update use of
8894 Kept_section. Only record Kept_comdat_section if sections are the
8895 same size. Set size of linkonce section.
8896 (Sized_relobj::map_to_kept_section): Update call to
8897 get_kept_comdat_section.
8898 * object.h (class Sized_relobj): Rename fields in
8899 Kept_comdat_section to drop trailing underscores; change object
8900 field to Relobj*. Change Kept_comdat_section_table to store
8901 struct rather than pointer.
8902 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8903 Add kept_object and kept_shndx parameters. Change all callers.
8904 (Sized_relobj::get_kept_comdat_section): Change return type to
8905 bool. Add kept_object and kept_shndx parameters. Change all
8906 callers.
8907 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8908 Layout::find_or_add_kept_section.
8909
37c3b7b0
ILT
89102009-07-09 Ian Lance Taylor <iant@google.com>
8911
8912 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8913 Reserve space in the hash table.
8914
98fa85cb
ILT
89152009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8916
8917 * fileread.cc (File_read::get_mtime): New method.
8918 * fileread.h (Timespec): New structure.
8919 (File_read::get_mtime): New method.
8920 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8921 Renamed from timestamp_nsec.
8922 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8923 Elf_Xword.
e1df38aa 8924 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 8925 timestamp_nsec.
e1df38aa 8926 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
8927 (Incremental_inputs::report_obejct): Save mtime; style fix.
8928 (Incremental_inputs::report_script): Save mtime; style fix.
8929 (Incremental_inputs::finalize_inputs): Style fix.
8930 (Incremental_inputs::finalize): Style fix.
8931 (Incremental_inputs::create_input_section_data): Store inputs
8932 mtime.
8933 * incremental.h (Incremental_inputs::report_script): Add mtime
8934 argument.
8935 (Incremental_inputs::Input_info::Input_info): Intialize only one
8936 union member.
8937 (Incremental_inputs::Input_info::archive): Move to nameless
8938 union.
8939 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8940 (Incremental_inputs::Input_info::script): Move to nameless union.
8941 (Incremental_inputs::mtime): New field.
8942 * script.cc (read_input_script): Pass file mtime to
8943 Incremental_input.
8944 * script.h (Script_info::inputs): Style fix.
8945
c9d70757
ILT
89462009-07-01 Ian Lance Taylor <ian@airs.com>
8947
8948 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8949 instead of 32.
8950
9c547ec3
ILT
89512009-06-24 Ian Lance Taylor <iant@google.com>
8952
8953 PR 10156
8954 * layout.cc (Layout::choose_output_section): If we find an
8955 existing section, update the flags.
8956 (Layout::create_notes): New function, broken out of
8957 Layout::finalize.
8958 (Layout::finalize): Don't create note sections.
8959 (Layout::create_note): Don't crash if linker script discards
8960 section.
8961 (Layout::create_gold_note): Likewise.
8962 (Layout::create_build_id): Likewise. Don't set
8963 after_input_sections on the section.
8964 (Layout::create_executable_stack_info): Remove target parameter.
8965 Change caller.
8966 * layout.h (class Layout): Declare create_notes. Update
8967 declaration of create_executable_stack_info.
8968 * gold.cc (queue_middle_tasks): Call create_notes.
8969 * output.cc (Output_section::update_flags_for_input_section): Move
8970 here from output.h. If SHF_ALLOC flag is newly set, mark address
8971 invalid.
8972 * output.h (Output_data::mark_address_invalid): New function.
8973 (class Output_section): Only declare, not define,
8974 update_flags_for_input_section. Remove set_flags.
8975
55458500
ILT
89762009-06-24 Ian Lance Taylor <iant@google.com>
8977
8978 * script-sections.cc (Output_section_definition::
8979 set_section_addresses): Rename shadowing local load_address to
8980 laddr.
8981
1307d6cd
ILT
89822009-06-24 Ian Lance Taylor <iant@google.com>
8983
8984 PR 10244
8985 * reloc.cc (relocate_sections): Skip empty relocation sections.
8986
ec3f783e
ILT
89872009-06-23 Ian Lance Taylor <iant@google.com>
8988
8989 PR 10156
8990 * layout.cc (Layout::create_note): Use choose_output_section
8991 rather than make_output_section.
8992
459c9f1c
ILT
89932009-06-23 Ian Lance Taylor <iant@google.com>
8994
8995 PR 10237
8996 * options.cc (General_options::parse_V): Set printed_version_.
8997 (General_options::General_options): Initialize printed_version_.
8998 * options.h (class General_options): Add printed_version_ field.
8999 * gold.cc (queue_initial_tasks): If there are no input files,
9000 don't give a fatal error if we printed the version information.
9001 (queue_middle_tasks): If using -r with a shared object, give a
9002 fatal error rather than an ordinary error.
9003
1518dc8f
ILT
90042009-06-23 Ian Lance Taylor <iant@google.com>
9005
9006 PR 10219
9007 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9008 (Layout::make_output_section): Set have_stabstr_section_ if we see
9009 a .stab*str section.
9010 (Layout::finalize): Call link_stabs_sections.
9011 (Layout::link_stabs_sections): New file.
9012 * layout.h (class Layout): Add have_stabstr_section_ field.
9013 Declare link_stabs_sections.
9014
3d857b98
DK
90152009-06-23 Doug Kwan <dougkwan@google.com>
9016
9017 * Makefile.am (libgold_a_LIBADD): New.
9018 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9019 * Makefile.in: Regenerate.
9020 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9021 * configure: Regenerate.
9022 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9023 * fileread.cc: Include sys/state.h
9024 * gold.h: Declare memmem and strndup if found missing.
9025 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9026
0639a6f6
ILT
90272009-06-23 Ian Lance Taylor <iant@google.com>
9028
9029 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9030 * configure: Rebuild.
9031
8d63875c
ILT
90322009-06-23 Ian Lance Taylor <iant@google.com>
9033
9034 PR 10147
9035 * object.cc (Object::section_contents): Don't try to get a view if
9036 the section has length zero.
9037 (Object::handle_gnu_warning_section): If the section is empty, use
9038 the name of the section as the warning.
9039
f7c8a183
ILT
90402009-06-23 Ian Lance Taylor <iant@google.com>
9041
9042 PR 10133
9043 * stringpool.h (class Stringpool_template): Add optimize_ field.
9044 (Stringpool_template::set_optimize): New function.
9045 * stringpool.cc (Stringpool_template::Stringpool_template):
9046 Initialize optimize_ field.
9047 (Stringpool_template::set_string_offsets): Test local optimize
9048 fild rather than parameter.
9049 * layout.cc (Layout::Layout): Call set_optimize on the section
9050 name stringpool.
9051
e6a307ba
ILT
90522009-06-22 Ian Lance Taylor <iant@google.com>
9053
9054 PR 10030
9055 * yyscript.y: Parse TARGET.
9056 * script.cc (script_set_target): New function.
9057 * script-c.h (script_set_target): Declare.
9058 * options.cc (General_options::string_to_object_format): Rename
9059 from string_to_object_format in anonymous namespace. Change
9060 callers.
9061 * options.h (class General_options): Declare
9062 string_to_object_format.
9063
3ee173de
ILT
90642009-06-22 Ian Lance Taylor <iant@google.com>
9065
9066 * script-sections.cc (Script_sections::create_segments): Don't put
9067 program headers in a PT_LOAD segment if -n or -N.
9068
90692009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
9070
9071 PR 10141
9072 * options.h (class General_options): Add -z lazy and -z now. Sort
9073 -z options into alphabetical order.
9074 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9075
cd6739a1 90762009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
9077
9078 * layout.cc (Layout::make_output_section): Call
9079 Target::new_output_section.
9080 (Layout::attach_allocated_section_to_segment): Put large section
9081 sections in a separate load segment with the large segment flag
9082 set.
9083 (Layout::segment_precedes): Sort large data segments after other
9084 load segments.
9085 (align_file_offset): New static function.
9086 (Layout::set_segment_offsets): Use align_file_offset.
9087 * output.h (class Output_section): Add is_small_section_ and
9088 is_large_section_ fields.
9089 (Output_section::is_small_section): New function.
9090 (Output_section::set_is_small_section): New function.
9091 (Output_section::is_large_section): New function.
9092 (Output_section::set_is_large_section): New function.
9093 (Output_section::is_large_data_section): New function.
9094 (class Output_segment): Add is_large_data_segment_ field.
9095 (Output_segment::is_large_data_segment): New function.
9096 (Output_segment::set_is_large_data_segment): New function.
9097 * output.cc (Output_section::Output_section): Initialize new
9098 fields.
9099 (Output_segment::Output_segment): Likewise.
9100 (Output_segment::add_output_section): Add assertion that large
9101 data sections always go in large data segments. Force small data
9102 sections to the end of the list of data sections. Force small BSS
9103 sections to the start of the list of BSS sections. For large BSS
9104 sections to the end of the list of BSS sections.
9105 * symtab.h (class Symbol): Declare is_common_shndx.
9106 (Symbol::is_defined): Check Symbol::is_common_shndx.
9107 (Symbol::is_common): Likewise.
9108 (class Symbol_table): Define enum Commons_section_type. Update
9109 declarations. Add small_commons_ and large_commons_ fields.
9110 * symtab.cc (Symbol::is_common_shndx): New function.
9111 (Symbol_table::Symbol_table): Initialize new fields.
9112 (Symbol_table::add_from_object): Put small and large common
9113 symbols in the right list.
9114 (Symbol_table::sized_finalized_symbol): Check
9115 Symbol::is_common_shndx.
9116 (Symbol_table::sized_write_globals): Likewise.
9117 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9118 common symbol lists. Don't call do_allocate_commons_list if the
9119 list is empty.
9120 (Symbol_table::do_allocate_commons_list): Remove is_tls
9121 parameter. Add comons_section_type parameter. Change all
9122 callers. Handle small and large common symbols.
9123 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9124 Symbol::is_common_shndx.
9125 * resolve.cc (symbol_to_bits): Likewise.
9126 * target.h (Target::small_common_shndx): New function.
9127 (Target::small_common_section_flags): New function.
9128 (Target::large_common_shndx): New function.
9129 (Target::large_common_section_flags): New function.
9130 (Target::new_output_section): New function.
9131 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9132 small_common_section_flags, and large_common_section_flags
9133 fields.
9134 (Target::do_new_output_section): New virtual function.
9135 * arm.cc (Target_arm::arm_info): Initialize new fields.
9136 * i386.cc (Target_i386::i386_info): Likewise.
9137 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9138 Likewise.
9139 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9140 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9141 (Target_x86_64::do_new_output_section): New function.
9142 * configure.ac: Define conditional MCMODEL_MEDIUM.
9143 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9144 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9145 (large_LDFLAGS): Define.
9146 * testsuite/large.c: New file.
9147 * testsuite/testfile.cc (Target_test::test_target_info):
9148 Initialize new fields.
9149 * configure, testsuite/Makefile.in: Rebuild.
9150
bb04269c
DK
91512009-06-05 Doug Kwan <dougkwan@google.com>
9152
9153 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 9154 * Makefile.in: Regenerate.
bb04269c
DK
9155 * i386.cc (class Target_i386): Define new virtual method to
9156 override do_is_local_label_name in parent.
9157 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9158 local symbols if --discard-locals or -X is given.
9159 * options.h (class General_options): Declare new options
9160 '--discard-locals' and '-X' for discarding locals.
9161 * target.h (class Target): Define new methods is_local_label_name.
9162 Declare new virtual method do_is_local_label_name.
9163 * target.cc: New file.
9164 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9165 (check_SCRIPTS): Add discard_locals_test.sh.
9166 (check_DATA): Add discard_local_tests.syms.
9167 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9168 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9169 * testsuite/Makefile.in: Regenerate.
9170 * testsuite/discard_locals_test.c: New file.
9171 * testsuite/discard_locals_test.sh: Same.
9172
805bb01c
DK
91732009-06-05 Doug Kwan <dougkwan@google.com>
9174
9175 * object.cc (Sized_relobj::Sized_relobj): Initialize
9176 discarded_eh_frame_shndx_ to -1U.
9177 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9178 section.
9179 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9180 a discarded .eh_frame section.
9181 (Sized_relobj::do_finalize_local_symbols): Ditto.
9182 * object.h (class Sized_relobj): Declare new member
9183 discarded_eh_frame_shndx_.
9184 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9185 (local_labels_test.o, local_labels_test): New rules.
9186 * testsuite/Makefile.in: Regenerate.
9187
1dcd334d
DK
91882009-06-04 Doug Kwan <dougkwan@google.com>
9189
9190 * layout.cc (Layout::section_name_mapping): Add mapping for
9191 special ARM sections.
9192
96d49306
DK
91932009-06-03 Doug Kwan <dougkwan@google.com>
9194
9195 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9196 (utils::has_overflow): Same.
9197
dff16297
ILT
91982009-06-03 Ian Lance Taylor <iant@google.com>
9199
9200 * layout.cc (Layout::section_name_mapping): New array, replacing
9201 Layout::linkonce_mapping.
9202 (Layout::section_name_mapping_count): New variable, replacing
9203 Layout::linkonce_mapping_count.
9204 (Layout::linkonce_output_name): Remove.
9205 (Layout::output_section_name): Rewrite.
9206 * layout.h (class Layout): Rename Linkonce_mapping to
9207 Section_name_mapping, linkonce_mapping to section_name_mapping,
9208 linkonce_mapping_count to section_name_mapping_count. Don't
9209 declare linkonce_output_name.
9210
c121c671
DK
92112009-06-03 Doug Kwan <dougkwan@google.com>
9212
9213 * gold/arm.cc (namespace utils): New.
9214 (Target_arm::reloc_is_non_pic): Define new method.
9215 (class Arm_relocate_functions): New.
9216 (Target_arm::Relocate::relocate): Handle relocation types used by
9217 Android.
9218
07800fab
ILT
92192009-06-03 Ian Lance Taylor <iant@google.com>
9220
9221 * arm.cc (Target_arm::scan::global): Use || instead of |.
9222
c121c671
DK
92232009-06-02 Doug Kwan <dougkwan@google.com>
9224
9225 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9226 issued_non_pic_error_.
9227 (class Target_arm::Scan): Declare new method check_non_pic.
9228 Define new method symbol_needs_plt_entry.
9229 Declare new data member issued_non_pic_error_.
9230 (class Target_arm::Relocate): Declare new method
9231 should_apply_static_reloc.
9232 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9233 (Target_arm::Scan::check_non_pic): Define new method.
9234 (Target_arm::Scan::local): Handle a small subset of reloc types used
9235 by Android.
9236 (Target_arm::Scan::local): Same.
9237 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9238
b19b0c6d
ILT
92392009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9240
9241 * incremental.cc (Incremental_inputs::report_command_line): Filter
9242 out --incremental-* options.
9243
94cdfcff
DK
92442009-05-29 Doug Kwan <dougkwan@google.com>
9245
9246 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9247 template class.
9248 (class Target_arm): Update comment.
9249 (Target_arm::Target_arm): Initialize new data members GOT_,
9250 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9251 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9252 and Target_arm::rel_dyn_section.
9253 Declare new_enum Target_arm::Got_type.
9254 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9255 and DYNBSS_.
9256 Update commments for member do_dynsym_value.
9257 (Target_arm::got_size, Target_arm::plt_section,
9258 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9259 new methods inside class defintion.
9260 (Target_arm::got_section): Define new method.
9261 (Target_arm::rel_dyn_section): Same.
9262 (Output_data_plt_arm): New template class.
9263 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9264 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9265 (Output_data_plt_arm::add_entry): Same.
9266 (Output_data_plt_arm::first_plt_entry): Define new
9267 static data member for PLT instruction template.
9268 (Output_data_plt_arm::plt_entry): Same.
9269 (Output_data_plt_arm::do_write): Define new method.
9270 (Target_arm::make_plt_entry): Same.
9271 (Target_arm::do_finalize_sections): Same.
9272 (Target_arm::do_dynsym_value): Same.
9273
4a657b0d
DK
92742009-05-28 Doug Kwan <dougkwan@google.com>
9275
9276 * Makefile.am (TARGETSOURCES): Add arm.cc.
9277 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9278 * Makefile.in: Regenerate.
9279 * arm.cc: New file.
9280 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9281
e7ae8c36
DK
92822009-05-26 Doug Kwan <dougkwan@google.com>
9283
9284 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9285 (General_options::check_excluded_libs): Strip off directories in
9286 archive name before matching like GNU ld does.
9287 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9288 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9289 (exclude_libs_test_LDFLAGS): Add linker option
9290 -Wl,--exclude-libs,libexclude_libs_test_3
9291 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9292 an explicit archive without using -l.
9293 (alt/libexclude_libs_test_3.a): New make rule.
9294 * testsuite/Makefile.in: Regenerate.
9295 * testsuite/exclude_libs_test.c : Declare lib3_default().
9296 (main): Call it.
9297 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9298 * exclude_libs_test_3.c: New file.
9299
f12e7348
NC
93002009-05-26 Nick Clifton <nickc@redhat.com>
9301
9302 * po/id.po: New Indonesian translation.
9303 * po/gold.pot: Updated template file.
9304
4daadc0d
ST
93052009-05-22 Sriraman Tallam <tmsriram@google.com>
9306
e1df38aa 9307 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
9308 gc_comdat_test files. Add -Wl,--gc-sections to build
9309 gc_comdat_test.
9310 * testsuite/Makefile.in: Regenerate.
9311 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9312
531813ad
ST
93132009-05-21 Sriraman Tallam <tmsriram@google.com>
9314
9315 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9316 kept comdat section was garbage collected.
9317 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9318 * testsuite/Makefile.in: Regenerate.
9319 * testsuite/gc_comdat_test.sh: New file.
9320 * testsuite/gc_comdat_test_1.cc: New file.
9321 * testsuite/gc_comdat_test_2.cc: New file.
9322
65514900
CC
93232009-05-19 Doug Kwan <dougkwan@google.com>
9324
9325 * archive.cc (Archive::Archive): Move constructor from archive.h
9326 to here. Initialize no_export_.
9327 (Archive::get_elf_object_for_member): Set no_export flag of object.
9328 * archive.h (Archive::Archive): Move constructor body to
9329 archive.cc.
9330 (Archive::no_export): New method.
9331 (Archive::no_export_): New field.
9332 * object.h (Object::Object): Initialize no_export_ to false.
9333 (Object::no_export, Object::set_no_export): New methods.
9334 (Object::no_export_): New field.
9335 * options.cc (General_options::parse_exclude_libs): New method.
9336 (General_options::check_excluded_libs) Same.
9337 * options.h (exclude_libs): New option.
9338 (General_options::check_excluded_libs): New method declaration.
9339 (General_options::excluded_libs_): New field.
9340 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9341 default or protected visibility if an object has no-export flag set.
9342 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9343 (check_SCRIPTS): Add exclude_libs_test.sh.
9344 (check_DATA): Add exclude_libs_test.syms.
9345 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9346 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9347 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9348 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9349 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9350 libexclude_libs_test_2.a): New rules.
9351 * testsuite/Makefile.in: Regenerate.
9352 * testsuite/exclude_libs_test.c: New file.
9353 * testsuite/exclude_libs_test.sh: Ditto.
9354 * testsuite/exclude_libs_test_1.c: Ditto.
9355 * testsuite/exclude_libs_test_2.c: Ditto.
9356
1b77ea50
ILT
93572009-05-15 Ian Lance Taylor <iant@google.com>
9358
9359 * configure.ac: Check for declarations for cases where libiberty.h
9360 checks HAVE_DECL_xxx.
9361 * configure, config.in: Rebuild.
9362
072fe7ce
ILT
93632009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9364
9365 * gold.h (Incremental_argument_list): Remove (invalid) forward
9366 declaration.
9367 * incremental.cc (Incremental_inputs::report_achive): New method.
9368 (Incremental_inputs::report_object): New method.
9369 (Incremental_inputs::report_script): New method.
9370 (Incremental_inputs::finalize_inputs): New method.
9371 (Incremental_inputs::finalize): Call finalize_inputs().
9372 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9373 Create inputs entries.
9374 * incremental.h (Incremental_input_type): New enum.
9375 (Incremental_inputs::Incremental_input): Initialize new fields.
9376 (Incremental_inputs::report_inputs): New method.
9377 (Incremental_inputs::report_achive): New method.
9378 (Incremental_inputs::report_object): New method.
9379 (Incremental_inputs::report_script): New method.
9380 (Incremental_inputs::finalize_inputs): New method.
9381 (Incremental_inputs::Input_info): New struct.
9382 (Incremental_inputs::Input_info_map): New typedef.
9383 (Incremental_inputs::lock_): New field.
9384 (Incremental_inputs::Inputs_): New field.
9385 (Incremental_inputs::Inputs_map): New field.
9386 * main.cc (main): Call Incremental_input::report_inputs.
9387 * options.h (Input_argument_list): Typedef moved from
9388 Input_arguments.
9389 (Input_file_group::Files): Remove, use ::Input_argument_list.
9390 (Input_file_group::Input_argument_list): Remove, use
9391 ::Input_argument_list.
9392 * plugin.cc (Plugin_manager::add_input_file): Add error in
9393 incremental build.
9394 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9395 functions.
9396 * script.cc (read_input_script): Call
9397 Incremental_input::report_script.
9398 * script.h (Script_info): New class.
9399
b0481b0b
ILT
94002009-04-27 Ian Lance Taylor <iant@google.com>
9401
9402 * x86_64.cc (do_adjust_output_section): Set entsize to
9403 plt_entry_size.
9404
b22a5a41 94052009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
9406
9407 * output.cc (Output_file::close): After short writes, continue
9408 writing from the correct offset in the buffer being written.
9409
40fde488
CD
94102009-04-23 Chris Demetriou <cgd@google.com>
9411
9412 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9413 * configure: Regenerate.
9414 * config.in: Regenerate.
9415 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9416 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9417
3ce2c28e
ILT
94182009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9419
9420 * incremental.cc (Incremental_inputs_header_data): Renamed from
9421 Incremental_input_header_data.
9422 (Incremental_inputs_header_data::data_size): New field.
9423 (Incremental_inputs_header_data::put_input_file_count): Renamed
9424 from input_file_count.
9425 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9426 from command_line_offset.
9427 (Incremental_inputs_header_data::put_reserved): Renamed from
9428 put_reserved.
9429 (Incremental_inputs_entry_data): Renamed from
9430 Incremental_input_entry_data.
9431 (Incremental_inputs_entry_data::data_size): New field.
9432 (Incremental_inputs::report_command_line): New method.
9433 (Incremental_inputs::finalize): New method.
9434 (Incremental_inputs::create_incremental_inputs_data): New method.
9435 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9436 * incremental.h: New file.
9437 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9438 (Layout::finalize): Create incremental inputs section in
9439 incremental builds.
9440 (Layout::create_incremental_info_sections): New method.
9441 * layout.h (Layout::incremental_inputs): New method.
9442 (Layout::create_incremental_info_sections): New method.
9443 (Layout::incremental_inputs_): New field.
9444 * main.cc (main): Notify Incremental_input of the command line.
9445
e55bde5e
ILT
94462009-04-01 Ian Lance Taylor <iant@google.com>
9447 Mikolaj Zalewski <mikolajz@google.com>
9448
9449 * gold.h (reserve_unordered_map): Define, three versions, one for
9450 each version of Unordered_map.
9451 * layout.cc (Layout::Layout): Remove options parameter. Add
9452 number_of_input_files parameter. Don't initialize options_.
9453 Initialize number_of_input_files_ and resized_signatures_. Move
9454 sections_are_attached_.
9455 (Layout::layout_group): Reserve space for group_signatures_.
9456 (Layout::find_or_add_kept_section): Change name parameter to be a
9457 reference. Resize signatures_ map when it gets large enough.
9458 (Layout::layout_eh_frame): Use parameters->options() instead of
9459 this->options_.
9460 (Layout::make_output_section): Likewise.
9461 (Layout::attach_allocated_section_to_segment): Likewise.
9462 (Layout::finalize, Layout::create_executable_stack): Likewise.
9463 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9464 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9465 * layout.h (class Layout): Update declarations. Remove options_
9466 field. Add number_of_input_files_ and resized_signatures_
9467 fields. Move sections_are_attached_ field.
9468 * main.cc (main): Pass number of input files to Layout
9469 constructor. Don't pass options.
9470
154b857c
ILT
94712009-03-30 Ian Lance Taylor <iant@google.com>
9472
9473 * ffsll.c (ffsll): Correct implementation.
9474
2f35ab9b
ILT
94752009-03-27 Ian Lance Taylor <iant@google.com>
9476
fd03461a
ILT
9477 * ffsll.c: New file.
9478 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9479 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9480 * ftruncate.c (ftruncate): Declare before definition.
9481 * mremap.c (mremap): Likewise.
9482 * pread.c (pread): Likewise.
9483 * configure, Makefile.in, config.in: Rebuild.
9484
2f35ab9b
ILT
9485 * mremap.c: New file.
9486 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9487 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9488 (mremap): Declare if HAVE_MREMAP is not defined.
9489 * configure, Makefile.in, config.in: Rebuild.
9490
33aea2fd
CC
94912009-03-27 Cary Coutant <ccoutant@google.com>
9492
9493 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9494 position independent.
9495 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9496 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9497
6d479619
CC
94982009-03-24 Cary Coutant <ccoutant@google.com>
9499
9500 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9501 an executable.
9502 (needs_dynamic_reloc): Likewise.
9503
afc06bb8
ILT
95042009-03-24 Ian Lance Taylor <iant@google.com>
9505
9506 * yyscript.y (file_cmd): Recognize EXTERN.
9507 (extern_name_list, extern_name_list_body): New nonterminals.
9508 * script.cc (script_add_extern): Define.
9509 * script-c.h (script_add_extern): Declare.
9510
f6060a4d
ILT
95112009-03-24 Rafael Avila de Espindola <espindola@google.com>
9512
9513 * object.cc (is_elf_object): Define.
9514 * object.h (is_elf_object): Declare.
9515 * archive.cc (Archive::get_elf_object_for_member): Call
9516 is_elf_object.
33aea2fd 9517 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 9518
26736d8e
ILT
95192009-03-24 Elliott Hughes <enh@google.com>
9520
9521 * output.cc (Output_file::map_anonymous): Define.
9522 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9523 try an anonymous one. Report the size if the mmap fails.
9524 * output.h (class Output_file): Declare map_anonymous.
9525
22fd9730
ILT
95262009-03-24 Ian Lance Taylor <iant@google.com>
9527
9528 * target-select.cc (instantiate_target): Don't acquire the lock if
9529 the instantiated_target_ field has already been set.
9530
cb010894
ILT
95312009-03-23 Ian Lance Taylor <iant@google.com>
9532
7f055c20
ILT
9533 * gold-threads.h (class Initialize_lock): Define.
9534 * gold-threads.cc (class Initialize_lock_once): Define.
9535 (initialize_lock_control): New static variable.
9536 (initialize_lock_pointer): New static variable.
9537 (initialize_lock_once): New static function.
9538 (Initialize_lock::Initialize_lock): Define.
9539 (Initialize_lock::initialize): Define.
9540 * target-select.h: Include "gold-threads.h".
9541 (class Target_selector): Add lock_ and initialize_lock_ fields.
9542 Don't define instantiate_target, just declare it.
9543 * target-select.cc (Target_selector::Target_selector): Initialize
9544 new fields.
9545 (Target_selector::instantiate_target): Define.
9546 * descriptors.h: Include "gold-threads.h".
9547 (class Descriptors): Add initialize_lock_ field.
9548 * descriptors.cc (Descriptors::Descriptors): Initialize new
9549 field.
9550 (Descriptors::open): Use initialize_lock_ field
9551 * errors.h (class Errors): Add initialize_lock_ field.
9552 * errors.cc (Errors::Errors): Initialize new field.
9553 (Errors::initialize_lock): Use initialize_lock_ field.
9554 * powerpc.cc (class Target_selector_powerpc): Remove
9555 instantiated_target_ field. In do_recognize call
9556 instantiate_target rather than do_instantiate_target. In
9557 do_instantiate_target just allocate a new target.
9558 * sparc.cc (class Target_selector_sparc): Likewise.
9559
36959681
ILT
9560 * freebsd.h: New file.
9561 * i386.cc: Include "freebsd.h".
9562 (Target_i386): Derive from Target_freebsd rather than
9563 Sized_target.
9564 (Target_selector_i386): Derive from Target_selector_freebsd rather
9565 than Target_selector.
9566 * x86_64.cc: Include "freebsd.h".
9567 (Target_x86_64): Derive from Target_freebsd rather than
9568 Sized_target.
9569 (Target_selector_x86_64): Derive from Target_selector_freebsd
9570 rather than Target_selector.
9571 * target.h (class Target): Add adjust_elf_header and
9572 do_adjust_elf_header.
9573 * output.cc (Output_file_header:: do_sized_write): Call target
9574 adjust_elf_header routine.
9575 * configure.tgt: Set targ_osabi.
9576 * configure.ac: Define GOLD_DEFAULT_OSABI.
9577 * parameters.cc (Parameters::default_target): Pass
9578 GOLD_DEFAULT_OSABI to select_target.
9579 * target-select.h (class Target_selector): Make instantiate_target
9580 protected rather than private.
9581 * Makefile.am (HFILES): Add freebsd.h.
9582 * configure, Makefile.in, config.in: Rebuild.
9583
cb010894
ILT
9584 * merge.cc (do_add_input_section): Correct pend value. Change
9585 message about last entry not being null terminated from error to
9586 warning.
9587
0e879927
ILT
95882009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9589
9590 * incremental.cc: New file.
9591 * Makefile.am (CCFILES): Add incremental.cc.
9592 * Makefile.in: Rebuild.
9593
41105937
PP
95942009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9595
9596 * layout.cc (Layout::output_section_name): Preserve names
9597 of '.note.' sections.
e1df38aa 9598
60439920
ILT
95992009-03-19 Ian Lance Taylor <iant@google.com>
9600
9601 * descriptors.cc (Descriptors::open): Check that the options are
9602 valid before using them.
9603
0d371ad3
ILT
96042009-03-18 Ian Lance Taylor <iant@google.com>
9605
9606 * script-sections.h: Include <list>.
9607 (class Script_sections): Change Sections_elements from std::vector
9608 to std::list. Typedef public Elements_iterator. Add
9609 orphan_section_placement_, data_segment_align_start_, and
9610 saw_data_segment_align_ fields. Remove data_segment_align_index_
9611 field.
9612 * script-sections.cc (class Orphan_section_placement): New class.
9613 (class Sections_element): Add virtual functions is_relro and
9614 orphan_section_init. Remove virtual function place_orphan_here.
9615 (class Output_section_definition): Add is_relro and
9616 orphan_section_init. Remove place_orphan_here.
9617 (class Orphan_output_section): Likewise.
9618 (Script_sections::Script_sections): Update for field changes.
9619 (Script_sections::data_segment_align): Set saw_data_segment_align_
9620 and data_segment_align_start_, not data_segment_align_index.
9621 (Script_sections::data_segment_relro_end): Check
9622 saw_data_segment_align_. Use data_segment_align_start_ rather
9623 than data_segment_align_index_.
9624 (Script_sections::place_orphan): Rewrite to use
9625 Orphan_section_placement.
9626
9201d894
ILT
96272009-03-17 Ian Lance Taylor <iant@google.com>
9628
9c5b8369
ILT
9629 * archive.cc (Archive::add_symbols): Check for a version attached
9630 to the symbol name in the archive map.
9631 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9632 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9633 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9634 (ver_test_11.a): New target.
9635 * testsuite/Makefile.in: Rebuild.
9636
9201d894
ILT
9637 * configure.ac: Check for chsize and posix_fallocate. Replace
9638 ftruncate.
9639 * ftruncate.c: New file, from gnulib.
9640 * output.cc (posix_fallocate): Define dummy version if not
9641 HAVE_POSIX_FALLOCATE.
9642 (Output_file::map): Call posix_fallocate rather than lseek and
9643 write.
9644 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9645 * configure, Makefile.in, config.in: Rebuild.
9646
ef4ab7a8 96472009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 9648
ef4ab7a8
PP
9649 * layout.h (Layout::create_note): Add section_name parameter.
9650 * layout.cc (Layout::create_note): Likewise.
9651 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 9652
8c500701
ILT
96532009-03-17 Ian Lance Taylor <iant@google.com>
9654
e85b18e1
ILT
9655 * descriptors.cc: Include "options.h".
9656 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9657 (Descriptors::open): Always use O_CLOEXEC when opening a new
9658 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9659 then set FD_CLOEXEC.
9660
9efe6174
ILT
9661 * sparc.cc (class Target_sparc): Add has_got_section.
9662 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9663 make sure we have a GOT section.
9664
9665 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9666 (Target_sparc::Scan::local): Likewise.
9667 (Target_sparc::Scan::global): Likewise.
9668 (Target_sparc::Relocate::relocate): Likewise.
9669 (Target_sparc::Relocate::relocate_tls): Likewise.
9670
8c500701
ILT
9671 * symtab.cc (Symbol_table::define_default_version): New function,
9672 broken out of add_from_object.
9673 (Symbol_table::add_from_object): Call define_default_version.
9674 (Symbol_table::define_special_symbol): Add resolve_oldsym
9675 parameter. Change all callers. If the version for a symbol comes
9676 from a version script, resolve it with the symbol with the same
9677 name with no version. Also add the symbol without a version if
9678 appropriate.
9679 (do_define_in_output_data): If resolving with oldsym, don't delete
9680 sym.
9681 (do_define_in_output_segment): Likewise.
9682 (do_define_as_constant): Likewise.
9683 * symtab.h (class Symbol_table): Update declarations.
9684
f1ed28fb
ILT
96852009-03-13 Ian Lance Taylor <iant@google.com>
9686
15f8229b
ILT
9687 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9688 (Read_symbols::requeue): New function.
9689 (Read_symbols::do_read_symbols): If make_elf_object fails because
9690 the target type is not configured, and the file was searched for,
9691 issue a warning and retry with the next directory.
9692 (Add_symbols::run): If the file has an incompatible format, and
9693 it was searched for, requeue the Read_symbols task. On error,
9694 release the object.
9695 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9696 dirindex parameter to constructor. Change all callers. Declare
9697 incompatible_warning and requeue.
9698 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9699 input_argument_ and input_group_ fields. Add them to
9700 constructor. Change all callers.
9701 (class Read_script): Add dirindex_ field. Add it to constructor.
9702 Change all callers.
9703 * archive.cc (Archive::setup): Remove input_objects parameter.
9704 Change all callers.
9705 (Archive::get_file_and_offset): Likewise.
9706 (Archive::read_all_symbols): Likewise.
9707 (Archive::read_symbols): Likewise.
9708 (Archive::get_elf_object_for_member): Remove input_objects
9709 parameter. Add punconfigured parameter. Change all callers.
9710 (Archive::add_symbols): Change return type to bool. Check return
9711 value of include_member.
9712 (Archive::include_all_members): Likewise.
9713 (Archive::include_member): Change return type to bool. Return
9714 false if first included object has incompatible target. Set
9715 included_member_ field.
9716 (Add_archive_symbols::run): If add_symbols returns false, requeue
9717 Read_symbols task.
9718 * archive.h (class Archive): Add included_member_ field.
9719 Initialize it in constructor. Add input_file and searched_for
9720 methods. Update declarations.
9721 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9722 input_argument_ fields. Add them to constructor. Change all
9723 callers.
9724 * script.cc: Include "target-select.h".
9725 (class Parser_closure): Add skip_on_incompatible_target_ and
9726 found_incompatible_target_ fields. Add
9727 skip_on_incompatible_target parameter to constructor. Change all
9728 callers. Add methods skip_on_incompatible_target,
9729 clear_skip_on_incompatible_target, found_incompatible_target, and
9730 set_found_incompatible_target.
9731 (read_input_script): Add dirindex parameter. Change all callers.
9732 If parser finds an incompatible target, requeue Read_symbols
9733 task.
9734 (script_set_symbol): Clear skip_on_incompatible_target in
9735 closure.
9736 (script_add_assertion, script_parse_option): Likewise.
9737 (script_start_sections, script_add_phdr): Likewise.
9738 (script_check_output_format): New function.
9739 * script.h (read_input_script): Update declaration.
9740 * script-c.h (script_check_output_format): Declare.
9741 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9742 (ignore_cmd): Remove OUTPUT_FORMAT.
9743 * fileread.cc (Input_file::Input_file): Add explicit this.
9744 (Input_file::will_search_for): New function.
9745 (Input_file::open): Add pindex parameter. Change all callers.
9746 * fileread.h (class Input_file): Add input_file_argument method.
9747 Declare will_search_for. Update declarations.
9748 * object.cc (make_elf_object): Add punconfigured parameter.
9749 Change all callers.
9750 * object.h (class Object): Make input_file public. Add
9751 searched_for method.
9752 (make_elf_object): Update declaration.
9753 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9754 restart search.
9755 * dirsearch.h (class Dirsearch): Update declaration.
9756 * options.h (class General_options): Add --warn-search-mismatch.
9757 * parameters.cc (Parameters::is_compatible_target): New function.
9758 * parameters.h (class Parameters): Declare is_compatible_target.
9759 * workqueue.cc (Workqueue::add_blocker): New function.
9760 * workqueue.h (class Workqueue): Declare add_blocker.
9761
f1ed28fb
ILT
9762 * fileread.cc (Input_file::open): Remove options parameter.
9763 Change all callers.
9764 (Input_file::open_binary): Likewise.
9765 * script.cc (read_input_script): Likewise.
9766 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9767 options parameter from constructor. Change all callers.
9768 (class Read_script): Likewise.
9769 * fileread.h (class Input_file): Update declarations.
9770 * script.h (read_input_script): Update declaration.
9771
34dd024a
NC
97722009-03-10 Nick Clifton <nickc@redhat.com>
9773
9774 * po/es.po: New Spanish translation.
9775
6d71b17c
CC
97762009-03-06 Cary Coutant <ccoutant@google.com>
9777
9778 * options.cc (parse_short_option): Keep dash_z from registering itself.
9779
031cdbed
ILT
97802009-03-03 Ian Lance Taylor <iant@google.com>
9781
9782 PR 9918
9783 * target-reloc.h (relocate_section): Pass output_section to
9784 relocate.
9785 * i386.cc (Target_i386::should_apply_static_reloc): Add
9786 output_section parameter. Change all callers.
9787 (Target_i386::Relocate::relocate): Add output_section parameter.
9788 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9789 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9790 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9791 * testsuite/two_file_shared.sh: New script.
9792 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9793 (check_DATA): Add two_file_shared.dbg.
9794 (two_file_shared.dbg): New target.
9795 * testsuite/Makefile.in: Rebuild.
9796
15d5fa16
ILT
97972009-03-01 Ian Lance Taylor <iant@google.com>
9798
9799 * configure.ac: Check for byteswap.h.
9800 * configure: Rebuild.
9801 * config.in: Rebuild.
9802
8a4c0b0d
ILT
98032009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9804
9805 * layout.cc (Layout::find_or_add_kept_section): New function.
9806 (Layout::add_comdat): Removed.
9807 * layout.h (struct Kept_section): Move out of class Layout.
9808 Remove trailing underscores from field names. Add group_sections
9809 field. Rename group_ field to is_group. Change all uses.
9810 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9811 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9812 comdat_groups_ field.
9813 (Sized_relobj::include_section_group): Use
9814 find_or_add_kept_section and Kept_section::group_sections.
9815 (Sized_relobj::include_linkonce_section): Likewise.
9816 * object.cc (class Sized_relobj): Don't define Comdat_group or
9817 Comdat_group_table. Remove find_comdat_group and
9818 add_comdat_group. Remove comdat_groups_ field.
9819 * plugin.cc (include_comdat_group): Use
9820 Layout::find_or_add_kept_section.
9821
b4ecf66b
ILT
98222009-02-28 Ian Lance Taylor <iant@google.com>
9823
14359ca0
ILT
9824 * README: --gc-sections and map files are now supported. Document
9825 some build requirements.
9826
b4ecf66b
ILT
9827 PR 6992
9828 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9829 relocatable link set the value of the section symbol to zero.
9830 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9831 relocatable link don't include the section address in the local
9832 symbol value.
9833
0602e05a
ILT
98342009-02-27 Ian Lance Taylor <iant@google.com>
9835
fd9d194f
ILT
9836 PR 6811
9837 * options.h (class Search_directory): Add is_system_directory.
9838 (class General_options): Declare is_in_system_directory.
9839 * options.cc (get_relative_sysroot): Make static.
9840 (get_default_sysroot): Make static.
9841 (General_optoins::is_in_system_directory): New function.
9842 * fileread.cc (Input_file::is_in_system_directory): New function.
9843 * fileread.h (class Input_file): Declare is_in_system_directory.
9844 * object.h (class Object): Add is_in_system_directory.
9845 (class Input_objects): Remove system_library_directory_ field.
9846 * object.cc (Input_objects::add_object): Don't set
9847 system_library_directory_.
9848 (input_objects::found_in_system_library_directory): Remove.
9849 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9850 parameter. Change all callers.
9851 (Symbol_table::sized_write_globals): Likewise.
9852 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9853 Call Object::is_in_system_directory.
9854 * symtab.h (class Symbol_table): Update declarations.
9855
61edd21f
ILT
9856 PR 5990
9857 * descriptors.h (Open_descriptor): Add is_on_stack field.
9858 * descriptors.cc (Descriptors::open): If the descriptor is on the
9859 top of the stack, remove it. Initialize is_on_stack field.
9860 (Descriptors::release): Only add pod to stack if it is not on the
9861 stack already.
9862 (Descriptors::close_some_descriptor): Clear stack_next and
9863 is_on_stack fields.
9864
e29e076a
ILT
9865 PR 7091
9866 * output.cc (Output_section::find_starting_output_address): Rename
9867 from starting_output_address; add PADDR parameter; change return
9868 type.
9869 * output.h (class Output_section): Declare
9870 find_starting_output_address instead of starting_output_address.
9871 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9872 section symbol for which we can't find a merge section.
9873
0602e05a
ILT
9874 PR 9836
9875 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9876 hidden or internal, force the symbol to be local.
9877 * resolve.cc (Symbol::override_visibility): Define.
9878 (Symbol::override_base): Use override_visibility.
9879 (Symbol_table::resolve): Likewise.
9880 (Symbol::override_base_with_special): Likewise.
9881 (Symbol_table::override_with_special): If the visibility is hidden
9882 or internal, force the symbol to be local.
9883 * symtab.h (class Symbol): Add set_visibility and
9884 override_visibility.
9885 * testsuite/ver_test_1.sh: New file.
9886 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9887 (check_DATA): Add ver_test_1.syms.
9888 (ver_test_1.syms): New target.
9889 * testsuite/Makefile.in: Rebuild.
9890
401a9a73
CC
98912009-02-25 Cary Coutant <ccoutant@google.com>
9892
9893 * layout.cc (Layout::choose_output_section): Don't rename sections
9894 when using a linker script that has a SECTIONS clause.
9895 * Makefile.in: Regenerate.
9896
9897 * testsuite/Makefile.am (script_test_5.sh): New test case.
9898 * testsuite/Makefile.in: Regenerate.
9899 * testsuite/script_test_5.cc: New file.
9900 * testsuite/script_test_5.sh: New file.
9901 * testsuite/script_test_5.t: New file.
9902
f488e4b0
CC
99032009-02-13 Rafael Avila de Espindola <espindola@google.com>
9904
9905 * archive.cc (Archive::include_member): Update calls to add_symbols.
9906 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9907 the Layout argument.
9908 * dynobj.h (do_add_symbols): Add the Layout argument.
9909 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9910 Layout argument.
9911 * object.h (Object::add_symbols): Add the Layout argument.
9912 (Object::do_add_symbols): Add the Layout argument.
9913 (Sized_relobj::do_add_symbols): Add the Layout argument.
9914 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9915 Unify the two versions.
9916 (Add_plugin_symbols): Remove.
9917 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9918 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9919 (Add_plugin_symbols): Remove.
9920 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9921 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9922 (Add_symbols::run): Make it work with Pulginobj.
9923
89dd1680
ILT
99242009-02-06 Ian Lance Taylor <iant@google.com>
9925
9926 * object.cc (Sized_relobj::do_layout): Make info message start
9927 with lower case letter.
9928
266d0a74
ILT
99292009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9930
602b464e
ILT
9931 * binary.cc: Fix file comment.
9932
266d0a74
ILT
9933 * options.h (enum Incremental_disposition): Define.
9934 (class General_options): Add new options: --incremental,
9935 --incremental_changed, --incremental_unchanged,
9936 --incremental_unknown. Add incremental_disposition_ and
9937 implicit_incremental_ fields.
9938 (General_options::incremental_disposition): New function.
9939 (class Position_dependent_options): Add incremental_disposition
9940 option.
9941 (Position_dependent_options::copy_from_options): Set incremental
9942 dispositions.
9943 * options.cc (General_options::parse_incremental_changed): New
9944 function.
9945 (General_options::parse_incremental_unchanged): New function.
9946 (General_options::parse_incremental_unknown): New function.
9947 (General_options::General_options): Initialize new fields
9948 incremental_disposition_ and implicit_incremental_.
9949 (General_options::finalize): Check for uasge of --incremental-*
9950 without --incremental.
9951
f073bbf7
CD
99522009-02-06 Chris Demetriou <cgd@google.com>
9953
9954 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9955 pointer and to report location as the file name associated with
9956 the symbol.
9957 (gold_undefined_symbol_at_location): New function to replace the
9958 old gold_undefined_symbol functionality.
9959 * target-reloc.h (relocate_section): Update to use
9960 gold_undefined_symbol_at_location.
9961 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9962 Call gold_undefined_symbol function rather than gold_error.
9963 * errors.h (Errors::undefined_symbol): Take location as a
9964 string, rather than calculating it from a relocation.
9965 * errors.cc (Errors::fatal): Print "fatal error:" before the
9966 formatted message.
9967 (Errors::error, Errors::error_at_location): Print "error: "
9968 before the formatted message.
9969 (Errors::undefined_symbol): Take location as a string, rather
9970 than calculating it from a relocation.
9971 (gold_undefined_symbol_at_location): New function akin to
9972 old gold_undefined_symbol, calculates location from relocation.
9973 (gold_undefined_symbol): Change to take only a Symbol pointer
9974 and to report location as the file name associated with the symbol.
9975 * testsuite/debug_msg.sh: Update for changed error messages.
9976 * testsuite/undef_symbol.sh: Likewise.
9977
8e94a90c
ILT
99782009-02-04 Duncan Sands <baldrick@free.fr>
9979
9980 PR 9812
9981 * reduced_debug_output.h
9982 (Output_reduced_debug_abbrev_section::failed): Use format for
9983 gold_warning.
9984 (Output_reduced_debug_info_section::faild): Likewise.
9985
88a0e15b
ILT
99862009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9987
9988 * script.cc (Lazy_demangler): New class.
9989 (Version_script_info::get_symbol_version_helper): Demangle a
9990 symbol only once.
9991
5efc7cd2
CC
99922009-01-29 Cary Coutant <ccoutant@google.com>
9993
9994 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9995 to __tls_get_addr.
9996 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9997
e0ebcf42
ILT
99982009-01-28 Ian Lance Taylor <iant@google.com>
9999
5efc7cd2 10000 * version.cc (version_string): Bump to 1.9.
75fe7426 10001
e0ebcf42
ILT
10002 * gold.h: Include <cstring> and <stdint.h>.
10003 * version.cc: Include <cstdio>.
10004 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10005 warning.
10006 * reduced_debug_output.cc (insert_into_vector): Rename from
10007 Insert_into_vector; change all callers. Use Swap_unaligned to
10008 avoid aliasing issue; remove union since it is unnecessary.
10009
8e2813be 100102009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
10011
10012 * Makefile.am (CCFILES): Add gc.cc.
10013 (HFILES): Add gc.h.
10014 * Makefile.in: Regenerate.
10015 * gold.cc (Gc_runner): New class.
10016 (queue_initial_tasks): Call garbage collection related tasks
10017 when corresponding options are invoked.
10018 (queue_middle_gc_tasks): New function.
10019 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10020 processed early before laying out sections during garbage collection.
10021 * gold.h (queue_middle_gc_tasks): New function.
10022 (is_prefix_of): Move from "layout.cc".
10023 * i386.cc (Target_i386::gc_process_relocs): New function.
10024 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10025 * main.cc (main): Create object of class "Garbage_collection".
10026 * object.cc (Relobj::copy_symbols_data): New function.
10027 (Relobj::is_section_name_included): New function.
e1df38aa
NC
10028 (Sized_relobj::do_layout): Allow this function to be called twice
10029 during garbage collection and defer layout of section during the
6d03d481
ST
10030 first call.
10031 * object.h (Relobj::get_symbols_data): New function.
10032 (Relobj::is_section_name_included): New function.
10033 (Relobj::copy_symbols_data): New function.
10034 (Relobj::set_symbols_data): New function.
10035 (Relobj::get_relocs_data): New function.
10036 (Relobj::set_relocs_data): New function.
10037 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10038 (Relobj::gc_process_relocs): New function.
10039 (Relobj::do_gc_process_relocs): New pure virtual function.
10040 (Relobj::sd_): New data member.
10041 (Sized_relobj::is_output_section_offset_invalid): New function.
10042 (Sized_relobj::do_gc_process_relocs): New function.
10043 * options.h (General_options::gc_sections): Modify to not be a no-op.
10044 (General_options::print_gc_sections): New option.
10045 * plugin.cc (Plugin_finish::run): Remove function call to
10046 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10047 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10048 * reloc.cc (Read_relocs::run): Add task to process relocs and
10049 determine unreferenced sections when doing garbage collection.
10050 (Gc_process_relocs): New class.
10051 (Sized_relobj::do_gc_process_relocs): New function.
10052 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10053 sections that are garbage collected.
10054 * reloc.h (Gc_process_relocs): New class.
10055 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10056 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10057 symbols whose corresponding sections are garbage collected.
10058 (Symbol_table::Symbol_table): Add new parameter for the garbage
10059 collection object.
10060 (Symbol_table::gc_mark_undef_symbols): New function.
10061 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10062 (Symbol_table::gc_mark_dyn_syms): New function.
10063 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10064 as garbage.
10065 (Symbol_table::add_from_object): Likewise.
10066 (Symbol_table::add_from_relobj): When building shared objects, do not
10067 treat externally visible symbols as garbage.
10068 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10069 table information for static and relocatable links.
10070 * symtab.h (Symbol_table::set_gc): New function.
10071 (Symbol_table::gc): New function.
10072 (Symbol_table::gc_mark_undef_symbols): New function.
10073 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10074 (Symbol_table::gc_mark_dyn_syms): New function.
10075 (Symbol_table::gc_): New data member.
e1df38aa 10076 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
10077 function.
10078 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10079 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10080
3b293544
CF
100812009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10082
10083 * options.h (General_options::gc_sections): Define as a no-op for now.
10084 (General_options::no_keep_memory): Ditto.
10085 (General_options::Bshareable): Define.
10086 * options.cc (General_options::finalize): Honor -Bshareable.
10087
83d22aa8
AS
100882009-01-20 Andreas Schwab <schwab@suse.de>
10089
10090 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10091 read the value in the contents, since we don't use it. Use the
10092 template endianness when writing.
10093 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10094
cd536b21
AS
100952009-01-19 Andreas Schwab <schwab@suse.de>
10096
10097 * configure.tgt (powerpc64-*): Fix targ_obj.
10098
99e9a495
ILT
100992009-01-15 Ian Lance Taylor <iant@google.com>
10100
10101 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10102 local symbols when stripping all symbols.
10103
bbbfea06
CC
101042009-01-14 Cary Coutant <ccoutant@google.com>
10105
99e9a495 10106 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 10107
0f7c0701
CC
101082009-01-14 Cary Coutant <ccoutant@google.com>
10109
10110 * archive.cc (Archive::get_elf_object_for_member): Remove call
10111 to File_read::claim_for_plugin.
10112 * descriptors.cc (Descriptors::open): Remove reference to
10113 is_claimed.
10114 (Descriptors::claim_for_plugin): Remove.
10115 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10116 (Descriptors::is_claimed): Remove.
10117 (claim_descriptor_for_plugin): Remove.
10118 * fileread.cc (File_read::claim_for_plugin): Remove.
10119 * fileread.h (File_read::claim_for_plugin): Remove.
10120 (File_read::descriptor): Reopen descriptor if necessary.
10121 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10122 (Plugin_manager::all_symbols_read): Add task parameter. Change
10123 all callers.
10124 (Plugin_manager::get_input_file): New function.
10125 (Plugin_manager::release_input_file): New function.
10126 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10127 corresponding data member.
10128 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10129 and pass to base constructor. Change all callers.
10130 (get_input_file, release_input_file): New functions.
10131 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10132 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10133 (Plugin_manager::all_symbols_read): Add task parameter.
10134 (Plugin_manager::get_input_file): New function.
10135 (Plugin_manager::release_input_file): New function.
10136 (Plugin_manager::task_): New data member.
10137 (Pluginobj::Pluginobj): Add filesize parameter.
10138 (Pluginobj::filename): New function.
10139 (Pluginobj::descriptor): New function.
10140 (Pluginobj::filesize): New function.
10141 (Pluginobj::filesize_): New data member.
10142 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10143 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10144 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10145
10146 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10147 with archive libraries.
10148 * testsuite/Makefile.in: Regenerate.
10149 * testsuite/plugin_test.c (struct sym_info): New type.
10150 (get_input_file, release_input_file): New static variables.
10151 (onload): Capture new transfer vector entries.
10152 (claim_file_hook): Stop reading at end of file according to filesize.
10153 Factor out parsing of readelf output into separate function.
10154 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10155 APIs and get the source file name from the symbol table. Convert
10156 source file name to corresponding object file name. Print info
10157 message when adding new input files.
10158 (parse_readelf_line): New function.
10159 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10160 * testsuite/plugin_test_2.sh: Likewise.
10161 * testsuite/plugin_test_3.sh: Likewise.
10162 * testsuite/plugin_test_4.sh: New test case.
10163
62a6d109
ILT
101642009-01-07 Ian Lance Taylor <iant@google.com>
10165
10166 * version.cc (version_string): Bump to 1.8.
10167
483620e8
CC
101682008-12-23 Cary Coutant <ccoutant@google.com>
10169
10170 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10171 * plugin.cc (Plugin_manager::finish): Rename as
10172 layout_deferred_objects. Move cleanup to separate function.
10173 (Plugin_manager::cleanup): New function.
10174 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10175 separately.
10176 * plugin.h (Plugin_manager::finish): Rename as
10177 layout_deferred_objects.
10178 (Plugin_manager::cleanup): New function.
10179 (Plugin_manager::cleanup_done): New field.
10180
d66a9eb3
CC
101812008-12-23 Cary Coutant <ccoutant@google.com>
10182
10183 * plugin.cc (is_visible_from_outside): New function.
10184 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10185 so we don't return "IR only" status for exported symbols or -r links.
10186
10187 * testsuite/Makefile.am (plugin_test_3): New test case.
10188 * testsuite/Makefile.in: Regenerate.
10189 * testsuite/plugin_test_3.sh: New file.
10190
5995b570
CC
101912008-12-22 Cary Coutant <ccoutant@google.com>
10192
10193 * object.cc (Sized_relobj::layout_section): New function.
10194 (Sized_relobj::do_layout): Defer layout of input sections until after
10195 plugin has provided replacement files.
10196 (Sized_relobj::do_layout_deferred_sections): New function.
10197 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10198 (Relobj::layout_deferred_sections): New function.
10199 (Relobj::do_layout_deferred_sections): New function.
10200 (Sized_relobj::do_layout_deferred_sections): New function.
10201 (Sized_relobj::layout_section): New function.
10202 (Sized_relobj::Deferred_layout): New structure.
10203 (Sized_relobj::deferred_layout_): New field.
10204 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10205 Change all callers. Layout deferred sections.
10206 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10207 references.
10208 (Plugin_hook::run): Move code from do_plugin_hook inline.
10209 (Plugin_hook::do_plugin_hook): Remove.
10210 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10211 (Plugin_manager::finish): Renamed, was cleanup.
10212 (Plugin_manager::should_defer_layout): New function.
10213 (Plugin_manager::add_deferred_layout_object): New function.
10214 (Plugin_manager::Deferred_layout_list): New type.
10215 (Plugin_manager::deferred_layout_objects_): New field.
10216 (Plugin_hook::do_plugin_hook): Remove.
10217
ee769c88
ILT
102182008-12-17 Ian Lance Taylor <iant@google.com>
10219
10220 * options.h (class General_options): Add --no case for
10221 --export-dynamic.
10222
abc8dcba
CC
102232008-12-16 Cary Coutant <ccoutant@google.com>
10224
10225 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10226 vector.
10227 (Plugin_manager::claim_file): Create plugin object even if
10228 plugin did not call the add_symbols callback.
10229 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10230 asking for more symbols than were added.
10231 * testsuite/Makefile.am (plugin_test_1): Add test case with
10232 no global symbols.
10233 (empty.syms): New target.
10234 * testsuite/Makefile.in: Regenerate.
10235 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10236 message. Don't call add_symbols if no globals.
10237 (all_symbols_read_hook): Don't provide replacement for empty
10238 claimed file.
10239
b0074644
ILT
102402008-12-12 Ian Lance Taylor <iant@google.com>
10241
68943102
ILT
10242 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10243 r_type == 0 for a local symbol with r_sym == 0.
10244 (scan_relocatable_relocs): Pass r_sym to
10245 local_non_section_strategy.
10246 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10247 r_sym parameter.
10248
b0074644
ILT
10249 * configure.ac: Update test for TLS descriptors: they are
10250 supported as of glibc 2.9.
10251 * configure: Rebuild.
10252
c2508178
ILT
102532008-12-11 Ian Lance Taylor <iant@google.com>
10254
10255 PR 7091
10256 * target-reloc.h (Default_scan_relocatable_relocs): For each
10257 function, map r_type == 0 to RELOC_DISCARD.
10258
2756a258
CC
102592008-12-10 Cary Coutant <ccoutant@google.com>
10260
10261 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10262 object to override a kept COMDAT group from a plugin object.
10263
bb6f53d3
ILT
102642008-12-09 Ian Lance Taylor <iant@google.com>
10265
fbc558e1
ILT
10266 PR 7088
10267 * yyscript.y (file_cmd): Handle INPUT.
10268
bb6f53d3
ILT
10269 * testsuite/initpri1.c: Change all declarations to be full
10270 prototypes by adding void, to avoid compiler warnings.
10271
4674ecfc
CC
102722008-12-05 Rafael Avila de Espindola <espindola@google.com>
10273
10274 * options.cc (General_options::parse_plugin_opt): New.
10275 (General_options::add_plugin): The argument now is just the filename.
10276 (General_options::add_plugin_option): New.
10277 * options.h (plugin_opt): New.
10278 (add_plugin): Change argument name.
10279 (add_plugin_option): New.
10280 * plugin.cc (Plugin::load): Don't parse the plugin option.
10281 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10282 (Plugin::add_option): New.
10283 (Plugin::args_): Change type.
10284 (Plugin::filename_): New.
10285 (Plugin_manager::add_plugin_option): New.
10286 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10287 * testsuite/Makefile.in: Regenerate.
10288
fd06b4aa
CC
102892008-12-05 Cary Coutant <ccoutant@google.com>
10290
10291 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10292 Handle --strip-lto-sections option.
10293 * options.h (strip_lto_sections): New option.
10294
6c52134c
CC
102952008-12-01 Cary Coutant <ccoutant@google.com>
10296
10297 * plugin.cc (ld_plugin_message): Change format parameter to const.
10298 Fix mismatch between new[] and delete.
10299
a45248e0
CC
103002008-11-14 Cary Coutant <ccoutant@google.com>
10301
10302 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10303 instead of -1U.
10304
c82fbeee
CS
103052008-11-05 Craig Silverstein <csilvers@google.com>
10306
10307 * options.cc (General_options::parse_dynamic_list): New function.
10308 * options.h (General_options): New flags dynamic_list,
10309 dynamic_list_data, dynamic_list_cpp_new, and
10310 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10311 (General_options::in_dynamic_list): New function.
10312 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10313 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10314 (Lex::can_continue_name): Likewise.
10315 (yylex): Likewise.
10316 (read_script_file): New parameter script_options.
10317 (read_dynamic_list): New function.
10318 (Script_options::define_dynamic_list): New function.
10319 (dynamic_list_keyword_parsecodes): New variable.
10320 (dynamic_list_keywords): New variable.
10321 * script.h (Script_options::define_dynamic_list): New function
10322 prototype.
10323 (read_dynamic_list): New function prototype.
10324 * symtab.cc (strprefix): New macro.
10325 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10326 dynamic_list_data, dynamic_list_cpp_new, and
10327 dynamic_list_cpp_typeinfo.
10328 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10329 (dynamic_list_expr): New rule.
10330 (dynamic_list_nodes): Likewise.
10331 (dynamic_list_node): Likewise.
10332 * testsuite/Makefile.am (dynamic_list): New test.
10333 * testsuite/Makefile.in: Regenerated.
10334 * testsuite/dynamic_list.t: New file.
10335 * testsuite/dynamic_list.sh: New file.
10336
e0bb29a5
CS
103372008-11-05 Craig Silverstein <csilvers@google.com>
10338
10339 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10340 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10341 (t11_last): Likewise.
10342 * testsuite/ver_test_6.c (main): Likewise.
10343
4e1e25e0
CC
103442008-10-07 Cary Coutant <ccoutant@google.com>
10345
10346 * options.c (General_options::finalize): Add check for -static and
10347 -shared.
10348 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10349 is not empty.
10350
92f03fcb
CC
103512008-10-02 Cary Coutant <ccoutant@google.com>
10352
10353 * plugin.cc (make_sized_plugin_object): Fix conditional
10354 compilation to work when not all targets are enabled.
10355
fbd8a257
CC
103562008-09-29 Cary Coutant <ccoutant@google.com>
10357
10358 * archive.cc (Archive::get_file_and_offset): Use filename instead
10359 of name to get library path.
10360 (Archive::include_member): Unlock external member of a thin archive.
10361
10362 * testsuite/Makefile.am (TEST_AR): New variable.
10363 (thin_archive_test_1): New test.
10364 (thin_archive_test_2): New test.
81636b3f
CC
10365 * testsuite/Makefile.in: Regenerate.
10366 * testsuite/thin_archive_main.cc: New file.
10367 * testsuite/thin_archive_test_1.cc: New file.
10368 * testsuite/thin_archive_test_2.cc: New file.
10369 * testsuite/thin_archive_test_3.cc: New file.
10370 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 10371
eff45813
CC
103722008-09-29 Cary Coutant <ccoutant@google.com>
10373
10374 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10375 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10376 instead of -1U.
10377 (Sized_relobj::do_finalize_local_symbols): Likewise.
10378 (Sized_relobj::map_to_kept_section): Likewise.
10379 * object.h (Sized_relobj::invalid_address): New constant.
10380 (Sized_relobj::do_output_section_offset): Check for invalid_address
10381 and return -1ULL.
10382 * output.cc (Output_reloc::local_section_offset): Use constant
10383 invalid_address instead of -1U.
10384 (Output_reloc::get_address): Likewise.
10385 (Output_section::output_address): Change -1U to -1ULL.
10386 * output.h (Output_reloc::invalid_address): New constant.
10387 * reloc.cc (Sized_relobj::write_sections): Use constant
10388 invalid_address instead of -1U.
10389 (Sized_relobj::relocate_sections): Likewise.
10390 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10391 values for merge sections.
10392 * target-reloc.h (relocate_for_relocatable): Use constant
10393 invalid_address instead of -1U.
10394
89fc3421
CC
103952008-09-19 Cary Coutant <ccoutant@google.com>
10396
10397 Add plugin functionality for link-time optimization (LTO).
10398 * configure.ac (plugins): Add --enable-plugins option.
10399 * configure: Regenerate.
10400 * config.in: Regenerate.
10401 * Makefile.am (LIBDL): New variable.
10402 (CCFILES): Add plugin.cc.
10403 (HFILES): Add plugin.h.
10404 (ldadd_var): Add LIBDL.
10405 * Makefile.in: Regenerate.
10406
10407 * archive.cc: Include "plugin.h".
10408 (Archive::setup): Don't preread archive symbols when using a plugin.
10409 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10410 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10411 files.
10412 (Archive::include_member): Add symbols from plugin objects.
10413 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10414 * descriptors.cc (Descriptors::open): Check for file descriptors
10415 abandoned by plugins.
10416 (Descriptors::claim_for_plugin): New function.
10417 * descriptors.h (Descriptors::claim_for_plugin): New function.
10418 (Open_descriptor::is_claimed): New field.
10419 (claim_descriptor_for_plugin): New function.
10420 * fileread.cc (File_read::claim_for_plugin): New function.
10421 * fileread.h (File_read::claim_for_plugin): New function.
10422 (File_read::descriptor): New function.
10423 * gold.cc: Include "plugin.h".
10424 (queue_initial_tasks): Add task to call plugin hooks for generating
10425 new object files.
10426 * main.cc: Include "plugin.h".
10427 (main): Load plugin libraries.
10428 * object.h (Pluginobj): Declare.
10429 (Object::pluginobj): New function.
10430 (Object::do_pluginobj): New function.
10431 (Object::set_target): New function.
10432 * options.cc: Include "plugin.h".
10433 (General_options::parse_plugin): New function.
10434 (General_options::General_options): Initialize plugins_ field.
10435 (General_options::add_plugin): New function.
10436 * options.h (Plugin_manager): Declare.
10437 (General_options): Add --plugin option.
10438 (General_options::has_plugins): New function.
10439 (General_options::plugins): New function.
10440 (General_options::add_plugin): New function.
10441 (General_options::plugins_): New field.
10442 * plugin.cc: New file.
10443 * plugin.h: New file.
10444 * readsyms.cc: Include "plugin.h".
10445 (Read_symbols::do_read_symbols): Check for archive before checking
10446 for ELF file. Call plugin hooks to claim files.
10447 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10448 from a real object file; force override when processing replacement
10449 files.
10450 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10451 (Symbol::init_base_object): Likewise.
10452 (Symbol::init_base_output_data): Likewise.
10453 (Symbol::init_base_output_segment): Likewise.
10454 (Symbol::init_base_constant): Likewise.
10455 (Symbol::init_base_undefined): Likewise.
10456 (Symbol::output_section): Assert that object is not a plugin.
10457 (Symbol_table::add_from_pluginobj): New function.
10458 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10459 undefined.
10460 (Symbol_table::sized_write_globals): Likewise.
10461 (Symbol_table::add_from_pluginobj): Instantiate template.
10462 * symtab.h (Sized_pluginobj): Declare.
10463 (Symbol::in_real_elf): New function.
10464 (Symbol::set_in_real_elf): New function.
10465 (Symbol::in_real_elf_): New field.
10466 (Symbol_table::add_from_pluginobj): New function.
10467
10468 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10469 (LIBDL): New variable.
10470 (LDADD): Add LIBDL.
10471 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10472 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10473 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10474 (MOSTLYCLEANFILES): Likewise.
10475 * testsuite/Makefile.in: Regenerate.
10476 * testsuite/plugin_test.c: New file.
10477 * testsuite/plugin_test_1.sh: New file.
10478 * testsuite/plugin_test_2.sh: New file.
10479
de31bda5
ILT
104802008-09-16 Ian Lance Taylor <iant@google.com>
10481
9c2d0ef9
ILT
10482 * target-reloc.h (relocate_section): Check whether a symbol is
10483 defined by the ABI before reporting an undefined symbol error.
10484 * target.h (Target::is_defined_by_abi): Make parameter const.
10485 (Target::do_is_defined_by_abi): Likewise.
10486 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10487 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10488 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10489 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10490 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10491 * testsuite/Makefile.in: Rebuild.
10492
de31bda5
ILT
10493 * fileread.cc (make_view): Add casts to avoid warning.
10494
9fa33bee
AO
104952008-09-16 Alexandre Oliva <aoliva@redhat.com>
10496
10497 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10498 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10499
183fd0e3
AO
105002008-09-16 Alexandre Oliva <aoliva@redhat.com>
10501
10502 * options.h (General_options::output_is_executable): New.
10503 (General_options::output_is_pie): New.
10504 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10505 for shared libraries.
10506 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10507
7be8330a
CD
105082008-09-11 Chris Demetriou <cgd@google.com>
10509
10510 * options.h (origin): New -z option.
10511 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10512 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10513 in DT_FLAGS_1.
10514
a9caad02
CC
105152008-09-05 Cary Coutant <ccoutant@google.com>
10516
10517 * fileread.cc (File_read::make_view): Add check for attempt to map
10518 beyond end of file.
10519
ae6dce4d
CC
105202008-09-05 Cary Coutant <ccoutant@google.com>
10521
10522 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10523 explicit instantiations.
10524
d7ab2a47
KVH
105252008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10526
10527 PR gold/6858
10528 * options.cc (General_options::finalize): Allow undefined symbols
10529 in shlibs if linking -shared.
10530
10531 PR gold/6859
10532 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10533 symbols as not needing a dynsym entry.
10534
1e52a9c1
CS
105352008-08-20 Craig Silverstein <csilvers@google.com>
10536
10537 * fileread.cc (File_read::open): Do not lock the file unless it
10538 was successfully opened.
10539
d85c80a3
CC
105402008-08-14 Cary Coutant <ccoutant@google.com>
10541
10542 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10543 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10544 * testsuite/tls_test.cc (struct int128): 128-bit struct
10545 for testing TLS relocs with non-zero addend.
10546 (v12): New TLS variable.
10547 (t12): New test.
10548 (t_last): Add check for v12.
10549 * testsuite/tls_test.h (t12): New function.
10550 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10551
2d924fd9
ILT
105522008-08-13 Ian Lance Taylor <iant@google.com>
10553
10554 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10555 set tls_segment_ or relro_segment_.
10556 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10557 when appropriate.
10558 * output.h (Output_section::clear_is_relro): New function.
10559 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10560 sections specially even when output_data_ is empty.
10561 (Output_segment::maximum_alignment): When first section is relro,
10562 only force alignment for PT_LOAD segments.
10563 * script.cc (script_data_segment_align): New function.
10564 (script_data_segment_relro_end): New function.
10565 * script-c.h (script_data_segment_align): Declare.
10566 (script_data_segment_relro_end): Declare.
10567 * script-sections.h (class Script_sections): Declare
10568 data_segment_align and data_segment_relro_end. Add fields
10569 segment_align_index_ and saw_relro_end_.
10570 * script-sections.cc (class Sections_element): Add set_is_relro
10571 virtual function. Add new bool* parameter to place_orphan_here.
10572 Add get_output_section virtual function.
10573 (class Output_section_definition): Add set_is_relro. Add new
10574 bool* parameter to place_orphan_here. Add get_output_section.
10575 Add is_relro_ field.
10576 (Output_section_definition::Output_section_definition): Initialize
10577 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10578 and is_relro_ fields.
10579 (Output_section_definition::place_orphan_here): Add is_relro
10580 parameter.
10581 (Output_section_definition::set_section_addresses): Set relro for
10582 output section.
10583 (Output_section_definition::alternate_constraint): Likewise.
10584 (class Orphan_output_section): Add new bool* parameter to
10585 place_orphan_here. Add get_output_section.
10586 (Orphan_output_section::place_orphan_here): Add is_relro
10587 parameter.
10588 (Script_sections::Script_sections): Initialize
10589 data_segment_align_index_ and saw_relro_end_.
10590 (Script_sections::data_segment_align): New function.
10591 (Script_sections::data_segment_relro_end): New function.
10592 (Script_sections::place_orphan): Set or clear is_relro.
10593 (Script_sections::set_section_addresses): Force alignment of first
10594 TLS section.
10595 * yyscript.y (exp): Call script_data_segment_align and
10596 script_data_segment_relro_end.
10597 * testsuite/relro_script_test.t: New file.
10598 * testsuite/relro_test.cc (using_script): Declare.
10599 (t1, t2): Test using_script.
10600 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10601 (relro_script_test_SOURCES): Define.
10602 (relro_script_test_DEPENDENCIES): Define.
10603 (relro_script_test_LDFLAGS): Define.
10604 (relro_script_test_LDADD): Define.
10605 (relro_script_test.so): New target.
10606 * testsuite/Makefile.in: Rebuild.
10607
f827c9a9
CC
106082008-08-06 Cary Coutant <ccoutant@google.com>
10609
10610 * archive.cc (Archive::total_archives, Archive::total_members)
10611 (Archive::total_members_loaded): New variables.
10612 (Archive::setup): Add parameter. Add option to preread
10613 archive symbols.
10614 (Archive::read_armap): Add counter.
10615 (Archive::get_file_and_offset): New function.
10616 (Archive::get_elf_object_for_member): New function.
10617 (Archive::read_all_symbols): New function.
10618 (Archive::read_symbols): New function.
10619 (Archive::add_symbols): Add counters.
10620 (Archive::include_all_members): Use armap to find members if it's
10621 already built.
10622 (Archive::include_member): Skip reading symbols if already read.
10623 Factored code into Archive::get_file_and_offset and
10624 Archive::get_elf_object_for_member. Changed call to
10625 Mapfile::report_include_archive_member.
10626 (Archive::print_stats): New function.
10627 * archive.h: Declare Object and Read_symbols_data classes.
10628 (Archive::Archive): Add initializers for new members.
10629 (Archive::setup): Add parameter.
10630 (Archive::print_stats): New function.
10631 (Archive::total_archives, Archive::total_members)
10632 (Archive::total_members_loaded): New variables.
10633 (Archive::get_file_and_offset): New function.
10634 (Archive::get_elf_object_for_member): New function.
10635 (Archive::read_all_symbols): New function.
10636 (Archive::read_symbols): New function.
10637 (Archive::Archive_member): New class.
10638 (Archive::members_): New member.
10639 (Archive::num_members_): New member.
10640 * main.cc: Include archive.h.
10641 (main): Call Archive::print_stats.
10642 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10643 archive parameter; member_name is now the fully-decorated name.
10644 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10645 * options.h: (General_options): Add --preread-archive-symbols option.
10646 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10647 Archive::setup.
10648
de4c45bd
ILT
106492008-08-04 Ian Lance Taylor <iant@google.com>
10650
10651 * symtab.h (Symbol::use_plt_offset): New function.
10652 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10653 * powerpc.cc (Relocate::relocate): Likewise.
10654 * sparc.cc (Relocate::relocate): Likewise.
10655 * x86_64.cc (Relocate::relocate): Likewise.
10656 * testsuite/weak_plt.sh: New test.
10657 * testsuite/weak_plt_main.cc: New test.
10658 * testsuite/weak_plt_shared.cc: New test.
10659 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10660 (check_PROGRAMS): Add weak_plt.
10661 (check_DATA): Add weak_plt_shared.so.
10662 (weak_plt_main_pic.o, weak_plt): New targets.
10663 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10664 * testsuite/Makefile.in: Rebuild.
10665
10666 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10667 gcctestdir/ld.
10668 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10669 * testsuite/Makefile.in: Rebuild.
10670
323ee3f4
AM
106712008-08-04 Alan Modra <amodra@bigpond.net.au>
10672
10673 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10674 * Makefile.in: Regenerate.
10675 * po/POTFILES.in: Regenerate.
10676
7c07ecec
ILT
106772008-07-29 Ian Lance Taylor <iant@google.com>
10678
10679 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10680 symbols before other symbols.
10681 * testsuite/script_test_2.cc (test_addr): Declare.
10682 (test_addr_alias): Declare.
10683 (main): Check that test_addr and test_addr_alias have the right
cd536b21 10684 values.
7c07ecec
ILT
10685 * testsuite/script_test_2.t: Define test_addr_alias and
10686 test_addr.
10687
5778530e
ILT
106882008-07-24 Ian Lance Taylor <iant@google.com>
10689
2a00e4fb
ILT
10690 PR 5990
10691 * descriptors.cc: New file.
10692 * descriptors.h: New file.
10693 * gold-threads.h (class Hold_optional_lock): New class.
10694 * fileread.cc: Include "descriptors.h".
10695 (File_read::~File_read): Release descriptor rather than closing
10696 it.
10697 (File_read::open) [file]: Call open_descriptor rather than open.
10698 Set is_descriptor_opened_.
10699 (File_read::open) [memory]: Assert that descriptor is not open.
10700 (File_read::reopen_descriptor): New function.
10701 (File_read::release): Release descriptor.
10702 (File_read::do_read): Make non-const. Reopen descriptor.
10703 (File_read::read): Make non-const.
10704 (File_read::make_view): Reopen descriptor.
10705 (File_read::do_readv): Likewise.
10706 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10707 Update declarations.
10708 * layout.cc: Include "descriptors.h".
10709 (Layout::create_build_id): Use open_descriptor rather than open.
10710 * output.cc: Include "descriptors.h".
10711 (Output_file::open): Use open_descriptor rather than open.
10712 * archive.cc (Archive::const_iterator): Change Archive to be
10713 non-const.
10714 (Archive::begin, Archive::end): Make non-const.
10715 (Archive::count_members): Likewise.
10716 * archive.h (class Archive): Update declarations.
10717 * object.h (Object::read): Make non-const.
10718 * Makefile.am (CCFILES): Add descriptors.cc.
10719 (HFILES): Add descriptors.h.
10720 * Makefile.in: Rebuild.
10721
801647d1
ILT
10722 PR 6716
10723 * gold.h: Always include <clocale>. Add Solaris workarounds
10724 following code in binutils/sysdep.h.
10725
5edd166e
ILT
10726 PR 6048
10727 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10728 this->eh_frame_hdr_ is NULL before using it.
10729
c89ad728
ILT
10730 * dynobj.cc (Versions::Versions): Update comment.
10731
aa86f06b
ILT
10732 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10733 the base version name.
10734
5778530e
ILT
10735 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10736 array size plus one.
10737 (Stringpool_template::set_string_offsets): Subtract one from key
10738 before using it as an array index.
10739 (Stringpool_template::get_offset_with_length): Likewise.
10740 (Stringpool_template::write_to_buffer): Likewise.
10741 * stringpool.h (Stringpool_template::get_offset_from_key):
10742 Likewise.
10743
057ead22
ILT
107442008-07-23 Ian Lance Taylor <iant@google.com>
10745
7f649c59
ILT
10746 PR 6658
10747 * object.h (Merged_symbol_value::value): Do our best to handle a
10748 negative addend.
10749
057ead22
ILT
10750 PR 6647
10751 * script.cc (Version_script_info::get_versions): Don't add empty
10752 version tag to return value.
10753 (Version_script_info::get_symbol_version_helper): Change return
10754 type to bool. Add pversion parameter. Change all callers.
10755 (script_register_vers_node): Don't require a non-NULL tag.
10756 * script.h (class Version_script_info): Update declarations.
10757 (Version_script_info::get_symbol_version): Change return type to
10758 bool. Add version parameter. Change all callers.
10759 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10760 handling. Handle an empty version from a version script.
10761 (Symbol_table::define_special_symbol): Likewise.
10762 * testsuite/ver_test_10.script: New file.
10763 * testsuite/ver_test_10.sh: New file.
10764 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10765 (check_DATA): Add ver_test_10.syms.
10766 (ver_test_10.syms, ver_test_10.so): New target.
10767 * testsuite/Makefile.in: Rebuild.
10768
58e54ac2
CD
107692008-07-23 Simon Baldwin <simonb@google.com>
10770
10771 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10772 to zero for undefined symbols from dynamic libraries.
10773
95d14cd3
ILT
107742008-07-23 Ian Lance Taylor <iant@google.com>
10775
10776 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10777 Change all callers.
10778 * symtab.h (class Symbol_table): Update declaration.
10779 * testsuite/ver_test_9.cc: New file.
10780 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10781 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10782 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10783 (ver_test_9.so, ver_test_9.o): New targets.
10784 * testsuite/Makefile.in: Rebuild.
10785
92de84a6
ILT
107862008-07-22 Ian Lance Taylor <iant@google.com>
10787
34810851
ILT
10788 * options.h (class General_options): Define --check-sections.
10789 * layout.cc (Layout::set_segment_offsets): Handle
10790 --check-sections.
10791
af6156ef
ILT
10792 * options.h (class General_options): Define -n/--nmagic and
10793 -N/--omagic.
10794 * options.cc (General_options::finalize): For -n/--nmagic or
10795 -N/--omagic, set -static.
10796 * layout.cc (Layout::attach_allocated_section_to_segment): If
10797 -N/--omagic, don't put read-only and read-write sections in
10798 different segments.
10799 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10800 finding a read-only segment.
10801 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10802 don't set the minimum segment alignment to the common page size,
10803 and don't set the file offset to the address modulo the page size.
10804 * script-sections.cc (Script_sections::create_segments): If
10805 -n/--omagic, don't put read-only and read-write sections in
10806 different segments.
10807
92de84a6
ILT
10808 * cref.cc: New file.
10809 * cref.h: New file.
10810 * options.h (class General_options): Add --print-symbol-counts.
10811 * main.cc (main): Issue defined symbol report if requested.
10812 * archive.cc (Archive::interpret_header): Make into a const member
10813 function.
10814 (Archive::add_symbols): Call Input_objects::archive_start and
10815 archive_stop.
10816 (Archive::const_iterator): Define new class.
10817 (Archive::begin, Archive::end): New functions.
10818 (Archive::include_all_members): Rewrite to use iterator.
10819 (Archive::count_members): New function.
10820 * archive.h (class Archive): Update declarations.
10821 (Archive::filename): New function.
10822 * object.cc: Include "cref.h".
10823 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10824 (Sized_relobj::do_get_global_symbol_counts): New function.
10825 (Input_objects::add_object): Add object to cross-referencer.
10826 (Input_objects::archive_start): New function.
10827 (Input_objects::archive_stop): New function.
10828 (Input_objects::print_symbol_counts): New function.
10829 * object.h: Declare Cref and Archive.
10830 (Object::get_global_symbol_counts): New function.
10831 (Object::do_get_global_symbol_counts): New pure virtual function.
10832 (class Sized_relobj): Add defined_count_ field. Update
10833 declarations.
10834 (class Input_objects): Add cref_ field. Update constructor.
10835 Update declarations.
10836 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10837 defined_count_.
10838 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10839 symbol counts.
10840 (Sized_dynobj::do_get_global_symbol_counts): New function.
10841 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10842 defined_count_. Update declarations. Define Symbols typedef.
10843 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10844 parameter. Change all callers.
10845 (Symbol_table::add_from_dynobj): Add sympointers and defined
10846 parameters. Change all callers.
10847 * symtab.h (class Symbol_table): Update declarations.
10848 * Makefile.am (CCFILES): Add cref.cc.
10849 (HFILES): Add cref.h.
10850 * Makefile.in: Rebuild.
10851
3f7c5e1d
CD
108522008-07-22 Simon Baldwin <simonb@google.com>
10853
10854 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10855 to zero when writing undefined symbols.
10856
e0b64032
ILT
108572008-07-22 Ian Lance Taylor <iant@google.com>
10858
10859 * output.cc (Output_section::add_input_section): Don't try to
10860 merge empty merge sections.
10861
096b02cf
CS
108622008-07-21 Craig Silverstein <csilvers@google.com>
10863
10864 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10865 Include symbol version in error message.
cd536b21 10866
1d1f116d
CD
108672008-07-20 Chris Demetriou <cgd@google.com>
10868
cd536b21 10869 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
10870 (RANDOM_SEED_CFLAGS): New substituted variable.
10871 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10872 * configure: Rebuild.
10873 * Makefile.in: Likewise.
10874 * testsuite/Makefile.in: Likewise.
10875
a18f591e
ILT
108762008-07-18 Ian Lance Taylor <iant@google.com>
10877
10878 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10879 where we see NAME/NULL and NAME/VERSION as separate symbols.
10880 * testsuite/ver_test_main.cc (main): Call t4.
10881 (t4, t4_2a): Define.
10882 * testsuite/ver_test_2.cc (t4_2): Define.
10883 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10884 * testsuite/ver_test_4.cc (t4_2a): Define.
10885 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10886 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10887
c6e3f6ed
ILT
108882008-07-17 Ian Lance Taylor <iant@google.com>
10889
10890 * dynobj.cc (Versions::add_def): If we give an error about a
10891 missing version, go ahead and create the version anyhow.
10892
ef9beddf
ILT
108932008-07-10 Ian Lance Taylor <iant@google.com>
10894
10895 Handle output sections with more than 0x7fffffff bytes.
10896 * object.h (class Relobj): Change map_to_output_ to
10897 output_sections_, and just keep a section pointer. Change all
10898 uses. Move comdat group support to Sized_relobj.
10899 (Relobj::is_section_specially_mapped): Remove.
10900 (Relobj::output_section): Remove poff parameter. Change all
10901 callers.
10902 (Relobj::output_section_offset): New function.
10903 (Relobj::set_section_offset): Rewrite.
10904 (Relobj::map_to_output): Remove.
10905 (Relobj::output_sections): New function.
10906 (Relobj::do_output_section_offset): New pure virtual function.
10907 (Relobj::do_set_section_offset): Likewise.
10908 (class Sized_relobj): Add section_offsets_ field. Add comdat
10909 group support from Relobj. Update declarations.
10910 (Sized_relobj::get_output_section_offset): New function.
10911 (Sized_relobj::do_output_section_offset): New function.
10912 (Sized_relobj::do_set_section_offset): New function.
10913 * object.cc (Relobj::output_section_address): Remove.
10914 (Sized_relobj::Sized_relobj): Initialize new fields.
10915 (Sized_relobj::include_section_group): Cast find_kept_object to
10916 Sized_relobj.
10917 (Sized_relobj::include_linkonce_section): Likewise.
10918 (Sized_relobj::do_layout): Use separate arrays for output section
10919 and output offset.
10920 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10921 output_sections.
10922 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10923 output_sections and section_offsets.
10924 (Sized_relobj::write_local_symbols): Likewise.
10925 (map_to_kept_section): Compute output address directly.
10926 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10927 output_sections and section_offsets.
10928 (Sized_relobj::write_sections): Likewise.
10929 (Sized_relobj::relocate_sections): Likewise.
10930 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10931 * output.h (class Output_reloc): Update declarations. Change
10932 u2_.relobj to Sized_relobj*.
10933 (class Output_data_reloc): Change add functions to use
10934 Sized_relobj*.
10935 * output.cc (Output_reloc::Output_reloc): Change relobj to
10936 Sized_relobj*.
10937 (Output_reloc::local_section_offset): Change return type to
10938 Elf_Addr. Use get_output_section_offset.
10939 (Output_reloc::get_address): Likewise.
10940 (Output_section::is_input_address_mapped): Don't call
10941 is_section_specially_mapped.
10942 (Output_section::output_offset): Likewise.
10943 (Output_section::output_address): Likewise.
10944 (Output_section::starting_output_address): Likewise.
10945 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10946 parameter to Sized_relobj*.
10947 (Copy_relocs::need_copy_reloc): Likewise.
10948 (Copy_relocs::save): Likewise.
10949 * copy-relocs.h (class Copy_relocs): Update declarations.
10950 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10951 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10952 * target-reloc.h (relocate_for_relocatable): Change
10953 offset_in_output_section type to Elf_Addr. Change code that uses
10954 it as well.
10955 * layout.cc (Layout::layout): Always set *off.
10956 * mapfile.cc (Mapfile::print_input_section): Use
10957 output_section_offset.
10958 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10959 Sized_relobj*.
10960 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10961 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10962 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10963
5cb66f97
ILT
109642008-07-03 Ian Lance Taylor <iant@google.com>
10965
10966 * layout.cc (Layout::include_section): Do not discard unrecognized
10967 SHT_STRTAB sections.
10968
afe47622
CS
109692008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10970
10971 * script.cc (Lex::can_continue_name): Make '?' allowable in
10972 version-script names.
10973 * testsuite/version_script.map: Change glob pattern to use '?'
10974
5adf9721
ILT
109752008-06-30 Manish Singh <yosh@gimp.org>
10976
10977 PR 6585
10978 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10979 Correct typo.
10980
e6fde208
ILT
109812008-06-30 Ian Lance Taylor <iant@google.com>
10982
10983 PR 6660
10984 PR 6682
10985 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10986 versions]: Don't try to read the value in the contents, since we
10987 don't use it. Use the template endianness when writing.
10988
3f2e6a2d
CC
109892008-06-25 Cary Coutant <ccoutant@google.com>
10990
10991 * fileread.cc (File_read::make_view): Assert on zero-length view.
10992 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10993 symbol table when there are no symbols to read.
10994
c43d3a48
CS
109952008-06-23 Craig Silverstein <csilvers@google.com>
10996
10997 * version.cc (version_string): Bump to 1.7
10998
5f494ea0
CS
109992008-06-18 Craig Silverstein <csilvers@google.com>
11000
11001 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11002 constant 0xFFFF to type Valtype.
11003 (Powerpc_relocate_functions::rel16_ha): Likewise.
11004
c42e122e
ILT
110052008-06-17 Ian Lance Taylor <iant@google.com>
11006
f34787f8
ILT
11007 * output.h (Output_section::Input_section): Initialize p2align_ to
11008 zero for Output_section_data constructors.
11009 (Output_section::Input_section::addralign): If not an input
11010 section, return the alignment of the Output_section_data.
11011 * testsuite/copy_test.cc: New file.
11012 * testsuite/copy_test_1.cc: New file.
11013 * testsuite/copy_test_2.cc: New file.
11014 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11015 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11016 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11017 (copy_test_1_pic.o, copy_test_1.so): New targets.
11018 (copy_test_2_pic.o, copy_test_2.so): New targets.
11019 * testsuite/Makefile.in: Rebuild.
11020
c42e122e
ILT
11021 * script-sections.cc (Script_sections::place_orphan): Initialize
11022 local variable exact.
11023
ce3ac18a
DE
110242008-06-13 David Edelsohn <edelsohn@gnu.org>
11025
11026 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11027
42cacb20
DE
110282008-06-12 David Edelsohn <edelsohn@gnu.org>
11029 David S. Miller <davem@davemloft.net>
11030
11031 * powerpc.cc: New file.
11032 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11033 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11034 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11035 * Makefile.in: Rebuild.
11036
7b308235
ILT
110372008-06-09 Ian Lance Taylor <iant@google.com>
11038
11039 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11040 <exception>.
11041 (throwing, orig_terminate): New static variables.
11042 (terminate_handler): New static function.
11043 (t2): Set terminate handler.
11044
f0b886e3
ILT
110452008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11046
11047 PR 6584
cd536b21 11048 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
11049 alignment.
11050
3e90f135
CC
110512008-05-30 Cary Coutant <ccoutant@google.com>
11052
11053 * archive.cc (Archive::include_all_members) Correct to step
11054 over symbol table and extended name table in thin archives.
11055
e09ad04a
ILT
110562008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11057
11058 PR 6407
11059 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11060 calculation.
11061
62b01cb5
ILT
110622008-05-28 Caleb Howe <cshowe@google.com>
11063
11064 * reduced_debug_output.cc: New file.
11065 * reduced_debug_output.h: New file.
92de84a6 11066 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
11067 * options.cc (General_options::finalize): Add strip_debug_non_line
11068 to the strip heirarchy.
11069 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11070 fields.
11071 * layout.cc: Include "reduced_debug_output.h".
11072 (Layout::Layout): Initialize new fields.
11073 (line_only_debug_sections): New static array.
11074 (is_lines_only_debug_sections): New static inline function.
11075 (Layout::include_section): Handle --strip-debug-non-line.
11076 (Layout::make_output_section): If --strip-debug-non-line, build
11077 new output sections for .debug_abbrev and .debug_info.
11078 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11079 gold. Warn about possible overflow.
11080 (read_signed_LEB_128): Likewise.
11081 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11082 (read_signed_LEB_128): Declare.
11083 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11084 (HFILES): Add reduced_debug_output.h.
11085 * Makefile.in: Rebuild.
11086
7d9e3d98
ILT
110872008-05-21 Ian Lance Taylor <iant@google.com>
11088
11089 * mapfile.cc: New file.
11090 * mapfile.h: New file.
11091 * options.h (class General_options): Add -M/--print-map and -Map.
11092 * options.cc (General_options::finalize): Make -M equivalent to
11093 -Map -.
11094 * main.cc: Include <cstdio> and "mapfile.h".
11095 (main): Open mapfile if requested.
11096 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11097 constructor. Change caller.
11098 (queue_initial_tasks): Add mapfile parameter. Change caller.
11099 (queue_middle_tasks): Likewise.
11100 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11101 declarations.
11102 * archive.cc: Include "mapfile.h".
11103 (Archive::add_symbols): Add mapfile parameter. Change all
11104 callers. Pass mapfile, symbol, and reason to include_member.
11105 (Archive::include_all_members): Add mapfile parameter. Change all
11106 callers.
11107 (Archive::include_member): Add mapfile, sym, and why parameters.
11108 Change all callers. Report inclusion to map file.
11109 * archive.h: Include "fileread.h".
11110 (class Archive): Update declarations.
11111 (Archive::file): New const method.
11112 (class Add_archive_symbols): Add mapfile_ field. Update
11113 constructor. Change all callers.
11114 * readsyms.h (class Read_symbols): Likewise.
11115 (class Finish_group): Likewise.
11116 (class Read_script): Likewise.
11117 * common.cc: Include "mapfile.h".
11118 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11119 all callers.
11120 (Symbol_table::do_allocate_commons): Likewise.
11121 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11122 symbol allocation to mapfile.
11123 * common.h (class Allocate_commons_task): Add mapfile_ field.
11124 Update constructor. Change all callers.
11125 * symtab.h (class Symbol_table): Update declarations.
11126 * layout.cc: Include "mapfile.h".
11127 (Layout_task_runner::run): Print information to mapfile.
11128 (Layout::create_gold_note): Change Output_data_fixed_space to
11129 Output_data_zero_fill.
11130 (Layout::create_build_id): Likewise.
11131 (Layout::print_to_mapfile): New function.
11132 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11133 constructor. Change caller.
11134 (class Layout): Declare print_to_mapfile.
11135 * output.cc (Output_section::Input_section::print_to_mapfile): New
11136 function.
11137 (Output_section::add_input_section): If producing a map, always
11138 add to input_sections_ list.
11139 (Output_section::do_print_to_mapfile): New function.
11140 (Output_segment::print_sections_to_mapfile): New function.
11141 (Output_segment::print_section_list_to_mapfile): New function.
11142 * output.h: Include "mapfile.h".
11143 (Output_data::print_to_mapfile): New function.
11144 (Output_data::do_print_to_mapfile): New virtual function.
11145 (Output_segment_headers::do_print_to_mapfile): New function.
11146 (Output_file_header::do_print_to_mapfile): New function.
11147 (Output_data_const::do_print_to_mapfile): New function.
11148 (class Output_data_const_buffer): Add map_name_ field. Update
11149 constructor. Change all callers. Add do_print_to_mapfile
11150 function.
11151 (class Output_data_fixed_space): Likewise.
11152 (class Output_data_space): Likewise.
11153 (class Output_data_zero_fill): New class.
11154 (Output_data_strtab::do_print_to_mapfile): New function.
11155 (Output_data_reloc_base::do_print_to_mapfile): New function.
11156 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11157 (Output_data_group::do_print_to_mapfile): New function.
11158 (Output_data_got::do_print_to_mapfile): New function.
11159 (Output_data_dynamic::do_print_to_mapfile): New function.
11160 (Output_symtab_xindex::do_print_to_mapfile): New function.
11161 (class Output_section): Declare do_print_to_mapflie. Declare
11162 print_to_mapfile in Input_section.
11163 (class Output_segment): Declare new functions.
11164 * object.h (Sized_relobj::symbol_count): New function.
11165 * script-sections.cc
11166 (Output_section_element_dot_assignment::set_section_addresses):
11167 Change Output_data_fixed_space to Output_data_zero_fill.
11168 (Output_data_expression::do_print_to_mapfile): New function.
11169 * script.cc (read_input_script): Add mapfile parameter. Change
11170 all callers.
11171 * script.h (read_input_script): Update declaration.
11172 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11173 (Eh_frame::do_print_to_mapfile): New function.
11174 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11175 (Output_merge_string::do_print_to_mapfile): New function.
11176 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11177 function.
11178 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11179 function.
11180 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11181 function.
11182 * Makefile.am (CCFILES): Add mapfile.cc.
11183 (HFILES): Add mapfile.h.
11184 * Makefile.in: Rebuild.
11185
9f1d377b
ILT
111862008-05-19 Ian Lance Taylor <iant@google.com>
11187
11188 * options.h (class General_options): Add -z relro.
11189 * layout.cc (Layout::Layout): Initialize relro_segment_.
11190 (Layout::add_output_section_data): Return the output section.
11191 (Layout::make_output_section): Rcognize relro sections and mark
11192 them appropriately.
11193 (Layout::attach_allocated_section_to_segment): Put relro sections
11194 in a PT_GNU_RELRO segment.
11195 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11196 section as relro.
11197 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11198 PT_TLS segments.
11199 (Layout::linkonce_mapping): Map d.rel.ro.local to
11200 .data.rel.ro.local.
11201 (Layout::output_section_name): Us .data.rel.ro.local for any
11202 section which begins with that.
11203 * layout.h (class Layout): Update add_output_section_data
11204 declaration. Add relro_segment_ field.
11205 * output.cc (Output_section::Output_section): Initialize is_relro_
11206 and is_relro_local_ fields.
11207 (Output_segment::add_output_section): Group relro sections.
11208 (Output_segment::is_first_section_relro): New function.
11209 (Output_segment::maximum_alignment): If there is a relro section,
11210 align the segment to the common page size.
11211 (Output_segment::set_section_addresses): Track whether we are
11212 looking at relro sections. If the last section is a relro
11213 section, align to the common page size.
11214 (Output_segment::set_section_list_addresses): Add in_relro
11215 parameter. Change all callers. Align to the page size when
11216 moving from relro to non-relro section.
11217 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11218 segment.
11219 * output.h (class Output_section): Add is_relro_ and
11220 is_relro_local_ fields.
11221 (Output_section::is_relro): New function.
11222 (Output_section::set_is_relro): New function.
11223 (Output_section::is_relro_local): New function.
11224 (Output_section::set_is_relro_local): New function.
11225 (class Output_segment): Update declarations.
11226 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11227 * sparc.cc (Target_sparc::got_section): Likewise.
11228 * x86_64.cc (Target_x86_64::got_section): Likewise.
11229 * testsuite/relro_test_main.cc: New file.
11230 * testsuite/relro_test.cc: New file.
11231 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11232 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11233 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11234 (relro_test.so, relro_test_pic.o): New targets.
11235 * testsuite/Makefile.in: Rebuild.
11236
a984ee1d
ILT
112372008-05-16 Ian Lance Taylor <iant@google.com>
11238
01676dcd
ILT
11239 * output.cc (Output_segment::add_output_section): Remove front
11240 parameter.
11241 * output.h (class Output_segment): Remove
11242 add_initial_output_section and overloaded add_output_section.
11243 Update declaration of remaining add_output_section.
11244 * layout.cc (Layout::create_interp): Call add_output_section
11245 rather than add_initial_output_section.
11246 (Layout::finish_dynamic_section): Likewise.
11247
497897f9
ILT
11248 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11249 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11250 know the dynamic type.
11251 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11252 field. Initialize it in constructor.
11253 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11254 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11255 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11256 reloc.
11257
a984ee1d
ILT
11258 * output.cc (Output_reloc::get_address): Change return type to
11259 Elf_Addr.
11260 * output.h (class Output_reloc): Update get_address declaration.
11261 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11262 for section addresses.
11263
55ba0940
ILT
112642008-05-09 Ian Lance Taylor <iant@google.com>
11265
11266 PR 6493
11267 * gold.cc (gold_nomem): Use return value of write.
11268
75517b77
ILT
112692008-05-08 Ian Lance Taylor <iant@google.com>
11270
11271 * symtab.c (Symbol::init_base_output_data): Add version
11272 parameter. Change all callers.
11273 (Symbol::init_base_output_segment): Likewise.
11274 (Symbol::init_base_constant): Likewise.
11275 (Symbol::init_base_undefined): Likewise.
11276 (Sized_symbol::init_output_data): Likewise.
11277 (Sized_symbol::init_output_segment): Likewise.
11278 (Sized_symbol::init_constant): Likewise.
11279 (Sized_symbol::init_undefined): Likewise.
11280 (Symbol_table::do_define_in_output_data): If the new symbol has a
11281 version, mark it as the default.
11282 (Symbol_table::do_define_in_output_segment): Likewise.
11283 (Symbol_table::do_define_as_constant): Likewise.
11284 * symtab.h (class Symbol): Update declarations.
11285 (class Sized_symbol): Likewise.
11286 * resolve.cc (Symbol::override_version): New function.
c42e122e 11287 (Symbol::override_base): Call override_version.
75517b77
ILT
11288 (Symbol::override_base_with_special): Likewise.
11289 * testsuite/ver_script_8.script: New file.
11290 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11291 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11292 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11293 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11294
f1f70eae
ILT
112952008-05-06 Ian Lance Taylor <iant@google.com>
11296
f3e9c5c5
ILT
11297 PR 6049
11298 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11299 functions.
11300 (class General_options): Remove existing --undefined, and add
11301 --no-undefined instead. Add new --undefined as synonym for -u.
11302 * archive.cc (Archive::add_symbols): Check whether symbol was
11303 named with -u.
11304 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11305 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11306 all uses. Add IS_UNDEFINED. Update declarations to split
11307 different versions of init_base. Declare init_base_undefined.
11308 (Symbol::is_defined): Handle IS_UNDEFINED.
11309 (Symbol::is_undefined): Likewise.
11310 (Symbol::is_weak_undefined): Call is_undefined.
11311 (Symbol::is_absolute): Handle IS_CONSTANT.
11312 (class Sized_symbol): Update declarations to split different
11313 versions of init. Declare init_undefined.
11314 (class Symbol_table): Declare new functions.
11315 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11316 Change all callers.
11317 (Symbol::init_base_output_data): Likewise.
11318 (Symbol::init_base_output_segment): Likewise.
11319 (Symbol::init_base_constant): Likewise.
11320 (Symbol::init_base_undefined): New function.
11321 (Sized_symbol::init_object): Rename from init. Change all
11322 callers.
11323 (Sized_symbol::init_output_data): Likewise.
11324 (Sized_symbol::init_output_segment): Likewise.
11325 (Sized_symbol::init_constant): Likewise.
11326 (Sized_symbol::init_undefined): New function.
11327 (Symbol_table::add_undefined_symbols_from_command_line): New
11328 function.
11329 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11330 function.
11331 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11332 (Symbol::output_section): Likewise.
11333 (Symbol::set_output_section): Likewise.
11334 (Symbol_table::sized_finalize_symbol): Likewise.
11335 (Symbol_table::sized_write_globals): Likewise.
11336 * resolve.cc (Symbol_table::should_override): Likewise.
11337 (Symbol::override_base_with_special): Likewise.
11338
8bdcdf2c
ILT
11339 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11340 symbol, change it to have default visibility.
11341 * testsuite/protected_1.cc: New file.
11342 * testsuite/protected_2.cc: New file.
11343 * testsuite/protected_3.cc: New file.
11344 * testsuite/protected_main_1.cc: New file.
11345 * testsuite/protected_main_2.cc: New file.
11346 * testsuite/protected_main_3.cc: New file.
11347 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11348 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11349 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11350 (protected_1.so): New target.
11351 (protected_1_pic.o, protected_2_pic.o): New targets.
11352 (protected_3_pic.o): New target.
11353 (check_PROGRAMS): Add protected_2.
11354 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11355 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11356 * testsuite/Makefile.in: Rebuild.
11357
2b706932
ILT
11358 * options.h (DEFINE_var): Add set_user_set_##varname__.
11359 (DEFINE_bool_alias): New macro.
11360 (class General_options): Define -Bstatic using DEFINE_bool_alias
11361 rather than DEFINE_special. Add --undefined as an alias for -z
11362 defs.
11363 * options.cc (General_options::parse_Bstatic): Remove.
11364
d82a5bcc
ILT
11365 * options.h (class General_options): Add --fatal-warnings.
11366 * main.cc (main): Implement --fatal-warnings.
11367 * errors.h (Errors::warning_count): New function.
11368
f1f70eae
ILT
11369 * options.h (class General_options): Add -Bsymbolic-functions.
11370 * symtab.h (Symbol::is_preemptible): Check for
11371 -Bsymbolic-functions.
11372
8825ac63
ILT
113732008-05-05 Ian Lance Taylor <iant@google.com>
11374
d98bc257
ILT
11375 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11376 as noVARNAME rather than no-VARNAME.
11377 (class General_options): Add option -z combreloc.
11378 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11379 get_address.
11380 (Output_reloc::sort_before) [SHT_REL]: New function.
11381 (Output_reloc::sort_before) [SHT_RELA]: New function.
11382 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11383 Sort_relocs_comparison.
11384 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11385 parameter. Change all callers.
11386 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11387 sort_relocs parameter. Change all callers.
11388 * output.cc (Output_reloc::get_address): New function, broken out
11389 of write_rel.
11390 (Output_reloc::write_rel): Call it.
11391 (Output_reloc::compare): New function.
11392 (Output_data_reloc_base::do_write): Optionally sort relocs.
11393
60b2b4e7
ILT
11394 * configure.ac: If targ_extra_obj is set, link it in.
11395 * configure.tgt: Initialize all variables.
11396 (x86_64*): Set targ_extra_obj and targ_extra_size.
11397 * configure: Rebuild.
11398
8825ac63
ILT
11399 * object.cc (Sized_relobj::include_section_group): Adjust section
11400 indexes read from group data. Build vector to pass to
11401 layout_group.
11402 * layout.cc (Layout::layout_group): Add flags and shndxes
11403 parameters. Remove contents parameter. Change caller. Update
11404 explicit instantiations.
11405 * layout.h (class Layout): Update layout_group declaration.
11406 * output.cc (Output_data_group::Output_data_group): Add flags and
11407 input_shndxes parameters. Remove contents parameter. Change
11408 caller.
11409 (Output_data_group::do_write): Change input_sections_ to
11410 input_shndxes_.
11411 * output.h (class Output_data_group): Update constructor
11412 declaration. Rename input_sections_ to input_shndxes_.
11413 * testsuite/many_sections_test.cc: Add template.
11414
e94cf127
CC
114152008-04-30 Cary Coutant <ccoutant@google.com>
11416
4418b2d5
CC
11417 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11418
e94cf127
CC
11419 * layout.cc (Layout::include_section): Refactored check for debug
11420 info section.
11421 (Layout::add_comdat): Add new parameters. Change type
11422 of signature parameter. Add object and shndx to signatures table.
11423 (Layout::find_kept_object): New function.
11424 * layout.h: Include <cstring>.
11425 (Layout::is_debug_info_section): New function.
11426 (Layout::add_comdat): Add new parameters.
11427 (Layout::find_kept_object): New function.
11428 (Layout::Kept_section): New struct.
11429 (Layout::Signatures): Change type of map range.
11430 * object.cc (Relobj::output_section_address): New function.
11431 (Sized_relobj::include_section_group): Add new parameters. Change
11432 calls to Layout::add_comdat. Change to build table of kept comdat
11433 groups and table mapping discarded sections to kept sections.
11434 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11435 (Sized_relobj::do_layout): Change calls to include_section_group and
11436 include_linkonce_section.
11437 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11438 value to zero when section is discarded.
11439 (Sized_relobj::map_to_kept_section): New function.
11440 * object.h (Relobj::output_section_address): New function.
11441 (Relobj::Comdat_group): New type.
11442 (Relobj::find_comdat_group): New function.
11443 (Relobj::Comdat_group_table): New type.
11444 (Relobj::Kept_comdat_section): New type.
11445 (Relobj::Kept_comdat_section_table): New type.
11446 (Relobj::add_comdat_group): New function.
11447 (Relobj::set_kept_comdat_section): New function.
11448 (Relobj::get_kept_comdat_section): New function.
11449 (Relobj::comdat_groups_): New field.
11450 (Relobj::kept_comdat_sections_): New field.
11451 (Symbol_value::input_value): Update comment.
11452 (Sized_relobj::map_to_kept_section) New function.
11453 (Sized_relobj::include_linkonce_section): Add new parameter.
11454 * target-reloc.h (Comdat_behavior): New type.
11455 (get_comdat_behavior): New function.
11456 (relocate_section): Add code to map a discarded section to the
11457 corresponding kept section when applying a relocation.
11458
e4e5049b
CS
114592008-04-30 Craig Silverstein <csilvers@google.com>
11460
11461 * dwarf_reader.cc (next_generation_count): New static var.
11462 (Addr2line_cache_entry): New struct.
11463 (addr2line_cache): New static var.
11464 (Dwarf_line_info::one_addr2line): Added caching.
11465 (Dwarf_line_info::clear_addr2line_cache): New function.
11466 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11467 cache-size parameter.
11468 (Dwarf_line_info::one_addr2line_cache): New function.
11469 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11470 new cache-size argument to one_addr2line(), and clear cache.
11471
d09e9154
CC
114722008-04-28 Cary Coutant <ccoutant@google.com>
11473
11474 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11475 R_386_PC8 relocations.
11476
7ef73768
ILT
114772008-04-23 Ian Lance Taylor <iant@google.com>
11478
55438702
ILT
11479 * object.cc (Sized_relobj::include_section_group): Check for
11480 invalid section group.
11481
c165fb93
ILT
11482 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11483 header size.
11484
7ef73768
ILT
11485 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11486 than read for file header.
11487 * archive.cc (Archive::include_member): Likewise.
11488
6194aaab
L
114892008-04-23 Paolo Bonzini <bonzini@gnu.org>
11490
11491 * aclocal.m4: Regenerate.
11492 * configure: Regenerate.
11493
d491d34e
ILT
114942008-04-19 Ian Lance Taylor <iant@google.com>
11495
5ea2bac6
ILT
11496 * version.cc (version_string): Bump to 1.6.
11497
7bc3e21a
ILT
11498 * testsuite/Makefile.am (many_sections_r_test): New target.
11499 (many_sections_r_test_SOURCES): Remove.
11500 (many_sections_r_test_DEPENDENCIES): Remove.
11501 (many_sections_r_test_LDFLAGS): Remove.
11502 (many_sections_r_test_LDADD): Remove.
11503
7fcd3aa9
ILT
11504 * object.cc (Sized_relobj::do_add_symbols): Always pass
11505 local_symbol_count_ to add_from_relobj.
11506
4c94d6ae
ILT
11507 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11508 every thousand variables.
11509 * testsuite/Makefile.in: Rebuild.
11510
d491d34e
ILT
11511 * object.cc (Xindex::initialize_symtab_xindex): New function.
11512 (Xindex::read_symtab_xindex): New function.
11513 (Xindex::sym_xindex_to_shndx): New function.
11514 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11515 available.
11516 (Sized_relobj::do_initialize_xindex): New function.
11517 (Sized_relobj::do_read_symbols): Adjust section links.
11518 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11519 parameter. Change all callers.
11520 (Sized_relobj::include_section_group): Adjust section links and
11521 symbol section indexes.
11522 (Sized_relobj::do_layout): Adjust section links.
11523 (Sized_relobj::do_count_local_symbols): Adjust section links and
11524 symbol section indexes.
11525 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11526 ordinary and special symbols.
11527 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11528 dynsym_xindex parameters. Change all callers. Adjust section
11529 links. Use SHN_XINDEX when needed.
11530 (Sized_relobj::get_symbol_location_info): Adjust section links.
11531 Don't get fooled by special symbols.
11532 * object.h (class Xindex): Define.
11533 (class Object): Add xindex_ parameter. Declare virtual functoin
11534 do_initialize_xindex.
11535 (Object::adjust_sym_shndx): New function.
11536 (Object::set_xindex): New protected function.
11537 (class Symbol_value): Add is_ordinary_shndx_ field.
11538 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11539 (Symbol_value::value): Assert ordinary section.
11540 (Symbol_value::initialize_input_to_output_map): Likewise.
11541 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11542 Change all callers.
11543 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11544 all callers.
11545 (class Sized_relobj): Update declarations.
11546 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11547 parameter. Change all callers.
11548 (Sized_relobj::adjust_shndx): New function.
11549 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11550 field.
11551 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11552 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11553 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11554 (Sized_dynobj::read_dynsym_section): Adjust section links.
11555 (Sized_dynobj::read_dynamic): Likewise.
11556 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11557 section links.
11558 (Sized_dynobj::do_initialize_xindex): New function.
11559 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11560 do_initialize_xindex.
11561 (Sized_dynobj::adjust_shndx): New function.
11562 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11563 dynsym_xindex_ fields.
11564 (Layout::finalize): Add a call to set_section_indexes before
11565 creating the symtab sections.
11566 (Layout::set_section_indexes): Don't do anything if the section
11567 already has a section index.
11568 (Layout::create_symtab_sections): Add shnum parameter. Change
11569 caller. Create .symtab_shndx section if needed.
11570 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11571 caller.
11572 (Layout::allocated_output_section_count): New function.
11573 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11574 needed.
11575 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11576 fields. Update declarations.
11577 (Layout::symtab_xindex): New function.
11578 (Layout::dynsym_xindex): New function.
11579 (class Write_symbols_task): Add layout_ field.
11580 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11581 Change caller.
11582 * output.cc (Output_section_headers::Output_section_headers): Add
11583 shstrtab_section parameter. Change all callers.
11584 (Output_section_headers::do_sized_write): Store overflow values
11585 for section count and section string table section index in
11586 section header zero.
11587 (Output_file_header::do_sized_write): Check for overflow of
11588 section count and section string table section index.
11589 (Output_symtab_xindex::do_write): New function.
11590 (Output_symtab_xindex::endian_do_write): New function.
11591 * output.h (class Output_section_headers): Add shstrtab_section_.
11592 Update declarations.
11593 (class Output_symtab_xindex): Define.
11594 (Output_section::has_out_shndx): New function.
11595 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11596 field.
11597 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11598 Change all callers.
11599 (Sized_symbol::init): Likewise.
11600 (Symbol::output_section): Check for ordinary symbol.
11601 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11602 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11603 callers.
11604 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11605 Change all callers. Simplify handling of symbols from sections
11606 not included in the link.
11607 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11608 distinction.
11609 (Weak_alias_sorter::operator()): Assert that symbols are
11610 ordinary.
11611 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11612 distinction.
11613 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11614 parameters. Change all callers.
11615 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11616 symbol distinction. Use SHN_XINDEX when needed.
11617 (Symbol_table::write_section_symbol): Add symtab_xindex
11618 parameter. Change all callers.
11619 (Symbol_table::sized_write_section_symbol): Likewise. Use
11620 SHN_XINDEX when needed.
11621 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11622 declarations.
11623 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11624 (Symbol::is_defined): Check is_ordinary.
11625 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11626 (Symbol::is_absolute, Symbol::is_common): Likewise.
11627 (class Sized_symbol): Update declarations.
11628 (class Symbol_table): Update declarations.
11629 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11630 parameters. Change all callers.
11631 (Sized_symbol::override): Likewise.
11632 (Symbol_table::override): Likewise.
11633 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11634 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11635 is_ordinary, and orig_st_shndx parameters. Change all callers.
11636 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11637 to be in an ordinary section.
11638 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11639 object and is_ordinary parameters. Change all callers.
11640 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11641 Change all callers. Don't add undefined or non-ordinary symbols
11642 to reloc_map_.
11643 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11644 Change all callers.
11645 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11646 declarations.
11647 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11648 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11649 (Sized_relobj::relocate_sections): Likewise.
11650 * target-reloc.h (scan_relocs): Adjust section symbol index.
11651 (scan_relocatable_relocs): Likewise.
11652 * i386.cc (Scan::local): Check for ordinary symbols.
11653 * sparc.cc (Scan::local): Likewise.
11654 * x86_64.cc (Scan::local): Likewise.
11655 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11656 to symbol_section_and_value.
11657 * testsuite/many_sections_test.cc: New file.
11658 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11659 (check_PROGRAMS): Add many_sections_test.
11660 (many_sections_test_SOURCES): Define.
11661 (many_sections_test_DEPENDENCIES): Define.
11662 (many_sections_test_LDFLAGS): Define.
11663 (BUILT_SOURCES): Add many_sections_define.h.
11664 (many_sections_define.h): New target.
11665 (BUILT_SOURCES): Add many_sections_check.h.
11666 (many_sections_check.h): New target.
11667 (check_PROGRAMS): Add many_sections_r_test.
11668 (many_sections_r_test_SOURCES): Define.
11669 (many_sections_r_test_DEPENDENCIES): Define.
11670 (many_sections_r_test_LDFLAGS): Define.
11671 (many_sections_r_test_LDADD): Define.
11672 (many_sections_r_test.o): New target.
11673 * testsuite/Makefile.in: Rebuild.
11674
c5818ff1
CC
116752008-04-17 Cary Coutant <ccoutant@google.com>
11676
11677 * errors.cc (Errors::info): New function.
11678 (gold_info): New function.
11679 * errors.h (Errors::info): New function.
11680 * gold.h (gold_info): New function.
11681 * object.cc (Input_objects::add_object): Print trace output.
11682 * options.cc (options::parse_set): New function.
11683 (General_options::parse_wrap): Deleted.
11684 (General_options::General_options): Deleted initializer.
11685 * options.h (options::String_set): New typedef.
11686 (options::parse_set): New function.
11687 (DEFINE_set): New macro.
11688 (General_options::wrap): Changed to use DEFINE_set. Changed
11689 callers of any_wrap_symbols and is_wrap_symbol.
11690 (General_options::trace, General_options::trace_symbol):
11691 New options.
11692 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11693 (General_options::wrap_symbols_): Deleted.
11694 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11695
b5be4a7c
DM
116962008-04-17 David S. Miller <davem@davemloft.net>
11697
11698 * options.cc (General_options::parse_V): New function.
11699 * options.h: Add entries for -V and -Qy.
11700
155a0dd7
ILT
117012008-04-17 Ian Lance Taylor <iant@google.com>
11702
11703 * common.cc (Symbol_table::allocate_commons): Remove options
11704 parameter. Change caller.
11705 (Symbol_table::do_allocate_commons): Remove options parameter.
11706 Change caller. Just call do_allocate_commons_list twice.
11707 (Symbol_table::do_allocate_commons_list): New function, broken out
11708 of do_allocate_commons.
11709 * common.h (class Allocate_commons_task): Remove options_ field.
11710 Update constructor.
11711 * symtab.cc (Symbol_table::Symbol_table): Initialize
11712 tls_commons_.
11713 (Symbol_table::add_from_object): Put TLS common symbols on
11714 tls_commons_ list.
11715 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11716 which are IN_OUTPUT_DATA.
11717 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11718 allocate_commons and do_allocate_commons declarations. Declare
11719 do_allocate_commons_list.
11720 * gold.cc (queue_middle_tasks): Update creation of
11721 Allocate_commons_task to not pass options.
11722 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11723 (TLS_TEST_C_FLAGS): New variable.
11724 (tls_test_c_pic.o): New target.
11725 (tls_test_shared.so): Link in tls_test_c_pic.o.
11726 (tls_test_c_pic_ie.o): New target.
11727 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11728 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11729 (tls_test_c.o): New target.
11730 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11731 (tls_pic_test_LDADD): Likewise.
11732 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11733 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11734 (tls_test_c_gnu2.o): New target.
11735 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11736 tls_test_c_gnu2.o.
11737 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11738 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11739 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11740 * testsuite/tls_test.cc: Include "config.h".
11741 (t_last): Call t11_last.
11742 * testsuite/tls_test.h (t11, t11_last): Declare.
11743 * testsuite/tls_test_c.c: New file.
11744 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11745 * configure.ac: Check for OpenMP support.
11746 * configure, config.in, Makefile.in: Rebuild.
11747 * testsuite/Makefile.in: Rebuild.
11748
edfbb029
CC
117492008-04-16 Cary Coutant <ccoutant@google.com>
11750
11751 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11752 (Target_i386::tls_base_symbol_defined_): New field.
11753 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11754 (Target_i386::Scan::global): Likewise.
11755 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11756 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11757 (Target_x86_64::tls_base_symbol_defined_): New field.
11758 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11759 (Target_x86_64::Scan::global): Likewise.
11760
f3c69fca
CC
117612008-04-16 Cary Coutant <ccoutant@google.com>
11762
11763 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11764 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11765 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11766 building shared libraries.
11767 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11768 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11769 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11770 * testsuite/Makefile.in: Rebuild.
11771 * testsuite/weak_undef.h: New file.
11772 * testsuite/weak_undef_file1.cc: Add extra test cases.
11773 * testsuite/weak_undef_file2.cc: Likewise.
11774 * testsuite/weak_undef_test.cc: Likewise.
11775
7c414435
DM
117762008-04-16 David S. Miller <davem@davemloft.net>
11777
32b769e1
DM
11778 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11779 Add issued_non_pic_error_ field. Declare check_non_pic.
11780 (Target_sparc::Scan::check_non_pic): New function.
11781 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11782 (Target_sparc::Scan::global): Likewise.
11783
11936fb1
DM
11784 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11785 * configure: Rebuild.
11786
7c414435
DM
11787 * options.h (DEFINE_enable): New macro.
11788 (new_dtags): New enable option.
11789 (initfirst, interpose, loadfltr, nodefaultlib,
11790 nodelete, nodlopen, nodump): New -z options.
11791 * layout.cc (Layout:finish_dynamic_section): If new
11792 dtags enabled, emit DT_RUNPATH. Also, emit a
11793 DT_FLAGS_1 containing any specified -z flags.
11794
85c7bf8b
ILT
117952008-04-16 Ian Lance Taylor <iant@google.com>
11796
12c0daef
ILT
11797 * copy-relocs.cc: New file.
11798 * copy-relocs.h: New file.
11799 * reloc.cc: Remove Copy_relocs code.
11800 * reloc.h: Likewise.
11801 * reloc-types.h (struct Reloc_types) [both versions]: Add
11802 get_reloc_addend_noerror.
11803 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11804 variants of add_global which take an addend which must be zero.
11805 * i386.cc: Include "copy-relocs.h".
11806 (class Target_i386): Change type of copy_relocs_ to variable,
11807 update initializer.
11808 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11809 Change all callers.
11810 (Target_i386::do_finalize_sections): Change handling of
11811 copy_relocs_.
11812 * sparc.cc: Include "copy-relocs.h".
11813 (class Target_sparc): Change type of copy_relocs_ to variable,
11814 update initializer.
11815 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11816 Change all callers.
11817 (Target_sparc::do_finalize_sections): Change handling of
11818 copy_relocs_.
11819 * x86_64.cc: Include "copy-relocs.h".
11820 (class Target_x86_64): Change type of copy_relocs_ to variable,
11821 update initializer.
11822 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11823 class. Change all callers.
11824 (Target_x86_64::do_finalize_sections): Change handling of
11825 copy_relocs_.
11826 * Makefile.am (CCFILES): Add copy-relocs.cc.
11827 (HFILES): Add copy-relocs.h.
11828
4f4995b6
ILT
11829 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11830
85c7bf8b
ILT
11831 * testsuite/script_test_4.sh: Permit leading zeroes.
11832
4f2a9edd
ILT
118332008-04-15 Ian Lance Taylor <iant@google.com>
11834
e6188289
ILT
11835 * script-sections.cc (Script_sections::create_segments): Use
11836 header_size_adjustment even when there is enough room for the
11837 headers.
11838 * testsuite/script_test_4.sh: New file.
11839 * testsuite/script_test_4.t: New file.
11840 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11841 (check_DATA): Add script_test_4.stdout.
11842 (MOSTLYCLEANFILES): Likewise.
11843 (script_test_4): New target.
11844 (script_test_4.stdout): New target.
11845 * testsuite/Makefile.in: Rebuild.
11846
4f2a9edd
ILT
11847 * sparc.cc: Add definitions for Output_data_plt_sparc class
11848 constants.
11849
f5314dd5
DM
118502008-04-14 David S. Miller <davem@davemloft.net>
11851
11852 * sparc.cc: New file.
11853 * Makefile.am (TARGETSOURCES): Add sparc.cc
11854 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11855 * configure.tgt: Document targ_extra_size and
11856 targ_extra_big_endian. Add entries for sparc-* and
11857 sparc64-*.
11858 * configure.ac: Handle targ_extra_size and
11859 targ_extra_big_endian.
11860 * Makefile.in: Rebuild.
11861 * configure: Likewise.
11862 * po/POTFILES.in: Likewise.
11863 * po/gold.pot: Likewise.
11864
154e0e9a
ILT
118652008-04-14 Ian Lance Taylor <iant@google.com>
11866
11867 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11868 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11869 in the name/type/flags to section mapping. Don't call
11870 allocate_output_section.
11871 (Layout::choose_output_section): Change parameter from adjust_name
11872 to is_input_section. Don't permit input sections after sections
11873 are attached to segments. Don't call allocate_output_section.
11874 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11875 not write_enable_output_section.
11876 (Layout::make_output_section): Don't push to
11877 unattached_section_list_ nor call attach_to_segment. Call
11878 attach_section_to_segment if sections are attached.
11879 (Layout::attach_sections_to_segments): New function.
11880 (Layout::attach_section_to_segment): New function.
11881 (Layout::attach_allocated_section_to_segment): Rename from
11882 attach_to_segment. Remove flags parameter.
11883 (Layout::allocate_output_section): Remove function.
11884 (Layout::write_enable_output_section): Remove function.
11885 * layout.h (class Layout): Update for above changes. Add new
11886 field sections_are_attached_.
11887 * output.h (Output_section::update_flags_for_input_section): New
11888 function.
11889 * output.cc (Output_section::add_input_section): Call
11890 update_flags_for_input_section.
11891 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11892
009a67a2
CC
118932008-04-11 Cary Coutant <ccoutant@google.com>
11894
11895 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11896 thought unnecessary.
11897 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11898
759b1a24
ILT
118992008-04-11 Ian Lance Taylor <iant@google.com>
11900
11901 * output.h (class Output_section_data): Remove inline definition
11902 of set_addralign.
11903 * output.cc (Output_section_data::set_addralign): New function.
11904
c2b45e22
CC
119052008-04-11 Cary Coutant <ccoutant@google.com>
11906
11907 Add support for TLS descriptors for i386 and x86_64.
11908 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11909 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11910 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11911 GOT_TYPE_TLS_DESC.
11912 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11913 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11914 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11915 relocations.
11916 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11917 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11918 Fix problem with initial-exec relocations.
11919 (Target_i386::Relocate::relocate_tls): Likewise.
11920 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11921 relaxation.
11922 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11923 support for section-plus-offset dynamic table entries.
11924 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11925 (Output_data_dynamic::Dynamic_entry): Add support for
11926 section-plus-offset dynamic table entries.
11927 (Output_data_dynamic::Classification): Likewise.
11928 (Output_data_dynamic::classification_): Renamed offset_.
11929 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11930 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11931 (Target_x86_64::make_plt_section): New function.
11932 (Target_x86_64::reserve_tlsdesc_entries): New function.
11933 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11934 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11935 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11936 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11937 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11938 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11939 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11940 add extra PLT entry for TLS descriptors.
11941 (Output_data_plt_x86_64::got_): New field.
11942 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11943 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11944 fields.
11945 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11946 descriptors.
11947 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11948 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11949 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11950 R_386_TLS_DESC_CALL relocations.
11951 (Target_x86_64::Scan::global): Likewise.
11952 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11953 for TLS descriptors.
11954 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11955 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11956 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11957 GD-to-IE relaxation.
11958 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11959 and TLS_DESCRIPTORS.
11960 * Makefile.in: Rebuild.
11961 * configure: Rebuild.
11962 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11963 (tls_test_shared2.so): New target.
11964 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11965 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11966 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11967 (tls_shared_gd_to_ie_test_LDADD): New variable.
11968 (tls_shared_gnu2_gd_to_ie_test): New target.
11969 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11970 New targets.
11971 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11972 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11973 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11974 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11975 (tls_shared_gnu2_test): New target.
11976 (tls_test_gnu2_shared.so): New target.
11977 (tls_shared_gnu2_test_SOURCES): New variable.
11978 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11979 (tls_shared_gnu2_test_LDFLAGS): New variable.
11980 (tls_shared_gnu2_test_LDADD): New variable.
11981 * testsuite/Makefile.in: Rebuild.
11982 * testsuite/Makefile.
11983
83bfb6b7
ILT
119842008-04-11 Ian Lance Taylor <iant@google.com>
11985
11986 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11987 justsyms.t.
11988 * testsuite/Makefile.in: Rebuild.
11989
11990 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11991 long.
11992 * testsuite/script_test_2.cc (main): Adjust test.
11993
706e1f5e
ILT
119942008-04-11 David S. Miller <davem@davemloft.net>
11995 Ian Lance Taylor <iant@google.com>
11996
11997 * options.h (General_options): Add entries for '-Y' and
11998 '-relax'.
11999 * options.cc (General_options:finalize): If -Y was used, add those
12000 entries to the library path instead of the default "/lib" and
12001 "/usr/lib".
12002
7c98e6bb
DM
120032008-04-11 David S. Miller <davem@davemloft.net>
12004
12005 * testsuite/justsyms.t: Start at 0x100.
12006 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
12007 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12008 long.
12009 * testsuite/script_test_2.cc: Adjust string and section length
12010 checks.
7c98e6bb 12011
99a37bfd
ILT
120122008-04-09 Ian Lance Taylor <iant@google.com>
12013
2cefc357
ILT
12014 PR gold/5996
12015 * script-sections.cc (Sections_element::allocate_to_segment): Add
12016 orphan parameter.
12017 (Output_section_definition::allocate_to_segment): Likewise.
12018 (Orphan_output_section::allocate_to_segment): Likewise.
12019 (Script_sections::attach_sections_using_phdrs_clause): Don't
12020 propagate non-PT_LOAD segments to orphan sections.
12021 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12022 readelf rather than objdump.
12023 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12024 .interp section and PT_INTERP segment are the same size.
12025 * testsuite/Makefile.in: Rebuild.
12026
99a37bfd
ILT
12027 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12028 aliases for symbols defined in the same object.
12029 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12030 (weak_alias_test_SOURCES): New variable.
12031 (weak_alias_test_DEPENDENCIES): New variable.
12032 (weak_alias_test_LDFLAGS): New variable.
12033 (weak_alias_test_LDADD): New variable.
12034 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12035 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12036 (weak_alias_test_3.o): New target.
12037 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12038 * testsuite/weak_alias_test_main.cc: New file.
12039 * testsuite/weak_alias_test_1.cc: New file.
12040 * testsuite/weak_alias_test_2.cc: New file.
12041 * testsuite/weak_alias_test_3.cc: New file.
12042
780e49c5
ILT
120432008-04-08 Ian Lance Taylor <iant@google.com>
12044
cdb0b8f5
ILT
12045 * options.h (class General_options): Add --noinhibit-exec option.
12046 * main.cc (main): Check --noinhibit-exec.
12047
0864d551
ILT
12048 * options.h (class General_options): Define --wrap as a special
12049 option. Add wrap_symbols_ field.
12050 (General_options::any_wrap_symbols): New function.
12051 (General_options::is_wrap_symbol): New function.
12052 * options.cc (General_options::parse_wrap): New function.
12053 (General_options::General_options): Initialize wrap_symbols_.
12054 * symtab.cc (Symbol_table::wrap_symbol): New function.
12055 (Symbol_table::add_from_object): Handle --wrap.
12056 * symtab.h (class Symbol_table): Declare wrap_symbol.
12057 * target.h (Target::wrap_char): New function.
12058 (Target::Target_info): Add wrap_char field.
12059 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12060 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12061 * testsuite/testfile.cc (Target_test::test_target_info):
12062 Likewise.
12063
789aa6de
ILT
12064 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12065 there is one.
12066
2c38906f
ILT
12067 * layout.h (class Layout): Add added_eh_frame_data_ field.
12068 * layout.cc (Layout::Layout): Initialize new field.
12069 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12070 output section until we find a section we merged successfully.
12071 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12072 that the size be non-zero.
12073
780e49c5
ILT
12074 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12075 qualifier.
12076
7fcd0256
ILT
120772008-04-08 Craig Silverstein <csilvers@google.com>
12078
12079 * configure.ac: Export new conditional variable HAVE_ZLIB.
12080 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12081 on HAVE_ZLIB.
12082 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12083 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12084
6835af53
ILT
120852008-04-07 Ian Lance Taylor <iant@google.com>
12086
e24f324c
ILT
12087 * version.cc (version_string): Set to "1.5".
12088
a036edd8
ILT
12089 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12090 Add issued_non_pic_error_ field. Declare check_non_pic.
12091 (Target_x86_64::Scan::check_non_pic): New function.
12092 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12093 (Target_x86_64::Scan::global): Likewise.
12094
624f8810
ILT
12095 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12096 addend parameter. Change caller. Handle merge sections.
12097 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12098 Address to Addend. Don't add in the result of
12099 local_section_offset, pass down the addend and use the returned
12100 value.
12101 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12102 Update declarations of local_section_offset and symbol_value.
12103 * testsuite/two_file_test_1.cc (t18): New function.
12104 * testsuite/two_file_test_2.cc (f18): New function.
12105 * testsuite/two_file_test_main.cc (main): Call t18.
12106 * testsuite/two_file_test.h (t18, f18): Declare.
12107
6835af53
ILT
12108 * configure.ac: Don't test for objdump, c++filt, or readelf.
12109 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12110 conditionals.
12111 (TEST_READELF): New variable.
12112 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12113 (check_PROGRAMS): Add two_file_strip_test.
12114 (two_file_strip_test): New target.
12115 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12116 (two_file_same_shared_strip_test_SOURCES): New variable.
12117 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12118 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12119 (two_file_same_shared_strip_test_LDADD): New variable.
12120 (two_file_shared_strip.so): New target.
12121 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12122 (ver_test_5.syms, ver_test_7.syms): Likewise.
12123 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12124 (strip_test_3.stdout): Use TEST_OBJDUMP.
12125 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12126
86925eef
CC
121272008-04-04 Cary Coutant <ccoutant@google.com>
12128
12129 * symtab.h (Symbol::is_weak_undefined): New function.
12130 (Symbol::is_strong_undefined): New function.
12131 (Symbol::is_absolute): New function.
12132 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12133 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12134 absolute symbols.
12135 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12136 (weak_undef_test): New target.
12137 * testsuite/Makefile.in: Rebuild.
12138 * testsuite/weak_undef_file1.cc: New file.
12139 * testsuite/weak_undef_file2.cc: New file.
12140 * testsuite/weak_undef_test.cc: New file.
12141
126f3ece
ILT
121422008-04-03 Craig Silverstein <csilvers@google.com>
12143
12144 * compressed_output.h (class Output_compressed_section): Use
12145 unsigned buffer.
12146 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12147 add zlib header.
12148 (zlib_compressed_suffix): Removed.
12149 (Output_compressed_section::set_final_data_size): Use unsigned
12150 buffers.
12151 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12152 Fix linker invocation.
12153 (flagstest_o_specialfile_and_compress_debug_sections):
12154 Likewise.
12155 * testsuite/Makefile.in: Regenerated.
12156
deae2a14
DM
121572008-04-02 David S. Miller <davem@davemloft.net>
12158
12159 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12160 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12161
70752818
ILT
121622008-04-02 Craig Silverstein <csilvers@google.com>
12163
12164 * TODO: New file.
12165
39d0cb0e
ILT
121662008-04-02 Ian Lance Taylor <iant@google.com>
12167
12168 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12169 parameters. Update for new key type to views_. Change all
12170 callers.
12171 (File_read::read): Adjust for byteshift in returned view.
12172 (File_read::add_view): New function, broken out of
12173 find_and_make_view.
12174 (File_read::make_view): New function, broken out of
12175 find_and_make_view.
12176 (File_read::find_or_make_view): Add offset and aligned
12177 parameters. Rewrite accordingly. Change all callers.
12178 (File_read::get_view): Add offset and aligned parameters. Adjust
12179 for byteshift in return value.
12180 (File_read::get_lasting_view): Likewise.
12181 * fileread.h (class File_read): Update declarations.
12182 (class File_read::View): Add byteshift_ field. Add byteshift to
12183 constructor. Add byteshift method.
12184 * archive.h (Archive::clear_uncached_views): New function.
12185 (Archive::get_view): Add aligned parameter. Change all callers.
12186 * object.h (Object::get_view): Add aligned parameter. Change all
12187 callers.
12188 (Object::get_lasting_view): Likewise.
12189
12190 * fileread.cc (File_read::release): Don't call clear_views if
12191 there are multiple objects.
12192 * fileread.h (File_read::clear_uncached_views): New function.
12193 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12194 on the archive.
12195
a1207466
CC
121962008-03-31 Cary Coutant <ccoutant@google.com>
12197
12198 Add thin archive support.
12199 * archive.cc (Archive::armagt): New const.
12200 (Archive::setup): Remove task parameter and calls to unlock.
12201 (Archive::unlock_nested_archives): New function.
12202 (Archive::read_header): Add nested_off parameter. Change
12203 all callers.
12204 (Archive::interpret_header): Likewise.
12205 (Archive::include_all_members): Change to handle thin
12206 archives.
12207 (Archive::include_member): Likewise.
12208 * archive.h (Archive::Archive): Add new parameters and
12209 initializers.
12210 (Archive::armagt): New const.
12211 (Archive::setup): Remove task parameter.
12212 (Archive::unlock_nested_archives): New function.
12213 (Archive::read_header): Add nested_off parameter.
12214 (Archive::interpret_header): Likewise.
12215 (Archive::Nested_archive_table): New typedef.
12216 (Archive::is_thin_archive_): New field.
12217 (Archive::nested_archives_): New field.
12218 (Archive::options_): New field.
12219 (Archive::dirpath_): New field.
12220 (Archive::task_): New field.
12221 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12222 for thin archives. Pass additional parameters to
12223 Archive::Archive. Unlock the archive file after calling
12224 Archive::setup.
cd536b21 12225
479f6503
ILT
122262008-03-29 Ian Lance Taylor <iant@google.com>
12227
686c8caf
ILT
12228 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12229 version symbol to be local.
12230 * testsuite/ver_test_4.sh: New file.
12231 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12232 (check_DATA): Add ver_test_4.syms.
12233 (ver_test_4.syms): New target.
12234 * testsuite/Makefile.in: Rebuild.
12235
ab794b6b
ILT
12236 * output.cc
12237 (Output_section::Input_section_sort_entry::has_priority): New
12238 function.
12239 (Output_section::Input_section_sort_entry::match_file_name): New
12240 function.
12241 (Output_section::Input_section_sort_entry::match_section_name):
12242 Remove.
12243 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12244 Remove.
12245 (Output_section::Input_section_sort_entry::match_section_file):
12246 Remove.
12247 (Output_section::Input_section_sort_compare::operator()): Rewrite
12248 using new Input_section_sort_entry functions. Sort crtbegin and
12249 crtend first. Sort sections with no priority before sections with
12250 a priority.
12251 * testsuite/initpri1.c (d3): Check j != 4.
12252 (cd5): New constructor/destructor function.
12253 (main): Check j != 2.
12254
479f6503
ILT
12255 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12256 new symbol when resolving, don't call set_is_default.
12257 * testsuite/ver_test_7.cc: New file.
12258 * testsuite/ver_test_7.sh: New file.
12259 * testsuite/Makefile.am (ver_test_7.so): New target.
12260 (ver_test_7.o): New target.
12261 (check_SCRIPTS): Add ver_test_7.sh.
12262 (check_DATA): Add ver_test_7.syms.
12263 (ver_test_7.syms): New target.
12264
2fd32231
ILT
122652008-03-28 Ian Lance Taylor <iant@google.com>
12266
12267 * layout.cc (Layout::layout): If we see an input section with a
12268 name that needs sorting, set the must_sort flag for the output
12269 section.
12270 (Layout::make_output_section): If the name of the output section
12271 indicates that it might require sorting, set the may_sort flag.
12272 * output.h (Output_section::may_sort_attached_input_sections): New
12273 function.
12274 (Output_section::set_may_sort_attached_input_sections): New
12275 function.
12276 (Output_section::must_sort_attached_input_sections): New
12277 function.
12278 (Output_section::set_must_sort_attached_input_sections): New
12279 function.
12280 (class Output_section): Declare Input_section_sort_entry. Define
12281 Input_section_sort_compare. Declare
12282 sort_attached_input_sections. Add new fields:
12283 may_sort_attached_input_sections_,
12284 must_sort_attached_input_sections_,
12285 attached_input_sections_are_sorted_.
12286 * output.cc (Output_section::Output_section): Initialize new
12287 fields.
12288 (Output_section::add_input_section): Add an entry to
12289 input_sections_ if may_sort or must_sort are true.
12290 (Output_section::set_final_data_size): Call
12291 sort_attached_input_sections if necessary.
12292 (Output_section::Input_section_sort_entry): Define new class.
12293 (Output_section::Input_section_sort_compare::operator()): New
12294 function.
12295 (Output_section::sort_attached_input_sections): New function.
12296 * configure.ac: Check whether the compiler supports constructor
12297 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12298 * testsuite/initpri1.c: New file.
12299 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12300 CONSTRUCTOR_PRIORITY.
12301 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12302 (initpri1_LDFLAGS): New variable.
12303 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12304
18e6b24e
ILT
123052008-03-27 Ian Lance Taylor <iant@google.com>
12306
49bdd526
ILT
12307 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12308 * testsuite/common_test_1.c: New file.
12309 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12310 (common_test_1_SOURCES): New variable.
12311 (common_test_1_DEPENDENCIES): New variable.
12312 (common_test_1_LDFLAGS): New variable.
12313
18e6b24e
ILT
12314 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12315 and commons_ correctly when NAME/VERSION does not override
12316 NAME/NULL.
12317 * testsuite/ver_test_6.c: New file.
12318 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12319 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12320 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12321
04bf7072
ILT
123222008-03-26 Ian Lance Taylor <iant@google.com>
12323
5871526f
ILT
12324 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12325 of an undefined symbol from a version script.
12326 * testsuite/Makefile.am (ver_test_5.so): New target.
12327 (ver_test_5.o): New target.
12328 (check_SCRIPTS): Add ver_test_5.sh.
12329 (check_DATA): Add ver_test_5.syms.
12330 (ver_test_5.syms): New target.
12331 * testsuite/ver_test_5.cc: New file.
12332 * testsuite/ver_test_5.script: New file.
12333 * testsuite/ver_test_5.sh: New file.
12334 * Makefile.in, testsuite/Makefile.in: Rebuild.
12335
04bf7072
ILT
12336 PR gold/5986
12337 Fix problems building gold with gcc 4.3.0.
12338 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12339 (gold_error_at_location, gold_warning_at_location): Use it.
12340 * configure.ac: Check whether we can compile and use a template
12341 function with a printf attribute.
12342 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12343 when jumping over bytes.
12344 * object.cc: Instantiate Object::read_section_data.
12345 * debug.h: Include <cstring>
12346 * dwarf_reader.cc: Include <algorithm>
12347 * main.cc: Include <cstring>.
12348 * options.cc: Include <cstring>.
12349 * output.cc: Include <cstring>.
12350 * script.cc: Include <cstring>.
12351 * script.h: Include <string>.
12352 * symtab.cc: Include <cstring> and <algorithm>.
12353 * target-select.cc: Include <cstring>.
12354 * version.cc: Include <string>.
12355 * testsuite/testmain.cc: Include <cstdlib>.
12356 * configure, config.in: Rebuild.
12357
874c5b28
ILT
123582008-03-25 Ian Lance Taylor <iant@google.com>
12359
819d6c3a
ILT
12360 * options.cc: Include "../bfd/bfdver.h".
12361 (options::help): Print bug reporting address.
12362
f4b2c6f5
ILT
12363 * version.cc (print_version): Adjust output for current value of
12364 BFD_VERSION_STRING.
12365
12366 * NEWS: New file.
12367
e96caa79
ILT
12368 * options.cc (options::help): Print list of supported targets.
12369 * target-select.h: Include <vector>.
12370 (class Target_selector): Make machine_, size_, and is_big_endian_
12371 fields const. Add bfd_name_ and instantiated_target_ fields.
12372 (Target_selector::Target_selector): Add bfd_name parameter.
12373 (Target_selector::recognize): Make non-virtual, call
12374 do_recognize.
12375 (Target_selector::recognize_by_name): Make non-virtual, call
12376 do_recognize_by_name.
12377 (Target_selector::supported_names): New function.
12378 (Target_selector::bfd_name): New function.
12379 (Target_selector::do_instantiate_target): New pure virtual
12380 function.
12381 (Target_selector::do_recognize): New virtual function.
12382 (Target_selector::do_recognize_by_name): New virtual function.
12383 (Target_selector::instantiate_target): New private function.
12384 (supported_target_names): Declare.
12385 * target-select.cc (Target_selector::Target_selector): Update for
12386 new parameter and fields.
12387 (select_target_by_name): Check that the name matches before
12388 calling recognize_by_name.
12389 (supported_target_names): New function.
12390 * i386.cc (class Target_selector_i386): Update Target_selector
12391 constructor call. Remove recognize and recognize_by_name. Add
12392 do_instantiate_target.
12393 * x86_64.cc (class Target_selector_x86_64): Likewise.
12394 * testsuite/testfile.cc (class Target_selector_test): Update for
12395 changes to Target_selector.
12396
874c5b28
ILT
12397 * README: Rewrite, with some notes on unsupported features.
12398
0a65a3a7
CC
123992008-03-24 Cary Coutant <ccoutant@google.com>
12400
12401 * i386.cc (Target_i386::Got_type): New enum declaration.
12402 (Target_i386::Scan::local): Updated callers of Output_data_got
12403 member functions.
12404 (Target_i386::Scan::global): Likewise.
12405 (Target_i386::Relocate::relocate): Likewise.
12406 (Target_i386::Relocate::relocate_tls): Likewise.
12407 * object.h (Got_offset_list): New class.
12408 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12409 (Sized_relobj::local_got_offset): Likewise.
12410 (Sized_relobj::set_local_got_offset): Likewise.
12411 (Sized_relobj::local_has_tls_got_offset): Removed.
12412 (Sized_relobj::local_tls_got_offset): Removed.
12413 (Sized_relobj::set_local_tls_got_offset): Removed.
12414 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12415 * output.cc (Output_data_got::add_global): Added got_type parameter.
12416 (Output_data_got::add_global_with_rel): Likewise.
12417 (Output_data_got::add_global_with_rela): Likewise.
12418 (Output_data_got::add_global_pair_with_rel): New function.
12419 (Output_data_got::add_global_pair_with_rela): New function.
12420 (Output_data_got::add_local): Added got_type parameter.
12421 (Output_data_got::add_local_with_rel): Likewise.
12422 (Output_data_got::add_local_with_rela): Likewise.
12423 (Output_data_got::add_local_pair_with_rel): New function.
12424 (Output_data_got::add_local_pair_with_rela): New function.
12425 (Output_data_got::add_global_tls): Removed.
12426 (Output_data_got::add_global_tls_with_rel): Removed.
12427 (Output_data_got::add_global_tls_with_rela): Removed.
12428 (Output_data_got::add_local_tls): Removed.
12429 (Output_data_got::add_local_tls_with_rel): Removed.
12430 (Output_data_got::add_local_tls_with_rela): Removed.
12431 * output.h (Output_data_got::add_global): Added got_type parameter.
12432 (Output_data_got::add_global_with_rel): Likewise.
12433 (Output_data_got::add_global_with_rela): Likewise.
12434 (Output_data_got::add_global_pair_with_rel): New function.
12435 (Output_data_got::add_global_pair_with_rela): New function.
12436 (Output_data_got::add_local): Added got_type parameter.
12437 (Output_data_got::add_local_with_rel): Likewise.
12438 (Output_data_got::add_local_with_rela): Likewise.
12439 (Output_data_got::add_local_pair_with_rel): New function.
12440 (Output_data_got::add_local_pair_with_rela): New function.
12441 (Output_data_got::add_global_tls): Removed.
12442 (Output_data_got::add_global_tls_with_rel): Removed.
12443 (Output_data_got::add_global_tls_with_rela): Removed.
12444 (Output_data_got::add_local_tls): Removed.
12445 (Output_data_got::add_local_tls_with_rel): Removed.
12446 (Output_data_got::add_local_tls_with_rela): Removed.
12447 * resolve.cc (Symbol::override_base_with_special): Removed
12448 reference to has_got_offset_ field.
12449 * symtab.cc (Symbol::init_fields): Replaced initialization
12450 of got_offset_ with got_offsets_. Removed initialization
12451 of has_got_offset_
53fcba31 12452 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
12453 (Symbol::got_offset): Likewise.
12454 (Symbol::set_got_offset): Likewise.
12455 (Symbol::has_tls_got_offset): Removed.
12456 (Symbol::tls_got_offset): Removed.
12457 (Symbol::set_tls_got_offset): Removed.
12458 (Symbol::got_offset_): Removed.
12459 (Symbol::tls_mod_got_offset_): Removed.
12460 (Symbol::tls_pair_got_offset_): Removed.
12461 (Symbol::got_offsets_): New field.
12462 (Symbol::has_got_offset): Removed.
12463 (Symbol::has_tls_mod_got_offset): Removed.
12464 (Symbol::has_tls_pair_got_offset): Removed.
12465 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12466 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12467 member functions.
12468 (Target_x86_64::Scan::global): Likewise.
12469 (Target_x86_64::Relocate::relocate): Likewise.
12470 (Target_x86_64::Relocate::relocate_tls): Likewise.
12471
bd52eafb
BE
124722008-03-25 Ben Elliston <bje@au.ibm.com>
12473
12474 * yyscript.y: Fix spelling error in comment.
12475
8b105e34
ILT
124762008-03-24 Ian Lance Taylor <iant@google.com>
12477
8ed814a9
ILT
12478 * options.h (class General_options): Define build_id option.
12479 * layout.h (class Layout): Declare write_build_id, create_note,
12480 create_build_id. Add build_id_note_ member.
12481 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12482 "libiberty.h", "md5.h", "sha1.h".
12483 (Layout::Layout): Initialize eh_frame_data_,
12484 eh_frame_hdr_section_, and build_id_note_.
12485 (Layout::finalize): Call create_build_id.
12486 (Layout::create_note): New function, broken out of
12487 Layout::create_gold_note.
12488 (Layout::create_gold_note): Call create_note.
12489 (Layout::create_build_id): New function.
12490 (Layout::write_build_id): New function.
12491 (Close_task_runner::run): Call write_build_id.
12492
8b105e34
ILT
12493 * x86_64.cc: Correct license to GPLv3.
12494
086a1841
ILT
124952008-03-23 Ian Lance Taylor <iant@google.com>
12496
12497 * options.cc: Include "demangle.h".
12498 (parse_optional_string): New function.
12499 (parse_long_option): Handle takes_optional_argument.
12500 (parse_short_option): Update dash_z initializer. Handle
12501 takes_optional_argument.
12502 (General_options::General_options): Initialize do_demangle_.
12503 (General_options::finalize): Set do_demangle_. Handle demangling
12504 style.
12505 * options.h (parse_optional_string): Declare.
12506 (struct One_option): Add optional_arg field. Update constructor.
12507 Update call constructor calls. Add takes_optional_argument
12508 function.
12509 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12510 (DEFINE_optional_string): Define.
12511 (General_options::demangle): Change from DEFINE_bool to
12512 DEFINE_optional_string.
12513 (General_options::no_demangle): New function.
12514 (General_options::do_demangle): New function.
12515 (General_options::set_do_demangle): New function.
12516 (General_options::execstack_status_): Move definition to end of
12517 class definition.
12518 (General_options::static_): Likewise.
12519 (General_options::do_demangle_): New field.
12520 * object.cc (big_endian>::get_symbol_location_info): Call
12521 Options::do_demangle, not Options::demangle.
12522 * symtab.cc (demangle): Likewise.
12523
cbb93e63
ILT
125242008-03-22 Ian Lance Taylor <iant@google.com>
12525
12526 * gold.h: Include <cstddef> and <sys/types.h>
12527 * options.h: Include <cstring>.
12528
ec531623
ILT
125292008-03-21 Ian Lance Taylor <iant@google.com>
12530
12531 * Added source code to GNU binutils.
This page took 0.721847 seconds and 4 git commands to generate.