PR gold/13850
[binutils-gdb.git] / gold / ChangeLog
1 2012-03-15 Ian Lance Taylor <iant@google.com>
2
3 PR gold/13850
4 * layout.cc (Layout::make_output_section): Correctly mark
5 SHT_INIT_ARRAY, et. al., as relro.
6
7 2012-03-14 Doug Kwan <dougkwan@google.com>
8
9 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
10 dynamic relocations for protected symbols in shared objects.
11
12 2012-03-13 Ian Lance Taylor <iant@google.com>
13
14 * resolve.cc (Symbol_table::resolve): When merging common symbols,
15 keep the larger alignment.
16
17 2012-03-12 Cary Coutant <ccoutant@google.com>
18
19 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
20 handling of DW_LNE_define_file.
21
22 2012-03-12 Cary Coutant <ccoutant@google.com>
23
24 * reduced_debug_output.cc
25 (Output_reduced_debug_info_section::get_die_end): Add new FORM
26 codes to switch.
27
28 2012-02-29 Cary Coutant <ccoutant@google.com>
29
30 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
31
32 2012-02-29 Cary Coutant <ccoutant@google.com>
33
34 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
35 Call Object::decompressed_section_contents.
36 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
37 New dtor.
38 (Sized_dwarf_line_info::buffer_start_): New data member.
39 * merge.cc (Output_merge_data::do_add_input_section): Call
40 Object::decompressed_section_contents.
41 (Output_merge_string::do_add_input_section): Likewise.
42 * object.cc (need_decompressed_section): New function.
43 (build_compressed_section_map): Decompress sections needed later.
44 (Sized_relobj_file::do_decompressed_section_contents): New function.
45 (Sized_relobj_file::do_discard_decompressed_sections): New function.
46 * object.h (Object::decompressed_section_contents): New function.
47 (Object::discard_decompressed_sections): New function.
48 (Object::do_decompressed_section_contents): New function.
49 (Object::do_discard_decompressed_sections): New function.
50 (Compressed_section_info): New type.
51 (Compressed_section_map): Include decompressed section contents.
52 (Sized_relobj_file::do_decompressed_section_contents): New function.
53 (Sized_relobj_file::do_discard_decompressed_sections): New function.
54
55 2012-02-16 Cary Coutant <ccoutant@google.com>
56
57 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
58 * testsuite/Makefile.in: Regenerate.
59
60 2012-02-14 Cary Coutant <ccoutant@google.com>
61
62 * options.cc (General_options::finalize): Disallow -pie and -static.
63
64 2012-02-03 Doug Kwan <dougkwan@google.com>
65
66 * arm.cc (Arm_relocate_functions::abs8,
67 Arm_relocate_functions::abs16): Use
68 Bits::has_signed_unsigned_overflow32.
69 (Arm_relocate_functions::thm_abs8): Correct range of
70 overflow check.
71 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
72 in assertions.
73
74 2012-02-02 Doug Kwan <dougkwan@google.com>
75
76 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
77 position independent outputs, not just shared objects.
78
79 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
80
81 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
82 * configure: Regenerated.
83
84 2012-01-27 Ian Lance Taylor <iant@google.com>
85
86 * reloc.h (Bits): New class with static functions, copied from
87 namespace utils in arm.cc.
88 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
89 instead.
90
91 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
92
93 * incremental.cc (write_info_blocks): Correct relocation offset.
94
95 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
96
97 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
98 (Relocate::tls_gd_to_le): Likewise.
99
100 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
101
102 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
103
104 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
105
106 * configure.ac: Check if -mcmodel=medium works.
107 * configure: Regenerated.
108
109 2012-01-24 Cary Coutant <ccoutant@google.com>
110
111 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
112 definition and ...
113 (read_unsigned_LEB_128_x): ... this new function.
114 (read_signed_LEB_128): Replaced with inline definition and ...
115 (read_signed_LEB_128_x): ... this new function.
116 * int_encoding.h (read_unsigned_LEB_128_x): New function.
117 (read_unsigned_LEB_128): Add inline definition.
118 (read_signed_LEB_128_x): New function.
119 (read_signed_LEB_128): Add inline definition.
120 * testsuite/Makefile.am (leb128_unittest): New unit test.
121 * testsuite/Makefile.in: Regenerate.
122 * testsuite/leb128_unittest.cc: New unit test.
123
124 2012-01-23 Ian Lance Taylor <iant@google.com>
125
126 PR gold/13617
127 * i386.cc (Target_i386::do_code_fill): When using a jmp
128 instruction, pad with nop instructions.
129 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
130
131 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
132
133 * x86_64.cc (gc_process_relocs): Add typename on types used in
134 template.
135 (scan_relocs): Likewise.
136 (relocate_section): Likewise.
137 (apply_relocation): Likewise.
138
139 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
140
141 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
142 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
143 under x32.
144
145 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
146
147 * x86_64.cc: Initial support for x32.
148
149 2012-01-03 Cary Coutant <ccoutant@google.com>
150
151 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
152 Use abstract base class for GOT.
153 * gold/output.h (class Output_data_got_base): New abstract base class.
154 (class Output_data_got): Derive from new base class, adjust ctors.
155 (Output_data_got::reserve_slot): Make virtual; rename to
156 do_reserve_slot; Adjust callers.
157 * gold/target.h (Sized_target::init_got_plt_for_update): Return
158 pointer to abstract base class.
159 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
160
161 2011-12-18 Ian Lance Taylor <iant@google.com>
162
163 * object.h (Relobj::local_symbol_value): New function.
164 (Relobj::local_plt_offset): New function.
165 (Relobj::local_has_got_offset): New function.
166 (Relobj::local_got_offset): New function.
167 (Relobj::set_local_got_offset): New function.
168 (Relobj::do_local_symbol_value): New pure virtual function.
169 (Relobj::do_local_plt_offset): Likewise.
170 (Relobj::do_local_has_got_offset): Likewise.
171 (Relobj::do_local_got_offset): Likewise.
172 (Relobj::do_set_local_got_offset): Likewise.
173 (Sized_relobj::do_local_has_got_offset): Rename from
174 local_has_got_offset.
175 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
176 (Sized_relobj::do_set_local_got_offset): Rename from
177 set_local_got_offset.
178 (Sized_relobj_file::do_local_plt_offset): Rename from
179 local_plt_offset.
180 (Sized_relobj_file::do_local_symbol_value): New function.
181 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
182 local_plt_offset.
183 * output.cc (Output_data_got::Got_entry::write): Change object to
184 Relobj. Use local_symbol_value.
185 (Output_data_got::add_global_with_rel): Change rel_dyn to
186 Output_data_reloc_generic*. Use add_global_generic.
187 (Output_data_got::add_global_with_rela): Remove. Change all
188 callers to use add_global_with_rel.
189 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
190 Output_data_reloc_generic*. Use add_global_generic.
191 (Output_data_got::add_global_pair_with_rela): Remove. Change all
192 callers to use add_global_pair_with_rel.
193 (Output_data_got::add_local): Change object to Relobj*.
194 (Output_data_got::add_local_plt): Likewise.
195 (Output_data_got::add_local_with_rel): Change object to Relobj*,
196 change rel_dyn to Output_data_reloc_generic*. Use
197 add_local_generic.
198 (Output_data_got::add_local_with_rela): Remove. Change all
199 callers to use all_local_with_rel.
200 (Output_data_got::add_local_pair_with_rel): Change object to
201 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
202 add_output_section_generic.
203 (Output_data_got::add_local_pair_with_rela): Remove. Change all
204 callers to use add_local_pair_with_rel.
205 (Output_data_got::reserve_local): Change object to Relobj*.
206 * output.h: (class Output_data_reloc_generic): Add pure virtual
207 declarations for add_global_generic, add_local_generic,
208 add_output_section_generic.
209 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
210 functions for Output_data_reloc_generic. Update declarations for
211 changes listed in output.cc.
212 (class Output_data_got): Change template parameter to got_size.
213 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
214 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
215 function.
216 (Sized_relobj_incr::do_local_plt_offset): New function.
217 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
218 add_global_generic.
219
220 2011-12-17 Cary Coutant <ccoutant@google.com>
221
222 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
223 * resolve.cc (Symbol_table::resolve): Likewise.
224 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
225 arrays.
226 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
227
228 2011-12-16 Ian Lance Taylor <iant@google.com>
229
230 * output.h (Output_data_reloc_generic::add): Only call
231 add_dynamic_reloc if this is a dynamic reloc section.
232
233 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
234
235 PR gold/13505
236 * target-reloc.h (apply_relocation): Replace <64, false> with
237 <size, big_endian>.
238
239 2011-11-25 Nick Clifton <nickc@redhat.com>
240
241 * po/it.po: New Italian translation.
242
243 2011-11-17 Sterling Augustine <saugustine@google.com>
244
245 * script.cc (script_include_directive): Implement.
246 (read_script_file): New local variables name and search_path. Update
247 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
248 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
249 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
250
251 2011-11-11 Sterling Augustine <saugustine@google.com>
252
253 * yyscript.y (section_cmd): Add support for INCLUDE directive.
254 (file_or_sections_cmd): Likewise.
255
256 2011-11-11 Doug Kwan <dougkwan@google.com>
257
258 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
259 if --just-symbols is given.
260
261 2011-11-10 Doug Kwan <dougkwan@google.com>
262
263 PR gold/13362
264 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
265 when processing data relocs.
266 * reloc.h (Relocate_functions::rel_unaligned): New method.
267 (Relocate_functions::pcrel_unaligned): Ditto.
268 (Relocate_functions::rel32_unaligned): Ditto.
269 (Relocate_functions::pcrel32_unaligned): Ditto.
270
271 2011-11-09 Doug Kwan <dougkwan@google.com>
272
273 PR gold/13362
274 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
275 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
276 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
277 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
278 (Relocate_functions::rel_unaligned): New.
279 (Relocate_functions::rel32_unaligned): New.
280 * target-reloc.h (relocate_for_relocatable): Add code to handle
281 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
282 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
283 arm_unaligned_reloc_r): New targets.
284 * testsuite/Makefile.in: Regenerate.
285 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
286 linking.
287
288 2011-11-02 Ian Lance Taylor <iant@google.com>
289
290 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
291 NATIVE_LINKER.
292 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
293 * options.cc (General_options::finalize): Use library search path
294 from configure script if specified. If not native and no sysroot,
295 only search TOOLLIBDIR.
296 * options.h (Search_directory::Search_directory): Change name to
297 const std::string&.
298 (General_options::add_to_library_path_with_sysroot): Change arg to
299 const std::string&.
300 * configure, Makefile.in, config.in: Rebuild.
301
302 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
303
304 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
305 we are working around the ARM1176 Erratum.
306 * options.h (General_options::fix_arm1176): Add option.
307 * testsuite/Makefile.am: Add testcases, and keep current ones
308 working.
309 * testsuite/Makefile.in: Regenerate.
310 * testsuite/arm_fix_1176.s: New file.
311 * testsuite/arm_fix_1176.sh: Likewise.
312
313 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
314
315 * arm.cc (Target_arm::Target_arm): Remove initialisation of
316 may_use_blx_.
317 (Target_arm::may_use_blx): Remove method.
318 (Target_arm::set_may_use_blx): Likewise.
319 (Target_arm::may_use_v4t_interworking): New method.
320 (Target_arm::may_use_v5t_interworking): Likewise.
321 (Target_arm::may_use_blx_): Remove member variable.
322 (Arm_relocate_functions::arm_branch_common): Check for v5T
323 interworking.
324 (Arm_relocate_functions::thumb_branch_common): Likewise.
325 (Reloc_stub::stub_type_for_reloc): Likewise.
326 (Target_arm::do_finalize_sections): Correct interworking checks.
327 * testsuite/Makefile.am: Add new tests.
328 * testsuite/Makefile.in: Regenerate.
329 * testsuite/arm_farcall_arm_arm.s: New test.
330 * testsuite/arm_farcall_arm_arm.sh: Likewise.
331 * testsuite/arm_farcall_arm_thumb.s: Likewise.
332 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
333 * testsuite/arm_farcall_thumb_arm.s: Likewise.
334 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
335 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
336 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
337
338 2011-10-31 Cary Coutant <ccoutant@google.com>
339
340 PR gold/13023
341 * expression.cc (Expression::eval_with_dot): Add
342 is_section_dot_assignment parameter.
343 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
344 absolute and assigning to dot within a section.
345 * script-sections.cc
346 (Output_section_element_assignment::set_section_addresses): Pass
347 dot_section to set_if_absolute.
348 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
349 as is_section_dot_assignment flag to eval_with_dot.
350 (Output_section_element_dot_assignment::set_section_addresses):
351 Likewise.
352 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
353 parameter. Also set value if relative to dot_section; set the
354 symbol's output_section.
355 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
356 parameter. Adjust all callers.
357 (Expression::eval_maybe_dot): Likewise.
358 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
359 Adjust all callers.
360 * testsuite/script_test_2.t: Test assignment of an absolute value
361 to dot within an output section element.
362
363 2011-10-31 Cary Coutant <ccoutant@google.com>
364
365 * options.h (class General_options): Add --[no-]gnu-unique options.
366 * symtab.cc (Symbol_table::sized_write_globals): Convert
367 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
368
369 2011-10-31 Cary Coutant <ccoutant@google.com>
370
371 PR gold/13359
372 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
373 unnecessary assertion.
374 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
375
376 2011-10-31 Sriraman Tallam <tmsriram@google.com>
377
378 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
379 gc_mark_symbol.
380 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
381 gc_mark_symbol.
382 Change to just keep the section associated with symbol.
383 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
384 they are externally visible and --export-dynamic is turned on.
385 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
386
387 2011-10-19 Ian Lance Taylor <iant@google.com>
388
389 PR gold/13163
390 * script-sections.cc
391 (Output_section_element_dot_assignment::needs_output_section): New
392 function.
393
394 2011-10-19 Ian Lance Taylor <iant@google.com>
395
396 PR gold/13204
397 * layout.cc (Layout::segment_precedes): Don't assert failure if a
398 --section-start option was seen.
399 * options.h (General_options::any_section_start): New function.
400
401 2011-10-18 David S. Miller <davem@davemloft.net>
402
403 PR binutils/13301
404 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
405 member to track relocation locations that have moved during TLS
406 reloc optimizations.
407 (Target_sparc::Relocate::Relocate): Initialize to NULL.
408 (Target_sparc::Relocate::relocate): Adjust view down by 4
409 bytes if it matches reloc_adjust_addr_.
410 (Target_sparc::Relocate::relocate_tls): Always move the
411 __tls_get_addr call delay slot instruction forward 4 bytes when
412 performing relaxation.
413
414 2011-10-18 Cary Coutant <ccoutant@google.com>
415
416 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
417 (Output_file::map_no_anonymous): Check for non-zero
418 return code from posix_fallocate.
419
420 2011-10-17 Cary Coutant <ccoutant@google.com>
421
422 PR gold/13245
423 * plugin.cc (is_visible_from_outside): Check for symbols
424 referenced from dynamic objects.
425 * resolve.cc (Symbol_table::resolve): Don't count references
426 from dynamic objects as references from real ELF files.
427 * testsuite/plugin_test_2.sh: Adjust expected result.
428
429 2011-10-17 Cary Coutant <ccoutant@google.com>
430
431 * gold.cc: Include timer.h.
432 (queue_middle_tasks): Stamp time.
433 (queue_final_tasks): Likewise.
434 * main.cc (main): Store timer in parameters. Print timers
435 for each pass.
436 * parameters.cc (Parameters::Parameters): Initialize timer_.
437 (Parameters::set_timer): New function.
438 (set_parameters_timer): New function.
439 * parameters.h (Parameters::set_timer): New function.
440 (Parameters::timer): New function.
441 (Parameters::timer_): New data member.
442 (set_parameters_timer): New function.
443 * timer.cc (Timer::stamp): New function.
444 (Timer::get_pass_time): New function.
445 * timer.h (Timer::stamp): New function.
446 (Timer::get_pass_time): New function.
447 (Timer::pass_times_): New data member.
448
449 2011-10-17 Cary Coutant <ccoutant@google.com>
450
451 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
452 task for members of lib groups.
453
454 2011-10-17 Cary Coutant <ccoutant@google.com>
455
456 PR gold/13288
457 * fileread.cc (File_read::find_view): Add assert.
458 (File_read::make_view): Move bounds check (replace with assert)...
459 (File_read::find_or_make_view): ... to here.
460
461 2011-10-12 Cary Coutant <ccoutant@google.com>
462
463 * output.cc (Output_file::open_base_file): Handle case where
464 ::read returns less than requested size.
465
466 2011-10-10 Cary Coutant <ccoutant@google.com>
467
468 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
469 Initialize defined_count_.
470 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
471 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
472 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
473 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
474 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
475 * incremental.h (Sized_relobj_incr::defined_count_): New data
476 member.
477 (Sized_incr_dynobj::defined_count_): New data member.
478 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
479 Return zeroes instead of internal error.
480
481 2011-10-10 Cary Coutant <ccoutant@google.com>
482
483 PR gold/13249
484 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
485 (Output_reloc::symbol_value): Return PLT offset if flag is set.
486 * output.h (class Output_reloc): Add use_plt_offset flag.
487 (Output_reloc::type_): Adjust size of bit field.
488 (Output_reloc::use_plt_offset_): New bit field.
489 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
490 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
491 flag. Adjust all callers.
492 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
493 creating RELATIVE relocations.
494
495 2011-10-10 Nick Clifton <nickc@redhat.com>
496
497 * po/es.po: Updated Spanish translation.
498 * po/fi.po: Updated Finnish translation.
499
500 2011-10-03 Diego Novillo <dnovillo@google.com>
501
502 * options.cc (parse_uint): Fix dereference of RETVAL.
503
504 2011-09-29 Sriraman Tallam <tmsriram@google.com>
505
506 * layout.h (section_order_map_): New member.
507 (get_section_order_map): New member function.
508 * output.cc (Output_section::add_input_section): Check for patterns
509 only when --section-ordering-file is specified.
510 * gold.cc (queue_middle_tasks): Delay updating order of sections till
511 output_sections have been formed.
512 * layout.cc (Layout_Layout): Initialize section_order_map_.
513 * plugin.cc (update_section_order): Store order in order_map. Do not
514 update the order.
515 * testsuite/Makefile.am: Add test case for plugin_final_layout.
516 * testsuite/Makefile.in: Regenerate.
517 * testsuite/plugin_section_order.c: New file.
518 * testsuite/plugin_final_layout.cc: New file.
519 * testsuite/plugin_final_layout.sh: New file.
520
521 2011-09-29 Cary Coutant <ccoutant@google.com>
522
523 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
524 Check for NULL.
525 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
526 symbols during incremental update.
527 (Symbol_table::add_from_dynobj): Likewise.
528
529 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
530 Ian Lance Taylor <iant@google.com>
531
532 * symtab.cc (Symbol_table::define_special_symbol): Always
533 canonicalize version string.
534
535 2011-09-26 Cary Coutant <ccoutant@google.com>
536
537 * gold.cc (queue_initial_tasks): Move option checks ...
538 * options.cc (General_options::finalize): ... to here. Disable
539 some options; make others fatal.
540
541 2011-09-26 Cary Coutant <ccoutant@google.com>
542
543 gcc PR lto/47247
544 * plugin.cc (get_symbols_v2): New function.
545 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
546 (is_referenced_from_outside): New function.
547 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
548 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
549 (get_symbols): Pass version parameter.
550 (get_symbols_v2): New function.
551 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
552 parameter.
553 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
554 (onload): Add LDPT_GET_SYMBOLS_V2.
555 (all_symbols_read_hook): Use get_symbols_v2; check for
556 LDPR_PREVAILING_DEF_IRONLY_EXP.
557 * testsuite/plugin_test_3.sh: Update expected results.
558
559 2011-09-23 Simon Baldwin <simonb@google.com>
560
561 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
562 configuration options.
563 * configure: Regenerate.
564 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
565 * Makefile.in: Regenerate.
566 * testsuite/Makefile.in: Regenerate.
567
568 2011-09-19 Sriraman Tallam <tmsriram@google.com>
569
570 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
571
572 2011-09-19 Cary Coutant <ccoutant@google.com>
573
574 * incremental.cc (can_incremental_update): Fix typo in comment.
575 * incremental.h (can_incremental_update): Likewise.
576
577 2011-09-18 Cary Coutant <ccoutant@google.com>
578
579 * incremental.cc (can_incremental_update): New function.
580 * incremental.h (can_incremental_update): New function.
581 * layout.cc (Layout::init_fixed_output_section): Call it.
582 (Layout::make_output_section): Don't allow patch space in .eh_frame.
583 * object.cc (Sized_relobj_file::do_layout): Call
584 can_incremental_update.
585
586 2011-09-13 Cary Coutant <ccoutant@google.com>
587
588 * configure.ac: Check for glibc support for gnu_indirect_function
589 support with static linking, setting automake conditional
590 IFUNC_STATIC.
591 * Makefile.in: Regenerate.
592 * configure: Regenerate.
593
594 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
595 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
596 for IFUNC_STATIC.
597 * testsuite/Makefile.in: Regenerate.
598
599 2011-09-13 Cary Coutant <ccoutant@google.com>
600
601 * incremental.cc (Sized_relobj_incr::do_layout): Call
602 report_comdat_group for kept comdat sections.
603 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
604 * testsuite/Makefile.in: Regenerate.
605 * testsuite/incr_comdat_test_1.cc: New source file.
606 * testsuite/incr_comdat_test_2_v1.cc: New source file.
607 * testsuite/incr_comdat_test_2_v2.cc: New source file.
608 * testsuite/incr_comdat_test_2_v3.cc: New source file.
609
610 2011-09-13 Ian Lance Taylor <iant@google.com>
611
612 * object.cc (Sized_relobj_file::do_layout): Remove unused local
613 variable external_symbols_offset.
614
615 2011-09-12 Ian Lance Taylor <iant@google.com>
616
617 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
618 triggered if object has no symbols.
619
620 2011-09-09 David S. Miller <davem@davemloft.net>
621
622 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
623 (Output_fill_debug_line::do_write): Likewise.
624
625 2011-08-29 Cary Coutant <ccoutant@google.com>
626
627 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
628 casts to match formatting specs.
629 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
630
631 2011-08-26 Cary Coutant <ccoutant@google.com>
632
633 * layout.cc (Free_list::allocate): Provide guarantee of minimum
634 remaining hole size when allocating.
635 (Layout::make_output_section): Set fill methods for debug sections.
636 * layout.h (Free_list::Free_list_node): Move from private to
637 public.
638 (Free_list::set_min_hole_size): New function.
639 (Free_list::begin, Free_list::end): New functions.
640 (Free_list::min_hole_): New data member.
641 * output.cc: Include dwarf.h.
642 (Output_fill_debug_info::do_minimum_hole_size): New function.
643 (Output_fill_debug_info::do_write): New function.
644 (Output_fill_debug_line::do_minimum_hole_size): New function.
645 (Output_fill_debug_line::do_write): New function.
646 (Output_section::Output_section): Initialize new data member.
647 (Output_section::set_final_data_size): Ensure patch space is larger
648 than minimum hole size.
649 (Output_section::do_write): Fill holes in debug sections.
650 * output.h (Output_fill): New class.
651 (Output_fill_debug_info): New class.
652 (Output_fill_debug_line): New class.
653 (Output_section::set_free_space_fill): New function.
654 (Output_section::free_space_fill_): New data member.
655 * testsuite/Makefile.am (incremental_test_3): Add
656 --incremental-patch option.
657 (incremental_test_4): Likewise.
658 (incremental_test_5): Likewise.
659 (incremental_test_6): Likewise.
660 (incremental_copy_test): Likewise.
661 (incremental_common_test_1): Likewise.
662 * testsuite/Makefile.in: Regenerate.
663
664 2011-08-26 Nick Clifton <nickc@redhat.com>
665
666 * po/es.po: Updated Spanish translation.
667
668 2011-08-01 Cary Coutant <ccoutant@google.com>
669
670 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
671 * gold/testsuite/Makefile.in: Regenerate.
672 * gold/testsuite/justsyms_exec.c: New source file.
673 * gold/testsuite/justsyms_lib.c: New source file.
674
675 2011-08-01 Cary Coutant <ccoutant@google.com>
676
677 * layout.cc (Layout::set_segment_offsets): Don't realign text
678 segment if -Ttext was specified.
679 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
680 file type.
681 * object.h (Sized_relobj_file::e_type): New function.
682 (Sized_relobj_file::e_type_): New data member.
683 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
684 base address for ET_EXEC files.
685 * target.cc (Target::do_make_elf_object_implementation): Allow
686 ET_EXEC files with --just-symbols option.
687
688 2011-07-28 Cary Coutant <ccoutant@google.com>
689
690 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
691 Add thread_number parameter.
692 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
693 * workqueue-threads.cc
694 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
695 current thread if its thread number is greater than desired thread
696 count.
697 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
698 Add thread_number parameter.
699 (Workqueue::should_cancel_thread): Likewise.
700 (Workqueue::find_runnable_or_wait): Pass thread_number to
701 should_cancel_thread.
702 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
703 parameter.
704
705 2011-07-22 Sriraman Tallam <tmsriram@google.com>
706
707 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
708 only after checking if it cannot be forced local.
709 * symtab.h (is_externally_visible): Check if the symbol is not forced
710 local.
711
712 2011-07-15 Ian Lance Taylor <iant@google.com>
713
714 * options.h (class General_options): Add --print-output-format.
715 Move -EL next to -EB, for better --help output.
716 * target-select.cc: Include <cstdio>, "options.h", and
717 "parameters.h".
718 (Target_selector::do_target_bfd_name): New function.
719 (print_output_format): New function.
720 * target-select.h (class Target_selector): Update declarations.
721 (Target_selector::target_bfd_name): New function.
722 (print_output_format): Declare.
723 * main.cc: Include "target-select.h".
724 (main): Handle --print-output-format.
725 * gold.cc: Include "target-select.h".
726 (queue_initial_tasks): Handle --print-output-format when there are
727 no input files.
728 * parameters.cc (parameters_force_valid_target): Give a better
729 error message if -EB/-EL does not match target.
730 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
731 function.
732
733 2011-07-15 Ian Lance Taylor <iant@google.com>
734
735 * i386.cc (class Output_data_plt_i386): Add layout_ field.
736 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
737 (Output_data_plt_i386::do_write): Write address of .dynamic
738 section to first entry in .got.plt section.
739 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
740 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
741 Initialize layout_.
742 (Output_data_plt_x86_64::do_write): Write address of .dynamic
743 section to first entry in .got.plt section.
744 * layout.h (Layout::dynamic_section): New function.
745
746 2011-07-13 Sriraman Tallam <tmsriram@google.com>
747
748 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
749 to claim_file call.
750 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
751 input_section_position_, and input_section_glob_.
752 (read_layout_from_file): Call function section_ordering_specified.
753 * layout.h (is_section_ordering_specified): New function.
754 (section_ordering_specified): New function.
755 (section_ordering_specified_): New boolean member.
756 * main.cc(main): Call load_plugins after layout object is defined.
757 * output.cc (Output_section::add_input_section): Use
758 function section_ordering_specified to check if section ordering is
759 needed.
760 * output.cc (Output_section::add_relaxed_input_section): Use
761 function section_ordering_specified to check if section ordering is
762 needed.
763 (Output_section::update_section_layout): New function.
764 (Output_section::sort_attached_input_sections): Check if input section
765 must be reordered.
766 * output.h (Output_section::update_section_layout): New function.
767 * plugin.cc (get_section_count): New function.
768 (get_section_type): New function.
769 (get_section_name): New function.
770 (get_section_contents): New function.
771 (update_section_order): New function.
772 (allow_section_ordering): New function.
773 (Plugin::load): Add the new interfaces to the transfer vector.
774 (Plugin_manager::load_plugins): New parameter.
775 (Plugin_manager::all_symbols_read): New parameter.
776 (Plugin_manager::claim_file): New parameter. Save the elf object for
777 unclaimed objects.
778 (Plugin_manager::get_elf_object): New function.
779 (Plugin_manager::get_view): Change to directly use the bool to check
780 if get_view is called from claim_file_hook.
781 * plugin.h (input_objects): New function
782 (Plugin__manager::load_plugins): New parameter.
783 (Plugin_manager::claim_file): New parameter.
784 (Plugin_manager::get_elf_object): New function.
785 (Plugin_manager::in_claim_file_handler): New function.
786 (Plugin_manager::in_claim_file_handler_): New member.
787 (layout): New function.
788 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
789 handler with an extra parameter. Make the elf object before calling
790 claim_file handler.
791 * testsuite/plugin_test.c (get_section_count): New function pointer.
792 (get_section_type): New function pointer.
793 (get_section_name): New function pointer.
794 (get_section_contents): New function pointer.
795 (update_section_order): New function pointer.
796 (allow_section_ordering): New function pointer.
797 (onload): Check if the new interfaces exist.
798
799 2011-07-13 Ian Lance Taylor <iant@google.com>
800
801 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
802 relro section.
803 * x86_64.cc (Target_x86_64::got_section): Likewise.
804 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
805 (relro_now_test_SOURCES): New variable.
806 (relro_now_test_DEPENDENCIES): New variable.
807 (relro_now_test_LDFLAGS): New variable.
808 (relro_now_test_LDADD): New variable.
809 (relro_now_test.so): New target.
810 * testsuite/Makefile.in: Rebuild.
811
812 2011-07-12 Ian Lance Taylor <iant@google.com>
813
814 PR gold/12980
815 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
816 GLOB_DAT relocation rather than a RELATIVE relocation for a
817 protected symbol when creating a shared library.
818 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
819 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
820 * testsuite/protected_main_1.cc (main): Test that protected
821 function has same address.
822
823 2011-07-11 Ian Lance Taylor <iant@google.com>
824
825 PR gold/12979
826 * options.h (class General_options): Add -Bgroup.
827 * options.cc (General_options::finalize): If -Bgroup is set,
828 default to --unresolved-symbols=report-all.
829 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
830 * target-reloc.h (issue_undefined_symbol_error): Handle
831 --unresolved-symbols=report-all.
832
833 2011-07-08 Ian Lance Taylor <iant@google.com>
834
835 PR gold/11985
836 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
837 if linker script discards key sections.
838 (Layout::create_dynamic_symtab): Likewise.
839 (Layout::assign_local_dynsym_offsets): Likewise.
840 (Layout::sized_create_version_sections): Likewise.
841 (Layout::create_interp): Likewise.
842 (Layout::finish_dynamic_section): Likewise.
843 (Layout::set_dynamic_symbol_size): Likewise.
844
845 2011-07-08 Ian Lance Taylor <iant@google.com>
846
847 PR gold/12386
848 * options.h (class General_options): Add --unresolved-symbols.
849 * target-reloc.h (issue_undefined_symbol_error): Check
850 --unresolved-symbols. Add comments.
851
852 2011-07-08 Ian Lance Taylor <iant@google.com>
853
854 * testsuite/odr_violation2.cc (Ordering::operator()): Make
855 expression more complex.
856
857 2011-07-08 Ian Lance Taylor <iant@google.com>
858
859 PR gold/11317
860 * target-reloc.h (issue_undefined_symbol_error): New inline
861 function, broken out of relocate_section.
862 (relocate_section): Call issue_undefined_symbol_error.
863 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
864 there is no TLS segment if we are about to issue an undefined
865 symbol error.
866 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
867
868 2011-07-08 Ian Lance Taylor <iant@google.com>
869
870 PR gold/12279
871 * resolve.cc (Symbol_table::should_override): Add fromtype
872 parameter. Change all callers. Give error when linking together
873 TLS and non-TLS symbol.
874 (Symbol_table::should_override_with_special): Add fromtype
875 parameter. Change all callers.
876 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
877 there is no TLS segment if we have reported some errors.
878 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
879
880 2011-07-08 Ian Lance Taylor <iant@google.com>
881
882 PR gold/12372
883 * target.h (Target::plt_address_for_global): New function.
884 (Target::plt_address_for_local): New function.
885 (Target::plt_section_for_global): Remove.
886 (Target::plt_section_for_local): Remove.
887 (Target::do_plt_address_for_global): New virtual function.
888 (Target::do_plt_address_for_local): New virtual function.
889 (Target::do_plt_section_for_global): Remove.
890 (Target::do_plt_section_for_local): Remove.
891 (Target::register_global_plt_entry): Add Symbol_table and Layout
892 parameters.
893 * output.cc (Output_data_got::Got_entry::write): Use
894 plt_address_for_global and plt_address_for_local.
895 * layout.cc (Layout::add_target_dynamic_tags): Use size and
896 address of output section.
897 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
898 got_irelative_, and irelative_count_ fields. Update
899 declarations.
900 (Output_data_plt_i386::has_irelative_section): New function.
901 (Output_data_plt_i386::entry_count): Add irelative_count_.
902 (Output_data_plt_i386::set_final_data_size): Likewise.
903 (class Target_i386): Add got_irelative_ and rel_irelative_
904 fields. Update declarations.
905 (Target_i386::Target_i386): Initialize new fields.
906 (Target_i386::do_plt_address_for_global): New function replacing
907 do_plt_section_for_global.
908 (Target_i386::do_plt_address_for_local): New function replacing
909 do_plt_section_for_local.
910 (Target_i386::got_section): Create got_irelative_.
911 (Target_i386::rel_irelative_section): New function.
912 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
913 fields. Don't define __rel_iplt_{start,end}.
914 (Output_data_plt_i386::add_entry): Add symtab and layout
915 parameters. Change all callers. Use different PLT and GOT for
916 IFUNC symbols.
917 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
918 layout parameters. Change all callers. Use different PLT and
919 GOT.
920 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
921 (Output_data_plt_i386::rel_irelative): New function.
922 (Output_data_plt_i386::address_for_global): New function.
923 (Output_data_plt_i386::address_for_local): New function.
924 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
925 IRELATIVE GOT when changing IFUNC GOT entries.
926 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
927 reloc.
928 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
929 if we didn't create an IRELATIVE GOT.
930 (Target_i386::Relocate::relocate): Use plt_address_for_global and
931 plt_address_for_local.
932 (Target_i386::do_dynsym_value): Use plt_address_for_global.
933 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
934 got_irelative_, and irelative_count_ fields. Update
935 declarations.
936 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
937 Initialize new fields. Remove symtab parameter. Change all
938 callers.
939 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
940 irelative_count_.
941 (Output_data_plt_x86_64::has_irelative_section): New function.
942 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
943 (class Target_x86_64): Add got_irelative_ and rel_irelative_
944 fields. Update declarations.
945 (Target_x86_64::Target_x86_64): Initialize new fields.
946 (Target_x86_64::do_plt_address_for_global): New function replacing
947 do_plt_section_for_global.
948 (Target_x86_64::do_plt_address_for_local): New function replacing
949 do_plt_section_for_local.
950 (Target_x86_64::got_section): Create got_irelative_.
951 (Target_x86_64::rela_irelative_section): New function.
952 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
953 all callers. Don't create __rel_iplt_{start,end}.
954 (Output_data_plt_x86_64::add_entry): Add symtab and layout
955 parameters. Change all callers. Use different PLT and GOT for
956 IFUNC symbols.
957 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
958 layout parameters. Change all callers. Use different PLT and
959 GOT.
960 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
961 parameters. Change all callers. Use different PLT and GOT for
962 IFUNC symbols.
963 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
964 (Output_data_plt_x86_64::rela_irelative): New function.
965 (Output_data_plt_x86_64::address_for_global): New function.
966 (Output_data_plt_x86_64::address_for_local): New function.
967 (Output_data_plt_x86_64::set_final_data_size): Likewise.
968 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
969 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
970 (Target_x86_64::register_global_plt_entry): Add symtab and layout
971 parameters.
972 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
973 reloc.
974 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
975 symbols if we didn't create an IRELATIVE GOT.
976 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
977 plt_address_for_local.
978 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
979 * testsuite/ifuncvar1.c: New test file.
980 * testsuite/ifuncvar2.c: New test file.
981 * testsuite/ifuncvar3.c: New test file.
982 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
983 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
984 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
985 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
986 * testsuite/Makefile.in: Rebuild.
987
988 2011-07-07 Cary Coutant <ccoutant@google.com>
989
990 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
991 (two_file_test_1_ndebug.o): Likewise.
992 (two_file_test_1b_ndebug.o): Likewise.
993 (two_file_test_2_ndebug.o): Likewise.
994 (two_file_test_main_ndebug.o): Likewise.
995 (incremental_test_2): Link with no-debug versions.
996
997 2011-07-06 Cary Coutant <ccoutant@google.com>
998
999 * gold/incremental.cc
1000 (Output_section_incremental_inputs::write_info_blocks): Check for
1001 hidden and internal symbols.
1002
1003 2011-07-06 Cary Coutant <ccoutant@google.com>
1004
1005 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1006 Check disposition for startup file.
1007 (Incremental_inputs::report_command_line): Ignore
1008 --incremental-startup-unchanged option.
1009 * options.cc (General_options::parse_incremental_startup_unchanged):
1010 New function.
1011 (General_options::General_options): Initialize new data member.
1012 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1013 (General_options): Add --incremental-startup-unchanged option.
1014 (General_options::incremental_startup_disposition): New function.
1015 (General_options::incremental_startup_disposition_): New data member.
1016
1017 2011-07-06 Cary Coutant <ccoutant@google.com>
1018
1019 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1020 input file index to Script_info ctor.
1021 (Sized_incremental_binary::do_file_has_changed): Find the
1022 command-line argument for files named in scripts.
1023 * incremental.h (Script_info::Script_info): New ctor
1024 with input file index.
1025 (Script_info::input_file_index): New function.
1026 (Script_info::input_file_index_): New data member.
1027 (Incremental_binary::get_library): Add const.
1028 (Incremental_binary::get_script_info): Add const.
1029 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1030 * testsuite/Makefile.am (incremental_test_5): New test case.
1031 (incremental_test_6): New test case.
1032 * testsuite/Makefile.in: Regenerate.
1033
1034 2011-07-06 Cary Coutant <ccoutant@google.com>
1035
1036 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1037 debug output when command lines differ.
1038
1039 2011-07-06 Cary Coutant <ccoutant@google.com>
1040
1041 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1042 --incremental-patch option.
1043 * layout.cc (Free_list::allocate): Extend allocation beyond original
1044 end if enabled.
1045 (Layout::make_output_section): Mark sections that should get
1046 patch space.
1047 * options.cc (parse_percent): New function.
1048 * options.h (parse_percent): New function.
1049 (DEFINE_percent): New macro.
1050 (General_options): Add --incremental-patch option.
1051 * output.cc (Output_section::Output_section): Initialize new data
1052 members.
1053 (Output_section::add_input_section): Print section name when out
1054 of patch space.
1055 (Output_section::add_output_section_data): Likewise.
1056 (Output_section::set_final_data_size): Add patch space when
1057 doing --incremental-full.
1058 (Output_section::do_reset_address_and_file_offset): Remove patch
1059 space.
1060 (Output_segment::set_section_list_addresses): Print debug output
1061 only if --incremental-update.
1062 * output.h (Output_section::set_is_patch_space_allowed): New function.
1063 (Output_section::is_patch_space_allowed_): New data member.
1064 (Output_section::patch_space_): New data member.
1065 * parameters.cc (Parameters::incremental_full): New function.
1066 * parameters.h (Parameters::incremental_full): New function
1067 * testsuite/Makefile.am (incremental_test_2): Add test for
1068 --incremental-patch option.
1069 * testsuite/Makefile.in: Regenerate.
1070 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1071 (t18): Remove function body.
1072
1073 2011-07-05 Doug Kwan <dougkwan@google.com>
1074
1075 PR gold/12771
1076 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1077 Arm_Address type for relocation result.
1078 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1079 overflow check.
1080 (Arm_relocate_functions::abs32): Use unaligned access.
1081 (Arm_relocate_functions::rel32): Ditto.
1082 (Arm_relocate_functions::prel31): Ditto.
1083 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1084 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1085 static data relocations.
1086 * testsuite/Makefile.in: Regnerate.
1087 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1088
1089 2011-07-05 Ian Lance Taylor <iant@google.com>
1090
1091 PR gold/12392
1092 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1093 symbols if necessary.
1094 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1095
1096 2011-07-05 Ian Lance Taylor <iant@google.com>
1097
1098 PR gold/12952
1099 * resolve.cc (Symbol::override_base_with_special): Simply override
1100 version with special symbol version, ignoring previous version.
1101
1102 2011-07-05 Ian Lance Taylor <iant@google.com>
1103
1104 * object.cc (Sized_relobj_file::include_section_group): Add
1105 information to comment about signature location.
1106
1107 2011-07-02 Ian Lance Taylor <iant@google.com>
1108
1109 PR gold/12957
1110 * options.h (class General_options): Add -f and -F.
1111 * options.cc (General_options::finalize): Fatal error if -f/-F
1112 are used without -shared.
1113 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1114
1115 2011-07-02 Ian Lance Taylor <iant@google.com>
1116
1117 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1118
1119 2011-07-01 Ian Lance Taylor <iant@google.com>
1120
1121 PR gold/12525
1122 PR gold/12952
1123 * resolve.cc (Symbol::override_base_with_special): Don't override
1124 the version if the overriding symbol has a different name.
1125 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1126 all callers. If we give an error about an undefined version,
1127 define the base version if necessary.
1128 * dynobj.h (class Versions): Update declaration.
1129 * testsuite/weak_alias_test_5.cc: New file.
1130 * testsuite/weak_alias_test.script: New file.
1131 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1132 and versioned_alias have the right value, and call t2.
1133 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1134 weak_alias_test_5.so.
1135 (weak_alias_test_LDADD): Likewise.
1136 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1137 * testsuite/Makefile.in: Rebuild.
1138
1139 2011-07-01 Ian Lance Taylor <iant@google.com>
1140
1141 PR gold/12525
1142 * options.h (class General_options): Support -z notext.
1143 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1144 -Wl,-z,notext.
1145 (two_file_shared_nonpic.so): Likewise.
1146 (two_file_shared_mixed.so): Likewise.
1147 (two_file_shared_mixed_1.so): Likewise.
1148 (weak_undef_lib_nonpic.so): Likewise.
1149 (alt/weak_undef_lib_nonpic.so): Likewise.
1150 (tls_test_shared_nonpic.so): Likewise.
1151 * testsuite/Makefile.in: Rebuild.
1152
1153 2011-07-01 Ian Lance Taylor <iant@google.com>
1154
1155 PR gold/12525
1156 * configure.ac: Test whether static linking works, setting
1157 the automake conditional HAVE_STATIC.
1158 * testsuite/Makefile.am: Disable tests using -static if
1159 HAVE_STATIC is not true.
1160 * configure, testsuite/Makefile.in: Rebuild.
1161
1162 2011-07-01 Ian Lance Taylor <iant@google.com>
1163
1164 PR gold/12525
1165 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1166 Assert if we see DW_EH_PE_indirect.
1167 * target.h (Target::ehframe_datarel_base): New function.
1168 (Target::do_ehframe_datarel_base): New target function.
1169 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1170 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1171 function.
1172
1173 2011-07-01 Ian Lance Taylor <iant@google.com>
1174
1175 PR gold/12571
1176 * options.h (class General_options): Add
1177 --ld-generated-unwind-info.
1178 * ehframe.cc (Fde::write): Add address parameter. Change all
1179 callers. If associated with PLT, fill in address and size.
1180 (Cie::set_output_offset): Only add merge mapping if there is an
1181 object.
1182 (Cie::write): Add address parameter. Change all callers.
1183 (Eh_frame::add_ehframe_for_plt): New function.
1184 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1185 input_offset_ fields into union u_, with new plt field.
1186 (Fde::Fde): Adjust for new union field.
1187 (Fde::Fde) [Output_data version]: New constructor.
1188 (Fde::add_mapping): Only add merge mapping if there is an object.
1189 (class Cie): Update declarations.
1190 (class Eh_frame): Declare add_ehframe_for_plt.
1191 * layout.cc (Layout::layout_eh_frame): Break out code into
1192 make_eh_frame_section, and call it.
1193 (Layout::make_eh_frame_section): New function.
1194 (Layout::add_eh_frame_for_plt): New function.
1195 * layout.h (class Layout): Update declarations.
1196 * merge.cc (Merge_map::add_mapping): Add assertion.
1197 * i386.cc: Include "dwarf.h".
1198 (class Output_data_plt_i386): Make first_plt_entry,
1199 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1200 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1201 and plt_eh_frame_fde.
1202 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1203 boundary. Call add_eh_frame_for_plt if appropriate.
1204 * x86_64.cc: Include "dwarf.h".
1205 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1206 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1207 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1208 and plt_eh_frame_fde.
1209 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1210 appropriate.
1211
1212 2011-06-29 Ian Lance Taylor <iant@google.com>
1213
1214 PR gold/12629
1215 * object.cc (Sized_relobj_file::layout_section): Change shdr
1216 parameter to be const.
1217 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1218 out of do_layout.
1219 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1220 appropriate. Call layout_eh_frame_section.
1221 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1222 sections.
1223 * object.h (class Sized_relobj_file): Update declarations.
1224
1225 2011-06-29 Ian Lance Taylor <iant@google.com>
1226
1227 PR gold/12652
1228 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1229 modifier.
1230 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1231
1232 2011-06-29 Ian Lance Taylor <iant@google.com>
1233
1234 PR gold/12675
1235 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1236 SHT_X86_64_UNWIND.
1237 * layout.cc (Layout::layout_eh_frame): Likewise.
1238
1239 2011-06-29 Ian Lance Taylor <iant@google.com>
1240
1241 PR gold/12695
1242 * layout.cc (Layout::symtab_section_shndx): New function.
1243 * layout.h (class Layout): Declare symtab_section_shndx.
1244 * output.cc (Output_section::write_header): Call it.
1245
1246 2011-06-29 Ian Lance Taylor <iant@google.com>
1247
1248 PR gold/12818
1249 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1250 symbols which are not used in a relocation.
1251
1252 2011-06-28 Ian Lance Taylor <iant@google.com>
1253
1254 PR gold/12898
1255 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1256 script create indistinguishable segments.
1257 (Layout::set_segment_offsets): Use stable_sort when sorting
1258 segments. Pass this to Compare_segments constructor.
1259 * layout.h (class Layout): Make segment_precedes non-static.
1260 (class Compare_segments): Change from struct to class. Add
1261 layout_ field. Add constructor.
1262 * script-sections.cc
1263 (Script_sections::attach_sections_using_phdrs_clause): Rename
1264 local orphan to is_orphan. Don't report failure to put empty
1265 section in segment. On attachment failure, report name of
1266 section, and attach to first PT_LOAD segment.
1267
1268 2011-06-28 Ian Lance Taylor <iant@google.com>
1269
1270 PR gold/12934
1271 * target-select.cc (Target_selector::Target_selector): Add
1272 emulation parameter. Change all callers.
1273 (select_target_by_bfd_name): Rename from select_target_by_name.
1274 Change all callers.
1275 (select_target_by_emulation): New function.
1276 (supported_emulation_names): New function.
1277 * target-select.h (class Target_selector): Add emulation_ field.
1278 Update declarations.
1279 (Target_selector::recognize_by_bfd_name): Rename from
1280 recognize_by_name. Change all callers.
1281 (Target_selector::supported_bfd_names): Rename from
1282 supported_names. Change all callers.
1283 (Target_selector::recognize_by_emulation): New function.
1284 (Target_selector::supported_emulations): New function.
1285 (Target_selector::emulation): New function.
1286 (Target_selector::do_recognize_by_bfd_name): Rename from
1287 do_recognize_by_name. Change all callers.
1288 (Target_selector::do_supported_bfd_names): Rename from
1289 do_supported_names. Change all callers.
1290 (Target_selector::do_recognize_by_emulation): New function.
1291 (Target_selector::do_supported_emulations): New function.
1292 (select_target_by_bfd_name): Change name in declaration.
1293 (select_target_by_emulation): Declare.
1294 (supported_emulation_names): Declare.
1295 * parameters.cc (parameters_force_valid_target): Try to find
1296 target based on emulation from -m option.
1297 * options.h (class General_options): Change doc string for -m.
1298 * options.cc (help): Print emulations.
1299 (General_options::parse_V): Likewise.
1300 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1301 Add emulation parameter. Change all callers.
1302
1303 2011-06-28 Ian Lance Taylor <iant@google.com>
1304
1305 * target.h (class Target): Add osabi_ field.
1306 (Target::osabi): New function.
1307 (Target::set_osabi): New function.
1308 (Target::Target): Initialize osabi_.
1309 (Target::do_adjust_elf_header): Make pure virtual.
1310 (Sized_target::do_adjust_elf_header): Declare.
1311 * target.cc (Sized_target::do_adjust_elf_header): New function.
1312 (class Sized_target): Instantiate all versions.
1313 * freebsd.h (class Target_freebsd): Remove.
1314 (Target_selector_freebsd::do_recognize): Call set_osabi on
1315 Target.
1316 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1317 (Target_selector_freebsd::set_osabi): Remove.
1318 * i386.cc (class Target_i386): Inherit from Sized_target rather
1319 than Target_freebsd.
1320 * x86_64.cc (class Target_x86_64): Likewise.
1321
1322 2011-06-28 Ian Lance Taylor <iant@google.com>
1323
1324 * target.h (Target::can_check_for_function_pointers): Rewrite.
1325 Make non-virtual.
1326 (Target::can_icf_inline_merge_sections): Likewise.
1327 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1328 (Target::Target_info): Add can_icf_inline_merge_sections field.
1329 (Target::do_can_check_for_function_pointers): New virtual
1330 function.
1331 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1332 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1333 from can_check_for_function_pointers, move in file.
1334 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1335 section_may_have_icf_unsafe_poineters, move in file.
1336 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1337 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1338 Rename from can_check_for_function_pointers, move in file.
1339 (Target_i386::can_icf_inline_merge_sections): Remove.
1340 (Target_i386::i386_info): Initialize
1341 can_icf_inline_merge_sections.
1342 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1343 Initialize can_icf_inline_merge_sections.
1344 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1345 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1346 Rename from can_check_for_function_pointers, move in file.
1347 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1348 (Target_x86_64::x86_64_info): Initialize
1349 can_icf_inline_merge_sections.
1350 * testsuite/testfile.cc (Target_test::test_target_info):
1351 Likewise.
1352 * icf.cc (get_section_contents): Correct formatting.
1353
1354 2011-06-27 Ian Lance Taylor <iant@google.com>
1355
1356 * symtab.cc (Symbol::versioned_name): New function.
1357 (Symbol_table::add_to_final_symtab): Use versioned_name when
1358 appropriate.
1359 (Symbol_table::sized_write_symbol): Likewise.
1360 * symtab.h (class Symbol): Declare versioned_name.
1361 * stringpool.h (class Stringpool_template): Add variant of add
1362 which takes a std::basic_string.
1363 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1364 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1365 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1366 (ver_test_12.o): New target.
1367 * testsuite/Makefile.in: Rebuild.
1368
1369 2011-06-27 Doug Kwan <dougkwan@google.com>
1370
1371 * arm.cc (Arm_relocate_functions::thm_jump8,
1372 Arm_relocate_functions::thm_jump11): Use a wider signed
1373 type to compute offset.
1374 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1375 arm_thm_jump8.
1376 * testsuite/Makefile.in: Regenerate.
1377 * testsuite/arm_branch_in_range.sh: Check test results of
1378 arm_thm_jump11 and arm_thm_jump8.
1379 * testsuite/arm_thm_jump11.s: New test source file.
1380 * testsuite/arm_thm_jump11.t: New linker script.
1381 * testsuite/arm_thm_jump8.s: New test source file.
1382 * testsuite/arm_thm_jump8.t: New linker script.
1383
1384 2011-06-24 Ian Lance Taylor <iant@google.com>
1385
1386 * layout.cc: Include "object.h".
1387 (ctors_sections_in_init_array): New static variable.
1388 (Layout::is_ctors_in_init_array): New function.
1389 (Layout::layout): Add entry to ctors_sections_in_init_array if
1390 appropriate.
1391 * layout.h (class Layout): Declare is_ctors_in_init_array.
1392 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1393 is_ctors_reverse_view is set.
1394 (Sized_relobj_file::write_sections): Add layout parameter. Change
1395 all callers. Set is_ctors_reverse_view field of View_size.
1396 (Sized_relobj_file::reverse_words): New function.
1397 * object.h (Sized_relobj_file::View_size): Add
1398 is_ctors_reverse_view field.
1399 (class Sized_relobj_file): Update declarations.
1400 * testsuite/initpri3.c: New test.
1401 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1402 initpri3b.
1403 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1404 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1405 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1406 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1407 * testsuite/Makefile.in: Rebuild.
1408
1409 2011-06-24 Cary Coutant <ccoutant@google.com>
1410
1411 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1412 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1413 (debug_msg_cdebug.err): New targets.
1414 * testsuite/Makefile.in: Regenerate.
1415 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1416 Fix checks for link with shared library.
1417
1418 2011-06-24 Doug Kwan <dougkwan@google.com>
1419
1420 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1421 skip empty text sections.
1422 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1423
1424 2011-06-22 Ian Lance Taylor <iant@google.com>
1425
1426 PR gold/12910
1427 * options.h (class General_options): Add --ctors-in-init-array.
1428 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1429 friends as SHT_PROGBITS for merging sections.
1430 (Layout::layout): Remove special handling of .init_array and
1431 friends. Don't sort if doing relocatable link. Sort for .ctors
1432 and .dtors if ctors_in_init_array.
1433 (Layout::make_output_section): Force correct section types for
1434 .init_array and friends. Don't sort if doing relocatable link,
1435 Don't sort .ctors and .dtors if ctors_in_init_array.
1436 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1437 (Layout::output_section_name): Add relobj parameter. Change all
1438 callers. Handle .ctors. and .dtors. in code rather than table.
1439 Handle .ctors and .dtors if ctors_in_init_array.
1440 (Layout::match_file_name): New function, moved from output.cc.
1441 * layout.h (class Layout): Update declarations.
1442 * output.cc: Include "layout.h".
1443 (Input_section_sort_entry::get_priority): New function.
1444 (Input_section_sort_entry::match_file_name): Just call
1445 Layout::match_file_name.
1446 (Output_section::Input_section_sort_init_fini_compare::operator()):
1447 Handle .ctors and .dtors. Sort by explicit priority rather than
1448 by name.
1449 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1450 * testsuite/initpri2.c: New test.
1451 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1452 (check_PROGRAMS): Add initpri2.
1453 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1454 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1455 * configure, testsuite/Makefile.in: Rebuild.
1456
1457 2011-06-19 Ian Lance Taylor <iant@google.com>
1458
1459 PR gold/12880
1460 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1461 .interp section to a PT_INTERP segment even if we have seen a
1462 --dynamic-linker option. Don't do it if we have seen a PHDRS
1463 clause in a linker script.
1464 (Layout::finalize): Don't create a .interp section if we've
1465 already create a PT_INTERP segment.
1466 (Layout::create_interp): Always call choose_output_section (revert
1467 patch of 2011-06-17). Don't create PT_INTERP segment.
1468 * script-sections.cc
1469 (Script_sections::create_note_and_tls_segments): Add a .interp
1470 section to a PT_INTERP segment even if we have seen a
1471 --dynamic-linker option.
1472
1473 2011-06-18 Ian Lance Taylor <iant@google.com>
1474
1475 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1476 merely because a non-PT_LOAD segment has a dynamic reloc.
1477
1478 2011-06-18 Ian Lance Taylor <iant@google.com>
1479
1480 * layout.cc (Layout::finish_dynamic_section): Don't create
1481 DT_FLAGS entry if not needed.
1482
1483 2011-06-18 Ian Lance Taylor <iant@google.com>
1484
1485 PR gold/12745
1486 * layout.cc (Layout::layout_eh_frame): Correct handling of
1487 writable .eh_frame section.
1488
1489 2011-06-17 Ian Lance Taylor <iant@google.com>
1490
1491 PR gold/12893
1492 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1493 symbol is redefined with the exact same object and value.
1494
1495 2011-06-17 Ian Lance Taylor <iant@google.com>
1496
1497 PR gold/12880
1498 * layout.h (class Layout): Add interp_segment_ field.
1499 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1500 (Layout::attach_allocated_section_to_segment): If making shared
1501 library, put .interp section in PT_INTERP segment.
1502 (Layout::finalize): Also call create_interp if -dynamic-linker
1503 option was used.
1504 (Layout::create_interp): Assert that there is no PT_INTERP
1505 segment. If not using a SECTIONS clause, use make_output_section.
1506 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1507 * script-sections.cc
1508 (Script_sections::create_note_and_tls_segments): If making shared
1509 library, put .interp section in PT_INTERP segment.
1510
1511 2011-06-17 Ian Lance Taylor <iant@google.com>
1512
1513 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1514 when making a shared library.
1515
1516 2011-06-17 Ian Lance Taylor <iant@google.com>
1517
1518 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1519 parameter. Change all callers. Don't issue warning about PC32
1520 against locally defined symbol.
1521
1522 2011-06-16 Ian Lance Taylor <iant@google.com>
1523
1524 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1525 occurs in same object.
1526
1527 2011-06-14 Alan Modra <amodra@gmail.com>
1528
1529 * po/POTFILES.in: Regenerate.
1530
1531 2011-06-09 Ian Lance Taylor <iant@google.com>
1532
1533 * script-sections.cc
1534 (Orphan_output_section::set_section_addresses): For a relocatable
1535 link set address to 0.
1536
1537 2011-06-09 Cary Coutant <ccoutant@google.com>
1538
1539 PR gold/12804
1540 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1541 used with --compress-debug-sections.
1542 * gold/object.cc (Sized_relobj_file::do_layout): Report
1543 uncompressed size of compressed input sections.
1544
1545 2011-06-08 Cary Coutant <ccoutant@google.com>
1546
1547 PR gold/12804
1548 * testsuite/two_file_test_2_v1.cc: Change initialization of
1549 v2 to keep it in .data.
1550
1551 2011-06-07 Cary Coutant <ccoutant@google.com>
1552
1553 * common.cc (Symbol_table::do_allocate_commons_list): Call
1554 gold_fallback.
1555 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1556 (Errors::fallback): New function.
1557 (gold_fallback): New function.
1558 * errors.h (Errors::fallback): New function.
1559 * gold.cc (gold_exit): Change status parameter to enum; adjust
1560 all callers.
1561 (queue_initial_tasks): Call gold_fallback.
1562 * gold.h: Include cstdlib.
1563 (Exit_status): New enum type.
1564 (gold_exit): Change status parameter to enum.
1565 (gold_fallback): New function.
1566 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1567 (Layout::create_symtab_sections): Likewise.
1568 (Layout::create_shdrs): Likewise.
1569 * main.cc (main): Adjust call to gold_exit.
1570 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1571 (Output_data_got::add_got_entry_pair): Likewise.
1572 (Output_section::add_input_section): Likewise.
1573 (Output_section::add_output_section_data): Likewise.
1574 (Output_segment::set_section_list_addresses): Likewise.
1575 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1576
1577 2011-06-07 Cary Coutant <ccoutant@google.com>
1578
1579 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1580 for incremental links.
1581 * output.cc (Output_segment::set_section_list_addresses): Remove
1582 FIXME and test for TLS or BSS.
1583
1584 2011-06-07 Cary Coutant <ccoutant@google.com>
1585
1586 * testsuite/Makefile.am: Add incremental_copy_test,
1587 incremental_common_test_1.
1588 * testsuite/Makefile.in: Regenerate.
1589 * testsuite/common_test_1_v1.c: New source file.
1590 * testsuite/common_test_1_v2.c: New source file.
1591 * testsuite/copy_test_v1.cc: New source file.
1592
1593 2011-06-07 Cary Coutant <ccoutant@google.com>
1594
1595 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1596 update, allocate common from bss section's free list.
1597 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1598 linker-defined symbols.
1599 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1600 Skip GOT and PLT entries that are no longer referenced.
1601 (Output_section_incremental_inputs::write_info_blocks): Mark
1602 linker-defined symbols.
1603 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1604 * output.cc (Output_section::allocate): New function.
1605 * output.h (Output_section::allocate): New function.
1606 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1607 linker-defined symbols.
1608 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1609 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1610 (Symbol::init_base_output_data): Likewise.
1611 (Symbol::init_base_output_segment): Likewise.
1612 (Symbol::init_base_constant): Likewise.
1613 (Sized_symbol::init_output_data): Likewise.
1614 (Sized_symbol::init_output_segment): Likewise.
1615 (Sized_symbol::init_constant): Likewise.
1616 (Symbol_table::do_define_in_output_data): Likewise.
1617 (Symbol_table::do_define_in_output_segment): Likewise.
1618 (Symbol_table::do_define_as_constant): Likewise.
1619 * symtab.h (Symbol::is_predefined): New function.
1620 (Symbol::init_base_output_data): Add is_predefined parameter.
1621 (Symbol::init_base_output_segment): Likewise.
1622 (Symbol::init_base_constant): Likewise.
1623 (Symbol::is_predefined_): New data member.
1624 (Sized_symbol::init_output_data): Add is_predefined parameter.
1625 (Sized_symbol::init_output_segment): Likewise.
1626 (Sized_symbol::init_constant): Likewise.
1627 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1628
1629 2011-06-07 Cary Coutant <ccoutant@google.com>
1630
1631 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1632 instead of emit_copy_reloc.
1633 (Copy_relocs::emit_copy_reloc): Refactor.
1634 (Copy_relocs::make_copy_reloc): New function.
1635 (Copy_relocs::add_copy_reloc): Remove.
1636 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1637 section.
1638 (Copy_relocs::make_copy_reloc): New function.
1639 (Copy_relocs::add_copy_reloc): Remove.
1640 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1641 unchanged input files.
1642 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1643 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1644 Reserve BSS space for COPY relocations.
1645 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1646 (Output_section_incremental_inputs::write_info_blocks): Record
1647 whether a symbol is copied from a shared object.
1648 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1649 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1650 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1651 (Incremental_input_entry_reader::get_output_symbol_index): Add
1652 is_copy parameter.
1653 (Incremental_binary::emit_copy_relocs): New function.
1654 (Incremental_binary::do_emit_copy_relocs): New function.
1655 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1656 new data member.
1657 (Sized_incremental_binary::add_copy_reloc): New function.
1658 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1659 (Sized_incremental_binary::Copy_reloc): New struct.
1660 (Sized_incremental_binary::Copy_relocs): New typedef.
1661 (Sized_incremental_binary::copy_relocs_): New data member.
1662 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1663 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1664 * target.h (Sized_target::emit_copy_reloc): New function.
1665 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1666
1667 2011-06-02 Cary Coutant <ccoutant@google.com>
1668
1669 PR gold/12163
1670 * gold/archive.cc (Archive::Archive): Initialize new data member.
1671 (Archive::include_all_members): Return if archive has already been
1672 included.
1673 * gold/archive.h (Archive::include_all_members_): New data member.
1674
1675 2011-06-02 Nick Clifton <nickc@redhat.com>
1676
1677 * dynobj.h: Fix spelling mistake in comment.
1678 * output.cc: Likewise.
1679
1680 2011-05-31 Doug Kwan <dougkwan@google.com>
1681 Asier Llano
1682
1683 PR gold/12826
1684 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1685 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1686 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1687 redundant arm_exidx_test.so.
1688 * testsuite/Makefile.in: Regenerate.
1689 (check_SCRIPTS): Add pr12826.sh
1690 (check_DATA): Add pr12826.stdout
1691 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1692 * testsuite/pr12826.sh: New file.
1693 * testsuite/pr12826_1.s: Ditto.
1694 * testsuite/pr12826_1.s: Ditto.
1695
1696 2011-05-30 Ian Lance Taylor <iant@google.com>
1697
1698 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1699 sections.
1700
1701 2011-05-29 Ian Lance Taylor <iant@google.com>
1702
1703 PR gold/12804
1704 * testsuite/Makefile.am: Use different file name for two_file_test
1705 temporary file for each incremental test.
1706 * testsuite/Makefile.in: Rebuild.
1707
1708 2011-05-29 Ian Lance Taylor <iant@google.com>
1709
1710 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1711 binary input file is empty.
1712
1713 2011-05-27 Ian Lance Taylor <iant@google.com>
1714
1715 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1716 (ver_test_9.so): Likewise.
1717 * testsuite/Makefile.in: Rebuild.
1718
1719 2011-05-26 Cary Coutant <ccoutant@google.com>
1720
1721 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1722 * incremental.cc (Incremental_inputs::report_input_section): Fix
1723 comment, indentation.
1724 (Incremental_inputs::report_comdat_group): New function.
1725 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1726 of data for incremental input file entry.
1727 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1728 group count, COMDAT group signatures.
1729 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1730 an unchanged input file.
1731 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1732 Initialize new data member.
1733 (Incremental_object_entry::add_comdat_group): New function.
1734 (Incremental_object_entry::get_comdat_group_count): New function.
1735 (Incremental_object_entry::get_comdat_signature_key): New function.
1736 (Incremental_object_entry::groups_): New data member.
1737 (Incremental_inputs::report_comdat_group): New function.
1738 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1739 data for incremental input file entry.
1740 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1741 (Incremental_input_entry_reader::get_input_section): Adjust size of
1742 data for incremental input file entry.
1743 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1744 (Incremental_input_entry_reader::get_comdat_group_signature): New
1745 function.
1746 * object.cc (Sized_relobj::include_section_group): Report kept
1747 COMDAT groups for incremental links.
1748
1749 2011-05-24 David Meyer <pdox@google.com>
1750
1751 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1752 with name parameter. Add found_name parameter.
1753 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1754 * dirsearch.h (class Dirsearch): Update declaration.
1755
1756 2011-05-24 Ian Lance Taylor <iant@google.com>
1757
1758 * archive.cc (Library_base::should_include_member): Pull in object
1759 from archive if it defines the entry symbol.
1760 * parameters.cc (Parameters::entry): New function.
1761 * parameters.h (class Parameters): Declare entry.
1762 * output.h (class Output_file_header): Remove entry_ field.
1763 * output.cc (Output_file_header::Output_file_header): Remove entry
1764 parameter. Change all callers.
1765 (Output_file_header::entry): Use parameters->entry.
1766 * gold.cc (queue_middle_tasks): Likewise.
1767 * plugin.cc (Plugin_hook::run): Likewise.
1768
1769 2011-05-24 Cary Coutant <ccoutant@google.com>
1770
1771 * gold.cc (queue_initial_tasks): Pass incremental base filename
1772 to Output_file::open_base_file; don't print error message.
1773 * incremental-dump.cc (main): Adjust call to
1774 Output_file::open_for_modification.
1775 * incremental-dump.cc (main): Likewise.
1776 * incremental.cc (Incremental_inputs::report_command_line):
1777 Ignore --incremental-base option when comparing command lines.
1778 Ignore parameter when given as separate argument.
1779 * options.h (class General_options): Add --incremental-base.
1780 * output.cc (Output_file::Output_file):
1781 (Output_file::open_base_file): Add base_name and writable parameters;
1782 read base file into new file; print error message here.
1783 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1784 callers.
1785 * output.h (Output_file::open_for_modification): Rename to...
1786 (Output_file::open_base_file): ...this; add base_name and
1787 writable parameters; adjust all callers.
1788 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1789 callers.
1790 * testsuite/Makefile.am (incremental_test_4): Test
1791 --incremental-base.
1792 * testsuite/Makefile.in: Regenerate.
1793
1794 2011-05-24 Cary Coutant <ccoutant@google.com>
1795
1796 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1797 incremental_test_4.
1798 * testsuite/Makefile.in: Regenerate.
1799 * testsuite/two_file_test_1_v1.cc: New test source file.
1800 * testsuite/two_file_test_1b_v1.cc: New test source file.
1801 * testsuite/two_file_test_2_v1.cc: New test source file.
1802
1803 2011-05-24 Cary Coutant <ccoutant@google.com>
1804
1805 * dynobj.h (Dynobj::do_dynobj): New function.
1806 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1807 flag and soname for shared objects.
1808 * incremental.cc (Incremental_inputs::report_object): Make
1809 either Incremental_object_entry or Incremental_dynobj_entry; add
1810 soname to string table.
1811 (Incremental_inputs::report_input_section): Add assertion.
1812 (Output_section_incremental_inputs::set_final_data_size): Adjust
1813 type of input file entry for shared libraries; adjust size of
1814 shared library info entry.
1815 (Output_section_incremental_inputs::write_input_files): Write
1816 as_needed flag for shared libraries.
1817 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1818 of input file entry for shared libraries; write soname.
1819 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1820 soname from incremental info.
1821 * incremental.h (enum Incremental_input_flags): Add
1822 INCREMENTAL_INPUT_AS_NEEDED.
1823 (Incremental_input_entry::Incremental_input_entry): Initialize new
1824 data member.
1825 (Incremental_input_entry::set_as_needed): New function.
1826 (Incremental_input_entry::as_needed): New function.
1827 (Incremental_input_entry::do_dynobj_entry): New function.
1828 (Incremental_input_entry::as_needed_): New data member.
1829 (Incremental_object_entry::Incremental_object_entry): Don't check
1830 for shared library.
1831 (Incremental_object_entry::do_type): Likewise.
1832 (class Incremental_dynobj_entry): New class.
1833 (Incremental_input_entry_reader::as_needed): New function.
1834 (Incremental_input_entry_reader::get_soname): New function.
1835 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1836 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1837 size of shared library info entry.
1838 * layout.cc (Layout::finish_dynamic_section): Don't test for
1839 incremental link when adding DT_NEEDED entries.
1840 * object.h (Object::Object): Initialize new data member.
1841 (Object::dynobj): New function.
1842 (Object::set_as_needed): New function.
1843 (Object::as_needed): New function.
1844 (Object::do_dynobj): New function.
1845 (Object::as_needed_): New data member.
1846
1847 2011-05-24 Cary Coutant <ccoutant@google.com>
1848
1849 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1850 info; adjust display of GOT entries.
1851 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1852 vector of input objects; remove file_status_.
1853 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1854 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1855 got_plt reader; call target hooks to reserve GOT entries.
1856 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1857 of input file info header and GOT info entry.
1858 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1859 relocation info.
1860 (Got_plt_view_info::got_descriptor): Remove.
1861 (Got_plt_view_info::sym_index): New data member.
1862 (Got_plt_view_info::input_index): New data member.
1863 (Local_got_offset_visitor::visit): Write input file index.
1864 (Global_got_offset_visitor::visit): Write 0 for input file index.
1865 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1866 with sym_index and input_index.
1867 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1868 incremental info GOT entry; replace got_descriptor with input_index.
1869 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1870 map from input file index to object.
1871 (Sized_relobj_incr::do_layout): Replace direct data member reference
1872 with accessor function.
1873 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1874 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1875 Adjust size of input file info header.
1876 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1877 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1878 (Incremental_input_entry_reader::get_input_section): Adjust size of
1879 input file info header.
1880 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1881 of incremental info GOT entry.
1882 (Incremental_got_plt_reader::get_got_desc): Remove.
1883 (Incremental_got_plt_reader::get_got_symndx): New function.
1884 (Incremental_got_plt_reader::get_got_input_index): New function.
1885 (Sized_incremental_binary::Sized_incremental_binary): Remove
1886 file_status_; add input_objects_.
1887 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1888 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1889 (Sized_incremental_binary::file_is_unchanged): Remove.
1890 (Sized_incremental_binary::set_input_object): New function.
1891 (Sized_incremental_binary::input_object): New function.
1892 (Sized_incremental_binary::file_status_): Remove.
1893 (Sized_incremental_binary::input_objects_): New data member.
1894 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1895 references.
1896 (Sized_relobj_incr::invalid_address): Move to base class.
1897 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1898 class.
1899 (Sized_relobj_incr::do_output_section_offset): Likewise.
1900 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1901 (Sized_relobj_incr::section_offsets_): Likewise.
1902 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1903 function.
1904 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1905 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1906 with accessor function.
1907 (Sized_relobj_file::do_layout): Likewise.
1908 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1909 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1910 (Sized_relobj_file::compute_final_local_value): Replace refs to
1911 section_offsets_ with accessor function.
1912 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1913 * object.h (Relobj::Relobj): Initialize new data members.
1914 (Relobj::add_dyn_reloc): New function.
1915 (Relobj::first_dyn_reloc): New function.
1916 (Relobj::dyn_reloc_count): New function.
1917 (Relobj::first_dyn_reloc_): New data member.
1918 (Relobj::dyn_reloc_count_): New data member.
1919 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1920 references.
1921 (Sized_relobj::Address): New typedef.
1922 (Sized_relobj::invalid_address): Move here from child class.
1923 (Sized_relobj::Sized_relobj): Initialize new data members.
1924 (Sized_relobj::sized_relobj): New function.
1925 (Sized_relobj::is_output_section_offset_invalid): Move here from
1926 child class.
1927 (Sized_relobj::get_output_section_offset): Likewise.
1928 (Sized_relobj::local_has_got_offset): Likewise.
1929 (Sized_relobj::local_got_offset): Likewise.
1930 (Sized_relobj::set_local_got_offset): Likewise.
1931 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1932 (Sized_relobj::clear_got_offsets): New function.
1933 (Sized_relobj::section_offsets): Move here from child class.
1934 (Sized_relobj::do_output_section_offset): Likewise.
1935 (Sized_relobj::do_set_section_offset): Likewise.
1936 (Sized_relobj::Local_got_offsets): Likewise.
1937 (Sized_relobj::local_got_offsets_): Likewise.
1938 (Sized_relobj::section_offsets_): Likewise.
1939 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1940 references.
1941 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1942 class.
1943 (Sized_relobj_file::sized_relobj): New function
1944 (Sized_relobj_file::local_has_got_offset): Move to base class.
1945 (Sized_relobj_file::local_got_offset): Likewise.
1946 (Sized_relobj_file::set_local_got_offset): Likewise.
1947 (Sized_relobj_file::get_output_section_offset): Likewise.
1948 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1949 (Sized_relobj_file::do_output_section_offset): Likewise.
1950 (Sized_relobj_file::do_set_section_offset): Likewise.
1951 (Sized_relobj_file::Local_got_offsets): Likewise.
1952 (Sized_relobj_file::local_got_offsets_): Likewise.
1953 (Sized_relobj_file::section_offsets_): Likewise.
1954 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1955 (all constructors).
1956 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1957 (Output_reloc::get_symbol_index): Likewise.
1958 (Output_reloc::local_section_offset): Likewise.
1959 (Output_reloc::get_address): Likewise.
1960 (Output_reloc::symbol_value): Likewise.
1961 (Output_data_got::reserve_slot): Move to class definition.
1962 (Output_data_got::reserve_local): New function.
1963 (Output_data_got::reserve_slot_for_global): Remove.
1964 (Output_data_got::reserve_global): New function.
1965 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1966 (all constructors, two instantiations).
1967 (Output_reloc::get_relobj): New function (two instantiations).
1968 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1969 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1970 (Output_data_reloc::add_global): Adjust type of relobj.
1971 (Output_data_reloc::add_global_relative): Likewise.
1972 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1973 (Output_data_reloc::add_local): Likewise.
1974 (Output_data_reloc::add_local_relative): Likewise.
1975 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1976 (Output_data_reloc::add_local_section): Likewise.
1977 (Output_data_reloc::add_output_section): Likewise.
1978 (Output_data_reloc::add_absolute): Likewise.
1979 (Output_data_reloc::add_target_specific): Likewise.
1980 (Output_data_got::reserve_slot): Move definition here.
1981 (Output_data_got::reserve_local): New function.
1982 (Output_data_got::reserve_global): New function.
1983 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1984 section_offsets_ with accessor function.
1985 (Sized_relobj_file::write_sections): Likewise.
1986 (Sized_relobj_file::do_relocate_sections): Likewise.
1987 * target.h (Sized_target::reserve_local_got_entry): New function.
1988 (Sized_target::reserve_global_got_entry): New function.
1989 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1990 (Target_x86_64::reserve_global_got_entry): New function.
1991 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1992
1993 2011-05-23 Cary Coutant <ccoutant@google.com>
1994
1995 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1996 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1997 bit when checking got_type.
1998 * incremental.cc (Sized_incremental_binary::setup_readers):
1999 Store symbol table and string table locations; initialize bit vector
2000 of file status flags.
2001 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2002 unchanged files.
2003 (Sized_incremental_binary::do_process_got_plt): New function.
2004 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2005 (Output_section_incremental_inputs::set_final_data_size): Record
2006 file index for each input file.
2007 (Output_section_incremental_inputs::write_got_plt): Store file index
2008 instead of input entry offset for each GOT entry.
2009 * incremental.h
2010 (Incremental_input_entry::Incremental_input_entry): Initialize new
2011 data member.
2012 (Incremental_input_entry::set_offset): Store file index.
2013 (Incremental_input_entry::get_file_index): New function.
2014 (Incremental_input_entry::file_index_): New data member.
2015 (Incremental_binary::process_got_plt): New function.
2016 (Incremental_binary::do_process_got_plt): New function.
2017 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2018 data members.
2019 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2020 (Sized_incremental_binary::set_file_is_unchanged): New function.
2021 (Sized_incremental_binary::file_is_unchanged): New function.
2022 (Sized_incremental_binary::do_process_got_plt): New function.
2023 (Sized_incremental_binary::file_status_): New data member.
2024 (Sized_incremental_binary::main_symtab_loc_): New data member.
2025 (Sized_incremental_binary::main_strtab_loc_): New data member.
2026 * output.cc (Output_data_got::Got_entry::write): Add case
2027 RESERVED_CODE.
2028 (Output_data_got::add_global): Call add_got_entry.
2029 (Output_data_got::add_global_plt): Likewise.
2030 (Output_data_got::add_global_with_rel): Likewise.
2031 (Output_data_got::add_global_with_rela): Likewise.
2032 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2033 (Output_data_got::add_global_pair_with_rela): Likewise.
2034 (Output_data_got::add_local): Call add_got_entry.
2035 (Output_data_got::add_local_plt): Likewise.
2036 (Output_data_got::add_local_with_rel): Likewise.
2037 (Output_data_got::add_local_with_rela): Likewise.
2038 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2039 (Output_data_got::add_local_pair_with_rela): Likewise.
2040 (Output_data_got::reserve_slot): New function.
2041 (Output_data_got::reserve_slot_for_global): New function.
2042 (Output_data_got::add_got_entry): New function.
2043 (Output_data_got::add_got_entry_pair): New function.
2044 (Output_section::add_output_section_data): Edit FIXME.
2045 * output.h
2046 (Output_section_data_build::Output_section_data_build): New
2047 constructor with size parameter.
2048 (Output_data_space::Output_data_space): Likewise.
2049 (Output_data_got::Output_data_got): Initialize new data member; new
2050 constructor with size parameter.
2051 (Output_data_got::add_constant): Call add_got_entry.
2052 (Output_data_got::reserve_slot): New function.
2053 (Output_data_got::reserve_slot_for_global): New function.
2054 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2055 (Output_data_got::add_got_entry): New function.
2056 (Output_data_got::add_got_entry_pair): New function.
2057 (Output_data_got::free_list_): New data member.
2058 * target.h (Sized_target::init_got_plt_for_update): New function.
2059 (Sized_target::register_global_plt_entry): New function.
2060 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2061 Initialize new data member; call init; add constructor with PLT count.
2062 (Output_data_plt_x86_64::init): New function.
2063 (Output_data_plt_x86_64::add_relocation): New function.
2064 (Output_data_plt_x86_64::reserve_slot): New function.
2065 (Output_data_plt_x86_64::free_list_): New data member.
2066 (Target_x86_64::init_got_plt_for_update): New function.
2067 (Target_x86_64::register_global_plt_entry): New function.
2068 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2069 incremental updates.
2070 (Output_data_plt_x86_64::add_relocation): New function.
2071 * testsuite/object_unittest.cc (Object_test): Set default options.
2072
2073 2011-05-16 Ian Lance Taylor <iant@google.com>
2074
2075 * options.h (class General_options): Make -i a synonym for -r.
2076
2077 2011-05-16 Ian Lance Taylor <iant@google.com>
2078
2079 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2080
2081 2011-05-10 Cary Coutant <ccoutant@google.com>
2082
2083 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2084 strip_all (-s).
2085
2086 2011-05-06 Ian Lance Taylor <iant@google.com>
2087
2088 * layout.cc (Layout::layout): If the output section flags change,
2089 update the ordering.
2090
2091 2011-04-25 Cary Coutant <ccoutant@google.com>
2092
2093 * incremental-dump.cc (dump_incremental_inputs): Print local
2094 symbol info for each input file.
2095 * incremental.cc
2096 (Output_section_incremental_inputs::set_final_data_size): Add local
2097 symbol info to input file entries in incremental info.
2098 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2099 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2100 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2101 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2102 implementation.
2103 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2104 (Sized_incr_relobj::do_relocate): Write the local symbols.
2105 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2106 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2107 Adjust size of input file header.
2108 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2109 (Incremental_inputs_reader::get_local_symbol_count): New function.
2110 (Incremental_inputs_reader::get_input_section): Adjust size of input
2111 file header.
2112 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2113 (Sized_incr_relobj::This): New typedef.
2114 (Sized_incr_relobj::sym_size): New const data member.
2115 (Sized_incr_relobj::Local_symbol): New struct.
2116 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2117 (Sized_incr_relobj::do_local_symbol_offset): New function.
2118 (Sized_incr_relobj::local_symbol_count_): New data member.
2119 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2120 (Sized_incr_relobj::local_symbol_index_): New data member.
2121 (Sized_incr_relobj::local_symbol_offset_): New data member.
2122 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2123 (Sized_incr_relobj::local_symbols_): New data member.
2124 * object.h (Relobj::output_local_symbol_count): New function.
2125 (Relobj::local_symbol_offset): New function.
2126 (Relobj::do_output_local_symbol_count): New function.
2127 (Relobj::do_local_symbol_offset): New function.
2128 (Sized_relobj::do_output_local_symbol_count): New function.
2129 (Sized_relobj::do_local_symbol_offset): New function.
2130
2131 2011-04-22 Vladimir Simonov <sv@sw.ru>
2132
2133 * descriptors.cc (set_close_on_exec): New function.
2134 (Descriptors::open): Use set_close_on_exec.
2135 * output.cc (S_ISLNK): Define if not defined.
2136
2137 2011-04-22 Cary Coutant <ccoutant@google.com>
2138
2139 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2140 global symbol map.
2141 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2142 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2143 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2144 relocations.
2145 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2146 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2147 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2148 * incremental.h
2149 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2150 function.
2151 (Incremental_binary::apply_incremental_relocs): New function.
2152 (Incremental_binary::do_apply_incremental_relocs): New function.
2153 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2154 data member.
2155 (Sized_incremental_binary::add_global_symbol): New function.
2156 (Sized_incremental_binary::global_symbol): New function.
2157 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2158 (Sized_incremental_binary::symbol_map_): New data member.
2159 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2160 * target.h (Sized_target::apply_relocation): New function.
2161 * target-reloc.h (apply_relocation): New function.
2162 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2163
2164 2011-04-22 Doug Kwan <dougkwan@google.com>
2165
2166 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2167 flag of a SHT_ARM_EXIDX section.
2168 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2169 * testsuite/Makefile.in: Regenerate.
2170 * testsuite/arm_exidx_test.s: New file.
2171 * testsuite/arm_exidx_test.sh: Same.
2172
2173 2011-04-20 Cary Coutant <ccoutant@google.com>
2174
2175 PR gold/12689
2176 * archive.h (Incremental_archive_entry::Archive_member):
2177 Initialize arg_serial_ (second constructor).
2178
2179 2011-04-17 Ian Lance Taylor <iant@google.com>
2180
2181 * object.cc (Relocate_info::location): Simplify location string.
2182 * errors.cc (Errors::error_at_location): Don't print program
2183 name.
2184 (Errors::warning_at_location): Likewise.
2185 (Errors::undefined_symbol): Likewise.
2186 * testsuite/debug_msg.sh: Update accordingly.
2187
2188 2011-04-14 Cary Coutant <ccoutant@google.com>
2189
2190 * gold/layout.cc (Layout::symtab_section_offset): New function.
2191 * gold/layout.h (Layout::symtab_section_offset): New function.
2192 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2193
2194 2011-04-12 Ian Lance Taylor <iant@google.com>
2195
2196 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2197 with MREMAP_MAYMOVE.
2198 * output.h (class Output_file): Add map_is_allocated_ field.
2199 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2200 not available, provide stubs. If mremap is not available, #define
2201 it to gold_mremap.
2202 (MREMAP_MAYMOVE): Define if not defined.
2203 (Output_file::Output_file): Initialize map_is_allocated_.
2204 (Output_file::resize): Check map_is_allocated_.
2205 (Output_file::map_anonymous): If mmap fails, use malloc.
2206 (Output_file::unmap): Don't do anything for an anonymous map.
2207 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2208 is not available, provide stubs.
2209 (File_read::View::~View): Use free rather than delete[].
2210 (File_read::make_view): Use malloc rather than new[]. If mmap
2211 fails, use malloc.
2212 (File_read::find_or_make_view): Use malloc rather than new[].
2213 * gold.h: Remove HAVE_REMAP code.
2214 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2215 exists. Rename mremap to gold_mremap. If mmap is not available
2216 don't do anything.
2217 * configure, config.in: Rebuild.
2218
2219 2011-04-11 Ian Lance Taylor <iant@google.com>
2220
2221 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2222 initialize local variable v.
2223
2224 2011-04-11 Cary Coutant <ccoutant@google.com>
2225
2226 * archive.cc (Archive::include_member): Adjust call to
2227 report_object.
2228 (Add_archive_symbols::run): Track argument serial numbers.
2229 (Lib_group::include_member): Likewise.
2230 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2231 * archive.h (Incremental_archive_entry::Archive_member):
2232 Initialize arg_serial_.
2233 (Archive_member::arg_serial_): New data member.
2234 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2235 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2236 incremental link.
2237 (Sized_dynobj::do_for_all_local_got_entries): New function.
2238 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2239 function.
2240 * fileread.cc (get_mtime): New function.
2241 * fileread.h (get_mtime): New function.
2242 * gold.cc (queue_initial_tasks): Check for incremental update.
2243 (process_incremental_input): New function.
2244 (queue_middle_tasks): Don't force valid target for incremental
2245 update.
2246 * incremental-dump.cc (find_input_containing_global): Adjust
2247 size of symbol info entry.
2248 (dump_incremental_inputs): Dump argument serial number and
2249 in_system_directory flag; bias shndx by 1; print symbol names
2250 when dumping per-file symbol lists; use new symbol info readers.
2251 * incremental.cc
2252 (Output_section_incremental_inputs:update_data_size): New function.
2253 (Sized_incremental_binary::setup_readers): Setup input readers
2254 for each input file; build maps for files added from libraries
2255 and scripts.
2256 (Sized_incremental_binary::check_input_args): New function.
2257 (Sized_incremental_binary::do_check_inputs): Build map of argument
2258 serial numbers to input arguments.
2259 (Sized_incremental_binary::do_file_has_changed): Rename
2260 do_file_is_unchanged to this; compare file modification times.
2261 (Sized_incremental_binary::do_init_layout): New function.
2262 (Sized_incremental_binary::do_reserve_layout): New function.
2263 (Sized_incremental_binary::do_get_input_reader): Remove.
2264 (Sized_incremental_binary::get_symtab_view): New function.
2265 (Incremental_checker::can_incrementally_link_output_file): Remove.
2266 (Incremental_inputs::report_command_line): Exclude --debug options.
2267 (Incremental_inputs::report_archive_begin): Add parameter; track
2268 argument serial numbers; don't put input file entry for archive
2269 before archive members.
2270 (Incremental_inputs::report_archive_end): Put input file entry
2271 for archive after archive members.
2272 (Incremental_inputs::report_object): Add parameter; track argument
2273 serial numbers and in_system_directory flag.
2274 (Incremental_inputs::report_script): Add parameter; track argument
2275 serial numbers.
2276 (Output_section_incremental_inputs::set_final_data_size): Adjust
2277 size of symbol info entry; check for forwarding symbols.
2278 (Output_section_incremental_inputs::write_input_files): Write
2279 in_system_directory flag and argument serial number.
2280 (Output_section_incremental_inputs::write_info_blocks): Map section
2281 indices between incremental info and original input file; store
2282 input section index for each symbol.
2283 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2284 change operator() to visit().
2285 (class Global_got_offset_visitor): Likewise.
2286 (class Global_symbol_visitor_got_plt):
2287 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2288 classes.
2289 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2290 (Sized_incr_relobj::do_read_symbols): New function.
2291 (Sized_incr_relobj::do_layout): New function.
2292 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2293 (Sized_incr_relobj::do_add_symbols): New function.
2294 (Sized_incr_relobj::do_should_include_member): New function.
2295 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2296 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2297 (Sized_incr_relobj::do_section_size): New function.
2298 (Sized_incr_relobj::do_section_name): New function.
2299 (Sized_incr_relobj::do_section_contents): New function.
2300 (Sized_incr_relobj::do_section_flags): New function.
2301 (Sized_incr_relobj::do_section_entsize): New function.
2302 (Sized_incr_relobj::do_section_address): New function.
2303 (Sized_incr_relobj::do_section_type): New function.
2304 (Sized_incr_relobj::do_section_link): New function.
2305 (Sized_incr_relobj::do_section_info): New function.
2306 (Sized_incr_relobj::do_section_addralign): New function.
2307 (Sized_incr_relobj::do_initialize_xindex): New function.
2308 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2309 (Sized_incr_relobj::do_read_relocs): New function.
2310 (Sized_incr_relobj::do_gc_process_relocs): New function.
2311 (Sized_incr_relobj::do_scan_relocs): New function.
2312 (Sized_incr_relobj::do_count_local_symbols): New function.
2313 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2314 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2315 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2316 (Sized_incr_relobj::do_relocate): New function.
2317 (Sized_incr_relobj::do_set_section_offset): New function.
2318 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2319 (Sized_incr_dynobj::do_read_symbols): New function.
2320 (Sized_incr_dynobj::do_layout): New function.
2321 (Sized_incr_dynobj::do_add_symbols): New function.
2322 (Sized_incr_dynobj::do_should_include_member): New function.
2323 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2324 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2325 (Sized_incr_dynobj::do_section_size): New function.
2326 (Sized_incr_dynobj::do_section_name): New function.
2327 (Sized_incr_dynobj::do_section_contents): New function.
2328 (Sized_incr_dynobj::do_section_flags): New function.
2329 (Sized_incr_dynobj::do_section_entsize): New function.
2330 (Sized_incr_dynobj::do_section_address): New function.
2331 (Sized_incr_dynobj::do_section_type): New function.
2332 (Sized_incr_dynobj::do_section_link): New function.
2333 (Sized_incr_dynobj::do_section_info): New function.
2334 (Sized_incr_dynobj::do_section_addralign): New function.
2335 (Sized_incr_dynobj::do_initialize_xindex): New function.
2336 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2337 (make_sized_incremental_object): New function.
2338 (Incremental_library::copy_unused_symbols): New function.
2339 (Incremental_library::do_for_all_unused_symbols): New function.
2340 * incremental.h (enum Incremental_input_flags): New type.
2341 (class Incremental_checker): Remove.
2342 (Incremental_input_entry::Incremental_input_entry): Add argument
2343 serial number.
2344 (Incremental_input_entry::arg_serial): New function.
2345 (Incremental_input_entry::set_is_in_system_directory): New function.
2346 (Incremental_input_entry::is_in_system_directory): New function.
2347 (Incremental_input_entry::arg_serial_): New data member.
2348 (Incremental_input_entry::is_in_system_directory_): New data member.
2349 (class Script_info): Move here from script.h.
2350 (Script_info::Script_info): Add filename parameter.
2351 (Script_info::filename): New function.
2352 (Script_info::filename_): New data member.
2353 (Incremental_script_entry::Incremental_script_entry): Add argument
2354 serial number.
2355 (Incremental_object_entry::Incremental_object_entry): Likewise.
2356 (Incremental_object_entry::add_input_section): Build list of input
2357 sections with map to original shndx.
2358 (Incremental_object_entry::get_input_section_index): New function.
2359 (Incremental_object_entry::shndx_): New data member.
2360 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2361 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2362 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2363 serial number.
2364 (Incremental_inputs::report_archive_begin): Likewise.
2365 (Incremental_inputs::report_object): Likewise.
2366 (Incremental_inputs::report_script): Likewise.
2367 (class Incremental_global_symbol_reader): New class.
2368 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2369 and store flags and input file type.
2370 (Incremental_input_entry_reader::arg_serial): New function.
2371 (Incremental_input_entry_reader::type): Extract type from flags.
2372 (Incremental_input_entry_reader::is_in_system_directory): New function.
2373 (Incremental_input_entry_reader::get_input_section_count): Call
2374 accessor function for type.
2375 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2376 function for type; adjust size of global symbol entry.
2377 (Incremental_input_entry_reader::get_global_symbol_count): Call
2378 accessor function for type.
2379 (Incremental_input_entry_reader::get_object_count): Likewise.
2380 (Incremental_input_entry_reader::get_object_offset): Likewise.
2381 (Incremental_input_entry_reader::get_member_count): Likewise.
2382 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2383 (Incremental_input_entry_reader::get_member_offset): Likewise.
2384 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2385 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2386 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2387 (Incremental_input_entry_reader::get_global_symbol_reader): New
2388 function.
2389 (Incremental_input_entry_reader::get_output_symbol_index): New
2390 function.
2391 (Incremental_input_entry_reader::type_): Remove.
2392 (Incremental_input_entry_reader::flags_): New data member.
2393 (Incremental_inputs_reader::input_file_offset): New function.
2394 (Incremental_inputs_reader::input_file_index): New function.
2395 (Incremental_inputs_reader::input_file): Call input_file_offset.
2396 (Incremental_inputs_reader::input_file_at_offset): New function.
2397 (Incremental_relocs_reader::get_r_type): Reformat.
2398 (Incremental_relocs_reader::get_r_shndx): Reformat.
2399 (Incremental_relocs_reader::get_r_offset): Reformat.
2400 (Incremental_relocs_reader::data): New function.
2401 (Incremental_binary::Incremental_binary): Initialize new data members.
2402 (Incremental_binary::check_inputs): Add cmdline parameter.
2403 (Incremental_binary::file_is_unchanged): Remove.
2404 (Input_reader::arg_serial): New function.
2405 (Input_reader::get_unused_symbol_count): New function.
2406 (Input_reader::get_unused_symbol): New function.
2407 (Input_reader::do_arg_serial): New function.
2408 (Input_reader::do_get_unused_symbol_count): New function.
2409 (Input_reader::do_get_unused_symbol): New function.
2410 (Incremental_binary::input_file_count): New function.
2411 (Incremental_binary::get_input_reader): Change signature to use
2412 index instead of filename.
2413 (Incremental_binary::file_has_changed): New function.
2414 (Incremental_binary::get_input_argument): New function.
2415 (Incremental_binary::get_library): New function.
2416 (Incremental_binary::get_script_info): New function.
2417 (Incremental_binary::init_layout): New function.
2418 (Incremental_binary::reserve_layout): New function.
2419 (Incremental_binary::output_file): New function.
2420 (Incremental_binary::do_check_inputs): New function.
2421 (Incremental_binary::do_file_is_unchanged): Remove.
2422 (Incremental_binary::do_file_has_changed): New function.
2423 (Incremental_binary::do_init_layout): New function.
2424 (Incremental_binary::do_reserve_layout): New function.
2425 (Incremental_binary::do_input_file_count): New function.
2426 (Incremental_binary::do_get_input_reader): Change signature.
2427 (Incremental_binary::input_args_map_): New data member.
2428 (Incremental_binary::library_map_): New data member.
2429 (Incremental_binary::script_map_): New data member.
2430 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2431 new data members.
2432 (Sized_incremental_binary::output_section): New function.
2433 (Sized_incremental_binary::inputs_reader): Add const.
2434 (Sized_incremental_binary::symtab_reader): Add const.
2435 (Sized_incremental_binary::relocs_reader): Add const.
2436 (Sized_incremental_binary::got_plt_reader): Add const.
2437 (Sized_incremental_binary::get_symtab_view): New function.
2438 (Sized_incremental_binary::Inputs_reader): New typedef.
2439 (Sized_incremental_binary::Input_entry_reader): New typedef.
2440 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2441 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2442 (Sized_incremental_binary::do_file_has_changed): New function.
2443 (Sized_incremental_binary::do_init_layout): New function.
2444 (Sized_incremental_binary::do_reserve_layout): New function.
2445 (Sized_input_reader::Inputs_reader): Remove.
2446 (Sized_input_reader::Input_entry_reader): Remove.
2447 (Sized_input_reader::do_arg_serial): New function.
2448 (Sized_input_reader::do_get_unused_symbol_count): New function.
2449 (Sized_input_reader::do_get_unused_symbol): New function.
2450 (Sized_incremental_binary::do_input_file_count): New function.
2451 (Sized_incremental_binary::do_get_input_reader): Change signature;
2452 use index instead of filename.
2453 (Sized_incremental_binary::section_map_): New data member.
2454 (Sized_incremental_binary::input_entry_readers_): New data member.
2455 (class Sized_incr_relobj): New class.
2456 (class Sized_incr_dynobj): New class.
2457 (make_sized_incremental_object): New function.
2458 (class Incremental_library): New class.
2459 * layout.cc (Free_list::num_lists): New static data member.
2460 (Free_list::num_nodes): New static data member.
2461 (Free_list::num_removes): New static data member.
2462 (Free_list::num_remove_visits): New static data member.
2463 (Free_list::num_allocates): New static data member.
2464 (Free_list::num_allocate_visits): New static data member.
2465 (Free_list::init): New function.
2466 (Free_list::remove): New function.
2467 (Free_list::allocate): New function.
2468 (Free_list::dump): New function.
2469 (Free_list::print_stats): New function.
2470 (Layout_task_runner::run): Resize output file for incremental updates.
2471 (Layout::Layout): Initialize new data members.
2472 (Layout::set_incremental_base): New function.
2473 (Layout::init_fixed_output_section): New function.
2474 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2475 incremental updates.
2476 (Layout::create_gold_note): Do not create gold note section for
2477 incremental updates.
2478 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2479 for incremental updates.
2480 (Layout::set_section_offsets): For incremental updates, allocate space
2481 from free list.
2482 (Layout::create_symtab_sections): Layout with offsets relative to
2483 start of section; for incremental updates, allocate space from free
2484 list.
2485 (Layout::create_shdrs): For incremental updates, allocate space from
2486 free list.
2487 (Layout::finish_dynamic_section): For incremental updates, do not
2488 check --as-needed (fixed in subsequent patch).
2489 * layout.h (class Free_list): New class.
2490 (Layout::set_incremental_base): New function.
2491 (Layout::incremental_base): New function.
2492 (Layout::init_fixed_output_section): New function.
2493 (Layout::allocate): New function.
2494 (Layout::incremental_base_): New data member.
2495 (Layout::free_list_): New data member.
2496 * main.cc (main): Print Free_list statistics.
2497 * object.cc (Relobj::finalize_incremental_relocs): Add
2498 clear_counts parameter; clear counts only when clear_counts is set.
2499 (Sized_relobj::Sized_relobj): Initialize new base class.
2500 (Sized_relobj::do_layout): Don't report special sections.
2501 (Sized_relobj::do_for_all_local_got_entries): New function.
2502 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2503 symtab_off to all symbol table offsets.
2504 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2505 * object.h (class Got_offset_list): Move to top of file.
2506 (Object::Object): Allow case where input_file == NULL.
2507 (Object::~Object): Likewise.
2508 (Object::input_file): Assert that input_file != NULL.
2509 (Object::lock): Allow case where input_file == NULL.
2510 (Object::unlock): Likewise.
2511 (Object::is_locked): Likewise.
2512 (Object::token): Likewise.
2513 (Object::release): Likewise.
2514 (Object::is_incremental): New function.
2515 (Object::get_mtime): New function.
2516 (Object::for_all_local_got_entries): New function.
2517 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2518 (Object::set_is_in_system_directory): New function.
2519 (Object::is_in_system_directory): New function.
2520 (Object::do_is_incremental): New function.
2521 (Object::do_get_mtime): New function.
2522 (Object::do_for_all_local_got_entries): New function.
2523 (Object::is_in_system_directory_): New data member.
2524 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2525 (class Sized_relobj_base): New class.
2526 (class Sized_relobj): Derive from Sized_relobj_base.
2527 (class Sized_relobj::Symbols): Redeclare from base class.
2528 (class Sized_relobj::local_got_offset_list): Remove.
2529 (class Sized_relobj::Output_sections): Redeclare from base class.
2530 (class Sized_relobj::do_for_all_local_got_entries): New function.
2531 (class Sized_relobj::write_local_symbols): Add offset parameter.
2532 (class Sized_relobj::local_symbol_offset_): Update comment.
2533 (class Sized_relobj::local_dynsym_offset_): Update comment.
2534 * options.cc (Input_arguments::add_file): Remove const.
2535 * options.h (Input_file_argument::Input_file_argument):
2536 Initialize arg_serial_ (all constructors).
2537 (Input_file_argument::set_arg_serial): New function.
2538 (Input_file_argument::arg_serial): New function.
2539 (Input_file_argument::arg_serial_): New data member.
2540 (Input_arguments::Input_arguments): Initialize file_count_.
2541 (Input_arguments::add_file): Remove const.
2542 (Input_arguments::number_of_input_files): New function.
2543 (Input_arguments::file_count_): New data member.
2544 (Command_line::number_of_input_files): Call
2545 Input_arguments::number_of_input_files.
2546 * output.cc (Output_segment_headers::Output_segment_headers):
2547 Set current size.
2548 (Output_section::Input_section::current_data_size): New function.
2549 (Output_section::Output_section): Initialize new data members.
2550 (Output_section::add_input_section): Don't do merge sections for
2551 an incremental link; allocate space from free list for an
2552 incremental update.
2553 (Output_section::add_output_section_data): Allocate space from
2554 free list for an incremental update.
2555 (Output_section::update_data_size): New function.
2556 (Output_section::set_fixed_layout): New function.
2557 (Output_section::reserve): New function.
2558 (Output_segment::set_section_addresses): Remove const.
2559 (Output_segment::set_section_list_addresses): Remove const; allocate
2560 space from free list for an incremental update.
2561 (Output_segment::set_offset): Adjust size of RELRO segment for an
2562 incremental update.
2563 * output.h (Output_data::current_data_size): Move here from
2564 child classes.
2565 (Output_data::pre_finalize_data_size): New function.
2566 (Output_data::update_data_size): New function.
2567 (Output_section_headers::update_data_size): new function.
2568 (Output_section_data_build::current_data_size): Move to Output_data.
2569 (Output_data_strtab::update_data_size): New function.
2570 (Output_section::current_data_size): Move to Output_data.
2571 (Output_section::set_fixed_layout): New function.
2572 (Output_section::has_fixed_layout): New function.
2573 (Output_section::reserve): New function.
2574 (Output_section::update_data_size): New function.
2575 (Output_section::has_fixed_layout_): New data member.
2576 (Output_section::free_list_): New data member.
2577 (Output_segment::set_section_addresses): Remove const.
2578 (Output_segment::set_section_list_addresses): Remove const.
2579 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2580 New function.
2581 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2582 New function.
2583 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2584 parameter when calling Add_symbols constructor; store argument
2585 serial number for members of a lib group.
2586 (Add_symbols::locks): Allow case where token == NULL.
2587 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2588 (Read_member::~Read_member): New function.
2589 (Read_member::is_runnable): New function.
2590 (Read_member::locks): New function.
2591 (Read_member::run): New function.
2592 (Check_script::~Check_script): New function.
2593 (Check_script::is_runnable): New function.
2594 (Check_script::locks): New function.
2595 (Check_script::run): New function.
2596 (Check_library::~Check_library): New function.
2597 (Check_library::is_runnable): New function.
2598 (Check_library::locks): New function.
2599 (Check_library::run): New function.
2600 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2601 (Add_symbols::library_): New data member.
2602 (class Read_member): New class.
2603 (class Check_script): New class.
2604 (class Check_library): New class.
2605 * reloc.cc (Read_relocs::is_runnable): Allow case where
2606 token == NULL.
2607 (Read_relocs::locks): Likewise.
2608 (Scan_relocs::locks): Likewise.
2609 (Relocate_task::locks): Likewise.
2610 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2611 to clear counters.
2612 (Sized_relobj::incremental_relocs_scan): Fix comment.
2613 (Sized_relobj::do_relocate): Pass output file offset to
2614 write_local_symbols.
2615 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2616 from class declaration.
2617 * script.cc (read_input_script): Allocate Script_info; pass
2618 argument serial number to report_script.
2619 * script.h (class Script_info): Move to incremental.h.
2620 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2621 * symtab.h (Symbol_table::add_from_incrobj): New function.
2622 (Symbol_table::set_file_offset): New function.
2623
2624 2011-04-05 Cary Coutant <ccoutant@google.com>
2625
2626 * incremental-dump.cc (dump_incremental_inputs): Change signature
2627 to take a Sized_incremental_binary; change caller. Use readers
2628 in Sized_incremental_binary.
2629 * incremental.cc
2630 (Sized_incremental_binary::find_incremental_inputs_sections):
2631 Rename do_find_incremental_inputs_sections to this.
2632 (Sized_incremental_binary::setup_readers): New function.
2633 (Sized_incremental_binary::do_check_inputs): Check
2634 has_incremental_info_ flag; move setup code to setup_readers;
2635 use input readers.
2636 (Sized_incremental_binary::do_file_is_unchanged): New function.
2637 (Sized_incremental_binary::do_get_input_reader): New function.
2638 * incremental.h (class Incremental_binary): Move to end of file.
2639 (Incremental_binary::file_is_unchanged): New function.
2640 (Incremental_binary::do_file_is_unchanged): New function.
2641 (Incremental_binary::Input_reader): New class.
2642 (Incremental_binary::get_input_reader): New function.
2643 (class Sized_incremental_binary): Move to end of file.
2644 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2645 input section reader classes.
2646 (Sized_incremental_binary::has_incremental_info): New function.
2647 (Sized_incremental_binary::inputs_reader): New function.
2648 (Sized_incremental_binary::symtab_reader): New function.
2649 (Sized_incremental_binary::relocs_reader): New function.
2650 (Sized_incremental_binary::got_plt_reader): New function.
2651 (Sized_incremental_binary::do_file_is_unchanged): New function.
2652 (Sized_incremental_binary::Sized_input_reader): New class.
2653 (Sized_incremental_binary::get_input_reader): New function.
2654 (Sized_incremental_binary::find_incremental_inputs_sections):
2655 Rename do_find_incremental_inputs_sections to this.
2656 (Sized_incremental_binary::setup_readers): New function.
2657 (Sized_incremental_binary::has_incremental_info_): New data member.
2658 (Sized_incremental_binary::inputs_reader_): New data member.
2659 (Sized_incremental_binary::symtab_reader_): New data member.
2660 (Sized_incremental_binary::relocs_reader_): New data member.
2661 (Sized_incremental_binary::got_plt_reader_): New data member.
2662 (Sized_incremental_binary::current_input_file_): New data member.
2663
2664 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2665
2666 PR gold/12640
2667 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2668 violation.
2669
2670 2011-03-30 Cary Coutant <ccoutant@google.com>
2671
2672 * archive.cc (Archive::include_member): Adjust call to report_object.
2673 (Add_archive_symbols::run): Add script_info to call to
2674 report_archive_begin.
2675 (Lib_group::include_member): Adjust call to report_object.
2676 (Add_lib_group_symbols::run): Adjust call to report_object.
2677 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2678 blocks. Add object count for script input files.
2679 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2680 script_info parameter; change all callers.
2681 (Incremental_inputs::report_object): Add script_info parameter;
2682 change all callers.
2683 (Incremental_inputs::report_script): Store backpointer to
2684 incremental info entry.
2685 (Output_section_incremental_inputs::set_final_data_size): Record
2686 additional information for scripts.
2687 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2688 * incremental.h (Incremental_script_entry::add_object): New function.
2689 (Incremental_script_entry::get_object_count): New function.
2690 (Incremental_script_entry::get_object): New function.
2691 (Incremental_script_entry::objects_): New data member; adjust
2692 constructor.
2693 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2694 (Incremental_inputs::report_object): Add script_info parameter.
2695 (Incremental_inputs_reader::get_object_count): New function.
2696 (Incremental_inputs_reader::get_object_offset): New function.
2697 * options.cc (Input_arguments::add_file): Return reference to
2698 new input argument.
2699 * options.h (Input_argument::set_script_info): New function.
2700 (Input_argument::script_info): New function.
2701 (Input_argument::script_info_): New data member; adjust all
2702 constructors.
2703 (Input_file_group::add_file): Return reference to new input argument.
2704 (Input_file_lib::add_file): Likewise.
2705 (Input_arguments::add_file): Likewise.
2706 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2707 * script.cc (Parser_closure::Parser_closure): Add script_info
2708 parameter; adjust all callers.
2709 (Parser_closure::script_info): New function.
2710 (Parser_closure::script_info_): New data member.
2711 (read_input_script): Report scripts earlier to incremental info.
2712 (script_add_file): Set script_info in Input_argument.
2713 (script_add_library): Likewise.
2714 * script.h (Script_options::Script_info): Rewrite class.
2715
2716 2011-03-29 Cary Coutant <ccoutant@google.com>
2717
2718 * archive.cc (Library_base::should_include_member): Move
2719 method here from class Archive.
2720 (Archive::Archive): Initialize base class.
2721 (Archive::should_include_member): Move to base class.
2722 (Archive::do_for_all_unused_symbols): New function.
2723 (Add_archive_symbols::run): Remove redundant access to
2724 incremental_inputs.
2725 (Lib_group::Lib_group): Initialize base class.
2726 (Lib_group::do_filename): New function.
2727 (Lib_group::include_member): Pass pointer to Lib_group to
2728 report_object.
2729 (Lib_group::do_for_all_unused_symbols): New function.
2730 (Add_lib_group_symbols::run): Report archive information for
2731 incremental links.
2732 * archive.h (class Library_base): New base class.
2733 (class Archive): Derive from Library_base.
2734 (Archive::filename): Move to base class.
2735 (Archive::set_incremental_info): Likewise.
2736 (Archive::incremental_info): Likewise.
2737 (Archive::Should_include): Likewise.
2738 (Archive::should_include_member): Likewise.
2739 (Archive::Armap_entry): Remove.
2740 (Archive::Unused_symbol_iterator): Remove.
2741 (Archive::unused_symbols_begin): Remove.
2742 (Archive::unused_symbols_end): Remove.
2743 (Archive::do_filename): New function.
2744 (Archive::do_get_mtime): New function.
2745 (Archive::do_for_all_unused_symbols): New function.
2746 (Archive::task_): Move to base class.
2747 (Archive::incremental_info_): Likewise.
2748 (class Lib_group): Derive from Library_base.
2749 (Lib_group::do_filename): New function.
2750 (Lib_group::do_get_mtime): New function.
2751 (Lib_group::do_for_all_unused_symbols): New function.
2752 (Lib_group::task_): Move to base class.
2753 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2754 function.
2755 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2756 function.
2757 * incremental.cc (Incremental_inputs::report_archive_begin):
2758 Use Library_base; call library's get_mtime; add incremental inputs
2759 entry before members.
2760 (class Unused_symbol_visitor): New class.
2761 (Incremental_inputs::report_archive_end): Use Library_base; use
2762 visitor class to record unused symbols; don't add incremental inputs
2763 entry after members.
2764 (Incremental_inputs::report_object): Use Library_base.
2765 * incremental.h
2766 (Incremental_archive_entry::Incremental_archive_entry): Remove
2767 unused Archive parameter.
2768 (Incremental_inputs::report_archive_begin): Use Library_base.
2769 (Incremental_inputs::report_archive_end): Likewise.
2770 (Incremental_inputs::report_object): Likewise.
2771 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2772 function.
2773 * object.h (Object::for_all_global_symbols): New function.
2774 (Object::do_for_all_global_symbols): New function.
2775 (Sized_relobj::do_for_all_global_symbols): New function.
2776 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2777 function.
2778 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2779 function.
2780
2781 2011-03-27 Ian Lance Taylor <iant@google.com>
2782
2783 * archive.cc (Archive::interpret_header): Return -1 if something
2784 goes wrong. Change callers accordingly.
2785
2786 2011-03-25 Cary Coutant <ccoutant@google.com>
2787
2788 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2789 * testsuite/Makefile.in: Regenerate.
2790
2791 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2792
2793 * plugin.cc (get_view): New.
2794 (Plugin::load): Pass get_view to the plugin.
2795 (Plugin_manager::get_view): New.
2796
2797 2011-03-21 Ian Lance Taylor <iant@google.com>
2798
2799 * testsuite/final_layout.sh: Rewrite to not use dc.
2800 * testsuite/relro_test.sh: Fail if dc is not present.
2801
2802 2011-03-21 Sriraman Tallam <tmsriram@google.com>
2803
2804 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2805 Change == to -eq.
2806 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2807 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2808 Change == to -eq.
2809 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2810 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2811
2812 2011-03-14 Ian Lance Taylor <iant@google.com>
2813
2814 * script-sections.cc (Sort_output_sections::script_compare):
2815 Rename from is_before, change return type.
2816 (Sort_output_sections::operator()): Adjust accordingly.
2817
2818 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2819
2820 PR gold/12572
2821 * testsuite/odr_violation2.cc: Add comment to make all error line
2822 numbers double digits.
2823 * testsuite/debug_msg.sh: Adjust expected errors.
2824
2825 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2826
2827 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2828 but mark earlier ones as non-canonical
2829 (offset_to_iterator): Update search target and example
2830 (do_addr2line): Return extra lines in a vector*
2831 (format_file_lineno): Extract from do_addr2line
2832 (one_addr2line): Add vector* out-param
2833 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2834 when a lineno entry appeared last for its instruction
2835 (Dwarf_line_info): Add vector* out-param
2836 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2837 * symtab.cc (Odr_violation_compare): Include the lineno in the
2838 comparison again.
2839 (linenos_from_loc): New. Combine the canonical line for an
2840 address with its other lines.
2841 (True_if_intersect): New. Helper functor to make
2842 std::set_intersection a query.
2843 (detect_odr_violations): Compare sets of lines instead of just
2844 one line for each function. This became less deterministic, but
2845 has fewer false positives.
2846 * symtab.h: Declarations.
2847 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2848 mix an optimized and non-optimized object in the same binary
2849 (odr_violation2.so): Same.
2850 * testsuite/Makefile.in: Regenerate from Makefile.am.
2851 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2852 * testsuite/debug_msg.sh: Update line numbers and add
2853 assertions.
2854 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2855 non-optimized context.
2856 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2857 isn't inlined, and use OdrDerived in an optimized context.
2858 * testsuite/odr_header1.h: Defines OdrDerived, where
2859 optimization will change the
2860 first-instruction-in-the-destructor's file and line number.
2861 * testsuite/odr_header2.h: Defines OdrBase.
2862
2863 2011-03-09 Ian Lance Taylor <iant@google.com>
2864
2865 * fileread.cc (File_read::clear_views): Don't delete the whole
2866 file view.
2867
2868 2011-03-08 Ian Lance Taylor <iant@google.com>
2869
2870 PR gold/12525
2871 * fileread.cc: #include <climits>.
2872 (GOLD_IOV_MAX): Define.
2873 (File_read::read_multiple): Limit number of entries by iov_max.
2874 * fileread.h (class File_read): Always set max_readv_entries to
2875 128.
2876
2877 2011-03-07 Ian Lance Taylor <iant@google.com>
2878
2879 PR gold/12525
2880 * options.h (class General_options): Add -dy and -dn.
2881
2882 2011-03-02 Cary Coutant <ccoutant@google.com>
2883
2884 * testsuite/script_test_9.t: Add TLS segment.
2885
2886 2011-03-02 Simon Baldwin <simonb@google.com>
2887
2888 * configure.ac: Add check for gnu_indirect_function support in
2889 the toolchain building binutils.
2890 * configure: Rebuild.
2891
2892 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2893
2894 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2895 plugin only symbols.
2896 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2897 in plugin files as not needed in the symbol table.
2898
2899 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2900
2901 * output.cc (Output_section::add_input_section): Delay fill
2902 generation for section ordering.
2903
2904 2011-02-09 Ian Lance Taylor <iant@google.com>
2905
2906 PR gold/12316
2907 * object.h (class Sized_relobj): Remove clear_local_symbols.
2908 * reloc.cc (Sized_relobj::do_relocate): Don't call
2909 clear_local_symbols.
2910
2911 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2912
2913 * plugin.cc (is_visible_from_outside): Return true for symbols
2914 in the -u option.
2915
2916 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2917
2918 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2919 filename.
2920
2921 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2922
2923 * icf.h (is_section_foldable_candidate): Change type of parameter
2924 to std::string.
2925 * icf.cc (Icf::find_identical_sections): Change type of local variable
2926 section_name to be std::string.
2927 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2928
2929 2011-01-25 Ian Lance Taylor <iant@google.com>
2930
2931 * script.cc (script_add_extern): Rewrite to use
2932 add_symbol_reference.
2933
2934 2011-01-25 Doug Kwan <dougkwan@google.com>
2935
2936 * icf.cc (get_section_contents): Always lock section's object.
2937
2938 2011-01-24 Ian Lance Taylor <iant@google.com>
2939
2940 * options.h (class General_options): Accept
2941 --no-detect-odr-violations.
2942
2943 2011-01-24 Ian Lance Taylor <iant@google.com>
2944
2945 * version.cc (version_string): Bump to 1.11.
2946
2947 2011-01-24 Ian Lance Taylor <iant@google.com>
2948
2949 * plugin.cc (class Plugin_rescan): Define new class.
2950 (Plugin_manager::claim_file): Set any_claimed_.
2951 (Plugin_manager::save_archive): New function.
2952 (Plugin_manager::save_input_group): New function.
2953 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2954 necessary.
2955 (Plugin_manager::new_undefined_symbol): New function.
2956 (Plugin_manager::rescan): New function.
2957 (Plugin_manager::rescannable_defines): New function.
2958 (Plugin_manager::add_input_file): Set any_added_.
2959 * plugin.h (class Plugin_manager): define new fields rescannable_,
2960 undefined_symbols_, any_claimed_, and any_added_. Declare
2961 Plugin_rescan as friend. Declare new functions.
2962 (Plugin_manager::Rescannable): Define type.
2963 (Plugin_manager::Rescannable_list): Define type.
2964 (Plugin_manager::Undefined_symbol_list): Define type.
2965 (Plugin_manager::Plugin_manager): Initialize new fields.
2966 * archive.cc (Archive::defines_symbol): New function.
2967 (Add_archive_symbols::run): Pass archive to plugins if any.
2968 * archive.h (class Archive): Declare defines_symbol.
2969 * readsyms.cc (Input_group::~Input_group): New function.
2970 (Finish_group::run): Pass input_group to plugins if any.
2971 * readsyms.h (class Input_group): Declare destructor.
2972 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2973 any.
2974
2975 2011-01-10 Ian Lance Taylor <iant@google.com>
2976
2977 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2978 section as relro.
2979 (Layout::set_segment_offsets): Reset increase_relro before calling
2980 set_section_addresses a second time.
2981
2982 2011-01-04 Cary Coutant <ccoutant@google.com>
2983
2984 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2985 sections before NOBITS sections.
2986
2987 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2988
2989 * version.cc (print_version): Update copyright to 2011.
2990
2991 2010-12-23 Cary Coutant <ccoutant@google.com>
2992
2993 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2994 of OS to this->add. Add OD parameter to second form of the function.
2995
2996 2010-12-20 Ian Lance Taylor <iant@google.com>
2997
2998 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2999 second of two consecutive entries with same offset.
3000
3001 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3002
3003 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3004 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3005 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3006 to avoid unneeded links against $(LDADD).
3007 * testsuite/Makefile.in: Regenerate.
3008
3009 2010-12-15 Ian Lance Taylor <iant@google.com>
3010
3011 PR gold/12324
3012 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3013 for R_X86_64_32 and R_X86_64_PC32.
3014 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3015 ver_matching_def_pic.o.
3016 (ver_matching_def_pic.o): New target.
3017
3018 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3019
3020 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3021 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3022 Move definition before File_read::View member definitions.
3023 (File_read::View::~View): Initialize and hold lock before
3024 updating current_mapped_bytes.
3025
3026 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3027
3028 * dwarf_reader.cc: Remove outdated comment.
3029 * gold-threads.cc: Fix typo in error message.
3030 * archive.cc: Fix typos in comments.
3031 * archive.h: Likewise.
3032 * arm-reloc-property.cc: Likewise.
3033 * arm-reloc-property.h: Likewise.
3034 * arm-reloc.def: Likewise.
3035 * arm.cc: Likewise.
3036 * attributes.h: Likewise.
3037 * cref.cc: Likewise.
3038 * ehframe.cc: Likewise.
3039 * fileread.h: Likewise.
3040 * gold.h: Likewise.
3041 * i386.cc: Likewise.
3042 * icf.cc: Likewise.
3043 * incremental.h: Likewise.
3044 * int_encoding.cc: Likewise.
3045 * layout.h: Likewise.
3046 * main.cc: Likewise.
3047 * merge.h: Likewise.
3048 * object.cc: Likewise.
3049 * object.h: Likewise.
3050 * options.cc: Likewise.
3051 * readsyms.cc: Likewise.
3052 * reduced_debug_output.cc: Likewise.
3053 * reloc.cc: Likewise.
3054 * script-sections.cc: Likewise.
3055 * sparc.cc: Likewise.
3056 * symtab.h: Likewise.
3057 * target-reloc.h: Likewise.
3058 * target.cc: Likewise.
3059 * target.h: Likewise.
3060 * timer.cc: Likewise.
3061 * timer.h: Likewise.
3062 * x86_64.cc: Likewise.
3063
3064 2010-12-09 Cary Coutant <ccoutant@google.com>
3065
3066 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3067 stack.
3068 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3069 parameter; change all callers.
3070 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3071 * options.h (warn_execstack): New option.
3072
3073 2010-12-07 Doug Kwan <dougkwan@google.com>
3074
3075 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3076 like function call relocations.
3077
3078 2010-12-07 Ian Lance Taylor <iant@google.com>
3079
3080 * archive.cc (Archive::get_elf_object_for_member): Permit
3081 punconfigured to be NULL.
3082 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3083 (Archive::include_member): Pass NULL to get_elf_object_for_member
3084 if we searched for the archive and this is the first included
3085 object.
3086
3087 2010-12-01 Ian Lance Taylor <iant@google.com>
3088
3089 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3090 track_relocs_type_ field.
3091 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3092 Set track_relocs_type_.
3093 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3094 contents when using RELA relocs.
3095 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3096 reloc_map_.
3097 * reloc.cc (Track_relocs::next_addend): New function.
3098 * reloc.h (class Track_relocs): Declare next_addend.
3099
3100 2010-12-01 Ian Lance Taylor <iant@google.com>
3101
3102 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3103 virtual destructor.
3104
3105 2010-12-01 Ian Lance Taylor <iant@google.com>
3106
3107 * README: Update compilers known to work and fail.
3108
3109 2010-11-23 Matthias Klose <doko@ubuntu.com>
3110
3111 * configure.in: For --enable-gold, handle value `default' instead of
3112 `both*'. Always install ld as ld.bfd, install as ld if gold is
3113 not the default.
3114 * configure: Regenerate.
3115
3116 2010-11-18 Doug Kwan <dougkwan@google.com>
3117
3118 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3119 and right_alignment to be zero. Store result alignment only if it is
3120 greater than existing alignment.
3121
3122 2010-11-16 Cary Coutant <ccoutant@google.com>
3123
3124 PR gold/12220
3125 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3126 Check for ".zdebug_line".
3127
3128 2010-11-16 Doug Kwan <dougkwan@google.com>
3129 Cary Coutant <ccoutant@google.com>
3130
3131 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3132 by reference; adjust all callers.
3133 * output.cc (Output_segment::set_section_addresses): Adjust references
3134 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3135 list is empty.
3136 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3137 end at page boundary.
3138
3139 2010-11-16 Cary Coutant <ccoutant@google.com>
3140
3141 PR gold/12220
3142 * layout.cc (Layout::choose_output_section): Transform names of
3143 compressed sections even when using a script with a SECTIONS clause.
3144 (Layout::output_section_name): Remove code to transform
3145 compressed debug section names.
3146 * output.cc (Output_section::add_input_section): Use uncompressed
3147 section size when tracking input sections.
3148
3149 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3150
3151 * symtab.h (Symbol::NON_PIC_REF): Remove.
3152 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3153 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3154 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3155 (Symbol::use_plt_offset): Take a flags argument and pass it
3156 directly to needs_dynamic_reloc. Restrict check for undefined
3157 weak symbols to function calls.
3158 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3159 (Target_arm::Scan::global): Use it.
3160 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3161 (Target_arm::Relocate::relocate): Likewise.
3162 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3163 parameter with an r_type parameter. Use get_reference_flags
3164 to get the flags.
3165 (Target_arm::Relocate::relocate): Update accordingly.
3166 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3167 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3168 (Target_i386::Scan::global): Likewise.
3169 (Target_i386::Relocate::relocate): Likewise.
3170 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3171 parameter with an r_type parameter. Use get_reference_flags
3172 to get the flags.
3173 (Target_i386::Relocate::relocate): Update accordingly.
3174 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3175 (Target_powerpc::Scan::global): Use it.
3176 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3177 (Target_powerpc::Relocate::relocate): Likewise.
3178 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3179 (Target_sparc::Scan::global): Use it.
3180 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3181 (Target_sparc::Relocate::relocate): Likewise.
3182 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3183 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3184 (Target_x86_64::Scan::global): Likewise.
3185 (Target_x86_64::Relocate::relocate): Likewise.
3186
3187 2010-11-08 Doug Kwan <dougkwan@google.com>
3188 Cary Coutant <ccoutant@google.com>
3189
3190 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3191 (Arm_exidx_merge_section::section_contents_): New data member.
3192 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3193 (Arm_input_section::~Arm_input_section): De-allocate memory.
3194 (Arm_input_section::original_contents_): New data member.
3195 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3196 in parameters instead of calling Object::section_contents without
3197 locking.
3198 (Arm_output_section::group_section): New parameter TASK. Pass it
3199 to callees that need locking objects.
3200 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3201 to lock EXIDX input sections. Fix a formatting issue. Call
3202 Arm_exidx_merged_section::build_contents to create merged section
3203 contents.
3204 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3205 to lock object of stub table owner.
3206 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3207 TEXT_SIZE to initialize data member TEXT_SIZE_.
3208 (Arm_exidx_input_section::addralign): Fix typo in comment.
3209 (Arm_exidx_input_section::text_size): New method.
3210 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3211 that require locking objects. Lock objects before scanning for stubs
3212 and updating local symbols.
3213 (Arm_input_section<big_endian>::init): Copy contents of original
3214 input section.
3215 (Arm_input_section<big_endian>::do_write): Use saved contents of
3216 original input section instead of calling Object::section_contents
3217 without locking.
3218 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3219 size without calling Object::section_size().
3220 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3221 for size. Allocate a buffer for merged EXIDX entries.
3222 (Arm_exidx_merged_section::build_contents): New method.
3223 (Arm_exidx_merged_section::do_write): Move merge section contents
3224 building code to Arm_exidx_merged_section::build_contetns. Write
3225 out contetns in buffer instead of building it on the fly.
3226 (Arm_relobj::make_exidx_input_section): Also pass text section size
3227 to Arm_exidx_input_section constructor.
3228 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3229 (Arm_dynobj::do_read_symbols): Fix memory leak.
3230 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3231 * target.h: (class Task): Add forward declaration.
3232 (Target::relax): Add new parameter TASK and pass it to
3233 Target::do_relax().
3234 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3235
3236 2010-11-05 Cary Coutant <ccoutant@google.com>
3237
3238 PR gold/10708
3239 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3240 object when reading from the file.
3241 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3242 second layout pass.
3243 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3244 when reading section contents.
3245 (get_section_contents): Likewise.
3246 (icf::find_identical_sections): Likewise.
3247 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3248 object when reading from the file.
3249 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3250 the object when doing deferred section layout.
3251
3252 2010-11-03 Nick Clifton <nickc@redhat.com>
3253
3254 PR gold/12001
3255 * script.h (class Symbol_assignment: name): New member. Returns
3256 the name of the symbol.
3257 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3258 Returns true if the given symbol name is on the list of
3259 assignments wating to be processed.
3260 * archive.cc (should_incldue_member): If the symbol is undefined,
3261 check to see if it is on the list of symbols pending assignment.
3262
3263 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3264
3265 * script-sections.cc (Script_sections::find_memory_region): Check
3266 for a NULL output section pointer.
3267
3268 2010-10-29 Doug Kwan <dougkwan@google.com>
3269
3270 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3271 Output_section::add_relaxed_input_section.
3272 * output.cc (Output_section::add_relaxed_input_section): Add new
3273 arguments LAYOUT and NAME. Set section order index.
3274 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3275 Copy section order index.
3276 * output.h (Output_section::add_relaxed_input_section): Add new
3277 arguments LAYOUT and NAME.
3278
3279 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3280
3281 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3282 NATIVE_OR_CROSS_LINKER.
3283 * testsuite/Makefile.in: Regenerate.
3284
3285 2010-10-20 Doug Kwan <dougkwan@google.com>
3286
3287 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3288 without SHF_LINK_ORDER flags.
3289 * layout.cc (Layout::choose_output_section): Do not filter
3290 SHF_LINK_ORDER flag in a relocatable link.
3291
3292 2010-10-17 Cary Coutant <ccoutant@google.com>
3293
3294 * output.h (Output_segment::set_section_addresses): Change function
3295 signature. Update all callers.
3296 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3297 sections.
3298 (Output_segment::set_section_addresses): Align after last TLS
3299 section. Add padding before last relro section instead of after.
3300
3301 2010-10-17 Doug Kwan <dougkwan@google.com>
3302
3303 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3304 GOT output section to be writable.
3305
3306 2010-10-14 Cary Coutant <ccoutant@google.com>
3307
3308 * debug.h (DEBUG_INCREMENTAL): New flag.
3309 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3310 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3311 mode.
3312 * incremental.cc (report_command_line): Ignore all forms of
3313 --incremental.
3314 * layout.cc (Layout::Layout): Check parameters for incremental link
3315 mode.
3316 * options.cc (General_options::parse_incremental): New function.
3317 (General_options::parse_no_incremental): New function.
3318 (General_options::parse_incremental_full): New function.
3319 (General_options::parse_incremental_update): New function.
3320 (General_options::incremental_mode_): New data member.
3321 (General_options::finalize): Check incremental_mode_.
3322 * options.h (General_options): Update help text for --incremental.
3323 Add --no-incremental, --incremental-full, --incremental-update.
3324 (General_options::Incremental_mode): New enum type.
3325 (General_options::incremental_mode): New function.
3326 (General_options::incremental_mode_): New data member.
3327 * parameters.cc (Parameters::incremental_mode_): New data member.
3328 (Parameters::set_options): Set incremental_mode_.
3329 (Parameters::set_incremental_full): New function.
3330 (Parameters::incremental): New function.
3331 (Parameters::incremental_update): New function.
3332 (set_parameters_incremental_full): New function.
3333 * parameters.h (Parameters::set_incremental_full): New function.
3334 (Parameters::incremental): New function.
3335 (Parameters::incremental_update): New function.
3336 (Parameters::incremental_mode_): New data member.
3337 (set_parameters_incremental_full): New function.
3338 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3339 incremental link mode.
3340 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3341 (Sized_relobj::do_relocate_sections): Likewise.
3342 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3343 option.
3344 * testsuite/Makefile.in: Regenerate.
3345 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3346
3347 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3348
3349 * script-sections.h (class Script_sections): Make
3350 Sections_elements typedef public.
3351 * script-sections.cc (class Sort_output_sections): Add elements_
3352 field. Add constructor which sets it; change all callers.
3353 (Sort_output_sections::is_before): New function.
3354 (Sort_output_sections::operator()): Call is_before.
3355 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3356 conditional.
3357 * testsuite/script_test_10.sh: New test. Test script section
3358 order.
3359 * testsuite/script_test_10.t: Likewise.
3360 * testsuite/script_test_10.s: Likewise.
3361 * testsuite/Makefile.am: Wrap the cross linker tests and the
3362 common tests into NATIVE_OR_CROSS_LINKER.
3363 (check_SCRIPTS): Add script_test_10.sh.
3364 (check_DATA): Add script_test_10.stdout.
3365 (script_test_10.o, script_test_10): New targets.
3366 (script_test_10.stdout): New target.
3367 * configure, testsuite/Makefile.in: Regenerate.
3368
3369 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3370
3371 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3372 error for the deprecated relocations.
3373 (Target_arm::Scan::global): Likewise.
3374 (Target_arm::Relocate::relocate): Likewise.
3375
3376 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3377
3378 * fileread.cc (Input_file::find_file): Initialize *found_name
3379 and *namep when using the fallback search for case 4.
3380
3381 2010-10-11 Cary Coutant <ccoutant@google.com>
3382
3383 * options.h (class General_options): Redefine -z lazy as an alias for
3384 the negation of -z now.
3385
3386 2010-10-11 Ian Lance Taylor <iant@google.com>
3387
3388 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3389 binding.
3390
3391 2010-10-06 Nick Clifton <nickc@redhat.com>
3392
3393 * script-sections.cc(class Memory_region): Remove
3394 current_lma_offset_ field. Rename current_vma_offset_ to
3395 current_offset_. Add last_section_ field.
3396 (Memory_region::get_current_vma_address): Rename to
3397 get_current_address.
3398 (Memory_region::get_current_lma_address): Delete.
3399 (Memory_region::increment_vma_offset): Rename to
3400 increment_offset.
3401 (Memory_region::increment_lma_offset): Delete.
3402 (Memory_region::attributes_compatible): New method. Returns
3403 true if the provided section is compatible with the region.
3404 (Memory_region::get_last_section): New method. Returns the last
3405 section to use the region.
3406 (Memory_region::set_last_section): New method. Stores the last
3407 section to use the region.
3408 (Script_sections::block_in_region): New method. Returns true if
3409 a block of memory is contained within a region.
3410 (Script_sections::find_memory_region): New method. Locates a
3411 memory region to be used to set a VMA or LMA address.
3412 (Output_section_definition::set_section_addresses): Add code to
3413 check for addresses set by memory regions.
3414 (Output_segment::set_section_addresses): Remove memory region
3415 walking code.
3416 (Script_sections::create_segment): Add a warning if a header
3417 segment is created outside of any region.
3418 * script-sections.h (class Script_sections): Add prototypes for
3419 find_memory_region and block_in_region methods.
3420 * testsuite/memory_test.s: Use .long instead of .word.
3421 * testsuite/memory_test.t: Add some more output sections.
3422 * testsuite/memory_test.sh: Update expected output.
3423
3424 2010-10-02 Doug Kwan <dougkwan@google.com>
3425
3426 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3427 defintion to symtab.h
3428 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3429 declaration to defintion.
3430
3431 2010-10-01 Nick Clifton <nickc@redhat.com>
3432
3433 * expression.cc (eval): Replace dummy argument with NULL.
3434 (eval_maybe_dot): Check for a NULL result section pointer.
3435 (Symbol_expression::value): Likewise.
3436 (Dot_expression::value): Likewise.
3437 (BINARY_EXPRESSION): Likewise.
3438 (Max_expression::value): Likewise.
3439 (Min_expression::value): Likewise.
3440 (Absolute_expression::value): Likewise.
3441 (Addr_expression::value_from_output_section): Likewise.
3442 (Loaddddr_expression::value_from_output_section): Likewise.
3443 (Segment_start_expression::value): Likewise.
3444 * script-sections.cc
3445 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3446 argument with NULL.
3447 (Sections_elememt_dot_assignment::set_section_addresses):
3448 Likewise.
3449 (Output_data_expression::do_write_to_buffer): Likewise.
3450 (Output_section_definition::finalize_symbols): Likewise.
3451 (Output_section_definition::set_section_addresses): Likewise.
3452
3453 2010-09-30 Doug Kwan <dougkwan@google.com>
3454
3455 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3456
3457 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3458
3459 * target.h (Target::can_icf_inline_merge_sections): New virtual
3460 function.
3461 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3462 virtual function.
3463 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3464 virtual function.
3465 * icf.cc (get_section_contents): Inline merge sections only when
3466 target allows it.
3467
3468 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3469
3470 * configure: Regenerate.
3471
3472 2010-09-17 Ian Lance Taylor <iant@google.com>
3473
3474 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3475 * testsuite/Makefile.am (memory_test.o): New target.
3476 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3477 memory_test.t.
3478 * testsuite/Makefile.in: Rebuild.
3479
3480 2010-09-17 Doug Kwan <dougkwan@google.com>
3481
3482 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3483 defintion if relocation uses GOT entries of the symbol.
3484 * testsuite/icf_safe_test.sh: Fix test.
3485 * testsuite/icf_safe_so_test.sh: Fix test.
3486
3487 2010-09-16 Cary Coutant <ccoutant@google.com>
3488
3489 * script_sections.cc (class Memory_region): Remove "NULL" from
3490 vector initializations.
3491
3492 2010-09-15 Cary Coutant <ccoutant@google.com>
3493
3494 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3495 Resolve forwarding symbols.
3496
3497 2010-09-15 Doug Kwan <dougkwan@google.com>
3498
3499 * gold/testsuite/script_test_3.t: Add ARM special sections.
3500 * gold/testsuite/script_test_4.t: Same.
3501 * gold/testsuite/script_test_5.t: Same.
3502 * gold/testsuite/script_test_6.t: Same.
3503 * gold/testsuite/script_test_7.t: Same.
3504 * gold/testsuite/script_test_7.t: Same.
3505 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3506
3507 2010-09-14 Cary Coutant <ccoutant@google.com>
3508
3509 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3510 (Target_x86_64::Relocate::relocate_tls): Replace check for
3511 saw_tls_block_reloc_ with test for executable section.
3512
3513 2010-09-12 Cary Coutant <ccoutant@google.com>
3514
3515 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3516 position-independent executables to shared libraries need dynamic
3517 relocations.
3518 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3519 position-independent executables.
3520 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3521 * testsuite/Makefile.in: Regenerate.
3522
3523 2010-09-10 Nick Clifton <nickc@redhat.com>
3524
3525 PR gold/11997
3526 * testsuite/memory_test.t: Discard any sections that are not
3527 needed.
3528
3529 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3530
3531 PR gold/11996
3532 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3533 "This::" to work around a bug in gcc 4.2.
3534
3535 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3536
3537 2010-09-09 Rafael Espindola <espindola@google.com>
3538
3539 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3540 sections with different PF_X flags in the same segment.
3541 (Layout::find_first_load_seg): Search all segments to find the first
3542 one.
3543 * options.h (rosegment): New.
3544
3545 2010-09-08 Rafael Espindola <espindola@google.com>
3546
3547 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3548
3549 2010-09-08 Doug Kwan <dougkwan@google.com>
3550
3551 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3552 (Arm_relobj::do_relocate_sections): Add new parameter for output
3553 file to match the parent.
3554 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3555 of local symbols instead of input values. Update code to track
3556 changes in gold::relocate_section.
3557 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3558 (Sized_relobj::compute_final_local_value_internal): New methods.
3559 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3560 body into private version of Sized_relobj::compute_final_local_value.
3561 Call the inline method.
3562 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3563 merged symbol value if there is one.
3564 (Symbol_value::has_output_value): New method defintiion.
3565 (Sized_relobj::Compute_final_local_value_status): New enum type.
3566 (Sized_relobj::compute_final_local_value): New methods.
3567 (Sized_relobj::compute_final_local_value_internal): New methods.
3568 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3569 and arm_cortex_a8.sh.
3570 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3571 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3572 New tests.
3573 * Makefile.in: Regenerate.
3574 * testsuite/arm_bl_out_of_range.s: Update test.
3575 * testsuite/thumb_bl_out_of_range.s: Ditto.
3576 * testsuite/thumb_blx_out_of_range.s: Ditto.
3577 * testsuite/arm_branch_out_of_range.sh: New file.
3578 * testsuite/arm_cortex_a8.sh: Ditto.
3579 * testsuite/arm_cortex_a8_b.s: Ditto.
3580 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3581 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3582 * testsuite/arm_cortex_a8_bl.s: Ditto.
3583 * testsuite/arm_cortex_a8_blx.s: Ditto.
3584 * testsuite/arm_cortex_a8_local.s: Ditto.
3585 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3586 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3587
3588 2010-09-08 Rafael Espindola <espindola@google.com>
3589
3590 * Makefile.am (memory_test.stdout): Run readelf with -W.
3591 * Makefile.in: Regenerate.
3592 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3593 64 bit output.
3594
3595 2010-09-08 Rafael Espindola <espindola@google.com>
3596
3597 * script-sections.cc (Script_sections::add_memory_region): Convert
3598 field precision to int.
3599 * script.cc (script_set_section_region, script_set_section_region):
3600 Convert field precision to int.
3601
3602 2010-09-08 Rafael Espindola <espindola@google.com>
3603
3604 * arm.cc (do_finalize_sections): Create the __exidx_start and
3605 __exdix_end symbols even when the section is missing.
3606
3607 2010-09-08 Nick Clifton <nickc@redhat.com>
3608
3609 * README: Remove claim that MEMORY is not supported.
3610 * expression.cc (script_exp_function_origin)
3611 (script_exp_function_length): Move from here to ...
3612 * script.cc: ... here.
3613 (script_set_section_region, script_add_memory)
3614 (script_parse_memory_attr, script_include_directive): New
3615 functions.
3616 * script-sections.cc
3617 (class Memory_region): New class.
3618 (class Output_section_definition): Add set_memory_region,
3619 set_section_vma, set_section_lma and get_section_name methods.
3620 (class Script_Sections): Add add_memory_region,
3621 find_memory_region, find_memory_region_origin,
3622 find_memory_region_length and set_memory_region methods.
3623 Have set_section_addresses method walk the list of set memory
3624 regions.
3625 Extend the print methos to display memory regions.
3626 * script-sections.h: Add prototypes for new methods.
3627 Add enum for MEMORY region attributes.
3628 * yyscript.y: Add support for parsing MEMORY regions.
3629 * script-c.h: Add prototypes for new functions.
3630 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3631 * testsuite/Makefile.in: Regenerate.
3632 * testsuite/memory_test.sh: New script.
3633 * testsuite/memory_test.s: New assembler source file.
3634 * testsuite/memory_test.t: New linker script.
3635
3636 2010-08-27 Doug Kwan <dougkwan@google.com>
3637
3638 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3639 reference override an existing dynamic weak reference.
3640 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3641 * testsuite/Makefile.in: Regenerate.
3642 * testsuite/dyn_weak_ref.sh: New file.
3643 * testsuite/dyn_weak_ref_1.c: Ditto.
3644 * testsuite/dyn_weak_ref_2.c: Ditto.
3645
3646 2010-08-27 Ian Lance Taylor <iant@google.com>
3647
3648 * incremental.h (class Incremental_input_entry): Add virtual
3649 destructor.
3650
3651 2010-08-27 Ian Lance Taylor <iant@google.com>
3652
3653 * testsuite/start_lib_test_3.c: Mark t3 as used.
3654
3655 2010-08-27 Nick Clifton <nickc@redhat.com>
3656
3657 * options.cc (version_script): Fix small typo in previous
3658 whitespace tidyup.
3659
3660 2010-08-25 Nick Clifton <nickc@redhat.com>
3661
3662 * archive.cc: Formatting fixes: Remove whitespace between
3663 typename and following asterisk. Remove whitespace between
3664 function name and opening parenthesis.
3665 * archive.h: Likewise.
3666 * arm.cc: Likewise.
3667 * attributes.cc: Likewise.
3668 * attributes.h: Likewise.
3669 * common.cc: Likewise.
3670 * copy-relocs.cc: Likewise.
3671 * dirsearch.h: Likewise.
3672 * dynobj.cc: Likewise.
3673 * ehframe.cc: Likewise.
3674 * ehframe.h: Likewise.
3675 * expression.cc: Likewise.
3676 * fileread.cc: Likewise.
3677 * fileread.h: Likewise.
3678 * gc.h: Likewise.
3679 * gold-threads.cc: Likewise.
3680 * gold.cc: Likewise.
3681 * i386.cc: Likewise.
3682 * icf.h: Likewise.
3683 * incremental-dump.cc: Likewise.
3684 * incremental.cc: Likewise.
3685 * layout.cc: Likewise.
3686 * layout.h: Likewise.
3687 * main.cc: Likewise.
3688 * merge.cc: Likewise.
3689 * merge.h: Likewise.
3690 * object.cc: Likewise.
3691 * object.h: Likewise.
3692 * options.cc: Likewise.
3693 * options.h: Likewise.
3694 * output.cc: Likewise.
3695 * output.h: Likewise.
3696 * plugin.cc: Likewise.
3697 * plugin.h: Likewise.
3698 * powerpc.cc: Likewise.
3699 * reloc.cc: Likewise.
3700 * script-c.h: Likewise.
3701 * script-sections.cc: Likewise.
3702 * script.cc: Likewise.
3703 * stringpool.cc: Likewise.
3704 * symtab.cc: Likewise.
3705 * symtab.h: Likewise.
3706 * target.cc: Likewise.
3707 * timer.cc: Likewise.
3708 * timer.h: Likewise.
3709 * version.cc: Likewise.
3710 * x86_64.cc: Likewise.
3711
3712 2010-08-24 Nick Clifton <nickc@redhat.com>
3713
3714 PR 11899
3715 * layout.cc (segment_precedes): Sort segments by their physical
3716 addresses, if they have been set.
3717
3718 2010-08-23 Cary Coutant <ccoutant@google.com>
3719
3720 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3721 symbols data.
3722 (Lib_group::include_member): Unlock object after deleting its
3723 symbols data.
3724 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3725 the bug fixed here.
3726
3727 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3728 Cary Coutant <ccoutant@google.com>
3729
3730 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3731 constructor, and set_blocker.
3732 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3733 readsyms_blocker_.
3734 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3735 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3736 * testsuite/Makefile.am (start_lib_test): New test case.
3737 * testsuite/Makefile.in: Regenerate.
3738 * testsuite/start_lib_test_main.c: New file.
3739 * testsuite/start_lib_test_1.c: New file.
3740 * testsuite/start_lib_test_2.c: New file.
3741 * testsuite/start_lib_test_3.c: New file.
3742
3743 2010-08-19 Ian Lance Taylor <iant@google.com>
3744
3745 * Makefile.in: Rebuild with automake 1.11.1.
3746 * aclocal.m4: Likewise.
3747 * testsuite/Makefile.in: Likewise.
3748
3749 2010-08-19 Ian Lance Taylor <iant@google.com>
3750
3751 PR 10893
3752 * i386.cc (class Output_data_plt_i386): Update declarations.
3753 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3754 local_ifuncs_ fields.
3755 (Target_i386::do_plt_section_for_global): New function.
3756 (Target_i386::do_plt_section_for_local): New function.
3757 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3758 parameter; change all callers. Initialize global_ifuncs_ and
3759 local_ifuncs_. If doing a static link define __rel_iplt_start and
3760 __rel_iplt_end.
3761 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3762 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3763 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3764 symbols.
3765 (Target_i386::make_plt_section): New function, broken out of
3766 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3767 (Target_i386::make_plt_entry): Call make_plt_section.
3768 (Target_i386::make_local_ifunc_plt_entry): New function.
3769 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3770 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3771 R_386_IRELATIVE to switch.
3772 (Target_i386::Scan::global): Likewise.
3773 (Target_i386::Relocate::relocate): Likewise.
3774 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3775 switch.
3776 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3777 (Target_x86_64::do_plt_section_for_global): New function.
3778 (Target_x86_64::do_plt_section_for_local): New function.
3779 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3780 parameter; change all callers. If doing a static link define
3781 __rela_iplt_start and __rela_iplt_end.
3782 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3783 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3784 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3785 to point to .plt.
3786 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3787 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3788 switch.
3789 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3790 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3791 R_X86_64_IRELATIVE to switch.
3792 (Target_x86_64::Scan::global): Likewise.
3793 (Target_x86_64::Relocate::relocate): Likewise.
3794 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3795 switch.
3796 * target.h (class Target): Add plt_section_for_global and
3797 plt_section_for_local functions. Add do_plt_section_for_global
3798 and do_plt_section_for_local virtual functions.
3799 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3800 clarifying comments.
3801 (Symbol::use_plt_offset): Handle IFUNC symbol.
3802 * object.cc (Sized_relobj::Sized_relobj): Initialize
3803 local_plt_offsets_.
3804 (Sized_relobj::local_has_plt_offset): New function.
3805 (Sized_relobj::local_plt_offset): New function.
3806 (Sized_relobj::set_local_plt_offset): New function.
3807 (Sized_relobj::do_count): Handle IFUNC symbol.
3808 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3809 a bit away from input_shndx_ field. Add set_is_func_symbol and
3810 is_ifunc_symbol functions.
3811 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3812 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3813 local_plt_offsets_ field.
3814 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3815 * output.h (class Output_section_data): Add non-const
3816 output_section function.
3817 (class Output_data_got): Update declarations.
3818 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3819 Add use_plt_offset parameter to global and local constructors.
3820 Change all callers. Change local_sym_index_ field to 31 bits.
3821 Change GSYM_CODE and CONSTANT_CODE accordingly.
3822 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3823 doing a static link don't set sh_link field.
3824 (Output_data_got::Got_entry::write): Use PLT offset if
3825 appropriate.
3826 (Output_data_got::add_global_plt): New function.
3827 (Output_data_got::add_local_plt): New function.
3828 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3829 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3830 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3831 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3832 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3833 IFUNC conditional.
3834 * testsuite/ifunc-sel.h: New file.
3835 * testsuite/ifuncmain1.c: New file.
3836 * testsuite/ifuncmain1vis.c: New file.
3837 * testsuite/ifuncmod1.c: New file.
3838 * testsuite/ifuncdep2.c: New file.
3839 * testsuite/ifuncmain2.c: New file.
3840 * testsuite/ifuncmain3.c: New file.
3841 * testsuite/ifuncmod3.c: New file.
3842 * testsuite/ifuncmain4.c: New file.
3843 * testsuite/ifuncmain5.c: New file.
3844 * testsuite/ifuncmod5.c: New file.
3845 * testsuite/ifuncmain6pie.c: New file.
3846 * testsuite/ifuncmod6.c: New file.
3847 * testsuite/ifuncmain7.c: New file.
3848 * configure, testsuite/Makefile.in: Rebuild.
3849
3850 2010-08-18 Ian Lance Taylor <iant@google.com>
3851
3852 * incremental.cc
3853 (Output_section_incremental_inputs::write_input_files): Add cast
3854 to avoid signed/unsigned comparison warning.
3855 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3856
3857 2010-08-12 Cary Coutant <ccoutant@google.com>
3858
3859 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3860
3861 2010-08-13 Ian Lance Taylor <iant@google.com>
3862
3863 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3864
3865 2010-08-12 Cary Coutant <ccoutant@google.com>
3866 Doug Kwan <dougkwan@google.com>
3867
3868 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3869 defintion overrides non-weak undef, remember that the original undef
3870 is not weak.
3871 * symtab.cc (Symbol_table::sized_write_global): For undef without
3872 an original weak binding, set binding to global in output.
3873 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3874 * testsuite/Makefile.in: Regenerate.
3875 * testsuite/strong_ref_weak_def.sh: New file.
3876 * testsuite/strong_ref_weak_def_1.c: Ditto.
3877 * testsuite/strong_ref_weak_def_2.c: Ditto.
3878
3879 2010-08-12 Cary Coutant <ccoutant@google.com>
3880
3881 * testsuite/incremental_test.sh: Rewrite.
3882 * testsuite/incremental_test_1.c: Rewrite.
3883 * testsuite/incremental_test_2.c: Rewrite.
3884
3885 2010-08-12 Cary Coutant <ccoutant@google.com>
3886
3887 * arm.cc (Target_arm::got_size): Add const.
3888 (Target_arm::got_entry_count): New function.
3889 (Target_arm::plt_entry_count): New function.
3890 (Target_arm::first_plt_entry_offset): New function.
3891 (Target_arm::plt_entry_size): New function.
3892 (Output_data_plt_arm::entry_count): New function.
3893 (Output_data_plt_arm::first_plt_entry_offset): New function.
3894 (Output_data_plt_arm::get_plt_entry_size): New function.
3895 * i386.cc (Target_i386::got_size): Add const.
3896 (Target_i386::got_entry_count): New function.
3897 (Target_i386::plt_entry_count): New function.
3898 (Target_i386::first_plt_entry_offset): New function.
3899 (Target_i386::plt_entry_size): New function.
3900 (Output_data_plt_i386::entry_count): New function.
3901 (Output_data_plt_i386::first_plt_entry_offset): New function.
3902 (Output_data_plt_i386::get_plt_entry_size): New function.
3903 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3904 find_incremental_inputs_sections. Dump incremental_got_plt section.
3905 * incremental.cc: Include target.h.
3906 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3907 parameter. Adjust all callers. Find incremental_got_plt section.
3908 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3909 section.
3910 (Output_section_incremental_inputs::set_final_data_size): Calculate
3911 size of incremental_got_plt section.
3912 (Output_section_incremental_inputs::do_write): Write the
3913 incremental_got_plt section.
3914 (Got_plt_view_info): New struct.
3915 (Local_got_offset_visitor): New class.
3916 (Global_got_offset_visitor): New class.
3917 (Global_symbol_visitor_got_plt): New class.
3918 (Output_section_incremental_inputs::write_got_plt): New function.
3919 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3920 Add parameter. Adjust all callers.
3921 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3922 (Incremental_inputs::got_plt_section): New function.
3923 (Incremental_inputs::got_plt_section_): New data member.
3924 (Incremental_got_plt_reader): New class.
3925 * layout.cc (Layout::create_incremental_info_sections): Add the
3926 incremental_got_plt section.
3927 * object.h (Got_offset_list::get_list): New function.
3928 (Got offset_list::for_all_got_offsets): New function.
3929 (Sized_relobj::local_got_offset_list): New function.
3930 * powerpc.cc (Target_powerpc::got_size): Add const.
3931 (Target_powerpc::got_entry_count): New function.
3932 (Target_powerpc::plt_entry_count): New function.
3933 (Target_powerpc::first_plt_entry_offset): New function.
3934 (Target_powerpc::plt_entry_size): New function.
3935 (Output_data_plt_powerpc::entry_count): New function.
3936 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3937 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3938 * sparc.cc (Target_sparc::got_size): Add const.
3939 (Target_sparc::got_entry_count): New function.
3940 (Target_sparc::plt_entry_count): New function.
3941 (Target_sparc::first_plt_entry_offset): New function.
3942 (Target_sparc::plt_entry_size): New function.
3943 (Output_data_plt_sparc::entry_count): New function.
3944 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3945 (Output_data_plt_sparc::get_plt_entry_size): New function.
3946 * symtab.h (Symbol::got_offset_list): New function.
3947 (Symbol_table::for_all_symbols): New function.
3948 * target.h (Sized_target::got_entry_count): New function.
3949 (Sized_target::plt_entry_count): New function.
3950 (Sized_target::plt_entry_size): New function.
3951 * x86_64.cc (Target_x86_64::got_size): Add const.
3952 (Target_x86_64::got_entry_count): New function.
3953 (Target_x86_64::plt_entry_count): New function.
3954 (Target_x86_64::first_plt_entry_offset): New function.
3955 (Target_x86_64::plt_entry_size): New function.
3956 (Output_data_plt_x86_64::entry_count): New function.
3957 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3958 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3959
3960 2010-08-12 Cary Coutant <ccoutant@google.com>
3961
3962 * archive.cc: Include incremental.h.
3963 (Archive::Archive): Initialize incremental_info_.
3964 (Archive::include_member): Record archive members in incremental info.
3965 (Add_archive_symbols::run): Record begin and end of an archive in
3966 incremental info.
3967 (Lib_group::include_member): Record objects in incremental info.
3968 * archive.h (Incremental_archive_entry): Forward declaration.
3969 (Archive::set_incremental_info): New member function.
3970 (Archive::incremental_info): New member function.
3971 (Archive::Unused_symbol_iterator): New class.
3972 (Archive::unused_symbols_begin): New member function.
3973 (Archive::unused_symbols_end): New member function.
3974 (Archive::incremental_info_): New data member.
3975 * incremental-dump.cc (find_input_containing_global): New function.
3976 (dump_incremental_inputs): Dump new incremental info sections.
3977 * incremental.cc: Include symtab.h.
3978 (Output_section_incremental_inputs): New class.
3979 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3980 new incremental info sections.
3981 (Sized_incremental_binary::do_check_inputs): Likewise.
3982 (Incremental_inputs::report_archive): Remove.
3983 (Incremental_inputs::report_archive_begin): New function.
3984 (Incremental_inputs::report_archive_end): New function.
3985 (Incremental_inputs::report_object): New function.
3986 (Incremental_inputs::finalize_inputs): Remove.
3987 (Incremental_inputs::report_input_section): New function.
3988 (Incremental_inputs::report_script): Rewrite.
3989 (Incremental_inputs::finalize): Do nothing but finalize string table.
3990 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3991 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3992 (Incremental_inputs::create_data_sections): New function.
3993 (Incremental_inputs::relocs_entsize): New function.
3994 (Output_section_incremental_inputs::set_final_data_size): New function.
3995 (Output_section_incremental_inputs::do_write): New function.
3996 (Output_section_incremental_inputs::write_header): New function.
3997 (Output_section_incremental_inputs::write_input_files): New function.
3998 (Output_section_incremental_inputs::write_info_blocks): New function.
3999 (Output_section_incremental_inputs::write_symtab): New function.
4000 * incremental.h (Incremental_script_entry): Forward declaration.
4001 (Incremental_object_entry): Forward declaration.
4002 (Incremental_archive_entry): Forward declaration.
4003 (Incremental_inputs): Forward declaration.
4004 (Incremental_inputs_header_data): Remove.
4005 (Incremental_inputs_header): Remove.
4006 (Incremental_inputs_header_write): Remove.
4007 (Incremental_inputs_entry_data): Remove.
4008 (Incremental_inputs_entry): Remove.
4009 (Incremental_inputs_entry_write): Remove.
4010 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4011 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4012 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4013 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4014 Likewise.
4015 (Incremental_input_entry): New class.
4016 (Incremental_script_entry): New class.
4017 (Incremental_object_entry): New class.
4018 (Incremental_archive_entry): New class.
4019 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4020 (Incremental_inputs::report_inputs): Remove.
4021 (Incremental_inputs::report_archive): Remove.
4022 (Incremental_inputs::report_archive_begin): New function.
4023 (Incremental_inputs::report_archive_end): New function.
4024 (Incremental_inputs::report_object): Change prototype.
4025 (Incremental_inputs::report_input_section): New function.
4026 (Incremental_inputs::report_script): Change prototype.
4027 (Incremental_inputs::get_reloc_count): New function.
4028 (Incremental_inputs::set_reloc_count): New function.
4029 (Incremental_inputs::create_data_sections): New function.
4030 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4031 (Incremental_inputs::inputs_section): New function.
4032 (Incremental_inputs::symtab_section): New function.
4033 (Incremental_inputs::relocs_section): New function.
4034 (Incremental_inputs::get_stringpool): Add const.
4035 (Incremental_inputs::command_line): Add const.
4036 (Incremental_inputs::inputs): Remove.
4037 (Incremental_inputs::command_line_key): New function.
4038 (Incremental_inputs::input_file_count): New function.
4039 (Incremental_inputs::input_files): New function.
4040 (Incremental_inputs::relocs_entsize): New function.
4041 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4042 (Incremental_inputs::finalize_inputs): Remove.
4043 (Incremental_inputs::Input_info): Remove.
4044 (Incremental_inputs::lock_): Remove.
4045 (Incremental_inputs::inputs_): Change type.
4046 (Incremental_inputs::inputs_map_): Remove.
4047 (Incremental_inputs::current_object_entry_): New data member.
4048 (Incremental_inputs::inputs_section_): New data member.
4049 (Incremental_inputs::symtab_section_): New data member.
4050 (Incremental_inputs::relocs_section_): New data member.
4051 (Incremental_inputs::reloc_count_): New data member.
4052 (Incremental_inputs_reader): New class.
4053 (Incremental_symtab_reader): New class.
4054 (Incremental_relocs_reader): New class.
4055 * layout.cc (Layout::finalize): Move finalization of incremental info
4056 and creation of incremental info sections to follow finalization of
4057 symbol table. Set offsets for postprocessing sections.
4058 (Layout::create_incremental_info_sections): Call
4059 Incremental_inputs::create_data_sections. Add incremental symtab
4060 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4061 sections to layout after input sections.
4062 * layout.h (struct Timespec): Forward declaration.
4063 (Layout::incremental_inputs): Add const.
4064 (Layout::create_incremental_info_sections): Add parameter.
4065 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4066 * object.cc: Include incremental.h.
4067 (Relobj::finalize_incremental_relocs): New function.
4068 (Sized_relobj::do_layout): Record input sections in incremental info.
4069 * object.h (Object::output_section): New function.
4070 (Object::output_section_offset): Moved from Relobj.
4071 (Object::get_incremental_reloc_base): New function.
4072 (Object::get_incremental_reloc_count): New function.
4073 (Object::do_output_section): New function.
4074 (Object::do_output_section_offset): Moved from Relobj.
4075 (Object::do_get_incremental_reloc_base): New function.
4076 (Object::do_get_incremental_reloc_count): New function.
4077 (Object::Object): Initialize new data members.
4078 (Relobj::output_section): Renamed do_output_section and moved to
4079 protected.
4080 (Relobj::output_section_offset): Moved to Object.
4081 (Relobj::do_get_incremental_reloc_base): New function.
4082 (Relobj::do_get_incremental_reloc_count): New function.
4083 (Relobj::allocate_incremental_reloc_counts): New function.
4084 (Relobj::count_incremental_reloc): New function.
4085 (Relobj::finalize_incremental_relocs): New function.
4086 (Relobj::next_incremental_reloc_index): New function.
4087 (Relobj::reloc_counts_): New data member.
4088 (Relobj::reloc_bases_): New data member.
4089 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4090 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4091 (Sized_relobj::incremental_relocs_scan): New function.
4092 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4093 (Sized_relobj::incremental_relocs_write): New function.
4094 (Sized_relobj::incremental_relocs_write_reltype): New function.
4095 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4096 incremental link.
4097 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4098 archives and object files elsewhere.
4099 (Add_symbols::run): Report object files here.
4100 (Finish_group::run): Report end of archive at end of group.
4101 * reloc.cc: Include layout.h, incremental.h.
4102 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4103 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4104 (Sized_relobj::incremental_relocs_scan): New function.
4105 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4106 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4107 (Sized_relobj::incremental_relocs_write): New function.
4108 (Sized_relobj::incremental_relocs_write_reltype): New function.
4109 * script.cc (read_input_script): Rewrite test for incremental link.
4110 Change call to Incremental_inputs::report_script.
4111 * symtab.h (Symbol_table::first_global_index): New function.
4112 (Symbol_table::output_count): New function.
4113
4114 2010-08-12 Doug Kwan <dougkwan@google.com>
4115
4116 * arm.cc (Target_arm::merge_object_attributes): Check command line
4117 options --no-wchar-size-warning and --no-enum-size-warning.
4118 * options.h (General_options): Add ld-compatible options
4119 --no-enum-size-warning and --no-wchar-size-warning.
4120
4121 2010-08-04 Ian Lance Taylor <iant@google.com>
4122
4123 * x86_64.cc (Target_x86_64::Scan::local): Use
4124 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4125 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4126 (Target_x86_64::Scan::global): Likewise.
4127 (Target_x86_64::Relocate::relocate): Likewise.
4128 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4129 Likewise.
4130
4131 2010-08-03 Cary Coutant <ccoutant@google.com>
4132
4133 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4134 to reserve space in merged_strings vector. Keep total input size
4135 for stats.
4136 (Output_merge_string::do_print_merge_stats): Print total input size.
4137 * merge.h (Output_merge_string): Add input_size_ field.
4138 * stringpool.cc (Stringpool_template::string_length): Move
4139 implementations out of Stringpool_template class and place in
4140 stringpool.h.
4141 * stringpool.h (string_length): Move out of Stringpool_template.
4142
4143 2010-08-03 Ian Lance Taylor <iant@google.com>
4144
4145 PR 11712
4146 * layout.cc (relaxation_loop_body): If address of load segment is
4147 set, adjust address to include headers if possible.
4148
4149 2010-08-03 Ian Lance Taylor <iant@google.com>
4150
4151 * version.cc (version_string): Bump to 1.10.
4152
4153 2010-08-03 Ian Lance Taylor <iant@google.com>
4154
4155 PR 11805
4156 * layout.h (enum Output_section_order): Define.
4157 (class Layout): Update declarations.
4158 * layout.cc (Layout::get_output_section): Add order parameter.
4159 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4160 is_first_non_relro parameters. Change all callers.
4161 (Layout::choose_output_section): Likewise.
4162 (Layout::add_output_section_data): Likewise.
4163 (Layout::make_output_section): Likewise. Set order.
4164 (Layout::default_section_order): New function.
4165 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4166 * output.cc (Output_section::Output_section): Initialize order_.
4167 Don't initialize deleted fields.
4168 (Output_segment::Output_segment): Don't initialize deleted
4169 fields.
4170 (Output_segment::add_output_section_to_load): New function
4171 replacing add_output_section. Change all callers to call this or
4172 add_output_section_to_nonload.
4173 (Output_segment::add_output_section_to_nonload): New function.
4174 (Output_segment::remove_output_section): Rewrite.
4175 (Output_segment::add_initial_output_data): Likewise.
4176 (Output_segment::has_any_data_sections): Likewise.
4177 (Output_segment::is_first_section_relro): Likewise.
4178 (Output_segment::maximum_alignment): Likewise.
4179 (Output_segment::has_dynamic_reloc): New function replacing
4180 dynamic_reloc_count. Change all callers.
4181 (Output_segment::has_dynamic_reloc_list): New function replacing
4182 dynamic_reloc_count_list. Change all callers.
4183 (Output_segment::set_section_addresses): Rewrite.
4184 (Output_segment::set_offset): Rewrite.
4185 (Output_segment::find_first_and_last_list): Remove.
4186 (Output_segment::set_tls_offsets): Rewrite.
4187 (Output_segment::first_section_load_address): Likewise.
4188 (Output_segment::output_section_count): Likewise.
4189 (Output_segment::section_with_lowest_load_address): Likewise.
4190 (Output_segment::write_section_headers): Likewise.
4191 (Output_segment::print_sections_to_map): Likewise.
4192 * output.h (class Output_data): Remove dynamic_reloc_count_
4193 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4194 (Output_data::add_dynamic_reloc): Rewrite.
4195 (Output_data::has_dynamic_reloc): New function.
4196 (Output_data::dynamic_reloc_count): Remove.
4197 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4198 is_last_relro_, is_first_non_relro_, is_interp_,
4199 is_dynamic_linker_section_ fields. Add order and set_order
4200 functions. Remove is_relro_local, set_is_relro_local,
4201 is_last_relro, set_is_last_relro, is_first_non_relro,
4202 set_is_first_non_relro functions, is_interp, set_is_interp,
4203 is_dynamic_linker_section, and set_is_dynamic_linker_section
4204 functions.
4205 (class Output_segment): Change Output_data_list from std::list to
4206 std:;vector. Add output_lists_ field. Remove output_data_ and
4207 output_bss_ fields. Update declarations.
4208
4209 2010-08-02 Ian Lance Taylor <iant@google.com>
4210
4211 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4212 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4213 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4214
4215 2010-08-02 Ian Lance Taylor <iant@google.com>
4216
4217 PR 11855
4218 * script.cc (Script_options::Script_options): Initialize
4219 symbol_definitions_ and symbol_references_.
4220 (Script_options::add_symbol_assignment): Update
4221 symbol_definitions_ and symbol_references_.
4222 (Script_options::add_symbol_reference): New function.
4223 (script_symbol): New function.
4224 * script.h (class Script_options): Add symbol_definitions_ and
4225 symbol_references_ fields.
4226 (Script_options::referenced_const_iterator): New type.
4227 (Script_options::referenced_begin): New function.
4228 (Script_options::referenced_end): New function.
4229 (Script_options::is_referenced): New function.
4230 (Script_options::any_unreferenced): New function.
4231 * script-c.h (script_symbol): Declare.
4232 * yyscript.y (exp): Call script_symbol.
4233 * symtab.cc: Include "script.h".
4234 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4235 Change all callers. Check symbols referenced by scripts.
4236 (Symbol_table::add_undefined_symbols_from_command_line): Add
4237 layout parameter. Change all callers.
4238 (Symbol_table::do_add_undefined_symbols_from_command_line):
4239 Likewise. Break out loop body. Check symbols referenced by
4240 scripts.
4241 (Symbol_table::add_undefined_symbol_from_command_line): New
4242 function broken out of
4243 do_add_undefined_symbols_from_command_line.
4244 * symtab.h (class Symbol_table): Update declarations.
4245 * archive.cc: Include "layout.h".
4246 (Archive::should_include_member): Add layout parameter. Change
4247 all callers. Check for symbol mentioned in expression.
4248 * archive.h (class Archive): Update declaration.
4249 * object.cc (Sized_relobj::do_should_include_member): Add layout
4250 parameter.
4251 * object.h (Object::should_include_member): Add layout parameter.
4252 Change all callers.
4253 (Object::do_should_include_member): Add layout parameter.
4254 (class Sized_relobj): Update declaration.
4255 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4256 parameter.
4257 * dynobj.h (class Sized_dynobj): Update declaration.
4258 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4259 layout parameter.
4260 * plugin.h (class Sized_pluginobj): Update declaration.
4261
4262 2010-08-02 Ian Lance Taylor <iant@google.com>
4263
4264 PR 11866
4265 * output.cc (Output_segment::set_offset): Search for the first and
4266 last sections rather than assuming that the list is in order.
4267 (Output_segment::find_first_and_last_list): New function.
4268 * output.h (class Output_segment): Update declarations.
4269 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4270 (relro_strip_test_SOURCES): New variable.
4271 (relro_strip_test_DEPENDENCIES): New variable.
4272 (relro_strip_test_LDFLAGS): New variable.
4273 (relro_strip_test_LDADD): New variable.
4274 (relro_strip_test.so): New target.
4275
4276 2010-08-02 Ian Lance Taylor <iant@google.com>
4277
4278 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4279 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4280 (Target_i386::got_tlsdesc_section): New function.
4281 (Target_i386::got_section): Create space for GOT entries for
4282 TLSDESC relocations.
4283 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4284 R_386_TLS_GOTDESC.
4285 (Target_i386::Scan::global): Likewise.
4286 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4287 using TLSDESC GOT.
4288 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4289 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4290 (Target_x86_64::got_tlsdesc_section): New function.
4291 (Target_x86_64::got_section): Create space for GOT entries for
4292 TLSDESC relocations.
4293 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4294 R_386_TLS_GOTDESC.
4295 (Target_x86_64::Scan::global): Likewise.
4296 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4297 using TLSDESC GOT.
4298
4299 2010-08-02 Ian Lance Taylor <iant@google.com>
4300
4301 * testsuite/final_layout.sh: Use dc to convert from hex to
4302 decimal.
4303
4304 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4305
4306 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4307 paramter to the call to gold::gc_process_relocs.
4308 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4309 paramter to the call to gold::gc_process_relocs.
4310 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4311 parameter to the call to gold::gc_process_relocs.
4312 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4313 template parameter to the call to gold::gc_process_relocs.
4314 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4315 paramter to the call to gold::gc_process_relocs.
4316 * gc.h (get_embedded_addend_size): New function.
4317 (gc_process_relocs): Save the size of the reloc for use by ICF.
4318 * icf.cc (get_section_contents): Get the addend from the text section
4319 for SHT_REL relocation sections.
4320 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4321 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4322 * int_encoding.h (read_from_pointer): New overloaded function.
4323 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4324 * testsuite/icf_sht_rel_addend_test.sh: New file.
4325 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4326 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4327
4328 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4329
4330 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4331 * Makefile.in: Regenerate.
4332 * testsuite/Makefile.in: Regenerate.
4333
4334 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4335
4336 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4337 * gold/testsuite/debug_msg.cc: Likewise.
4338 * gold/testsuite/odr_violation1.cc
4339 * gold/testsuite/odr_violation2.cc
4340
4341 2010-07-21 Cary Coutant <ccoutant@google.com>
4342
4343 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4344 string, and length fields.
4345 (Output_merge_string::Merged_strings_list): New type.
4346 (Output_merge_string::Merged_strings_lists): New typedef.
4347 (Output_merge_string): Replace merged_strings_ with
4348 merged_strings_lists_.
4349 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4350 Merged_strings_list per input object and section. Don't store pointer
4351 to the string. Don't store length with each merged string entry.
4352 (Output_merge_string::finalize_merged_data): Loop over list of merged
4353 strings lists. Recompute length of each merged string.
4354
4355 2010-07-15 Cary Coutant <ccoutant@google.com>
4356
4357 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4358 here.
4359
4360 2010-07-14 Ian Lance Taylor <iant@google.com>
4361
4362 * descriptors.cc (Descriptors::open): Report correct name in error
4363 message.
4364
4365 2010-07-13 Doug Kwan <dougkwan@google.com>
4366
4367 * arm.cc (Arm_input_section::Arm_input_section): For a
4368 SHT_ARM_EXIDX section, always keeps the input sections.
4369 (Arm_input_section::set_exidx_section_link): New method.
4370 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4371 has_errors_ to false.
4372 (Arm_exidx_input_section::has_errors,
4373 Arm_exidx_input_section::set_has_errors): New methods.
4374 (Arm_exidx_input_section::has_errors_): New data member.
4375 (Arm_relobj::get_exidx_shndx_list): New method.
4376 (Arm_output_section::append_text_sections_to_list): Do not skip
4377 section without SHF_EXECINSTR.
4378 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4379 errors.
4380 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4381 section header. Make error messages more verbose. Check for
4382 a non-executable section linked to an EXIDX section.
4383 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4384 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4385 check that there is no deferred EXIDX section if we exit early.
4386 Instead of not making an EXIDX section in case of an error, make one
4387 and set the has_errors flag of it.
4388 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4389 in a relocatable link.
4390 (Target_arm::do_relax): Look for the EXIDX output section instead of
4391 assuming that it is called .ARM.exidx.
4392 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4393 section list. Do not check for SHF_EXECINSTR section flags but
4394 skip any input section with errors.
4395 * output.cc (Output_section::Output_section): Initialize
4396 always_keeps_input_sections_ to false.
4397 (Output_section::add_input_section): Check for
4398 always_keeps_input_sections_.
4399 * output.h (Output_section::always_keeps_input_sections,
4400 Output_section::set_always_keeps_input_sections): New methods.
4401 (Output_section::always_keeps_input_sections): New data member.
4402
4403 2010-07-13 Rafael Espindola <espindola@google.com>
4404
4405 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4406 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4407
4408 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4409 Ian Lance Taylor <iant@google.com>
4410
4411 * output.h (Output_section_lookup_maps::add_merge_section):
4412 Correct check of whether value was inserted.
4413 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4414 (Output_section_lookup_maps::add_relaxed_input_section):
4415 Likewise.
4416 * arm.cc (Target_arm::got_section): Remove used local os.
4417 * i386.cc (Target_i386::got_section): Likewise.
4418 * x86_64.cc (Target_x86_64::got_section): Likewise.
4419 * sparc.cc (Target_sparc::got_section): Likewise.
4420 (Target_sparc::relocate): Remove unused local have_got_offset.
4421 * powerpc.cc (Target_powerpc::relocate): Likewise.
4422
4423 2010-07-13 Ian Lance Taylor <iant@google.com>
4424
4425 * compressed_output.cc (zlib_decompress): Fix signature in
4426 !HAVE_ZLIB_H case.
4427
4428 * archive.cc (Archive::include_member): Unlock an external member
4429 of a thin archive. Don't bother to delete an object we know is
4430 NULL.
4431
4432 2010-07-12 Cary Coutant <ccoutant@google.com>
4433
4434 * compressed_output.cc (zlib_decompress): New function.
4435 (get_uncompressed_size): New function.
4436 (decompress_input_section): New function.
4437 * compressed_output.h (get_uncompressed_size): New function.
4438 (decompress_input_section): New function.
4439 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4440 Handle compressed debug sections.
4441 * layout.cc (is_compressed_debug_section): New function.
4442 (Layout::output_section_name): Map compressed section names to
4443 canonical names.
4444 * layout.h (is_compressed_debug_section): New function.
4445 (is_debug_info_section): Recognize compressed debug sections.
4446 * merge.cc: Include compressed_output.h.
4447 (Output_merge_data::do_add_input_section): Handle compressed
4448 debug sections.
4449 (Output_merge_string::do_add_input_section): Handle compressed
4450 debug sections.
4451 * object.cc: Include compressed_output.h.
4452 (Sized_relobj::Sized_relobj): Initialize new data members.
4453 (build_compressed_section_map): New function.
4454 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4455 * object.h (Object::section_is_compressed): New method.
4456 (Object::do_section_is_compressed): New method.
4457 (Sized_relobj::Compressed_section_map): New type.
4458 (Sized_relobj::do_section_is_compressed): New method.
4459 (Sized_relobj::compressed_sections_): New data member.
4460 * output.cc (Output_section::add_input_section): Handle compressed
4461 debug sections.
4462 * reloc.cc: Include compressed_output.h.
4463 (Sized_relobj::write_sections): Handle compressed debug sections.
4464
4465 2010-07-08 Cary Coutant <ccoutant@google.com>
4466
4467 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4468 weak when resolving to a dynamic def.
4469 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4470 for weak undef/dynamic def cases. Adjust callers.
4471 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4472 undef_binding_weak_.
4473 (Symbol_table::sized_write_globals): Adjust symbol binding.
4474 (Symbol_table::sized_write_symbol): Add binding parameter.
4475 * symtab.h (Symbol::set_undef_binding): New method.
4476 (Symbol::is_undef_binding_weak): New method.
4477 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4478 (Symbol_table::should_override): Add new parameter.
4479 (Symbol_table::sized_write_symbol): Add new parameter.
4480
4481 * testsuite/weak_undef_file1.cc: Add new test case.
4482 * testsuite/weak_undef_file2.cc: Fix header comment.
4483 * testsuite/weak_undef_test.cc: Add new test case.
4484
4485 2010-06-29 Doug Kwan <dougkwan@google.com>
4486
4487 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4488 Initialize USE_SYMBOL_.
4489 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4490 definition.
4491 (Arm_reloc_property::uses_symbol_): New data member declaration.
4492 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4493 uses symbol value and symbol is undefined but not weakly undefined.
4494
4495 2010-06-28 Rafael Espindola <espindola@google.com>
4496
4497 * plugin.cc (Plugin::load): Use dlerror.
4498
4499 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4500
4501 * symtab.cc (detect_odr_violations): When reporting an ODR
4502 violation, report an object where the symbol is defined.
4503
4504 2010-06-25 Doug Kwan <dougkwan@google.com>
4505
4506 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4507 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4508 definition.
4509 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4510 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4511 target hook to detect function points.
4512 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4513 * icf.h (Icf::check_section_for_function_pointers): Change type of
4514 parameter SECTION_NAME to const reference to std::string. Use
4515 target hook to determine if section may have unsafe pointers.
4516 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4517 method definition.
4518
4519 2010-06-21 Rafael Espindola <espindola@google.com>
4520
4521 * fileread.cc (Input_file::find_fie): New
4522 (Input_file::open): Use Input_file::find_fie.
4523 * fileread.h (Input_file::find_fie): New
4524 * plugin.cc (set_extra_library_path): New.
4525 (Plugin::load): Add set_extra_library_path to the transfer vector.
4526 (Plugin_manager::set_extra_library_path): New.
4527 (Plugin_manager::add_input_file): Use the extra search path if set.
4528 (set_extra_library_path(): New.
4529 * plugin.h (Plugin_manager): Add set_extra_library_path and
4530 extra_search_path_.
4531
4532 2010-06-19 Cary Coutant <ccoutant@google.com>
4533
4534 * layout.cc (gdb_sections): Add .debug_types.
4535 (lines_only_debug_sections): Likewise.
4536
4537 2010-06-18 Rafael Espindola <espindola@google.com>
4538
4539 * plugin.cc (add_input_file,add_input_library)
4540 (Plugin_manager::add_input_file): Make filename arguments const.
4541 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4542 const.
4543
4544 2010-06-16 Doug Kwan <dougkwan@google.com>
4545
4546 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4547 .ARM.attributes section if we have not merged any input
4548 attributes sections.
4549
4550 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4551
4552 * arm.cc: Allow combining objects with no EABI version
4553 information.
4554
4555 2010-06-15 Rafael Espindola <espindola@google.com>
4556
4557 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4558
4559 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4560
4561 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4562 (struct iovec): Correct !HAVE_READV definition.
4563
4564 2010-06-10 Cary Coutant <ccoutant@google.com>
4565
4566 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4567 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4568 reloc sections.
4569 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4570
4571 PR 11683
4572 * symtab.h (Symbol::is_placeholder): New member function.
4573 * target-reloc.h (relocate_section): Check for placeholder symbols.
4574
4575 * testsuite/Makefile.am (plugin_test_8): New test.
4576 (plugin_test_9): New test.
4577 * testsuite/Makefile.in: Regenerate.
4578
4579 2010-06-09 Nick Clifton <nickc@redhat.com>
4580
4581 * yyscript.y (input_list_element): Allow strings prefixed with
4582 the '-' character. Treat these as libraries.
4583 * script.cc (script_add_library): New function. Adds a library
4584 specified by "-l<name>" found in an input script.
4585 * script-c.h: Add prototype for script_add_library.
4586
4587 2010-06-07 Doug Kwan <dougkwan@google.com>
4588
4589 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4590 Restrict stub-group size to be within long conditional branch
4591 range when working around cortex-A8 erratum.
4592
4593 2010-06-07 Damien Diederen <dd@crosstwine.com>
4594
4595 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4596 #ifdef typo.
4597
4598 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4599
4600 PR gold/11658
4601 * output.cc
4602 (Output_section::Input_section_sort_entry::compare_section_ordering):
4603 Change to return non-zero correctly.
4604 (Output_section::Input_section_sort_section_order_index_compare
4605 ::operator()): Change to fix ambiguity in comparisons.
4606
4607 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4608
4609 * gold.h (is_wildcard_string): New function.
4610 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4611 (Layout::layout_eh_frame): Ditto.
4612 (Layout::find_section_order_index): New method.
4613 (Layout::read_layout_from_file): New method.
4614 * layout.h (Layout::find_section_order_index): New method.
4615 (Layout::read_layout_from_file): New method.
4616 (Layout::input_section_position_): New private member.
4617 (Layout::input_section_glob_): New private member.
4618 * main.cc (main): Call read_layout_from_file here.
4619 * options.h (--section-ordering-file): New option.
4620 * output.cc (Output_section::input_section_order_specified_): New
4621 member.
4622 (Output_section::Output_section): Initialize new member.
4623 (Output_section::add_input_section): Add new parameter.
4624 Keep input sections when --section-ordering-file is used.
4625 (Output_section::set_final_data_size): Sort input sections when
4626 section ordering file is specified.
4627 (Output_section::Input_section_sort_entry): Add new parameter.
4628 Check sorting type.
4629 (Output_section::Input_section_sort_entry::compare_section_ordering):
4630 New method.
4631 (Output_section::Input_section_sort_compare::operator()): Change to
4632 consider section_order_index.
4633 (Output_section::Input_section_sort_init_fini_compare::operator()):
4634 Change to consider section_order_index.
4635 (Output_section::Input_section_sort_section_order_index_compare
4636 ::operator()): New method.
4637 (Output_section::sort_attached_input_sections): Change to sort
4638 according to section order when specified.
4639 (Output_section::add_input_section<32, true>): Add new parameter.
4640 (Output_section::add_input_section<64, true>): Add new parameter.
4641 (Output_section::add_input_section<32, false>): Add new parameter.
4642 (Output_section::add_input_section<64, false>): Add new parameter.
4643 * output.h (Output_section::add_input_section): Add new parameter.
4644 (Output_section::input_section_order_specified): New
4645 method.
4646 (Output_section::set_input_section_order_specified): New method.
4647 (Input_section::Input_section): Initialize section_order_index_.
4648 (Input_section::section_order_index): New method.
4649 (Input_section::set_section_order_index): New method.
4650 (Input_section::section_order_index_): New member.
4651 (Input_section::Input_section_sort_section_order_index_compare): New
4652 struct.
4653 (Output_section::input_section_order_specified_): New member.
4654 * script-sections.cc (is_wildcard_string): Delete and move modified
4655 method to gold.h.
4656 (Output_section_element_input::Output_section_element_input): Modify
4657 call to is_wildcard_string.
4658 (Output_section_element_input::Input_section_pattern
4659 ::Input_section_pattern): Ditto.
4660 (Output_section_element_input::Output_section_element_input): Ditto.
4661 * testsuite/Makefile.am (final_layout): New test case.
4662 * testsuite/Makefile.in: Regenerate.
4663 * testsuite/final_layout.cc: New file.
4664 * testsuite/final_layout.sh: New file.
4665
4666 2010-06-01 Rafael Espindola <espindola@google.com>
4667
4668 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4669
4670 2010-06-01 Rafael Espindola <espindola@google.com>
4671
4672 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4673 visibility of symbols.
4674
4675 2010-05-27 Doug Kwan <dougkwan@google.com>
4676
4677 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4678 from start of output section instead of address for a local symbol
4679 in a merged or relaxed section when doing a relocatable link.
4680
4681 2010-05-26 Rafael Espindola <espindola@google.com>
4682
4683 PR 11604
4684 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4685 adding sections the garbage collector removed.
4686 * gold/testsuite/Makefile.am: Add test.
4687 * gold/testsuite/Makefile.in: Regenerate.
4688 * gold/testsuite/plugin_test_7.sh: New.
4689 * gold/testsuite/plugin_test_7_1.c: New.
4690 * gold/testsuite/plugin_test_7_2.c: New.
4691
4692 2010-05-26 Rafael Espindola <espindola@google.com>
4693
4694 * script-sections.cc (Output_section_definition::set_section_addresses):
4695 Check for --section-start.
4696
4697 2010-05-26 Doug Kwan <dougkwan@google.com>
4698
4699 * arm.cc (Arm_scan_relocatable_relocs): New class.
4700 (Target_arm::relocate_special_relocatable): New method.
4701 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4702 (Arm_relocate_functions::thumb_branch_common): Same.
4703 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4704 instead of Default_scan_relocatable_relocs.
4705 * target-reloc.h (relocate_for_relocatable): Let target handle
4706 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4707 * target.h (Sized_target::relocate_special_relocatable): New method.
4708
4709 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4710
4711 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4712
4713 2010-05-23 Doug Kwan <dougkwan@google.com>
4714
4715 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4716 instead of a cast.
4717 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4718 with a direct branch, not a conditional branch, to a stub.
4719 * merge.cc (Output_merge_base::record_input_section): New method
4720 defintion.
4721 (Output_merge_data::do_add_input_section): Record input section if
4722 keeps-input-sections flag is set.
4723 (Output_merge_string::do_add_input_section): Ditto.
4724 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4725 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4726 INPUT_SECTIONS_.
4727 (Output_merge_base::keeps_input_sections,
4728 Output_merge_base::set_keeps_input_sections,
4729 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4730 method definitions.
4731 (Output_merge_base::Input_sections): New type declaration.
4732 (Output_merge_base::input_sections_begin,
4733 Output_merge_base::input_sections_end,
4734 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4735 (Output_merge_base::bool keeps_input_sections_,
4736 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4737 Output_merge_base::input_sections_): New data members.
4738 (Output_merge_data::do_set_keeps_input_sections): New method
4739 defintion.
4740 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4741 * output.cc (Output_section::Input_section::relobj): Move method
4742 defintion from class declaration to here and handle merge sections.
4743 (Output_section::Input_section::shndx): Ditto.
4744 (Output_section::Output_section): Remove initializations of removed
4745 data members and initialize new data member LOOKUP_MAPS_.
4746 (Output_section::add_input_section): Set keeps-input-sections flag
4747 for a newly created merge output section as appropriate. Adjust code
4748 to use Output_section_lookup_maps class.
4749 (Output_section::add_relaxed_input_section): Adjst code for lookup
4750 maps code refactoring.
4751 (Output_section::add_merge_input_section): Add a new parameter
4752 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4753 class. If adding input section to a newly created merge output
4754 section fails, remove the new merge section.
4755 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4756 Adjust code for use of the Output_section_lookup_maps class.
4757 (Output_section::find_merge_section): Ditto.
4758 (Output_section::build_lookup_maps): New method defintion.
4759 (Output_section::find_relaxed_input_section): Adjust code to use
4760 Output_section_lookup_maps class.
4761 (Output_section::get_input_sections): Export merge sections. Adjust
4762 code to use Output_section_lookup_maps class.
4763 (Output_section:::add_script_input_section): Adjust code to use
4764 Output_section_lookup_maps class. Update lookup maps for merge
4765 sections also.
4766 (Output_section::discard_states): Use Output_section_lookup_maps.
4767 (Output_section::restore_states): Same.
4768 * output.h (Merge_section_properties): Move class defintion out of
4769 Output_section.
4770 (Output_section_lookup_maps): New class.
4771 (Output_section::Input_section::is_merge_section): New method
4772 defintion.
4773 (Output_section::Input_section::relobj): Move defintion out of class
4774 defintion. Declare method only.
4775 (Output_section::Input_section::shndx): Ditto.
4776 (Output_section::Input_section::output_merge_base): New method defintion.
4777 (Output_section::Input_section::u2_.pomb): New union field.
4778 (Output_section::Merge_section_by_properties_map,
4779 Output_section::Output_section_data_by_input_section_map,
4780 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4781 Remove types.
4782 (Output_section::add_merge_input_section): Add new parameter
4783 KEEPS_INPUT_SECTIONS.
4784 (Output_section::build_lookup_maps): New method declaration.
4785 (Output_section::merge_section_map_,
4786 Output_section::merge_section_by_properties_map_,
4787 Output_section::relaxed_input_section_map_,
4788 Output_section::is_relaxed_input_section_map_valid_): Remove data
4789 members.
4790 (Output_section::lookup_maps_): New data member.
4791
4792 2010-05-21 Doug Kwan <dougkwan@google.com>
4793
4794 PR gold/11619
4795 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4796 avoid a compilation error.
4797
4798 2010-05-19 Rafael Espindola <espindola@google.com>
4799
4800 * script-sections.cc (Output_section_definition::allocate_to_segment):
4801 Update the phdrs_list even when the output section is NULL.
4802 * testsuite/Makefile.am: Add test.
4803 * testsuite/Makefile.in: Regenerate.
4804 * testsuite/script_test_9.cc: New.
4805 * testsuite/script_test_9.sh: New.
4806 * testsuite/script_test_9.t: New.
4807
4808 2010-05-19 Doug Kwan <dougkwan@google.com>
4809
4810 * arm.cc (Arm_input_section::original_size): New method.
4811 (Arm_input_section::do_addralign): Add a cast.
4812 (Arm_input_section::do_output_offset): Remove static cast.
4813 (Arm_input_section::original_addralign,
4814 Arm_input_section::original_size_): Change type to uint32_t.
4815 (Arm_input_section::init): Add safe casts for section alignment
4816 and size.
4817 (Arm_input_section::set_final_data_size): Do not set address and
4818 offset of stub table.
4819 (Arm_output_section::fix_exidx_coverage): Change use of of
4820 Output_section::Simple_input_section to that of
4821 Output_section::Input_section.
4822 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4823 except for the first pass.
4824 * output.cc (Output_section::get_input_sections): Change type of
4825 input_sections to std::list<Input_section>.
4826 (Output_section::add_script_input_section): Rename from
4827 Output_section::add_simple_input_section. Change type of SIS
4828 parameter from Simple_input_section to Input_section.
4829 * output.h (Output_section::Simple_input_section): Remove class.
4830 (Output_section::Input_section): Change class visibility to public.
4831 (Output_section::Input_section::addralign): Use stored alignments
4832 for special input sections if set.
4833 (Output_section::Input_section::set_addralign): New method.
4834 (Output_section::get_input_sections): Change parameter type from
4835 list of Simple_input_section to list of Input_section.
4836 (Output_section::add_script_input_section): Rename from
4837 Output_section::add_simple_input_section. Change first parameter's
4838 type from Simple_input_section to Input_section and remove the
4839 second and third parameters.
4840 * script-sections.cc (Input_section::Input_section_list): Change
4841 type to list of Output_section::Input_section/
4842 (Input_section_info::Input_section_info): Change parameter type of
4843 INPUT_SECTION to Output_section::Input_section.
4844 (Input_section_info::input_section): Change return type.
4845 (Input_section_info::input_section_): Change type to
4846 Output_section::Input_section.
4847 (Output_section_element_input::set_section_addresses): Adjust code
4848 to use Output_section::Input_section instead of
4849 Output_section::Simple_input_section. Adjust code for renaming
4850 of Output_section::add_simple_input_section.
4851 (Orphan_output_section::set_section_addresses): Ditto.
4852
4853 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4854
4855 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4856 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4857
4858 2010-05-18 Rafael Espindola <espindola@google.com>
4859
4860 * options.cc (General_options::finalize): Handle -nostdlib.
4861 * options.h (nostdlib): New option.
4862 * script.cc (script_add_search_dir): Handle -nostdlib.
4863
4864 2010-05-12 Doug Kwan <dougkwan@google.com>
4865
4866 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4867 attributes section only if there no attributes section after merging.
4868 (Target_arm::merge_object_attributes): Move value of
4869 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4870 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4871 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4872 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4873 and arm_attr_merge_7.stdout.
4874 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4875 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4876 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4877 arm_attr_merge_7b.o): New rules.
4878 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4879 arm_attr_merge_7
4880 * testsuite/Makefile.in: Regenerate.
4881 * testsuite/arm_attr_merge.sh: New file.
4882 * testsuite/arm_attr_merge_[67][ab].s: Same.
4883
4884 2010-05-05 Nick Clifton <nickc@redhat.com>
4885
4886 * po/es.po: Updated Spanish translation.
4887
4888 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4889
4890 * Makefile.am (install-exec-local): Properly install gold as
4891 default cross linker.
4892 * Makefile.in: Regenerated.
4893
4894 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4895 Nick Clifton <nickc@redhat.com>
4896
4897 * configure.ac (install_as_default): Define and set to false
4898 unless --enable-gold or --enable-gold=both/gold has been
4899 specified.
4900 * configure: Regenerate.
4901
4902 * Makefile.am (install-exec-local): Install the executable as
4903 'ld.gold'. If install_as_default is true then also install it as
4904 'ld'.
4905 * Makefile.in: Regenerated.
4906
4907 2010-04-24 Ian Lance Taylor <iant@google.com>
4908
4909 * layout.cc (Layout::layout_reloc): In relocatable link don't
4910 combine reloc sections for grouped sections.
4911
4912 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4913
4914 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4915 sections that are not ordinary to icf.
4916 * icf.cc (get_section_contents): Handle relocation pointing to section
4917 with no object or shndx information.
4918 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4919 * testsuite/Makefile.in: Regenerate.
4920 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4921 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4922
4923 2010-04-22 Ian Lance Taylor <iant@google.com>
4924
4925 * expression.cc (Expression::Expression_eval_info): Add
4926 result_alignment_pointer field.
4927 (Expression::eval_with_dot): Add result_alignment_pointer
4928 parameter. Change all callers.
4929 (Expression::eval_maybe_dot): Likewise.
4930 (class Binary_expression): Add alignment_pointer parameter to
4931 left_value and right_value. Change all callers.
4932 (BINARY_EXPRESSION): Set result alignment.
4933 (class Trinary_expression): Add alignment_pointer parameter to
4934 arg2_value and arg3_value. Change all callers.
4935 (Trinary_cond::value): Set result alignment.
4936 (Max_expression::value, Min_expression::value): Likewise.
4937 (Align_expression::value): Likewise.
4938 * script-sections.cc (class Sections_element): Add dot_alignment
4939 parameter to set_section_addresses virtual function. Update
4940 instantiations.
4941 (class Output_section_element): Likewise.
4942 (Script_sections::create_segments): Add dot_alignment parameter.
4943 Change all callers.
4944 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4945 (Script_sections::set_phdrs_clause_addresses): Likewise.
4946 * script-sections.h: Update declarations.
4947 * script.h: Update declarations.
4948 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4949 min_p_align.
4950 * testsuite/script_test_3.t: Set large alignment.
4951 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4952 segment has expected alignment.
4953
4954 2010-04-22 Nick Clifton <nickc@redhat.com>
4955
4956 * po/gold.pot: Updated by the Translation project.
4957 * po/vi.po: Updated Vietnamese translation.
4958
4959 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4960
4961 * testsuite/Makefile.am (check_PROGRAMS): Add
4962 icf_virtual_function_folding_test.
4963 * testsuite/Makefile.in: Regenerated.
4964
4965 2010-04-15 Andrew Haley <aph@redhat.com>
4966
4967 * options.h (merge_exidx_entries): New option.
4968 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4969 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4970 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4971 (Target_arm::merge_exidx_entries): New function.
4972 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4973 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4974 to Arm_exidx_fixup constructor.
4975 Add new arg, merge_exidx_entries.
4976 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4977 Arm_output_section::fix_exidx_coverage.
4978
4979 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4980
4981 * icf.cc (get_section_contents): Check for preemptible functions.
4982 Ignore addend when appropriate.
4983 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4984 section folded.
4985 (add_from_relobj): Check for section folded.
4986 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4987 * symtab.h (should_add_dynsym_entry): Add new parameter.
4988 * target-reloc.h (scan_relocs): Check for section folded.
4989 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4990 Check reloc types for function pointers in shared objects.
4991 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4992 case.
4993 (icf_preemptible_functions_test): New test case.
4994 (icf_string_merge_test): New test case.
4995 * testsuite.Makefile.in: Regenerate.
4996 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4997 bar_glob. Refactor code.
4998 * testsuite/icf_preemptible_functions_test.cc: New file.
4999 * testsuite/icf_preemptible_functions_test.sh: New file.
5000 * testsuite/icf_string_merge_test.cc: New file.
5001 * testsuite/icf_string_merge_test.sh: New file.
5002 * testsuite/icf_virtual_function_folding_test.cc: New file.
5003 * testsuite/icf_virtual_function_folding_test.sh: New file.
5004
5005 2010-04-14 Doug Kwan <dougkwan@google.com>
5006
5007 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5008 for local symbol recounting if we remove a section due to ICF.
5009 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5010 there are no regular objects in input.
5011
5012 2010-04-13 Doug Kwan <dougkwan@google.com>
5013
5014 * arm.cc (Arm_input_section::set_final_data_size): Compute
5015 accurate final data size instead of using current data size.
5016
5017 2010-04-09 Doug Kwan <dougkwan@google.com>
5018
5019 * layout.cc (Layout::choose_output_section): Handle script section
5020 types.
5021 (Layout::make_output_section_for_script): Add section type parameter.
5022 Handle script section types.
5023 * layout.h (Layout::make_output_section_for_script): Add section
5024 type parameter.
5025 * output.cc (Output_section::Output_section): Initialize data member
5026 is_noload_.
5027 (Output_section::do_reset_address_and_file_offset): Do not set address
5028 to 0 if section is a NOLOAD section.
5029 * output.h (Output_section::is_noload): New method.
5030 (Output_section::set_is_noload): Ditto.
5031 (Output_section::is_noload_): New data member.
5032 * script-c.h (Script_section_type): New enum type.
5033 (struct Parser_output_section_header): Add new file section_type.
5034 * script-sections.cc (Sections_element::output_section_name): Add
5035 parameter for returning script section type.
5036 (Output_section_definition::output_section_name): Ditto.
5037 (Output_section_definition::section_type)P; New method.
5038 (Output_section_definiton::script_section_type_name): Ditto.
5039 (Output_section_definition::script_section_type_): New data member.
5040 (Output_section_definition::Output_section_definition): Initialize
5041 data member Output_section_definition::script_section_type_.
5042 (Output_section_definition::create_sections): Pass script section type
5043 to Layout::make_output_section_for_script.
5044 (Output_section_definition::output_section_name): Return script
5045 section type to caller.
5046 (Output_section_definition::set_section_address): Do not advance
5047 dot value and load address if section type is NOLOAD. Set address
5048 of NOLOAD sections regardless of section flags.
5049 (Output_section_definition::print): Print section type if it is
5050 not SCRIPT_SECTION_TYPE_NONE.
5051 (Output_section_definition::section_type): New method.
5052 (Output_section_definition::script_section_type_name): Ditto.
5053 (Script_sections::output_section_name): Add new parameter
5054 PSECTION_TYPE for returning script section type. Pass it to
5055 section elements. Handle discard sections.
5056 (Sort_output_sections::operator()): Handle NOLOAD sections.
5057 * script-sections.h (Script_sections::Section_type): New enum type.
5058 (Script_sections::output_section_name): Add a new parameter for
5059 returning script section type.
5060 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5061 INFO and NOLOAD.
5062 * yyscript.y (union): Add new field SECTION_TYPE.
5063 (COPY, DSECT, INFO, NOLOAD): New tokens.
5064 (opt_address_and_section_type): Change type to output_section_header.
5065 (section_type): New non-terminal
5066 (section_header): Handle section type.
5067 (opt_address_and_section_type): Return section type value.
5068
5069 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5070
5071 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5072 * testsuite/plugin_common_test_2.c (foo): Likewise.
5073
5074 2010-04-08 Doug Kwan <dougkwan@google.com>
5075
5076 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5077 Output_merge_data.
5078 * output.cc (Output_section::add_merge_input_section): Simplify
5079 code and return status of Output_merge_base::add_input_section.
5080 Update merge section map only if Output_merge_base::add_input_section
5081 returns true.
5082
5083 2010-04-07 Doug Kwan <dougkwan@google.com>
5084
5085 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5086 if section is marked as containing instructions but has no mapping
5087 symbols.
5088 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5089 correct section index.
5090 (Arm_relobj::find_linked_text_section): Ditto.
5091
5092 2010-04-07 Cary Coutant <ccoutant@google.com>
5093
5094 * archive.cc (include_member): Destroy Read_symbols_data object before
5095 releasing file.
5096 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5097 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5098 (Read_symbols_data::~Read_symbols_data) New destructor.
5099 (Section_relocs::Section_relocs) New constructor.
5100 (Section_relocs::~Section_relocs) New destructor.
5101 (Read_relocs_data::Read_relocs_data) New constructor.
5102 (Read_relocs_data::~Read_relocs_data) New destructor.
5103 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5104 pointers to NULL after deleting.
5105
5106 2010-04-07 Doug Kwan <dougkwan@google.com>
5107
5108 * arm.cc: Replace "endianity" with "endianness" in comments.
5109 (Arm_exidx_cantunwind): Ditto.
5110 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5111 (Arm_relobj::merge_flags_and_attributes): New method.
5112 (Arm_relobj::merge_flags_and_attributes_): New data member.
5113 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5114 (Arm_relobj::scan_sections_for_stubs): Ditto.
5115 (Arm_relobj::do_read_symbols): Check to see if we really want to
5116 merge processor-specific flags and attributes. Exit early if
5117 an object is empty except for section names and the undefined symbol.
5118 (Target_arm::do_finalize_sections): Move check for ELF format to
5119 Arm_relobj::do_read_symbols. Merge processor specific flags and
5120 attributes from a regular object only when we have determined that
5121 it is aapropriate. Do not create an .ARM.attributes section in
5122 output if there is no regular input object.
5123 (Target_arm::merge_processor_specific_flags): Check
5124 --warn-mismatch before printing any error.
5125 (Target_arm::merge_object_attributes): Ditto.
5126 * gold.cc (queue_middle_tasks): Handle the case in which there is
5127 no regular object in input.
5128 * options.cc (General_options::parse_EB): New method.
5129 (General_options::parse_EL): Same.
5130 (General_options::General_options): Initialize endianness_.
5131 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5132 New options.
5133 (General_options::Endianness): New enum.
5134 (General_options::endianness): New method.
5135 (General_options::endianness_): New data member.
5136 * parameters.cc (Parameters::set_options): Check target endianness.
5137 (Parameters::set_target_once): Ditto.
5138 (Parameters::check_target_endianness): New method.
5139 (parameters_force_valid_target): If either -EL or -EB is specified,
5140 use it to define endianness of default target.
5141 * parameters.h (Parameters::check_target_endianness): New method
5142 declaration.
5143 * target.h (class Target): Change "endianity" to "endianness"
5144 in comments.
5145
5146 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5147
5148 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5149 * configure: Regenerate.
5150 * Makefile.in: Regenerate.
5151 * testsuite/Makefile.in: Regenerate.
5152
5153 2010-04-06 Cary Coutant <ccoutant@google.com>
5154
5155 gcc PR lto/42757
5156 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5157 prevailing definitions of common symbols.
5158 * testsuite/plugin_test_6.sh: New test case.
5159 * testsuite/plugin_common_test_1.c: New test case.
5160 * testsuite/plugin_common_test_2.c: New test case.
5161 * testsuite/Makefile.am (plugin_test_6): New test case.
5162 * testsuite/Makefile.in: Regenerate.
5163
5164 2010-04-06 Nick Clifton <nickc@redhat.com>
5165
5166 * po/vi.po: New Vietnamese translation.
5167
5168 2010-03-30 Doug Kwan <dougkwan@google.com>
5169
5170 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5171
5172 2010-03-25 Doug Kwan <dougkwan@google.com>
5173
5174 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5175 to avoid a conversion warning on a 32-bit host.
5176
5177 2010-03-24 Ian Lance Taylor <iant@google.com>
5178
5179 * testsuite/script_test_3.t: Add a TLS segment.
5180 * testsuite/Makefile.am (check_PROGRAMS): Add
5181 tls_phdrs_script_test.
5182 (tls_phdrs_script_test_SOURCES): Define.
5183 (tls_phdrs_script_test_DEPENDENCIES): Define.
5184 (tls_phdrs_script_test_LDFLAGS): Define.
5185 (tls_phdrs_script_test_LDADD): Define.
5186 * testsuite/Makefile.in: Rebuild.
5187
5188 2010-03-23 Cary Coutant <ccoutant@google.com>
5189
5190 * fileread.cc (find_or_make_view): Fix comment.
5191
5192 2010-03-23 Ian Lance Taylor <iant@google.com>
5193
5194 * script-sections.cc (class Orphan_section_placement): Define
5195 PLACE_TLS and PLACE_TLS_BSS.
5196 (Orphan_section_placement::Orphan_section_placement): Initialize
5197 new places.
5198 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5199 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5200 (tls_script_test_SOURCES): Define.
5201 (tls_script_test_DEPENDENCIES): Define.
5202 (tls_script_test_LDFLAGS): Define.
5203 (tls_script_test_LDADD): Define.
5204 * testsuite/Makefile.in: Rebuild.
5205
5206 2010-03-22 Doug Kwan <dougkwan@google.com>
5207
5208 * arm.cc (Arm_relocate_functions::abs8,
5209 Arm_relocate_functions::abs16): Use correct check for overflow
5210 specified in the ARM ELF specs.
5211 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5212 target of a BLX instruction specially.
5213 (Reloc_stub::stub_type_for_reloc): Ditto.
5214 (Relocate::relocate): Use symbolic names instead of numeric relocation
5215 codes to report error.
5216 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5217 workaround.
5218 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5219 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5220 thumb2_blx_out_of_range.stdout
5221 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5222 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5223 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5224 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5225 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5226 thumb2_blx_in_range, thumb2_blx_in_range.o,
5227 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5228 thumb2_blx_out_of_range.o): New rules.
5229 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5230 thumb2_blx_in_range and thumb2_blx_out_of_range.
5231 * testsuite/Makefile.in: Regenerate.
5232 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5233 * testsuite/thumb_blx_in_range.s: New file.
5234 * testsuite/thumb_blx_out_of_range.s: New file.
5235
5236 2010-03-22 Rafael Espindola <espindola@google.com>
5237
5238 * archive.cc (Should_include): Move to archive.h.
5239 (should_include_member): Make it a member of Archive.
5240 (Lib_group): New.
5241 (Add_lib_group_symbols): New.
5242 * archive.h: Include options.h.
5243 (Archive_member): Moved from Archive.
5244 (Should_include): Moved from archive.cc.
5245 (Lib_group): New.
5246 (Add_lib_group_symbols): New.
5247 * dynobj.cc (do_should_include_member): New.
5248 * dynobj.h (do_should_include_member): New.
5249 * gold.cc (queue_initial_tasks): Update call to queue.
5250 * main.cc (main): Print lib group stats.
5251 * object.cc (do_should_include_member): New.
5252 * object.h: Include archive.h.
5253 (Object::should_include_member): New.
5254 (Object::do_should_include_member): New.
5255 (Sized_relobj::do_should_include_member): New.
5256 * options.cc (General_options::parse_start_lib): New.
5257 (General_options::parse_end_lib): New.
5258 (Input_arguments::add_file): Handle lib groups.
5259 (Input_arguments::start_group): Check we are not in a lib.
5260 (Input_arguments::start_lib): New.
5261 (Input_arguments::end_lib): New.
5262 * options.h (General_options): Add start_lib and end_lib.
5263 (Input_argument::lib_): New.
5264 (Input_argument::lib): New.
5265 (Input_argument::is_lib): New.
5266 (Input_file_lib): New.
5267 (Input_arguments::in_lib_): New.
5268 (Input_arguments::in_lib): New.
5269 (Input_arguments::start_lib): New.
5270 (Input_arguments::end_lib_): New.
5271 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5272 in unused members as preempted.
5273 (Sized_pluginobj::do_should_include_member): New.
5274 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5275 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5276 return the blocker.
5277 (Read_symbols::do_whole_lib_group): New.
5278 (Read_symbols::do_lib_group): New.
5279 (Read_symbols::do_read_symbols): Handle lib groups.
5280 (Read_symbols::get_name): Handle lib groups.
5281 * readsyms.h (Read_symbols): Add an archive member pointer.
5282 (Read_symbols::do_whole_lib_group): New.
5283 (Read_symbols::do_lib_group): New.
5284 (Read_symbols::member_): New.
5285 * script.cc (read_input_script): Update call to queue_soon.
5286
5287 2010-03-19 Doug Kwan <dougkwan@google.com>
5288
5289 * arm.cc (Stub_table::Stub_table): Initialize new data members
5290 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5291 (Stub_table::add_reloc_stub): Assign stub offset and update
5292 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5293 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5294 New data members.
5295 (Stub_table::update_data_size_and_addralign): Use
5296 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5297 instead of going over all reloc stubs.
5298 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5299 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5300 Stringpool_template::offset_ to size of Stringpool_char.
5301 (Stringpool_template::new_key_offset): Remove code to initialize
5302 Stringpool_template::offset_.
5303 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5304 Stringpool_template::offset_ to zero.
5305
5306 2010-03-15 Doug Kwan <dougkwan@google.com>
5307
5308 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5309 offset_.
5310 (Stringpool_template::new_key_offset): New method.
5311 (Stringpool_template::add_string): Assign offsets when adding new
5312 strings.
5313 (Stringpool_template::set_string_offsets): Do not set string offsets
5314 when not optimizing.
5315 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5316 member size_.
5317 (Chunked_vector::clear): Clear size_.
5318 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5319 (Chunked_vector::size): Return size_.
5320 (Chunked_vector::push_back): Use size_ to find insert position.
5321 (Chunked_vector::size_): New data member.
5322 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5323 (Stringpool_template::new_key_offset): New method declaration.
5324 (Stringpool_template::offset_): New data member.
5325
5326 2010-03-15 Rafael Espindola <espindola@google.com>
5327
5328 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5329 Add_symbols' constructor.
5330 * readsyms.h (Add_symbols): Remove the input_group member.
5331
5332 2010-03-10 Ian Lance Taylor <iant@google.com>
5333
5334 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5335 target to ask whether a reference to a symbol requires a stack
5336 split.
5337 * target.h (Target::is_call_to_non_split): New function.
5338 (Target::do_is_call_to_non_split): Declare virtual function.
5339 * target.cc: Include "symtab.h".
5340 (Target::do_is_call_to_non_split): New function.
5341 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5342
5343 2010-03-10 Cary Coutant <ccoutant@google.com>
5344
5345 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5346 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5347 (File_read::open[2]): Add whole_file_view_ to list of views.
5348 (File_read::make_view): Remove test of whole_file_view_.
5349 (File_read::find_or_make_view): Create whole_file_view_ if
5350 necessary.
5351 (File_read::clear_views): Replace bool parameter with enum;
5352 adjust all callers. Don't delete views with permanent data;
5353 do delete cached views and views from archives if
5354 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5355 if clearing the corresponding view.
5356 * fileread.h (File_read::Clear_views_mode): New enum.
5357 (File_read::View::is_permanent_view): New method.
5358 (File_read::clear_views): Replace bool parameter
5359 with enum; adjust all callers.
5360 * options.h (General_options): Change keep_files_mapped option;
5361 add map_whole_files.
5362 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5363 releasing the file.
5364 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5365 the file.
5366
5367 2010-03-10 David S. Miller <davem@davemloft.net>
5368
5369 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5370
5371 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5372
5373 * icf.cc (get_section_contents): Add '@' marker after processing the
5374 merge reloc.
5375
5376 2010-03-08 Doug Kwan <dougkwan@google.com>
5377
5378 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5379 due to a conversion warning.
5380 (Arm_relobj::update_output_local_symbol_count): Check for local
5381 symbol with unset output index.
5382
5383 2010-03-05 Ian Lance Taylor <iant@google.com>
5384
5385 * options.h (class General_options): Add --spare-dynamic-tags.
5386 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5387 --spare-dynamic-tags.
5388
5389 2010-03-05 Ian Lance Taylor <iant@google.com>
5390
5391 * incremental.cc: Include "libiberty.h".
5392
5393 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5394
5395 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5396 function, is_info_ member.
5397 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5398 (Versions::Versions): Update caller.
5399 (Versions::define_base_version): Likewise.
5400 (Versions::add_def): Likewise.
5401
5402 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5403
5404 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5405 (Scan::possible_function_pointer_reloc): New function.
5406 (Scan::local_reloc_may_be_function_pointer): Change to call
5407 possible_function_pointer_reloc.
5408 (Scan::global_reloc_may_be_function_pointer): Ditto.
5409 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5410 relocations in ".data.rel.ro._ZTV" section.
5411 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5412 * testsuite/icf_safe_so_test.cc: Ditto.
5413 * testsuite/icf_safe_test.cc: Ditto.
5414 * testsuite/icf_safe_test.sh: Ditto.
5415
5416 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5417 Ian Lance Taylor <iant@google.com>
5418
5419 * target-reloc.h (relocate_section): Check the symbol table index
5420 for -1U before setting the local symbol index.
5421 (scan_relocatable_relocs): If copying the relocation, record that
5422 the local symbol is required.
5423 * object.h (Symbol_value::is_output_symtab_index_set): New
5424 function.
5425 (Symbol_value::may_be_discarded_from_output_symtab): New
5426 function.
5427 (Symbol_value::has_output_symtab_entry): New function.
5428 (Symbol_value::needs_output_symtab_entry): Remove.
5429 (Symbol_value::output_symtab_index): Make sure the symbol index is
5430 set.
5431 (Symbol_value::set_output_symtab_index): Make sure the symbol
5432 index is not set. Make sure the new index is valid.
5433 (Symbol_value::set_must_have_output_symtab_entry): New function.
5434 (Symbol_value::has_output_dynsym_entry): New function.
5435 (Symbol_value::set_output_dynsym_index): Make sure the new index
5436 is valid.
5437 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5438 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5439 local symbol if permitted.
5440 (Sized_relobj::do_finalize_local_symbols): Call
5441 is_output_symtab_index_set rather than needs_output_symtab_entry.
5442 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5443 rather than needs_output_symtab_entry. Call
5444 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5445 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5446 is_output_symtab_index_set rather than needs_output_symtab_entry.
5447 * testsuite/discard_locals_relocatable_test.c: New file.
5448 * testsuite/discard_locals_test.sh: Test -r.
5449 * testsuite/Makefile.am (check_DATA): Add
5450 discard_locals_relocatable_test1.syms,
5451 discard_local_relocatable_test2.syms.
5452 (MOSTLYCLEANFILES): Likewise. Also add
5453 discard_locals_relocatable_test1.lout and
5454 discard_locals_relocatable_test2.out.
5455 (discard_locals_relocatable_test1.syms): New target.
5456 (discard_locals_relocatable_test.o): New target.
5457 (discard_locals_relocatable_test1.out): New target.
5458 (discard_locals_relocatable_test2.syms): New target.
5459 (discard_locals_relocatable_test2.out): New target.
5460 (various): Add missing ../ld-new dependencies.
5461 * testsuite/Makefile.in: Rebuild.
5462
5463 2010-03-03 Nick Clifton <nickc@redhat.com>
5464
5465 * po/fi.po: New Finnish translation.
5466
5467 2010-03-01 Doug Kwan <dougkwan@google.com>
5468
5469 * layout.cc (Layout::Layout): Force section types of .init_array*,
5470 .preinit_array* and .fini_array* sections.
5471 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5472 Fix check of return value of std::string::find.().
5473 (Output_section::Input_section_sort_compare::operator()): Remove
5474 comment about .init_array.
5475 (Output_section::Input_section_sort_init_fini_compare::operator()):
5476 New method.
5477 (Output_section::sort_attached_input_sections): Handle .init_array
5478 and .fini_array specially.
5479 * output.h (Output_section::Inut_section_sort_compare): Update
5480 comment.
5481 (Output_section::Input_section_sort_init_fini_compare): New struct.
5482
5483 2010-02-26 Doug Kwan <dougkwan@google.com>
5484
5485 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5486 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5487 * testsuite/debug_msg.sh: Avoid matching source line number for
5488 use of global variable undef_int.
5489
5490 2010-02-26 Doug Kwan <dougkwan@google.com>
5491
5492 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5493 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5494 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5495 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5496 * options.cc (General_options::General_options): Initialize member
5497 fix_v4bx_.
5498 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5499 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5500 and rm_no_fix_v4bx.stdout
5501 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5502 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5503 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5504 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5505 and arm_no_fix_v4bx.
5506 * Makefile.in: Regenerate.
5507 * testsuite/arm_fix_v4bx.s: New file.
5508 * testsuite/arm_fix_v4bx.sh: Ditto.
5509
5510 2010-02-24 Doug Kwan <dougkwan@google.com>
5511
5512 * arm.cc (Target_arm::got_section): Make the .got section the first
5513 non RELRO section in the data segment.
5514 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5515 suffixes of section names.
5516
5517 2010-02-24 Doug Kwan <dougkwan@google.com>
5518
5519 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5520 flags and attributes merging if an input file is a binary file.
5521 * fileread.cc (Input_file::open): Record format of original file.
5522 * fileread.h (Input_file::Format): New enum type.
5523 (Input_file::Input_file): Initialize data member format_.
5524 (Input_file::format): New method definition.
5525 (Input_file::format_):: New data member.
5526
5527 2010-02-24 Doug Kwan <dougkwan@google.com>
5528
5529 * arm.cc (Arm_output_data_got): New class.
5530 (ARM_TCB_SIZE): New constant
5531 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5532 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5533 If user uses a script with a SECTIONS clause, issue only a warning
5534 for a misplaced EXIDX input section. Otherwise, issue an error.
5535 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5536 garbage collection.
5537 (Target_arm::got_mode_index_entry): Handle static linking.
5538 (Target_arm::Scan::local): Ditto.
5539 (Target_arm::Scan::global): Ditto.
5540 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5541 all incorrectly implemented relocations.
5542 (Target_arm::fix_exidx_coverage): Pass layout to
5543 Arm_output_section::fix_exidx_coverage.
5544 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5545 from ".ARM.exidx." and ".ARM.extab.".
5546
5547 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5548
5549 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5550 section if it does not already exist.
5551 * attributes.cc (Attributes_section_data::Attributes_section_data):
5552 Don't crash if size is zero.
5553
5554 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5555 Ian Lance Taylor <iant@google.com>
5556
5557 * gold.cc (queue_middle_tasks): If no input files were opened,
5558 exit.
5559 * workqueue.h (Task_function::Task_function): Assert that there is
5560 a blocker.
5561
5562 2010-02-22 Doug Kwan <dougkwan@google.com>
5563
5564 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5565 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5566 types to avoid warnings due to different uint64_t implementations
5567 on different hosts.
5568
5569 2010-02-21 Doug Kwan <dougkwan@google.com>
5570
5571 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5572 handling of the maximum backward branch offset.
5573 (Arm_relocate_functions::thumb_branch_common): Ditto.
5574 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5575 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5576 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5577 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5578 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5579 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5580 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5581 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5582 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5583 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5584 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5585 thumb2_bl_out_of_range.o): New rules.
5586 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5587 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5588 thumb2_bl_out_of_range
5589 * testsuite/Makefile.in: Regenerate.
5590 * testsuite/arm_bl_in_range.s: New file.
5591 * testsuite/arm_bl_out_of_range.s: Ditto.
5592 * testsuite/arm_branch_in_range.sh: Ditto.
5593 * testsuite/arm_branch_range.t: Ditto.
5594 * testsuite/thumb2_branch_range.t: Ditto.
5595 * testsuite/thumb_bl_in_range.s: Ditto.
5596 * testsuite/thumb_bl_out_of_range.s: Ditto.
5597 * testsuite/thumb_branch_range.t: Ditto.
5598
5599 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5600
5601 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5602 Add reloc offset information.
5603 * icf.cc (get_section_contents): Change iterators to point to the new
5604 vectors. Add reloc offset information to the contents.
5605 * icf.h (Icf::Sections_reachable_info): New typedef.
5606 (Icf::Sections_reachable_list): New typedef.
5607 (Icf::Offset_info): New typedef.
5608 (Icf::Reloc_info): New struct typedef.
5609 (Icf::Reloc_info_list): New typedef.
5610 (Icf::symbol_reloc_list): Delete method.
5611 (Icf::addend_reloc_list): Delete method.
5612 (Icf::section_reloc_list): Delete method.
5613 (Icf::reloc_info_list): New method.
5614 (Icf::reloc_info_list_): New member.
5615
5616 2010-02-19 Doug Kwan <dougkwan@google.com>
5617
5618 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5619 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5620 * arm.cc (Arm_relocation_functions): New forward declaration.
5621 (Target_arm::Target_arm): Initialize new data members
5622 got_mod_index_offset_ and tls_base_symbol_defined_.
5623 (Target_arm::Relocate::relocate_tls): New method.
5624 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5625 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5626 New methods.
5627 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5628 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5629 (Target_arm::got_mod_index_offset_,
5630 Target_arm::tls_base_symbol_defined_): New data members.
5631 (Target_arm::Scan::local, Target::Scan::global,
5632 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5633 relocations.
5634
5635 2010-02-18 Doug Kwan <dougkwan@google.com>
5636
5637 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5638 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5639 text section as a parameter becuase some broken tools may not set
5640 the link in section header.
5641 (Target_arm::has_got_section): New method.
5642 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5643 without any mapping symbol as data only. Remove warning.
5644 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5645 link in its section header, try to discover the link by inspecting the
5646 REL31 relocation at the beginning of the section.
5647 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5648 in error message.
5649 (Target_arm::Scan::global): Treat any reference to the symbol
5650 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5651
5652 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5653
5654 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5655 (Scan::global_reloc_may_be_function_pointer): New function.
5656 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5657 (Scan::global_reloc_may_be_function_pointer): New function.
5658 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5659 (Scan::global_reloc_may_be_function_pointer): New function.
5660 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5661 (Scan::global_reloc_may_be_function_pointer): New function.
5662 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5663 (Scan::global_reloc_may_be_function_pointer): New function.
5664 (Scan::possible_function_pointer_reloc): New function.
5665 (Target_x86_64::can_check_for_function_pointers): New function.
5666 * gc.h (gc_process_relocs): Scan relocation types to determine if
5667 function pointers were taken for targets that support it.
5668 * icf.cc (Icf::find_identical_sections): Include functions for
5669 folding in safe ICF whose pointer is not taken.
5670 * icf.h (Secn_fptr_taken_set): New typedef.
5671 (fptr_section_id_): New member.
5672 (section_has_function_pointers): New function.
5673 (set_section_has_function_pointers): New function.
5674 (check_section_for_function_pointers): New function.
5675 * options.h: Fix comment for safe ICF option.
5676 * target.h (can_check_for_function_pointers): New function.
5677 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5678 Modify icf_safe_test for X86-64.
5679 * testsuite/Makefile.in: Regenerate.
5680 * testsuite/icf_safe_so_test.cc: New file.
5681 * testsuite/icf_safe_so_test.sh: New file.
5682 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5683 (main): Change to take pointer to function kept_func_3.
5684 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5685 folding is done correctly for X86-64.
5686
5687 2010-02-12 David S. Miller <davem@davemloft.net>
5688
5689 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5690 is_symbolless parameter.
5691 (Output_reloc<SHT_REL>::is_symbolless): New.
5692 (Output_reloc<SHT_REL>::is_symbolless_): New.
5693 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5694 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5695 (Output_reloc<SHT_RELA>::is_symbolless): New.
5696 (Output_data_reloc::add_global): Handle is_symbolless.
5697 (Output_data_reloc::add_global_relative): Likewise.
5698 (Output_data_reloc::add_local): Likewise.
5699 (Output_data_reloc::add_local_relative): Likewise.
5700 (Output_data_reloc::add_symbolless_global_addend): New.
5701 (Output_data_reloc::add_symbolless_local_addend): New.
5702 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5703 is_symbolless.
5704 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5705 instead of ->is_relative_
5706 (Output_reloc::write): Likewise.
5707 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5708 (Output_reloc::write_rel): Simplify.
5709
5710 * sparc.cc (Target_sparc::Scan::local): Use
5711 ->add_symbolless_local_addend as needed.
5712 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5713 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5714 based upon relocation offset.
5715
5716 2010-02-11 Doug Kwan <dougkwan@google.com>
5717
5718 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5719 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5720 beginning of function.
5721 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5722 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5723 parameter is_32bit in calls to should_apply_static_reloc.
5724 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5725 (check_DATA): Add arm_abs_global.stdout.
5726 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5727 arm_abs_global.stdout): New rules.
5728 (MOSTLLYCLEANFILES): Add arm_abs_global
5729 * Makefile.in: Regenerate.
5730 * testsuite/arm_abs_global.s: New file.
5731 * testsuite/arm_abs_global.sh: Ditto.
5732 * testsuite/arm_abs_lib.s: Ditto.
5733
5734 2010-02-11 Ian Lance Taylor <iant@google.com>
5735
5736 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5737 Read_relocs task.
5738 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5739 Allocate_commons_task first.
5740 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5741 task, rather than symtab_lock_.
5742 (Gc_process_relocs::~Gc_process_relocs): New function.
5743 (Gc_process_relocs::is_runnable): Check this_blocker_.
5744 (Gc_process_relocs::locks): Use next_blocker_ rather than
5745 blocker_.
5746 (Scan_relocs::~Scan_relocs): New function.
5747 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5748 symtab_lock_.
5749 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5750 next_blocker_.
5751 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5752 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5753 constructor accordingly.
5754 (class Gc_process_relocs): Likewise.
5755 (class Scan_relocs): Likewise.
5756 * common.h (class Allocate_commons_task): Remove symtab_lock_
5757 field, and corresponding constructor parameter.
5758 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5759 symtab_lock_.
5760 (Allocate_commons_task::locks): Likewise.
5761
5762 2010-02-11 Ian Lance Taylor <iant@google.com>
5763
5764 * gold-threads.h (class Once): Define.
5765 (class Initialize_lock): Rewrite as child of Once.
5766 * gold-threads.cc (class Once_initialize): Define.
5767 (once_pointer_control): New static variable.
5768 (once_pointer, once_arg): New static variables.
5769 (c_run_once): New static function.
5770 (Once::Once, Once::run_once, Once::internal_run): New functions.
5771 (class Initialize_lock_once): Remove.
5772 (initialize_lock_control): Remove.
5773 (initialize_lock_pointer): Remove.
5774 (initialize_lock_once): Remove.
5775 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5776 (Initialize_lock::initialize): Rewrite.
5777 (Initialize_lock::do_run_once): New function.
5778 * archive.cc (Archive::interpret_header): Only clear name if it is
5779 not already empty.
5780 * fileread.cc: Include "gold-threads.h"
5781 (file_counts_lock): New static variable.
5782 (file_counts_initialize_lock): Likewise.
5783 (File_read::release): Only increment counts when using --stats.
5784 Use a lock around the increment.
5785 * parameters.cc (class Set_parameters_target_once): Define.
5786 (set_parameters_target_once): New static variable.
5787 (Parameters::Parameters): Move here from parameters.h.
5788 (Parameters::set_target): Rewrite.
5789 (Parameters::set_target_once): New function.
5790 (Parameters::clear_target): Move here and rewrite.
5791 * parameters.h (class Parameters): Update declarations. Add
5792 set_parameters_target_once_ field.
5793 (Parameters::Parameters): Move to parameters.cc.
5794 (Parameters::clear_target): Likewise.
5795 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5796 task.
5797 (Start_group::~Start_group): New function.
5798 (Start_group::is_runnable): New function.
5799 (Start_group::locks, Start_group::run): New functions.
5800 (Finish_group::run): Change saw_undefined to size_t.
5801 * readsyms.h (class Start_group): Define.
5802 (class Finish_group): Change saw_undefined_ field to size_t.
5803 (Finish_group::Finish_group): Remove saw_undefined and
5804 this_blocker parameters. Change all callers.
5805 (Finish_group::set_saw_undefined): New function.
5806 (Finish_group::set_blocker): New function.
5807 * symtab.h (class Symbol_table): Change saw_undefined to return
5808 size_t. Change saw_undefined_ field to size_t.
5809 * target-select.cc (Set_target_once::do_run_once): New function.
5810 (Target_selector::Target_selector): Initialize set_target_once_
5811 field. Don't initialize lock_ and initialize_lock_ fields.
5812 (Target_selector::instantiate_target): Rewrite.
5813 (Target_selector::set_target): New function.
5814 * target-select.h (class Set_target_once): Define.
5815 (class Target_selector): Update declarations. Make
5816 Set_target_once a friend. Remove lock_ and initialize_lock_
5817 fields. Add set_target_once_ field.
5818
5819 2010-02-10 Ian Lance Taylor <iant@google.com>
5820
5821 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5822 queueing any tasks.
5823 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5824 (queue_middle_tasks): Add all blockers before queueing any tasks.
5825 (queue_final_tasks): Likewise.
5826 * token.h (Task_token::add_blockers): New function.
5827 * object.h (Input_objects::number_of_relobjs): New function.
5828
5829 2010-02-10 Ian Lance Taylor <iant@google.com>
5830
5831 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5832 shared, not if not position independent.
5833 * x86_64.cc (Relocate::relocate_tls): Likewise.
5834 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5835 (tls_pie_pic_test): New target.
5836 * testsuite/Makefile.in: Rebuild.
5837
5838 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5839 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5840 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5841 * testsuite/Makefile.in: Rebuild.
5842
5843 2010-02-09 David S. Miller <davem@davemloft.net>
5844
5845 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5846 R_SPARC_RELATIVE using ->add_local_relative().
5847 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5848
5849 * output.h (Output_data_dynamic::add_section_size): New method
5850 that takes two Output_data objects.
5851 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5852 entry param. Handle it in initializers.
5853 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5854 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5855 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5856 arg.
5857 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5858 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5859 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5860 for dynrel_includes_plt.
5861 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5862 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5863 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5864 before .rela.plt
5865 (Target_sparc::do_finalize_sections): Update to pass true for
5866 dynrel_includes_plt.
5867 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5868 output before .rela.plt
5869 (Target_powerpc::do_finalize_sections): Update to pass true for
5870 dynrel_includes_plt when 32-bit.
5871
5872 2010-02-08 Doug Kwan <dougkwan@google.com>
5873
5874 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5875 method.
5876 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5877 Arm_relobj::scan_section_for_cortex_a8_stubs,
5878 Arm_relobj::do_relocation_section): Instead of calling
5879 Output_section::output_address, use faster
5880 Arm_relobj::simple_input_section_output_address.
5881
5882 2010-02-08 David S. Miller <davem@davemloft.net>
5883
5884 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5885 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5886 relocation helper function.
5887
5888 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5889 just like R_SPARC_GOT{10,13,22}.
5890 (Target_sparc::Scan::local): Likewise.
5891 (Target_sparc::Relocate:relocate): Likewise.
5892
5893 2010-02-06 Ian Lance Taylor <iant@google.com>
5894
5895 * configure.ac: Rewrite targetobjs duplicate removal code to use
5896 only shell constructs.
5897 * configure: Rebuild.
5898
5899 2010-02-05 Doug Kwan <dougkwan@google.com>
5900
5901 PR 11247
5902 * arm.cc (Arm_relobj::section_is_scannable): New method.
5903 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5904 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5905
5906 2010-02-04 Doug Kwan <dougkwan@google.com>
5907
5908 PR 11247
5909 * arm-reloc-property.cc (cstdio): Include.
5910 * configure.ac (targetobjs): Remove duplicates.
5911 * configure: Regenerate.
5912 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5913 big and little endian version for a given address size.
5914
5915 2010-02-03 Doug Kwan <dougkwan@google.com>
5916
5917 * arm-reloc-property.cc
5918 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5919 definition.
5920 * arm-reloc-property.h
5921 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5922 New method definition.
5923 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5924 declaration.
5925 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5926 overflow to N.
5927 (GOT_PREL): Change implemented to Y.
5928 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5929 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5930 (Arm_relocate_functions::movw_abs_nc): Remove method.
5931 (Arm_relocate_functions::movt_abs): Ditto.
5932 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5933 (Arm_relocate_functions::thm_movt_abs): Ditto.
5934 (Arm_relocate_functions::movw_rel_nc): Ditto.
5935 (Arm_relocate_functions::movw_rel): Ditto.
5936 (Arm_relocate_functions::movt_rel): Ditto.
5937 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5938 (Arm_relocate_functions:thm_movw_rel): Ditto.
5939 (Arm_relocate_functions:thm_movt_rel): Ditto.
5940 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5941 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5942 New method definitions.
5943 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5944 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5945 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5946 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5947 (Target_arm::Relocate::relocate): Check for non-static or
5948 unimplemented relocation code and exit early. Change calls to
5949 Target_arm::reloc_uses_thumb_bit and
5950 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5951 instead. Refactor code to handle similar relocations to increase
5952 code sharing. Remove check for unsupported relocation code in switch
5953 statement.
5954 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5955 relocation property table to find out size. Change error message to
5956 print out the name of a relocation code instead of the numeric value.
5957 (Target_arm::scan_reloc_for_stub): Use relocation property table
5958 instead of calling Target_arm::reloc_uses_thumb_bit().
5959
5960 2010-02-02 Doug Kwan <dougkwan@google.com>
5961
5962 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5963 types of relaxed input section.
5964
5965 2010-02-02 Doug Kwan <dougkwan@google.com>
5966
5967 * Makefile.am (HFILES): Add arm-reloc-property.h.
5968 (DEFFILES): New.
5969 (TARGETSOURCES): Add arm-reloc-property.cc
5970 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5971 (libgold_a_SOURCES): $(DEFFILES)
5972 * Makefile.in: Regenerate.
5973 * arm-reloc-property.cc: New file.
5974 * arm-reloc-property.h: New file.
5975 * arm-reloc.def: New file.
5976 * arm.cc: Update comments.
5977 (arm-reloc-property.h): New included header.
5978 (arm_reloc_property_table): New global variable.
5979 (Target_arm::do_select_as_default_target): New method definition.
5980 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5981 arm-reloc-property to targ_extra_obj.
5982 * parameters.cc (set_parameters_target): Call
5983 Target::select_as_default_target().
5984 * target.h (Target::select_as_default_target): New method definition.
5985 (Target::do_select_as_default_target): Same.
5986
5987 2010-02-01 Doug Kwan <dougkwan@google.com>
5988
5989 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5990 first_output_text_section_.
5991 (Arm_exidx_fixup::first_output_text_section): New method definition.
5992 (Arm_exidx_fixup::first_output_text_section_): New data member.
5993 (Arm_exidx_fixup::process_exidx_section): Record the first text
5994 output section seen.
5995 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5996 and entsize in output section header.
5997
5998 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5999
6000 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6001 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6002 (Arm_relocate_functions::thm_alu11): New Method.
6003 (Arm_relocate_functions::thm_pc8): New Method.
6004 (Arm_relocate_functions::thm_pc12): New Method.
6005 (Target_arm::Scan::local): Handle the relocations.
6006 (Target_arm::Scan::global): Likewise.
6007 (Target_arm::Relocate::relocate): Likewise.
6008 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6009
6010 2010-01-29 Doug Kwan <dougkwan@google.com>
6011
6012 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6013 of relocation types as ld.
6014
6015 2010-01-29 Doug Kwan <dougkwan@google.com>
6016
6017 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6018 to public.
6019 (Arm_relocate_functions::thumb_branch_common): Ditto.
6020 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6021 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6022 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6023 Arm_relocate_functions::jump24): Remove.
6024 (Target_arm::Relocate::relocate): Adjust code to call
6025 Arm_relocation_functions::arm_branch_common and
6026 Arm_relocation_functions::thumb_branch_common instead of their removed
6027 wrappers. Merge switch-cases together to reduce source code size.
6028
6029 2010-01-29 Doug Kwan <dougkwan@google.com>
6030
6031 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6032 output_local_symbol_count_needs_update_.
6033 (Arm_relobj::output_local_symbol_count_needs_update,
6034 Arm_relobj::set_output_local_symbol_count_needs_update,
6035 Arm_relobj::update_output_local_symbol_count): New methods.
6036 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6037 member.
6038 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6039 of pointed function as in a R_ARM_PREL31 relocation.
6040 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6041 for output local symbol count updating.
6042 (Target_arm::do_relax): Update output local symbol counts in objects
6043 if necessary.
6044 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6045
6046 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6047
6048 * arm.cc: Added support for the ARM relocations:
6049 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6050 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6051 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6052 movw_prel_nc).
6053 (Arm_relocate_functions::movw_rel): New method.
6054 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6055 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6056 thm_movw_prel_nc).
6057 (Arm_relocate_functions::thm_movw_rel): New method.
6058 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6059 thm_movt_prel).
6060 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6061 relocations.
6062 (Target_arm::Scan::global): Likewise.
6063 (Target_arm::Relocate::relocate): Likewise.
6064 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6065 Likewise.
6066
6067 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6068
6069 * arm.cc: Added support for ARM group relocations.
6070 (Target_arm::reloc_needs_sym_origin): New method.
6071 (Arm_relocate_functions::calc_grp_kn): New method.
6072 (Arm_relocate_functions::calc_grp_residual): New method.
6073 (Arm_relocate_functions::calc_grp_gn): New method.
6074 (Arm_relocate_functions::arm_grp_alu): New Method.
6075 (Arm_relocate_functions::arm_grp_ldr): New Method.
6076 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6077 (Arm_relocate_functions::arm_grp_ldc): New Method.
6078 (Target_arm::Scan::local): Handle the ARM group relocations.
6079 (Target_arm::Scan::global): Likewise.
6080 (Target_arm::Relocate::relocate): Likewise.
6081 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6082 Likewise.
6083
6084 2010-01-26 Doug Kwan <dougkwan@google.com>
6085
6086 * arm.cc (set): Include.
6087 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6088 pointer type.
6089 (Arm_output_section::Text_section_list): New type.
6090 (Arm_output_section::append_text_sections_to_list): New method.
6091 (Arm_output_section::fix_exidx_coverage): Ditto.
6092 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6093 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6094 Relobj::set_section_offset() instead of
6095 Sized_relobj::invalidate_section_offset().
6096 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6097 parameter for section headers. Ignore relocation sections for
6098 unallocated sections and EXIDX sections.
6099 (Target_arm::fix_exidx_coverage): New method.
6100 (Target_arm::output_section_address_less_than): New type.
6101 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6102 linked text section instead of the EXIDX section.
6103 (Arm_output_section::create_stub_group): Add an assertion to check
6104 that this is not an EXIDX output section.
6105 (Arm_output_section::append_text_sections_to_list): New method.
6106 (Arm_output_section::fix_exidx_coverage): Ditto.
6107 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6108 Arm_relobj::section_needs_reloc_stub_scanning.
6109 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6110 first pass.
6111 (Target_arm::fix_exidx_coverage): New method.
6112 * object.h (Relobj::set_output_section): New method.
6113 (Sized_relobj::invalidate_section_offset): Remove method.
6114 (Sized_relobj::do_invalidate_section_offset): Remove method.
6115 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6116
6117 2010-01-25 Doug Kwan <dougkwan@google.com>
6118
6119 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6120 Fix warning due to signed and unsigned comparison on a 32-bit host.
6121
6122 2010-01-22 Doug Kwan <dougkwan@google.com>
6123
6124 * arm.cc (Target_arm::do_relax): Record an output section for section
6125 offset adjustment it contains any stub table that has changed.
6126 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6127 offsets in an output section if necessary.
6128 * output.cc (Output_section::Output_section): Initialize
6129 section_offsets_need_adjustments_.
6130 (Output_section::add_input_section_for_script): Renamed to
6131 Output_section::add_simple_input_section.
6132 (Output_section::save_states): Add a comment.
6133 (Output_section::discard_states): New method defintion.
6134 (Output_section::adjust_section_offsets): Same.
6135 * output.h (Output_section::add_input_section_for_script): Renamed to
6136 Output_section::add_simple_input_section.
6137 (Output_section::discard_states): New method declaration.
6138 (Output_section::adjust_section_offsets): Same.
6139 (Output_section::section_offsets_need_adjustment,
6140 Output_section::set_section_offsets_need_adjustment): New method
6141 definitions.
6142 (Output_section::section_offsets_need_adjustment_): New data member.
6143 * script-sections.cc
6144 (Output_section_element_input::set_section_address): Adjust code for
6145 renaming of Output_section::add_input_section_for_script.
6146 (Orphan_output_section::set_section_address): Same.
6147
6148 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6149
6150 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6151 Fix_v4bx enum values .
6152 * gold/options.h (General_options): New option definitions.
6153 (General_options::fix_v4bx): New method.
6154 (General_options::Fix_v4bx): New enum.
6155 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6156 (General_options::parse_fix_v4bx_interworking): New method.
6157
6158 2010-01-22 Doug Kwan <dougkwan@google.com>
6159
6160 * arm.cc (Arm_exidx_fixup): New class.
6161
6162 2010-01-21 Doug Kwan <dougkwan@google.com>
6163
6164 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6165 classes.
6166 (Arm_exidx_section_offset_map): New type.
6167
6168 2010-01-21 Doug Kwan <dougkwan@google.com>
6169
6170 * arm.cc (Arm_exidx_input_section): New class.
6171 (Arm_relobj::exidx_input_section_by_link,
6172 Arm_relobj::exidx_input_section_by_shndx,
6173 Arm_relobj::make_exidx_input_section): New methods.
6174 (read_arm_attributes_section): Remove.
6175 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6176 information about them.
6177 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6178 to here.
6179
6180 2010-01-20 Doug Kwan <dougkwan@google.com>
6181
6182 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6183 Input_section_specifier to Section_id.
6184 (Target_arm::new_arm_input_section: Adjust code for change of key
6185 type.
6186 (Target_arm::find_arm_input_section): Ditto.
6187 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6188 (Section_id): Remove.
6189 (Garbage_collection::Section_id_hash): Remove.
6190 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6191 (Section_id): Remove.
6192 (Icf::Section_id_hash): Remove.
6193 * object.h (Section_id, Const_section_id, Section_id_hash,
6194 Const_section_id_hash): New type definitions.
6195 * output.cc (Output_section::add_relaxed_input_section): Change to
6196 use Const_section_id instead of Input_section_specifier as key type.
6197 (Output_section::add_merge_input_section): Ditto.
6198 (Output_section::build_relaxation_map): Change to use Section_id
6199 instead of Input_section_specifier as key type.
6200 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6201 Ditto.
6202 (Output_section::convert_input_sections_to_relaxed_sections): Change
6203 to use Const_section_id instead of Input_section_specifier as key type.
6204 (Output_section::find_merge_section): Ditto.
6205 (Output_section::find_relaxed_input_section): Ditto.
6206 * output.h (Input_section_specifier): Remove class.
6207 (Output_section::Output_section_data_by_input_section_map): Change
6208 key type to Const_section_id.
6209 (Output_section::Output_relaxed_input_section_by_input_section_map):
6210 Ditto.
6211 (Output_section::Relaxation_map): Change key type to Section_id.
6212
6213 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6214
6215 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6216 (class Arm_v4bx_stub): New class.
6217 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6218 (Stub_factory::make_arm_v4bx_stub): New method.
6219 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6220 (Stub_table::empty): Handle v4bx stubs.
6221 (Stub_table::add_arm_v4bx_stub): New method.
6222 (Stub_table::find_arm_v4bx_stub): New method.
6223 (Arm_relocate_functions::v4bx): New method.
6224 (Target_arm::fix_v4bx): New method.
6225 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6226 (Stub_table::relocate_stubs): Likewise.
6227 (Stub_table::do_write): Likewise.
6228 (Stub_table::update_data_size_and_addralign): Likewise.
6229 (Stub_table::finalize_stubs): Likewise.
6230 (Target_arm::Scan::local): Likewise.
6231 (Target_arm::Scan::global): Likewise.
6232 (Target_arm::do_finalize_sections): Likewise.
6233 (Target_arm::Relocate::relocate): Likewise.
6234 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6235 Likewise.
6236 (Target_arm::scan_reloc_for_stub): Likewise.
6237 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6238
6239 2010-01-19 Ian Lance Taylor <iant@google.com>
6240
6241 * output.cc (Output_section_headers::do_sized_write): Write large
6242 segment count to sh_info field.
6243 (Output_file_header::do_sized_write): For large segment count,
6244 write PN_XNUM to e_phnum field.
6245
6246 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6247
6248 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6249 (Arm_relocate_functions::thm_jump8): New function.
6250 (Arm_relocate_functions::thm_jump11): New function.
6251 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6252 R_ARM_THM_JUMP11.
6253 (Target_arm::Scan::global): Likewise.
6254 (Target_arm::Relocate::relocate): Likewise.
6255 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6256 Likewise.
6257
6258 2010-01-14 Doug Kwan <dougkwan@google.com>
6259
6260 * arm.cc (map, utility): Include headers.
6261 (Target_arm::apply_cortex_a8_workaround): New method.
6262 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6263 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6264 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6265 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6266 the --[no-]fix-cortex-a8 command line options.
6267 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6268 (Target_arm::relocate_stub): Use addend in instruction template.
6269 * options.h (DEFINE_bool): Set the user-set flag.
6270 (General_options): Add --[no-]-fix-cortex options.
6271 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6272 : Update fast look-up map after conversion.
6273
6274 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6275
6276 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6277 in the first pass of do_layout.
6278
6279 2010-01-13 Doug Kwan <dougkwan@google.com>
6280
6281 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6282 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6283 apparent compiler problem of not folding static constant integral
6284 data members of elfcpp::Elf_sizes<32>.
6285
6286 2010-01-13 Doug Kwan <dougkwan@google.com>
6287
6288 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6289 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6290 Arm_relobj::scan_section_for_cortex_a8_erratum,
6291 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6292 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6293 sections to scan for relocation stubs into a new method
6294 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6295 relocation and Cortex-A8 stub scanning.
6296 (Target_arm::do_relax): Force stubs to be after stubbed sections
6297 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6298 the beginning of a new relaxation pass. Update a comment.
6299 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6300
6301 2010-01-12 Ian Lance Taylor <iant@google.com>
6302
6303 * target-reloc.h (visibility_error): New inline function.
6304 (relocate_section): Call visibility_error.
6305 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6306 (MOSTLYCLEANFILES): Likewise.
6307 (protected_4_pic.o, protected_3.err): New targets.
6308 * testsuite/protected_4.cc: New file.
6309
6310 2010-01-12 Doug Kwan <dougkwan@google.com>
6311
6312 * arm.cc (Cortex_a8_reloc): New class.
6313 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6314 and cortex_a8_relocs_info_.
6315 (Target_arm::fix_cortex_a8): New method definition.
6316 (Target_arm::Cortex_a8_relocs_info): New type.
6317 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6318 New data member declarations.
6319 (Target_arm::scan_reloc_for_stub): Record information about
6320 relocations for THUMB branches that might be exempted from the
6321 Cortex-A8 workaround.
6322 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6323 at the beginning of a relaxation pass.
6324
6325 2010-01-12 Doug Kwan <dougkwan@google.com>
6326
6327 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6328 (Arm_relobj::Mapping_symbol_position,
6329 Arm_reloj::Mapping_symbol_position_less,
6330 Arm_relobj::Mapping_symbols_info): New types.
6331 (Target_arm::is_mapping_symbol_name): New method definition.
6332 (Arm_relobj::do_count_local_symbols): Save information about mapping
6333 symbols.
6334
6335 2010-01-11 Doug Kwan <dougkwan@google.com>
6336
6337 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6338 Arm_relocate_functions::thumb32_branch_upper,
6339 Arm_relocate_functions::thumb32_branch_lower,
6340 Arm_relocate_functions::thumb32_cond_branch_offset,
6341 Arm_relocate_functions::thumb32_cond_branch_upper,
6342 Arm_relocate_functions::thumb32_cond_branch_lower,
6343 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6344 branch offset encoding.
6345 (Arm_relocate_functions::thumb_branch_common): Use new branch
6346 offset encoding methods to avoid code duplication.
6347 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6348 (Stub_addend_reader::operator()): Use new branch encoding method
6349 to avoid code duplication.
6350
6351 2010-01-11 Doug Kwan <dougkwan@google.com>
6352
6353 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6354 (Target_arm::do_finalize_sections): Define special EXIDX section
6355 symbols only if referenced.
6356 * gc.h (Garbage_collection::add_reference): New method.
6357 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6358 code duplication.
6359
6360 2010-01-11 Ian Lance Taylor <iant@google.com>
6361
6362 * script.cc (Version_script_info::build_expression_list_lookup):
6363 Change complaing about duplicate wildcard match from error to
6364 warning.
6365
6366 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6367 of 2009-12-30.
6368 (Version_script_info::Version_script_info): Initialize globs_,
6369 default_version_, default_is_global_, and exact_. Don't
6370 initialize globals_ or locals_.
6371 (Version_script_info::build_lookup_tables): Build local symbols
6372 first.
6373 (Version_script_info::unquote): New function.
6374 (Version_script_info::add_exact_match): New function.
6375 (Version_script_info::build_expression_list_lookup): Remove lookup
6376 parameter. Add is_global parameter. Change all callers. Handle
6377 wildcard pattern specially. Unquote pattern. Call
6378 add_exact_match.
6379 (Version_script_info::get_name_to_match): New function.
6380 (Version_script_info::get_symbol_version): New function.
6381 (Version_script_info::get_symbol_version_helper): Remove.
6382 (Version_script_info::check_unmatched_names): Call unquote.
6383 * script.h (class Version_script_info): Change get_symbol_version
6384 to be non-inline and add is_global parameter; change all callers.
6385 Rewrite symbol_is_local. Update declarations. Define struct
6386 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6387 Remove globals_ and locals_ members. Add exact_, globs_,
6388 default_version_, is_global_.
6389 (Version_script_info::Glob): Remove pattern, add expression and
6390 is_global. Update constructor. Change all callers.
6391 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6392 default version.
6393 (Versions::symbol_section_contents): If a symbol is undefined, or
6394 defined in a dynamic object, set the version index to
6395 VER_NDX_LOCAL.
6396 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6397 symbol_is_local.
6398 (Symbol_table::add_from_pluginobj): Likewise.
6399 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6400
6401 2010-01-11 Doug Kwan <dougkwan@google.com>
6402
6403 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6404 (incremental_dump_LDADD): Add linking option for libintl.
6405 * Makefile.in: Regenerate.
6406
6407 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6408
6409 PR gold/11144
6410 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6411 instead of -Ds.
6412 * testsuite/Makefile.in: Regenerated.
6413
6414 2010-01-10 Doug Kwan <dougkwan@google.com>
6415
6416 * options.h (DEFINE_var): Use parentheses around argument varname__
6417 in macro body to avoid any unintended subsequent substitutions.
6418
6419 2010-01-10 Ian Lance Taylor <iant@google.com>
6420
6421 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6422 candidates before doing symbol resolution.
6423
6424 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6425 ODR candidates if only one is weak.
6426
6427 2010-01-08 Ian Lance Taylor <iant@google.com>
6428
6429 * script.cc (Version_script_info::build_expression_list_lookup):
6430 Don't warn about ambiguous version, just record the ambiguity.
6431 (Version_script_info::get_symbol_version_helper): Give error if
6432 version is ambiguous.
6433
6434 2010-01-08 Doug Kwan <dougkwan@google.com>
6435
6436 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6437 prev_data_size_ and prev_addralign_. Remove initializer for
6438 deleted data member has_been_changed_.
6439 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6440 to determine if the table is empty.
6441 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6442 Remove.
6443 (Stub_table::add_reloc_stub): Define method in class definition
6444 instead of just declaring it there.
6445 (Stub_table::add_cortex_a8_stub): New method definition.
6446 (Stub_table::update_data_size_and_addralign): Ditto.
6447 (Stub_table::finalize_stubs): Ditto.
6448 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6449 (Stub_table::do_addralign_): Return address alignment in the
6450 (Stub_table::do_reset_address_and_file_offset): Define method in
6451 class definition instead of declaring it there. Set current data
6452 size to be the data size of the previous pass.
6453 (Stub_table::set_final_data_size): Use current data size as the
6454 final data size.
6455 (Stub_table::relocate_stub): Change parameter type of stub from
6456 Reloc_stub pointer to Stub pointer.
6457 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6458 (Stub_table::Cortex_a8_stub_list): New typedef.
6459 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6460 Stub_table::prev_addralign_): New data member.
6461 (Arm_relobj::Arm_relobj): Initialize data member
6462 section_has_cortex_a8_workaround_.
6463 (Arm_relobj::section_has_cortex_a8_workaround,
6464 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6465 definitions.
6466 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6467 declarations.
6468 (Target_arm::relocate_stub): Change parameter type of stub from
6469 Reloc_stub pointer to Stub pointer.
6470 (Insn_template::size, Insn_template::alignment): Handle
6471 THUMB16_SPECIAL_TYPE.
6472 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6473 Stub_table::update_data_size_and_addralign,
6474 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6475 definitions.
6476 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6477 (Stub_table::do_write): Ditto.
6478 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6479
6480 2010-01-08 Ian Lance Taylor <iant@google.com>
6481
6482 PR 11108
6483 * symtab.h (class Symbol): Remove fields is_target_special_ and
6484 has_plt_offset_. Add field is_defined_in_discarded_section_.
6485 (Symbol::is_defined_in_discarded_section): New function.
6486 (Symbol::set_is_defined_in_discarded_section): New function.
6487 (Symbol::has_plt_offset): Rewrite.
6488 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6489 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6490 Don't initialize is_target_special_ or has_plt_offset_.
6491 Initialize is_defined_in_discarded_section_.
6492 (Symbol_table::add_from_relobj): If appropriate, set
6493 is_defined_in_discarded_section.
6494 * resolve.cc (Symbol::override_base_with_special): Don't test
6495 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6496 * target-reloc.h (relocate_section): Do special handling for
6497 symbols defined in discarded sections for global symbols as well
6498 as local symbols.
6499
6500 2010-01-08 Ian Lance Taylor <iant@google.com>
6501
6502 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6503 the SHT_SYMTAB case.
6504
6505 2010-01-08 Ian Lance Taylor <iant@google.com>
6506
6507 * object.cc (Sized_relobj::do_layout): Don't get confused if
6508 layout_eh_frame returns NULL.
6509
6510 2010-01-08 Ian Lance Taylor <iant@google.com>
6511
6512 PR 11084
6513 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6514 dynamic symbol table, use the normal symbol table.
6515 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6516 symbol table.
6517
6518 2010-01-08 Ian Lance Taylor <iant@google.com>
6519
6520 PR 11072
6521 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6522 sections.
6523
6524 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6525
6526 * version.cc (print_version): Change to "Copyright 2010".
6527
6528 2010-01-08 Ian Lance Taylor <iant@google.com>
6529
6530 PR 10287
6531 PR 11063
6532 * i386.cc (class Target_i386): Change return type of plt_section
6533 to be non-const.
6534 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6535 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6536 tls_desc_rel_ field.
6537 (Output_data_plt_i386::rel_tls_desc): New function.
6538 (Target_i386::rel_tls_desc_section): New function.
6539 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6540 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6541 R_386_TLS_DESC reloc in rel_tls_desc_section.
6542 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6543 Define struct Tlsdesc_info.
6544 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6545 (Target_x86_64::do_reloc_symbol_index): New function.
6546 (Target_x86_64::add_tlsdesc_info): New function.
6547 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6548 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6549 tlsdesc_rel_ field.
6550 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6551 all callers.
6552 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6553 (Target_x86_64::rela_tlsdesc_section): New function.
6554 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6555 handling.
6556 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6557 (Target_x86_64::do_reloc_addend): New function.
6558 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6559 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6560 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6561 (Output_reloc::type): New function.
6562 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6563 (Output_reloc::is_target_specific): New function.
6564 (Output_reloc::target_arg): New function.
6565 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6566 absolute relocs and target specific relocs.
6567 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6568 add_target_specific.
6569 (class Output_data_reloc) [SHT_RELA]: Likewise.
6570 * output.cc (Output_reloc::Output_reloc): Add four new versions
6571 for absolute relocs and target specific relocs.
6572 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6573 (Output_reloc::get_symbol_index): Likewise.
6574 (Output_reloc::local_section_offset): Check that local_sym_index_
6575 is not TARGET_CODE or 0.
6576 (Output_reloc::symbol_value): Likewise.
6577 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6578 reloc.
6579 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6580 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6581 functions.
6582 * layout.cc (add_target_dynamic_tags): Use output section for
6583 DT_PLTRELSZ and DT_JMPREL.
6584
6585 2010-01-07 Ian Lance Taylor <iant@google.com>
6586
6587 PR 11061
6588 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6589 function.
6590 (class Output_data_reloc_generic): Define.
6591 (class Output_data_reloc_base): Change base class to
6592 Output_data_reloc_generic. Change add() method to call
6593 bump_relative_reloc_count for a relative reloc. Remove
6594 sort_relocs_ field.
6595 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6596 to sort_relocs().
6597 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6598 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6599 appropriate.
6600 * layout.h (class Layout): Update declaration.
6601
6602 2010-01-07 Ian Lance Taylor <iant@google.com>
6603
6604 * output.h (class Output_data): Add const version of
6605 output_section and do_output_section.
6606 (class Output_section_data): Add const version of
6607 do_output_section.
6608 (class Output_section): Likewise.
6609 * layout.cc (Layout::add_target_dynamic_tags): New function.
6610 * layout.h (class Layout): Update declarations.
6611 * arm.cc (Target_arm::do_finalize_sections): Use
6612 add_target_dynamic_tags.
6613 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6614 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6615 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6616 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6617
6618 2010-01-07 Ian Lance Taylor <iant@google.com>
6619
6620 PR 11042
6621 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6622 object as needed.
6623
6624 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6625 Ian Lance Taylor <iant@google.com>
6626
6627 PR 11019
6628 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6629 Xindex::read_symtab_xindex.
6630
6631 2010-01-07 Doug Kwan <dougkwan@google.com>
6632
6633 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6634 (Insn_template::thumb16_bcond_insn): New method declaration.
6635 (Insn_template): Fix spelling.
6636 (Stub::thumb16_special): New method declaration.
6637 (Stub::do_write): Define virtual method which was previously pure
6638 virtual.
6639 (Stub::do_thumb16_special): New method declaration.
6640 (Stub::do_fixed_endian_write): New template member.
6641 (Reloc_stub::do_write): Remove.
6642 (Reloc_stub::do_fixed_endian_write): Remove.
6643 (Cortex_a8_stub): New class definition.
6644 (Stub_factory::make_cortex_a8_stub): New method definition.
6645 (Stub_factory::Stub_factory): Add missing static storage class
6646 qualifier for elf32_arm_stub_a8_veneer_blx.
6647
6648 2010-01-07 Ian Lance Taylor <iant@google.com>
6649
6650 PR 10980
6651 * options.h (class General_options): Add --warn-unresolved-symbols
6652 and --error-unresolved-symbols.
6653 * errors.cc (Errors::undefined_symbol): Implement
6654 --warn-unresolved-symbols.
6655
6656 * options.h (class General_options): Add -z text and -z textoff.
6657 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6658
6659 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6660
6661 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6662 (Garbage_collection::cident_sections): New function.
6663 (Garbage_collection::add_cident_section): New function.
6664 (Garbage_collection::cident_sections_): New member.
6665 (gc_process_relocs): Add references to sections whose names are C
6666 identifiers.
6667 * gold.h (cident_section_start_prefix): New constant.
6668 (cident_section_stop_prefix): New constant.
6669 (is_cident): New function.
6670 * layout.cc (Layout::define_section_symbols): Replace string constants
6671 with the newly defined constants.
6672 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6673 C identifiers.
6674 * testsuite/Makefile.am: Add gc_orphan_section_test.
6675 * testsuite/Makefile.in: Regenerate.
6676 * testsuite/gc_orphan_section_test.cc: New file.
6677 * testsuite/gc_orphan_section_test.sh: New file.
6678
6679 2010-01-06 Ian Lance Taylor <iant@google.com>
6680
6681 PR 10980
6682 * options.h (class General_options): Add --warn-shared-textrel.
6683 * layout.cc (Layout::finish_dynamic_section): Implement
6684 --warn-shared-textrel.
6685
6686 PR 10980
6687 * options.h (class General_options): Add --warn-multiple-gp.
6688
6689 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6690
6691 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6692 $(THREADSLIB) and $(LIBDL).
6693 * Makefile.in: Rebuild.
6694
6695 2010-01-06 Ian Lance Taylor <iant@google.com>
6696
6697 PR 10980
6698 * options.cc (General_options::parse_section_start): New function.
6699 (General_options::section_start): New function.
6700 (General_options::General_options): Initialize all members.
6701 * options.h: Include <map>
6702 (class General_options): Add --section-start. Add section_starts_
6703 member.
6704 * layout.cc (Layout::attach_allocated_section_to_segment): If
6705 --section-start was used, set the address of the segment. Remove
6706 local sort_sections.
6707 (Layout::relaxation_loop_body): If the address of the load segment
6708 has been set by --section-start, don't use it.
6709 * output.h (Output_segment::update_flags_for_output_section): New
6710 function.
6711 * output.cc (Output_segment::add_output_section): Call
6712 update_flags_for_output_section.
6713
6714 2010-01-05 Ian Lance Taylor <iant@google.com>
6715
6716 PR 10980
6717 * options.h (class General_options): Add --undefined-version.
6718 * script.cc (struct Version_expression): Add was_matched_by_symbol
6719 field.
6720 (Version_script_info::matched_symbol): New function.
6721 (Version_script_info::get_symbol_version_helper): Call
6722 matched_symbol.
6723 (Version_script_info::check_unmatched_names): New function.
6724 * script.h (class Version_script_info): Update declarations.
6725 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6726
6727 * options.h (class General_options): Use DEFINE_bool_alias for
6728 allow_multiple_definition.
6729 * resolve.cc (Symbol_table::should_override): Don't test
6730 allow_multiple_definition.
6731
6732 PR 10980
6733 * options.h (class General_options): Add --cref.
6734 * main.cc (main): Print cref table if --cref. Don't close mapfile
6735 until after printing cref table.
6736 * cref.cc: Include "symtab.h".
6737 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6738 (Cref_table_compare::operator()): New function.
6739 (Cref_inputs::gather_cref): New function.
6740 (filecol): New static const.
6741 (Cref_inputs::print_cref): New function.
6742 (Cref::print_cref): New function.
6743 * cref.h: Include <cstdio>.
6744 (class Cref): Update declarations.
6745 * mapfile.h (Mapfile::file): New function.
6746 * object.h (class Object): Define Symbols. Declare virtual
6747 do_get_global_symbols.
6748 (Object::get_global_symbols): New function.
6749 * object.cc (Input_objects::add_object): Pass object to cref_ if
6750 --cref.
6751 (Input_objects::archive_start): Likewise.
6752 (Input_objects::archive_stop): Likewise.
6753 (Input_objects::print_cref): New function.
6754 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6755 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6756 --cref.
6757 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6758 function.
6759 * plugin.h (class Sized_pluginobj): Update declarations.
6760
6761 2010-01-05 Ian Lance Taylor <iant@google.com>
6762
6763 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6764 to is_default_version. Rename insdef to insdefault.
6765 (Symbol_table::add_from_relobj): Rename def to is_default_version
6766 and local to is_forced_local.
6767 (Symbol_table::add_from_pluginobj): Likewise.
6768 (Symbol_table::add_from_dynobj): Likewise.
6769 (Symbol_table::define_special_symbol): Rename insdef to
6770 insdefault.
6771
6772 2010-01-04 Ian Lance Taylor <iant@google.com>
6773
6774 PR 10980
6775 * options.h (class General_options): Add
6776 --allow-multiple-definition and -z muldefs.
6777 * resolve.cc (Symbol_table::should_override): Don't warn about a
6778 multiple symbol definition if --allow-multiple-definition or -z
6779 muldefs.
6780
6781 PR 10980
6782 * options.h (class General_options): Add --add-needed and
6783 --copy-dt-needed-entries. Tweak --as-needed help entry.
6784 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6785 error if --copy-dt-needed-entries aka --add-needed is used and
6786 would cause a change in behaviour.
6787
6788 PR 10980
6789 * options.h (class General_options): Add -G as a short version of
6790 --shared. Add no-op options -assert, -g, and -i.
6791
6792 2010-01-04 Sriraman Tallam <tmsriram@google.com>
6793
6794 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6795 check for .text or .gnu.linkonce.t sections.
6796 * icf.cc (Icf::find_identical_sections): Ditto.
6797 Change the detection for mangled function name within the section
6798 name.
6799 * icf.h (is_section_foldable_candidate): New function.
6800
6801 2009-12-30 Ian Lance Taylor <iant@google.com>
6802
6803 PR 10980
6804 * options.h (class General_options): Permit two dashes with
6805 --retain-symbols-file.
6806
6807 2009-12-30 Ian Lance Taylor <iant@google.com>
6808
6809 PR 10979
6810 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6811 don't put the file header and segment headers in the text
6812 segment.
6813
6814 PR 10979
6815 * common.cc (Sort_commons::operator()): Stabilize sort when both
6816 entries are NULL.
6817 (Symbol_table::do_allocate_commons_list): When allocating common
6818 symbols, skip a symbol which is no longer common.
6819 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6820 an object before checking its type.
6821 * testsuite/common_test_2.c: New file.
6822 * testsuite/common_test_3.c: New file.
6823 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6824 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6825 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6826 (common_test_2_pic.o, common_test_2.so): New targets.
6827 (common_test_3_pic.o, common_test_3.so): New targets.
6828 * testsuite/Makefile.in: Rebuild.
6829
6830 PR 10979
6831 * script.cc (read_input_script): If we see a new SECTIONS clause,
6832 and we have added an input section, give an error.
6833 * layout.h (class Layout): Add have_added_input_section function.
6834 Add have_added_input_section_ field.
6835 * layout.cc (Layout::Layout): Initialize
6836 have_added_input_section_.
6837 (Layout::layout): Set have_added_input_section_.
6838 (Layout::layout_eh_frame): Likewise.
6839
6840 2009-12-30 Ian Lance Taylor <iant@google.com>
6841
6842 PR 10931
6843 * options.h (class General_options): Add --sort-common option.
6844 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6845 * common.cc (Sort_common): Add sort_order parameter to
6846 constructor. Add sort_order_ field.
6847 (Sort_commons::operator): Check sort_order_.
6848 (Symbol_table::allocate_commons): Determine the sort order.
6849 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6850 Change all callers.
6851 (Symbol_table::do_allocate_commons_list): Likewise.
6852
6853 2009-12-30 Ian Lance Taylor <iant@google.com>
6854
6855 PR 10916
6856 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6857 symbols from this object, don't change the visibility of an
6858 undefined symbol.
6859 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6860
6861 2009-12-30 Ian Lance Taylor <iant@google.com>
6862
6863 PR 10861
6864 * script.h (class Version_script_info): Define Language enum.
6865 Update declarations. Define Glob, Exact, and Lookup types. Add
6866 new fields globals_, locals_, and is_finalized_.
6867 * script.cc: Various formatting fixes.
6868 (class Parser_closure): Change language_stack_ from a vector of
6869 std::string to one of Version_script_info::Language. Adjust all
6870 uses accordingly.
6871 (class Lazy_demangler): Remove.
6872 (struct Version_expression): Change language from std::string to
6873 Version_script_info::Language.
6874 (Version_script_info::Version_script_info): New function.
6875 (Version_script_info::~Version_script_info): Don't call clear.
6876 (Version_script_info::finalize): New function.
6877 (Version_script_info::build_lookup_tables): New function.
6878 (Version_script_info::build_expression_list_lookup): New
6879 function.
6880 (Version_script_info::get_symbol_version_helper): Rewrite to use
6881 lookup tables.
6882 (Version_script_info::print_expression_list): Adjust to use
6883 Version_script_info::Language.
6884 (script_push_lex_into_version_mode): Check that the version script
6885 has not been finalized.
6886 (version_script_push_lang): Change language string to
6887 Version_script_info::Language.
6888 * options.cc (Command_line::version_script): New function.
6889 * options.h (class General_options): Add finalize_dynamic_list
6890 function. Change version_script from declaration to definition.
6891 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6892 * testsuite/version_script.map: Remove duplicate def of foo.
6893 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6894 version_script.map.
6895 * testsuite/Makefile.in: Rebuild.
6896
6897 2009-12-30 Ian Lance Taylor <iant@google.com>
6898
6899 PR 10843
6900 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6901 if the input symbol index is 0, make the output symbol index 0.
6902
6903 2009-12-30 Ian Lance Taylor <iant@google.com>
6904
6905 PR 10670
6906 * options.h (class General_options): Add -x/--discard-all.
6907 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6908 --discard-all. If the local symbol needs a dynamic entry, check
6909 that before handling --discard-locals.
6910
6911 2009-12-30 Ian Lance Taylor <iant@google.com>
6912
6913 PR 10450
6914 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6915 flags to PF_R.
6916 (Output_segment::add_output_section): Don't change the flags if
6917 the type is PT_TLS.
6918
6919 PR 10450
6920 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6921 GNU hash table if they need a dynamic value. Otherwise, don't add
6922 them if they are defined in a dynamic object or are forced local.
6923
6924 2009-12-29 Ian Lance Taylor <iant@google.com>
6925
6926 PR 10450
6927 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6928 .gnu.hash table for a 32-bit target.
6929
6930 PR 10450
6931 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6932 regular and a dynamic object only needs a dynamic symbol table
6933 entry if it is externally visible.
6934
6935 PR 10450
6936 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6937 constructor. Add global_offset_table_ field.
6938 (Target_i386::got_section): Set global_offset_table_.
6939 (Target_i386::do_finalize_sections): Set global_offset_table_
6940 size.
6941 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6942 in constructor. Add global_offset_table_ field.
6943 (Target_x86_64::got_section): Set global_offset_table_.
6944 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6945 size.
6946
6947 * layout.cc (Layout::Layout): Initialize increase_relro_.
6948 (Layout::get_output_section): Add is_relro, is_last_relro, and
6949 is_first_non_relro parameters. Change all callers.
6950 (Layout::choose_output_section): Likewise.
6951 (Layout::add_output_section_data): Likewise.
6952 (Layout::make_output_section): Likewise.
6953 (Layout::set_segment_offsets): Clear increase_relro when using a
6954 linker script.
6955 * layout.h (class Layout): Add increase_relro method. Add
6956 increase_relro_ field. Update declarations.
6957 * output.cc (Output_section::Output_section): Initialize
6958 is_last_relro_ and is_first_non_relro_.
6959 (Output_segment::add_output_section): Group relro sections is
6960 do_sort is true. Handle is_last_relro and is_first_non_relro.
6961 (Output_segment::maximum_alignment): Remove relro handling.
6962 (Output_segment::set_section_addresses): Add increase_relro
6963 parameter. Change all callers. Add initial alignment to align
6964 relro sections on separate page. Remove old relro handling.
6965 (Output_segment::set_section_list_addresses): Remove in_relro
6966 parameter. Change all callers.
6967 (Output_segment::set_offset): Add increase parameter. Change all
6968 callers. Remove old relro handling.
6969 * output.h (class Output_section): Add new methods: is_last_relro,
6970 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6971 Add is_last_relro_ and is_first_non_relro_ fields.
6972 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6973 Create separate .got.plt section. Call increase_relro.
6974 * x86_64.cc (Target_x86_64::got_section): Likewise.
6975 * testsuite/relro_script_test.t: Add .got.plt.
6976
6977 PR 10450
6978 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6979 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6980 (Layout::finalize): Call set_dynamic_symbol_size.
6981 (Layout::set_dynamic_symbol_size): New function.
6982 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6983 set_dynamic_symbol_size.
6984
6985 PR 10450
6986 * output.h (class Output_section): Add is_entsize_zero_ field.
6987 * output.cc (Output_section::Output_section): Initialize
6988 is_entsize_zero_.
6989 (Output_section::set_entsize): If two different entsizes are
6990 requested, force it to zero.
6991 (Output_section::add_input_section): Set flags for .debug_str
6992 before updating section flags. Set entsize.
6993 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6994 and SHF_STRING if all input sections have those flags.
6995
6996 2009-12-29 Rafael Espindola <espindola@google.com>
6997
6998 * main.cc (main): Fix the sys time reporting.
6999 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7000 reporting.
7001
7002 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7003
7004 * options.cc (General_options::parse_version): Allow -v to exit
7005 without an error if there is nothing to link.
7006
7007 2009-12-29 Ian Lance Taylor <iant@google.com>
7008
7009 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7010 using a version of gcc before 4.1.
7011 * configure: Rebuild.
7012
7013 2009-12-28 Chris Demetriou <cgd@google.com>
7014
7015 * attributes.cc (Output_attributes_section_data::do_write): Use
7016 std::vector::front rather than std::vector::data.
7017
7018 2009-12-28 Ian Lance Taylor <iant@google.com>
7019
7020 * symtab.h (class Symbol_table): Add enum Defined.
7021 * resolve.cc (Symbol_table::should_override): Add defined
7022 parameter. Change all callers. Test whether object is NULL
7023 before calling a method on it.
7024 (Symbol_table::report_resolve_problem): Add defined parameter.
7025 Change all callers.
7026 (Symbol_table::should_override_with_special): Likewise.
7027 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7028 parameter. Change all callers.
7029 (Symbol_table::do_define_in_output_data): Likewise.
7030 (Symbol_table::define_in_output_segment): Likewise.
7031 (Symbol_table::do_define_in_output_segment): Likewise.
7032 (Symbol_table::define_as_constant): Likewise.
7033 (Symbol_table::do_define_as_constant): Likewise.
7034 * script.h (class Symbol_assignment): Add is_defsym parameter to
7035 constructor; change all callers.
7036 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7037 parameter. Change all callers. Add is_defsym_ field.
7038 (class Parser_closure): Add parsing_defsym parameter to
7039 constructor; change all callers. Add parsing_defsym accessor
7040 function. Add parsing_defsym_ field.
7041
7042 2009-12-28 Ian Lance Taylor <iant@google.com>
7043
7044 * gold.cc (queue_middle_tasks): Fix formatting.
7045 * object.cc (Relobj::is_section_name_included): Likewise.
7046
7047 2009-12-23 Ian Lance Taylor <iant@google.com>
7048
7049 * i386.cc (Target_i386::do_calls_non_split): Recognize
7050 -fsplit-stack prologue for a function with a static chain.
7051 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7052 -fsplit-stack prologue when using %r11.
7053
7054 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7055
7056 * options.cc (General_options::parse_version): Make -v continue and do
7057 the link like GNU ld does.
7058
7059 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7060
7061 * Makefile.am (CCFILES): Add timer.cc.
7062 (HFILES): Add timer.h.
7063 * configure.ac: Check for sysconf and times.
7064 * main.cc: include timer.h.
7065 (main): Use Timer instead of get_run_time.
7066 * timer.cc: New.
7067 * timer.h: New.
7068 * workqueue.cc: include timer.h.
7069 (Workqueue::find_and_run_task):
7070 Report user, sys and wall time.
7071 * Makefile.in: Regenerate.
7072 * config.in: Regenerate.
7073 * configure: Regenerate.
7074
7075 2009-12-16 Doug Kwan <dougkwan@google.com>
7076
7077 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7078 sections.
7079 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7080 relaxed input sections.
7081 * output.cc (Output_section::find_relaxed_input_section): Change
7082 return type to Output_relaxed_input_section pointer. Adjust code
7083 for new type of relaxed_input_section_map_.
7084 * output.h (Output_section::find_relaxed_input_section): Change
7085 return type to Output_relaxed_input_section pointer.
7086 (Output_section::Output_relaxed_input_section_by_input_section_map):
7087 New type.
7088 (Output_section::relaxed_input_section_map_): Change type to
7089 Output_section::Output_relaxed_input_section_by_input_section_map.
7090 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7091 input section.
7092
7093 2009-12-15 Ian Lance Taylor <iant@google.com>
7094
7095 * layout.cc (Layout::create_shstrtab): Only write out after input
7096 sections if we are compressing debug sections.
7097
7098 2009-12-15 Ian Lance Taylor <iant@google.com>
7099
7100 * archive.cc (Archive::add_symbols): Only look up a symbol without
7101 a version if there is, in fact, a version.
7102
7103 2009-12-14 Ian Lance Taylor <iant@google.com>
7104
7105 Revert -Wshadow changes, all changes from:
7106 2009-12-11 Doug Kwan <dougkwan@google.com>
7107 2009-12-11 Nick Clifton <nickc@redhat.com>
7108 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7109
7110 2009-12-11 Doug Kwan <dougkwan@google.com>
7111
7112 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7113 due to -Wshadow.
7114 * attributes.cc (Object_attribute::size): Ditto.
7115 (Attributes_section_data::size): Ditto.
7116 (Attributes_section_data::Attributes_section_data): Ditto.
7117 (Output_attributes_section_data::do_write): Ditto.
7118 * attributes.h (Object_attribute::set_type): Ditto.
7119 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7120
7121 2009-12-11 Nick Clifton <nickc@redhat.com>
7122
7123 * archive.cc: Fix shadowed variable warnings.
7124 * arm.cc: Likewise.
7125 * compressed_output.cc: Likewise.
7126 * compressed_output.h: Likewise.
7127 * configure: Likewise.
7128 * dwarf_reader.cc: Likewise.
7129 * dynobj.cc: Likewise.
7130 * dynobj.h: Likewise.
7131 * ehframe.cc: Likewise.
7132 * ehframe.h: Likewise.
7133 * errors.cc: Likewise.
7134 * expression.cc: Likewise.
7135 * fileread.cc: Likewise.
7136 * fileread.h: Likewise.
7137 * freebsd.h: Likewise.
7138 * i386.cc: Likewise.
7139 * icf.cc: Likewise.
7140 * incremental.h: Likewise.
7141 * layout.cc: Likewise.
7142 * layout.h: Likewise.
7143 * mapfile.cc: Likewise.
7144 * merge.cc: Likewise.
7145 * merge.h: Likewise.
7146 * object.cc: Likewise.
7147 * object.h: Likewise.
7148 * options.h: Likewise.
7149 * output.cc: Likewise.
7150 * output.h: Likewise.
7151 * parameters.cc: Likewise.
7152 * plugin.cc: Likewise.
7153 * powerpc.cc: Likewise.
7154 * reduced_debug_output.cc: Likewise.
7155 * reduced_debug_output.h: Likewise.
7156 * reloc.cc: Likewise.
7157 * reloc.h: Likewise.
7158 * resolve.cc: Likewise.
7159 * script-sections.cc: Likewise.
7160 * script.cc: Likewise.
7161 * script.h: Likewise.
7162 * sparc.cc: Likewise.
7163 * symtab.cc: Likewise.
7164 * symtab.h: Likewise.
7165 * target-select.cc: Likewise.
7166 * target-select.h: Likewise.
7167 * token.h: Likewise.
7168 * workqueue.cc: Likewise.
7169 * workqueue.h: Likewise.
7170 * x86_64.cc: Likewise.
7171
7172 2009-12-10 Doug Kwan <dougkwan@google.com>
7173
7174 * arm.cc (attributes.h): New include.
7175 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7176 (Arm_relobj::~Arm_relobj): Delete object pointed by
7177 attributes_section_data_.
7178 (Arm_relobj::attributes_section_data): New method definition.
7179 (Arm_relobj::attributes_section_data_): New data member declaration.
7180 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7181 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7182 attributes_section_data_.
7183 (Arm_dynobj::attributes_section_data): New method definition.
7184 (Arm_dynobj::attributes_section_data_): New data member declaration.
7185 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7186 initialization value of may_use_blx_ to false.
7187 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7188 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7189 object attributes to compute results instead of hard-coding.
7190 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7191 Target_arm::get_secondary_compatible_arch,
7192 Target_arm::set_secondary_compatible_arch
7193 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7194 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7195 New method declarations.
7196 (Target_arm::get_aeabi_object_attribute): New method definition.
7197 (Target_arm::attributes_section_data_): New data member declaration.
7198 (read_arm_attributes_section): New template definition.
7199 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7200 (Arm_dynobj::do_read_symbols): Ditto.
7201 (Target_arm::do_finalize_sections): Merge attributes sections from
7202 input. Check for BLX use after attributes section merging.
7203 Fix __exidx_start and __exidx_end visibility. Create an
7204 .ARM.attributes section if necessary.
7205 (Target_arm::get_secondary_compatible_arch,
7206 Target_arm::set_secondary_compatible_arch,
7207 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7208 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7209 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7210 New method definitions.
7211
7212 2009-12-09 Ian Lance Taylor <iant@google.com>
7213
7214 * plugin.cc (Plugin::load): Don't cast from void* to a function
7215 pointer.
7216
7217 2009-12-09 Ian Lance Taylor <iant@google.com>
7218
7219 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7220 information fields.
7221
7222 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7223
7224 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7225 Replace two_file_shared_1.so with two_file_shared_2.so.
7226 * testsuite/Makefile.in: Regenerated.
7227
7228 2009-12-08 Doug Kwan <dougkwan@google.com>
7229
7230 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7231 (HFILES): Add attributes.h and int_encoding.h.
7232 * Makefile.in: Regenerate.
7233 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7234 function definitions to int_encoding.cc
7235 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7236 prototypes to int_encoding.h
7237 * reduced_debug_output.cc (int_encoding.h): New include.
7238 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7239 function definitions to int_encoding.cc
7240 (insert_into_vector, read_from_pointer): Move template definitions to
7241 int_encoding.h
7242 * attributes.cc: New file.
7243 * attributes.h: New file.
7244 * int_encoding.cc: New file.
7245 * int_encoding.h: New file.
7246
7247 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7248
7249 PR gold/11055
7250 * incremental-dump.cc (dump_incremental_inputs): New.
7251 (main): Use dump_incremental_inputs.
7252
7253 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7254
7255 PR gold/10893
7256 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7257 checking elfcpp::STT_FUNC.
7258 (Target_i386::Relocate::relocate): Likewise.
7259 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7260
7261 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7262 symbols from shared libraries into normal FUNC symbols.
7263
7264 * symtab.h (Symbol): Add is_func and use it.
7265
7266 2009-12-05 Doug Kwan <dougkwan@google.com>
7267
7268 * arm.cc (Target_arm::arm_info): Initialize new fields
7269 attributes_section and attributes_vendor.
7270 * i386.cc (Target_i386::i386_info): Same.
7271 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7272 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7273 fields attributes_section and attributes_vendor.
7274 * sparc.cc (Target_sparc::sparc_info): Same.
7275 * target.h (Target::attributes_section, Target::attributes_vendor,
7276 Target::is_attributes_section, Target::attribute_arg_type,
7277 Target::attributes_order): New method definitions.
7278 (Target::Target_info::attributes_section,
7279 Target::Target_info::attributes_vendor): New fields.
7280 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7281 virtual method definitions.
7282 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7283 attributes_section and attributes_vendor.
7284 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7285
7286 2009-12-05 Doug Kwan <dougkwan@google.com>
7287
7288 * arm.cc: Update comments about interworking and stub generation.
7289 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7290 considered as non-PIC.
7291 (Arm_relocate_functions::base_abs): Fix formatting.
7292 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7293 of function to use GOT entry address instead of offset.
7294 (Target_arm::Scan::global): Issue an error if a symbol would need a
7295 PLT does not get one because it is untyped. Remove code to create
7296 dynamic symbols for relative branches.
7297 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7298 takes unsigned integer instead of boolean.
7299
7300 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7301
7302 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7303 (two_file_test_LDADD): Likewise.
7304 (common_test_1_LDADD): Likewise.
7305 (exception_test_LDADD) Likewise.
7306 (weak_test_LDADD): Likewise.
7307 (many_sections_test_LDADD): Likewise.
7308 (initpri1_LDADD): Likewise.
7309 (script_test_1_LDADD): Likewise.
7310 (script_test_2_LDADD): Likewise.
7311 (justsyms_LDADD): Likewise.
7312 (binary_test_LDADD): Likewise.
7313 (large_LDADD): Likewise.
7314 * testsuite/Makefile.in: Regenerated.
7315
7316 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7317
7318 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7319 (Symbol_table::override_with_special): Likewise.
7320 (Symbol_table::add_from_object): Likewise.
7321
7322 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7323
7324 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7325 Don't set the data_offset twice.
7326
7327 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7328
7329 * testsuite/Makefile.in: Regenerate.
7330
7331 2009-12-03 Doug Kwan <dougkwan@google.com>
7332
7333 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7334 (Target_arm::do_finalize_sections): Add parameter for symbol table
7335 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7336 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7337 parameter for symbol table pointer.
7338 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7339 an additional parameter for a pointer to symbol table.
7340 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7341 parameter for a symbol table pointer.
7342 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7343 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7344 Ditto.
7345 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7346 parameter for a symbol table pointer.
7347
7348 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7349
7350 * incremental.cc (Incremental_inputs_header)
7351 (Incremental_inputs_header_write, Incremental_inputs_entry)
7352 (Incremental_inputs_entry_write): Move ...
7353 * incremental.h (Incremental_inputs_header)
7354 (Incremental_inputs_header_write, Incremental_inputs_entry)
7355 (Incremental_inputs_entry_write): here.
7356
7357 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7358
7359 * incremental.cc (make_sized_incremental_binary): Set the target.
7360 Error if it is incompatible.
7361 * output.h (Output_file): Add filename method.
7362
7363 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7364
7365 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7366 from the get_* methods.
7367
7368 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7369
7370 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7371 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7372 Write 0 for the data_offset of scripts.
7373
7374 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7375
7376 * testsuite/Makefile.am: Add the incremental_test.sh test.
7377 * testsuite/incremental_test.sh: New.
7378 * testsuite/incremental_test_1.c: New.
7379 * testsuite/incremental_test_2.c: New.
7380
7381 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7382
7383 * incremental-dump.cc (main): Fix typos.
7384
7385 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7386
7387 PR gold/11025
7388 * incremental-dump.cc (main): Use llu to print 64 bit values.
7389
7390 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7391 H.J. Lu <hongjiu.lu@intel.com>
7392
7393 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7394 $(LIBDL).
7395 (incremental_dump_LDADD): Likewise.
7396 * Makefile.in: Regenerated.
7397
7398 2009-11-25 Doug Kwan <dougkwan@google.com>
7399
7400 Revert:
7401
7402 2009-11-25 Doug Kwan <dougkwan@google.com>
7403
7404 * arm.cc (Target_arm::Target_arm): Move method definition
7405 outside of class definition. Add code to handle
7406 --target1-rel, --target1-abs and --target2= options.
7407 (Target_arm::get_reloc_reloc_type): Change method to be
7408 non-static and const.
7409 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7410 New data member declaration.
7411 (Target_arm::Scan::local, Target_arm::Scan::global,
7412 Target_arm::Relocate::relocate,
7413 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7414 Adjust call to Target_arm::get_real_reloc_type.
7415 (Target_arm::get_real_reloc_type): Use command line options
7416 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7417 * options.h (--target1-rel, --target1-abs, --target2): New
7418 ARM-only options.
7419
7420 2009-11-25 Doug Kwan <dougkwan@google.com>
7421
7422 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7423 class definition. Add code to handle --target1-rel, --target1-abs
7424 and --target2= options.
7425 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7426 and const.
7427 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7428 member declaration.
7429 (Target_arm::Scan::local, Target_arm::Scan::global,
7430 Target_arm::Relocate::relocate,
7431 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7432 call to Target_arm::get_real_reloc_type.
7433 (Target_arm::get_real_reloc_type): Use command line options to
7434 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7435 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7436 options.
7437
7438 2009-11-25 Doug Kwan <dougkwan@google.com>
7439
7440 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7441 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7442 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7443 formatting.
7444 (Arm_relocate_functions::thm_call): Replace body with a call to
7445 Arm_relocate_functions::thumb_branch_common.
7446 (Arm_relocate_functions::thm_jump24,
7447 Arm_relocate_functions::thm_xpc22): New method definitions.
7448 (Arm_relocate_functions::thumb_branch_common): New method definition.
7449 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7450 operator.
7451 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7452 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7453
7454 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7455
7456 * Makefile.am: Build incremental-dump
7457 * Makefile.in: Regenerate.
7458 * incremental-dump.cc: New.
7459 * incremental.cc (Incremental_inputs_header_data,
7460 Incremental_inputs_entry_data): Move to incremental.h
7461 * incremental.h: (Incremental_inputs_header_data,
7462 Incremental_inputs_entry_data): Move from incremental.cc
7463
7464 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7465
7466 * incremental.cc (Incremental_inputs_header,
7467 Incremental_inputs_header_write, Incremental_inputs_entry,
7468 Incremental_inputs_entry_write): Add a typedef with the data type.
7469
7470 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7471
7472 * incremental.cc (Incremental_inputs_header,
7473 Incremental_inputs_header_write, Incremental_inputs_entry,
7474 Incremental_inputs_entry_write): Update comment about which
7475 type has the filed descriptions.
7476
7477 2009-11-15 Doug Kwan <dougkwan@google.com>
7478
7479 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7480 (Arm_relocate_functions::arm_branch_common): Change method defintion
7481 in class definition to a method declaration and update list of formal
7482 parameters.
7483 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7484 Arm_relocation_functions::jump24): Adjust call to
7485 Arm_relocate_functions::arm_branch_common. Update list of formal
7486 parameters.
7487 (Arm_relocate_functions::xpc25): New method definition.
7488 (Arm_relocate_functions::arm_branch_common): Move method defintion
7489 out from class definition. Use stubs for mode-switching and extending
7490 branch ranges.
7491 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7492 specially. Change code to enable use of stubs in ARM branches.
7493
7494 2009-11-10 Doug Kwan <dougkwan@google.com>
7495
7496 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7497 in method declaration.
7498 (Target_arm::relocate_stub): New method declaration.
7499 (Target_arm::default_target): Change to return a pointer instead of
7500 a const reference.
7501 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7502 Target_arm::default_target.
7503 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7504 method definition.
7505 (Target_arm::relocate_section): Adjust view.
7506 (Target_arm::relocate_stub): New method definition.
7507
7508 2009-11-10 Doug Kwan <dougkwan@google.com>
7509
7510 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7511 a format warning.
7512 * incremental.cc (open_incremental_binary): Initialized local
7513 variables to avoid warnings.
7514 * object.cc (make_elf_object): Ditto.
7515 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7516 a format warning.
7517
7518 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7519
7520 PR gold/10930
7521 * testsuite/plugin_test.c: Include "config.h".
7522
7523 2009-11-09 Doug Kwan <dougkwan@google.com>
7524
7525 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7526 (arm_symbol_value): Remove.
7527 (Arm_relocate_functions::arm_branch_common,
7528 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7529 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7530 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7531 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7532 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7533 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7534 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7535 Arm_relocate_functions::thm_mobw_abs_nc,
7536 Arm_relocate_functions::thm_mov_abs,
7537 Arm_relocate_functions::movw_prel_nc,
7538 Arm_relocate_functions::thm_movt_abs,
7539 Arm_relocate_functions::movt_prel,
7540 Arm_relocate_functions::thm_movw_prel_nc,
7541 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7542 (Target_arm::Relocate::relocate): Only decompose address into two
7543 parts if relocation type uses the thumb-bit and pass the actual
7544 bit instead of a flag indicating that the thumb-bit is used. Adjust
7545 calls to methods in Arm_relocate_functions for this change.
7546
7547 2009-11-08 Ian Lance Taylor <iant@google.com>
7548
7549 PR 10925
7550 * reloc.cc: Instantiate
7551 Sized_relobj::initialize_input_to_output_maps and
7552 Sized_relobj:free_input_to_output_maps.
7553
7554 2009-11-06 Ian Lance Taylor <iant@google.com>
7555
7556 PR 10876
7557 * defstd.cc (in_segment): Set only_if_ref true for "end".
7558
7559 2009-11-06 Doug Kwan <dougkwan@google.com>
7560
7561 * arm.cc (class Reloc_stub): Correct a comment.
7562 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7563 (Target_arm::scan_section_for_stubs): New method declaration.
7564 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7565 Change methods from private to protected.
7566 (Target_arm::do_may_relax): New method definition.
7567 (Target_arm::do_relax, Target_arm::group_sections,
7568 Target_arm::scan_reloc_for_stub,
7569 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7570 (Target_arm::arm_input_section_map_): New data member declaration.
7571 (Target_arm::scan_reloc_for_stub,
7572 Target_arm::scan_reloc_section_for_stubs,
7573 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7574 Target_arm::do_relax): New method definitions.
7575
7576 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7577
7578 * configure.ac: Check for (struct stat)::st_mtim
7579 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7580 * config.in: Regenerate.
7581 * configure: Regenerate.
7582
7583 2009-11-05 Ian Lance Taylor <iant@google.com>
7584
7585 PR 10910
7586 * output.cc (Output_segment::add_output_section): Add missing
7587 return statement.
7588
7589 2009-11-04 Ian Lance Taylor <iant@google.com>
7590
7591 PR 10880
7592 * object.h (class Object): Add is_needed and set_is_needed
7593 methods. Add is_needed_ field. Make bool fields into bitfields.
7594 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7595 defined in a dynamic object and referenced by a regular object,
7596 set is_needed for the dynamic object.
7597 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7598 if the file is marked with as_needed and it is not needed.
7599
7600 2009-11-04 Ian Lance Taylor <iant@google.com>
7601
7602 PR 10887
7603 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7604 tags if data is discarded by linker script.
7605 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7606 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7607 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7608 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7609
7610 2009-11-04 Ian Lance Taylor <iant@google.com>
7611
7612 * layout.cc (Layout::get_output_section): Add is_interp and
7613 is_dynamic_linker_section parameters. Change all callers.
7614 (Layout::choose_output_section): Likewise.
7615 (Layout::make_output_section): Likewise.
7616 (Layout::add_output_section_data): Add is_dynamic_linker_section
7617 parameter. Change all callers.
7618 * layout.h (class Layout): Update declarations.
7619 * output.h (class Output_section): Add is_interp, set_is_interp,
7620 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7621 Add is_interp_, is_dynamic_linker_section_ fields. Change
7622 generate_code_fills_at_write_ to a bitfield.
7623 * output.cc (Output_section::Output_sections): Initialize new
7624 fields.
7625 (Output_segment::add_output_section): Add do_sort parameter.
7626 Change all callers.
7627
7628 2009-11-03 Ian Lance Taylor <iant@google.com>
7629
7630 PR 10860
7631 * options.h (class General_options): Add --warn-common.
7632 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7633 merging two common symbols.
7634 (Symbol_table::should_override): Handle --warn-common when merging
7635 a common symbol with a defined symbol. Use report_resolve_problem
7636 for multiple definitions.
7637 (Symbol_table::report_resolve_problem): New function.
7638 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7639
7640 2009-11-03 Doug Kwan <dougkwan@google.com>
7641
7642 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7643 stub_factory_.
7644 (Target_arm::stub_factory): New method definition.
7645 (Target_arm::new_arm_input_section,
7646 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7647 Target_arm::reloc_uses_thumb_bit): New method declarations.
7648 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7649 New type definitions.
7650 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7651 member declarations.
7652 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7653 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7654 New method definitions.
7655
7656 2009-11-03 Ian Lance Taylor <iant@google.com>
7657
7658 * options.h (class General_options): Add --warn_constructors.
7659
7660 2009-11-03 Ian Lance Taylor <iant@google.com>
7661
7662 PR 10893
7663 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7664 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7665
7666 2009-11-03 Ian Lance Taylor <iant@google.com>
7667
7668 PR 10895
7669 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7670 --msgid-bugs-address.
7671 (install-pdf): New target.
7672 (install-data_yes): Look up one directory to find mkinstalldirs.
7673
7674 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7675
7676 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7677 tree.
7678
7679 2009-10-30 Doug Kwan <dougkwan@google.com>
7680
7681 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7682
7683 2009-10-30 Doug Kwan <dougkwan@google.com>
7684
7685 * arm.cc (Stub_addend_reader): New struct template definition
7686 and partial specializations.
7687 (Stub_addend_reader::operator()): New method definition for a
7688 partially specialized template.
7689
7690 2009-10-30 Doug Kwan <dougkwan@google.com>
7691
7692 * arm.cc (Arm_relobj::processor_specific_flags): New method
7693 definition.
7694 (Arm_relobj::do_read_symbols): New method declaration.
7695 (Arm_relobj::processor_specific_flags_): New data member declaration.
7696 (Arm_dynobj): New class definition.
7697 (Target_arm::do_finalize_sections): Add input_objects parameter.
7698 (Target_arm::do_adjust_elf_header): New method declaration.
7699 (Target_arm::are_eabi_versions_compatible,
7700 (Target_arm::merge_processor_specific_flags): New method declaration.
7701 (Target_arm::do_make_elf_object): New overloaded method definitions
7702 and declaration.
7703 (Arm_relobj::do_read_symbols): New method definition.
7704 (Arm_dynobj::do_read_symbols): Ditto.
7705 (Target_arm::do_finalize_sections): Add input_objects parameters.
7706 Merge processor-specific flags from all input objects.
7707 (Target_arm::are_eabi_versions_compatible,
7708 Target_arm::merge_processor_specific_flags,
7709 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7710 New method definitions.
7711 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7712 Input_objects pointer type parameter.
7713 * layout.cc (Layout::finalize): Pass input objects to target's.
7714 finalize_sections function.
7715 * output.cc (Output_file_header::do_sized_write): Set ELF file
7716 header's processor-specific flags.
7717 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7718 Input_objects pointer type parameter.
7719 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7720 * target.h (Input_objects): New forward class declaration.
7721 (Target::processor_specific_flags,
7722 Target::are_processor_specific_flags_sect): New method definitions.
7723 (Target::finalize_sections): Add input_objects parameter.
7724 (Target::Target): Initialize processor_specific_flags_ and
7725 are_processor_specific_flags_set_.
7726 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7727 parameter.
7728 (Target::set_processor_specific_flags): New method definition.
7729 (Target::processor_specific_flags_,
7730 Target::are_processor_specific_flags_set_): New data member
7731 declarations.
7732 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7733 Input_objects pointer type parameter.
7734
7735 2009-10-30 Doug Kwan <dougkwan@google.com>
7736
7737 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7738
7739 2009-10-28 Ian Lance Taylor <iant@google.com>
7740
7741 * object.h (class Relobj): Drop options parameter from
7742 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7743 do_scan_relocs, do_relocate. Change all callers.
7744 (class Sized_relobj): Drop options parameters from
7745 do_gc_process_relocs, do_scan_relocs, do_relocate,
7746 do_relocate_sections, relocate_sections, emit_relocs_scan,
7747 emit_relocs_scan_reltype. Change all callers.
7748 (struct Relocate_info): Remove options field and all references to
7749 it.
7750 * reloc.h (class Read_relocs): Remove options constructor
7751 parameter and options_ field. Change all callers.
7752 (class Gc_process_relocs, class Scan_relocs): Likewise.
7753 (class Relocate_task): Likewise.
7754 * target-reloc.h (scan_relocs): Remove options parameter. Change
7755 all callers.
7756 (scan_relocatable_relocs): Likewise.
7757 * target.h (class Sized_target): Remove options parameter from
7758 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7759 all callers.
7760 * gc.h (gc_process_relocs): Remove options parameter. Change all
7761 callers.
7762 * arm.cc: Update functions to remove options parameters.
7763 * i386.cc: Likewise.
7764 * powerpc.cc: Likewise.
7765 * sparc.cc: Likewise.
7766 * x86_64.cc: Likewise.
7767 * testsuite/testfile.cc: Likewise.
7768
7769 2009-10-28 Doug Kwan <dougkwan@google.com>
7770
7771 * arm.cc (Arm_relobj): New class definition.
7772 (Arm_relobj::scan_sections_for_stubs,
7773 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7774 New method definitions.
7775
7776 2009-10-28 Cary Coutant <ccoutant@google.com>
7777
7778 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7779 (Plugin::cleanup_done_): New member.
7780 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7781 (Plugin_manager::cleanup_done_): Remove.
7782 (Plugin_manager::add_input_file): Edit error message.
7783 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7784 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7785
7786 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7787
7788 * fileread.cc: (File_read::View::~View): Use the new
7789 data_ownership_ filed.
7790 (File_read::~File_read): Dispose the new whole_file_view_.
7791 (File_read::open): Mmap the whole file if needed.
7792 (File_read::open): Use whole_file_view_ instead of contents_.
7793 (File_read::find_view): Use whole_file_view_ if applicable.
7794 (File_read::do_read): Use whole_file_view_ instead of contents_.
7795 (File_read::make_view): Use whole_file_view_ instead of contents_,
7796 update File_read::View::View call.
7797 (File_read::find_or_make_view): Update File_read::View::View
7798 call.
7799 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7800 remove contents_
7801 (File_read::View::Data_ownership): New enum.
7802 (File_read::View::View): Replace bool mapped_ with Data_ownership
7803 argument.
7804 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7805 (File_read::View::data_ownership_): New field.
7806 (File_read::contents_): Remove (replaced by whole_file_view_).
7807 (File_read::whole_file_view_): New field.
7808 * options.h (class General_options): Add --keep-files-mapped.
7809
7810 2009-10-27 Cary Coutant <ccoutant@google.com>
7811
7812 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7813 * testsuite/Makefile.am (plugin_test_5): New test case.
7814 * testsuite/Makefile.in: Regenerate.
7815
7816 2009-10-25 Doug Kwan <dougkwan@google.com>
7817
7818 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7819 from private to protected to allow access by child class.
7820 (Sized_relobj::do_relocate_sections): New method declaration.
7821 (Sized_relobj::relocate_sections): Virtualize.
7822 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7823 Sized_relobj::relocate_sections. Instantiate template explicitly
7824 for different target sizes and endianity.
7825
7826 2009-10-24 Doug Kwan <dougkwan@google.com>
7827
7828 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7829 (Arm_input_section::as_arm_input_section): New method.
7830 (Arm_output_section): New class definition.
7831 (Arm_output_section::create_stub_group,
7832 Arm_output_section::group_sections): New method definitions.
7833
7834 2009-10-22 Doug Kwan <dougkwan@google.com>
7835
7836 * arm.cc (Arm_input_section): New class definition.
7837 (Arm_input_section::init, Arm_input_section:do_write,
7838 Arm_input_section::set_final_data_size,
7839 Arm_input_section::do_reset_address_and_file_offset): New method
7840 definitions.
7841
7842 2009-10-21 Doug Kwan <dougkwan@google.com>
7843
7844 * arm.cc (Stub_table, Arm_input_section): New forward class
7845 declarations.
7846 (Stub_table): New class defintion.
7847 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7848 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7849 New method definition.
7850
7851 2009-10-21 Doug Kwan <dougkwan@google.com>
7852
7853 * arm.cc: Update copyright comments.
7854 (Target_arm): New forward class template declaration.
7855 (Arm_address): New type.
7856 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7857 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7858 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7859 constants.
7860 (Insn_template): Same.
7861 (DEF_STUBS): New macro.
7862 (Stub_type): New enum type.
7863 (Stub_template): New class definition.
7864 (Stub): Same.
7865 (Reloc_stub): Same.
7866 (Stub_factory): Same.
7867 (Target_arm::Target_arm): Initialize may_use_blx_ and
7868 should_force_pic_veneer_.
7869 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7870 Target_arm::should_force_pic_veneer,
7871 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7872 Target_arm::using_thumb_only, Target_arm:;default_target): New
7873 method defintions.
7874 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7875 New data member declarations.
7876 (Insn_template::size, Insn_template::alignment): New method defintions.
7877 (Stub_template::Stub_template): New method definition.
7878 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7879 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7880 (Stub_factory::Stub_factory): New method definition.
7881 * gold.h (string_hash): New template.
7882 * output.h (Input_section_specifier::hash_value): Use
7883 gold::string_hash.
7884 (Input_section_specifier::string_hash): Remove.
7885 * stringpool.cc (Stringpool_template::string_hash): Use
7886 gold::string_hash.
7887
7888 2009-10-20 Doug Kwan <dougkwan@google.com>
7889
7890 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7891 symbols of relaxed input sections.
7892 * output.h (Output_section::find_relaxed_input_section): Make
7893 method public.
7894
7895 2009-10-16 Doug Kwan <dougkwan@google.com>
7896
7897 * dynobj.cc (Versions::Versions): Initialize version_script_.
7898 Only insert base version symbol definition for a shared object
7899 if version script defines any version versions.
7900 (Versions::define_base_version): New method definition.
7901 (Versions::add_def): Check that base version is not needed.
7902 (Versions::add_need): Define base version lazily.
7903 * dynobj.h (Versions::define_base_version): New method declaration.
7904 (Versions::needs_base_version_): New data member declaration.
7905 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7906 (check_DATA): Add no_version_test.stdout.
7907 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7908 New make rules.
7909 * testsuite/Makefile.in: Regenerate.
7910 * testsuite/no_version_test.c: New file.
7911 * testsuite/no_version_test.sh: Ditto.
7912
7913 2009-10-16 Doug Kwan <dougkwan@google.com>
7914
7915 * expression.cc (class Segment_start_expression): New class definition.
7916 (Segment_start_expression::value): New method definition.
7917 (script_exp_function_segment_start): Return a new
7918 Segment_start_expression.
7919 * gold/script-c.h (script_saw_segment_start_expression): New function
7920 prototype.
7921 * script-sections.cc (Script_sections::Script_sections): Initialize
7922 SAW_SEGMENT_START_EXPRESSION_ to false.
7923 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7924 and -Tbbs options to specify section addresses if given in
7925 command line and no SEGMENT_START expression is seen in a script.
7926 * script-sections.h (Script_sections::saw_segment_start_expression,
7927 Script_sections::set_saw_segment_start_expression): New method
7928 definition.
7929 (Script_sections::saw_segment_start_expression_): New data member
7930 declaration.
7931 * script.cc (script_saw_segment_start_expression): New function.
7932 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7933 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7934 script_test_7.sh and script_test_8.sh.
7935 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7936 script_test_8.stdout.
7937 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7938 (script_test_6, script_test_6.stdout, script_test_7,
7939 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7940 * Makefile.in: Regenerate.
7941 * testsuite/script_test_6.sh: New file.
7942 * testsuite/script_test_6.t: Same.
7943 * testsuite/script_test_7.sh: Same.
7944 * testsuite/script_test_7.t: Same.
7945 * testsuite/script_test_8.sh: Same.
7946
7947 2009-10-16 Doug Kwan <dougkwan@google.com>
7948
7949 * output.cc (Output_segment::set_section_list_address): Cast
7950 expressions to unsigned long long type to avoid format warnings.
7951
7952 2009-10-15 Ian Lance Taylor <iant@google.com>
7953
7954 * script.cc (Script_options::add_symbol_assignment): Always add a
7955 dot assignment to script_sections_.
7956 * script-sections.cc (Script_sections::add_dot_assignment):
7957 Initialize if necessary.
7958
7959 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7960 program headers with no load segment if there is a linker script.
7961
7962 * layout.cc (Layout::set_segment_offsets): Align the file offset
7963 to the segment aligment for -N or -n with no load segment.
7964 * output.cc (Output_segment::add_output_section): Don't crash if
7965 the first section is a TLS section.
7966 (Output_segment::set_section_list_addresses): Print an error
7967 message if the address moves backward in a linker script.
7968 * script-sections.cc
7969 (Output_section_element_input::set_section_addresses): Don't
7970 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7971 (Orphan_output_section::set_section_addresses): Likewise.
7972
7973 2009-10-15 Doug Kwan <dougkwan@google.com>
7974
7975 * layout.cc (Layout::finish_dynamic_section): Generate tags
7976 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7977 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7978 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7979
7980 2009-10-14 Ian Lance Taylor <iant@google.com>
7981
7982 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7983 fields.
7984 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7985 data_shdr fields of relinfo.
7986 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7987 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7988 R_386_TLS_LDO_32, adjust based on section flags.
7989 (Target_i386::Relocate::fix_up_ldo): Remove.
7990
7991 2009-10-13 Ian Lance Taylor <iant@google.com>
7992
7993 Add support for -pie.
7994 * options.h (class General_options): Add -pie and
7995 --pic-executable.
7996 (General_options::output_is_position_independent): Test -pie.
7997 (General_options::output_is_executable): Return true if not shared
7998 and not relocatable.
7999 (General_options::output_is_pie): Remove.
8000 * options.cc (General_options::finalize): Reject incompatible uses
8001 of -pie.
8002 * gold.cc (queue_middle_tasks): A -pie link is not static.
8003 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8004 * symtab.cc (Symbol::final_value_is_known): Return false if
8005 output_is_position_independent.
8006 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8007 output_is_position_independent.
8008 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8009 output_is_position_independent.
8010 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8011 output_is_position_independent.
8012 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8013 two_file_pie_test.
8014 (basic_pie_test.o, basic_pie_test): New targets.
8015 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8016 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8017 (two_file_pie_test): New target.
8018 * testsuite/Makefile.in: Rebuild.
8019 * README: Remove note saying that -pie is not supported.
8020
8021 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8022
8023 * options.h (class General_options): Add -init and -fini.
8024 * layout.cc (Layout::finish_dynamic_section): Emit
8025 given init and fini functions.
8026
8027 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8028
8029 * gc.h (gc_process_relocs): Check if icf is enabled using new
8030 function.
8031 * gold.cc (queue_initial_tasks): Likewise.
8032 (queue_middle_tasks): Likewise.
8033 * object.cc (do_layout): Likewise.
8034 * symtab.cc (is_section_folded): Likewise.
8035 * main.cc (main): Likewise.
8036 * reloc.cc (Read_relocs::run): Likewise.
8037 (Sized_relobj::do_scan_relocs): Likewise.
8038 * icf.cc (is_function_ctor_or_dtor): New function.
8039 (Icf::find_identical_sections): Check if function is ctor or dtor when
8040 safe icf is chosen.
8041 * options.h (General_options::icf): Change option to be an enum.
8042 (Icf_status): New enum.
8043 (icf_enabled): New method.
8044 (icf_safe_folding): New method.
8045 (set_icf_status): New method.
8046 (icf_status_): New variable.
8047 * (options.cc) (General_options::finalize): Set icf_status_.
8048 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8049 icf_test and icf_keep_unique_test to use the --icf enum flag.
8050 * testsuite/icf_safe_test.sh: New file.
8051 * testsuite/icf_safe_test.cc: New file.
8052
8053 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8054
8055 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8056 includes to gc.h and icf.h.
8057 * arm.cc: Include gc.h.
8058 * gold.cc: Likewise.
8059 * i386.cc: Likewise.
8060 * powerpc.cc: Likewise.
8061 * sparc.cc: Likewise.
8062 * x86_64.cc: Likewise.
8063 * gc.h: Include icf.h.
8064
8065 2009-10-11 Ian Lance Taylor <iant@google.com>
8066
8067 * plugin.cc: Include "gold.h" before other header files.
8068
8069 2009-10-10 Chris Demetriou <cgd@google.com>
8070
8071 * options.h (Input_file_argument::Input_file_type): New enum.
8072 (Input_file_argument::is_lib_): Replace with...
8073 (Input_file_argument::type_): New member.
8074 (Input_file_argument::Input_file_argument): Take Input_file_type
8075 'type' rather than boolean 'is_lib' as second argument.
8076 (Input_file_argument::is_lib): Use type_.
8077 (Input_file_argument::is_searched_file): New function.
8078 (Input_file_argument::may_need_search): Handle is_searched_file.
8079 * options.cc (General_options::parse_library): Support -l:filename.
8080 (General_options::parse_just_symbols): Update for Input_file_argument
8081 changes.
8082 (Command_line::process): Likewise.
8083 * archive.cc (Archive::get_file_and_offset): Likewise.
8084 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8085 * script.cc (read_script_file, script_add_file): Likewise.
8086 * fileread.cc (Input_file::Input_file): Likewise.
8087 (Input_file::will_search_for): Handle is_searched_file.
8088 (Input_file::open): Likewise.
8089 * readsyms.cc (Read_symbols::get_name): Likewise.
8090 * testsuite/Makefile.am (searched_file_test): New test.
8091 * testsuite/Makefile.in: Regenerate.
8092 * testsuite/searched_file_test.cc: New file.
8093 * testsuite/searched_file_test_lib.cc: New file.
8094
8095 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8096 Ian Lance Taylor <iant@google.com>
8097
8098 * descriptor.cc: Include <cstdio> and "binary-io.h".
8099 (Descriptors::open): Open the files in binary mode always.
8100 * script.cc (Lex::get_token): Treat \r as whitespace.
8101
8102 2009-10-09 Ian Lance Taylor <iant@google.com>
8103
8104 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8105
8106 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8107 Ian Lance Taylor <iant@google.com>
8108
8109 * configure.ac: Check for readv function also.
8110 * fileread.cc (readv): Define if not HAVE_READV.
8111 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8112 does not exist.
8113 * config.in: Regenerate.
8114 * configure: Regenerate.
8115
8116 2009-10-09 Doug Kwan <dougkwan@google.com>
8117
8118 * layout.cc (Layout::make_output_section): Call target hook to make
8119 ordinary output section.
8120 (Layout::finalize): Adjust parameter list of call the
8121 Target::may_relax().
8122 * layout.h (class Layout::section_list): New method.
8123 * merge.h (Output_merge_base::entsize): Change visibility to public.
8124 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8125 New methods.
8126 (Output_merge_string::do_is_string): New method.
8127 * object.cc (Sized_relobj::do_setup): renamed from
8128 Sized_relobj::set_up.
8129 * object.h (Sized_relobj::adjust_shndx,
8130 Sized_relobj::initializ_input_to_output_maps,
8131 Sized_relobj::free_input_to_output_maps): Change visibilities to
8132 protected.
8133 (Sized_relobj::setup): Virtualize.
8134 (Sized_relobj::do_setup): New method declaration.
8135 (Sized_relobj::invalidate_section_offset,
8136 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8137 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8138 * options.cc (parse_int): New function.
8139 * options.h (parse_int): New declaration.
8140 (DEFINE_int): New macro.
8141 (stub_group_size): New option.
8142 * output.cc (Output_section::Output_section): Initialize memebers
8143 merge_section_map_, merge_section_by_properties_map_,
8144 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8145 (Output_section::add_input_section): Handled deferred code-fill
8146 generation and remove an old comment.
8147 (Output_section::add_relaxed_input_section): New method definition.
8148 (Output_section::add_merge_input_section): Use merge section by
8149 properties map to speed to search. Update merge section maps
8150 as appropriate.
8151 (Output_section::build_relaxation_map): New method definition.
8152 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8153 Same.
8154 (Output_section::relax_input_section): Renamed to
8155 Output_section::convert_input_sections_to_relaxed_sections and change
8156 interface to take a vector of pointers to relaxed sections.
8157 (Output_section::find_merge_section,
8158 Output_section::find_relaxed_input_section): New method definitions.
8159 (Output_section::is_input_address_mapped,
8160 Output_section::output_offset, Output_section::output_address):
8161 Use output section data maps to speed up searching.
8162 (Output_section::find_starting_output_address): Add comments.
8163 (Output_section::do_write,
8164 Output_section::write_to_postprocessing_buffer): Do code-fill
8165 generation as appropriate.
8166 (Output_section::get_input_sections): Invalidate relaxed input section
8167 map.
8168 (Output_section::restore_states): Adjust type of checkpoint .
8169 Invalidate relaxed input section map.
8170 * output.h (Output_merge_base): New class declaration.
8171 (Input_section_specifier): New class defintion.
8172 (class Output_relaxed_input_section) Change base class to
8173 Output_section_data_build.
8174 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8175 base class initializer.
8176 (Output_section::add_relaxed_input_section): New method declaration.
8177 (Output_section::Input_section): Change visibility to protected.
8178 (Output_section::Input_section::relobj,
8179 Output_section::Input_section::shndx): Handle relaxed input sections.
8180 Output_section::input_sections) Change visibility to protected. Also
8181 define overload to return a non-const pointer.
8182 (Output_section::Merge_section_properties): New class defintion.
8183 (Output_section::Merge_section_by_properties_map,
8184 Output_section::Output_section_data_by_input_section_map,
8185 Output_section::Relaxation_map): New types.
8186 (Output_section::relax_input_section): Rename method to
8187 Output_section::convert_input_sections_to_relaxed_sections and change
8188 interface to take a vector of relaxed section pointers.
8189 (Output_section::find_merge_section,
8190 Output_section::find_relaxed_input_section,
8191 Output_section::build_relaxation_map,
8192 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8193 New method declarations.
8194 (Output_section::merge_section_map_
8195 Output_section::merge_section_by_properties_map_,
8196 Output_section::relaxed_input_section_map_,
8197 Output_section::is_relaxed_input_section_map_valid_,
8198 Output_section::generate_code_fills_at_write_): New data members.
8199 * script-sections.cc
8200 (Output_section_element_input::set_section_addresses): Call
8201 current_data_size and addralign methods of relaxed input sections.
8202 (Orphan_output_section::set_section_addresses): Call current_data_size
8203 and addralign methods of relaxed input sections.
8204 * symtab.cc (Symbol_table::compute_final_value): Extract template
8205 from the body of Symbol_table::sized_finalize_symbol.
8206 (Symbol_table::sized_finalized_symbol): Call
8207 Symbol_table::compute_final_value.
8208 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8209 (Symbol_table::compute_final_value): New templated method declaration.
8210 * target.cc (Target::do_make_output_section): New method defintion.
8211 * target.h (Target::make_output_section): New method declaration.
8212 (Target::relax): Add more parameters for input objects, symbol table
8213 and layout. Adjust call to do_relax.
8214 (Target::do_make_output_section): New method declaration.
8215 (Target::do_relax): Add parameters for input objects, symbol table
8216 and layout.
8217
8218 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8219
8220 * pread.c: Include stdio.h.
8221
8222 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8223
8224 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8225 defined.
8226
8227 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8228
8229 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8230 Change read_shndx type to unsigned int.
8231 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8232 int.
8233 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8234 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8235 Change read_shndx type to unsigned int.
8236 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8237 int.
8238 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8239 * layout.cc (Layout::create_symtab_sections): Cast the result of
8240 local_symcount * symsize to off_t in the gold_assert.
8241
8242 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8243
8244 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8245 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8246 R_ARM_BASE_ABS.
8247 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8248 (Arm_relocate_functions::thm_abs5): New function.
8249 (Arm_relocate_functions::abs12): New function.
8250 (Arm_relocate_functions::abs16): New function.
8251 (Arm_relocate_functions::base_abs): New function.
8252 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8253 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8254 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8255 R_ARM_BASE_ABS.
8256 (Scan::global): Likewise.
8257 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8258 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8259 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8260 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8261 R_ARM_BASE_ABS.
8262
8263 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8264
8265 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8266 (Arm_relocate_functions::movt_prel): New function.
8267 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8268 (Arm_relocate_functions::thm_movt_prel): New function.
8269 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8270 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8271 (Scan::global, Relocate::relocate): Likewise.
8272 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8273
8274 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8275
8276 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8277 Incremental_checker.
8278 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8279 unsigned int.
8280 (class Incremental_inputs_header): New class.
8281 (Incremental_inputs_header_writer): Edit comment.
8282 (Incremental_inputs_entry): New class.
8283 (Incremental_inputs_entry_writer): Edit comment.
8284 (Sized_incremental_binary::do_find_incremental_inputs_section):
8285 Add *strtab_shndx parameter, fill it.
8286 (Sized_incremental_binary::do_check_inputs): New method.
8287 (Incremental_checker::can_incrementally_link_output_file): Use
8288 Sized_incremental_binary::check_inputs.
8289 (Incremental_inputs::report_command_line): Save command line in
8290 command_line_.
8291 * incremental.h:
8292 (Incremental_binary::find_incremental_inputs_section): New
8293 method.
8294 (Incremental_binary::do_find_incremental_inputs_section): Add
8295 strtab_shndx parameter.
8296 (Incremental_binary::do_check_inputs): New pure virtual method.
8297 (Sized_incremental_binary::do_check_inputs): Declare.
8298 (Incremental_checker::Incremental_checker): Add incremental_inputs
8299 parameter, use it to initialize incremental_inputs_.
8300 (Incremental_checker::incremental_inputs_): New field.
8301 (Incremental_checker::command_line): New method.
8302 (Incremental_checker::inputs): New method.
8303 (Incremental_checker::command_line_): New field.
8304
8305 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8306
8307 * incremental.cc: Include <cstdarg> and "target-select.h".
8308 (vexplain_no_incremental): New function.
8309 (explain_no_incremental): New function.
8310 (Incremental_binary::error): New method.
8311 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8312 method.
8313 (make_sized_incremental_binary): New function.
8314 (open_incremental_binary): New function.
8315 (can_incrementally_link_file): Add checks if output is ELF and has
8316 inputs section.
8317 * incremental.h: Include "elfcpp_file.h" and "output.h".
8318 (Incremental_binary): New class.
8319 (Sized_incremental_binary): New class.
8320 (open_incremental_binary): Declare.
8321 * object.cc (is_elf_object): Use
8322 elfcpp::Elf_recognizer::is_elf_file.
8323 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8324 * output.h (Output_file::filesize): New method.
8325
8326 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8327
8328 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8329 New function.
8330 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8331 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8332 function.
8333 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8334 function.
8335 (Arm_relocate_functions::movw_abs_nc): New function.
8336 (Arm_relocate_functions::movt_abs): New function.
8337 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8338 (Arm_relocate_functions::thm_movt_abs): New function.
8339 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8340 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8341 (Scan::global): Likewise.
8342 (Relocate::relocate): Likewise.
8343 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8344
8345 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8346
8347 * arm.cc (Arm_relocate_functions::got_prel) New function.
8348 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8349 (Relocate::relocate): Likewise.
8350 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8351
8352 2009-10-06 Ian Lance Taylor <iant@google.com>
8353
8354 * options.h (class General_options): Define
8355 split_stack_adjust_size parameter.
8356 * object.h (class Object): Add uses_split_stack_ and
8357 has_no_split_stack_ fields. Add uses_split_stack and
8358 has_no_split_stack accessor functions. Declare
8359 handle_split_stack_section.
8360 (class Reloc_symbol_changes): Define.
8361 (class Sized_relobj): Define Function_offsets. Declare
8362 split_stack_adjust, split_stack_adjust_reltype, and
8363 find_functions.
8364 * object.cc (Object::handle_split_stack_section): New function.
8365 (Sized_relobj::do_layout): Call handle_split_stack_section.
8366 * dynobj.cc (Sized_dynobj::do_layout): Call
8367 handle_split_stack_section.
8368 * reloc.cc (Sized_relobj::relocate_sections): Call
8369 split_stack_adjust for executable sections in split_stack
8370 objects. Pass reloc_map to relocate_section.
8371 (Sized_relobj::split_stack_adjust): New function.
8372 (Sized_relobj::split_stack_adjust_reltype): New function.
8373 (Sized_relobj::find_functions): New function.
8374 * target-reloc.h: Include "object.h".
8375 (relocate_section): Add reloc_symbol_changes parameter. Change
8376 all callers.
8377 * target.h (class Target): Add calls_non_split method. Declare
8378 do_calls_non_split virtual method. Declare match_view and
8379 set_view_to_nop.
8380 * target.cc: Include "elfcpp.h".
8381 (Target::do_calls_non_split): New function.
8382 (Target::match_view): New function.
8383 (Target::set_view_to_nop): New function.
8384 * gold.cc (queue_middle_tasks): Give an error if mixing
8385 split-stack and non-split-stack objects with -r.
8386 * i386.cc (Target_i386::relocate_section): Add
8387 reloc_symbol_changes parameter.
8388 (Target_i386::do_calls_non_split): New function.
8389 * x86_64.cc (Target_x86_64::relocate_section): Add
8390 reloc_symbol_changes parameter.
8391 (Target_x86_64::do_calls_non_split): New function.
8392 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8393 parameter.
8394 * powerpc.cc (Target_powerpc::relocate_section): Add
8395 reloc_symbol_changes parameter.
8396 * sparc.cc (Target_sparc::relocate_section): Add
8397 reloc_symbol_changes parameter.
8398 * configure.ac: Call AM_CONDITIONAL for the default target.
8399 * configure: Rebuild.
8400 * testsuite/Makefile.am (TEST_AS): New variable.
8401 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8402 (check_DATA): Add split_i386 and split_x86_64 files.
8403 (SPLIT_DEFSYMS): Define.
8404 (split_i386_[1234n].o): New targets.
8405 (split_i386_[124]): New targets.
8406 (split_i386_[1234r].stdout): New targets.
8407 (split_x86_64_[1234n].o): New targets.
8408 (split_x86_64_[124]): New targets.
8409 (split_x86_64_[1234r].stdout): New targets.
8410 (MOSTLYCLEANFILES): Add new executables.
8411 * testsuite/split_i386.sh: New file.
8412 * testsuite/split_x86_64.sh: New file.
8413 * testsuite/split_i386_1.s: New file.
8414 * testsuite/split_i386_2.s: New file.
8415 * testsuite/split_i386_3.s: New file.
8416 * testsuite/split_i386_4.s: New file.
8417 * testsuite/split_i386_n.s: New file.
8418 * testsuite/split_x86_64_1.s: New file.
8419 * testsuite/split_x86_64_2.s: New file.
8420 * testsuite/split_x86_64_3.s: New file.
8421 * testsuite/split_x86_64_4.s: New file.
8422 * testsuite/split_x86_64_n.s: New file.
8423 * testsuite/testfile.cc (Target_test): Update relocation_section
8424 function.
8425 * testsuite/Makefile.in: Rebuild.
8426
8427 2009-10-06 Ian Lance Taylor <iant@google.com>
8428
8429 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8430 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8431 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8432 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8433 the address on ldo_addrs_.
8434 (Target_i386::Relocate::fix_up_ldo): New function.
8435
8436 2009-10-06 Rafael Espindola <espindola@google.com>
8437
8438 * plugin.cc (add_input_library): New.
8439 (Plugin::load): Add add_input_library to tv.
8440 (Plugin_manager::add_input_file): Add the is_lib argument.
8441 (add_input_file): Update call to Plugin_manager::add_input_file.
8442 (add_input_library): New.
8443 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8444
8445 2009-09-30 Doug Kwan <dougkwan@google.com>
8446
8447 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8448 symbol and call Symbol::may_need_copy_reloc to determine if
8449 a copy reloc is needed.
8450 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8451 nocopyreloc is given in command line.
8452 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8453 given in command line.
8454 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8455 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8456 of the removed Target_i386::may_need_copy_reloc.
8457 * options.h (copyreloc): New option with default value false.
8458 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8459 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8460 instead of the removed Target_powerpc::may_need_copy_reloc.
8461 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8462 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8463 instead of the removed Target_sparc::may_need_copy_reloc.
8464 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8465 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8466 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8467 instead of the removed Target_x86_64::may_need_copy_reloc.
8468
8469 2009-09-30 Ian Lance Taylor <iant@google.com>
8470
8471 * object.h (class Object): Remove target_ field, and target,
8472 sized_target, and set_target methods.
8473 (Object::sized_target): Remove.
8474 (class Sized_relobj): Update declarations. Remove sized_target.
8475 * object.cc (Sized_relobj::setup): Remove target parameter.
8476 Change all callers.
8477 (Input_objects::add_object): Don't do anything with the target.
8478 (make_elf_sized_object): Add punconfigured parameter. Change all
8479 callers. Set or test parameter target.
8480 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8481 Change all callers.
8482 * parameters.cc (Parameters::set_target): Change parameter type to
8483 be non-const.
8484 (Parameters::default_target): Remove.
8485 (set_parameters_target): Change parameter type to be non-const.
8486 (parameters_force_valid_target): New function.
8487 (parameters_clear_target): New function.
8488 * parameters.h (class Parameters): Update declarations. Remove
8489 default_target method. Add sized_target and clear_target
8490 methods. Change target_ to be non-const.
8491 (set_parameters_target): Update declaration.
8492 (parameters_force_valid_target): Declare.
8493 (parameters_clear_target): Declare.
8494 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8495 as NULL if we aren't searching.
8496 (Add_symbols::run): Don't check for compatible target.
8497 * fileread.cc (Input_file::open_binary): Call
8498 parameters_force_valid_target.
8499 * gold.cc (queue_middle_tasks): Likewise.
8500 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8501 set_target on object.
8502 * dynobj.h (class Sized_dynobj): Update declarations.
8503 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8504 make_elf_object returns NULL.
8505 (Archive::include_member): Don't check whether object target is
8506 compatible.
8507 * output.cc (Output_section::add_input_section): Get target from
8508 parameters.
8509 (Output_section::relax_input_section): Likewise.
8510 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8511 parameters.
8512 (Sized_relobj::do_scan_relocs): Likewise.
8513 (Sized_relobj::relocate_sections): Likewise.
8514 * resolve.cc (Symbol_table::resolve): Likewise.
8515 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8516 parameter. Change all callers.
8517 (Symbol_table::add_from_object): Get target from parameters.
8518 (Symbol_table::add_from_relobj): Don't check object target.
8519 (Symbol_table::add_from_dynobj): Likewise.
8520 (Symbol_table::define_special_symbol): Get target from
8521 parameters.
8522 * symtab.h (class Symbol_table): Update declaration.
8523 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8524 parameter. Change all callers. Clear parameter target.
8525 (Binary_test): Test target here.
8526 * testsuite/object_unittest.cc (gold_testsuite): Remove
8527 target_test_pointer parameter. Change all callers.
8528 (Object_test): Test target here.
8529
8530 2009-09-26 Ian Lance Taylor <iant@google.com>
8531
8532 * testsuite/initpri1.c: Don't try to use constructor priorities if
8533 compiling with gcc before 4.3.
8534
8535 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8536
8537 * testsuite/retain_symbols_file_test.sh (check_present): Change
8538 output file name to retain_symbols_file_test.stdout.
8539 (check_absent): Likewise.
8540
8541 2009-09-18 Craig Silverstein <csilvers@google.com>
8542
8543 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8544 * options.cc: Include <cerrno> and <fstream>.
8545 (General_options::finalize): Parse -retain-symbols-file tag.
8546 * options.h: New flag.
8547 (General_options): New method should_retain_symbol, new
8548 variable symbols_to_retain.
8549 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8550 should_retain_symbol map.
8551 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8552 * testsuite/Makefile.in: Regenerate.
8553 * testsuite/retain_symbols_file_test.sh: New file.
8554
8555 2009-09-18 Nick Clifton <nickc@redhat.com>
8556
8557 * po/es.po: Updated Spanish translation.
8558
8559 2009-09-17 Doug Kwan <dougkwan@google.com>
8560
8561 * debug.h (DEBUG_RELAXATION): New constant.
8562 (DEBUG_ALL): Add DEBUG_RELAXATION.
8563 (debug_string_to_enum): Add relaxation debug option.
8564 * layout.cc
8565 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8566 Layout::Relaxation_debug_check::read_sections,
8567 Layout::Relaxation_debug_check::read_sections): New method definitions.
8568 (Layout::Layout): Initialize data members
8569 record_output_section_data_from_scrips_,
8570 script_output_section_data_list_ and relaxation_debug_check_.
8571 (Layout::save_segments, Layout::restore_segments,
8572 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8573 Layout::relaxation_loop_body): New method definitions.
8574 (Layout::finalize): Support relaxation. Move section layout code to
8575 Layout::relaxation_loop_body.
8576 (Layout::set_asection_address_from_script): Move code for orphan
8577 section placement out.
8578 (Layout::place_orphan_sections_in_script): New method definition.
8579 * layout.h (Output_segment_headers, Output_file_header):
8580 New forward class declarations.
8581 (Layout::~Layout): Define.
8582 (Layout::new_output_section_data_from_script): New method definition.
8583 (Layout::place_orphan_sections_in_script): New method declaration.
8584 (Layout::Segment_states): New type declaration.
8585 (Layout::save_segments, Layout::restore_segments,
8586 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8587 Layout::relaxation_loop_body): New method declarations.
8588 (Layout::Output_section_data_list): New type declaration.
8589 (Layout::Relaxation_debug_check): New class definition.
8590 (Layout::record_output_section_data_from_script_,
8591 Layout::script_output_section_data_list_, Layout::segment_states_,
8592 Layout::relaxation_debug_check_): New data members.
8593 * output.cc: (Output_section_headers::do_size): New method definition.
8594 (Output_section_headers::Output_section_headers): Move size
8595 computation to Output_section_headers::do_size.
8596 (Output_segment_headers::do_size): New method definition.
8597 (Output_file_header::Output_file_header): Move size computation to
8598 Output_file_header::do_size and call it.
8599 (Output_file_header::do_size): New method definition.
8600 (Output_data_group::Output_data_group): Adjust call to
8601 Output_section_data.
8602 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8603 (Output_symtab_xindex::do_write): Add array bound check.
8604 (Output_section::Input_section::print_to_mapfile): Handle
8605 RELAXED_INPUT_SECTION_CODE.
8606 (Output_section::Output_section): Initialize data member checkpoint_.
8607 (Output_section::~Output_section): Delete checkpoint object pointed
8608 by checkpoint_.
8609 (Output_section::add_input_section): Always add an Input_section if
8610 relaxing.
8611 (Output_section::add_merge_input_section): Add assert.
8612 (Output_section::relax_input_section): New method definition.
8613 (Output_section::set_final_data_size): Set load address to zero for
8614 an unallocated section.
8615 (Output_section::do_address_and_file_offset_have_reset_values):
8616 New method definition.
8617 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8618 Handle relaxed input section.
8619 (Output_section::sort_attached_input_sections): Checkpoint input
8620 section list lazily.
8621 (Output_section::get_input_sections): Change type of input_sections to
8622 list of Simple_input_section pointers. Checkpoint input section list
8623 lazily. Also handle relaxed input sections.
8624 (Output_section::add_input_section_for_script): Take a reference to
8625 a Simple_input_section object instead of Relobj pointer and section
8626 index as parameter. Handle relaxed input sections.
8627 (Output_section::save_states, Output_section::restore_states): New
8628 method definitions.
8629 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8630 (Output_data::is_data_size_fixed): New method definition.
8631 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8632 if it is fixed.
8633 (Output_data::address_and_file_offset_have_reset_values): New method
8634 definition.
8635 (Output_data::do_address_and_file_offset_have_reset_values): New method
8636 definition.
8637 (Output_data::set_data_size): Check that data size is not fixed.
8638 (Output_data::fix_data_size): New method definition.
8639 (Output_data::is_data_size_fixed_): New data member.
8640 (Output_section_headers::set_final_data_size): New method definition.
8641 (Output_section_headers::do_size): New method declaration.
8642 (Output_segment_headers::set_final_data_size): New method definition.
8643 (Output_segment_headers::do_size): New method declaration.
8644 (Output_file_header::set_final_data_size)::New method definition.
8645 (Output_file_header::do_size)::New method declaration.
8646 (Output_section_data::Output_section_data): Add new parameter
8647 is_data_size_fixed and use it to fix data size.
8648 (Output_data_const::Output_data_const): Adjust call to base class
8649 constructor and fix data size.
8650 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8651 base class constructor and fix data size.
8652 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8653 base class constructor and fix data size.
8654 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8655 class constructor and fix data size.
8656 (Output_data_group::set_final_data_size): New method definition.
8657 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8658 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8659 class constructor and fix data size.
8660 (Output_relaxed_input_section): New class definition.
8661 (Output_section::Simple_input_section): New class definition.
8662 (Output_section::get_input_sections): Adjust parameter list.
8663 (Output_section::add_input_section_for_script): Same.
8664 (Output_section::save_states, Output_section::restore_states,
8665 Output_section::do_address_and_file_offset_have_reset_values,
8666 (Output_section::Input_section::Input_section): Handle
8667 RELAXED_INPUT_SECTION_CODE. Add new overload for
8668 Output_relaxed_input_section.
8669 (Output_section::Input_section::is_input_section,
8670 Output_section::Input_section::set_output_section): Handle relaxed
8671 input section.
8672 (Output_section::Input_section::is_relaxed_input_section,
8673 Output_section::Input_section::output_section_data,
8674 Output_section::Input_section::relaxed_input_section): New method
8675 definitions.
8676 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8677 value.
8678 (Output_section::Input_section::u1_): Update comments.
8679 (Output_section::Input_section::u2_): Add new union member poris.
8680 (Output_section::Checkpoint_output_section): New classs definition.
8681 (Output_section::relax_input_section): New method declaration.
8682 (Output_section::checkpoint_): New data member.
8683 (Output_segment): Update comments.
8684 (Output_segment::Output_segment): Un-privatize copy constructor.
8685 (Output_segment::operator=): Un-privatize.
8686 * script-sections.cc (Output_section_element::Input_section_list):
8687 Change element type to Output_section::Simple_input_section.
8688 (Output_section_element_dot_assignment::set_section_addresses):
8689 Register output section data for relaxation clean up.
8690 (Output_data_exression::Output_data_expression): Adjust call to base
8691 constructor to fix data size.
8692 (Output_section_element_data::set_section_addresses): Register
8693 Output_data_expression object for relaxation clean up.
8694 (struct Input_section_info): Replace Relobj pointer and section index
8695 pair with Output_section::Simple_input_section and Convert struct to a
8696 class.
8697 (Input_section_sorter::operator()): Adjust access to
8698 Input_section_info data member to use accessors.
8699 (Output_section_element_input::set_section_addresses): Use layout
8700 parameter. Adjust code to use Output_section::Simple_input_section
8701 and Input_secction_info classes. Register filler for relaxation
8702 clean up.
8703 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8704 and section index pair with Output_section::Simple_input_section
8705 class. Adjust code accordingly.
8706 (Phdrs_element::release_segment): New method definition.
8707 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8708 segment list.
8709 (Script_sections::release_segments): New method definition.
8710 * gold/script-sections.h (Script_sections::release_segments): New
8711 method declaration.
8712 * gold/target.h (Target::may_relax, Target::relax,
8713 Target::do_may_relax, Target::do_relax): New method definitions.
8714
8715 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8716
8717 * arm.cc (has_signed_unsigned_overflow): New function.
8718 (Arm_relocate_functions::abs8): New function.
8719 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8720 (Target_arm::Scan::global): Likewise.
8721 (Target_arm::relocate::relocate): Likewise.
8722 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8723 Likewise.
8724
8725 2009-09-16 Cary Coutant <ccoutant@google.com>
8726
8727 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8728 * testsuite/Makefile.in: Regenerate.
8729
8730 2009-09-11 Nick Clifton <nickc@redhat.com>
8731
8732 * po/gold.pot: Updated by the Translation project.
8733
8734 2009-09-08 Cary Coutant <ccoutant@google.com>
8735
8736 * output.cc (Output_file::open): Add execute permission to empty file.
8737 * testsuite/Makefile.am (permission_test): New test.
8738 * testsuite/Makefile.in: Regenerate.
8739
8740 2009-09-02 Ian Lance Taylor <iant@google.com>
8741
8742 * output.cc (Output_file::resize): Call map_no_anonymous rather
8743 than map.
8744
8745 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8746
8747 * gold.cc: Include "incremental.h".
8748 (queue_initial_tasks): Call Incremental_checker methods.
8749 * incremental.cc: Include "output.h".
8750 (Incremental_checker::can_incrementally_link_output_file): New
8751 method.
8752 * incremental.h (Incremental_checker): New class.
8753
8754 * output.cc (Output_file::open_for_modification): New method.
8755 (Output_file::map_anonymous): Changed return type to bool. Record
8756 map in base_ field.
8757 (Output_file::map_no_anonymous): New method, broken out of map.
8758 (Output_file::map): Use map_no_anonymous and map_anonymous.
8759 * output.h (class Output_file): Update declarations.
8760
8761 2009-08-24 Cary Coutant <ccoutant@google.com>
8762
8763 * options.h (Command_line::Pre_options): New class.
8764 (Command_line::pre_options): New member.
8765 * options.cc (gold::options::ready_to_register): New variable.
8766 (One_option::register_option): Do nothing if not registering options.
8767 Assert if same short option registered twice.
8768 (General_options::General_options): Turn off option registration when
8769 done constructing.
8770 (Command_line::Pre_options::Pre_options): New constructor.
8771
8772 2009-08-24 Cary Coutant <ccoutant@google.com>
8773
8774 * options.h (General_options::no_keep_memory): Remove incorrect
8775 short option.
8776
8777 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8778
8779 * Makefile.am (am__skiplex, am__skipyacc): New.
8780 * Makefile.in: Regenerate.
8781
8782 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8783
8784 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8785 (INCLUDES): ... this.
8786 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8787 (AM_CPPFLAGS): Renamed from ...
8788 (INCLUDE): ... this.
8789 * Makefile.in, testsuite/Makefile.in: Regenerate.
8790
8791 * Makefile.in: Regenerate.
8792 * aclocal.m4: Likewise.
8793 * config.in: Likewise.
8794 * configure: Likewise.
8795 * testsuite/Makefile.in: Likewise.
8796
8797 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8798 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8799 * Makefile.in: Regenerate.
8800 * testsuite/Makefile.in: Regenerate.
8801
8802 2009-08-19 Cary Coutant <ccoutant@google.com>
8803
8804 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8805 symbols in shared libraries overridden by hidden or internal symbols
8806 in the main program.
8807
8808 2009-08-19 Chris Demetriou <cgd@google.com>
8809
8810 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8811 checking source file names in error messages.
8812
8813 2009-08-18 Doug Kwan <dougkwan@google.com>
8814
8815 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8816 an elcpp::Ehdr as parameter. Adjust call to set_target.
8817 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8818 an elfcpp::Ehdr as parameter.
8819 * object.cc (Object::set_target): Remove the version that looks up
8820 a target and sets it.
8821 (Sized_relobj::setup): Take a Target object instead of
8822 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8823 (make_elf_sized_object): Find target and ask target to
8824 make an ELF object.
8825 * object.h: (Object::set_target): Remove the version that looks up
8826 a target and sets it.
8827 (Sized_relobj::setup): Take a Target object instead of
8828 an elfcpp:Ehdr as parameter.
8829 * target.cc: Include dynobj.h.
8830 (Target::do_make_elf_object_implementation): New.
8831 (Target::do_make_elf_object): New.
8832 * target.h (Target::make_elf_object): New template declaration.
8833 (Target::do_make_elf_object): New method declarations.
8834 (Target::do_make_elf_object_implementation): New template declaration.
8835
8836 2009-08-14 Ian Lance Taylor <iant@google.com>
8837
8838 * gold.h (FUNCTION_NAME): Define.
8839 (gold_unreachable): Use FUNCTION_NAME.
8840
8841 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8842
8843 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8844 symbol in the --keep-unique list is not found.
8845
8846 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8847
8848 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8849 been maked as --keep-unique.
8850 (Icf::unfold_section): New function.
8851 * icf.h (Icf::unfold_section): New function.
8852 * options.h (General_options::keep_unique): New option.
8853 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8854 * testsuite/Makefile.in: Regenerate.
8855 * testsuite/icf_keep_unique_test.sh: New file.
8856 * testsuite/icf_keep_unique_test.cc: New file.
8857
8858 2009-08-12 Cary Coutant <ccoutant@google.com>
8859
8860 PR 10471
8861 * resolve.cc (Symbol_table::resolve): Check for references from
8862 dynamic objects to hidden and internal symbols.
8863 * testsuite/Makefile.am (hidden_test.sh): New test.
8864 * testsuite/Makefile.in: Regenerate.
8865 * testsuite/hidden_test.sh: New script.
8866 * testsuite/hidden_test_1.c: New test source.
8867 * testsuite/hidden_test_main.c: New test source.
8868
8869 2009-08-11 Doug Kwan <dougkwan@google.com>
8870
8871 * arm.cc: Update comments.
8872 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8873 segment to locate the .ARM.exidx section if present.
8874
8875 2009-08-09 Doug Kwan <dougkwan@google.com>
8876
8877 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8878 patch.
8879
8880 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8881 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8882 compiler warnings.
8883
8884 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8885
8886 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8887 valid tls_segment only for non-debug-section relocations.
8888 * testsuite/Makefile.am: Add gc_tls_test.
8889 * testsuite/Makefile.in: Regenerate.
8890 * testsuite/gc_tls_test.cc: New file.
8891 * testsuite/gc_tls_test.sh: New file.
8892
8893 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8894
8895 * icf.cc: New file.
8896 * icf.h: New file.
8897 * Makefile.am (CCFILES): Add icf.cc.
8898 (HFILES): Add icf.h
8899 * Makefile.in: Regenerate.
8900 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8901 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8902 section, symbol and addend information for the relocs.
8903 * gold.cc (queue_middle_tasks): Call identical code folding.
8904 * gold.h: Add defines for multimap.
8905 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8906 to the call of finalize_local_symbols.
8907 * main.cc (main): Create object of class Icf.
8908 * object.cc (Sized_relobj::do_layout): Allow this function to be
8909 called twice during icf.
8910 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8911 to sections marked as identical by icf.
8912 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8913 when available.
8914 (Sized_relobj::do_section_entsize): New function.
8915 * object.h (Object::section_entsize): New function.
8916 (Object::do_section_entsize): New pure virtual function.
8917 (Relobj::finalize_local_symbols): Add new parameter.
8918 (Relobj::do_section_entsize): New function.
8919 * options.h (General_options::icf): New option.
8920 (General_options::icf_iterations): New option.
8921 (General_options::print_icf_sections): New option.
8922 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8923 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8924 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8925 icf.
8926 * symtab.cc (Symbol_table::is_section_folded): New function.
8927 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8928 to sections marked as identical by icf.
8929 * symtab.h (Symbol_table::set_icf): New function.
8930 (Symbol_table::icf): New function.
8931 (Symbol_table::is_section_folded): New function.
8932 (Symbol_table::icf_): New data member.
8933 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8934 * testsuite/Makefile.am: Add commands to build icf_test.
8935 * testsuite/Makefile.in: Regenerate.
8936 * testsuite/icf_test.sh: New file.
8937 * testsuite/icf_test.cc: New file.
8938
8939 2009-07-24 Chris Demetriou <cgd@google.com>
8940
8941 * layout.cc (is_compressible_debug_section): Fix incorrect
8942 comment about compressed section names.
8943
8944 2009-07-20 Ian Lance Taylor <ian@airs.com>
8945
8946 PR 10419
8947 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8948
8949 2009-07-16 Ian Lance Taylor <iant@google.com>
8950
8951 PR 10400
8952 * layout.h: #include <map>.
8953 (class Kept_section): Change from struct to class. Add accessors
8954 and setters. Add section size to Comdat_group mapping. Change
8955 Comdat_group to std::map. Add is_comdat_ field. Add
8956 linkonce_size field in union.
8957 (class Layout): Update declaration of find_or_add_kept_section.
8958 Don't declare find_kept_object.
8959 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8960 parameter. Add object, shndx, is_comdat, and is_group_name
8961 parameters. Change all callers. Adjust for new Kept_section.
8962 (Layout::find_kept_object): Remove.
8963 * object.cc (Sized_relobj::include_section_group): Update use of
8964 Kept_section. Rename secnum to shndx. Only record
8965 Kept_comdat_section if sections are the same size.
8966 (Sized_relobj::include_linkonce_section): Update use of
8967 Kept_section. Only record Kept_comdat_section if sections are the
8968 same size. Set size of linkonce section.
8969 (Sized_relobj::map_to_kept_section): Update call to
8970 get_kept_comdat_section.
8971 * object.h (class Sized_relobj): Rename fields in
8972 Kept_comdat_section to drop trailing underscores; change object
8973 field to Relobj*. Change Kept_comdat_section_table to store
8974 struct rather than pointer.
8975 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8976 Add kept_object and kept_shndx parameters. Change all callers.
8977 (Sized_relobj::get_kept_comdat_section): Change return type to
8978 bool. Add kept_object and kept_shndx parameters. Change all
8979 callers.
8980 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8981 Layout::find_or_add_kept_section.
8982
8983 2009-07-09 Ian Lance Taylor <iant@google.com>
8984
8985 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8986 Reserve space in the hash table.
8987
8988 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8989
8990 * fileread.cc (File_read::get_mtime): New method.
8991 * fileread.h (Timespec): New structure.
8992 (File_read::get_mtime): New method.
8993 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8994 Renamed from timestamp_nsec.
8995 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8996 Elf_Xword.
8997 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8998 timestamp_nsec.
8999 (Incremental_inputs::report_archive): Save mtime; style fix.
9000 (Incremental_inputs::report_obejct): Save mtime; style fix.
9001 (Incremental_inputs::report_script): Save mtime; style fix.
9002 (Incremental_inputs::finalize_inputs): Style fix.
9003 (Incremental_inputs::finalize): Style fix.
9004 (Incremental_inputs::create_input_section_data): Store inputs
9005 mtime.
9006 * incremental.h (Incremental_inputs::report_script): Add mtime
9007 argument.
9008 (Incremental_inputs::Input_info::Input_info): Intialize only one
9009 union member.
9010 (Incremental_inputs::Input_info::archive): Move to nameless
9011 union.
9012 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9013 (Incremental_inputs::Input_info::script): Move to nameless union.
9014 (Incremental_inputs::mtime): New field.
9015 * script.cc (read_input_script): Pass file mtime to
9016 Incremental_input.
9017 * script.h (Script_info::inputs): Style fix.
9018
9019 2009-07-01 Ian Lance Taylor <ian@airs.com>
9020
9021 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9022 instead of 32.
9023
9024 2009-06-24 Ian Lance Taylor <iant@google.com>
9025
9026 PR 10156
9027 * layout.cc (Layout::choose_output_section): If we find an
9028 existing section, update the flags.
9029 (Layout::create_notes): New function, broken out of
9030 Layout::finalize.
9031 (Layout::finalize): Don't create note sections.
9032 (Layout::create_note): Don't crash if linker script discards
9033 section.
9034 (Layout::create_gold_note): Likewise.
9035 (Layout::create_build_id): Likewise. Don't set
9036 after_input_sections on the section.
9037 (Layout::create_executable_stack_info): Remove target parameter.
9038 Change caller.
9039 * layout.h (class Layout): Declare create_notes. Update
9040 declaration of create_executable_stack_info.
9041 * gold.cc (queue_middle_tasks): Call create_notes.
9042 * output.cc (Output_section::update_flags_for_input_section): Move
9043 here from output.h. If SHF_ALLOC flag is newly set, mark address
9044 invalid.
9045 * output.h (Output_data::mark_address_invalid): New function.
9046 (class Output_section): Only declare, not define,
9047 update_flags_for_input_section. Remove set_flags.
9048
9049 2009-06-24 Ian Lance Taylor <iant@google.com>
9050
9051 * script-sections.cc (Output_section_definition::
9052 set_section_addresses): Rename shadowing local load_address to
9053 laddr.
9054
9055 2009-06-24 Ian Lance Taylor <iant@google.com>
9056
9057 PR 10244
9058 * reloc.cc (relocate_sections): Skip empty relocation sections.
9059
9060 2009-06-23 Ian Lance Taylor <iant@google.com>
9061
9062 PR 10156
9063 * layout.cc (Layout::create_note): Use choose_output_section
9064 rather than make_output_section.
9065
9066 2009-06-23 Ian Lance Taylor <iant@google.com>
9067
9068 PR 10237
9069 * options.cc (General_options::parse_V): Set printed_version_.
9070 (General_options::General_options): Initialize printed_version_.
9071 * options.h (class General_options): Add printed_version_ field.
9072 * gold.cc (queue_initial_tasks): If there are no input files,
9073 don't give a fatal error if we printed the version information.
9074 (queue_middle_tasks): If using -r with a shared object, give a
9075 fatal error rather than an ordinary error.
9076
9077 2009-06-23 Ian Lance Taylor <iant@google.com>
9078
9079 PR 10219
9080 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9081 (Layout::make_output_section): Set have_stabstr_section_ if we see
9082 a .stab*str section.
9083 (Layout::finalize): Call link_stabs_sections.
9084 (Layout::link_stabs_sections): New file.
9085 * layout.h (class Layout): Add have_stabstr_section_ field.
9086 Declare link_stabs_sections.
9087
9088 2009-06-23 Doug Kwan <dougkwan@google.com>
9089
9090 * Makefile.am (libgold_a_LIBADD): New.
9091 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9092 * Makefile.in: Regenerate.
9093 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9094 * configure: Regenerate.
9095 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9096 * fileread.cc: Include sys/state.h
9097 * gold.h: Declare memmem and strndup if found missing.
9098 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9099
9100 2009-06-23 Ian Lance Taylor <iant@google.com>
9101
9102 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9103 * configure: Rebuild.
9104
9105 2009-06-23 Ian Lance Taylor <iant@google.com>
9106
9107 PR 10147
9108 * object.cc (Object::section_contents): Don't try to get a view if
9109 the section has length zero.
9110 (Object::handle_gnu_warning_section): If the section is empty, use
9111 the name of the section as the warning.
9112
9113 2009-06-23 Ian Lance Taylor <iant@google.com>
9114
9115 PR 10133
9116 * stringpool.h (class Stringpool_template): Add optimize_ field.
9117 (Stringpool_template::set_optimize): New function.
9118 * stringpool.cc (Stringpool_template::Stringpool_template):
9119 Initialize optimize_ field.
9120 (Stringpool_template::set_string_offsets): Test local optimize
9121 fild rather than parameter.
9122 * layout.cc (Layout::Layout): Call set_optimize on the section
9123 name stringpool.
9124
9125 2009-06-22 Ian Lance Taylor <iant@google.com>
9126
9127 PR 10030
9128 * yyscript.y: Parse TARGET.
9129 * script.cc (script_set_target): New function.
9130 * script-c.h (script_set_target): Declare.
9131 * options.cc (General_options::string_to_object_format): Rename
9132 from string_to_object_format in anonymous namespace. Change
9133 callers.
9134 * options.h (class General_options): Declare
9135 string_to_object_format.
9136
9137 2009-06-22 Ian Lance Taylor <iant@google.com>
9138
9139 * script-sections.cc (Script_sections::create_segments): Don't put
9140 program headers in a PT_LOAD segment if -n or -N.
9141
9142 2009-06-22 Ian Lance Taylor <iant@google.com>
9143
9144 PR 10141
9145 * options.h (class General_options): Add -z lazy and -z now. Sort
9146 -z options into alphabetical order.
9147 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9148
9149 2009-06-21 Ian Lance Taylor <iant@google.com>
9150
9151 * layout.cc (Layout::make_output_section): Call
9152 Target::new_output_section.
9153 (Layout::attach_allocated_section_to_segment): Put large section
9154 sections in a separate load segment with the large segment flag
9155 set.
9156 (Layout::segment_precedes): Sort large data segments after other
9157 load segments.
9158 (align_file_offset): New static function.
9159 (Layout::set_segment_offsets): Use align_file_offset.
9160 * output.h (class Output_section): Add is_small_section_ and
9161 is_large_section_ fields.
9162 (Output_section::is_small_section): New function.
9163 (Output_section::set_is_small_section): New function.
9164 (Output_section::is_large_section): New function.
9165 (Output_section::set_is_large_section): New function.
9166 (Output_section::is_large_data_section): New function.
9167 (class Output_segment): Add is_large_data_segment_ field.
9168 (Output_segment::is_large_data_segment): New function.
9169 (Output_segment::set_is_large_data_segment): New function.
9170 * output.cc (Output_section::Output_section): Initialize new
9171 fields.
9172 (Output_segment::Output_segment): Likewise.
9173 (Output_segment::add_output_section): Add assertion that large
9174 data sections always go in large data segments. Force small data
9175 sections to the end of the list of data sections. Force small BSS
9176 sections to the start of the list of BSS sections. For large BSS
9177 sections to the end of the list of BSS sections.
9178 * symtab.h (class Symbol): Declare is_common_shndx.
9179 (Symbol::is_defined): Check Symbol::is_common_shndx.
9180 (Symbol::is_common): Likewise.
9181 (class Symbol_table): Define enum Commons_section_type. Update
9182 declarations. Add small_commons_ and large_commons_ fields.
9183 * symtab.cc (Symbol::is_common_shndx): New function.
9184 (Symbol_table::Symbol_table): Initialize new fields.
9185 (Symbol_table::add_from_object): Put small and large common
9186 symbols in the right list.
9187 (Symbol_table::sized_finalized_symbol): Check
9188 Symbol::is_common_shndx.
9189 (Symbol_table::sized_write_globals): Likewise.
9190 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9191 common symbol lists. Don't call do_allocate_commons_list if the
9192 list is empty.
9193 (Symbol_table::do_allocate_commons_list): Remove is_tls
9194 parameter. Add comons_section_type parameter. Change all
9195 callers. Handle small and large common symbols.
9196 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9197 Symbol::is_common_shndx.
9198 * resolve.cc (symbol_to_bits): Likewise.
9199 * target.h (Target::small_common_shndx): New function.
9200 (Target::small_common_section_flags): New function.
9201 (Target::large_common_shndx): New function.
9202 (Target::large_common_section_flags): New function.
9203 (Target::new_output_section): New function.
9204 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9205 small_common_section_flags, and large_common_section_flags
9206 fields.
9207 (Target::do_new_output_section): New virtual function.
9208 * arm.cc (Target_arm::arm_info): Initialize new fields.
9209 * i386.cc (Target_i386::i386_info): Likewise.
9210 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9211 Likewise.
9212 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9213 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9214 (Target_x86_64::do_new_output_section): New function.
9215 * configure.ac: Define conditional MCMODEL_MEDIUM.
9216 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9217 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9218 (large_LDFLAGS): Define.
9219 * testsuite/large.c: New file.
9220 * testsuite/testfile.cc (Target_test::test_target_info):
9221 Initialize new fields.
9222 * configure, testsuite/Makefile.in: Rebuild.
9223
9224 2009-06-05 Doug Kwan <dougkwan@google.com>
9225
9226 * Makefile.am (CCFILES): Add target.cc.
9227 * Makefile.in: Regenerate.
9228 * i386.cc (class Target_i386): Define new virtual method to
9229 override do_is_local_label_name in parent.
9230 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9231 local symbols if --discard-locals or -X is given.
9232 * options.h (class General_options): Declare new options
9233 '--discard-locals' and '-X' for discarding locals.
9234 * target.h (class Target): Define new methods is_local_label_name.
9235 Declare new virtual method do_is_local_label_name.
9236 * target.cc: New file.
9237 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9238 (check_SCRIPTS): Add discard_locals_test.sh.
9239 (check_DATA): Add discard_local_tests.syms.
9240 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9241 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9242 * testsuite/Makefile.in: Regenerate.
9243 * testsuite/discard_locals_test.c: New file.
9244 * testsuite/discard_locals_test.sh: Same.
9245
9246 2009-06-05 Doug Kwan <dougkwan@google.com>
9247
9248 * object.cc (Sized_relobj::Sized_relobj): Initialize
9249 discarded_eh_frame_shndx_ to -1U.
9250 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9251 section.
9252 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9253 a discarded .eh_frame section.
9254 (Sized_relobj::do_finalize_local_symbols): Ditto.
9255 * object.h (class Sized_relobj): Declare new member
9256 discarded_eh_frame_shndx_.
9257 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9258 (local_labels_test.o, local_labels_test): New rules.
9259 * testsuite/Makefile.in: Regenerate.
9260
9261 2009-06-04 Doug Kwan <dougkwan@google.com>
9262
9263 * layout.cc (Layout::section_name_mapping): Add mapping for
9264 special ARM sections.
9265
9266 2009-06-03 Doug Kwan <dougkwan@google.com>
9267
9268 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9269 (utils::has_overflow): Same.
9270
9271 2009-06-03 Ian Lance Taylor <iant@google.com>
9272
9273 * layout.cc (Layout::section_name_mapping): New array, replacing
9274 Layout::linkonce_mapping.
9275 (Layout::section_name_mapping_count): New variable, replacing
9276 Layout::linkonce_mapping_count.
9277 (Layout::linkonce_output_name): Remove.
9278 (Layout::output_section_name): Rewrite.
9279 * layout.h (class Layout): Rename Linkonce_mapping to
9280 Section_name_mapping, linkonce_mapping to section_name_mapping,
9281 linkonce_mapping_count to section_name_mapping_count. Don't
9282 declare linkonce_output_name.
9283
9284 2009-06-03 Doug Kwan <dougkwan@google.com>
9285
9286 * gold/arm.cc (namespace utils): New.
9287 (Target_arm::reloc_is_non_pic): Define new method.
9288 (class Arm_relocate_functions): New.
9289 (Target_arm::Relocate::relocate): Handle relocation types used by
9290 Android.
9291
9292 2009-06-03 Ian Lance Taylor <iant@google.com>
9293
9294 * arm.cc (Target_arm::scan::global): Use || instead of |.
9295
9296 2009-06-02 Doug Kwan <dougkwan@google.com>
9297
9298 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9299 issued_non_pic_error_.
9300 (class Target_arm::Scan): Declare new method check_non_pic.
9301 Define new method symbol_needs_plt_entry.
9302 Declare new data member issued_non_pic_error_.
9303 (class Target_arm::Relocate): Declare new method
9304 should_apply_static_reloc.
9305 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9306 (Target_arm::Scan::check_non_pic): Define new method.
9307 (Target_arm::Scan::local): Handle a small subset of reloc types used
9308 by Android.
9309 (Target_arm::Scan::local): Same.
9310 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9311
9312 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9313
9314 * incremental.cc (Incremental_inputs::report_command_line): Filter
9315 out --incremental-* options.
9316
9317 2009-05-29 Doug Kwan <dougkwan@google.com>
9318
9319 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9320 template class.
9321 (class Target_arm): Update comment.
9322 (Target_arm::Target_arm): Initialize new data members GOT_,
9323 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9324 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9325 and Target_arm::rel_dyn_section.
9326 Declare new_enum Target_arm::Got_type.
9327 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9328 and DYNBSS_.
9329 Update commments for member do_dynsym_value.
9330 (Target_arm::got_size, Target_arm::plt_section,
9331 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9332 new methods inside class defintion.
9333 (Target_arm::got_section): Define new method.
9334 (Target_arm::rel_dyn_section): Same.
9335 (Output_data_plt_arm): New template class.
9336 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9337 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9338 (Output_data_plt_arm::add_entry): Same.
9339 (Output_data_plt_arm::first_plt_entry): Define new
9340 static data member for PLT instruction template.
9341 (Output_data_plt_arm::plt_entry): Same.
9342 (Output_data_plt_arm::do_write): Define new method.
9343 (Target_arm::make_plt_entry): Same.
9344 (Target_arm::do_finalize_sections): Same.
9345 (Target_arm::do_dynsym_value): Same.
9346
9347 2009-05-28 Doug Kwan <dougkwan@google.com>
9348
9349 * Makefile.am (TARGETSOURCES): Add arm.cc.
9350 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9351 * Makefile.in: Regenerate.
9352 * arm.cc: New file.
9353 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9354
9355 2009-05-26 Doug Kwan <dougkwan@google.com>
9356
9357 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9358 (General_options::check_excluded_libs): Strip off directories in
9359 archive name before matching like GNU ld does.
9360 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9361 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9362 (exclude_libs_test_LDFLAGS): Add linker option
9363 -Wl,--exclude-libs,libexclude_libs_test_3
9364 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9365 an explicit archive without using -l.
9366 (alt/libexclude_libs_test_3.a): New make rule.
9367 * testsuite/Makefile.in: Regenerate.
9368 * testsuite/exclude_libs_test.c : Declare lib3_default().
9369 (main): Call it.
9370 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9371 * exclude_libs_test_3.c: New file.
9372
9373 2009-05-26 Nick Clifton <nickc@redhat.com>
9374
9375 * po/id.po: New Indonesian translation.
9376 * po/gold.pot: Updated template file.
9377
9378 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9379
9380 * testsuite/Makefile.am: Add -ffunction-sections to compile
9381 gc_comdat_test files. Add -Wl,--gc-sections to build
9382 gc_comdat_test.
9383 * testsuite/Makefile.in: Regenerate.
9384 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9385
9386 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9387
9388 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9389 kept comdat section was garbage collected.
9390 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9391 * testsuite/Makefile.in: Regenerate.
9392 * testsuite/gc_comdat_test.sh: New file.
9393 * testsuite/gc_comdat_test_1.cc: New file.
9394 * testsuite/gc_comdat_test_2.cc: New file.
9395
9396 2009-05-19 Doug Kwan <dougkwan@google.com>
9397
9398 * archive.cc (Archive::Archive): Move constructor from archive.h
9399 to here. Initialize no_export_.
9400 (Archive::get_elf_object_for_member): Set no_export flag of object.
9401 * archive.h (Archive::Archive): Move constructor body to
9402 archive.cc.
9403 (Archive::no_export): New method.
9404 (Archive::no_export_): New field.
9405 * object.h (Object::Object): Initialize no_export_ to false.
9406 (Object::no_export, Object::set_no_export): New methods.
9407 (Object::no_export_): New field.
9408 * options.cc (General_options::parse_exclude_libs): New method.
9409 (General_options::check_excluded_libs) Same.
9410 * options.h (exclude_libs): New option.
9411 (General_options::check_excluded_libs): New method declaration.
9412 (General_options::excluded_libs_): New field.
9413 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9414 default or protected visibility if an object has no-export flag set.
9415 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9416 (check_SCRIPTS): Add exclude_libs_test.sh.
9417 (check_DATA): Add exclude_libs_test.syms.
9418 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9419 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9420 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9421 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9422 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9423 libexclude_libs_test_2.a): New rules.
9424 * testsuite/Makefile.in: Regenerate.
9425 * testsuite/exclude_libs_test.c: New file.
9426 * testsuite/exclude_libs_test.sh: Ditto.
9427 * testsuite/exclude_libs_test_1.c: Ditto.
9428 * testsuite/exclude_libs_test_2.c: Ditto.
9429
9430 2009-05-15 Ian Lance Taylor <iant@google.com>
9431
9432 * configure.ac: Check for declarations for cases where libiberty.h
9433 checks HAVE_DECL_xxx.
9434 * configure, config.in: Rebuild.
9435
9436 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9437
9438 * gold.h (Incremental_argument_list): Remove (invalid) forward
9439 declaration.
9440 * incremental.cc (Incremental_inputs::report_achive): New method.
9441 (Incremental_inputs::report_object): New method.
9442 (Incremental_inputs::report_script): New method.
9443 (Incremental_inputs::finalize_inputs): New method.
9444 (Incremental_inputs::finalize): Call finalize_inputs().
9445 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9446 Create inputs entries.
9447 * incremental.h (Incremental_input_type): New enum.
9448 (Incremental_inputs::Incremental_input): Initialize new fields.
9449 (Incremental_inputs::report_inputs): New method.
9450 (Incremental_inputs::report_achive): New method.
9451 (Incremental_inputs::report_object): New method.
9452 (Incremental_inputs::report_script): New method.
9453 (Incremental_inputs::finalize_inputs): New method.
9454 (Incremental_inputs::Input_info): New struct.
9455 (Incremental_inputs::Input_info_map): New typedef.
9456 (Incremental_inputs::lock_): New field.
9457 (Incremental_inputs::Inputs_): New field.
9458 (Incremental_inputs::Inputs_map): New field.
9459 * main.cc (main): Call Incremental_input::report_inputs.
9460 * options.h (Input_argument_list): Typedef moved from
9461 Input_arguments.
9462 (Input_file_group::Files): Remove, use ::Input_argument_list.
9463 (Input_file_group::Input_argument_list): Remove, use
9464 ::Input_argument_list.
9465 * plugin.cc (Plugin_manager::add_input_file): Add error in
9466 incremental build.
9467 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9468 functions.
9469 * script.cc (read_input_script): Call
9470 Incremental_input::report_script.
9471 * script.h (Script_info): New class.
9472
9473 2009-04-27 Ian Lance Taylor <iant@google.com>
9474
9475 * x86_64.cc (do_adjust_output_section): Set entsize to
9476 plt_entry_size.
9477
9478 2009-04-23 Elliott Hughes <enh@google.com>
9479
9480 * output.cc (Output_file::close): After short writes, continue
9481 writing from the correct offset in the buffer being written.
9482
9483 2009-04-23 Chris Demetriou <cgd@google.com>
9484
9485 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9486 * configure: Regenerate.
9487 * config.in: Regenerate.
9488 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9489 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9490
9491 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9492
9493 * incremental.cc (Incremental_inputs_header_data): Renamed from
9494 Incremental_input_header_data.
9495 (Incremental_inputs_header_data::data_size): New field.
9496 (Incremental_inputs_header_data::put_input_file_count): Renamed
9497 from input_file_count.
9498 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9499 from command_line_offset.
9500 (Incremental_inputs_header_data::put_reserved): Renamed from
9501 put_reserved.
9502 (Incremental_inputs_entry_data): Renamed from
9503 Incremental_input_entry_data.
9504 (Incremental_inputs_entry_data::data_size): New field.
9505 (Incremental_inputs::report_command_line): New method.
9506 (Incremental_inputs::finalize): New method.
9507 (Incremental_inputs::create_incremental_inputs_data): New method.
9508 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9509 * incremental.h: New file.
9510 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9511 (Layout::finalize): Create incremental inputs section in
9512 incremental builds.
9513 (Layout::create_incremental_info_sections): New method.
9514 * layout.h (Layout::incremental_inputs): New method.
9515 (Layout::create_incremental_info_sections): New method.
9516 (Layout::incremental_inputs_): New field.
9517 * main.cc (main): Notify Incremental_input of the command line.
9518
9519 2009-04-01 Ian Lance Taylor <iant@google.com>
9520 Mikolaj Zalewski <mikolajz@google.com>
9521
9522 * gold.h (reserve_unordered_map): Define, three versions, one for
9523 each version of Unordered_map.
9524 * layout.cc (Layout::Layout): Remove options parameter. Add
9525 number_of_input_files parameter. Don't initialize options_.
9526 Initialize number_of_input_files_ and resized_signatures_. Move
9527 sections_are_attached_.
9528 (Layout::layout_group): Reserve space for group_signatures_.
9529 (Layout::find_or_add_kept_section): Change name parameter to be a
9530 reference. Resize signatures_ map when it gets large enough.
9531 (Layout::layout_eh_frame): Use parameters->options() instead of
9532 this->options_.
9533 (Layout::make_output_section): Likewise.
9534 (Layout::attach_allocated_section_to_segment): Likewise.
9535 (Layout::finalize, Layout::create_executable_stack): Likewise.
9536 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9537 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9538 * layout.h (class Layout): Update declarations. Remove options_
9539 field. Add number_of_input_files_ and resized_signatures_
9540 fields. Move sections_are_attached_ field.
9541 * main.cc (main): Pass number of input files to Layout
9542 constructor. Don't pass options.
9543
9544 2009-03-30 Ian Lance Taylor <iant@google.com>
9545
9546 * ffsll.c (ffsll): Correct implementation.
9547
9548 2009-03-27 Ian Lance Taylor <iant@google.com>
9549
9550 * ffsll.c: New file.
9551 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9552 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9553 * ftruncate.c (ftruncate): Declare before definition.
9554 * mremap.c (mremap): Likewise.
9555 * pread.c (pread): Likewise.
9556 * configure, Makefile.in, config.in: Rebuild.
9557
9558 * mremap.c: New file.
9559 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9560 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9561 (mremap): Declare if HAVE_MREMAP is not defined.
9562 * configure, Makefile.in, config.in: Rebuild.
9563
9564 2009-03-27 Cary Coutant <ccoutant@google.com>
9565
9566 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9567 position independent.
9568 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9569 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9570
9571 2009-03-24 Cary Coutant <ccoutant@google.com>
9572
9573 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9574 an executable.
9575 (needs_dynamic_reloc): Likewise.
9576
9577 2009-03-24 Ian Lance Taylor <iant@google.com>
9578
9579 * yyscript.y (file_cmd): Recognize EXTERN.
9580 (extern_name_list, extern_name_list_body): New nonterminals.
9581 * script.cc (script_add_extern): Define.
9582 * script-c.h (script_add_extern): Declare.
9583
9584 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9585
9586 * object.cc (is_elf_object): Define.
9587 * object.h (is_elf_object): Declare.
9588 * archive.cc (Archive::get_elf_object_for_member): Call
9589 is_elf_object.
9590 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9591
9592 2009-03-24 Elliott Hughes <enh@google.com>
9593
9594 * output.cc (Output_file::map_anonymous): Define.
9595 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9596 try an anonymous one. Report the size if the mmap fails.
9597 * output.h (class Output_file): Declare map_anonymous.
9598
9599 2009-03-24 Ian Lance Taylor <iant@google.com>
9600
9601 * target-select.cc (instantiate_target): Don't acquire the lock if
9602 the instantiated_target_ field has already been set.
9603
9604 2009-03-23 Ian Lance Taylor <iant@google.com>
9605
9606 * gold-threads.h (class Initialize_lock): Define.
9607 * gold-threads.cc (class Initialize_lock_once): Define.
9608 (initialize_lock_control): New static variable.
9609 (initialize_lock_pointer): New static variable.
9610 (initialize_lock_once): New static function.
9611 (Initialize_lock::Initialize_lock): Define.
9612 (Initialize_lock::initialize): Define.
9613 * target-select.h: Include "gold-threads.h".
9614 (class Target_selector): Add lock_ and initialize_lock_ fields.
9615 Don't define instantiate_target, just declare it.
9616 * target-select.cc (Target_selector::Target_selector): Initialize
9617 new fields.
9618 (Target_selector::instantiate_target): Define.
9619 * descriptors.h: Include "gold-threads.h".
9620 (class Descriptors): Add initialize_lock_ field.
9621 * descriptors.cc (Descriptors::Descriptors): Initialize new
9622 field.
9623 (Descriptors::open): Use initialize_lock_ field
9624 * errors.h (class Errors): Add initialize_lock_ field.
9625 * errors.cc (Errors::Errors): Initialize new field.
9626 (Errors::initialize_lock): Use initialize_lock_ field.
9627 * powerpc.cc (class Target_selector_powerpc): Remove
9628 instantiated_target_ field. In do_recognize call
9629 instantiate_target rather than do_instantiate_target. In
9630 do_instantiate_target just allocate a new target.
9631 * sparc.cc (class Target_selector_sparc): Likewise.
9632
9633 * freebsd.h: New file.
9634 * i386.cc: Include "freebsd.h".
9635 (Target_i386): Derive from Target_freebsd rather than
9636 Sized_target.
9637 (Target_selector_i386): Derive from Target_selector_freebsd rather
9638 than Target_selector.
9639 * x86_64.cc: Include "freebsd.h".
9640 (Target_x86_64): Derive from Target_freebsd rather than
9641 Sized_target.
9642 (Target_selector_x86_64): Derive from Target_selector_freebsd
9643 rather than Target_selector.
9644 * target.h (class Target): Add adjust_elf_header and
9645 do_adjust_elf_header.
9646 * output.cc (Output_file_header:: do_sized_write): Call target
9647 adjust_elf_header routine.
9648 * configure.tgt: Set targ_osabi.
9649 * configure.ac: Define GOLD_DEFAULT_OSABI.
9650 * parameters.cc (Parameters::default_target): Pass
9651 GOLD_DEFAULT_OSABI to select_target.
9652 * target-select.h (class Target_selector): Make instantiate_target
9653 protected rather than private.
9654 * Makefile.am (HFILES): Add freebsd.h.
9655 * configure, Makefile.in, config.in: Rebuild.
9656
9657 * merge.cc (do_add_input_section): Correct pend value. Change
9658 message about last entry not being null terminated from error to
9659 warning.
9660
9661 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9662
9663 * incremental.cc: New file.
9664 * Makefile.am (CCFILES): Add incremental.cc.
9665 * Makefile.in: Rebuild.
9666
9667 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9668
9669 * layout.cc (Layout::output_section_name): Preserve names
9670 of '.note.' sections.
9671
9672 2009-03-19 Ian Lance Taylor <iant@google.com>
9673
9674 * descriptors.cc (Descriptors::open): Check that the options are
9675 valid before using them.
9676
9677 2009-03-18 Ian Lance Taylor <iant@google.com>
9678
9679 * script-sections.h: Include <list>.
9680 (class Script_sections): Change Sections_elements from std::vector
9681 to std::list. Typedef public Elements_iterator. Add
9682 orphan_section_placement_, data_segment_align_start_, and
9683 saw_data_segment_align_ fields. Remove data_segment_align_index_
9684 field.
9685 * script-sections.cc (class Orphan_section_placement): New class.
9686 (class Sections_element): Add virtual functions is_relro and
9687 orphan_section_init. Remove virtual function place_orphan_here.
9688 (class Output_section_definition): Add is_relro and
9689 orphan_section_init. Remove place_orphan_here.
9690 (class Orphan_output_section): Likewise.
9691 (Script_sections::Script_sections): Update for field changes.
9692 (Script_sections::data_segment_align): Set saw_data_segment_align_
9693 and data_segment_align_start_, not data_segment_align_index.
9694 (Script_sections::data_segment_relro_end): Check
9695 saw_data_segment_align_. Use data_segment_align_start_ rather
9696 than data_segment_align_index_.
9697 (Script_sections::place_orphan): Rewrite to use
9698 Orphan_section_placement.
9699
9700 2009-03-17 Ian Lance Taylor <iant@google.com>
9701
9702 * archive.cc (Archive::add_symbols): Check for a version attached
9703 to the symbol name in the archive map.
9704 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9705 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9706 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9707 (ver_test_11.a): New target.
9708 * testsuite/Makefile.in: Rebuild.
9709
9710 * configure.ac: Check for chsize and posix_fallocate. Replace
9711 ftruncate.
9712 * ftruncate.c: New file, from gnulib.
9713 * output.cc (posix_fallocate): Define dummy version if not
9714 HAVE_POSIX_FALLOCATE.
9715 (Output_file::map): Call posix_fallocate rather than lseek and
9716 write.
9717 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9718 * configure, Makefile.in, config.in: Rebuild.
9719
9720 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9721
9722 * layout.h (Layout::create_note): Add section_name parameter.
9723 * layout.cc (Layout::create_note): Likewise.
9724 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9725
9726 2009-03-17 Ian Lance Taylor <iant@google.com>
9727
9728 * descriptors.cc: Include "options.h".
9729 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9730 (Descriptors::open): Always use O_CLOEXEC when opening a new
9731 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9732 then set FD_CLOEXEC.
9733
9734 * sparc.cc (class Target_sparc): Add has_got_section.
9735 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9736 make sure we have a GOT section.
9737
9738 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9739 (Target_sparc::Scan::local): Likewise.
9740 (Target_sparc::Scan::global): Likewise.
9741 (Target_sparc::Relocate::relocate): Likewise.
9742 (Target_sparc::Relocate::relocate_tls): Likewise.
9743
9744 * symtab.cc (Symbol_table::define_default_version): New function,
9745 broken out of add_from_object.
9746 (Symbol_table::add_from_object): Call define_default_version.
9747 (Symbol_table::define_special_symbol): Add resolve_oldsym
9748 parameter. Change all callers. If the version for a symbol comes
9749 from a version script, resolve it with the symbol with the same
9750 name with no version. Also add the symbol without a version if
9751 appropriate.
9752 (do_define_in_output_data): If resolving with oldsym, don't delete
9753 sym.
9754 (do_define_in_output_segment): Likewise.
9755 (do_define_as_constant): Likewise.
9756 * symtab.h (class Symbol_table): Update declarations.
9757
9758 2009-03-13 Ian Lance Taylor <iant@google.com>
9759
9760 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9761 (Read_symbols::requeue): New function.
9762 (Read_symbols::do_read_symbols): If make_elf_object fails because
9763 the target type is not configured, and the file was searched for,
9764 issue a warning and retry with the next directory.
9765 (Add_symbols::run): If the file has an incompatible format, and
9766 it was searched for, requeue the Read_symbols task. On error,
9767 release the object.
9768 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9769 dirindex parameter to constructor. Change all callers. Declare
9770 incompatible_warning and requeue.
9771 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9772 input_argument_ and input_group_ fields. Add them to
9773 constructor. Change all callers.
9774 (class Read_script): Add dirindex_ field. Add it to constructor.
9775 Change all callers.
9776 * archive.cc (Archive::setup): Remove input_objects parameter.
9777 Change all callers.
9778 (Archive::get_file_and_offset): Likewise.
9779 (Archive::read_all_symbols): Likewise.
9780 (Archive::read_symbols): Likewise.
9781 (Archive::get_elf_object_for_member): Remove input_objects
9782 parameter. Add punconfigured parameter. Change all callers.
9783 (Archive::add_symbols): Change return type to bool. Check return
9784 value of include_member.
9785 (Archive::include_all_members): Likewise.
9786 (Archive::include_member): Change return type to bool. Return
9787 false if first included object has incompatible target. Set
9788 included_member_ field.
9789 (Add_archive_symbols::run): If add_symbols returns false, requeue
9790 Read_symbols task.
9791 * archive.h (class Archive): Add included_member_ field.
9792 Initialize it in constructor. Add input_file and searched_for
9793 methods. Update declarations.
9794 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9795 input_argument_ fields. Add them to constructor. Change all
9796 callers.
9797 * script.cc: Include "target-select.h".
9798 (class Parser_closure): Add skip_on_incompatible_target_ and
9799 found_incompatible_target_ fields. Add
9800 skip_on_incompatible_target parameter to constructor. Change all
9801 callers. Add methods skip_on_incompatible_target,
9802 clear_skip_on_incompatible_target, found_incompatible_target, and
9803 set_found_incompatible_target.
9804 (read_input_script): Add dirindex parameter. Change all callers.
9805 If parser finds an incompatible target, requeue Read_symbols
9806 task.
9807 (script_set_symbol): Clear skip_on_incompatible_target in
9808 closure.
9809 (script_add_assertion, script_parse_option): Likewise.
9810 (script_start_sections, script_add_phdr): Likewise.
9811 (script_check_output_format): New function.
9812 * script.h (read_input_script): Update declaration.
9813 * script-c.h (script_check_output_format): Declare.
9814 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9815 (ignore_cmd): Remove OUTPUT_FORMAT.
9816 * fileread.cc (Input_file::Input_file): Add explicit this.
9817 (Input_file::will_search_for): New function.
9818 (Input_file::open): Add pindex parameter. Change all callers.
9819 * fileread.h (class Input_file): Add input_file_argument method.
9820 Declare will_search_for. Update declarations.
9821 * object.cc (make_elf_object): Add punconfigured parameter.
9822 Change all callers.
9823 * object.h (class Object): Make input_file public. Add
9824 searched_for method.
9825 (make_elf_object): Update declaration.
9826 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9827 restart search.
9828 * dirsearch.h (class Dirsearch): Update declaration.
9829 * options.h (class General_options): Add --warn-search-mismatch.
9830 * parameters.cc (Parameters::is_compatible_target): New function.
9831 * parameters.h (class Parameters): Declare is_compatible_target.
9832 * workqueue.cc (Workqueue::add_blocker): New function.
9833 * workqueue.h (class Workqueue): Declare add_blocker.
9834
9835 * fileread.cc (Input_file::open): Remove options parameter.
9836 Change all callers.
9837 (Input_file::open_binary): Likewise.
9838 * script.cc (read_input_script): Likewise.
9839 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9840 options parameter from constructor. Change all callers.
9841 (class Read_script): Likewise.
9842 * fileread.h (class Input_file): Update declarations.
9843 * script.h (read_input_script): Update declaration.
9844
9845 2009-03-10 Nick Clifton <nickc@redhat.com>
9846
9847 * po/es.po: New Spanish translation.
9848
9849 2009-03-06 Cary Coutant <ccoutant@google.com>
9850
9851 * options.cc (parse_short_option): Keep dash_z from registering itself.
9852
9853 2009-03-03 Ian Lance Taylor <iant@google.com>
9854
9855 PR 9918
9856 * target-reloc.h (relocate_section): Pass output_section to
9857 relocate.
9858 * i386.cc (Target_i386::should_apply_static_reloc): Add
9859 output_section parameter. Change all callers.
9860 (Target_i386::Relocate::relocate): Add output_section parameter.
9861 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9862 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9863 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9864 * testsuite/two_file_shared.sh: New script.
9865 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9866 (check_DATA): Add two_file_shared.dbg.
9867 (two_file_shared.dbg): New target.
9868 * testsuite/Makefile.in: Rebuild.
9869
9870 2009-03-01 Ian Lance Taylor <iant@google.com>
9871
9872 * configure.ac: Check for byteswap.h.
9873 * configure: Rebuild.
9874 * config.in: Rebuild.
9875
9876 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9877
9878 * layout.cc (Layout::find_or_add_kept_section): New function.
9879 (Layout::add_comdat): Removed.
9880 * layout.h (struct Kept_section): Move out of class Layout.
9881 Remove trailing underscores from field names. Add group_sections
9882 field. Rename group_ field to is_group. Change all uses.
9883 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9884 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9885 comdat_groups_ field.
9886 (Sized_relobj::include_section_group): Use
9887 find_or_add_kept_section and Kept_section::group_sections.
9888 (Sized_relobj::include_linkonce_section): Likewise.
9889 * object.cc (class Sized_relobj): Don't define Comdat_group or
9890 Comdat_group_table. Remove find_comdat_group and
9891 add_comdat_group. Remove comdat_groups_ field.
9892 * plugin.cc (include_comdat_group): Use
9893 Layout::find_or_add_kept_section.
9894
9895 2009-02-28 Ian Lance Taylor <iant@google.com>
9896
9897 * README: --gc-sections and map files are now supported. Document
9898 some build requirements.
9899
9900 PR 6992
9901 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9902 relocatable link set the value of the section symbol to zero.
9903 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9904 relocatable link don't include the section address in the local
9905 symbol value.
9906
9907 2009-02-27 Ian Lance Taylor <iant@google.com>
9908
9909 PR 6811
9910 * options.h (class Search_directory): Add is_system_directory.
9911 (class General_options): Declare is_in_system_directory.
9912 * options.cc (get_relative_sysroot): Make static.
9913 (get_default_sysroot): Make static.
9914 (General_optoins::is_in_system_directory): New function.
9915 * fileread.cc (Input_file::is_in_system_directory): New function.
9916 * fileread.h (class Input_file): Declare is_in_system_directory.
9917 * object.h (class Object): Add is_in_system_directory.
9918 (class Input_objects): Remove system_library_directory_ field.
9919 * object.cc (Input_objects::add_object): Don't set
9920 system_library_directory_.
9921 (input_objects::found_in_system_library_directory): Remove.
9922 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9923 parameter. Change all callers.
9924 (Symbol_table::sized_write_globals): Likewise.
9925 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9926 Call Object::is_in_system_directory.
9927 * symtab.h (class Symbol_table): Update declarations.
9928
9929 PR 5990
9930 * descriptors.h (Open_descriptor): Add is_on_stack field.
9931 * descriptors.cc (Descriptors::open): If the descriptor is on the
9932 top of the stack, remove it. Initialize is_on_stack field.
9933 (Descriptors::release): Only add pod to stack if it is not on the
9934 stack already.
9935 (Descriptors::close_some_descriptor): Clear stack_next and
9936 is_on_stack fields.
9937
9938 PR 7091
9939 * output.cc (Output_section::find_starting_output_address): Rename
9940 from starting_output_address; add PADDR parameter; change return
9941 type.
9942 * output.h (class Output_section): Declare
9943 find_starting_output_address instead of starting_output_address.
9944 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9945 section symbol for which we can't find a merge section.
9946
9947 PR 9836
9948 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9949 hidden or internal, force the symbol to be local.
9950 * resolve.cc (Symbol::override_visibility): Define.
9951 (Symbol::override_base): Use override_visibility.
9952 (Symbol_table::resolve): Likewise.
9953 (Symbol::override_base_with_special): Likewise.
9954 (Symbol_table::override_with_special): If the visibility is hidden
9955 or internal, force the symbol to be local.
9956 * symtab.h (class Symbol): Add set_visibility and
9957 override_visibility.
9958 * testsuite/ver_test_1.sh: New file.
9959 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9960 (check_DATA): Add ver_test_1.syms.
9961 (ver_test_1.syms): New target.
9962 * testsuite/Makefile.in: Rebuild.
9963
9964 2009-02-25 Cary Coutant <ccoutant@google.com>
9965
9966 * layout.cc (Layout::choose_output_section): Don't rename sections
9967 when using a linker script that has a SECTIONS clause.
9968 * Makefile.in: Regenerate.
9969
9970 * testsuite/Makefile.am (script_test_5.sh): New test case.
9971 * testsuite/Makefile.in: Regenerate.
9972 * testsuite/script_test_5.cc: New file.
9973 * testsuite/script_test_5.sh: New file.
9974 * testsuite/script_test_5.t: New file.
9975
9976 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9977
9978 * archive.cc (Archive::include_member): Update calls to add_symbols.
9979 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9980 the Layout argument.
9981 * dynobj.h (do_add_symbols): Add the Layout argument.
9982 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9983 Layout argument.
9984 * object.h (Object::add_symbols): Add the Layout argument.
9985 (Object::do_add_symbols): Add the Layout argument.
9986 (Sized_relobj::do_add_symbols): Add the Layout argument.
9987 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9988 Unify the two versions.
9989 (Add_plugin_symbols): Remove.
9990 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9991 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9992 (Add_plugin_symbols): Remove.
9993 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9994 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9995 (Add_symbols::run): Make it work with Pulginobj.
9996
9997 2009-02-06 Ian Lance Taylor <iant@google.com>
9998
9999 * object.cc (Sized_relobj::do_layout): Make info message start
10000 with lower case letter.
10001
10002 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10003
10004 * binary.cc: Fix file comment.
10005
10006 * options.h (enum Incremental_disposition): Define.
10007 (class General_options): Add new options: --incremental,
10008 --incremental_changed, --incremental_unchanged,
10009 --incremental_unknown. Add incremental_disposition_ and
10010 implicit_incremental_ fields.
10011 (General_options::incremental_disposition): New function.
10012 (class Position_dependent_options): Add incremental_disposition
10013 option.
10014 (Position_dependent_options::copy_from_options): Set incremental
10015 dispositions.
10016 * options.cc (General_options::parse_incremental_changed): New
10017 function.
10018 (General_options::parse_incremental_unchanged): New function.
10019 (General_options::parse_incremental_unknown): New function.
10020 (General_options::General_options): Initialize new fields
10021 incremental_disposition_ and implicit_incremental_.
10022 (General_options::finalize): Check for uasge of --incremental-*
10023 without --incremental.
10024
10025 2009-02-06 Chris Demetriou <cgd@google.com>
10026
10027 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10028 pointer and to report location as the file name associated with
10029 the symbol.
10030 (gold_undefined_symbol_at_location): New function to replace the
10031 old gold_undefined_symbol functionality.
10032 * target-reloc.h (relocate_section): Update to use
10033 gold_undefined_symbol_at_location.
10034 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10035 Call gold_undefined_symbol function rather than gold_error.
10036 * errors.h (Errors::undefined_symbol): Take location as a
10037 string, rather than calculating it from a relocation.
10038 * errors.cc (Errors::fatal): Print "fatal error:" before the
10039 formatted message.
10040 (Errors::error, Errors::error_at_location): Print "error: "
10041 before the formatted message.
10042 (Errors::undefined_symbol): Take location as a string, rather
10043 than calculating it from a relocation.
10044 (gold_undefined_symbol_at_location): New function akin to
10045 old gold_undefined_symbol, calculates location from relocation.
10046 (gold_undefined_symbol): Change to take only a Symbol pointer
10047 and to report location as the file name associated with the symbol.
10048 * testsuite/debug_msg.sh: Update for changed error messages.
10049 * testsuite/undef_symbol.sh: Likewise.
10050
10051 2009-02-04 Duncan Sands <baldrick@free.fr>
10052
10053 PR 9812
10054 * reduced_debug_output.h
10055 (Output_reduced_debug_abbrev_section::failed): Use format for
10056 gold_warning.
10057 (Output_reduced_debug_info_section::faild): Likewise.
10058
10059 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10060
10061 * script.cc (Lazy_demangler): New class.
10062 (Version_script_info::get_symbol_version_helper): Demangle a
10063 symbol only once.
10064
10065 2009-01-29 Cary Coutant <ccoutant@google.com>
10066
10067 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10068 to __tls_get_addr.
10069 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10070
10071 2009-01-28 Ian Lance Taylor <iant@google.com>
10072
10073 * version.cc (version_string): Bump to 1.9.
10074
10075 * gold.h: Include <cstring> and <stdint.h>.
10076 * version.cc: Include <cstdio>.
10077 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10078 warning.
10079 * reduced_debug_output.cc (insert_into_vector): Rename from
10080 Insert_into_vector; change all callers. Use Swap_unaligned to
10081 avoid aliasing issue; remove union since it is unnecessary.
10082
10083 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10084
10085 * Makefile.am (CCFILES): Add gc.cc.
10086 (HFILES): Add gc.h.
10087 * Makefile.in: Regenerate.
10088 * gold.cc (Gc_runner): New class.
10089 (queue_initial_tasks): Call garbage collection related tasks
10090 when corresponding options are invoked.
10091 (queue_middle_gc_tasks): New function.
10092 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10093 processed early before laying out sections during garbage collection.
10094 * gold.h (queue_middle_gc_tasks): New function.
10095 (is_prefix_of): Move from "layout.cc".
10096 * i386.cc (Target_i386::gc_process_relocs): New function.
10097 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10098 * main.cc (main): Create object of class "Garbage_collection".
10099 * object.cc (Relobj::copy_symbols_data): New function.
10100 (Relobj::is_section_name_included): New function.
10101 (Sized_relobj::do_layout): Allow this function to be called twice
10102 during garbage collection and defer layout of section during the
10103 first call.
10104 * object.h (Relobj::get_symbols_data): New function.
10105 (Relobj::is_section_name_included): New function.
10106 (Relobj::copy_symbols_data): New function.
10107 (Relobj::set_symbols_data): New function.
10108 (Relobj::get_relocs_data): New function.
10109 (Relobj::set_relocs_data): New function.
10110 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10111 (Relobj::gc_process_relocs): New function.
10112 (Relobj::do_gc_process_relocs): New pure virtual function.
10113 (Relobj::sd_): New data member.
10114 (Sized_relobj::is_output_section_offset_invalid): New function.
10115 (Sized_relobj::do_gc_process_relocs): New function.
10116 * options.h (General_options::gc_sections): Modify to not be a no-op.
10117 (General_options::print_gc_sections): New option.
10118 * plugin.cc (Plugin_finish::run): Remove function call to
10119 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10120 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10121 * reloc.cc (Read_relocs::run): Add task to process relocs and
10122 determine unreferenced sections when doing garbage collection.
10123 (Gc_process_relocs): New class.
10124 (Sized_relobj::do_gc_process_relocs): New function.
10125 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10126 sections that are garbage collected.
10127 * reloc.h (Gc_process_relocs): New class.
10128 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10129 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10130 symbols whose corresponding sections are garbage collected.
10131 (Symbol_table::Symbol_table): Add new parameter for the garbage
10132 collection object.
10133 (Symbol_table::gc_mark_undef_symbols): New function.
10134 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10135 (Symbol_table::gc_mark_dyn_syms): New function.
10136 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10137 as garbage.
10138 (Symbol_table::add_from_object): Likewise.
10139 (Symbol_table::add_from_relobj): When building shared objects, do not
10140 treat externally visible symbols as garbage.
10141 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10142 table information for static and relocatable links.
10143 * symtab.h (Symbol_table::set_gc): New function.
10144 (Symbol_table::gc): New function.
10145 (Symbol_table::gc_mark_undef_symbols): New function.
10146 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10147 (Symbol_table::gc_mark_dyn_syms): New function.
10148 (Symbol_table::gc_): New data member.
10149 * target.h (Sized_target::gc_process_relocs): New pure virtual
10150 function.
10151 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10152 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10153
10154 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10155
10156 * options.h (General_options::gc_sections): Define as a no-op for now.
10157 (General_options::no_keep_memory): Ditto.
10158 (General_options::Bshareable): Define.
10159 * options.cc (General_options::finalize): Honor -Bshareable.
10160
10161 2009-01-20 Andreas Schwab <schwab@suse.de>
10162
10163 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10164 read the value in the contents, since we don't use it. Use the
10165 template endianness when writing.
10166 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10167
10168 2009-01-19 Andreas Schwab <schwab@suse.de>
10169
10170 * configure.tgt (powerpc64-*): Fix targ_obj.
10171
10172 2009-01-15 Ian Lance Taylor <iant@google.com>
10173
10174 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10175 local symbols when stripping all symbols.
10176
10177 2009-01-14 Cary Coutant <ccoutant@google.com>
10178
10179 * output.cc (Output_reloc): Add explicit instantiations.
10180
10181 2009-01-14 Cary Coutant <ccoutant@google.com>
10182
10183 * archive.cc (Archive::get_elf_object_for_member): Remove call
10184 to File_read::claim_for_plugin.
10185 * descriptors.cc (Descriptors::open): Remove reference to
10186 is_claimed.
10187 (Descriptors::claim_for_plugin): Remove.
10188 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10189 (Descriptors::is_claimed): Remove.
10190 (claim_descriptor_for_plugin): Remove.
10191 * fileread.cc (File_read::claim_for_plugin): Remove.
10192 * fileread.h (File_read::claim_for_plugin): Remove.
10193 (File_read::descriptor): Reopen descriptor if necessary.
10194 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10195 (Plugin_manager::all_symbols_read): Add task parameter. Change
10196 all callers.
10197 (Plugin_manager::get_input_file): New function.
10198 (Plugin_manager::release_input_file): New function.
10199 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10200 corresponding data member.
10201 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10202 and pass to base constructor. Change all callers.
10203 (get_input_file, release_input_file): New functions.
10204 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10205 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10206 (Plugin_manager::all_symbols_read): Add task parameter.
10207 (Plugin_manager::get_input_file): New function.
10208 (Plugin_manager::release_input_file): New function.
10209 (Plugin_manager::task_): New data member.
10210 (Pluginobj::Pluginobj): Add filesize parameter.
10211 (Pluginobj::filename): New function.
10212 (Pluginobj::descriptor): New function.
10213 (Pluginobj::filesize): New function.
10214 (Pluginobj::filesize_): New data member.
10215 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10216 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10217 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10218
10219 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10220 with archive libraries.
10221 * testsuite/Makefile.in: Regenerate.
10222 * testsuite/plugin_test.c (struct sym_info): New type.
10223 (get_input_file, release_input_file): New static variables.
10224 (onload): Capture new transfer vector entries.
10225 (claim_file_hook): Stop reading at end of file according to filesize.
10226 Factor out parsing of readelf output into separate function.
10227 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10228 APIs and get the source file name from the symbol table. Convert
10229 source file name to corresponding object file name. Print info
10230 message when adding new input files.
10231 (parse_readelf_line): New function.
10232 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10233 * testsuite/plugin_test_2.sh: Likewise.
10234 * testsuite/plugin_test_3.sh: Likewise.
10235 * testsuite/plugin_test_4.sh: New test case.
10236
10237 2009-01-07 Ian Lance Taylor <iant@google.com>
10238
10239 * version.cc (version_string): Bump to 1.8.
10240
10241 2008-12-23 Cary Coutant <ccoutant@google.com>
10242
10243 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10244 * plugin.cc (Plugin_manager::finish): Rename as
10245 layout_deferred_objects. Move cleanup to separate function.
10246 (Plugin_manager::cleanup): New function.
10247 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10248 separately.
10249 * plugin.h (Plugin_manager::finish): Rename as
10250 layout_deferred_objects.
10251 (Plugin_manager::cleanup): New function.
10252 (Plugin_manager::cleanup_done): New field.
10253
10254 2008-12-23 Cary Coutant <ccoutant@google.com>
10255
10256 * plugin.cc (is_visible_from_outside): New function.
10257 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10258 so we don't return "IR only" status for exported symbols or -r links.
10259
10260 * testsuite/Makefile.am (plugin_test_3): New test case.
10261 * testsuite/Makefile.in: Regenerate.
10262 * testsuite/plugin_test_3.sh: New file.
10263
10264 2008-12-22 Cary Coutant <ccoutant@google.com>
10265
10266 * object.cc (Sized_relobj::layout_section): New function.
10267 (Sized_relobj::do_layout): Defer layout of input sections until after
10268 plugin has provided replacement files.
10269 (Sized_relobj::do_layout_deferred_sections): New function.
10270 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10271 (Relobj::layout_deferred_sections): New function.
10272 (Relobj::do_layout_deferred_sections): New function.
10273 (Sized_relobj::do_layout_deferred_sections): New function.
10274 (Sized_relobj::layout_section): New function.
10275 (Sized_relobj::Deferred_layout): New structure.
10276 (Sized_relobj::deferred_layout_): New field.
10277 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10278 Change all callers. Layout deferred sections.
10279 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10280 references.
10281 (Plugin_hook::run): Move code from do_plugin_hook inline.
10282 (Plugin_hook::do_plugin_hook): Remove.
10283 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10284 (Plugin_manager::finish): Renamed, was cleanup.
10285 (Plugin_manager::should_defer_layout): New function.
10286 (Plugin_manager::add_deferred_layout_object): New function.
10287 (Plugin_manager::Deferred_layout_list): New type.
10288 (Plugin_manager::deferred_layout_objects_): New field.
10289 (Plugin_hook::do_plugin_hook): Remove.
10290
10291 2008-12-17 Ian Lance Taylor <iant@google.com>
10292
10293 * options.h (class General_options): Add --no case for
10294 --export-dynamic.
10295
10296 2008-12-16 Cary Coutant <ccoutant@google.com>
10297
10298 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10299 vector.
10300 (Plugin_manager::claim_file): Create plugin object even if
10301 plugin did not call the add_symbols callback.
10302 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10303 asking for more symbols than were added.
10304 * testsuite/Makefile.am (plugin_test_1): Add test case with
10305 no global symbols.
10306 (empty.syms): New target.
10307 * testsuite/Makefile.in: Regenerate.
10308 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10309 message. Don't call add_symbols if no globals.
10310 (all_symbols_read_hook): Don't provide replacement for empty
10311 claimed file.
10312
10313 2008-12-12 Ian Lance Taylor <iant@google.com>
10314
10315 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10316 r_type == 0 for a local symbol with r_sym == 0.
10317 (scan_relocatable_relocs): Pass r_sym to
10318 local_non_section_strategy.
10319 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10320 r_sym parameter.
10321
10322 * configure.ac: Update test for TLS descriptors: they are
10323 supported as of glibc 2.9.
10324 * configure: Rebuild.
10325
10326 2008-12-11 Ian Lance Taylor <iant@google.com>
10327
10328 PR 7091
10329 * target-reloc.h (Default_scan_relocatable_relocs): For each
10330 function, map r_type == 0 to RELOC_DISCARD.
10331
10332 2008-12-10 Cary Coutant <ccoutant@google.com>
10333
10334 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10335 object to override a kept COMDAT group from a plugin object.
10336
10337 2008-12-09 Ian Lance Taylor <iant@google.com>
10338
10339 PR 7088
10340 * yyscript.y (file_cmd): Handle INPUT.
10341
10342 * testsuite/initpri1.c: Change all declarations to be full
10343 prototypes by adding void, to avoid compiler warnings.
10344
10345 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10346
10347 * options.cc (General_options::parse_plugin_opt): New.
10348 (General_options::add_plugin): The argument now is just the filename.
10349 (General_options::add_plugin_option): New.
10350 * options.h (plugin_opt): New.
10351 (add_plugin): Change argument name.
10352 (add_plugin_option): New.
10353 * plugin.cc (Plugin::load): Don't parse the plugin option.
10354 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10355 (Plugin::add_option): New.
10356 (Plugin::args_): Change type.
10357 (Plugin::filename_): New.
10358 (Plugin_manager::add_plugin_option): New.
10359 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10360 * testsuite/Makefile.in: Regenerate.
10361
10362 2008-12-05 Cary Coutant <ccoutant@google.com>
10363
10364 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10365 Handle --strip-lto-sections option.
10366 * options.h (strip_lto_sections): New option.
10367
10368 2008-12-01 Cary Coutant <ccoutant@google.com>
10369
10370 * plugin.cc (ld_plugin_message): Change format parameter to const.
10371 Fix mismatch between new[] and delete.
10372
10373 2008-11-14 Cary Coutant <ccoutant@google.com>
10374
10375 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10376 instead of -1U.
10377
10378 2008-11-05 Craig Silverstein <csilvers@google.com>
10379
10380 * options.cc (General_options::parse_dynamic_list): New function.
10381 * options.h (General_options): New flags dynamic_list,
10382 dynamic_list_data, dynamic_list_cpp_new, and
10383 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10384 (General_options::in_dynamic_list): New function.
10385 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10386 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10387 (Lex::can_continue_name): Likewise.
10388 (yylex): Likewise.
10389 (read_script_file): New parameter script_options.
10390 (read_dynamic_list): New function.
10391 (Script_options::define_dynamic_list): New function.
10392 (dynamic_list_keyword_parsecodes): New variable.
10393 (dynamic_list_keywords): New variable.
10394 * script.h (Script_options::define_dynamic_list): New function
10395 prototype.
10396 (read_dynamic_list): New function prototype.
10397 * symtab.cc (strprefix): New macro.
10398 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10399 dynamic_list_data, dynamic_list_cpp_new, and
10400 dynamic_list_cpp_typeinfo.
10401 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10402 (dynamic_list_expr): New rule.
10403 (dynamic_list_nodes): Likewise.
10404 (dynamic_list_node): Likewise.
10405 * testsuite/Makefile.am (dynamic_list): New test.
10406 * testsuite/Makefile.in: Regenerated.
10407 * testsuite/dynamic_list.t: New file.
10408 * testsuite/dynamic_list.sh: New file.
10409
10410 2008-11-05 Craig Silverstein <csilvers@google.com>
10411
10412 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10413 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10414 (t11_last): Likewise.
10415 * testsuite/ver_test_6.c (main): Likewise.
10416
10417 2008-10-07 Cary Coutant <ccoutant@google.com>
10418
10419 * options.c (General_options::finalize): Add check for -static and
10420 -shared.
10421 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10422 is not empty.
10423
10424 2008-10-02 Cary Coutant <ccoutant@google.com>
10425
10426 * plugin.cc (make_sized_plugin_object): Fix conditional
10427 compilation to work when not all targets are enabled.
10428
10429 2008-09-29 Cary Coutant <ccoutant@google.com>
10430
10431 * archive.cc (Archive::get_file_and_offset): Use filename instead
10432 of name to get library path.
10433 (Archive::include_member): Unlock external member of a thin archive.
10434
10435 * testsuite/Makefile.am (TEST_AR): New variable.
10436 (thin_archive_test_1): New test.
10437 (thin_archive_test_2): New test.
10438 * testsuite/Makefile.in: Regenerate.
10439 * testsuite/thin_archive_main.cc: New file.
10440 * testsuite/thin_archive_test_1.cc: New file.
10441 * testsuite/thin_archive_test_2.cc: New file.
10442 * testsuite/thin_archive_test_3.cc: New file.
10443 * testsuite/thin_archive_test_4.cc: New file.
10444
10445 2008-09-29 Cary Coutant <ccoutant@google.com>
10446
10447 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10448 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10449 instead of -1U.
10450 (Sized_relobj::do_finalize_local_symbols): Likewise.
10451 (Sized_relobj::map_to_kept_section): Likewise.
10452 * object.h (Sized_relobj::invalid_address): New constant.
10453 (Sized_relobj::do_output_section_offset): Check for invalid_address
10454 and return -1ULL.
10455 * output.cc (Output_reloc::local_section_offset): Use constant
10456 invalid_address instead of -1U.
10457 (Output_reloc::get_address): Likewise.
10458 (Output_section::output_address): Change -1U to -1ULL.
10459 * output.h (Output_reloc::invalid_address): New constant.
10460 * reloc.cc (Sized_relobj::write_sections): Use constant
10461 invalid_address instead of -1U.
10462 (Sized_relobj::relocate_sections): Likewise.
10463 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10464 values for merge sections.
10465 * target-reloc.h (relocate_for_relocatable): Use constant
10466 invalid_address instead of -1U.
10467
10468 2008-09-19 Cary Coutant <ccoutant@google.com>
10469
10470 Add plugin functionality for link-time optimization (LTO).
10471 * configure.ac (plugins): Add --enable-plugins option.
10472 * configure: Regenerate.
10473 * config.in: Regenerate.
10474 * Makefile.am (LIBDL): New variable.
10475 (CCFILES): Add plugin.cc.
10476 (HFILES): Add plugin.h.
10477 (ldadd_var): Add LIBDL.
10478 * Makefile.in: Regenerate.
10479
10480 * archive.cc: Include "plugin.h".
10481 (Archive::setup): Don't preread archive symbols when using a plugin.
10482 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10483 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10484 files.
10485 (Archive::include_member): Add symbols from plugin objects.
10486 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10487 * descriptors.cc (Descriptors::open): Check for file descriptors
10488 abandoned by plugins.
10489 (Descriptors::claim_for_plugin): New function.
10490 * descriptors.h (Descriptors::claim_for_plugin): New function.
10491 (Open_descriptor::is_claimed): New field.
10492 (claim_descriptor_for_plugin): New function.
10493 * fileread.cc (File_read::claim_for_plugin): New function.
10494 * fileread.h (File_read::claim_for_plugin): New function.
10495 (File_read::descriptor): New function.
10496 * gold.cc: Include "plugin.h".
10497 (queue_initial_tasks): Add task to call plugin hooks for generating
10498 new object files.
10499 * main.cc: Include "plugin.h".
10500 (main): Load plugin libraries.
10501 * object.h (Pluginobj): Declare.
10502 (Object::pluginobj): New function.
10503 (Object::do_pluginobj): New function.
10504 (Object::set_target): New function.
10505 * options.cc: Include "plugin.h".
10506 (General_options::parse_plugin): New function.
10507 (General_options::General_options): Initialize plugins_ field.
10508 (General_options::add_plugin): New function.
10509 * options.h (Plugin_manager): Declare.
10510 (General_options): Add --plugin option.
10511 (General_options::has_plugins): New function.
10512 (General_options::plugins): New function.
10513 (General_options::add_plugin): New function.
10514 (General_options::plugins_): New field.
10515 * plugin.cc: New file.
10516 * plugin.h: New file.
10517 * readsyms.cc: Include "plugin.h".
10518 (Read_symbols::do_read_symbols): Check for archive before checking
10519 for ELF file. Call plugin hooks to claim files.
10520 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10521 from a real object file; force override when processing replacement
10522 files.
10523 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10524 (Symbol::init_base_object): Likewise.
10525 (Symbol::init_base_output_data): Likewise.
10526 (Symbol::init_base_output_segment): Likewise.
10527 (Symbol::init_base_constant): Likewise.
10528 (Symbol::init_base_undefined): Likewise.
10529 (Symbol::output_section): Assert that object is not a plugin.
10530 (Symbol_table::add_from_pluginobj): New function.
10531 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10532 undefined.
10533 (Symbol_table::sized_write_globals): Likewise.
10534 (Symbol_table::add_from_pluginobj): Instantiate template.
10535 * symtab.h (Sized_pluginobj): Declare.
10536 (Symbol::in_real_elf): New function.
10537 (Symbol::set_in_real_elf): New function.
10538 (Symbol::in_real_elf_): New field.
10539 (Symbol_table::add_from_pluginobj): New function.
10540
10541 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10542 (LIBDL): New variable.
10543 (LDADD): Add LIBDL.
10544 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10545 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10546 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10547 (MOSTLYCLEANFILES): Likewise.
10548 * testsuite/Makefile.in: Regenerate.
10549 * testsuite/plugin_test.c: New file.
10550 * testsuite/plugin_test_1.sh: New file.
10551 * testsuite/plugin_test_2.sh: New file.
10552
10553 2008-09-16 Ian Lance Taylor <iant@google.com>
10554
10555 * target-reloc.h (relocate_section): Check whether a symbol is
10556 defined by the ABI before reporting an undefined symbol error.
10557 * target.h (Target::is_defined_by_abi): Make parameter const.
10558 (Target::do_is_defined_by_abi): Likewise.
10559 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10560 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10561 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10562 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10563 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10564 * testsuite/Makefile.in: Rebuild.
10565
10566 * fileread.cc (make_view): Add casts to avoid warning.
10567
10568 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10569
10570 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10571 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10572
10573 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10574
10575 * options.h (General_options::output_is_executable): New.
10576 (General_options::output_is_pie): New.
10577 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10578 for shared libraries.
10579 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10580
10581 2008-09-11 Chris Demetriou <cgd@google.com>
10582
10583 * options.h (origin): New -z option.
10584 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10585 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10586 in DT_FLAGS_1.
10587
10588 2008-09-05 Cary Coutant <ccoutant@google.com>
10589
10590 * fileread.cc (File_read::make_view): Add check for attempt to map
10591 beyond end of file.
10592
10593 2008-09-05 Cary Coutant <ccoutant@google.com>
10594
10595 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10596 explicit instantiations.
10597
10598 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10599
10600 PR gold/6858
10601 * options.cc (General_options::finalize): Allow undefined symbols
10602 in shlibs if linking -shared.
10603
10604 PR gold/6859
10605 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10606 symbols as not needing a dynsym entry.
10607
10608 2008-08-20 Craig Silverstein <csilvers@google.com>
10609
10610 * fileread.cc (File_read::open): Do not lock the file unless it
10611 was successfully opened.
10612
10613 2008-08-14 Cary Coutant <ccoutant@google.com>
10614
10615 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10616 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10617 * testsuite/tls_test.cc (struct int128): 128-bit struct
10618 for testing TLS relocs with non-zero addend.
10619 (v12): New TLS variable.
10620 (t12): New test.
10621 (t_last): Add check for v12.
10622 * testsuite/tls_test.h (t12): New function.
10623 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10624
10625 2008-08-13 Ian Lance Taylor <iant@google.com>
10626
10627 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10628 set tls_segment_ or relro_segment_.
10629 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10630 when appropriate.
10631 * output.h (Output_section::clear_is_relro): New function.
10632 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10633 sections specially even when output_data_ is empty.
10634 (Output_segment::maximum_alignment): When first section is relro,
10635 only force alignment for PT_LOAD segments.
10636 * script.cc (script_data_segment_align): New function.
10637 (script_data_segment_relro_end): New function.
10638 * script-c.h (script_data_segment_align): Declare.
10639 (script_data_segment_relro_end): Declare.
10640 * script-sections.h (class Script_sections): Declare
10641 data_segment_align and data_segment_relro_end. Add fields
10642 segment_align_index_ and saw_relro_end_.
10643 * script-sections.cc (class Sections_element): Add set_is_relro
10644 virtual function. Add new bool* parameter to place_orphan_here.
10645 Add get_output_section virtual function.
10646 (class Output_section_definition): Add set_is_relro. Add new
10647 bool* parameter to place_orphan_here. Add get_output_section.
10648 Add is_relro_ field.
10649 (Output_section_definition::Output_section_definition): Initialize
10650 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10651 and is_relro_ fields.
10652 (Output_section_definition::place_orphan_here): Add is_relro
10653 parameter.
10654 (Output_section_definition::set_section_addresses): Set relro for
10655 output section.
10656 (Output_section_definition::alternate_constraint): Likewise.
10657 (class Orphan_output_section): Add new bool* parameter to
10658 place_orphan_here. Add get_output_section.
10659 (Orphan_output_section::place_orphan_here): Add is_relro
10660 parameter.
10661 (Script_sections::Script_sections): Initialize
10662 data_segment_align_index_ and saw_relro_end_.
10663 (Script_sections::data_segment_align): New function.
10664 (Script_sections::data_segment_relro_end): New function.
10665 (Script_sections::place_orphan): Set or clear is_relro.
10666 (Script_sections::set_section_addresses): Force alignment of first
10667 TLS section.
10668 * yyscript.y (exp): Call script_data_segment_align and
10669 script_data_segment_relro_end.
10670 * testsuite/relro_script_test.t: New file.
10671 * testsuite/relro_test.cc (using_script): Declare.
10672 (t1, t2): Test using_script.
10673 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10674 (relro_script_test_SOURCES): Define.
10675 (relro_script_test_DEPENDENCIES): Define.
10676 (relro_script_test_LDFLAGS): Define.
10677 (relro_script_test_LDADD): Define.
10678 (relro_script_test.so): New target.
10679 * testsuite/Makefile.in: Rebuild.
10680
10681 2008-08-06 Cary Coutant <ccoutant@google.com>
10682
10683 * archive.cc (Archive::total_archives, Archive::total_members)
10684 (Archive::total_members_loaded): New variables.
10685 (Archive::setup): Add parameter. Add option to preread
10686 archive symbols.
10687 (Archive::read_armap): Add counter.
10688 (Archive::get_file_and_offset): New function.
10689 (Archive::get_elf_object_for_member): New function.
10690 (Archive::read_all_symbols): New function.
10691 (Archive::read_symbols): New function.
10692 (Archive::add_symbols): Add counters.
10693 (Archive::include_all_members): Use armap to find members if it's
10694 already built.
10695 (Archive::include_member): Skip reading symbols if already read.
10696 Factored code into Archive::get_file_and_offset and
10697 Archive::get_elf_object_for_member. Changed call to
10698 Mapfile::report_include_archive_member.
10699 (Archive::print_stats): New function.
10700 * archive.h: Declare Object and Read_symbols_data classes.
10701 (Archive::Archive): Add initializers for new members.
10702 (Archive::setup): Add parameter.
10703 (Archive::print_stats): New function.
10704 (Archive::total_archives, Archive::total_members)
10705 (Archive::total_members_loaded): New variables.
10706 (Archive::get_file_and_offset): New function.
10707 (Archive::get_elf_object_for_member): New function.
10708 (Archive::read_all_symbols): New function.
10709 (Archive::read_symbols): New function.
10710 (Archive::Archive_member): New class.
10711 (Archive::members_): New member.
10712 (Archive::num_members_): New member.
10713 * main.cc: Include archive.h.
10714 (main): Call Archive::print_stats.
10715 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10716 archive parameter; member_name is now the fully-decorated name.
10717 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10718 * options.h: (General_options): Add --preread-archive-symbols option.
10719 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10720 Archive::setup.
10721
10722 2008-08-04 Ian Lance Taylor <iant@google.com>
10723
10724 * symtab.h (Symbol::use_plt_offset): New function.
10725 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10726 * powerpc.cc (Relocate::relocate): Likewise.
10727 * sparc.cc (Relocate::relocate): Likewise.
10728 * x86_64.cc (Relocate::relocate): Likewise.
10729 * testsuite/weak_plt.sh: New test.
10730 * testsuite/weak_plt_main.cc: New test.
10731 * testsuite/weak_plt_shared.cc: New test.
10732 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10733 (check_PROGRAMS): Add weak_plt.
10734 (check_DATA): Add weak_plt_shared.so.
10735 (weak_plt_main_pic.o, weak_plt): New targets.
10736 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10737 * testsuite/Makefile.in: Rebuild.
10738
10739 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10740 gcctestdir/ld.
10741 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10742 * testsuite/Makefile.in: Rebuild.
10743
10744 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10745
10746 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10747 * Makefile.in: Regenerate.
10748 * po/POTFILES.in: Regenerate.
10749
10750 2008-07-29 Ian Lance Taylor <iant@google.com>
10751
10752 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10753 symbols before other symbols.
10754 * testsuite/script_test_2.cc (test_addr): Declare.
10755 (test_addr_alias): Declare.
10756 (main): Check that test_addr and test_addr_alias have the right
10757 values.
10758 * testsuite/script_test_2.t: Define test_addr_alias and
10759 test_addr.
10760
10761 2008-07-24 Ian Lance Taylor <iant@google.com>
10762
10763 PR 5990
10764 * descriptors.cc: New file.
10765 * descriptors.h: New file.
10766 * gold-threads.h (class Hold_optional_lock): New class.
10767 * fileread.cc: Include "descriptors.h".
10768 (File_read::~File_read): Release descriptor rather than closing
10769 it.
10770 (File_read::open) [file]: Call open_descriptor rather than open.
10771 Set is_descriptor_opened_.
10772 (File_read::open) [memory]: Assert that descriptor is not open.
10773 (File_read::reopen_descriptor): New function.
10774 (File_read::release): Release descriptor.
10775 (File_read::do_read): Make non-const. Reopen descriptor.
10776 (File_read::read): Make non-const.
10777 (File_read::make_view): Reopen descriptor.
10778 (File_read::do_readv): Likewise.
10779 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10780 Update declarations.
10781 * layout.cc: Include "descriptors.h".
10782 (Layout::create_build_id): Use open_descriptor rather than open.
10783 * output.cc: Include "descriptors.h".
10784 (Output_file::open): Use open_descriptor rather than open.
10785 * archive.cc (Archive::const_iterator): Change Archive to be
10786 non-const.
10787 (Archive::begin, Archive::end): Make non-const.
10788 (Archive::count_members): Likewise.
10789 * archive.h (class Archive): Update declarations.
10790 * object.h (Object::read): Make non-const.
10791 * Makefile.am (CCFILES): Add descriptors.cc.
10792 (HFILES): Add descriptors.h.
10793 * Makefile.in: Rebuild.
10794
10795 PR 6716
10796 * gold.h: Always include <clocale>. Add Solaris workarounds
10797 following code in binutils/sysdep.h.
10798
10799 PR 6048
10800 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10801 this->eh_frame_hdr_ is NULL before using it.
10802
10803 * dynobj.cc (Versions::Versions): Update comment.
10804
10805 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10806 the base version name.
10807
10808 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10809 array size plus one.
10810 (Stringpool_template::set_string_offsets): Subtract one from key
10811 before using it as an array index.
10812 (Stringpool_template::get_offset_with_length): Likewise.
10813 (Stringpool_template::write_to_buffer): Likewise.
10814 * stringpool.h (Stringpool_template::get_offset_from_key):
10815 Likewise.
10816
10817 2008-07-23 Ian Lance Taylor <iant@google.com>
10818
10819 PR 6658
10820 * object.h (Merged_symbol_value::value): Do our best to handle a
10821 negative addend.
10822
10823 PR 6647
10824 * script.cc (Version_script_info::get_versions): Don't add empty
10825 version tag to return value.
10826 (Version_script_info::get_symbol_version_helper): Change return
10827 type to bool. Add pversion parameter. Change all callers.
10828 (script_register_vers_node): Don't require a non-NULL tag.
10829 * script.h (class Version_script_info): Update declarations.
10830 (Version_script_info::get_symbol_version): Change return type to
10831 bool. Add version parameter. Change all callers.
10832 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10833 handling. Handle an empty version from a version script.
10834 (Symbol_table::define_special_symbol): Likewise.
10835 * testsuite/ver_test_10.script: New file.
10836 * testsuite/ver_test_10.sh: New file.
10837 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10838 (check_DATA): Add ver_test_10.syms.
10839 (ver_test_10.syms, ver_test_10.so): New target.
10840 * testsuite/Makefile.in: Rebuild.
10841
10842 2008-07-23 Simon Baldwin <simonb@google.com>
10843
10844 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10845 to zero for undefined symbols from dynamic libraries.
10846
10847 2008-07-23 Ian Lance Taylor <iant@google.com>
10848
10849 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10850 Change all callers.
10851 * symtab.h (class Symbol_table): Update declaration.
10852 * testsuite/ver_test_9.cc: New file.
10853 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10854 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10855 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10856 (ver_test_9.so, ver_test_9.o): New targets.
10857 * testsuite/Makefile.in: Rebuild.
10858
10859 2008-07-22 Ian Lance Taylor <iant@google.com>
10860
10861 * options.h (class General_options): Define --check-sections.
10862 * layout.cc (Layout::set_segment_offsets): Handle
10863 --check-sections.
10864
10865 * options.h (class General_options): Define -n/--nmagic and
10866 -N/--omagic.
10867 * options.cc (General_options::finalize): For -n/--nmagic or
10868 -N/--omagic, set -static.
10869 * layout.cc (Layout::attach_allocated_section_to_segment): If
10870 -N/--omagic, don't put read-only and read-write sections in
10871 different segments.
10872 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10873 finding a read-only segment.
10874 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10875 don't set the minimum segment alignment to the common page size,
10876 and don't set the file offset to the address modulo the page size.
10877 * script-sections.cc (Script_sections::create_segments): If
10878 -n/--omagic, don't put read-only and read-write sections in
10879 different segments.
10880
10881 * cref.cc: New file.
10882 * cref.h: New file.
10883 * options.h (class General_options): Add --print-symbol-counts.
10884 * main.cc (main): Issue defined symbol report if requested.
10885 * archive.cc (Archive::interpret_header): Make into a const member
10886 function.
10887 (Archive::add_symbols): Call Input_objects::archive_start and
10888 archive_stop.
10889 (Archive::const_iterator): Define new class.
10890 (Archive::begin, Archive::end): New functions.
10891 (Archive::include_all_members): Rewrite to use iterator.
10892 (Archive::count_members): New function.
10893 * archive.h (class Archive): Update declarations.
10894 (Archive::filename): New function.
10895 * object.cc: Include "cref.h".
10896 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10897 (Sized_relobj::do_get_global_symbol_counts): New function.
10898 (Input_objects::add_object): Add object to cross-referencer.
10899 (Input_objects::archive_start): New function.
10900 (Input_objects::archive_stop): New function.
10901 (Input_objects::print_symbol_counts): New function.
10902 * object.h: Declare Cref and Archive.
10903 (Object::get_global_symbol_counts): New function.
10904 (Object::do_get_global_symbol_counts): New pure virtual function.
10905 (class Sized_relobj): Add defined_count_ field. Update
10906 declarations.
10907 (class Input_objects): Add cref_ field. Update constructor.
10908 Update declarations.
10909 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10910 defined_count_.
10911 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10912 symbol counts.
10913 (Sized_dynobj::do_get_global_symbol_counts): New function.
10914 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10915 defined_count_. Update declarations. Define Symbols typedef.
10916 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10917 parameter. Change all callers.
10918 (Symbol_table::add_from_dynobj): Add sympointers and defined
10919 parameters. Change all callers.
10920 * symtab.h (class Symbol_table): Update declarations.
10921 * Makefile.am (CCFILES): Add cref.cc.
10922 (HFILES): Add cref.h.
10923 * Makefile.in: Rebuild.
10924
10925 2008-07-22 Simon Baldwin <simonb@google.com>
10926
10927 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10928 to zero when writing undefined symbols.
10929
10930 2008-07-22 Ian Lance Taylor <iant@google.com>
10931
10932 * output.cc (Output_section::add_input_section): Don't try to
10933 merge empty merge sections.
10934
10935 2008-07-21 Craig Silverstein <csilvers@google.com>
10936
10937 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10938 Include symbol version in error message.
10939
10940 2008-07-20 Chris Demetriou <cgd@google.com>
10941
10942 * configure.ac (gold_cv_c_random_seed): New configured variable.
10943 (RANDOM_SEED_CFLAGS): New substituted variable.
10944 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10945 * configure: Rebuild.
10946 * Makefile.in: Likewise.
10947 * testsuite/Makefile.in: Likewise.
10948
10949 2008-07-18 Ian Lance Taylor <iant@google.com>
10950
10951 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10952 where we see NAME/NULL and NAME/VERSION as separate symbols.
10953 * testsuite/ver_test_main.cc (main): Call t4.
10954 (t4, t4_2a): Define.
10955 * testsuite/ver_test_2.cc (t4_2): Define.
10956 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10957 * testsuite/ver_test_4.cc (t4_2a): Define.
10958 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10959 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10960
10961 2008-07-17 Ian Lance Taylor <iant@google.com>
10962
10963 * dynobj.cc (Versions::add_def): If we give an error about a
10964 missing version, go ahead and create the version anyhow.
10965
10966 2008-07-10 Ian Lance Taylor <iant@google.com>
10967
10968 Handle output sections with more than 0x7fffffff bytes.
10969 * object.h (class Relobj): Change map_to_output_ to
10970 output_sections_, and just keep a section pointer. Change all
10971 uses. Move comdat group support to Sized_relobj.
10972 (Relobj::is_section_specially_mapped): Remove.
10973 (Relobj::output_section): Remove poff parameter. Change all
10974 callers.
10975 (Relobj::output_section_offset): New function.
10976 (Relobj::set_section_offset): Rewrite.
10977 (Relobj::map_to_output): Remove.
10978 (Relobj::output_sections): New function.
10979 (Relobj::do_output_section_offset): New pure virtual function.
10980 (Relobj::do_set_section_offset): Likewise.
10981 (class Sized_relobj): Add section_offsets_ field. Add comdat
10982 group support from Relobj. Update declarations.
10983 (Sized_relobj::get_output_section_offset): New function.
10984 (Sized_relobj::do_output_section_offset): New function.
10985 (Sized_relobj::do_set_section_offset): New function.
10986 * object.cc (Relobj::output_section_address): Remove.
10987 (Sized_relobj::Sized_relobj): Initialize new fields.
10988 (Sized_relobj::include_section_group): Cast find_kept_object to
10989 Sized_relobj.
10990 (Sized_relobj::include_linkonce_section): Likewise.
10991 (Sized_relobj::do_layout): Use separate arrays for output section
10992 and output offset.
10993 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10994 output_sections.
10995 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10996 output_sections and section_offsets.
10997 (Sized_relobj::write_local_symbols): Likewise.
10998 (map_to_kept_section): Compute output address directly.
10999 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11000 output_sections and section_offsets.
11001 (Sized_relobj::write_sections): Likewise.
11002 (Sized_relobj::relocate_sections): Likewise.
11003 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11004 * output.h (class Output_reloc): Update declarations. Change
11005 u2_.relobj to Sized_relobj*.
11006 (class Output_data_reloc): Change add functions to use
11007 Sized_relobj*.
11008 * output.cc (Output_reloc::Output_reloc): Change relobj to
11009 Sized_relobj*.
11010 (Output_reloc::local_section_offset): Change return type to
11011 Elf_Addr. Use get_output_section_offset.
11012 (Output_reloc::get_address): Likewise.
11013 (Output_section::is_input_address_mapped): Don't call
11014 is_section_specially_mapped.
11015 (Output_section::output_offset): Likewise.
11016 (Output_section::output_address): Likewise.
11017 (Output_section::starting_output_address): Likewise.
11018 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11019 parameter to Sized_relobj*.
11020 (Copy_relocs::need_copy_reloc): Likewise.
11021 (Copy_relocs::save): Likewise.
11022 * copy-relocs.h (class Copy_relocs): Update declarations.
11023 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11024 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11025 * target-reloc.h (relocate_for_relocatable): Change
11026 offset_in_output_section type to Elf_Addr. Change code that uses
11027 it as well.
11028 * layout.cc (Layout::layout): Always set *off.
11029 * mapfile.cc (Mapfile::print_input_section): Use
11030 output_section_offset.
11031 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11032 Sized_relobj*.
11033 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11034 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11035 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11036
11037 2008-07-03 Ian Lance Taylor <iant@google.com>
11038
11039 * layout.cc (Layout::include_section): Do not discard unrecognized
11040 SHT_STRTAB sections.
11041
11042 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11043
11044 * script.cc (Lex::can_continue_name): Make '?' allowable in
11045 version-script names.
11046 * testsuite/version_script.map: Change glob pattern to use '?'
11047
11048 2008-06-30 Manish Singh <yosh@gimp.org>
11049
11050 PR 6585
11051 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11052 Correct typo.
11053
11054 2008-06-30 Ian Lance Taylor <iant@google.com>
11055
11056 PR 6660
11057 PR 6682
11058 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11059 versions]: Don't try to read the value in the contents, since we
11060 don't use it. Use the template endianness when writing.
11061
11062 2008-06-25 Cary Coutant <ccoutant@google.com>
11063
11064 * fileread.cc (File_read::make_view): Assert on zero-length view.
11065 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11066 symbol table when there are no symbols to read.
11067
11068 2008-06-23 Craig Silverstein <csilvers@google.com>
11069
11070 * version.cc (version_string): Bump to 1.7
11071
11072 2008-06-18 Craig Silverstein <csilvers@google.com>
11073
11074 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11075 constant 0xFFFF to type Valtype.
11076 (Powerpc_relocate_functions::rel16_ha): Likewise.
11077
11078 2008-06-17 Ian Lance Taylor <iant@google.com>
11079
11080 * output.h (Output_section::Input_section): Initialize p2align_ to
11081 zero for Output_section_data constructors.
11082 (Output_section::Input_section::addralign): If not an input
11083 section, return the alignment of the Output_section_data.
11084 * testsuite/copy_test.cc: New file.
11085 * testsuite/copy_test_1.cc: New file.
11086 * testsuite/copy_test_2.cc: New file.
11087 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11088 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11089 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11090 (copy_test_1_pic.o, copy_test_1.so): New targets.
11091 (copy_test_2_pic.o, copy_test_2.so): New targets.
11092 * testsuite/Makefile.in: Rebuild.
11093
11094 * script-sections.cc (Script_sections::place_orphan): Initialize
11095 local variable exact.
11096
11097 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11098
11099 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11100
11101 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11102 David S. Miller <davem@davemloft.net>
11103
11104 * powerpc.cc: New file.
11105 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11106 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11107 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11108 * Makefile.in: Rebuild.
11109
11110 2008-06-09 Ian Lance Taylor <iant@google.com>
11111
11112 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11113 <exception>.
11114 (throwing, orig_terminate): New static variables.
11115 (terminate_handler): New static function.
11116 (t2): Set terminate handler.
11117
11118 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11119
11120 PR 6584
11121 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11122 alignment.
11123
11124 2008-05-30 Cary Coutant <ccoutant@google.com>
11125
11126 * archive.cc (Archive::include_all_members) Correct to step
11127 over symbol table and extended name table in thin archives.
11128
11129 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11130
11131 PR 6407
11132 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11133 calculation.
11134
11135 2008-05-28 Caleb Howe <cshowe@google.com>
11136
11137 * reduced_debug_output.cc: New file.
11138 * reduced_debug_output.h: New file.
11139 * options.h (class General_options): Add --strip-debug-non-line.
11140 * options.cc (General_options::finalize): Add strip_debug_non_line
11141 to the strip heirarchy.
11142 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11143 fields.
11144 * layout.cc: Include "reduced_debug_output.h".
11145 (Layout::Layout): Initialize new fields.
11146 (line_only_debug_sections): New static array.
11147 (is_lines_only_debug_sections): New static inline function.
11148 (Layout::include_section): Handle --strip-debug-non-line.
11149 (Layout::make_output_section): If --strip-debug-non-line, build
11150 new output sections for .debug_abbrev and .debug_info.
11151 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11152 gold. Warn about possible overflow.
11153 (read_signed_LEB_128): Likewise.
11154 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11155 (read_signed_LEB_128): Declare.
11156 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11157 (HFILES): Add reduced_debug_output.h.
11158 * Makefile.in: Rebuild.
11159
11160 2008-05-21 Ian Lance Taylor <iant@google.com>
11161
11162 * mapfile.cc: New file.
11163 * mapfile.h: New file.
11164 * options.h (class General_options): Add -M/--print-map and -Map.
11165 * options.cc (General_options::finalize): Make -M equivalent to
11166 -Map -.
11167 * main.cc: Include <cstdio> and "mapfile.h".
11168 (main): Open mapfile if requested.
11169 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11170 constructor. Change caller.
11171 (queue_initial_tasks): Add mapfile parameter. Change caller.
11172 (queue_middle_tasks): Likewise.
11173 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11174 declarations.
11175 * archive.cc: Include "mapfile.h".
11176 (Archive::add_symbols): Add mapfile parameter. Change all
11177 callers. Pass mapfile, symbol, and reason to include_member.
11178 (Archive::include_all_members): Add mapfile parameter. Change all
11179 callers.
11180 (Archive::include_member): Add mapfile, sym, and why parameters.
11181 Change all callers. Report inclusion to map file.
11182 * archive.h: Include "fileread.h".
11183 (class Archive): Update declarations.
11184 (Archive::file): New const method.
11185 (class Add_archive_symbols): Add mapfile_ field. Update
11186 constructor. Change all callers.
11187 * readsyms.h (class Read_symbols): Likewise.
11188 (class Finish_group): Likewise.
11189 (class Read_script): Likewise.
11190 * common.cc: Include "mapfile.h".
11191 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11192 all callers.
11193 (Symbol_table::do_allocate_commons): Likewise.
11194 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11195 symbol allocation to mapfile.
11196 * common.h (class Allocate_commons_task): Add mapfile_ field.
11197 Update constructor. Change all callers.
11198 * symtab.h (class Symbol_table): Update declarations.
11199 * layout.cc: Include "mapfile.h".
11200 (Layout_task_runner::run): Print information to mapfile.
11201 (Layout::create_gold_note): Change Output_data_fixed_space to
11202 Output_data_zero_fill.
11203 (Layout::create_build_id): Likewise.
11204 (Layout::print_to_mapfile): New function.
11205 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11206 constructor. Change caller.
11207 (class Layout): Declare print_to_mapfile.
11208 * output.cc (Output_section::Input_section::print_to_mapfile): New
11209 function.
11210 (Output_section::add_input_section): If producing a map, always
11211 add to input_sections_ list.
11212 (Output_section::do_print_to_mapfile): New function.
11213 (Output_segment::print_sections_to_mapfile): New function.
11214 (Output_segment::print_section_list_to_mapfile): New function.
11215 * output.h: Include "mapfile.h".
11216 (Output_data::print_to_mapfile): New function.
11217 (Output_data::do_print_to_mapfile): New virtual function.
11218 (Output_segment_headers::do_print_to_mapfile): New function.
11219 (Output_file_header::do_print_to_mapfile): New function.
11220 (Output_data_const::do_print_to_mapfile): New function.
11221 (class Output_data_const_buffer): Add map_name_ field. Update
11222 constructor. Change all callers. Add do_print_to_mapfile
11223 function.
11224 (class Output_data_fixed_space): Likewise.
11225 (class Output_data_space): Likewise.
11226 (class Output_data_zero_fill): New class.
11227 (Output_data_strtab::do_print_to_mapfile): New function.
11228 (Output_data_reloc_base::do_print_to_mapfile): New function.
11229 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11230 (Output_data_group::do_print_to_mapfile): New function.
11231 (Output_data_got::do_print_to_mapfile): New function.
11232 (Output_data_dynamic::do_print_to_mapfile): New function.
11233 (Output_symtab_xindex::do_print_to_mapfile): New function.
11234 (class Output_section): Declare do_print_to_mapflie. Declare
11235 print_to_mapfile in Input_section.
11236 (class Output_segment): Declare new functions.
11237 * object.h (Sized_relobj::symbol_count): New function.
11238 * script-sections.cc
11239 (Output_section_element_dot_assignment::set_section_addresses):
11240 Change Output_data_fixed_space to Output_data_zero_fill.
11241 (Output_data_expression::do_print_to_mapfile): New function.
11242 * script.cc (read_input_script): Add mapfile parameter. Change
11243 all callers.
11244 * script.h (read_input_script): Update declaration.
11245 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11246 (Eh_frame::do_print_to_mapfile): New function.
11247 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11248 (Output_merge_string::do_print_to_mapfile): New function.
11249 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11250 function.
11251 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11252 function.
11253 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11254 function.
11255 * Makefile.am (CCFILES): Add mapfile.cc.
11256 (HFILES): Add mapfile.h.
11257 * Makefile.in: Rebuild.
11258
11259 2008-05-19 Ian Lance Taylor <iant@google.com>
11260
11261 * options.h (class General_options): Add -z relro.
11262 * layout.cc (Layout::Layout): Initialize relro_segment_.
11263 (Layout::add_output_section_data): Return the output section.
11264 (Layout::make_output_section): Rcognize relro sections and mark
11265 them appropriately.
11266 (Layout::attach_allocated_section_to_segment): Put relro sections
11267 in a PT_GNU_RELRO segment.
11268 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11269 section as relro.
11270 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11271 PT_TLS segments.
11272 (Layout::linkonce_mapping): Map d.rel.ro.local to
11273 .data.rel.ro.local.
11274 (Layout::output_section_name): Us .data.rel.ro.local for any
11275 section which begins with that.
11276 * layout.h (class Layout): Update add_output_section_data
11277 declaration. Add relro_segment_ field.
11278 * output.cc (Output_section::Output_section): Initialize is_relro_
11279 and is_relro_local_ fields.
11280 (Output_segment::add_output_section): Group relro sections.
11281 (Output_segment::is_first_section_relro): New function.
11282 (Output_segment::maximum_alignment): If there is a relro section,
11283 align the segment to the common page size.
11284 (Output_segment::set_section_addresses): Track whether we are
11285 looking at relro sections. If the last section is a relro
11286 section, align to the common page size.
11287 (Output_segment::set_section_list_addresses): Add in_relro
11288 parameter. Change all callers. Align to the page size when
11289 moving from relro to non-relro section.
11290 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11291 segment.
11292 * output.h (class Output_section): Add is_relro_ and
11293 is_relro_local_ fields.
11294 (Output_section::is_relro): New function.
11295 (Output_section::set_is_relro): New function.
11296 (Output_section::is_relro_local): New function.
11297 (Output_section::set_is_relro_local): New function.
11298 (class Output_segment): Update declarations.
11299 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11300 * sparc.cc (Target_sparc::got_section): Likewise.
11301 * x86_64.cc (Target_x86_64::got_section): Likewise.
11302 * testsuite/relro_test_main.cc: New file.
11303 * testsuite/relro_test.cc: New file.
11304 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11305 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11306 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11307 (relro_test.so, relro_test_pic.o): New targets.
11308 * testsuite/Makefile.in: Rebuild.
11309
11310 2008-05-16 Ian Lance Taylor <iant@google.com>
11311
11312 * output.cc (Output_segment::add_output_section): Remove front
11313 parameter.
11314 * output.h (class Output_segment): Remove
11315 add_initial_output_section and overloaded add_output_section.
11316 Update declaration of remaining add_output_section.
11317 * layout.cc (Layout::create_interp): Call add_output_section
11318 rather than add_initial_output_section.
11319 (Layout::finish_dynamic_section): Likewise.
11320
11321 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11322 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11323 know the dynamic type.
11324 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11325 field. Initialize it in constructor.
11326 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11327 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11328 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11329 reloc.
11330
11331 * output.cc (Output_reloc::get_address): Change return type to
11332 Elf_Addr.
11333 * output.h (class Output_reloc): Update get_address declaration.
11334 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11335 for section addresses.
11336
11337 2008-05-09 Ian Lance Taylor <iant@google.com>
11338
11339 PR 6493
11340 * gold.cc (gold_nomem): Use return value of write.
11341
11342 2008-05-08 Ian Lance Taylor <iant@google.com>
11343
11344 * symtab.c (Symbol::init_base_output_data): Add version
11345 parameter. Change all callers.
11346 (Symbol::init_base_output_segment): Likewise.
11347 (Symbol::init_base_constant): Likewise.
11348 (Symbol::init_base_undefined): Likewise.
11349 (Sized_symbol::init_output_data): Likewise.
11350 (Sized_symbol::init_output_segment): Likewise.
11351 (Sized_symbol::init_constant): Likewise.
11352 (Sized_symbol::init_undefined): Likewise.
11353 (Symbol_table::do_define_in_output_data): If the new symbol has a
11354 version, mark it as the default.
11355 (Symbol_table::do_define_in_output_segment): Likewise.
11356 (Symbol_table::do_define_as_constant): Likewise.
11357 * symtab.h (class Symbol): Update declarations.
11358 (class Sized_symbol): Likewise.
11359 * resolve.cc (Symbol::override_version): New function.
11360 (Symbol::override_base): Call override_version.
11361 (Symbol::override_base_with_special): Likewise.
11362 * testsuite/ver_script_8.script: New file.
11363 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11364 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11365 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11366 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11367
11368 2008-05-06 Ian Lance Taylor <iant@google.com>
11369
11370 PR 6049
11371 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11372 functions.
11373 (class General_options): Remove existing --undefined, and add
11374 --no-undefined instead. Add new --undefined as synonym for -u.
11375 * archive.cc (Archive::add_symbols): Check whether symbol was
11376 named with -u.
11377 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11378 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11379 all uses. Add IS_UNDEFINED. Update declarations to split
11380 different versions of init_base. Declare init_base_undefined.
11381 (Symbol::is_defined): Handle IS_UNDEFINED.
11382 (Symbol::is_undefined): Likewise.
11383 (Symbol::is_weak_undefined): Call is_undefined.
11384 (Symbol::is_absolute): Handle IS_CONSTANT.
11385 (class Sized_symbol): Update declarations to split different
11386 versions of init. Declare init_undefined.
11387 (class Symbol_table): Declare new functions.
11388 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11389 Change all callers.
11390 (Symbol::init_base_output_data): Likewise.
11391 (Symbol::init_base_output_segment): Likewise.
11392 (Symbol::init_base_constant): Likewise.
11393 (Symbol::init_base_undefined): New function.
11394 (Sized_symbol::init_object): Rename from init. Change all
11395 callers.
11396 (Sized_symbol::init_output_data): Likewise.
11397 (Sized_symbol::init_output_segment): Likewise.
11398 (Sized_symbol::init_constant): Likewise.
11399 (Sized_symbol::init_undefined): New function.
11400 (Symbol_table::add_undefined_symbols_from_command_line): New
11401 function.
11402 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11403 function.
11404 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11405 (Symbol::output_section): Likewise.
11406 (Symbol::set_output_section): Likewise.
11407 (Symbol_table::sized_finalize_symbol): Likewise.
11408 (Symbol_table::sized_write_globals): Likewise.
11409 * resolve.cc (Symbol_table::should_override): Likewise.
11410 (Symbol::override_base_with_special): Likewise.
11411
11412 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11413 symbol, change it to have default visibility.
11414 * testsuite/protected_1.cc: New file.
11415 * testsuite/protected_2.cc: New file.
11416 * testsuite/protected_3.cc: New file.
11417 * testsuite/protected_main_1.cc: New file.
11418 * testsuite/protected_main_2.cc: New file.
11419 * testsuite/protected_main_3.cc: New file.
11420 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11421 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11422 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11423 (protected_1.so): New target.
11424 (protected_1_pic.o, protected_2_pic.o): New targets.
11425 (protected_3_pic.o): New target.
11426 (check_PROGRAMS): Add protected_2.
11427 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11428 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11429 * testsuite/Makefile.in: Rebuild.
11430
11431 * options.h (DEFINE_var): Add set_user_set_##varname__.
11432 (DEFINE_bool_alias): New macro.
11433 (class General_options): Define -Bstatic using DEFINE_bool_alias
11434 rather than DEFINE_special. Add --undefined as an alias for -z
11435 defs.
11436 * options.cc (General_options::parse_Bstatic): Remove.
11437
11438 * options.h (class General_options): Add --fatal-warnings.
11439 * main.cc (main): Implement --fatal-warnings.
11440 * errors.h (Errors::warning_count): New function.
11441
11442 * options.h (class General_options): Add -Bsymbolic-functions.
11443 * symtab.h (Symbol::is_preemptible): Check for
11444 -Bsymbolic-functions.
11445
11446 2008-05-05 Ian Lance Taylor <iant@google.com>
11447
11448 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11449 as noVARNAME rather than no-VARNAME.
11450 (class General_options): Add option -z combreloc.
11451 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11452 get_address.
11453 (Output_reloc::sort_before) [SHT_REL]: New function.
11454 (Output_reloc::sort_before) [SHT_RELA]: New function.
11455 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11456 Sort_relocs_comparison.
11457 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11458 parameter. Change all callers.
11459 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11460 sort_relocs parameter. Change all callers.
11461 * output.cc (Output_reloc::get_address): New function, broken out
11462 of write_rel.
11463 (Output_reloc::write_rel): Call it.
11464 (Output_reloc::compare): New function.
11465 (Output_data_reloc_base::do_write): Optionally sort relocs.
11466
11467 * configure.ac: If targ_extra_obj is set, link it in.
11468 * configure.tgt: Initialize all variables.
11469 (x86_64*): Set targ_extra_obj and targ_extra_size.
11470 * configure: Rebuild.
11471
11472 * object.cc (Sized_relobj::include_section_group): Adjust section
11473 indexes read from group data. Build vector to pass to
11474 layout_group.
11475 * layout.cc (Layout::layout_group): Add flags and shndxes
11476 parameters. Remove contents parameter. Change caller. Update
11477 explicit instantiations.
11478 * layout.h (class Layout): Update layout_group declaration.
11479 * output.cc (Output_data_group::Output_data_group): Add flags and
11480 input_shndxes parameters. Remove contents parameter. Change
11481 caller.
11482 (Output_data_group::do_write): Change input_sections_ to
11483 input_shndxes_.
11484 * output.h (class Output_data_group): Update constructor
11485 declaration. Rename input_sections_ to input_shndxes_.
11486 * testsuite/many_sections_test.cc: Add template.
11487
11488 2008-04-30 Cary Coutant <ccoutant@google.com>
11489
11490 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11491
11492 * layout.cc (Layout::include_section): Refactored check for debug
11493 info section.
11494 (Layout::add_comdat): Add new parameters. Change type
11495 of signature parameter. Add object and shndx to signatures table.
11496 (Layout::find_kept_object): New function.
11497 * layout.h: Include <cstring>.
11498 (Layout::is_debug_info_section): New function.
11499 (Layout::add_comdat): Add new parameters.
11500 (Layout::find_kept_object): New function.
11501 (Layout::Kept_section): New struct.
11502 (Layout::Signatures): Change type of map range.
11503 * object.cc (Relobj::output_section_address): New function.
11504 (Sized_relobj::include_section_group): Add new parameters. Change
11505 calls to Layout::add_comdat. Change to build table of kept comdat
11506 groups and table mapping discarded sections to kept sections.
11507 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11508 (Sized_relobj::do_layout): Change calls to include_section_group and
11509 include_linkonce_section.
11510 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11511 value to zero when section is discarded.
11512 (Sized_relobj::map_to_kept_section): New function.
11513 * object.h (Relobj::output_section_address): New function.
11514 (Relobj::Comdat_group): New type.
11515 (Relobj::find_comdat_group): New function.
11516 (Relobj::Comdat_group_table): New type.
11517 (Relobj::Kept_comdat_section): New type.
11518 (Relobj::Kept_comdat_section_table): New type.
11519 (Relobj::add_comdat_group): New function.
11520 (Relobj::set_kept_comdat_section): New function.
11521 (Relobj::get_kept_comdat_section): New function.
11522 (Relobj::comdat_groups_): New field.
11523 (Relobj::kept_comdat_sections_): New field.
11524 (Symbol_value::input_value): Update comment.
11525 (Sized_relobj::map_to_kept_section) New function.
11526 (Sized_relobj::include_linkonce_section): Add new parameter.
11527 * target-reloc.h (Comdat_behavior): New type.
11528 (get_comdat_behavior): New function.
11529 (relocate_section): Add code to map a discarded section to the
11530 corresponding kept section when applying a relocation.
11531
11532 2008-04-30 Craig Silverstein <csilvers@google.com>
11533
11534 * dwarf_reader.cc (next_generation_count): New static var.
11535 (Addr2line_cache_entry): New struct.
11536 (addr2line_cache): New static var.
11537 (Dwarf_line_info::one_addr2line): Added caching.
11538 (Dwarf_line_info::clear_addr2line_cache): New function.
11539 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11540 cache-size parameter.
11541 (Dwarf_line_info::one_addr2line_cache): New function.
11542 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11543 new cache-size argument to one_addr2line(), and clear cache.
11544
11545 2008-04-28 Cary Coutant <ccoutant@google.com>
11546
11547 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11548 R_386_PC8 relocations.
11549
11550 2008-04-23 Ian Lance Taylor <iant@google.com>
11551
11552 * object.cc (Sized_relobj::include_section_group): Check for
11553 invalid section group.
11554
11555 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11556 header size.
11557
11558 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11559 than read for file header.
11560 * archive.cc (Archive::include_member): Likewise.
11561
11562 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11563
11564 * aclocal.m4: Regenerate.
11565 * configure: Regenerate.
11566
11567 2008-04-19 Ian Lance Taylor <iant@google.com>
11568
11569 * version.cc (version_string): Bump to 1.6.
11570
11571 * testsuite/Makefile.am (many_sections_r_test): New target.
11572 (many_sections_r_test_SOURCES): Remove.
11573 (many_sections_r_test_DEPENDENCIES): Remove.
11574 (many_sections_r_test_LDFLAGS): Remove.
11575 (many_sections_r_test_LDADD): Remove.
11576
11577 * object.cc (Sized_relobj::do_add_symbols): Always pass
11578 local_symbol_count_ to add_from_relobj.
11579
11580 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11581 every thousand variables.
11582 * testsuite/Makefile.in: Rebuild.
11583
11584 * object.cc (Xindex::initialize_symtab_xindex): New function.
11585 (Xindex::read_symtab_xindex): New function.
11586 (Xindex::sym_xindex_to_shndx): New function.
11587 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11588 available.
11589 (Sized_relobj::do_initialize_xindex): New function.
11590 (Sized_relobj::do_read_symbols): Adjust section links.
11591 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11592 parameter. Change all callers.
11593 (Sized_relobj::include_section_group): Adjust section links and
11594 symbol section indexes.
11595 (Sized_relobj::do_layout): Adjust section links.
11596 (Sized_relobj::do_count_local_symbols): Adjust section links and
11597 symbol section indexes.
11598 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11599 ordinary and special symbols.
11600 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11601 dynsym_xindex parameters. Change all callers. Adjust section
11602 links. Use SHN_XINDEX when needed.
11603 (Sized_relobj::get_symbol_location_info): Adjust section links.
11604 Don't get fooled by special symbols.
11605 * object.h (class Xindex): Define.
11606 (class Object): Add xindex_ parameter. Declare virtual functoin
11607 do_initialize_xindex.
11608 (Object::adjust_sym_shndx): New function.
11609 (Object::set_xindex): New protected function.
11610 (class Symbol_value): Add is_ordinary_shndx_ field.
11611 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11612 (Symbol_value::value): Assert ordinary section.
11613 (Symbol_value::initialize_input_to_output_map): Likewise.
11614 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11615 Change all callers.
11616 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11617 all callers.
11618 (class Sized_relobj): Update declarations.
11619 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11620 parameter. Change all callers.
11621 (Sized_relobj::adjust_shndx): New function.
11622 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11623 field.
11624 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11625 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11626 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11627 (Sized_dynobj::read_dynsym_section): Adjust section links.
11628 (Sized_dynobj::read_dynamic): Likewise.
11629 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11630 section links.
11631 (Sized_dynobj::do_initialize_xindex): New function.
11632 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11633 do_initialize_xindex.
11634 (Sized_dynobj::adjust_shndx): New function.
11635 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11636 dynsym_xindex_ fields.
11637 (Layout::finalize): Add a call to set_section_indexes before
11638 creating the symtab sections.
11639 (Layout::set_section_indexes): Don't do anything if the section
11640 already has a section index.
11641 (Layout::create_symtab_sections): Add shnum parameter. Change
11642 caller. Create .symtab_shndx section if needed.
11643 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11644 caller.
11645 (Layout::allocated_output_section_count): New function.
11646 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11647 needed.
11648 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11649 fields. Update declarations.
11650 (Layout::symtab_xindex): New function.
11651 (Layout::dynsym_xindex): New function.
11652 (class Write_symbols_task): Add layout_ field.
11653 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11654 Change caller.
11655 * output.cc (Output_section_headers::Output_section_headers): Add
11656 shstrtab_section parameter. Change all callers.
11657 (Output_section_headers::do_sized_write): Store overflow values
11658 for section count and section string table section index in
11659 section header zero.
11660 (Output_file_header::do_sized_write): Check for overflow of
11661 section count and section string table section index.
11662 (Output_symtab_xindex::do_write): New function.
11663 (Output_symtab_xindex::endian_do_write): New function.
11664 * output.h (class Output_section_headers): Add shstrtab_section_.
11665 Update declarations.
11666 (class Output_symtab_xindex): Define.
11667 (Output_section::has_out_shndx): New function.
11668 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11669 field.
11670 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11671 Change all callers.
11672 (Sized_symbol::init): Likewise.
11673 (Symbol::output_section): Check for ordinary symbol.
11674 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11675 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11676 callers.
11677 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11678 Change all callers. Simplify handling of symbols from sections
11679 not included in the link.
11680 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11681 distinction.
11682 (Weak_alias_sorter::operator()): Assert that symbols are
11683 ordinary.
11684 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11685 distinction.
11686 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11687 parameters. Change all callers.
11688 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11689 symbol distinction. Use SHN_XINDEX when needed.
11690 (Symbol_table::write_section_symbol): Add symtab_xindex
11691 parameter. Change all callers.
11692 (Symbol_table::sized_write_section_symbol): Likewise. Use
11693 SHN_XINDEX when needed.
11694 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11695 declarations.
11696 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11697 (Symbol::is_defined): Check is_ordinary.
11698 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11699 (Symbol::is_absolute, Symbol::is_common): Likewise.
11700 (class Sized_symbol): Update declarations.
11701 (class Symbol_table): Update declarations.
11702 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11703 parameters. Change all callers.
11704 (Sized_symbol::override): Likewise.
11705 (Symbol_table::override): Likewise.
11706 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11707 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11708 is_ordinary, and orig_st_shndx parameters. Change all callers.
11709 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11710 to be in an ordinary section.
11711 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11712 object and is_ordinary parameters. Change all callers.
11713 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11714 Change all callers. Don't add undefined or non-ordinary symbols
11715 to reloc_map_.
11716 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11717 Change all callers.
11718 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11719 declarations.
11720 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11721 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11722 (Sized_relobj::relocate_sections): Likewise.
11723 * target-reloc.h (scan_relocs): Adjust section symbol index.
11724 (scan_relocatable_relocs): Likewise.
11725 * i386.cc (Scan::local): Check for ordinary symbols.
11726 * sparc.cc (Scan::local): Likewise.
11727 * x86_64.cc (Scan::local): Likewise.
11728 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11729 to symbol_section_and_value.
11730 * testsuite/many_sections_test.cc: New file.
11731 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11732 (check_PROGRAMS): Add many_sections_test.
11733 (many_sections_test_SOURCES): Define.
11734 (many_sections_test_DEPENDENCIES): Define.
11735 (many_sections_test_LDFLAGS): Define.
11736 (BUILT_SOURCES): Add many_sections_define.h.
11737 (many_sections_define.h): New target.
11738 (BUILT_SOURCES): Add many_sections_check.h.
11739 (many_sections_check.h): New target.
11740 (check_PROGRAMS): Add many_sections_r_test.
11741 (many_sections_r_test_SOURCES): Define.
11742 (many_sections_r_test_DEPENDENCIES): Define.
11743 (many_sections_r_test_LDFLAGS): Define.
11744 (many_sections_r_test_LDADD): Define.
11745 (many_sections_r_test.o): New target.
11746 * testsuite/Makefile.in: Rebuild.
11747
11748 2008-04-17 Cary Coutant <ccoutant@google.com>
11749
11750 * errors.cc (Errors::info): New function.
11751 (gold_info): New function.
11752 * errors.h (Errors::info): New function.
11753 * gold.h (gold_info): New function.
11754 * object.cc (Input_objects::add_object): Print trace output.
11755 * options.cc (options::parse_set): New function.
11756 (General_options::parse_wrap): Deleted.
11757 (General_options::General_options): Deleted initializer.
11758 * options.h (options::String_set): New typedef.
11759 (options::parse_set): New function.
11760 (DEFINE_set): New macro.
11761 (General_options::wrap): Changed to use DEFINE_set. Changed
11762 callers of any_wrap_symbols and is_wrap_symbol.
11763 (General_options::trace, General_options::trace_symbol):
11764 New options.
11765 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11766 (General_options::wrap_symbols_): Deleted.
11767 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11768
11769 2008-04-17 David S. Miller <davem@davemloft.net>
11770
11771 * options.cc (General_options::parse_V): New function.
11772 * options.h: Add entries for -V and -Qy.
11773
11774 2008-04-17 Ian Lance Taylor <iant@google.com>
11775
11776 * common.cc (Symbol_table::allocate_commons): Remove options
11777 parameter. Change caller.
11778 (Symbol_table::do_allocate_commons): Remove options parameter.
11779 Change caller. Just call do_allocate_commons_list twice.
11780 (Symbol_table::do_allocate_commons_list): New function, broken out
11781 of do_allocate_commons.
11782 * common.h (class Allocate_commons_task): Remove options_ field.
11783 Update constructor.
11784 * symtab.cc (Symbol_table::Symbol_table): Initialize
11785 tls_commons_.
11786 (Symbol_table::add_from_object): Put TLS common symbols on
11787 tls_commons_ list.
11788 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11789 which are IN_OUTPUT_DATA.
11790 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11791 allocate_commons and do_allocate_commons declarations. Declare
11792 do_allocate_commons_list.
11793 * gold.cc (queue_middle_tasks): Update creation of
11794 Allocate_commons_task to not pass options.
11795 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11796 (TLS_TEST_C_FLAGS): New variable.
11797 (tls_test_c_pic.o): New target.
11798 (tls_test_shared.so): Link in tls_test_c_pic.o.
11799 (tls_test_c_pic_ie.o): New target.
11800 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11801 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11802 (tls_test_c.o): New target.
11803 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11804 (tls_pic_test_LDADD): Likewise.
11805 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11806 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11807 (tls_test_c_gnu2.o): New target.
11808 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11809 tls_test_c_gnu2.o.
11810 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11811 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11812 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11813 * testsuite/tls_test.cc: Include "config.h".
11814 (t_last): Call t11_last.
11815 * testsuite/tls_test.h (t11, t11_last): Declare.
11816 * testsuite/tls_test_c.c: New file.
11817 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11818 * configure.ac: Check for OpenMP support.
11819 * configure, config.in, Makefile.in: Rebuild.
11820 * testsuite/Makefile.in: Rebuild.
11821
11822 2008-04-16 Cary Coutant <ccoutant@google.com>
11823
11824 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11825 (Target_i386::tls_base_symbol_defined_): New field.
11826 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11827 (Target_i386::Scan::global): Likewise.
11828 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11829 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11830 (Target_x86_64::tls_base_symbol_defined_): New field.
11831 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11832 (Target_x86_64::Scan::global): Likewise.
11833
11834 2008-04-16 Cary Coutant <ccoutant@google.com>
11835
11836 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11837 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11838 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11839 building shared libraries.
11840 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11841 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11842 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11843 * testsuite/Makefile.in: Rebuild.
11844 * testsuite/weak_undef.h: New file.
11845 * testsuite/weak_undef_file1.cc: Add extra test cases.
11846 * testsuite/weak_undef_file2.cc: Likewise.
11847 * testsuite/weak_undef_test.cc: Likewise.
11848
11849 2008-04-16 David S. Miller <davem@davemloft.net>
11850
11851 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11852 Add issued_non_pic_error_ field. Declare check_non_pic.
11853 (Target_sparc::Scan::check_non_pic): New function.
11854 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11855 (Target_sparc::Scan::global): Likewise.
11856
11857 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11858 * configure: Rebuild.
11859
11860 * options.h (DEFINE_enable): New macro.
11861 (new_dtags): New enable option.
11862 (initfirst, interpose, loadfltr, nodefaultlib,
11863 nodelete, nodlopen, nodump): New -z options.
11864 * layout.cc (Layout:finish_dynamic_section): If new
11865 dtags enabled, emit DT_RUNPATH. Also, emit a
11866 DT_FLAGS_1 containing any specified -z flags.
11867
11868 2008-04-16 Ian Lance Taylor <iant@google.com>
11869
11870 * copy-relocs.cc: New file.
11871 * copy-relocs.h: New file.
11872 * reloc.cc: Remove Copy_relocs code.
11873 * reloc.h: Likewise.
11874 * reloc-types.h (struct Reloc_types) [both versions]: Add
11875 get_reloc_addend_noerror.
11876 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11877 variants of add_global which take an addend which must be zero.
11878 * i386.cc: Include "copy-relocs.h".
11879 (class Target_i386): Change type of copy_relocs_ to variable,
11880 update initializer.
11881 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11882 Change all callers.
11883 (Target_i386::do_finalize_sections): Change handling of
11884 copy_relocs_.
11885 * sparc.cc: Include "copy-relocs.h".
11886 (class Target_sparc): Change type of copy_relocs_ to variable,
11887 update initializer.
11888 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11889 Change all callers.
11890 (Target_sparc::do_finalize_sections): Change handling of
11891 copy_relocs_.
11892 * x86_64.cc: Include "copy-relocs.h".
11893 (class Target_x86_64): Change type of copy_relocs_ to variable,
11894 update initializer.
11895 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11896 class. Change all callers.
11897 (Target_x86_64::do_finalize_sections): Change handling of
11898 copy_relocs_.
11899 * Makefile.am (CCFILES): Add copy-relocs.cc.
11900 (HFILES): Add copy-relocs.h.
11901
11902 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11903
11904 * testsuite/script_test_4.sh: Permit leading zeroes.
11905
11906 2008-04-15 Ian Lance Taylor <iant@google.com>
11907
11908 * script-sections.cc (Script_sections::create_segments): Use
11909 header_size_adjustment even when there is enough room for the
11910 headers.
11911 * testsuite/script_test_4.sh: New file.
11912 * testsuite/script_test_4.t: New file.
11913 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11914 (check_DATA): Add script_test_4.stdout.
11915 (MOSTLYCLEANFILES): Likewise.
11916 (script_test_4): New target.
11917 (script_test_4.stdout): New target.
11918 * testsuite/Makefile.in: Rebuild.
11919
11920 * sparc.cc: Add definitions for Output_data_plt_sparc class
11921 constants.
11922
11923 2008-04-14 David S. Miller <davem@davemloft.net>
11924
11925 * sparc.cc: New file.
11926 * Makefile.am (TARGETSOURCES): Add sparc.cc
11927 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11928 * configure.tgt: Document targ_extra_size and
11929 targ_extra_big_endian. Add entries for sparc-* and
11930 sparc64-*.
11931 * configure.ac: Handle targ_extra_size and
11932 targ_extra_big_endian.
11933 * Makefile.in: Rebuild.
11934 * configure: Likewise.
11935 * po/POTFILES.in: Likewise.
11936 * po/gold.pot: Likewise.
11937
11938 2008-04-14 Ian Lance Taylor <iant@google.com>
11939
11940 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11941 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11942 in the name/type/flags to section mapping. Don't call
11943 allocate_output_section.
11944 (Layout::choose_output_section): Change parameter from adjust_name
11945 to is_input_section. Don't permit input sections after sections
11946 are attached to segments. Don't call allocate_output_section.
11947 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11948 not write_enable_output_section.
11949 (Layout::make_output_section): Don't push to
11950 unattached_section_list_ nor call attach_to_segment. Call
11951 attach_section_to_segment if sections are attached.
11952 (Layout::attach_sections_to_segments): New function.
11953 (Layout::attach_section_to_segment): New function.
11954 (Layout::attach_allocated_section_to_segment): Rename from
11955 attach_to_segment. Remove flags parameter.
11956 (Layout::allocate_output_section): Remove function.
11957 (Layout::write_enable_output_section): Remove function.
11958 * layout.h (class Layout): Update for above changes. Add new
11959 field sections_are_attached_.
11960 * output.h (Output_section::update_flags_for_input_section): New
11961 function.
11962 * output.cc (Output_section::add_input_section): Call
11963 update_flags_for_input_section.
11964 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11965
11966 2008-04-11 Cary Coutant <ccoutant@google.com>
11967
11968 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11969 thought unnecessary.
11970 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11971
11972 2008-04-11 Ian Lance Taylor <iant@google.com>
11973
11974 * output.h (class Output_section_data): Remove inline definition
11975 of set_addralign.
11976 * output.cc (Output_section_data::set_addralign): New function.
11977
11978 2008-04-11 Cary Coutant <ccoutant@google.com>
11979
11980 Add support for TLS descriptors for i386 and x86_64.
11981 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11982 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11983 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11984 GOT_TYPE_TLS_DESC.
11985 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11986 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11987 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11988 relocations.
11989 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11990 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11991 Fix problem with initial-exec relocations.
11992 (Target_i386::Relocate::relocate_tls): Likewise.
11993 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11994 relaxation.
11995 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11996 support for section-plus-offset dynamic table entries.
11997 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11998 (Output_data_dynamic::Dynamic_entry): Add support for
11999 section-plus-offset dynamic table entries.
12000 (Output_data_dynamic::Classification): Likewise.
12001 (Output_data_dynamic::classification_): Renamed offset_.
12002 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12003 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12004 (Target_x86_64::make_plt_section): New function.
12005 (Target_x86_64::reserve_tlsdesc_entries): New function.
12006 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12007 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12008 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12009 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12010 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12011 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12012 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12013 add extra PLT entry for TLS descriptors.
12014 (Output_data_plt_x86_64::got_): New field.
12015 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12016 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12017 fields.
12018 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12019 descriptors.
12020 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12021 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12022 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12023 R_386_TLS_DESC_CALL relocations.
12024 (Target_x86_64::Scan::global): Likewise.
12025 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12026 for TLS descriptors.
12027 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12028 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12029 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12030 GD-to-IE relaxation.
12031 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12032 and TLS_DESCRIPTORS.
12033 * Makefile.in: Rebuild.
12034 * configure: Rebuild.
12035 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12036 (tls_test_shared2.so): New target.
12037 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12038 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12039 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12040 (tls_shared_gd_to_ie_test_LDADD): New variable.
12041 (tls_shared_gnu2_gd_to_ie_test): New target.
12042 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12043 New targets.
12044 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12045 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12046 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12047 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12048 (tls_shared_gnu2_test): New target.
12049 (tls_test_gnu2_shared.so): New target.
12050 (tls_shared_gnu2_test_SOURCES): New variable.
12051 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12052 (tls_shared_gnu2_test_LDFLAGS): New variable.
12053 (tls_shared_gnu2_test_LDADD): New variable.
12054 * testsuite/Makefile.in: Rebuild.
12055 * testsuite/Makefile.
12056
12057 2008-04-11 Ian Lance Taylor <iant@google.com>
12058
12059 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12060 justsyms.t.
12061 * testsuite/Makefile.in: Rebuild.
12062
12063 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12064 long.
12065 * testsuite/script_test_2.cc (main): Adjust test.
12066
12067 2008-04-11 David S. Miller <davem@davemloft.net>
12068 Ian Lance Taylor <iant@google.com>
12069
12070 * options.h (General_options): Add entries for '-Y' and
12071 '-relax'.
12072 * options.cc (General_options:finalize): If -Y was used, add those
12073 entries to the library path instead of the default "/lib" and
12074 "/usr/lib".
12075
12076 2008-04-11 David S. Miller <davem@davemloft.net>
12077
12078 * testsuite/justsyms.t: Start at 0x100.
12079 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12080 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12081 long.
12082 * testsuite/script_test_2.cc: Adjust string and section length
12083 checks.
12084
12085 2008-04-09 Ian Lance Taylor <iant@google.com>
12086
12087 PR gold/5996
12088 * script-sections.cc (Sections_element::allocate_to_segment): Add
12089 orphan parameter.
12090 (Output_section_definition::allocate_to_segment): Likewise.
12091 (Orphan_output_section::allocate_to_segment): Likewise.
12092 (Script_sections::attach_sections_using_phdrs_clause): Don't
12093 propagate non-PT_LOAD segments to orphan sections.
12094 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12095 readelf rather than objdump.
12096 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12097 .interp section and PT_INTERP segment are the same size.
12098 * testsuite/Makefile.in: Rebuild.
12099
12100 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12101 aliases for symbols defined in the same object.
12102 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12103 (weak_alias_test_SOURCES): New variable.
12104 (weak_alias_test_DEPENDENCIES): New variable.
12105 (weak_alias_test_LDFLAGS): New variable.
12106 (weak_alias_test_LDADD): New variable.
12107 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12108 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12109 (weak_alias_test_3.o): New target.
12110 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12111 * testsuite/weak_alias_test_main.cc: New file.
12112 * testsuite/weak_alias_test_1.cc: New file.
12113 * testsuite/weak_alias_test_2.cc: New file.
12114 * testsuite/weak_alias_test_3.cc: New file.
12115
12116 2008-04-08 Ian Lance Taylor <iant@google.com>
12117
12118 * options.h (class General_options): Add --noinhibit-exec option.
12119 * main.cc (main): Check --noinhibit-exec.
12120
12121 * options.h (class General_options): Define --wrap as a special
12122 option. Add wrap_symbols_ field.
12123 (General_options::any_wrap_symbols): New function.
12124 (General_options::is_wrap_symbol): New function.
12125 * options.cc (General_options::parse_wrap): New function.
12126 (General_options::General_options): Initialize wrap_symbols_.
12127 * symtab.cc (Symbol_table::wrap_symbol): New function.
12128 (Symbol_table::add_from_object): Handle --wrap.
12129 * symtab.h (class Symbol_table): Declare wrap_symbol.
12130 * target.h (Target::wrap_char): New function.
12131 (Target::Target_info): Add wrap_char field.
12132 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12133 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12134 * testsuite/testfile.cc (Target_test::test_target_info):
12135 Likewise.
12136
12137 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12138 there is one.
12139
12140 * layout.h (class Layout): Add added_eh_frame_data_ field.
12141 * layout.cc (Layout::Layout): Initialize new field.
12142 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12143 output section until we find a section we merged successfully.
12144 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12145 that the size be non-zero.
12146
12147 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12148 qualifier.
12149
12150 2008-04-08 Craig Silverstein <csilvers@google.com>
12151
12152 * configure.ac: Export new conditional variable HAVE_ZLIB.
12153 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12154 on HAVE_ZLIB.
12155 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12156 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12157
12158 2008-04-07 Ian Lance Taylor <iant@google.com>
12159
12160 * version.cc (version_string): Set to "1.5".
12161
12162 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12163 Add issued_non_pic_error_ field. Declare check_non_pic.
12164 (Target_x86_64::Scan::check_non_pic): New function.
12165 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12166 (Target_x86_64::Scan::global): Likewise.
12167
12168 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12169 addend parameter. Change caller. Handle merge sections.
12170 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12171 Address to Addend. Don't add in the result of
12172 local_section_offset, pass down the addend and use the returned
12173 value.
12174 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12175 Update declarations of local_section_offset and symbol_value.
12176 * testsuite/two_file_test_1.cc (t18): New function.
12177 * testsuite/two_file_test_2.cc (f18): New function.
12178 * testsuite/two_file_test_main.cc (main): Call t18.
12179 * testsuite/two_file_test.h (t18, f18): Declare.
12180
12181 * configure.ac: Don't test for objdump, c++filt, or readelf.
12182 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12183 conditionals.
12184 (TEST_READELF): New variable.
12185 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12186 (check_PROGRAMS): Add two_file_strip_test.
12187 (two_file_strip_test): New target.
12188 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12189 (two_file_same_shared_strip_test_SOURCES): New variable.
12190 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12191 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12192 (two_file_same_shared_strip_test_LDADD): New variable.
12193 (two_file_shared_strip.so): New target.
12194 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12195 (ver_test_5.syms, ver_test_7.syms): Likewise.
12196 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12197 (strip_test_3.stdout): Use TEST_OBJDUMP.
12198 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12199
12200 2008-04-04 Cary Coutant <ccoutant@google.com>
12201
12202 * symtab.h (Symbol::is_weak_undefined): New function.
12203 (Symbol::is_strong_undefined): New function.
12204 (Symbol::is_absolute): New function.
12205 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12206 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12207 absolute symbols.
12208 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12209 (weak_undef_test): New target.
12210 * testsuite/Makefile.in: Rebuild.
12211 * testsuite/weak_undef_file1.cc: New file.
12212 * testsuite/weak_undef_file2.cc: New file.
12213 * testsuite/weak_undef_test.cc: New file.
12214
12215 2008-04-03 Craig Silverstein <csilvers@google.com>
12216
12217 * compressed_output.h (class Output_compressed_section): Use
12218 unsigned buffer.
12219 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12220 add zlib header.
12221 (zlib_compressed_suffix): Removed.
12222 (Output_compressed_section::set_final_data_size): Use unsigned
12223 buffers.
12224 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12225 Fix linker invocation.
12226 (flagstest_o_specialfile_and_compress_debug_sections):
12227 Likewise.
12228 * testsuite/Makefile.in: Regenerated.
12229
12230 2008-04-02 David S. Miller <davem@davemloft.net>
12231
12232 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12233 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12234
12235 2008-04-02 Craig Silverstein <csilvers@google.com>
12236
12237 * TODO: New file.
12238
12239 2008-04-02 Ian Lance Taylor <iant@google.com>
12240
12241 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12242 parameters. Update for new key type to views_. Change all
12243 callers.
12244 (File_read::read): Adjust for byteshift in returned view.
12245 (File_read::add_view): New function, broken out of
12246 find_and_make_view.
12247 (File_read::make_view): New function, broken out of
12248 find_and_make_view.
12249 (File_read::find_or_make_view): Add offset and aligned
12250 parameters. Rewrite accordingly. Change all callers.
12251 (File_read::get_view): Add offset and aligned parameters. Adjust
12252 for byteshift in return value.
12253 (File_read::get_lasting_view): Likewise.
12254 * fileread.h (class File_read): Update declarations.
12255 (class File_read::View): Add byteshift_ field. Add byteshift to
12256 constructor. Add byteshift method.
12257 * archive.h (Archive::clear_uncached_views): New function.
12258 (Archive::get_view): Add aligned parameter. Change all callers.
12259 * object.h (Object::get_view): Add aligned parameter. Change all
12260 callers.
12261 (Object::get_lasting_view): Likewise.
12262
12263 * fileread.cc (File_read::release): Don't call clear_views if
12264 there are multiple objects.
12265 * fileread.h (File_read::clear_uncached_views): New function.
12266 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12267 on the archive.
12268
12269 2008-03-31 Cary Coutant <ccoutant@google.com>
12270
12271 Add thin archive support.
12272 * archive.cc (Archive::armagt): New const.
12273 (Archive::setup): Remove task parameter and calls to unlock.
12274 (Archive::unlock_nested_archives): New function.
12275 (Archive::read_header): Add nested_off parameter. Change
12276 all callers.
12277 (Archive::interpret_header): Likewise.
12278 (Archive::include_all_members): Change to handle thin
12279 archives.
12280 (Archive::include_member): Likewise.
12281 * archive.h (Archive::Archive): Add new parameters and
12282 initializers.
12283 (Archive::armagt): New const.
12284 (Archive::setup): Remove task parameter.
12285 (Archive::unlock_nested_archives): New function.
12286 (Archive::read_header): Add nested_off parameter.
12287 (Archive::interpret_header): Likewise.
12288 (Archive::Nested_archive_table): New typedef.
12289 (Archive::is_thin_archive_): New field.
12290 (Archive::nested_archives_): New field.
12291 (Archive::options_): New field.
12292 (Archive::dirpath_): New field.
12293 (Archive::task_): New field.
12294 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12295 for thin archives. Pass additional parameters to
12296 Archive::Archive. Unlock the archive file after calling
12297 Archive::setup.
12298
12299 2008-03-29 Ian Lance Taylor <iant@google.com>
12300
12301 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12302 version symbol to be local.
12303 * testsuite/ver_test_4.sh: New file.
12304 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12305 (check_DATA): Add ver_test_4.syms.
12306 (ver_test_4.syms): New target.
12307 * testsuite/Makefile.in: Rebuild.
12308
12309 * output.cc
12310 (Output_section::Input_section_sort_entry::has_priority): New
12311 function.
12312 (Output_section::Input_section_sort_entry::match_file_name): New
12313 function.
12314 (Output_section::Input_section_sort_entry::match_section_name):
12315 Remove.
12316 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12317 Remove.
12318 (Output_section::Input_section_sort_entry::match_section_file):
12319 Remove.
12320 (Output_section::Input_section_sort_compare::operator()): Rewrite
12321 using new Input_section_sort_entry functions. Sort crtbegin and
12322 crtend first. Sort sections with no priority before sections with
12323 a priority.
12324 * testsuite/initpri1.c (d3): Check j != 4.
12325 (cd5): New constructor/destructor function.
12326 (main): Check j != 2.
12327
12328 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12329 new symbol when resolving, don't call set_is_default.
12330 * testsuite/ver_test_7.cc: New file.
12331 * testsuite/ver_test_7.sh: New file.
12332 * testsuite/Makefile.am (ver_test_7.so): New target.
12333 (ver_test_7.o): New target.
12334 (check_SCRIPTS): Add ver_test_7.sh.
12335 (check_DATA): Add ver_test_7.syms.
12336 (ver_test_7.syms): New target.
12337
12338 2008-03-28 Ian Lance Taylor <iant@google.com>
12339
12340 * layout.cc (Layout::layout): If we see an input section with a
12341 name that needs sorting, set the must_sort flag for the output
12342 section.
12343 (Layout::make_output_section): If the name of the output section
12344 indicates that it might require sorting, set the may_sort flag.
12345 * output.h (Output_section::may_sort_attached_input_sections): New
12346 function.
12347 (Output_section::set_may_sort_attached_input_sections): New
12348 function.
12349 (Output_section::must_sort_attached_input_sections): New
12350 function.
12351 (Output_section::set_must_sort_attached_input_sections): New
12352 function.
12353 (class Output_section): Declare Input_section_sort_entry. Define
12354 Input_section_sort_compare. Declare
12355 sort_attached_input_sections. Add new fields:
12356 may_sort_attached_input_sections_,
12357 must_sort_attached_input_sections_,
12358 attached_input_sections_are_sorted_.
12359 * output.cc (Output_section::Output_section): Initialize new
12360 fields.
12361 (Output_section::add_input_section): Add an entry to
12362 input_sections_ if may_sort or must_sort are true.
12363 (Output_section::set_final_data_size): Call
12364 sort_attached_input_sections if necessary.
12365 (Output_section::Input_section_sort_entry): Define new class.
12366 (Output_section::Input_section_sort_compare::operator()): New
12367 function.
12368 (Output_section::sort_attached_input_sections): New function.
12369 * configure.ac: Check whether the compiler supports constructor
12370 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12371 * testsuite/initpri1.c: New file.
12372 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12373 CONSTRUCTOR_PRIORITY.
12374 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12375 (initpri1_LDFLAGS): New variable.
12376 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12377
12378 2008-03-27 Ian Lance Taylor <iant@google.com>
12379
12380 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12381 * testsuite/common_test_1.c: New file.
12382 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12383 (common_test_1_SOURCES): New variable.
12384 (common_test_1_DEPENDENCIES): New variable.
12385 (common_test_1_LDFLAGS): New variable.
12386
12387 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12388 and commons_ correctly when NAME/VERSION does not override
12389 NAME/NULL.
12390 * testsuite/ver_test_6.c: New file.
12391 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12392 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12393 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12394
12395 2008-03-26 Ian Lance Taylor <iant@google.com>
12396
12397 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12398 of an undefined symbol from a version script.
12399 * testsuite/Makefile.am (ver_test_5.so): New target.
12400 (ver_test_5.o): New target.
12401 (check_SCRIPTS): Add ver_test_5.sh.
12402 (check_DATA): Add ver_test_5.syms.
12403 (ver_test_5.syms): New target.
12404 * testsuite/ver_test_5.cc: New file.
12405 * testsuite/ver_test_5.script: New file.
12406 * testsuite/ver_test_5.sh: New file.
12407 * Makefile.in, testsuite/Makefile.in: Rebuild.
12408
12409 PR gold/5986
12410 Fix problems building gold with gcc 4.3.0.
12411 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12412 (gold_error_at_location, gold_warning_at_location): Use it.
12413 * configure.ac: Check whether we can compile and use a template
12414 function with a printf attribute.
12415 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12416 when jumping over bytes.
12417 * object.cc: Instantiate Object::read_section_data.
12418 * debug.h: Include <cstring>
12419 * dwarf_reader.cc: Include <algorithm>
12420 * main.cc: Include <cstring>.
12421 * options.cc: Include <cstring>.
12422 * output.cc: Include <cstring>.
12423 * script.cc: Include <cstring>.
12424 * script.h: Include <string>.
12425 * symtab.cc: Include <cstring> and <algorithm>.
12426 * target-select.cc: Include <cstring>.
12427 * version.cc: Include <string>.
12428 * testsuite/testmain.cc: Include <cstdlib>.
12429 * configure, config.in: Rebuild.
12430
12431 2008-03-25 Ian Lance Taylor <iant@google.com>
12432
12433 * options.cc: Include "../bfd/bfdver.h".
12434 (options::help): Print bug reporting address.
12435
12436 * version.cc (print_version): Adjust output for current value of
12437 BFD_VERSION_STRING.
12438
12439 * NEWS: New file.
12440
12441 * options.cc (options::help): Print list of supported targets.
12442 * target-select.h: Include <vector>.
12443 (class Target_selector): Make machine_, size_, and is_big_endian_
12444 fields const. Add bfd_name_ and instantiated_target_ fields.
12445 (Target_selector::Target_selector): Add bfd_name parameter.
12446 (Target_selector::recognize): Make non-virtual, call
12447 do_recognize.
12448 (Target_selector::recognize_by_name): Make non-virtual, call
12449 do_recognize_by_name.
12450 (Target_selector::supported_names): New function.
12451 (Target_selector::bfd_name): New function.
12452 (Target_selector::do_instantiate_target): New pure virtual
12453 function.
12454 (Target_selector::do_recognize): New virtual function.
12455 (Target_selector::do_recognize_by_name): New virtual function.
12456 (Target_selector::instantiate_target): New private function.
12457 (supported_target_names): Declare.
12458 * target-select.cc (Target_selector::Target_selector): Update for
12459 new parameter and fields.
12460 (select_target_by_name): Check that the name matches before
12461 calling recognize_by_name.
12462 (supported_target_names): New function.
12463 * i386.cc (class Target_selector_i386): Update Target_selector
12464 constructor call. Remove recognize and recognize_by_name. Add
12465 do_instantiate_target.
12466 * x86_64.cc (class Target_selector_x86_64): Likewise.
12467 * testsuite/testfile.cc (class Target_selector_test): Update for
12468 changes to Target_selector.
12469
12470 * README: Rewrite, with some notes on unsupported features.
12471
12472 2008-03-24 Cary Coutant <ccoutant@google.com>
12473
12474 * i386.cc (Target_i386::Got_type): New enum declaration.
12475 (Target_i386::Scan::local): Updated callers of Output_data_got
12476 member functions.
12477 (Target_i386::Scan::global): Likewise.
12478 (Target_i386::Relocate::relocate): Likewise.
12479 (Target_i386::Relocate::relocate_tls): Likewise.
12480 * object.h (Got_offset_list): New class.
12481 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12482 (Sized_relobj::local_got_offset): Likewise.
12483 (Sized_relobj::set_local_got_offset): Likewise.
12484 (Sized_relobj::local_has_tls_got_offset): Removed.
12485 (Sized_relobj::local_tls_got_offset): Removed.
12486 (Sized_relobj::set_local_tls_got_offset): Removed.
12487 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12488 * output.cc (Output_data_got::add_global): Added got_type parameter.
12489 (Output_data_got::add_global_with_rel): Likewise.
12490 (Output_data_got::add_global_with_rela): Likewise.
12491 (Output_data_got::add_global_pair_with_rel): New function.
12492 (Output_data_got::add_global_pair_with_rela): New function.
12493 (Output_data_got::add_local): Added got_type parameter.
12494 (Output_data_got::add_local_with_rel): Likewise.
12495 (Output_data_got::add_local_with_rela): Likewise.
12496 (Output_data_got::add_local_pair_with_rel): New function.
12497 (Output_data_got::add_local_pair_with_rela): New function.
12498 (Output_data_got::add_global_tls): Removed.
12499 (Output_data_got::add_global_tls_with_rel): Removed.
12500 (Output_data_got::add_global_tls_with_rela): Removed.
12501 (Output_data_got::add_local_tls): Removed.
12502 (Output_data_got::add_local_tls_with_rel): Removed.
12503 (Output_data_got::add_local_tls_with_rela): Removed.
12504 * output.h (Output_data_got::add_global): Added got_type parameter.
12505 (Output_data_got::add_global_with_rel): Likewise.
12506 (Output_data_got::add_global_with_rela): Likewise.
12507 (Output_data_got::add_global_pair_with_rel): New function.
12508 (Output_data_got::add_global_pair_with_rela): New function.
12509 (Output_data_got::add_local): Added got_type parameter.
12510 (Output_data_got::add_local_with_rel): Likewise.
12511 (Output_data_got::add_local_with_rela): Likewise.
12512 (Output_data_got::add_local_pair_with_rel): New function.
12513 (Output_data_got::add_local_pair_with_rela): New function.
12514 (Output_data_got::add_global_tls): Removed.
12515 (Output_data_got::add_global_tls_with_rel): Removed.
12516 (Output_data_got::add_global_tls_with_rela): Removed.
12517 (Output_data_got::add_local_tls): Removed.
12518 (Output_data_got::add_local_tls_with_rel): Removed.
12519 (Output_data_got::add_local_tls_with_rela): Removed.
12520 * resolve.cc (Symbol::override_base_with_special): Removed
12521 reference to has_got_offset_ field.
12522 * symtab.cc (Symbol::init_fields): Replaced initialization
12523 of got_offset_ with got_offsets_. Removed initialization
12524 of has_got_offset_
12525 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12526 (Symbol::got_offset): Likewise.
12527 (Symbol::set_got_offset): Likewise.
12528 (Symbol::has_tls_got_offset): Removed.
12529 (Symbol::tls_got_offset): Removed.
12530 (Symbol::set_tls_got_offset): Removed.
12531 (Symbol::got_offset_): Removed.
12532 (Symbol::tls_mod_got_offset_): Removed.
12533 (Symbol::tls_pair_got_offset_): Removed.
12534 (Symbol::got_offsets_): New field.
12535 (Symbol::has_got_offset): Removed.
12536 (Symbol::has_tls_mod_got_offset): Removed.
12537 (Symbol::has_tls_pair_got_offset): Removed.
12538 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12539 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12540 member functions.
12541 (Target_x86_64::Scan::global): Likewise.
12542 (Target_x86_64::Relocate::relocate): Likewise.
12543 (Target_x86_64::Relocate::relocate_tls): Likewise.
12544
12545 2008-03-25 Ben Elliston <bje@au.ibm.com>
12546
12547 * yyscript.y: Fix spelling error in comment.
12548
12549 2008-03-24 Ian Lance Taylor <iant@google.com>
12550
12551 * options.h (class General_options): Define build_id option.
12552 * layout.h (class Layout): Declare write_build_id, create_note,
12553 create_build_id. Add build_id_note_ member.
12554 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12555 "libiberty.h", "md5.h", "sha1.h".
12556 (Layout::Layout): Initialize eh_frame_data_,
12557 eh_frame_hdr_section_, and build_id_note_.
12558 (Layout::finalize): Call create_build_id.
12559 (Layout::create_note): New function, broken out of
12560 Layout::create_gold_note.
12561 (Layout::create_gold_note): Call create_note.
12562 (Layout::create_build_id): New function.
12563 (Layout::write_build_id): New function.
12564 (Close_task_runner::run): Call write_build_id.
12565
12566 * x86_64.cc: Correct license to GPLv3.
12567
12568 2008-03-23 Ian Lance Taylor <iant@google.com>
12569
12570 * options.cc: Include "demangle.h".
12571 (parse_optional_string): New function.
12572 (parse_long_option): Handle takes_optional_argument.
12573 (parse_short_option): Update dash_z initializer. Handle
12574 takes_optional_argument.
12575 (General_options::General_options): Initialize do_demangle_.
12576 (General_options::finalize): Set do_demangle_. Handle demangling
12577 style.
12578 * options.h (parse_optional_string): Declare.
12579 (struct One_option): Add optional_arg field. Update constructor.
12580 Update call constructor calls. Add takes_optional_argument
12581 function.
12582 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12583 (DEFINE_optional_string): Define.
12584 (General_options::demangle): Change from DEFINE_bool to
12585 DEFINE_optional_string.
12586 (General_options::no_demangle): New function.
12587 (General_options::do_demangle): New function.
12588 (General_options::set_do_demangle): New function.
12589 (General_options::execstack_status_): Move definition to end of
12590 class definition.
12591 (General_options::static_): Likewise.
12592 (General_options::do_demangle_): New field.
12593 * object.cc (big_endian>::get_symbol_location_info): Call
12594 Options::do_demangle, not Options::demangle.
12595 * symtab.cc (demangle): Likewise.
12596
12597 2008-03-22 Ian Lance Taylor <iant@google.com>
12598
12599 * gold.h: Include <cstddef> and <sys/types.h>
12600 * options.h: Include <cstring>.
12601
12602 2008-03-21 Ian Lance Taylor <iant@google.com>
12603
12604 * Added source code to GNU binutils.