crash printing optimized out variant type
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
c891b3f9
SA
12012-09-10 Sterling Augustine <saugustine@google.com>
2
3 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
4 (Gdb_index::pubtypes_read): New parameter.
5 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
6 to calls.
7 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
8 pubtypes_object_.
9
e81fea4d
AM
102012-09-09 Alan Modra <amodra@gmail.com>
11
12 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
13 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
14 * gc.h (gc_process_relocs): Call target gc_add_reference.
15 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
16 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
17 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
18 unnecessary cast.
19 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
20 to cater for when we don't need code offset. Update use.
21 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
22 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
23 set_opd_valid): New functions.
24 (Target_powerpc::do_gc_add_reference): New function.
25 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
26 stashed refs.
27 (Target_powerpc::do_gc_mark_symbol): New function.
28
d2d60eef
CC
292012-09-06 Cary Coutant <ccoutant@google.com>
30
31 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
32 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
33 (Dwarf_die::skip_attributes): Likewise.
34 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
35 * testsuite/gdb_index_test.cc (inline_func_1): New function.
36 (main): Call it.
37 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
38
32ed4573
L
392012-09-05 H.J. Lu <hongjiu.lu@intel.com>
40
41 * testsuite/script_test_3.t: Add .got.plt output section
42 statement.
43 * testsuite/script_test_4.t: Likewise.
44
f4baf0d4
AM
452012-09-05 Alan Modra <amodra@gmail.com>
46
47 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
48 update all uses and lose "enum" when using type.
49
864a1b56
AM
502012-09-05 Alan Modra <amodra@gmail.com>
51
52 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
53 * configure: Regenerate.
54 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
55 (plugin_final_layout.stdout): Likewise.
56 (memory_test): Set page sizes to 0x1000.
57 * testsuite/Makefile.in: Regenerate.
58 * testsuite/discard_locals_test.sh: Add FIXME comment.
59 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
60 * testsuite/pr14265.t: Add .got output section statement.
61 * testsuite/script_test_2.t: Likewise.
62 * testsuite/script_test_3.t: Likewise.
63 * testsuite/script_test_4.t: Likewise.
64 * testsuite/script_test_5.t: Likewise.
65 * testsuite/script_test_6.t: Likewise.
66 * testsuite/script_test_7.t: Likewise.
67 * testsuite/script_test_9.t: Likewise.
68
3ea0a085
AM
692012-09-05 Alan Modra <amodra@gmail.com>
70
71 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
72 (Powerpc_relocate_functions::Status): New typedef.
73 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
74 (Target_powerpc::Scan::local): Handle REL64.
75 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
76 for REL32 and REL64.
77 (Target_powerpc::symval_for_branch): New function, extracted from..
78 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
79 checks. Report overflow errors.
80
7404fe1b
AM
812012-09-05 Alan Modra <amodra@gmail.com>
82
83 * object.h (Sized_relobj_file::emit_relocs): Delete.
84 (Sized_relobj_file::emit_relocs_reltype): Delete.
85 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
86 relocate_relocs for --emit-relocs.
87 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
88 * output.h: Update comment.
89 (Output_segment::first_section): New function.
90 (Output_segment::first_section_load_address): Use first_section.
91 * output.cc (Output_segment::first_section): New function extracted..
92 (Output_segment::first_section_load_address): ..from here. Delete.
93 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
94 * target.h (Sized_target::relocate_for_relocatable): Likewise.
95 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
96 adjust call to target.h function.
97 * i386.cc (Target_i386): Likewise.
98 * sparc.cc (Target_sparc): Likewise.
99 * x86_64.cc (Target_x86_64): Likewise.
100 * powerpc.cc (Target_powerpc): Likewise.
101 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
102 first tls section has section symbol for optimised local dynamic
103 output relocs.
104 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
105 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
106 optimised tls code.
107 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
108 Rename to relocate_relocs. Update error message.
109
957564c9
AS
1102012-09-04 Andreas Schwab <schwab@linux-m68k.org>
111
112 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
113 --just-symbols.
114
dd93cd0a
AM
1152012-08-31 Alan Modra <amodra@gmail.com>
116
117 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
118 (Powerpc_relobj::toc_base_offset): New stub function.
119 (Target_powerpc): Add tp_offset, dtp_offset. Rename
120 got_mod_index_offset to tlsld_got_offset. Update all refs.
121 (Target_powerpc::Relocate::enum skip_tls): New.
122 (Target_powerpc::call_tls_get_addr_): New var.
123 (Target_powerpc::is_branch_reloc): Move to file scope.
124 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
125 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
126 New functions.
127 (Target_powerpc::enum Got_type): Delete old values, add new ones.
128 (powerpc_info): Correct common_pagesize for ppc64.
129 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
130 (Powerpc_relocate_functions): Add overflow check enums and functions.
131 Add non-shift version of rela, rela_ua. Delete all rel public
132 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
133 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
134 addr16_ha3, addr14 functions.
135 (Output_data_got_powerpc::add_constant_pair): New function.
136 (Output_data_got_powerpc::got_base_offset): Likewise.
137 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
138 (instruction constants): Sort, add some more.
139 (Output_data_glink::do_write): Add and use Address typedef. Use
140 object->toc_base_offset() stub for 64-bit.
141 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
142 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
143 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
144 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
145 Always treat .opd relocs as against locally defined symbol.
146 Correct condition for RELATIVE relocs.
147 (Target_powerpc::do_finalize_sections): Test for NULL sections.
148 (Target_powerpc::Relocate::relocate): Use plt call stub as value
149 for 32-bit syms with a plt entry. Correct ppc64 toc base
150 calculations. Handle TLS relocs, and more. Add overflow
151 checking and adjust for Powerpc_relocate_functions changes.
152 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
153 Reinstate --emit-relocs code with FIXME.
154
a1373b60
AM
1552012-08-30 Alan Modra <amodra@gmail.com>
156
157 * layout.cc (Layout::set_segment_offsets): Set p_align to
158 abi_pagesize, not common_pagesize.
159 (Layout::relaxation_loop_body): Similarly use abi_pagesize
160 to determine whether file header can go in segment.
161
703d02da
AM
1622012-08-30 Alan Modra <amodra@gmail.com>
163
164 * output.h (Output_reloc::Output_reloc <output section>): Add
165 is_relative param. Adjust calls.
166 (Output_reloc::add_output_section_relative): New functions.
167 * output.cc (Output_reloc::Output_reloc <output section>): Handle
168 is_relative.
169 (Output_reloc::symbol_value): Handle SECTION_CODE.
170
16164a6b
ST
1712012-08-24 Sriraman Tallam <tmsriram@google.com>
172
173 * gold.cc (queue_middle_tasks): Call layout again when unique
174 segments for sections is desired.
175 * layout.cc (Layout::Layout): Initialize new members.
176 (Layout::get_output_section_flags): New function.
177 (Layout::choose_output_section): Call get_output_section_flags.
178 (Layout::layout): Make output section for mapping to a unique segment.
179 (Layout::insert_section_segment_map): New function.
180 (Layout::attach_allocated_section_to_segment): Make unique segment for
703d02da 181 output sections marked so.
16164a6b
ST
182 (Layout::segment_precedes): Check for unique segments when sorting.
183 * layout.h (Layout::Unique_segment_info): New struct.
184 (Layout::Section_segment_map): New typedef.
185 (Layout::insert_section_segment_map): New function.
186 (Layout::get_output_section_flags): New function.
187 (Layout::is_unique_segment_for_sections_specified): New function.
188 (Layout::set_unique_segment_for_sections_specified): New function.
189 (Layout::unique_segment_for_sections_specified_): New member.
190 (Layout::section_segment_map_): New member.
191 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
192 Rename is_gc_pass_one to is_pass_one.
193 Rename is_gc_pass_two to is_pass_two.
194 Rename is_gc_or_icf to is_two_pass.
195 Check for which pass based on whether symbols data is present.
196 Make it two pass when unique segments for sections is desired.
197 * output.cc (Output_section::Output_section): Initialize new
198 members.
199 * output.h (Output_section::is_unique_segment): New function.
200 (Output_section::set_is_unique_segment): New function.
201 (Output_section::is_unique_segment_): New member.
202 (Output_section::extra_segment_flags): New function.
203 (Output_section::set_extra_segment_flags): New function.
204 (Output_section::extra_segment_flags_): New member.
205 (Output_section::segment_alignment): New function.
206 (Output_section::set_segment_alignment): New function.
207 (Output_section::segment_alignment_): New member.
208 (Output_segment::Output_segment): Initialize is_unique_segment_.
209 (Output_segment::is_unique_segment): New function.
210 (Output_segment::set_is_unique_segment): New function.
211 (Output_segment::is_unique_segment_): New member.
212 * plugin.cc (allow_unique_segment_for_sections): New function.
213 (unique_segment_for_sections): New function.
214 (Plugin::load): Add new functions to transfer vector.
215 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
216 * Makefile.in: Regenerate.
217 * testsuite/plugin_final_layout.sh: Check if unique segment
218 functionality works.
219 * testsuite/plugin_section_order.c (onload): Check if new interfaces
220 are available.
221 (allow_unique_segment_for_sections): New global.
222 (unique_segment_for_sections): New global.
223 (claim_file_hook): Call allow_unique_segment_for_sections.
224 (all_symbols_read_hook): Call unique_segment_for_sections.
16164a6b 225
1e2bee4f
CC
2262012-08-22 Cary Coutant <ccoutant@google.com>
227
228 * layout.cc (Layout::include_section): Don't assert on GROUP
229 sections with --emit-relocs.
230
1d5dfe78
CC
2312012-08-21 Cary Coutant <ccoutant@google.com>
232
233 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
234 if --export-dynamic-symbol names an undef symbol.
235
c9269dff
AM
2362012-08-18 Alan Modra <amodra@gmail.com>
237
238 * powerpc.cc: Formatting and white space.
239 (Powerpc_relobj): Rename got2_section_ to special_.
240 Add opd_ent_shndx_ and opd_ent_off_ vectors.
241 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
242 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
243 (Target_powerpc): Add Address typedef and invalid_address. Use
244 throughout.
245 (Target_powerpc::is_branch_reloc): New function.
246 (Powerpc_relocate_functions): Add Address typedef, use throughout.
247 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
248 for dst_mask, value and addend.
249 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
250 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
251 (Output_data_glink::do_write): Correct toc base. Don't try to use
252 uint16_t for 24-bit offset. Use get_output_section_offset and
253 check return.
254 (Target_powerpc::Scan::local): Handle more relocs.
255 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
256 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
257 Plug in toc restoring insn after plt calls. Translate branches
258 to function descriptor symbols to corresponding entry point.
259 (Target_powerpc::relocate_for_relocatable): Check return from
260 get_output_section_offset.
261 * symtab.h: Comment typo.
262
b1759dce
ILT
2632012-08-14 Ian Lance Taylor <iant@google.com>
264
265 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
266 unsupported_relocal_local to call unsupported_reloc_global.
267
b9b2ae8b
NC
2682012-08-14 Nick Clifton <nickc@redhat.com>
269
270 PR ld/14265
271 * script-sections.cc (Sections_element::output_section_name): Add
272 keep return parameter.
273 (Output_section_element::match_name): Add keep return parameter.
274 Return the value of the keep_ member.
275 * script-sections.h (class Output_section): Update
276 output_section_name prototype.
277 * layout.cc (Layout::keep_input_section): New public member
278 function.
279 (Layout::choose_output_section): Pass keep parameter to
280 output_section_name.
281 * layout.h (class Layout): Add keep_input_section.
282 * object.cc (Sized_relobj_file::do_layout): Check for kept input
283 sections.
284 * testsuite/Makefile.am: Add a test.
285 * testsuite/Makefile.in: Regenerate.
286 * testsuite/pr14265.c: Source file for the test.
287 * testsuite/pr14265.t: Linker script for the test.
288 * testsuite/pr14265.sh: Shell script for the test.
289
921b5322
AM
2902012-08-14 Alan Modra <amodra@gmail.com>
291
292 * target.h (Target::output_section_name): New function.
293 (Target::do_output_section_name): New function.
294 * layout.cc (Layout::choose_output_section): Call the above.
295 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
296
6ce78956
AM
2972012-08-14 Alan Modra <amodra@gmail.com>
298
299 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
300 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
301 for replace_constant call.
302 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
303 (Output_data_glink::do_print_to_mapfile): New function.
304 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
305 (Target_powerpc::Relocate::relocate): Likewise.
306
d1a8cabd
AM
3072012-08-14 Alan Modra <amodra@gmail.com>
308
309 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
310 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
311 (Output_data_glink::add_entry,find_entry): Remove shndx param.
312 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
313 all references to shndx_. Handle special case for R_PPC_PLTREL24
314 here.
315 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
316 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
317 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
318 here.
319 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
320 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
321
d83ce4e3
AM
3222012-08-12 Alan Modra <amodra@gmail.com>
323
324 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
325 (glink insn constants): Use uint32_t.
326 (Output_data_glink::add_entry): Use insert, not [] operator.
327
cf43a2fe
AM
3282012-08-11 Alan Modra <amodra@gmail.com>
329
330 * object.h (Sized_relobj_file::find_shdr): New function.
331 (Sized_relobj_file::find_special_sections): New function.
332 * object.cc (Sized_relobj_file::find_shdr): New function.
333 (Sized_relobj_file::find_eh_frame): Use find_shdr.
334 (Sized_relobj_file::find_special_sections): New function, split out..
335 (Sized_relobj_file::do_read_symbols): ..from here.
336 * output.h (Output_data_got::replace_constant): New function.
337 (Output_data_got::num_entries): New function.
338 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
339 (Output_data_got::got_offset): Protected rather than private.
340 (Output_data_got::replace_got_entry): New function.
341 * output.cc (Output_data_got::replace_got_entry): New function.
342 * powerpc.cc (class Powerpc_relobj): New.
343 (class Powerpc_relocate_functions): Delete all psymval variants or
344 convert to value,addend type. Delete pcrela, pcrela_unaligned.
345 Implement _ha functions using corresponding _hi function.
346 (Powerpc_relobj::find_special_sections): New function.
347 (Target_powerpc::do_make_elf_object): New function.
348 (class Output_data_got_powerpc): New.
349 (class Output_data_glink): New.
350 (class Powerpc_scan_relocatable_reloc): New.
351 Many more changes througout file.
352
3c892704
NC
3532012-08-09 Nick Clifton <nickc@redhat.com>
354
355 * po/vi.po: Updated Vietnamese translation.
356
82435b3b
ILT
3572012-08-07 Ian Lance Taylor <iant@google.com>
358
359 * layout.cc (Layout::add_target_dynamic_tags): If
360 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
361 plt_rel.
362
a6dc81d2
NC
3632012-07-30 Nick Clifton <nickc@redhat.com>
364
365 * po/gold.pot: Updated template.
366 * po/es.po: Updated Spanish translation.
367
f1415016
CC
3682012-07-18 Cary Coutant <ccoutant@google.com>
369
370 PR gold/14344
371 * configure.ac: Add check for -gpubnames support.
372 * configure: Regenerate.
373 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
374 support; force -gno-pubnames.
375 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
376 support.
377 (gdb_index_test_4): New test.
378 * testsuite/Makefile.in: Regenerate.
379 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
380 * testsuite/gdb_index_test_2.sh: Likewise.
381 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
382 * testsuite/gdb_index_test_4.sh: New script.
383 * testsuite/gdb_index_test_comm.sh: New script with common code;
384 don't look for space after colon.
385
b7fd7c37
ST
3862012-07-16 Sriraman Tallam <tmsriram@google.com>
387
388 * gold.cc (queue_middle_tasks): Update function order only after
389 deferred objects due to plugins are processed.
390
1f3212db
ILT
3912012-07-11 Ian Lance Taylor <iant@google.com>
392
393 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
394 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
395 (Target_arm::scan_reloc_for_stub): Likewise.
396 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
397 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
398 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
399 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
400 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
401
81c82a68
ILT
4022012-07-10 Dodji Seketeli <dodji@redhat.com>
403 Ian Lance Taylor <iant@google.com>
404
405 PR gold/14309
406 * configure.ac: Test whether std::tr1::hash<off_t> works.
407 * gold.h: Add a specialization for std::tr1::hash<off_t> if
408 needed.
409 * output.h (class Output_fill): Add virtual destructor.
410 * configure, config.in: Rebuild.
411
eabc84f4
RM
4122012-06-22 Roland McGrath <mcgrathr@google.com>
413
414 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
415
370e30b6
RÁE
4162012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
417
418 * plugin.cc (Plugin::load): Handle position independent executables.
419
fb1b895d
CC
4202012-06-06 Cary Coutant <ccoutant@google.com>
421
422 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
423 add .debug_macro.
424 (lines_only_debug_sections): Likewise.
425 (gdb_fast_lookup_sections): New static array.
426 (is_gdb_debug_section): Rename formal parameter.
427 (is_lines_only_debug_section): Likewise.
428 (is_gdb_fast_lookup_section): New function.
429 (Layout::include_section): Check for ".zdebug_" prefix; pass
430 section name suffix to is_gdb_debug_section, et al.; check for
431 fast-lookup sections when building .gdb_index.
432 * options.h (--strip-debug-gdb): Update GDB version number.
433
7c0640fa
CC
4342012-06-06 Cary Coutant <ccoutant@google.com>
435
436 * configure.ac: Add check for fallocate.
437 * configure: Regenerate.
438 * config.in: Regenerate.
439
440 * options.h (class General_options): Add --mmap-output-file and
441 --posix-fallocate options.
442 * output.cc: (posix_fallocate): Remove; replace with...
443 (gold_fallocate): New function.
444 (Output_file::map_no_anonymous): Call gold_fallocate.
445 (Output_file::map): Check --mmap-output-file option.
446
2a49eb69
DK
4472012-06-05 Jing Yu <jingyu@google.com>
448
449 * gold.h (textdomain): Add do {} to empty while(0).
450 (bindtextdomain): Likewise.
451
fad072ac
CC
4522012-06-04 Cary Coutant <ccoutant@google.com>
453
454 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
455 has_dynsym_index.
456
8cc69fb6
ST
4572012-05-25 Sriraman Tallam <tmsriram@google.com>
458
459 * symtab.cc (Symbol_table::define_special_symbol):
460 Initialize *poldsym to prevent uninitialized variable errors.
461
1be75daa
CC
4622012-05-23 Cary Coutant <ccoutant@google.com>
463
464 * layout.cc (Layout::section_name_mapping): Add rules to handle
465 exact match on .data.rel.ro.local or .data.rel.ro.
466 (Layout::output_section_name): Check for exact matches.
467
9b689de0
CC
4682012-05-23 Cary Coutant <ccoutant@google.com>
469
470 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
471 more carefully.
472
b24fdbf5
CC
4732012-05-22 Cary Coutant <ccoutant@google.com>
474
475 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
476 object before exporting symbol.
477
e550e1a2
L
4782012-05-21 H.J. Lu <hongjiu.lu@intel.com>
479
480 * testsuite/tls_test.cc: Include "config.h" first.
481 * testsuite/tls_test_c.c: Likewise.
482
df7b86aa
NC
4832012-05-17 Daniel Richard G. <skunk@iskunk.org>
484 Nick Clifton <nickc@redhat.com>
485
486 PR 14072
487 * configure.in: Add check that sysdep.h has been included before
488 any system header files.
489 * configure: Regenerate.
490 * config.in: Regenerate.
491
1007b503
CC
4922012-05-14 Cary Coutant <ccoutant@google.com>
493
494 * layout.cc (Layout::make_output_section): Mark .tdata section
495 as RELRO.
496 * testsuite/relro_test.cc: Add a TLS variable.
497
fd885f3a
L
4982012-05-10 H.J. Lu <hongjiu.lu@intel.com>
499
500 PR gold/14091
501 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
502 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
503 R_X86_64_64.
504
80f5885c
CC
5052012-05-08 Cary Coutant <ccoutant@google.com>
506
507 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
508 (lines_only_debug_sections): Likewise.
509
2e702c99
RM
5102012-05-02 Roland McGrath <mcgrathr@google.com>
511
512 * nacl.cc: New file.
513 * nacl.h: New file.
514 * Makefile.am (CCFILES, HFILES): Add them.
515 * Makefile.in: Regenerate.
516 * i386.cc (Output_data_plt_i386_nacl): New class.
517 (Output_data_plt_i386_nacl_exec): New class.
518 (Output_data_plt_i386_nacl_dyn): New class.
519 (Target_i386_nacl): New class.
520 (Target_selector_i386_nacl): New class.
521 (target_selector_i386): Use it instead of Target_selector_i386.
522 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
523 (Target_x86_64_nacl): New class.
524 (Target_selector_x86_64_nacl): New class.
525 (target_selector_x86_64, target_selector_x32): Use it instead of
526 Target_selector_x86_64.
527 * arm.cc (Output_data_plt_arm_nacl): New class.
528 (Target_arm_nacl): New class.
529 (Target_selector_arm_nacl): New class.
530 (target_selector_arm, target_selector_armbe): Use it instead of
531 Target_selector_arm.
532
533 * target-select.cc (select_target): Take new Input_file* and off_t
534 arguments, pass them on to recognize method of selector.
535 * object.cc (make_elf_sized_object): Update caller.
536 * parameters.cc (parameters_force_valid_target): Likewise.
537 * incremental.cc (make_sized_incremental_binary): Likewise.
538 * target-select.h: Update decl.
539 (Target_selector::recognize): Take new Input_file* argument,
540 pass it on to do_recognize.
541 (Target_selector::do_recognize): Take new Input_file* argument.
542 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
543 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
544 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
545 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
546
547 * target.h (Target::Target_info): New members isolate_execinstr
548 and rosegment_gap.
549 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
550 * arm.cc (Target_arm::arm_info): Update initializer.
551 * i386.cc (Target_i386::i386_info): Likewise.
552 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
553 * sparc.cc (Target_sparc::sparc_info): Likewise.
554 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
555 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
556 * layout.cc (Layout::attach_allocated_section_to_segment):
557 Take new const Target* argument. If target->isolate_execinstr(), act
558 like --rosegment.
559 (Layout::find_first_load_seg): Take new const Target* argument;
560 if target->isolate_execinstr(), reject PF_X segments.
561 (Layout::relaxation_loop_body): Update caller.
562 (Layout::set_segment_offsets): If target->isolate_execinstr(),
563 reset file offset to zero when we hit LOAD_SEG, and then do a second
564 loop over the segments before LOAD_SEG to reassign offsets after
565 addresses have been determined. Handle target->rosegment_gap().
566 (Layout::attach_section_to_segment): Take new const Target* argument;
567 pass it to attach_allocated_section_to_segment.
568 (Layout::make_output_section): Update caller.
569 (Layout::attach_sections_to_segments): Take new const Target* argument;
570 pass it to attach_section_to_segment.
571 * gold.cc (queue_middle_tasks): Update caller.
572 * layout.h (Layout): Update method decls with new arguments.
573
574 * arm.cc (Target_arm::Target_arm): Take optional argument for the
575 Target_info pointer to use.
576 (Target_arm::do_make_data_plt): New virtual method.
577 (Target_arm::make_data_plt): New method that calls it.
578 (Target_arm::make_plt_entry): Use it.
579 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
580 for the section alignment.
581 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
582 method.
583 (Output_data_plt_arm::first_plt_entry_offset): Call it.
584 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
585 method.
586 (Output_data_plt_arm::get_plt_entry_size): Call it.
587 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
588 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
589 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
590 method.
591 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
592 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
593 method instead of sizeof(plt_entry).
594 (Output_data_plt_arm::add_entry): Likewise.
595 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
596 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
597 than static method.
598 (Target_arm::plt_entry_size): Likewise.
599 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
600 Move to ...
601 (Output_data_plt_arm_standard): ... here, new class.
602 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
603 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
604 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
605
606 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
607 Take additional argument for the PLT entry size.
608 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
609 Use get_plt_entry_size method rather than plt_entry_size variable.
610 (Output_data_plt_x86_64::reserve_slot): Likewise.
611 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
612 (Output_data_plt_x86_64::add_entry): Likewise.
613 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
614 (Output_data_plt_x86_64::address_for_global): Likewise.
615 (Output_data_plt_x86_64::address_for_local): Likewise.
616 (Output_data_plt_x86_64::set_final_data_size): Likewise.
617 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
618 Make method non-static.
619 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
620 method.
621 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
622 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
623 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
624 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
625 virtual method.
626 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
627 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
628 virtual method.
629 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
630 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
631 virtual method.
632 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
633 (Output_data_plt_x86_64::plt_entry_size)
634 (Output_data_plt_x86_64::first_plt_entry)
635 (Output_data_plt_x86_64::plt_entry)
636 (Output_data_plt_x86_64::tlsdesc_plt_entry)
637 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
638 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
639 (Output_data_plt_x86_64_standard): ... here, new class.
640 (Target_x86_64::Target_x86_64): Take optional argument for the
641 Target_info pointer to use.
642 (Target_x86_64::do_make_data_plt): New virtual method.
643 (Target_x86_64::make_data_plt): New method to call it.
644 (Target_x86_64::init_got_plt_for_update): Use that.
645 Call this->plt_->add_eh_frame method here.
646 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
647 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
648 rather than static method.
649 (Target_x86_64::plt_entry_size): Likewise.
650 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
651 rather than plt_entry_size variable. Move guts of PLT filling to...
652 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
653 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
654 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
655
656 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
657 additional argument for the section alignment.
658 Don't do add_eh_frame_for_plt here.
659 (Output_data_plt_i386::first_plt_entry_offset): Make the method
660 non-static. Use get_plt_entry_size method rather than plt_entry_size
661 variable.
662 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
663 method.
664 (Output_data_plt_i386::get_plt_entry_size): Call it.
665 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
666 (Output_data_plt_i386::add_eh_frame): New method to call it.
667 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
668 method.
669 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
670 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
671 method.
672 (Output_data_plt_i386::fill_plt_entry): New method to call it.
673 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
674 method instead of plt_entry_size.
675 (Output_data_plt_i386::plt_entry_size)
676 (Output_data_plt_i386::plt_eh_frame_fde_size)
677 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
678 (Output_data_plt_i386_standard): ... here, new class.
679 (Output_data_plt_i386_exec): New class.
680 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
681 (Output_data_plt_i386_exec::first_plt_entry): ... here.
682 (Output_data_plt_i386::exec_plt_entry): Move to ...
683 (Output_data_plt_i386_exec::plt_entry): ... here.
684 (Output_data_plt_i386_dyn): New class.
685 (Output_data_plt_i386::first_plt_entry): Move to ...
686 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
687 (Output_data_plt_i386::dyn_plt_entry): Move to ...
688 (Output_data_plt_i386_dyn::plt_entry): ... here.
689 (Target_i386::Target_i386): Take optional argument for the Target_info
690 pointer to use.
691 (Target_i386::do_make_data_plt): New virtual method.
692 (Target_i386::make_data_plt): New method to call it.
693 (Target_i386::make_plt_section): Use that.
694 Call this->plt_->add_eh_frame method here.
695 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
696 rather than plt_entry_size variable.
697 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
698 (Output_data_plt_i386::address_for_local): Likewise.
699 (Output_data_plt_i386::do_write): Likewise.
700 Move guts of PLT filling to...
701 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
702 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
703 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
704 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
705
b9b9f2ee
CC
7062012-05-01 Cary Coutant <ccoutant@google.com>
707
708 * dwarf_reader.cc (Dwarf_die::read_attributes)
709 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
710 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
711 * reduced_debug_output.cc
712 (Output_reduced_debug_info_section::get_die_end): Remove
713 DW_FORM_GNU_ref_index. Add default case.
714
57923f48
MW
7152012-04-26 Mark Wielaard <mjw@redhat.com>
716
717 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
718 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
719 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
720 DW_AT_high_pc as offset from DW_AT_low_pc.
721
722 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
723 * testsuite/Makefile.in: Regenerate.
724 * testsuite/gdb_index_test_3.c: New test source file.
725 * testsuite/gdb_index_test_3.sh: New test source file.
726
2c54b4f4
ILT
7272012-04-25 Ian Lance Taylor <iant@google.com>
728
729 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
730 pointer.
731 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
732 as a class, not a struct.
733 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
734 (Target_arm::apply_cortex_a8_workaround): Likewise.
735 * gc.h: Declare Reloc_types as a struct, not a class.
736 * object.h: Declare Symbols_data as a struct.
737 * reloc.h: Declare Read_relocs_data as a struct.
738 * target.h: Declare Relocate_info as a struct.
739
a5a5f7a3
DM
7402012-04-24 David S. Miller <davem@davemloft.net>
741
742 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
743 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
744 and R_SPARC_WPLT30.
745
f038d496
CC
7462012-04-24 Cary Coutant <ccoutant@google.com>
747
748 * incremental-dump.cc (find_input_containing_global): Replace
749 magic number with symbolic constant.
750 (dump_incremental_inputs): Update version number.
751 * incremental.cc (Output_section_incremental_inputs): Update version
752 number; import symbolic constants from Incremental_inputs_reader.
753 (Incremental_inputs::create_data_sections): Align relocations
754 section correctly for 64-bit targets.
755 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
756 constants; add padding.
757 (Output_section_incremental_inputs::write_header): Add assert for
758 header_size.
759 (Output_section_incremental_inputs::write_input_files): Add assert
760 for input_entry_size.
761 (Output_section_incremental_inputs::write_info_blocks): Add padding;
762 add assert for object_info_size, input_section_entry_size,
763 global_sym_entry_size.
764 * incremental.h (Incremental_inputs_reader): Add symbolic constants
765 for data structure sizes; use them.
766 (Incremental_input_entry_reader): Import symbolic constants from
767 Incremental_inputs_reader; use them.
768
a4d85145
DM
7692012-04-23 David S. Miller <davem@davemloft.net>
770
771 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
772 and elf_flags_set_.
773 (Target_sparc::Target_sparc): Initialize new fields.
774 (Target_sparc::do_make_elf_object): New function.
775 (Target_sparc::do_adjust_elf_header): New function.
776
1d509098
CC
7772012-04-23 Cary Coutant <ccoutant@google.com>
778
779 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
780 CU range table of gdb index.
781
7ebeff7f
DM
7822012-04-20 David S. Miller <davem@davemloft.net>
783
784 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
785 instead of false.
786
13cf9988
DM
7872012-04-16 David S. Miller <davem@davemloft.net>
788
2a1079e8
DM
789 * sparc.cc (Target_sparc::got_address): New function.
790 (Sparc_relocate_functions::gdop_hix22): New function.
791 (Sparc_relocate_functions::gdop_lox10): New function.
792 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
793 relocs.
794 (Target_sparc::Scan::local): Likewise if the global symbol is not
795 preemptible and is not IFUNC.
796 (Target_sparc::Relocate::relocate): Perform GOTDATA code
797 transformations for local and non-preemptible non-IFUNC global
798 symbols.
799
0bc964fc
DM
800 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
801 writing out 64-bit part of ranges.
802
661d7a80
DM
803 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
804 -fpic and -fpie respectively.
805 * Makefile.in: Regenerate.
806
8c2bf391
DM
807 * sparc.cc (class Target_sparc): Add rela_ifunc_.
808 (Target_sparc::Target_sparc): Initialize new field.
809 (Target_sparc::do_plt_section_for_global): New function.
810 (Target_sparc::do_plt_section_for_local): New function.
811 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
812 (Target_sparc::make_plt_section): New function, broken out of
813 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
814 (Target_sparc::make_plt_entry): Call make_plt_section.
815 (Target_sparc::make_local_ifunc_plt_entry): New function.
816 (Target_sparc::rela_ifunc_section): New function.
817 (Target_sparc::plt_section): Remove const.
818 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
819 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
820 and ifunc_count_ fields.
821 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
822 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
823 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
824 (Output_data_plt_sparc::rela_ifunc): New function.
825 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
826 (Output_data_plt_sparc::has_ifunc_section): New function.
827 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
828 (Output_data_plt_sparc::address_for_global): New function.
829 (Output_data_plt_sparc::address_for_local): New function.
830 (Output_data_plt_sparc::plt_index_to_offset): New function.
831 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
832 and entry_count.
833 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
834 entry_count.
835 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
836 R_SPARC_JMP_IREL to switch.
837 (Target_sparc::Scan::check_non_pic): Likewise.
838 (Target_sparc::Scan::local): Handle IFUNC symbols.
839 (Target_sparc::Scan::local): Likewise.
840 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
841 and plt_address_for_local.
842 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
843 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
844
13cf9988
DM
845 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
846 (class Output_data_reloc): Adjust calls to Output_reloc_type.
847 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
848 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
849 global relocs too.
850 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
851 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
852 calls.
853 * sparc.cc (Target_sparc::Scan::global): Likewise.
854 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
855
31821be0
CC
8562012-04-16 Cary Coutant <ccoutant@google.com>
857
858 * archive.cc (Library_base::should_include_member): Check for
859 --export-dynamic-symbol.
860 * options.h (class General_options): Add --export-dynamic-symbol.
861 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
862 --export-dynamic-symbol.
863 (Symbol_table::gc_mark_undef_symbols): Likewise.
864 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
865
2615994e
DM
8662012-04-12 David S. Miller <davem@davemloft.net>
867
868 * sparc.cc (Reloc::wdisp10): New relocation method.
869 (Reloc::h34): Likewise.
870 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
871 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
872 R_SPARC_WDISP10.
873 (Target_sparc::Scan::local): Likewise.
874 (Target_sparc::Scan::global): Likewise.
875 (Target_sparc::Relocate::relocate): Likewise.
876
6782735d
CC
8772012-04-09 Cary Coutant <ccoutant@google.com>
878
879 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
880 low_pc == 0.
881
8c7a0b00
ILT
8822012-04-06 Ian Lance Taylor <iant@google.com>
883
884 * timer.cc: #include <unistd.h>.
885
58797674
RM
8862012-04-06 Roland McGrath <mcgrathr@google.com>
887
888 * configure.in (AC_CHECK_HEADERS): Add locale.h.
889 * config.in: Regenerate.
890 * configure: Regenerate.
891
44350750
NC
8922012-04-05 Nick Clifton <nickc@redhat.com>
893
894 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
895 (AM_LC_MESSAGES): Add.
896 * aclocal.m4: Regenerate.
897 * config.in: Regenerate.
898 * configure: Regenerate.
899
c1027032
CC
9002012-03-21 Cary Coutant <ccoutant@google.com>
901
902 * Makefile.am: Add gdb-index.cc, gdb-index.h.
903 * Makefile.in: Regenerate.
904 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
905 (Sized_elf_reloc_mapper::symbol_section): New function.
906 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
907 (make_elf_reloc_mapper): New function.
908 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
909 (Dwarf_abbrev_table::do_read_abbrevs): New function.
910 (Dwarf_abbrev_table::do_get_abbrev): New function.
911 (Dwarf_ranges_table::read_ranges_table): New function.
912 (Dwarf_ranges_table::read_range_list): New function.
913 (Dwarf_pubnames_table::read_section): New function.
914 (Dwarf_pubnames_table::read_header): New function.
915 (Dwarf_pubnames_table::next_name): New function.
916 (Dwarf_die::Dwarf_die): New function.
917 (Dwarf_die::read_attributes): New function.
918 (Dwarf_die::skip_attributes): New function.
919 (Dwarf_die::set_name): New function.
920 (Dwarf_die::set_linkage_name): New function.
921 (Dwarf_die::attribute): New function.
922 (Dwarf_die::string_attribute): New function.
923 (Dwarf_die::int_attribute): New function.
924 (Dwarf_die::uint_attribute): New function.
925 (Dwarf_die::ref_attribute): New function.
926 (Dwarf_die::child_offset): New function.
927 (Dwarf_die::sibling_offset): New function.
928 (Dwarf_info_reader::check_buffer): New function.
929 (Dwarf_info_reader::parse): New function.
930 (Dwarf_info_reader::do_parse): New function.
931 (Dwarf_info_reader::do_read_string_table): New function.
932 (Dwarf_info_reader::lookup_reloc): New function.
933 (Dwarf_info_reader::get_string): New function.
934 (Dwarf_info_reader::visit_compilation_unit): New function.
935 (Dwarf_info_reader::visit_type_unit): New function.
936 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
937 Sized_elf_reloc_mapper.
938 (Sized_dwarf_line_info::symbol_section): Remove function.
939 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
940 (Sized_dwarf_line_info::read_line_mappings): Remove object
941 parameter, adjust callers.
942 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
943 * dwarf_reader.h: Include <sys/types.h>.
944 (class Track_relocs): Remove forward declaration.
945 (class Elf_reloc_mapper): New class.
946 (class Sized_elf_reloc_mapper): New class.
947 (class Dwarf_abbrev_table): New class.
948 (class Dwarf_range_list): New class.
949 (class Dwarf_ranges_table): New class.
950 (class Dwarf_pubnames_table): New class.
951 (class Dwarf_die): New class.
952 (class Dwarf_info_reader): New class.
953 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
954 (Sized_dwarf_line_info::symbol_section): Remove member function.
955 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
956 base class.
957 * gdb-index.cc: New source file.
958 * gdb-index.h: New source file.
959 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
960 and .debug_types sections, call Layout::add_to_gdb_index.
961 (Sized_relobj_incr::do_section_name): Implement.
962 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
963 return type; Implement.
964 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
965 return type.
966 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
967 parameter list and return type.
968 (Sized_incr_dynobj::do_section_contents): Likewise.
969 * layout.cc: Include gdb-index.h.
970 (Layout::Layout): Initialize gdb_index_data_.
971 (Layout::init_fixed_output_section): Check for .gdb_index section.
972 (Layout::add_to_gdb_index): New function. Instantiate.
973 * layout.h: Add forward declaration for class Gdb_index.
974 (Layout::add_to_gdb_index): New member function.
975 (Layout::gdb_index_data_): New data member.
976 * main.cc: Include gdb-index.h.
977 (main): Print statistics for gdb index.
978 * object.cc (Object::section_contents): Move code into
979 do_section_contents.
980 (need_decompressed_section): Check for sections needed when building
981 gdb index.
982 (build_compressed_section_map): Likewise.
983 (Sized_relobj_file::do_read_symbols): Need local symbols when building
984 gdb index.
985 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
986 sections; call Layout::add_to_gdb_index.
987 (Sized_relobj_file::do_decompressed_section_contents): Call
988 do_section_contents directly.
989 * object.h (Object::do_section_contents): Adjust parameter list and
990 return type.
991 (Object::do_decompressed_section_contents): Call do_section_contents
992 directly.
993 (Sized_relobj_file::do_section_contents): Adjust parameter list and
994 return type.
995 * options.h (class General_options): Add --gdb-index option.
996 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
997 list and return type.
998 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
999 * reloc.h (Track_relocs::checkpoint): New function.
1000 (Track_relocs::reset): New function.
1001
1002 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1003 New test cases.
1004 * testsuite/Makefile.in: Regenerate.
1005 * testsuite/gdb_index_test.cc: New test source file.
1006 * testsuite/gdb_index_test_1.sh: New test source file.
1007 * testsuite/gdb_index_test_2.sh: New test source file.
1008
647f1574
DK
10092012-03-19 Doug Kwan <dougkwan@google.com>
1010
1011 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2e702c99 1012 (Target_arm::do_finalize_sections): Remove code which defines
647f1574
DK
1013 __exidx_start and __exidx_end. Make symbol table parameter
1014 anonymous as it is not used.
1015 * gold.cc (queue_middle_tasks): Call target hook to define any
1016 target-specific symbols.
1017 * target.h (Target::define_standard_symbols): New method.
1018 (Target::do_define_standard_symbols): Same.
1019 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1020 * testsuite/Makefile.in: Regenerate.
1021 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1022 and __exidx_end.
1023 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1024 relocations are generated for __exidx_start and __exidx_end.
1025
7c6109da
DK
10262012-03-16 Doug Kwan <dougkwan@google.com>
1027
1028 * testsuite/Makefile.am: Disable test initpri3b.
1029 * testsuite/Makefile.in: Regenerate.
1030
7b8957f8
DK
10312012-03-15 Doug Kwan <dougkwan@google.com>
1032
1033 * arm.cc (Target_arm::got_section): Make .got section read-only
1034 if -z now is given.
1035
14dc9ef7
ILT
10362012-03-15 Ian Lance Taylor <iant@google.com>
1037
1038 PR gold/13850
1039 * layout.cc (Layout::make_output_section): Correctly mark
1040 SHT_INIT_ARRAY, et. al., as relro.
1041
fa40b62a
DK
10422012-03-14 Doug Kwan <dougkwan@google.com>
1043
1044 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1045 dynamic relocations for protected symbols in shared objects.
1046
fd325007
ILT
10472012-03-13 Ian Lance Taylor <iant@google.com>
1048
1049 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1050 keep the larger alignment.
1051
e8dd54e1
CC
10522012-03-12 Cary Coutant <ccoutant@google.com>
1053
1054 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1055 handling of DW_LNE_define_file.
1056
feb5f3b0
CC
10572012-03-12 Cary Coutant <ccoutant@google.com>
1058
1059 * reduced_debug_output.cc
1060 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1061 codes to switch.
1062
a1fb4256
CC
10632012-02-29 Cary Coutant <ccoutant@google.com>
1064
1065 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1066
5dd8762a
CC
10672012-02-29 Cary Coutant <ccoutant@google.com>
1068
1069 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1070 Call Object::decompressed_section_contents.
1071 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1072 New dtor.
1073 (Sized_dwarf_line_info::buffer_start_): New data member.
1074 * merge.cc (Output_merge_data::do_add_input_section): Call
1075 Object::decompressed_section_contents.
1076 (Output_merge_string::do_add_input_section): Likewise.
1077 * object.cc (need_decompressed_section): New function.
1078 (build_compressed_section_map): Decompress sections needed later.
1079 (Sized_relobj_file::do_decompressed_section_contents): New function.
1080 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1081 * object.h (Object::decompressed_section_contents): New function.
1082 (Object::discard_decompressed_sections): New function.
1083 (Object::do_decompressed_section_contents): New function.
1084 (Object::do_discard_decompressed_sections): New function.
1085 (Compressed_section_info): New type.
1086 (Compressed_section_map): Include decompressed section contents.
1087 (Sized_relobj_file::do_decompressed_section_contents): New function.
1088 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1089
7b5de7ee
CC
10902012-02-16 Cary Coutant <ccoutant@google.com>
1091
1092 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1093 * testsuite/Makefile.in: Regenerate.
1094
f9fa4a63
CC
10952012-02-14 Cary Coutant <ccoutant@google.com>
1096
1097 * options.cc (General_options::finalize): Disallow -pie and -static.
1098
2c175ebc
DK
10992012-02-03 Doug Kwan <dougkwan@google.com>
1100
1101 * arm.cc (Arm_relocate_functions::abs8,
1102 Arm_relocate_functions::abs16): Use
1103 Bits::has_signed_unsigned_overflow32.
1104 (Arm_relocate_functions::thm_abs8): Correct range of
1105 overflow check.
1106 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1107 in assertions.
1108
90cff06f
DK
11092012-02-02 Doug Kwan <dougkwan@google.com>
1110
1111 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1112 position independent outputs, not just shared objects.
1113
63887f3d
L
11142012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1115
1116 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1117 * configure: Regenerated.
1118
bef2b434
ILT
11192012-01-27 Ian Lance Taylor <iant@google.com>
1120
1121 * reloc.h (Bits): New class with static functions, copied from
1122 namespace utils in arm.cc.
1123 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1124 instead.
1125
c335b55d
L
11262012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1127
1128 * incremental.cc (write_info_blocks): Correct relocation offset.
1129
41194d9f
L
11302012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1131
1132 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1133 (Relocate::tls_gd_to_le): Likewise.
1134
1bae613c
L
11352012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1136
1137 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1138
24482ca0
L
11392012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1140
1141 * configure.ac: Check if -mcmodel=medium works.
1142 * configure: Regenerated.
1143
c2c7840a
CC
11442012-01-24 Cary Coutant <ccoutant@google.com>
1145
1146 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1147 definition and ...
1148 (read_unsigned_LEB_128_x): ... this new function.
1149 (read_signed_LEB_128): Replaced with inline definition and ...
1150 (read_signed_LEB_128_x): ... this new function.
1151 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1152 (read_unsigned_LEB_128): Add inline definition.
1153 (read_signed_LEB_128_x): New function.
1154 (read_signed_LEB_128): Add inline definition.
1155 * testsuite/Makefile.am (leb128_unittest): New unit test.
1156 * testsuite/Makefile.in: Regenerate.
1157 * testsuite/leb128_unittest.cc: New unit test.
1158
833de760 11592012-01-23 Ian Lance Taylor <iant@google.com>
9dee3b3c
ILT
1160
1161 PR gold/13617
1162 * i386.cc (Target_i386::do_code_fill): When using a jmp
1163 instruction, pad with nop instructions.
1164 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1165
618d6666
L
11662012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1167
1168 * x86_64.cc (gc_process_relocs): Add typename on types used in
1169 template.
1170 (scan_relocs): Likewise.
1171 (relocate_section): Likewise.
1172 (apply_relocation): Likewise.
1173
3660ff06
L
11742012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1175
1176 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1177 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1178 under x32.
1179
fc51264f
L
11802012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1181
1182 * x86_64.cc: Initial support for x32.
1183
dd74ae06
CC
11842012-01-03 Cary Coutant <ccoutant@google.com>
1185
1186 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1187 Use abstract base class for GOT.
1188 * gold/output.h (class Output_data_got_base): New abstract base class.
1189 (class Output_data_got): Derive from new base class, adjust ctors.
1190 (Output_data_got::reserve_slot): Make virtual; rename to
1191 do_reserve_slot; Adjust callers.
1192 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1193 pointer to abstract base class.
1194 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1195
83896202
ILT
11962011-12-18 Ian Lance Taylor <iant@google.com>
1197
1198 * object.h (Relobj::local_symbol_value): New function.
1199 (Relobj::local_plt_offset): New function.
1200 (Relobj::local_has_got_offset): New function.
1201 (Relobj::local_got_offset): New function.
1202 (Relobj::set_local_got_offset): New function.
1203 (Relobj::do_local_symbol_value): New pure virtual function.
1204 (Relobj::do_local_plt_offset): Likewise.
1205 (Relobj::do_local_has_got_offset): Likewise.
1206 (Relobj::do_local_got_offset): Likewise.
1207 (Relobj::do_set_local_got_offset): Likewise.
1208 (Sized_relobj::do_local_has_got_offset): Rename from
1209 local_has_got_offset.
1210 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1211 (Sized_relobj::do_set_local_got_offset): Rename from
1212 set_local_got_offset.
1213 (Sized_relobj_file::do_local_plt_offset): Rename from
1214 local_plt_offset.
1215 (Sized_relobj_file::do_local_symbol_value): New function.
1216 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1217 local_plt_offset.
1218 * output.cc (Output_data_got::Got_entry::write): Change object to
1219 Relobj. Use local_symbol_value.
1220 (Output_data_got::add_global_with_rel): Change rel_dyn to
1221 Output_data_reloc_generic*. Use add_global_generic.
1222 (Output_data_got::add_global_with_rela): Remove. Change all
1223 callers to use add_global_with_rel.
1224 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1225 Output_data_reloc_generic*. Use add_global_generic.
1226 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1227 callers to use add_global_pair_with_rel.
1228 (Output_data_got::add_local): Change object to Relobj*.
1229 (Output_data_got::add_local_plt): Likewise.
1230 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1231 change rel_dyn to Output_data_reloc_generic*. Use
1232 add_local_generic.
1233 (Output_data_got::add_local_with_rela): Remove. Change all
1234 callers to use all_local_with_rel.
1235 (Output_data_got::add_local_pair_with_rel): Change object to
1236 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1237 add_output_section_generic.
1238 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1239 callers to use add_local_pair_with_rel.
1240 (Output_data_got::reserve_local): Change object to Relobj*.
1241 * output.h: (class Output_data_reloc_generic): Add pure virtual
1242 declarations for add_global_generic, add_local_generic,
1243 add_output_section_generic.
1244 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1245 functions for Output_data_reloc_generic. Update declarations for
1246 changes listed in output.cc.
1247 (class Output_data_got): Change template parameter to got_size.
1248 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1249 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1250 function.
1251 (Sized_relobj_incr::do_local_plt_offset): New function.
1252 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1253 add_global_generic.
1254
76677ad0
CC
12552011-12-17 Cary Coutant <ccoutant@google.com>
1256
1257 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1258 * resolve.cc (Symbol_table::resolve): Likewise.
1259 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1260 arrays.
1261 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1262
8b8dd8d5
ILT
12632011-12-16 Ian Lance Taylor <iant@google.com>
1264
1265 * output.h (Output_data_reloc_generic::add): Only call
1266 add_dynamic_reloc if this is a dynamic reloc section.
1267
d55525b9
L
12682011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1269
1270 PR gold/13505
1271 * target-reloc.h (apply_relocation): Replace <64, false> with
1272 <size, big_endian>.
1273
ff81c7c1
NC
12742011-11-25 Nick Clifton <nickc@redhat.com>
1275
1276 * po/it.po: New Italian translation.
1277
628f39be
SA
12782011-11-17 Sterling Augustine <saugustine@google.com>
1279
1280 * script.cc (script_include_directive): Implement.
1281 (read_script_file): New local variables name and search_path. Update
1282 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1283 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1284 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1285
98ef3ea4
SA
12862011-11-11 Sterling Augustine <saugustine@google.com>
1287
1288 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1289 (file_or_sections_cmd): Likewise.
1290
f4a8b6d7
DK
12912011-11-11 Doug Kwan <dougkwan@google.com>
1292
1293 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1294 if --just-symbols is given.
1295
29ab395d
DK
12962011-11-10 Doug Kwan <dougkwan@google.com>
1297
1298 PR gold/13362
1299 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1300 when processing data relocs.
1301 * reloc.h (Relocate_functions::rel_unaligned): New method.
1302 (Relocate_functions::pcrel_unaligned): Ditto.
1303 (Relocate_functions::rel32_unaligned): Ditto.
1304 (Relocate_functions::pcrel32_unaligned): Ditto.
1305
2c339f71
DK
13062011-11-09 Doug Kwan <dougkwan@google.com>
1307
1308 PR gold/13362
1309 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1310 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1311 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1312 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1313 (Relocate_functions::rel_unaligned): New.
1314 (Relocate_functions::rel32_unaligned): New.
1315 * target-reloc.h (relocate_for_relocatable): Add code to handle
1316 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1317 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1318 arm_unaligned_reloc_r): New targets.
1319 * testsuite/Makefile.in: Regenerate.
1320 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1321 linking.
1322
3f3cddf1
ILT
13232011-11-02 Ian Lance Taylor <iant@google.com>
1324
1325 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1326 NATIVE_LINKER.
1327 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1328 * options.cc (General_options::finalize): Use library search path
1329 from configure script if specified. If not native and no sysroot,
1330 only search TOOLLIBDIR.
1331 * options.h (Search_directory::Search_directory): Change name to
1332 const std::string&.
1333 (General_options::add_to_library_path_with_sysroot): Change arg to
1334 const std::string&.
1335 * configure, Makefile.in, config.in: Rebuild.
1336
a8e2273b
ILT
13372011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1338
1339 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1340 we are working around the ARM1176 Erratum.
1341 * options.h (General_options::fix_arm1176): Add option.
1342 * testsuite/Makefile.am: Add testcases, and keep current ones
1343 working.
1344 * testsuite/Makefile.in: Regenerate.
1345 * testsuite/arm_fix_1176.s: New file.
1346 * testsuite/arm_fix_1176.sh: Likewise.
1347
cd6eab1c
ILT
13482011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1349
1350 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1351 may_use_blx_.
1352 (Target_arm::may_use_blx): Remove method.
1353 (Target_arm::set_may_use_blx): Likewise.
1354 (Target_arm::may_use_v4t_interworking): New method.
1355 (Target_arm::may_use_v5t_interworking): Likewise.
1356 (Target_arm::may_use_blx_): Remove member variable.
1357 (Arm_relocate_functions::arm_branch_common): Check for v5T
1358 interworking.
1359 (Arm_relocate_functions::thumb_branch_common): Likewise.
1360 (Reloc_stub::stub_type_for_reloc): Likewise.
1361 (Target_arm::do_finalize_sections): Correct interworking checks.
1362 * testsuite/Makefile.am: Add new tests.
1363 * testsuite/Makefile.in: Regenerate.
1364 * testsuite/arm_farcall_arm_arm.s: New test.
1365 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1366 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1367 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1368 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1369 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1370 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1371 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1372
286adcf4
CC
13732011-10-31 Cary Coutant <ccoutant@google.com>
1374
1375 PR gold/13023
1376 * expression.cc (Expression::eval_with_dot): Add
1377 is_section_dot_assignment parameter.
1378 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1379 absolute and assigning to dot within a section.
1380 * script-sections.cc
1381 (Output_section_element_assignment::set_section_addresses): Pass
1382 dot_section to set_if_absolute.
1383 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1384 as is_section_dot_assignment flag to eval_with_dot.
1385 (Output_section_element_dot_assignment::set_section_addresses):
1386 Likewise.
1387 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1388 parameter. Also set value if relative to dot_section; set the
1389 symbol's output_section.
1390 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1391 parameter. Adjust all callers.
1392 (Expression::eval_maybe_dot): Likewise.
1393 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1394 Adjust all callers.
1395 * testsuite/script_test_2.t: Test assignment of an absolute value
1396 to dot within an output section element.
1397
9634ed06
CC
13982011-10-31 Cary Coutant <ccoutant@google.com>
1399
1400 * options.h (class General_options): Add --[no-]gnu-unique options.
1401 * symtab.cc (Symbol_table::sized_write_globals): Convert
1402 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1403
de4101c7
CC
14042011-10-31 Cary Coutant <ccoutant@google.com>
1405
1406 PR gold/13359
1407 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1408 unnecessary assertion.
1409 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1410
7257cc92
ST
14112011-10-31 Sriraman Tallam <tmsriram@google.com>
1412
1413 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1414 gc_mark_symbol.
1415 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1416 gc_mark_symbol.
1417 Change to just keep the section associated with symbol.
1418 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1419 they are externally visible and --export-dynamic is turned on.
1420 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1421
bfc34b3f
ILT
14222011-10-19 Ian Lance Taylor <iant@google.com>
1423
1424 PR gold/13163
1425 * script-sections.cc
1426 (Output_section_element_dot_assignment::needs_output_section): New
1427 function.
1428
ea0d8c47
ILT
14292011-10-19 Ian Lance Taylor <iant@google.com>
1430
1431 PR gold/13204
1432 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1433 --section-start option was seen.
1434 * options.h (General_options::any_section_start): New function.
1435
abd242a9
DM
14362011-10-18 David S. Miller <davem@davemloft.net>
1437
1438 PR binutils/13301
1439 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1440 member to track relocation locations that have moved during TLS
1441 reloc optimizations.
1442 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1443 (Target_sparc::Relocate::relocate): Adjust view down by 4
1444 bytes if it matches reloc_adjust_addr_.
1445 (Target_sparc::Relocate::relocate_tls): Always move the
1446 __tls_get_addr call delay slot instruction forward 4 bytes when
1447 performing relaxation.
1448
bab9090f
CC
14492011-10-18 Cary Coutant <ccoutant@google.com>
1450
1451 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1452 (Output_file::map_no_anonymous): Check for non-zero
1453 return code from posix_fallocate.
1454
f7c5b166
CC
14552011-10-17 Cary Coutant <ccoutant@google.com>
1456
1457 PR gold/13245
1458 * plugin.cc (is_visible_from_outside): Check for symbols
1459 referenced from dynamic objects.
1460 * resolve.cc (Symbol_table::resolve): Don't count references
1461 from dynamic objects as references from real ELF files.
1462 * testsuite/plugin_test_2.sh: Adjust expected result.
1463
b490c0bb
CC
14642011-10-17 Cary Coutant <ccoutant@google.com>
1465
1466 * gold.cc: Include timer.h.
1467 (queue_middle_tasks): Stamp time.
1468 (queue_final_tasks): Likewise.
1469 * main.cc (main): Store timer in parameters. Print timers
1470 for each pass.
1471 * parameters.cc (Parameters::Parameters): Initialize timer_.
1472 (Parameters::set_timer): New function.
1473 (set_parameters_timer): New function.
1474 * parameters.h (Parameters::set_timer): New function.
1475 (Parameters::timer): New function.
1476 (Parameters::timer_): New data member.
1477 (set_parameters_timer): New function.
1478 * timer.cc (Timer::stamp): New function.
1479 (Timer::get_pass_time): New function.
1480 * timer.h (Timer::stamp): New function.
1481 (Timer::get_pass_time): New function.
1482 (Timer::pass_times_): New data member.
1483
f475cf7b
CC
14842011-10-17 Cary Coutant <ccoutant@google.com>
1485
1486 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1487 task for members of lib groups.
1488
cdd7e244
CC
14892011-10-17 Cary Coutant <ccoutant@google.com>
1490
1491 PR gold/13288
4f95c8b4 1492 * fileread.cc (File_read::find_view): Add assert.
cdd7e244
CC
1493 (File_read::make_view): Move bounds check (replace with assert)...
1494 (File_read::find_or_make_view): ... to here.
1495
dfb45471
CC
14962011-10-12 Cary Coutant <ccoutant@google.com>
1497
4f95c8b4 1498 * output.cc (Output_file::open_base_file): Handle case where
dfb45471
CC
1499 ::read returns less than requested size.
1500
53bbcc1b
CC
15012011-10-10 Cary Coutant <ccoutant@google.com>
1502
4f95c8b4 1503 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
53bbcc1b
CC
1504 Initialize defined_count_.
1505 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1506 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1507 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1508 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1509 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4f95c8b4 1510 * incremental.h (Sized_relobj_incr::defined_count_): New data
53bbcc1b
CC
1511 member.
1512 (Sized_incr_dynobj::defined_count_): New data member.
4f95c8b4 1513 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
53bbcc1b
CC
1514 Return zeroes instead of internal error.
1515
397b129b
CC
15162011-10-10 Cary Coutant <ccoutant@google.com>
1517
1518 PR gold/13249
4f95c8b4 1519 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
397b129b 1520 (Output_reloc::symbol_value): Return PLT offset if flag is set.
4f95c8b4 1521 * output.h (class Output_reloc): Add use_plt_offset flag.
397b129b
CC
1522 (Output_reloc::type_): Adjust size of bit field.
1523 (Output_reloc::use_plt_offset_): New bit field.
1524 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1525 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1526 flag. Adjust all callers.
4f95c8b4 1527 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
397b129b
CC
1528 creating RELATIVE relocations.
1529
d5698657
NC
15302011-10-10 Nick Clifton <nickc@redhat.com>
1531
1532 * po/es.po: Updated Spanish translation.
1533 * po/fi.po: Updated Finnish translation.
1534
6a59a5c2
DN
15352011-10-03 Diego Novillo <dnovillo@google.com>
1536
1537 * options.cc (parse_uint): Fix dereference of RETVAL.
1538
f0558624
ST
15392011-09-29 Sriraman Tallam <tmsriram@google.com>
1540
1541 * layout.h (section_order_map_): New member.
1542 (get_section_order_map): New member function.
1543 * output.cc (Output_section::add_input_section): Check for patterns
1544 only when --section-ordering-file is specified.
1545 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1546 output_sections have been formed.
1547 * layout.cc (Layout_Layout): Initialize section_order_map_.
1548 * plugin.cc (update_section_order): Store order in order_map. Do not
1549 update the order.
1550 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1551 * testsuite/Makefile.in: Regenerate.
1552 * testsuite/plugin_section_order.c: New file.
1553 * testsuite/plugin_final_layout.cc: New file.
1554 * testsuite/plugin_final_layout.sh: New file.
1555
a7dac153
CC
15562011-09-29 Cary Coutant <ccoutant@google.com>
1557
4f95c8b4 1558 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
a7dac153 1559 Check for NULL.
4f95c8b4 1560 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
a7dac153
CC
1561 symbols during incremental update.
1562 (Symbol_table::add_from_dynobj): Likewise.
1563
eebd87a5
ILT
15642011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1565 Ian Lance Taylor <iant@google.com>
1566
1567 * symtab.cc (Symbol_table::define_special_symbol): Always
1568 canonicalize version string.
1569
403a3331
CC
15702011-09-26 Cary Coutant <ccoutant@google.com>
1571
4f95c8b4
CC
1572 * gold.cc (queue_initial_tasks): Move option checks ...
1573 * options.cc (General_options::finalize): ... to here. Disable
403a3331
CC
1574 some options; make others fatal.
1575
235061c2
CC
15762011-09-26 Cary Coutant <ccoutant@google.com>
1577
1578 gcc PR lto/47247
1579 * plugin.cc (get_symbols_v2): New function.
1580 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1581 (is_referenced_from_outside): New function.
1582 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1583 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1584 (get_symbols): Pass version parameter.
1585 (get_symbols_v2): New function.
1586 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1587 parameter.
1588 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1589 (onload): Add LDPT_GET_SYMBOLS_V2.
1590 (all_symbols_read_hook): Use get_symbols_v2; check for
1591 LDPR_PREVAILING_DEF_IRONLY_EXP.
1592 * testsuite/plugin_test_3.sh: Update expected results.
1593
dc87f620
ILT
15942011-09-23 Simon Baldwin <simonb@google.com>
1595
1596 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1597 configuration options.
1598 * configure: Regenerate.
1599 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1600 * Makefile.in: Regenerate.
1601 * testsuite/Makefile.in: Regenerate.
1602
a8279f82
ST
16032011-09-19 Sriraman Tallam <tmsriram@google.com>
1604
1605 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1606
0c9350c8
CC
16072011-09-19 Cary Coutant <ccoutant@google.com>
1608
1609 * incremental.cc (can_incremental_update): Fix typo in comment.
1610 * incremental.h (can_incremental_update): Likewise.
1611
aa06ae28
CC
16122011-09-18 Cary Coutant <ccoutant@google.com>
1613
1614 * incremental.cc (can_incremental_update): New function.
1615 * incremental.h (can_incremental_update): New function.
1616 * layout.cc (Layout::init_fixed_output_section): Call it.
1617 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1618 * object.cc (Sized_relobj_file::do_layout): Call
1619 can_incremental_update.
1620
ebb300b2
CC
16212011-09-13 Cary Coutant <ccoutant@google.com>
1622
1623 * configure.ac: Check for glibc support for gnu_indirect_function
1624 support with static linking, setting automake conditional
1625 IFUNC_STATIC.
1626 * Makefile.in: Regenerate.
1627 * configure: Regenerate.
1628
1629 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1630 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1631 for IFUNC_STATIC.
1632 * testsuite/Makefile.in: Regenerate.
1633
1206d0d5
CC
16342011-09-13 Cary Coutant <ccoutant@google.com>
1635
1636 * incremental.cc (Sized_relobj_incr::do_layout): Call
1637 report_comdat_group for kept comdat sections.
1638 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1639 * testsuite/Makefile.in: Regenerate.
1640 * testsuite/incr_comdat_test_1.cc: New source file.
1641 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1642 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1643 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1644
40b29874
ILT
16452011-09-13 Ian Lance Taylor <iant@google.com>
1646
1647 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1648 variable external_symbols_offset.
1649
1b045aac
ILT
16502011-09-12 Ian Lance Taylor <iant@google.com>
1651
1652 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1653 triggered if object has no symbols.
1654
24c6c55a
DM
16552011-09-09 David S. Miller <davem@davemloft.net>
1656
1657 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1658 (Output_fill_debug_line::do_write): Likewise.
1659
66570254
CC
16602011-08-29 Cary Coutant <ccoutant@google.com>
1661
1662 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1663 casts to match formatting specs.
1664 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1665
8ea8cd50
CC
16662011-08-26 Cary Coutant <ccoutant@google.com>
1667
1668 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1669 remaining hole size when allocating.
1670 (Layout::make_output_section): Set fill methods for debug sections.
1671 * layout.h (Free_list::Free_list_node): Move from private to
1672 public.
1673 (Free_list::set_min_hole_size): New function.
1674 (Free_list::begin, Free_list::end): New functions.
1675 (Free_list::min_hole_): New data member.
1676 * output.cc: Include dwarf.h.
1677 (Output_fill_debug_info::do_minimum_hole_size): New function.
1678 (Output_fill_debug_info::do_write): New function.
1679 (Output_fill_debug_line::do_minimum_hole_size): New function.
1680 (Output_fill_debug_line::do_write): New function.
1681 (Output_section::Output_section): Initialize new data member.
1682 (Output_section::set_final_data_size): Ensure patch space is larger
1683 than minimum hole size.
1684 (Output_section::do_write): Fill holes in debug sections.
1685 * output.h (Output_fill): New class.
1686 (Output_fill_debug_info): New class.
1687 (Output_fill_debug_line): New class.
1688 (Output_section::set_free_space_fill): New function.
1689 (Output_section::free_space_fill_): New data member.
1690 * testsuite/Makefile.am (incremental_test_3): Add
1691 --incremental-patch option.
1692 (incremental_test_4): Likewise.
1693 (incremental_test_5): Likewise.
1694 (incremental_test_6): Likewise.
1695 (incremental_copy_test): Likewise.
1696 (incremental_common_test_1): Likewise.
1697 * testsuite/Makefile.in: Regenerate.
1698
7cf80422
NC
16992011-08-26 Nick Clifton <nickc@redhat.com>
1700
1701 * po/es.po: Updated Spanish translation.
1702
c3f7b0e5
CC
17032011-08-01 Cary Coutant <ccoutant@google.com>
1704
1705 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1706 * gold/testsuite/Makefile.in: Regenerate.
1707 * gold/testsuite/justsyms_exec.c: New source file.
1708 * gold/testsuite/justsyms_lib.c: New source file.
1709
9590bf25
CC
17102011-08-01 Cary Coutant <ccoutant@google.com>
1711
1712 * layout.cc (Layout::set_segment_offsets): Don't realign text
1713 segment if -Ttext was specified.
1714 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1715 file type.
1716 * object.h (Sized_relobj_file::e_type): New function.
1717 (Sized_relobj_file::e_type_): New data member.
1718 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1719 base address for ET_EXEC files.
1720 * target.cc (Target::do_make_elf_object_implementation): Allow
1721 ET_EXEC files with --just-symbols option.
1722
dcd8d12e
CC
17232011-07-28 Cary Coutant <ccoutant@google.com>
1724
1725 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1726 Add thread_number parameter.
1727 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1728 * workqueue-threads.cc
1729 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1730 current thread if its thread number is greater than desired thread
1731 count.
1732 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1733 Add thread_number parameter.
1734 (Workqueue::should_cancel_thread): Likewise.
1735 (Workqueue::find_runnable_or_wait): Pass thread_number to
1736 should_cancel_thread.
1737 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1738 parameter.
1739
804eb480
ST
17402011-07-22 Sriraman Tallam <tmsriram@google.com>
1741
1742 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1743 only after checking if it cannot be forced local.
1744 * symtab.h (is_externally_visible): Check if the symbol is not forced
1745 local.
1746
f1ddb600
ILT
17472011-07-15 Ian Lance Taylor <iant@google.com>
1748
1749 * options.h (class General_options): Add --print-output-format.
1750 Move -EL next to -EB, for better --help output.
1751 * target-select.cc: Include <cstdio>, "options.h", and
1752 "parameters.h".
1753 (Target_selector::do_target_bfd_name): New function.
1754 (print_output_format): New function.
1755 * target-select.h (class Target_selector): Update declarations.
1756 (Target_selector::target_bfd_name): New function.
1757 (print_output_format): Declare.
1758 * main.cc: Include "target-select.h".
1759 (main): Handle --print-output-format.
1760 * gold.cc: Include "target-select.h".
1761 (queue_initial_tasks): Handle --print-output-format when there are
1762 no input files.
1763 * parameters.cc (parameters_force_valid_target): Give a better
1764 error message if -EB/-EL does not match target.
1765 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1766 function.
1767
7d172687
ILT
17682011-07-15 Ian Lance Taylor <iant@google.com>
1769
1770 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1771 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1772 (Output_data_plt_i386::do_write): Write address of .dynamic
1773 section to first entry in .got.plt section.
1774 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1775 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1776 Initialize layout_.
1777 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1778 section to first entry in .got.plt section.
1779 * layout.h (Layout::dynamic_section): New function.
1780
e9552f7e
ST
17812011-07-13 Sriraman Tallam <tmsriram@google.com>
1782
1783 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1784 to claim_file call.
1785 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1786 input_section_position_, and input_section_glob_.
1787 (read_layout_from_file): Call function section_ordering_specified.
1788 * layout.h (is_section_ordering_specified): New function.
1789 (section_ordering_specified): New function.
1790 (section_ordering_specified_): New boolean member.
1791 * main.cc(main): Call load_plugins after layout object is defined.
1792 * output.cc (Output_section::add_input_section): Use
1793 function section_ordering_specified to check if section ordering is
1794 needed.
1795 * output.cc (Output_section::add_relaxed_input_section): Use
1796 function section_ordering_specified to check if section ordering is
1797 needed.
1798 (Output_section::update_section_layout): New function.
1799 (Output_section::sort_attached_input_sections): Check if input section
1800 must be reordered.
1801 * output.h (Output_section::update_section_layout): New function.
1802 * plugin.cc (get_section_count): New function.
1803 (get_section_type): New function.
1804 (get_section_name): New function.
1805 (get_section_contents): New function.
1806 (update_section_order): New function.
58797674 1807 (allow_section_ordering): New function.
e9552f7e
ST
1808 (Plugin::load): Add the new interfaces to the transfer vector.
1809 (Plugin_manager::load_plugins): New parameter.
1810 (Plugin_manager::all_symbols_read): New parameter.
1811 (Plugin_manager::claim_file): New parameter. Save the elf object for
1812 unclaimed objects.
1813 (Plugin_manager::get_elf_object): New function.
1814 (Plugin_manager::get_view): Change to directly use the bool to check
1815 if get_view is called from claim_file_hook.
1816 * plugin.h (input_objects): New function
1817 (Plugin__manager::load_plugins): New parameter.
1818 (Plugin_manager::claim_file): New parameter.
1819 (Plugin_manager::get_elf_object): New function.
1820 (Plugin_manager::in_claim_file_handler): New function.
1821 (Plugin_manager::in_claim_file_handler_): New member.
1822 (layout): New function.
1823 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1824 handler with an extra parameter. Make the elf object before calling
1825 claim_file handler.
1826 * testsuite/plugin_test.c (get_section_count): New function pointer.
1827 (get_section_type): New function pointer.
1828 (get_section_name): New function pointer.
1829 (get_section_contents): New function pointer.
1830 (update_section_order): New function pointer.
1831 (allow_section_ordering): New function pointer.
1832 (onload): Check if the new interfaces exist.
1833
9446efde
ILT
18342011-07-13 Ian Lance Taylor <iant@google.com>
1835
1836 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1837 relro section.
1838 * x86_64.cc (Target_x86_64::got_section): Likewise.
1839 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1840 (relro_now_test_SOURCES): New variable.
1841 (relro_now_test_DEPENDENCIES): New variable.
1842 (relro_now_test_LDFLAGS): New variable.
1843 (relro_now_test_LDADD): New variable.
1844 (relro_now_test.so): New target.
1845 * testsuite/Makefile.in: Rebuild.
1846
07aa62f2
ILT
18472011-07-12 Ian Lance Taylor <iant@google.com>
1848
1849 PR gold/12980
1850 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1851 GLOB_DAT relocation rather than a RELATIVE relocation for a
1852 protected symbol when creating a shared library.
1853 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1854 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1855 * testsuite/protected_main_1.cc (main): Test that protected
1856 function has same address.
1857
e2153196
ILT
18582011-07-11 Ian Lance Taylor <iant@google.com>
1859
1860 PR gold/12979
1861 * options.h (class General_options): Add -Bgroup.
1862 * options.cc (General_options::finalize): If -Bgroup is set,
1863 default to --unresolved-symbols=report-all.
1864 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1865 * target-reloc.h (issue_undefined_symbol_error): Handle
1866 --unresolved-symbols=report-all.
1867
6daf5215
ILT
18682011-07-08 Ian Lance Taylor <iant@google.com>
1869
1870 PR gold/11985
1871 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1872 if linker script discards key sections.
1873 (Layout::create_dynamic_symtab): Likewise.
1874 (Layout::assign_local_dynsym_offsets): Likewise.
1875 (Layout::sized_create_version_sections): Likewise.
1876 (Layout::create_interp): Likewise.
1877 (Layout::finish_dynamic_section): Likewise.
1878 (Layout::set_dynamic_symbol_size): Likewise.
1879
beabb2c6
ILT
18802011-07-08 Ian Lance Taylor <iant@google.com>
1881
1882 PR gold/12386
1883 * options.h (class General_options): Add --unresolved-symbols.
1884 * target-reloc.h (issue_undefined_symbol_error): Check
1885 --unresolved-symbols. Add comments.
1886
9c16daf1
ILT
18872011-07-08 Ian Lance Taylor <iant@google.com>
1888
1889 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1890 expression more complex.
1891
191f1a2d
ILT
18922011-07-08 Ian Lance Taylor <iant@google.com>
1893
1894 PR gold/11317
1895 * target-reloc.h (issue_undefined_symbol_error): New inline
1896 function, broken out of relocate_section.
1897 (relocate_section): Call issue_undefined_symbol_error.
1898 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1899 there is no TLS segment if we are about to issue an undefined
1900 symbol error.
1901 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1902
62855347
ILT
19032011-07-08 Ian Lance Taylor <iant@google.com>
1904
1905 PR gold/12279
1906 * resolve.cc (Symbol_table::should_override): Add fromtype
1907 parameter. Change all callers. Give error when linking together
1908 TLS and non-TLS symbol.
1909 (Symbol_table::should_override_with_special): Add fromtype
1910 parameter. Change all callers.
1911 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1912 there is no TLS segment if we have reported some errors.
1913 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1914
67181c72
ILT
19152011-07-08 Ian Lance Taylor <iant@google.com>
1916
1917 PR gold/12372
1918 * target.h (Target::plt_address_for_global): New function.
1919 (Target::plt_address_for_local): New function.
1920 (Target::plt_section_for_global): Remove.
1921 (Target::plt_section_for_local): Remove.
1922 (Target::do_plt_address_for_global): New virtual function.
1923 (Target::do_plt_address_for_local): New virtual function.
1924 (Target::do_plt_section_for_global): Remove.
1925 (Target::do_plt_section_for_local): Remove.
1926 (Target::register_global_plt_entry): Add Symbol_table and Layout
1927 parameters.
1928 * output.cc (Output_data_got::Got_entry::write): Use
1929 plt_address_for_global and plt_address_for_local.
1930 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1931 address of output section.
1932 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1933 got_irelative_, and irelative_count_ fields. Update
1934 declarations.
1935 (Output_data_plt_i386::has_irelative_section): New function.
1936 (Output_data_plt_i386::entry_count): Add irelative_count_.
1937 (Output_data_plt_i386::set_final_data_size): Likewise.
1938 (class Target_i386): Add got_irelative_ and rel_irelative_
1939 fields. Update declarations.
1940 (Target_i386::Target_i386): Initialize new fields.
1941 (Target_i386::do_plt_address_for_global): New function replacing
1942 do_plt_section_for_global.
1943 (Target_i386::do_plt_address_for_local): New function replacing
1944 do_plt_section_for_local.
1945 (Target_i386::got_section): Create got_irelative_.
1946 (Target_i386::rel_irelative_section): New function.
1947 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1948 fields. Don't define __rel_iplt_{start,end}.
1949 (Output_data_plt_i386::add_entry): Add symtab and layout
1950 parameters. Change all callers. Use different PLT and GOT for
1951 IFUNC symbols.
1952 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1953 layout parameters. Change all callers. Use different PLT and
1954 GOT.
1955 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1956 (Output_data_plt_i386::rel_irelative): New function.
1957 (Output_data_plt_i386::address_for_global): New function.
1958 (Output_data_plt_i386::address_for_local): New function.
1959 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1960 IRELATIVE GOT when changing IFUNC GOT entries.
1961 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1962 reloc.
1963 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1964 if we didn't create an IRELATIVE GOT.
1965 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1966 plt_address_for_local.
1967 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1968 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1969 got_irelative_, and irelative_count_ fields. Update
1970 declarations.
1971 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1972 Initialize new fields. Remove symtab parameter. Change all
1973 callers.
1974 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1975 irelative_count_.
1976 (Output_data_plt_x86_64::has_irelative_section): New function.
1977 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1978 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1979 fields. Update declarations.
1980 (Target_x86_64::Target_x86_64): Initialize new fields.
1981 (Target_x86_64::do_plt_address_for_global): New function replacing
1982 do_plt_section_for_global.
1983 (Target_x86_64::do_plt_address_for_local): New function replacing
1984 do_plt_section_for_local.
1985 (Target_x86_64::got_section): Create got_irelative_.
1986 (Target_x86_64::rela_irelative_section): New function.
1987 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1988 all callers. Don't create __rel_iplt_{start,end}.
1989 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1990 parameters. Change all callers. Use different PLT and GOT for
1991 IFUNC symbols.
1992 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1993 layout parameters. Change all callers. Use different PLT and
1994 GOT.
1995 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1996 parameters. Change all callers. Use different PLT and GOT for
1997 IFUNC symbols.
1998 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1999 (Output_data_plt_x86_64::rela_irelative): New function.
2000 (Output_data_plt_x86_64::address_for_global): New function.
2001 (Output_data_plt_x86_64::address_for_local): New function.
2002 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2003 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2004 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2005 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2006 parameters.
2007 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2008 reloc.
2009 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2010 symbols if we didn't create an IRELATIVE GOT.
2011 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2012 plt_address_for_local.
2013 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2014 * testsuite/ifuncvar1.c: New test file.
2015 * testsuite/ifuncvar2.c: New test file.
2016 * testsuite/ifuncvar3.c: New test file.
2017 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2018 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2019 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2020 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2021 * testsuite/Makefile.in: Rebuild.
2022
33c15b45
CC
20232011-07-07 Cary Coutant <ccoutant@google.com>
2024
2025 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2026 (two_file_test_1_ndebug.o): Likewise.
2027 (two_file_test_1b_ndebug.o): Likewise.
2028 (two_file_test_2_ndebug.o): Likewise.
2029 (two_file_test_main_ndebug.o): Likewise.
2030 (incremental_test_2): Link with no-debug versions.
2031
f48b5fb7
CC
20322011-07-06 Cary Coutant <ccoutant@google.com>
2033
2034 * gold/incremental.cc
2035 (Output_section_incremental_inputs::write_info_blocks): Check for
2036 hidden and internal symbols.
2037
221597a5
CC
20382011-07-06 Cary Coutant <ccoutant@google.com>
2039
2040 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2041 Check disposition for startup file.
2042 (Incremental_inputs::report_command_line): Ignore
2043 --incremental-startup-unchanged option.
2044 * options.cc (General_options::parse_incremental_startup_unchanged):
2045 New function.
2046 (General_options::General_options): Initialize new data member.
2047 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2048 (General_options): Add --incremental-startup-unchanged option.
2049 (General_options::incremental_startup_disposition): New function.
2050 (General_options::incremental_startup_disposition_): New data member.
2051
e24719f6
CC
20522011-07-06 Cary Coutant <ccoutant@google.com>
2053
2054 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2055 input file index to Script_info ctor.
2056 (Sized_incremental_binary::do_file_has_changed): Find the
2057 command-line argument for files named in scripts.
2058 * incremental.h (Script_info::Script_info): New ctor
2059 with input file index.
2060 (Script_info::input_file_index): New function.
2061 (Script_info::input_file_index_): New data member.
2062 (Incremental_binary::get_library): Add const.
2063 (Incremental_binary::get_script_info): Add const.
2064 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2065 * testsuite/Makefile.am (incremental_test_5): New test case.
2066 (incremental_test_6): New test case.
2067 * testsuite/Makefile.in: Regenerate.
2068
8f7c81e8
CC
20692011-07-06 Cary Coutant <ccoutant@google.com>
2070
2071 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2072 debug output when command lines differ.
2073
9fbd3822
CC
20742011-07-06 Cary Coutant <ccoutant@google.com>
2075
2076 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2077 --incremental-patch option.
2078 * layout.cc (Free_list::allocate): Extend allocation beyond original
2079 end if enabled.
2080 (Layout::make_output_section): Mark sections that should get
2081 patch space.
2082 * options.cc (parse_percent): New function.
2083 * options.h (parse_percent): New function.
2084 (DEFINE_percent): New macro.
2085 (General_options): Add --incremental-patch option.
2086 * output.cc (Output_section::Output_section): Initialize new data
2087 members.
2088 (Output_section::add_input_section): Print section name when out
2089 of patch space.
2090 (Output_section::add_output_section_data): Likewise.
2091 (Output_section::set_final_data_size): Add patch space when
2092 doing --incremental-full.
2093 (Output_section::do_reset_address_and_file_offset): Remove patch
2094 space.
2095 (Output_segment::set_section_list_addresses): Print debug output
2096 only if --incremental-update.
2097 * output.h (Output_section::set_is_patch_space_allowed): New function.
2098 (Output_section::is_patch_space_allowed_): New data member.
2099 (Output_section::patch_space_): New data member.
2100 * parameters.cc (Parameters::incremental_full): New function.
2101 * parameters.h (Parameters::incremental_full): New function
2102 * testsuite/Makefile.am (incremental_test_2): Add test for
2103 --incremental-patch option.
2104 * testsuite/Makefile.in: Regenerate.
2105 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2106 (t18): Remove function body.
2107
f6cccc2c
DK
21082011-07-05 Doug Kwan <dougkwan@google.com>
2109
2110 PR gold/12771
2111 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2112 Arm_Address type for relocation result.
2113 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2114 overflow check.
2115 (Arm_relocate_functions::abs32): Use unaligned access.
2116 (Arm_relocate_functions::rel32): Ditto.
2117 (Arm_relocate_functions::prel31): Ditto.
2118 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2119 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2120 static data relocations.
2121 * testsuite/Makefile.in: Regnerate.
2122 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2123
28a13fec
ILT
21242011-07-05 Ian Lance Taylor <iant@google.com>
2125
2126 PR gold/12392
2127 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2128 symbols if necessary.
2129 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2130
24d47b34
ILT
21312011-07-05 Ian Lance Taylor <iant@google.com>
2132
2133 PR gold/12952
2134 * resolve.cc (Symbol::override_base_with_special): Simply override
2135 version with special symbol version, ignoring previous version.
2136
41f9cbbe
ILT
21372011-07-05 Ian Lance Taylor <iant@google.com>
2138
2139 * object.cc (Sized_relobj_file::include_section_group): Add
2140 information to comment about signature location.
2141
886288f1
ILT
21422011-07-02 Ian Lance Taylor <iant@google.com>
2143
2144 PR gold/12957
2145 * options.h (class General_options): Add -f and -F.
2146 * options.cc (General_options::finalize): Fatal error if -f/-F
2147 are used without -shared.
2148 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2149
ae3a6d4f
ILT
21502011-07-02 Ian Lance Taylor <iant@google.com>
2151
2152 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2153
21131061
ILT
21542011-07-01 Ian Lance Taylor <iant@google.com>
2155
2156 PR gold/12525
2157 PR gold/12952
2158 * resolve.cc (Symbol::override_base_with_special): Don't override
2159 the version if the overriding symbol has a different name.
2160 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2161 all callers. If we give an error about an undefined version,
2162 define the base version if necessary.
2163 * dynobj.h (class Versions): Update declaration.
2164 * testsuite/weak_alias_test_5.cc: New file.
2165 * testsuite/weak_alias_test.script: New file.
2166 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2167 and versioned_alias have the right value, and call t2.
2168 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2169 weak_alias_test_5.so.
2170 (weak_alias_test_LDADD): Likewise.
2171 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2172 * testsuite/Makefile.in: Rebuild.
2173
611062c0
ILT
21742011-07-01 Ian Lance Taylor <iant@google.com>
2175
2176 PR gold/12525
2177 * options.h (class General_options): Support -z notext.
2178 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2179 -Wl,-z,notext.
2180 (two_file_shared_nonpic.so): Likewise.
2181 (two_file_shared_mixed.so): Likewise.
2182 (two_file_shared_mixed_1.so): Likewise.
2183 (weak_undef_lib_nonpic.so): Likewise.
2184 (alt/weak_undef_lib_nonpic.so): Likewise.
2185 (tls_test_shared_nonpic.so): Likewise.
2186 * testsuite/Makefile.in: Rebuild.
2187
328c7c2f
ILT
21882011-07-01 Ian Lance Taylor <iant@google.com>
2189
2190 PR gold/12525
2191 * configure.ac: Test whether static linking works, setting
2192 the automake conditional HAVE_STATIC.
2193 * testsuite/Makefile.am: Disable tests using -static if
2194 HAVE_STATIC is not true.
2195 * configure, testsuite/Makefile.in: Rebuild.
2196
02d7cd44
ILT
21972011-07-01 Ian Lance Taylor <iant@google.com>
2198
2199 PR gold/12525
2200 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2201 Assert if we see DW_EH_PE_indirect.
2202 * target.h (Target::ehframe_datarel_base): New function.
2203 (Target::do_ehframe_datarel_base): New target function.
2204 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2205 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2206 function.
2207
07a60597
ILT
22082011-07-01 Ian Lance Taylor <iant@google.com>
2209
2210 PR gold/12571
2211 * options.h (class General_options): Add
2212 --ld-generated-unwind-info.
2213 * ehframe.cc (Fde::write): Add address parameter. Change all
2214 callers. If associated with PLT, fill in address and size.
2215 (Cie::set_output_offset): Only add merge mapping if there is an
2216 object.
2217 (Cie::write): Add address parameter. Change all callers.
2218 (Eh_frame::add_ehframe_for_plt): New function.
2219 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2220 input_offset_ fields into union u_, with new plt field.
2221 (Fde::Fde): Adjust for new union field.
2222 (Fde::Fde) [Output_data version]: New constructor.
2223 (Fde::add_mapping): Only add merge mapping if there is an object.
2224 (class Cie): Update declarations.
2225 (class Eh_frame): Declare add_ehframe_for_plt.
2226 * layout.cc (Layout::layout_eh_frame): Break out code into
2227 make_eh_frame_section, and call it.
2228 (Layout::make_eh_frame_section): New function.
2229 (Layout::add_eh_frame_for_plt): New function.
2230 * layout.h (class Layout): Update declarations.
2231 * merge.cc (Merge_map::add_mapping): Add assertion.
2232 * i386.cc: Include "dwarf.h".
2233 (class Output_data_plt_i386): Make first_plt_entry,
2234 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2235 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2236 and plt_eh_frame_fde.
2237 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2238 boundary. Call add_eh_frame_for_plt if appropriate.
2239 * x86_64.cc: Include "dwarf.h".
2240 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2241 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2242 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2243 and plt_eh_frame_fde.
2244 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2245 appropriate.
2246
14788a3f
ILT
22472011-06-29 Ian Lance Taylor <iant@google.com>
2248
2249 PR gold/12629
2250 * object.cc (Sized_relobj_file::layout_section): Change shdr
2251 parameter to be const.
2252 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2253 out of do_layout.
2254 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2255 appropriate. Call layout_eh_frame_section.
2256 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2257 sections.
2258 * object.h (class Sized_relobj_file): Update declarations.
2259
6c21fce1
ILT
22602011-06-29 Ian Lance Taylor <iant@google.com>
2261
37e41b03 2262 PR gold/12652
6c21fce1
ILT
2263 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2264 modifier.
2265 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2266
4d5e4e62
ILT
22672011-06-29 Ian Lance Taylor <iant@google.com>
2268
2269 PR gold/12675
2270 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2271 SHT_X86_64_UNWIND.
2272 * layout.cc (Layout::layout_eh_frame): Likewise.
2273
886f533a
ILT
22742011-06-29 Ian Lance Taylor <iant@google.com>
2275
2276 PR gold/12695
2277 * layout.cc (Layout::symtab_section_shndx): New function.
2278 * layout.h (class Layout): Declare symtab_section_shndx.
2279 * output.cc (Output_section::write_header): Call it.
2280
f3ae1b28
ILT
22812011-06-29 Ian Lance Taylor <iant@google.com>
2282
2283 PR gold/12818
2284 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2285 symbols which are not used in a relocation.
2286
aecf301f
ILT
22872011-06-28 Ian Lance Taylor <iant@google.com>
2288
2289 PR gold/12898
2290 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2291 script create indistinguishable segments.
2292 (Layout::set_segment_offsets): Use stable_sort when sorting
2293 segments. Pass this to Compare_segments constructor.
2294 * layout.h (class Layout): Make segment_precedes non-static.
2295 (class Compare_segments): Change from struct to class. Add
2296 layout_ field. Add constructor.
2297 * script-sections.cc
2298 (Script_sections::attach_sections_using_phdrs_clause): Rename
2299 local orphan to is_orphan. Don't report failure to put empty
2300 section in segment. On attachment failure, report name of
2301 section, and attach to first PT_LOAD segment.
2302
03ef7571
ILT
23032011-06-28 Ian Lance Taylor <iant@google.com>
2304
2305 PR gold/12934
2306 * target-select.cc (Target_selector::Target_selector): Add
2307 emulation parameter. Change all callers.
2308 (select_target_by_bfd_name): Rename from select_target_by_name.
2309 Change all callers.
2310 (select_target_by_emulation): New function.
2311 (supported_emulation_names): New function.
2312 * target-select.h (class Target_selector): Add emulation_ field.
2313 Update declarations.
2314 (Target_selector::recognize_by_bfd_name): Rename from
2315 recognize_by_name. Change all callers.
2316 (Target_selector::supported_bfd_names): Rename from
2317 supported_names. Change all callers.
2318 (Target_selector::recognize_by_emulation): New function.
2319 (Target_selector::supported_emulations): New function.
2320 (Target_selector::emulation): New function.
2321 (Target_selector::do_recognize_by_bfd_name): Rename from
2322 do_recognize_by_name. Change all callers.
2323 (Target_selector::do_supported_bfd_names): Rename from
2324 do_supported_names. Change all callers.
2325 (Target_selector::do_recognize_by_emulation): New function.
2326 (Target_selector::do_supported_emulations): New function.
2327 (select_target_by_bfd_name): Change name in declaration.
2328 (select_target_by_emulation): Declare.
2329 (supported_emulation_names): Declare.
2330 * parameters.cc (parameters_force_valid_target): Try to find
2331 target based on emulation from -m option.
2332 * options.h (class General_options): Change doc string for -m.
2333 * options.cc (help): Print emulations.
2334 (General_options::parse_V): Likewise.
2335 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2336 Add emulation parameter. Change all callers.
2337
200b2bb9
ILT
23382011-06-28 Ian Lance Taylor <iant@google.com>
2339
2340 * target.h (class Target): Add osabi_ field.
2341 (Target::osabi): New function.
2342 (Target::set_osabi): New function.
2343 (Target::Target): Initialize osabi_.
2344 (Target::do_adjust_elf_header): Make pure virtual.
2345 (Sized_target::do_adjust_elf_header): Declare.
2346 * target.cc (Sized_target::do_adjust_elf_header): New function.
2347 (class Sized_target): Instantiate all versions.
2348 * freebsd.h (class Target_freebsd): Remove.
2349 (Target_selector_freebsd::do_recognize): Call set_osabi on
2350 Target.
2351 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2352 (Target_selector_freebsd::set_osabi): Remove.
2353 * i386.cc (class Target_i386): Inherit from Sized_target rather
2354 than Target_freebsd.
2355 * x86_64.cc (class Target_x86_64): Likewise.
2356
b3ce541e
ILT
23572011-06-28 Ian Lance Taylor <iant@google.com>
2358
2359 * target.h (Target::can_check_for_function_pointers): Rewrite.
2360 Make non-virtual.
2361 (Target::can_icf_inline_merge_sections): Likewise.
2362 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2363 (Target::Target_info): Add can_icf_inline_merge_sections field.
2364 (Target::do_can_check_for_function_pointers): New virtual
2365 function.
2366 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2367 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2368 from can_check_for_function_pointers, move in file.
2369 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2370 section_may_have_icf_unsafe_poineters, move in file.
2371 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2372 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2373 Rename from can_check_for_function_pointers, move in file.
2374 (Target_i386::can_icf_inline_merge_sections): Remove.
2375 (Target_i386::i386_info): Initialize
2376 can_icf_inline_merge_sections.
2377 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2378 Initialize can_icf_inline_merge_sections.
2379 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2380 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2381 Rename from can_check_for_function_pointers, move in file.
2382 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2383 (Target_x86_64::x86_64_info): Initialize
2384 can_icf_inline_merge_sections.
2385 * testsuite/testfile.cc (Target_test::test_target_info):
2386 Likewise.
2387 * icf.cc (get_section_contents): Correct formatting.
2388
6d1c4efb
ILT
23892011-06-27 Ian Lance Taylor <iant@google.com>
2390
2391 * symtab.cc (Symbol::versioned_name): New function.
2392 (Symbol_table::add_to_final_symtab): Use versioned_name when
2393 appropriate.
2394 (Symbol_table::sized_write_symbol): Likewise.
2395 * symtab.h (class Symbol): Declare versioned_name.
2396 * stringpool.h (class Stringpool_template): Add variant of add
2397 which takes a std::basic_string.
2398 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2399 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2400 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2401 (ver_test_12.o): New target.
2402 * testsuite/Makefile.in: Rebuild.
2403
57eb9b50
DK
24042011-06-27 Doug Kwan <dougkwan@google.com>
2405
2406 * arm.cc (Arm_relocate_functions::thm_jump8,
2407 Arm_relocate_functions::thm_jump11): Use a wider signed
2408 type to compute offset.
2409 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2410 arm_thm_jump8.
2411 * testsuite/Makefile.in: Regenerate.
2412 * testsuite/arm_branch_in_range.sh: Check test results of
2413 arm_thm_jump11 and arm_thm_jump8.
2414 * testsuite/arm_thm_jump11.s: New test source file.
2415 * testsuite/arm_thm_jump11.t: New linker script.
2416 * testsuite/arm_thm_jump8.s: New test source file.
2417 * testsuite/arm_thm_jump8.t: New linker script.
2418
487b39df
ILT
24192011-06-24 Ian Lance Taylor <iant@google.com>
2420
2421 * layout.cc: Include "object.h".
2422 (ctors_sections_in_init_array): New static variable.
2423 (Layout::is_ctors_in_init_array): New function.
2424 (Layout::layout): Add entry to ctors_sections_in_init_array if
2425 appropriate.
2426 * layout.h (class Layout): Declare is_ctors_in_init_array.
2427 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2428 is_ctors_reverse_view is set.
2429 (Sized_relobj_file::write_sections): Add layout parameter. Change
2430 all callers. Set is_ctors_reverse_view field of View_size.
2431 (Sized_relobj_file::reverse_words): New function.
2432 * object.h (Sized_relobj_file::View_size): Add
2433 is_ctors_reverse_view field.
2434 (class Sized_relobj_file): Update declarations.
2435 * testsuite/initpri3.c: New test.
2436 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2437 initpri3b.
2438 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2439 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2440 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2441 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2442 * testsuite/Makefile.in: Rebuild.
2443
472076e4
CC
24442011-06-24 Cary Coutant <ccoutant@google.com>
2445
2446 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2447 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2448 (debug_msg_cdebug.err): New targets.
2449 * testsuite/Makefile.in: Regenerate.
2450 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2451 Fix checks for link with shared library.
2452
a60af0db
DK
24532011-06-24 Doug Kwan <dougkwan@google.com>
2454
2455 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2456 skip empty text sections.
2457 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2458
5393d741
ILT
24592011-06-22 Ian Lance Taylor <iant@google.com>
2460
2461 PR gold/12910
2462 * options.h (class General_options): Add --ctors-in-init-array.
2463 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2464 friends as SHT_PROGBITS for merging sections.
2465 (Layout::layout): Remove special handling of .init_array and
2466 friends. Don't sort if doing relocatable link. Sort for .ctors
2467 and .dtors if ctors_in_init_array.
2468 (Layout::make_output_section): Force correct section types for
2469 .init_array and friends. Don't sort if doing relocatable link,
2470 Don't sort .ctors and .dtors if ctors_in_init_array.
2471 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2472 (Layout::output_section_name): Add relobj parameter. Change all
2473 callers. Handle .ctors. and .dtors. in code rather than table.
2474 Handle .ctors and .dtors if ctors_in_init_array.
2475 (Layout::match_file_name): New function, moved from output.cc.
2476 * layout.h (class Layout): Update declarations.
2477 * output.cc: Include "layout.h".
2478 (Input_section_sort_entry::get_priority): New function.
2479 (Input_section_sort_entry::match_file_name): Just call
2480 Layout::match_file_name.
2481 (Output_section::Input_section_sort_init_fini_compare::operator()):
2482 Handle .ctors and .dtors. Sort by explicit priority rather than
2483 by name.
2484 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2485 * testsuite/initpri2.c: New test.
2486 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2487 (check_PROGRAMS): Add initpri2.
2488 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2489 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2490 * configure, testsuite/Makefile.in: Rebuild.
2491
e1f74f98
ILT
24922011-06-19 Ian Lance Taylor <iant@google.com>
2493
2494 PR gold/12880
2495 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2496 .interp section to a PT_INTERP segment even if we have seen a
2497 --dynamic-linker option. Don't do it if we have seen a PHDRS
2498 clause in a linker script.
2499 (Layout::finalize): Don't create a .interp section if we've
2500 already create a PT_INTERP segment.
2501 (Layout::create_interp): Always call choose_output_section (revert
2502 patch of 2011-06-17). Don't create PT_INTERP segment.
2503 * script-sections.cc
2504 (Script_sections::create_note_and_tls_segments): Add a .interp
2505 section to a PT_INTERP segment even if we have seen a
2506 --dynamic-linker option.
2507
766f91bb
ILT
25082011-06-18 Ian Lance Taylor <iant@google.com>
2509
2510 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2511 merely because a non-PT_LOAD segment has a dynamic reloc.
2512
0d212c3a
ILT
25132011-06-18 Ian Lance Taylor <iant@google.com>
2514
2515 * layout.cc (Layout::finish_dynamic_section): Don't create
2516 DT_FLAGS entry if not needed.
2517
911a5072
ILT
25182011-06-18 Ian Lance Taylor <iant@google.com>
2519
2520 PR gold/12745
2521 * layout.cc (Layout::layout_eh_frame): Correct handling of
2522 writable .eh_frame section.
2523
534b4e5f
ILT
25242011-06-17 Ian Lance Taylor <iant@google.com>
2525
2526 PR gold/12893
2527 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2528 symbol is redefined with the exact same object and value.
2529
10b4f102
ILT
25302011-06-17 Ian Lance Taylor <iant@google.com>
2531
2532 PR gold/12880
2533 * layout.h (class Layout): Add interp_segment_ field.
2534 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2535 (Layout::attach_allocated_section_to_segment): If making shared
2536 library, put .interp section in PT_INTERP segment.
2537 (Layout::finalize): Also call create_interp if -dynamic-linker
2538 option was used.
2539 (Layout::create_interp): Assert that there is no PT_INTERP
2540 segment. If not using a SECTIONS clause, use make_output_section.
2541 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2542 * script-sections.cc
2543 (Script_sections::create_note_and_tls_segments): If making shared
2544 library, put .interp section in PT_INTERP segment.
2545
a29b0dad
ILT
25462011-06-17 Ian Lance Taylor <iant@google.com>
2547
e588ea8d
ILT
2548 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2549 when making a shared library.
2550
25512011-06-17 Ian Lance Taylor <iant@google.com>
2552
2553 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2554 parameter. Change all callers. Don't issue warning about PC32
2555 against locally defined symbol.
a29b0dad 2556
9d3b0698
ILT
25572011-06-16 Ian Lance Taylor <iant@google.com>
2558
2559 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2560 occurs in same object.
2561
85b0f90c
AM
25622011-06-14 Alan Modra <amodra@gmail.com>
2563
2564 * po/POTFILES.in: Regenerate.
2565
a94907d9
ILT
25662011-06-09 Ian Lance Taylor <iant@google.com>
2567
2568 * script-sections.cc
2569 (Orphan_output_section::set_section_addresses): For a relocatable
2570 link set address to 0.
2571
4fb3a1c3
CC
25722011-06-09 Cary Coutant <ccoutant@google.com>
2573
2574 PR gold/12804
2575 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2576 used with --compress-debug-sections.
2577 * gold/object.cc (Sized_relobj_file::do_layout): Report
2578 uncompressed size of compressed input sections.
2579
61220854
CC
25802011-06-08 Cary Coutant <ccoutant@google.com>
2581
2582 PR gold/12804
2583 * testsuite/two_file_test_2_v1.cc: Change initialization of
2584 v2 to keep it in .data.
2585
e6455dfb
CC
25862011-06-07 Cary Coutant <ccoutant@google.com>
2587
2588 * common.cc (Symbol_table::do_allocate_commons_list): Call
2589 gold_fallback.
2590 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2591 (Errors::fallback): New function.
2592 (gold_fallback): New function.
2593 * errors.h (Errors::fallback): New function.
2594 * gold.cc (gold_exit): Change status parameter to enum; adjust
2595 all callers.
2596 (queue_initial_tasks): Call gold_fallback.
2597 * gold.h: Include cstdlib.
2598 (Exit_status): New enum type.
2599 (gold_exit): Change status parameter to enum.
2600 (gold_fallback): New function.
2601 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2602 (Layout::create_symtab_sections): Likewise.
2603 (Layout::create_shdrs): Likewise.
2604 * main.cc (main): Adjust call to gold_exit.
2605 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2606 (Output_data_got::add_got_entry_pair): Likewise.
2607 (Output_section::add_input_section): Likewise.
2608 (Output_section::add_output_section_data): Likewise.
2609 (Output_segment::set_section_list_addresses): Likewise.
2610 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2611
fb0e076f
CC
26122011-06-07 Cary Coutant <ccoutant@google.com>
2613
2614 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2615 for incremental links.
2616 * output.cc (Output_segment::set_section_list_addresses): Remove
2617 FIXME and test for TLS or BSS.
2618
a5ee4d5d
CC
26192011-06-07 Cary Coutant <ccoutant@google.com>
2620
2621 * testsuite/Makefile.am: Add incremental_copy_test,
2622 incremental_common_test_1.
2623 * testsuite/Makefile.in: Regenerate.
2624 * testsuite/common_test_1_v1.c: New source file.
2625 * testsuite/common_test_1_v2.c: New source file.
2626 * testsuite/copy_test_v1.cc: New source file.
2627
5146f448
CC
26282011-06-07 Cary Coutant <ccoutant@google.com>
2629
2630 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2631 update, allocate common from bss section's free list.
2632 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2633 linker-defined symbols.
2634 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2635 Skip GOT and PLT entries that are no longer referenced.
2636 (Output_section_incremental_inputs::write_info_blocks): Mark
2637 linker-defined symbols.
2638 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2639 * output.cc (Output_section::allocate): New function.
2640 * output.h (Output_section::allocate): New function.
2641 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2642 linker-defined symbols.
2643 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2644 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2645 (Symbol::init_base_output_data): Likewise.
2646 (Symbol::init_base_output_segment): Likewise.
2647 (Symbol::init_base_constant): Likewise.
2648 (Sized_symbol::init_output_data): Likewise.
2649 (Sized_symbol::init_output_segment): Likewise.
2650 (Sized_symbol::init_constant): Likewise.
2651 (Symbol_table::do_define_in_output_data): Likewise.
2652 (Symbol_table::do_define_in_output_segment): Likewise.
2653 (Symbol_table::do_define_as_constant): Likewise.
2654 * symtab.h (Symbol::is_predefined): New function.
2655 (Symbol::init_base_output_data): Add is_predefined parameter.
2656 (Symbol::init_base_output_segment): Likewise.
2657 (Symbol::init_base_constant): Likewise.
2658 (Symbol::is_predefined_): New data member.
2659 (Sized_symbol::init_output_data): Add is_predefined parameter.
2660 (Sized_symbol::init_output_segment): Likewise.
2661 (Sized_symbol::init_constant): Likewise.
2662 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2663
26d3c67d
CC
26642011-06-07 Cary Coutant <ccoutant@google.com>
2665
2666 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2667 instead of emit_copy_reloc.
2668 (Copy_relocs::emit_copy_reloc): Refactor.
2669 (Copy_relocs::make_copy_reloc): New function.
2670 (Copy_relocs::add_copy_reloc): Remove.
2671 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2672 section.
2673 (Copy_relocs::make_copy_reloc): New function.
2674 (Copy_relocs::add_copy_reloc): Remove.
2675 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2676 unchanged input files.
2677 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2678 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2679 Reserve BSS space for COPY relocations.
2680 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2681 (Output_section_incremental_inputs::write_info_blocks): Record
2682 whether a symbol is copied from a shared object.
2683 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2684 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2685 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2686 (Incremental_input_entry_reader::get_output_symbol_index): Add
2687 is_copy parameter.
2688 (Incremental_binary::emit_copy_relocs): New function.
2689 (Incremental_binary::do_emit_copy_relocs): New function.
2690 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2691 new data member.
2692 (Sized_incremental_binary::add_copy_reloc): New function.
2693 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2694 (Sized_incremental_binary::Copy_reloc): New struct.
2695 (Sized_incremental_binary::Copy_relocs): New typedef.
2696 (Sized_incremental_binary::copy_relocs_): New data member.
2697 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2698 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2699 * target.h (Sized_target::emit_copy_reloc): New function.
2700 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2701
7cdb37d9
CC
27022011-06-02 Cary Coutant <ccoutant@google.com>
2703
2704 PR gold/12163
2705 * gold/archive.cc (Archive::Archive): Initialize new data member.
2706 (Archive::include_all_members): Return if archive has already been
2707 included.
2708 * gold/archive.h (Archive::include_all_members_): New data member.
2709
cc643b88
NC
27102011-06-02 Nick Clifton <nickc@redhat.com>
2711
2712 * dynobj.h: Fix spelling mistake in comment.
2713 * output.cc: Likewise.
2714
f62a3ca7 27152011-05-31 Doug Kwan <dougkwan@google.com>
2e702c99 2716 Asier Llano
f62a3ca7
DK
2717
2718 PR gold/12826
cc643b88 2719 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
2720 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2721 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2722 redundant arm_exidx_test.so.
2723 * testsuite/Makefile.in: Regenerate.
2724 (check_SCRIPTS): Add pr12826.sh
2725 (check_DATA): Add pr12826.stdout
2726 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2727 * testsuite/pr12826.sh: New file.
2728 * testsuite/pr12826_1.s: Ditto.
2729 * testsuite/pr12826_1.s: Ditto.
2730
8dbe1edc
ILT
27312011-05-30 Ian Lance Taylor <iant@google.com>
2732
2733 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2734 sections.
2735
c49875be
ILT
27362011-05-29 Ian Lance Taylor <iant@google.com>
2737
2738 PR gold/12804
2739 * testsuite/Makefile.am: Use different file name for two_file_test
2740 temporary file for each incremental test.
2741 * testsuite/Makefile.in: Rebuild.
2742
69d53f7a
ILT
27432011-05-29 Ian Lance Taylor <iant@google.com>
2744
2745 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2746 binary input file is empty.
2747
41d0ab5f
ILT
27482011-05-27 Ian Lance Taylor <iant@google.com>
2749
2750 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2751 (ver_test_9.so): Likewise.
2752 * testsuite/Makefile.in: Rebuild.
2753
89d8a36b
CC
27542011-05-26 Cary Coutant <ccoutant@google.com>
2755
2756 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2757 * incremental.cc (Incremental_inputs::report_input_section): Fix
2758 comment, indentation.
2759 (Incremental_inputs::report_comdat_group): New function.
2760 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2761 of data for incremental input file entry.
2762 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2763 group count, COMDAT group signatures.
2764 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2765 an unchanged input file.
2766 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2767 Initialize new data member.
2768 (Incremental_object_entry::add_comdat_group): New function.
2769 (Incremental_object_entry::get_comdat_group_count): New function.
2770 (Incremental_object_entry::get_comdat_signature_key): New function.
2771 (Incremental_object_entry::groups_): New data member.
2772 (Incremental_inputs::report_comdat_group): New function.
2773 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2774 data for incremental input file entry.
2775 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2776 (Incremental_input_entry_reader::get_input_section): Adjust size of
2777 data for incremental input file entry.
2778 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2779 (Incremental_input_entry_reader::get_comdat_group_signature): New
2780 function.
2781 * object.cc (Sized_relobj::include_section_group): Report kept
2782 COMDAT groups for incremental links.
2783
1706a06f
ILT
27842011-05-24 David Meyer <pdox@google.com>
2785
2786 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2787 with name parameter. Add found_name parameter.
2788 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2789 * dirsearch.h (class Dirsearch): Update declaration.
2790
a10ae760
ILT
27912011-05-24 Ian Lance Taylor <iant@google.com>
2792
2793 * archive.cc (Library_base::should_include_member): Pull in object
2794 from archive if it defines the entry symbol.
2795 * parameters.cc (Parameters::entry): New function.
2796 * parameters.h (class Parameters): Declare entry.
2797 * output.h (class Output_file_header): Remove entry_ field.
2798 * output.cc (Output_file_header::Output_file_header): Remove entry
2799 parameter. Change all callers.
2800 (Output_file_header::entry): Use parameters->entry.
2801 * gold.cc (queue_middle_tasks): Likewise.
2802 * plugin.cc (Plugin_hook::run): Likewise.
2803
aa92d6ed
CC
28042011-05-24 Cary Coutant <ccoutant@google.com>
2805
2806 * gold.cc (queue_initial_tasks): Pass incremental base filename
2807 to Output_file::open_base_file; don't print error message.
2808 * incremental-dump.cc (main): Adjust call to
2809 Output_file::open_for_modification.
2810 * incremental-dump.cc (main): Likewise.
2811 * incremental.cc (Incremental_inputs::report_command_line):
2812 Ignore --incremental-base option when comparing command lines.
2813 Ignore parameter when given as separate argument.
2814 * options.h (class General_options): Add --incremental-base.
2815 * output.cc (Output_file::Output_file):
2816 (Output_file::open_base_file): Add base_name and writable parameters;
2817 read base file into new file; print error message here.
2818 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2819 callers.
2820 * output.h (Output_file::open_for_modification): Rename to...
2821 (Output_file::open_base_file): ...this; add base_name and
2822 writable parameters; adjust all callers.
2823 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2824 callers.
2825 * testsuite/Makefile.am (incremental_test_4): Test
2826 --incremental-base.
2827 * testsuite/Makefile.in: Regenerate.
2828
2eedd706
CC
28292011-05-24 Cary Coutant <ccoutant@google.com>
2830
2831 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2832 incremental_test_4.
2833 * testsuite/Makefile.in: Regenerate.
2834 * testsuite/two_file_test_1_v1.cc: New test source file.
2835 * testsuite/two_file_test_1b_v1.cc: New test source file.
2836 * testsuite/two_file_test_2_v1.cc: New test source file.
2837
0f1c85a6
CC
28382011-05-24 Cary Coutant <ccoutant@google.com>
2839
2840 * dynobj.h (Dynobj::do_dynobj): New function.
2841 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2842 flag and soname for shared objects.
2843 * incremental.cc (Incremental_inputs::report_object): Make
2844 either Incremental_object_entry or Incremental_dynobj_entry; add
2845 soname to string table.
2846 (Incremental_inputs::report_input_section): Add assertion.
2847 (Output_section_incremental_inputs::set_final_data_size): Adjust
2848 type of input file entry for shared libraries; adjust size of
2849 shared library info entry.
2850 (Output_section_incremental_inputs::write_input_files): Write
2851 as_needed flag for shared libraries.
2852 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2853 of input file entry for shared libraries; write soname.
2854 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2855 soname from incremental info.
2856 * incremental.h (enum Incremental_input_flags): Add
2857 INCREMENTAL_INPUT_AS_NEEDED.
2858 (Incremental_input_entry::Incremental_input_entry): Initialize new
2859 data member.
2860 (Incremental_input_entry::set_as_needed): New function.
2861 (Incremental_input_entry::as_needed): New function.
2862 (Incremental_input_entry::do_dynobj_entry): New function.
2863 (Incremental_input_entry::as_needed_): New data member.
2864 (Incremental_object_entry::Incremental_object_entry): Don't check
2865 for shared library.
2866 (Incremental_object_entry::do_type): Likewise.
2867 (class Incremental_dynobj_entry): New class.
2868 (Incremental_input_entry_reader::as_needed): New function.
2869 (Incremental_input_entry_reader::get_soname): New function.
2870 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2871 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2872 size of shared library info entry.
58797674 2873 * layout.cc (Layout::finish_dynamic_section): Don't test for
0f1c85a6
CC
2874 incremental link when adding DT_NEEDED entries.
2875 * object.h (Object::Object): Initialize new data member.
2876 (Object::dynobj): New function.
2877 (Object::set_as_needed): New function.
2878 (Object::as_needed): New function.
2879 (Object::do_dynobj): New function.
2880 (Object::as_needed_): New data member.
2881
6fa2a40b
CC
28822011-05-24 Cary Coutant <ccoutant@google.com>
2883
2884 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2885 info; adjust display of GOT entries.
2886 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2887 vector of input objects; remove file_status_.
2888 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2889 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2890 got_plt reader; call target hooks to reserve GOT entries.
2891 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2892 of input file info header and GOT info entry.
2893 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2894 relocation info.
2895 (Got_plt_view_info::got_descriptor): Remove.
2896 (Got_plt_view_info::sym_index): New data member.
2897 (Got_plt_view_info::input_index): New data member.
2898 (Local_got_offset_visitor::visit): Write input file index.
2899 (Global_got_offset_visitor::visit): Write 0 for input file index.
2900 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2901 with sym_index and input_index.
2902 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2903 incremental info GOT entry; replace got_descriptor with input_index.
2904 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2905 map from input file index to object.
2906 (Sized_relobj_incr::do_layout): Replace direct data member reference
2907 with accessor function.
2908 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2909 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2910 Adjust size of input file info header.
2911 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2912 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2913 (Incremental_input_entry_reader::get_input_section): Adjust size of
2914 input file info header.
2915 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2916 of incremental info GOT entry.
2917 (Incremental_got_plt_reader::get_got_desc): Remove.
2918 (Incremental_got_plt_reader::get_got_symndx): New function.
2919 (Incremental_got_plt_reader::get_got_input_index): New function.
2920 (Sized_incremental_binary::Sized_incremental_binary): Remove
2921 file_status_; add input_objects_.
2922 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2923 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2924 (Sized_incremental_binary::file_is_unchanged): Remove.
2925 (Sized_incremental_binary::set_input_object): New function.
2926 (Sized_incremental_binary::input_object): New function.
2927 (Sized_incremental_binary::file_status_): Remove.
2928 (Sized_incremental_binary::input_objects_): New data member.
2929 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2930 references.
2931 (Sized_relobj_incr::invalid_address): Move to base class.
2932 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2933 class.
2934 (Sized_relobj_incr::do_output_section_offset): Likewise.
2935 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2936 (Sized_relobj_incr::section_offsets_): Likewise.
2937 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2938 function.
2939 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2940 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2941 with accessor function.
2942 (Sized_relobj_file::do_layout): Likewise.
2943 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2944 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2945 (Sized_relobj_file::compute_final_local_value): Replace refs to
2946 section_offsets_ with accessor function.
2947 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2948 * object.h (Relobj::Relobj): Initialize new data members.
2949 (Relobj::add_dyn_reloc): New function.
2950 (Relobj::first_dyn_reloc): New function.
2951 (Relobj::dyn_reloc_count): New function.
2952 (Relobj::first_dyn_reloc_): New data member.
2953 (Relobj::dyn_reloc_count_): New data member.
2954 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2955 references.
2956 (Sized_relobj::Address): New typedef.
2957 (Sized_relobj::invalid_address): Move here from child class.
2958 (Sized_relobj::Sized_relobj): Initialize new data members.
2959 (Sized_relobj::sized_relobj): New function.
2960 (Sized_relobj::is_output_section_offset_invalid): Move here from
2961 child class.
2962 (Sized_relobj::get_output_section_offset): Likewise.
2963 (Sized_relobj::local_has_got_offset): Likewise.
2964 (Sized_relobj::local_got_offset): Likewise.
2965 (Sized_relobj::set_local_got_offset): Likewise.
2966 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2967 (Sized_relobj::clear_got_offsets): New function.
2968 (Sized_relobj::section_offsets): Move here from child class.
2969 (Sized_relobj::do_output_section_offset): Likewise.
2970 (Sized_relobj::do_set_section_offset): Likewise.
2971 (Sized_relobj::Local_got_offsets): Likewise.
2972 (Sized_relobj::local_got_offsets_): Likewise.
2973 (Sized_relobj::section_offsets_): Likewise.
2974 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2975 references.
2976 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2977 class.
2978 (Sized_relobj_file::sized_relobj): New function
2979 (Sized_relobj_file::local_has_got_offset): Move to base class.
2980 (Sized_relobj_file::local_got_offset): Likewise.
2981 (Sized_relobj_file::set_local_got_offset): Likewise.
2982 (Sized_relobj_file::get_output_section_offset): Likewise.
2983 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2984 (Sized_relobj_file::do_output_section_offset): Likewise.
2985 (Sized_relobj_file::do_set_section_offset): Likewise.
2986 (Sized_relobj_file::Local_got_offsets): Likewise.
2987 (Sized_relobj_file::local_got_offsets_): Likewise.
2988 (Sized_relobj_file::section_offsets_): Likewise.
2989 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2990 (all constructors).
2991 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2992 (Output_reloc::get_symbol_index): Likewise.
2993 (Output_reloc::local_section_offset): Likewise.
2994 (Output_reloc::get_address): Likewise.
2995 (Output_reloc::symbol_value): Likewise.
2996 (Output_data_got::reserve_slot): Move to class definition.
2997 (Output_data_got::reserve_local): New function.
2998 (Output_data_got::reserve_slot_for_global): Remove.
2999 (Output_data_got::reserve_global): New function.
3000 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3001 (all constructors, two instantiations).
3002 (Output_reloc::get_relobj): New function (two instantiations).
3003 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3004 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3005 (Output_data_reloc::add_global): Adjust type of relobj.
3006 (Output_data_reloc::add_global_relative): Likewise.
3007 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3008 (Output_data_reloc::add_local): Likewise.
3009 (Output_data_reloc::add_local_relative): Likewise.
3010 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3011 (Output_data_reloc::add_local_section): Likewise.
3012 (Output_data_reloc::add_output_section): Likewise.
3013 (Output_data_reloc::add_absolute): Likewise.
3014 (Output_data_reloc::add_target_specific): Likewise.
3015 (Output_data_got::reserve_slot): Move definition here.
3016 (Output_data_got::reserve_local): New function.
3017 (Output_data_got::reserve_global): New function.
3018 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3019 section_offsets_ with accessor function.
3020 (Sized_relobj_file::write_sections): Likewise.
3021 (Sized_relobj_file::do_relocate_sections): Likewise.
3022 * target.h (Sized_target::reserve_local_got_entry): New function.
3023 (Sized_target::reserve_global_got_entry): New function.
3024 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3025 (Target_x86_64::reserve_global_got_entry): New function.
3026 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3027
4829d394
CC
30282011-05-23 Cary Coutant <ccoutant@google.com>
3029
3030 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3031 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3032 bit when checking got_type.
3033 * incremental.cc (Sized_incremental_binary::setup_readers):
3034 Store symbol table and string table locations; initialize bit vector
3035 of file status flags.
3036 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3037 unchanged files.
3038 (Sized_incremental_binary::do_process_got_plt): New function.
3039 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3040 (Output_section_incremental_inputs::set_final_data_size): Record
3041 file index for each input file.
3042 (Output_section_incremental_inputs::write_got_plt): Store file index
3043 instead of input entry offset for each GOT entry.
3044 * incremental.h
3045 (Incremental_input_entry::Incremental_input_entry): Initialize new
3046 data member.
3047 (Incremental_input_entry::set_offset): Store file index.
3048 (Incremental_input_entry::get_file_index): New function.
3049 (Incremental_input_entry::file_index_): New data member.
3050 (Incremental_binary::process_got_plt): New function.
3051 (Incremental_binary::do_process_got_plt): New function.
3052 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3053 data members.
3054 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3055 (Sized_incremental_binary::set_file_is_unchanged): New function.
3056 (Sized_incremental_binary::file_is_unchanged): New function.
3057 (Sized_incremental_binary::do_process_got_plt): New function.
3058 (Sized_incremental_binary::file_status_): New data member.
3059 (Sized_incremental_binary::main_symtab_loc_): New data member.
3060 (Sized_incremental_binary::main_strtab_loc_): New data member.
3061 * output.cc (Output_data_got::Got_entry::write): Add case
3062 RESERVED_CODE.
3063 (Output_data_got::add_global): Call add_got_entry.
3064 (Output_data_got::add_global_plt): Likewise.
3065 (Output_data_got::add_global_with_rel): Likewise.
3066 (Output_data_got::add_global_with_rela): Likewise.
3067 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3068 (Output_data_got::add_global_pair_with_rela): Likewise.
3069 (Output_data_got::add_local): Call add_got_entry.
3070 (Output_data_got::add_local_plt): Likewise.
3071 (Output_data_got::add_local_with_rel): Likewise.
3072 (Output_data_got::add_local_with_rela): Likewise.
3073 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3074 (Output_data_got::add_local_pair_with_rela): Likewise.
3075 (Output_data_got::reserve_slot): New function.
3076 (Output_data_got::reserve_slot_for_global): New function.
3077 (Output_data_got::add_got_entry): New function.
3078 (Output_data_got::add_got_entry_pair): New function.
3079 (Output_section::add_output_section_data): Edit FIXME.
3080 * output.h
3081 (Output_section_data_build::Output_section_data_build): New
3082 constructor with size parameter.
3083 (Output_data_space::Output_data_space): Likewise.
3084 (Output_data_got::Output_data_got): Initialize new data member; new
3085 constructor with size parameter.
3086 (Output_data_got::add_constant): Call add_got_entry.
3087 (Output_data_got::reserve_slot): New function.
3088 (Output_data_got::reserve_slot_for_global): New function.
3089 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3090 (Output_data_got::add_got_entry): New function.
3091 (Output_data_got::add_got_entry_pair): New function.
3092 (Output_data_got::free_list_): New data member.
3093 * target.h (Sized_target::init_got_plt_for_update): New function.
3094 (Sized_target::register_global_plt_entry): New function.
3095 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3096 Initialize new data member; call init; add constructor with PLT count.
3097 (Output_data_plt_x86_64::init): New function.
3098 (Output_data_plt_x86_64::add_relocation): New function.
3099 (Output_data_plt_x86_64::reserve_slot): New function.
3100 (Output_data_plt_x86_64::free_list_): New data member.
3101 (Target_x86_64::init_got_plt_for_update): New function.
3102 (Target_x86_64::register_global_plt_entry): New function.
3103 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3104 incremental updates.
3105 (Output_data_plt_x86_64::add_relocation): New function.
3106 * testsuite/object_unittest.cc (Object_test): Set default options.
3107
ec69d6da
ILT
31082011-05-16 Ian Lance Taylor <iant@google.com>
3109
3110 * options.h (class General_options): Make -i a synonym for -r.
3111
732e31de
ILT
31122011-05-16 Ian Lance Taylor <iant@google.com>
3113
3114 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3115
403676b5
CC
31162011-05-10 Cary Coutant <ccoutant@google.com>
3117
3118 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3119 strip_all (-s).
3120
5b7b7d6e
ILT
31212011-05-06 Ian Lance Taylor <iant@google.com>
3122
3123 * layout.cc (Layout::layout): If the output section flags change,
3124 update the ordering.
3125
f0f9babf
CC
31262011-04-25 Cary Coutant <ccoutant@google.com>
3127
3128 * incremental-dump.cc (dump_incremental_inputs): Print local
3129 symbol info for each input file.
3130 * incremental.cc
3131 (Output_section_incremental_inputs::set_final_data_size): Add local
3132 symbol info to input file entries in incremental info.
3133 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3134 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3135 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3136 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3137 implementation.
3138 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3139 (Sized_incr_relobj::do_relocate): Write the local symbols.
3140 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3141 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3142 Adjust size of input file header.
3143 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3144 (Incremental_inputs_reader::get_local_symbol_count): New function.
3145 (Incremental_inputs_reader::get_input_section): Adjust size of input
3146 file header.
3147 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3148 (Sized_incr_relobj::This): New typedef.
3149 (Sized_incr_relobj::sym_size): New const data member.
3150 (Sized_incr_relobj::Local_symbol): New struct.
3151 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3152 (Sized_incr_relobj::do_local_symbol_offset): New function.
3153 (Sized_incr_relobj::local_symbol_count_): New data member.
3154 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3155 (Sized_incr_relobj::local_symbol_index_): New data member.
3156 (Sized_incr_relobj::local_symbol_offset_): New data member.
3157 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3158 (Sized_incr_relobj::local_symbols_): New data member.
3159 * object.h (Relobj::output_local_symbol_count): New function.
3160 (Relobj::local_symbol_offset): New function.
3161 (Relobj::do_output_local_symbol_count): New function.
3162 (Relobj::do_local_symbol_offset): New function.
3163 (Sized_relobj::do_output_local_symbol_count): New function.
3164 (Sized_relobj::do_local_symbol_offset): New function.
3165
d0a9ace3
ILT
31662011-04-22 Vladimir Simonov <sv@sw.ru>
3167
3168 * descriptors.cc (set_close_on_exec): New function.
3169 (Descriptors::open): Use set_close_on_exec.
3170 * output.cc (S_ISLNK): Define if not defined.
3171
94a3fc8b
CC
31722011-04-22 Cary Coutant <ccoutant@google.com>
3173
3174 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3175 global symbol map.
3176 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3177 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3178 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3179 relocations.
3180 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3181 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3182 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3183 * incremental.h
3184 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3185 function.
3186 (Incremental_binary::apply_incremental_relocs): New function.
3187 (Incremental_binary::do_apply_incremental_relocs): New function.
3188 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3189 data member.
3190 (Sized_incremental_binary::add_global_symbol): New function.
3191 (Sized_incremental_binary::global_symbol): New function.
3192 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3193 (Sized_incremental_binary::symbol_map_): New data member.
3194 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3195 * target.h (Sized_target::apply_relocation): New function.
3196 * target-reloc.h (apply_relocation): New function.
3197 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3198
c87e4302
DK
31992011-04-22 Doug Kwan <dougkwan@google.com>
3200
3201 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3202 flag of a SHT_ARM_EXIDX section.
2e702c99 3203 * testsuite/Makefile.am (arm_exidx_test): New test rules.
c87e4302
DK
3204 * testsuite/Makefile.in: Regenerate.
3205 * testsuite/arm_exidx_test.s: New file.
3206 * testsuite/arm_exidx_test.sh: Same.
3207
e7782cf6
CC
32082011-04-20 Cary Coutant <ccoutant@google.com>
3209
3210 PR gold/12689
3211 * archive.h (Incremental_archive_entry::Archive_member):
3212 Initialize arg_serial_ (second constructor).
3213
308ecdc7
ILT
32142011-04-17 Ian Lance Taylor <iant@google.com>
3215
3216 * object.cc (Relocate_info::location): Simplify location string.
3217 * errors.cc (Errors::error_at_location): Don't print program
3218 name.
3219 (Errors::warning_at_location): Likewise.
3220 (Errors::undefined_symbol): Likewise.
3221 * testsuite/debug_msg.sh: Update accordingly.
3222
bec5b579
CC
32232011-04-14 Cary Coutant <ccoutant@google.com>
3224
3225 * gold/layout.cc (Layout::symtab_section_offset): New function.
3226 * gold/layout.h (Layout::symtab_section_offset): New function.
3227 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3228
88597d34
ILT
32292011-04-12 Ian Lance Taylor <iant@google.com>
3230
3231 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3232 with MREMAP_MAYMOVE.
3233 * output.h (class Output_file): Add map_is_allocated_ field.
3234 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3235 not available, provide stubs. If mremap is not available, #define
3236 it to gold_mremap.
3237 (MREMAP_MAYMOVE): Define if not defined.
3238 (Output_file::Output_file): Initialize map_is_allocated_.
3239 (Output_file::resize): Check map_is_allocated_.
3240 (Output_file::map_anonymous): If mmap fails, use malloc.
3241 (Output_file::unmap): Don't do anything for an anonymous map.
3242 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3243 is not available, provide stubs.
3244 (File_read::View::~View): Use free rather than delete[].
3245 (File_read::make_view): Use malloc rather than new[]. If mmap
3246 fails, use malloc.
3247 (File_read::find_or_make_view): Use malloc rather than new[].
3248 * gold.h: Remove HAVE_REMAP code.
3249 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3250 exists. Rename mremap to gold_mremap. If mmap is not available
3251 don't do anything.
3252 * configure, config.in: Rebuild.
3253
11e361bc
ILT
32542011-04-11 Ian Lance Taylor <iant@google.com>
3255
3256 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3257 initialize local variable v.
3258
cdc29364
CC
32592011-04-11 Cary Coutant <ccoutant@google.com>
3260
3261 * archive.cc (Archive::include_member): Adjust call to
3262 report_object.
3263 (Add_archive_symbols::run): Track argument serial numbers.
3264 (Lib_group::include_member): Likewise.
3265 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3266 * archive.h (Incremental_archive_entry::Archive_member):
3267 Initialize arg_serial_.
3268 (Archive_member::arg_serial_): New data member.
3269 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3270 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3271 incremental link.
3272 (Sized_dynobj::do_for_all_local_got_entries): New function.
3273 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3274 function.
3275 * fileread.cc (get_mtime): New function.
3276 * fileread.h (get_mtime): New function.
3277 * gold.cc (queue_initial_tasks): Check for incremental update.
3278 (process_incremental_input): New function.
3279 (queue_middle_tasks): Don't force valid target for incremental
3280 update.
3281 * incremental-dump.cc (find_input_containing_global): Adjust
3282 size of symbol info entry.
3283 (dump_incremental_inputs): Dump argument serial number and
3284 in_system_directory flag; bias shndx by 1; print symbol names
3285 when dumping per-file symbol lists; use new symbol info readers.
3286 * incremental.cc
3287 (Output_section_incremental_inputs:update_data_size): New function.
3288 (Sized_incremental_binary::setup_readers): Setup input readers
3289 for each input file; build maps for files added from libraries
3290 and scripts.
3291 (Sized_incremental_binary::check_input_args): New function.
3292 (Sized_incremental_binary::do_check_inputs): Build map of argument
3293 serial numbers to input arguments.
3294 (Sized_incremental_binary::do_file_has_changed): Rename
3295 do_file_is_unchanged to this; compare file modification times.
3296 (Sized_incremental_binary::do_init_layout): New function.
3297 (Sized_incremental_binary::do_reserve_layout): New function.
3298 (Sized_incremental_binary::do_get_input_reader): Remove.
3299 (Sized_incremental_binary::get_symtab_view): New function.
3300 (Incremental_checker::can_incrementally_link_output_file): Remove.
3301 (Incremental_inputs::report_command_line): Exclude --debug options.
3302 (Incremental_inputs::report_archive_begin): Add parameter; track
3303 argument serial numbers; don't put input file entry for archive
3304 before archive members.
3305 (Incremental_inputs::report_archive_end): Put input file entry
3306 for archive after archive members.
3307 (Incremental_inputs::report_object): Add parameter; track argument
3308 serial numbers and in_system_directory flag.
3309 (Incremental_inputs::report_script): Add parameter; track argument
3310 serial numbers.
3311 (Output_section_incremental_inputs::set_final_data_size): Adjust
3312 size of symbol info entry; check for forwarding symbols.
3313 (Output_section_incremental_inputs::write_input_files): Write
3314 in_system_directory flag and argument serial number.
3315 (Output_section_incremental_inputs::write_info_blocks): Map section
3316 indices between incremental info and original input file; store
3317 input section index for each symbol.
3318 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3319 change operator() to visit().
3320 (class Global_got_offset_visitor): Likewise.
3321 (class Global_symbol_visitor_got_plt):
3322 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3323 classes.
3324 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3325 (Sized_incr_relobj::do_read_symbols): New function.
3326 (Sized_incr_relobj::do_layout): New function.
3327 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3328 (Sized_incr_relobj::do_add_symbols): New function.
3329 (Sized_incr_relobj::do_should_include_member): New function.
3330 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3331 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3332 (Sized_incr_relobj::do_section_size): New function.
3333 (Sized_incr_relobj::do_section_name): New function.
3334 (Sized_incr_relobj::do_section_contents): New function.
3335 (Sized_incr_relobj::do_section_flags): New function.
3336 (Sized_incr_relobj::do_section_entsize): New function.
3337 (Sized_incr_relobj::do_section_address): New function.
3338 (Sized_incr_relobj::do_section_type): New function.
3339 (Sized_incr_relobj::do_section_link): New function.
3340 (Sized_incr_relobj::do_section_info): New function.
3341 (Sized_incr_relobj::do_section_addralign): New function.
3342 (Sized_incr_relobj::do_initialize_xindex): New function.
3343 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3344 (Sized_incr_relobj::do_read_relocs): New function.
3345 (Sized_incr_relobj::do_gc_process_relocs): New function.
3346 (Sized_incr_relobj::do_scan_relocs): New function.
3347 (Sized_incr_relobj::do_count_local_symbols): New function.
3348 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3349 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3350 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3351 (Sized_incr_relobj::do_relocate): New function.
3352 (Sized_incr_relobj::do_set_section_offset): New function.
3353 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3354 (Sized_incr_dynobj::do_read_symbols): New function.
3355 (Sized_incr_dynobj::do_layout): New function.
3356 (Sized_incr_dynobj::do_add_symbols): New function.
3357 (Sized_incr_dynobj::do_should_include_member): New function.
3358 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3359 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3360 (Sized_incr_dynobj::do_section_size): New function.
3361 (Sized_incr_dynobj::do_section_name): New function.
3362 (Sized_incr_dynobj::do_section_contents): New function.
3363 (Sized_incr_dynobj::do_section_flags): New function.
3364 (Sized_incr_dynobj::do_section_entsize): New function.
3365 (Sized_incr_dynobj::do_section_address): New function.
3366 (Sized_incr_dynobj::do_section_type): New function.
3367 (Sized_incr_dynobj::do_section_link): New function.
3368 (Sized_incr_dynobj::do_section_info): New function.
3369 (Sized_incr_dynobj::do_section_addralign): New function.
3370 (Sized_incr_dynobj::do_initialize_xindex): New function.
3371 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3372 (make_sized_incremental_object): New function.
3373 (Incremental_library::copy_unused_symbols): New function.
3374 (Incremental_library::do_for_all_unused_symbols): New function.
3375 * incremental.h (enum Incremental_input_flags): New type.
3376 (class Incremental_checker): Remove.
3377 (Incremental_input_entry::Incremental_input_entry): Add argument
3378 serial number.
3379 (Incremental_input_entry::arg_serial): New function.
3380 (Incremental_input_entry::set_is_in_system_directory): New function.
3381 (Incremental_input_entry::is_in_system_directory): New function.
3382 (Incremental_input_entry::arg_serial_): New data member.
3383 (Incremental_input_entry::is_in_system_directory_): New data member.
3384 (class Script_info): Move here from script.h.
3385 (Script_info::Script_info): Add filename parameter.
3386 (Script_info::filename): New function.
3387 (Script_info::filename_): New data member.
3388 (Incremental_script_entry::Incremental_script_entry): Add argument
3389 serial number.
3390 (Incremental_object_entry::Incremental_object_entry): Likewise.
3391 (Incremental_object_entry::add_input_section): Build list of input
3392 sections with map to original shndx.
3393 (Incremental_object_entry::get_input_section_index): New function.
3394 (Incremental_object_entry::shndx_): New data member.
3395 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3396 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3397 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3398 serial number.
3399 (Incremental_inputs::report_archive_begin): Likewise.
3400 (Incremental_inputs::report_object): Likewise.
3401 (Incremental_inputs::report_script): Likewise.
3402 (class Incremental_global_symbol_reader): New class.
3403 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3404 and store flags and input file type.
3405 (Incremental_input_entry_reader::arg_serial): New function.
3406 (Incremental_input_entry_reader::type): Extract type from flags.
3407 (Incremental_input_entry_reader::is_in_system_directory): New function.
3408 (Incremental_input_entry_reader::get_input_section_count): Call
3409 accessor function for type.
3410 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3411 function for type; adjust size of global symbol entry.
3412 (Incremental_input_entry_reader::get_global_symbol_count): Call
3413 accessor function for type.
3414 (Incremental_input_entry_reader::get_object_count): Likewise.
3415 (Incremental_input_entry_reader::get_object_offset): Likewise.
3416 (Incremental_input_entry_reader::get_member_count): Likewise.
3417 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3418 (Incremental_input_entry_reader::get_member_offset): Likewise.
3419 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3420 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3421 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3422 (Incremental_input_entry_reader::get_global_symbol_reader): New
3423 function.
3424 (Incremental_input_entry_reader::get_output_symbol_index): New
3425 function.
3426 (Incremental_input_entry_reader::type_): Remove.
3427 (Incremental_input_entry_reader::flags_): New data member.
3428 (Incremental_inputs_reader::input_file_offset): New function.
3429 (Incremental_inputs_reader::input_file_index): New function.
3430 (Incremental_inputs_reader::input_file): Call input_file_offset.
3431 (Incremental_inputs_reader::input_file_at_offset): New function.
3432 (Incremental_relocs_reader::get_r_type): Reformat.
3433 (Incremental_relocs_reader::get_r_shndx): Reformat.
3434 (Incremental_relocs_reader::get_r_offset): Reformat.
3435 (Incremental_relocs_reader::data): New function.
3436 (Incremental_binary::Incremental_binary): Initialize new data members.
3437 (Incremental_binary::check_inputs): Add cmdline parameter.
3438 (Incremental_binary::file_is_unchanged): Remove.
3439 (Input_reader::arg_serial): New function.
3440 (Input_reader::get_unused_symbol_count): New function.
3441 (Input_reader::get_unused_symbol): New function.
3442 (Input_reader::do_arg_serial): New function.
3443 (Input_reader::do_get_unused_symbol_count): New function.
3444 (Input_reader::do_get_unused_symbol): New function.
3445 (Incremental_binary::input_file_count): New function.
3446 (Incremental_binary::get_input_reader): Change signature to use
3447 index instead of filename.
3448 (Incremental_binary::file_has_changed): New function.
3449 (Incremental_binary::get_input_argument): New function.
3450 (Incremental_binary::get_library): New function.
3451 (Incremental_binary::get_script_info): New function.
3452 (Incremental_binary::init_layout): New function.
3453 (Incremental_binary::reserve_layout): New function.
3454 (Incremental_binary::output_file): New function.
3455 (Incremental_binary::do_check_inputs): New function.
3456 (Incremental_binary::do_file_is_unchanged): Remove.
3457 (Incremental_binary::do_file_has_changed): New function.
3458 (Incremental_binary::do_init_layout): New function.
3459 (Incremental_binary::do_reserve_layout): New function.
3460 (Incremental_binary::do_input_file_count): New function.
3461 (Incremental_binary::do_get_input_reader): Change signature.
3462 (Incremental_binary::input_args_map_): New data member.
3463 (Incremental_binary::library_map_): New data member.
3464 (Incremental_binary::script_map_): New data member.
3465 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3466 new data members.
3467 (Sized_incremental_binary::output_section): New function.
3468 (Sized_incremental_binary::inputs_reader): Add const.
3469 (Sized_incremental_binary::symtab_reader): Add const.
3470 (Sized_incremental_binary::relocs_reader): Add const.
3471 (Sized_incremental_binary::got_plt_reader): Add const.
3472 (Sized_incremental_binary::get_symtab_view): New function.
3473 (Sized_incremental_binary::Inputs_reader): New typedef.
3474 (Sized_incremental_binary::Input_entry_reader): New typedef.
3475 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3476 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3477 (Sized_incremental_binary::do_file_has_changed): New function.
3478 (Sized_incremental_binary::do_init_layout): New function.
3479 (Sized_incremental_binary::do_reserve_layout): New function.
3480 (Sized_input_reader::Inputs_reader): Remove.
3481 (Sized_input_reader::Input_entry_reader): Remove.
3482 (Sized_input_reader::do_arg_serial): New function.
3483 (Sized_input_reader::do_get_unused_symbol_count): New function.
3484 (Sized_input_reader::do_get_unused_symbol): New function.
3485 (Sized_incremental_binary::do_input_file_count): New function.
3486 (Sized_incremental_binary::do_get_input_reader): Change signature;
3487 use index instead of filename.
3488 (Sized_incremental_binary::section_map_): New data member.
3489 (Sized_incremental_binary::input_entry_readers_): New data member.
3490 (class Sized_incr_relobj): New class.
3491 (class Sized_incr_dynobj): New class.
3492 (make_sized_incremental_object): New function.
3493 (class Incremental_library): New class.
3494 * layout.cc (Free_list::num_lists): New static data member.
3495 (Free_list::num_nodes): New static data member.
3496 (Free_list::num_removes): New static data member.
3497 (Free_list::num_remove_visits): New static data member.
3498 (Free_list::num_allocates): New static data member.
3499 (Free_list::num_allocate_visits): New static data member.
3500 (Free_list::init): New function.
3501 (Free_list::remove): New function.
3502 (Free_list::allocate): New function.
3503 (Free_list::dump): New function.
3504 (Free_list::print_stats): New function.
3505 (Layout_task_runner::run): Resize output file for incremental updates.
3506 (Layout::Layout): Initialize new data members.
3507 (Layout::set_incremental_base): New function.
3508 (Layout::init_fixed_output_section): New function.
3509 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3510 incremental updates.
3511 (Layout::create_gold_note): Do not create gold note section for
3512 incremental updates.
3513 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3514 for incremental updates.
3515 (Layout::set_section_offsets): For incremental updates, allocate space
3516 from free list.
3517 (Layout::create_symtab_sections): Layout with offsets relative to
3518 start of section; for incremental updates, allocate space from free
3519 list.
3520 (Layout::create_shdrs): For incremental updates, allocate space from
3521 free list.
3522 (Layout::finish_dynamic_section): For incremental updates, do not
3523 check --as-needed (fixed in subsequent patch).
3524 * layout.h (class Free_list): New class.
3525 (Layout::set_incremental_base): New function.
3526 (Layout::incremental_base): New function.
3527 (Layout::init_fixed_output_section): New function.
3528 (Layout::allocate): New function.
3529 (Layout::incremental_base_): New data member.
3530 (Layout::free_list_): New data member.
3531 * main.cc (main): Print Free_list statistics.
3532 * object.cc (Relobj::finalize_incremental_relocs): Add
3533 clear_counts parameter; clear counts only when clear_counts is set.
3534 (Sized_relobj::Sized_relobj): Initialize new base class.
3535 (Sized_relobj::do_layout): Don't report special sections.
3536 (Sized_relobj::do_for_all_local_got_entries): New function.
3537 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3538 symtab_off to all symbol table offsets.
3539 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3540 * object.h (class Got_offset_list): Move to top of file.
3541 (Object::Object): Allow case where input_file == NULL.
3542 (Object::~Object): Likewise.
3543 (Object::input_file): Assert that input_file != NULL.
3544 (Object::lock): Allow case where input_file == NULL.
3545 (Object::unlock): Likewise.
3546 (Object::is_locked): Likewise.
3547 (Object::token): Likewise.
3548 (Object::release): Likewise.
3549 (Object::is_incremental): New function.
3550 (Object::get_mtime): New function.
3551 (Object::for_all_local_got_entries): New function.
3552 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3553 (Object::set_is_in_system_directory): New function.
3554 (Object::is_in_system_directory): New function.
3555 (Object::do_is_incremental): New function.
3556 (Object::do_get_mtime): New function.
3557 (Object::do_for_all_local_got_entries): New function.
3558 (Object::is_in_system_directory_): New data member.
3559 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3560 (class Sized_relobj_base): New class.
3561 (class Sized_relobj): Derive from Sized_relobj_base.
3562 (class Sized_relobj::Symbols): Redeclare from base class.
3563 (class Sized_relobj::local_got_offset_list): Remove.
3564 (class Sized_relobj::Output_sections): Redeclare from base class.
3565 (class Sized_relobj::do_for_all_local_got_entries): New function.
3566 (class Sized_relobj::write_local_symbols): Add offset parameter.
3567 (class Sized_relobj::local_symbol_offset_): Update comment.
3568 (class Sized_relobj::local_dynsym_offset_): Update comment.
3569 * options.cc (Input_arguments::add_file): Remove const.
3570 * options.h (Input_file_argument::Input_file_argument):
3571 Initialize arg_serial_ (all constructors).
3572 (Input_file_argument::set_arg_serial): New function.
3573 (Input_file_argument::arg_serial): New function.
3574 (Input_file_argument::arg_serial_): New data member.
3575 (Input_arguments::Input_arguments): Initialize file_count_.
3576 (Input_arguments::add_file): Remove const.
3577 (Input_arguments::number_of_input_files): New function.
3578 (Input_arguments::file_count_): New data member.
3579 (Command_line::number_of_input_files): Call
3580 Input_arguments::number_of_input_files.
3581 * output.cc (Output_segment_headers::Output_segment_headers):
3582 Set current size.
3583 (Output_section::Input_section::current_data_size): New function.
3584 (Output_section::Output_section): Initialize new data members.
3585 (Output_section::add_input_section): Don't do merge sections for
3586 an incremental link; allocate space from free list for an
3587 incremental update.
3588 (Output_section::add_output_section_data): Allocate space from
3589 free list for an incremental update.
3590 (Output_section::update_data_size): New function.
3591 (Output_section::set_fixed_layout): New function.
3592 (Output_section::reserve): New function.
3593 (Output_segment::set_section_addresses): Remove const.
3594 (Output_segment::set_section_list_addresses): Remove const; allocate
3595 space from free list for an incremental update.
3596 (Output_segment::set_offset): Adjust size of RELRO segment for an
3597 incremental update.
3598 * output.h (Output_data::current_data_size): Move here from
3599 child classes.
3600 (Output_data::pre_finalize_data_size): New function.
3601 (Output_data::update_data_size): New function.
3602 (Output_section_headers::update_data_size): new function.
3603 (Output_section_data_build::current_data_size): Move to Output_data.
3604 (Output_data_strtab::update_data_size): New function.
3605 (Output_section::current_data_size): Move to Output_data.
3606 (Output_section::set_fixed_layout): New function.
3607 (Output_section::has_fixed_layout): New function.
3608 (Output_section::reserve): New function.
3609 (Output_section::update_data_size): New function.
3610 (Output_section::has_fixed_layout_): New data member.
3611 (Output_section::free_list_): New data member.
3612 (Output_segment::set_section_addresses): Remove const.
3613 (Output_segment::set_section_list_addresses): Remove const.
3614 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3615 New function.
3616 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3617 New function.
3618 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3619 parameter when calling Add_symbols constructor; store argument
3620 serial number for members of a lib group.
3621 (Add_symbols::locks): Allow case where token == NULL.
3622 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3623 (Read_member::~Read_member): New function.
3624 (Read_member::is_runnable): New function.
3625 (Read_member::locks): New function.
3626 (Read_member::run): New function.
3627 (Check_script::~Check_script): New function.
3628 (Check_script::is_runnable): New function.
3629 (Check_script::locks): New function.
3630 (Check_script::run): New function.
3631 (Check_library::~Check_library): New function.
3632 (Check_library::is_runnable): New function.
3633 (Check_library::locks): New function.
3634 (Check_library::run): New function.
3635 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3636 (Add_symbols::library_): New data member.
3637 (class Read_member): New class.
3638 (class Check_script): New class.
3639 (class Check_library): New class.
3640 * reloc.cc (Read_relocs::is_runnable): Allow case where
3641 token == NULL.
3642 (Read_relocs::locks): Likewise.
3643 (Scan_relocs::locks): Likewise.
3644 (Relocate_task::locks): Likewise.
3645 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3646 to clear counters.
3647 (Sized_relobj::incremental_relocs_scan): Fix comment.
3648 (Sized_relobj::do_relocate): Pass output file offset to
3649 write_local_symbols.
3650 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3651 from class declaration.
3652 * script.cc (read_input_script): Allocate Script_info; pass
3653 argument serial number to report_script.
3654 * script.h (class Script_info): Move to incremental.h.
3655 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3656 * symtab.h (Symbol_table::add_from_incrobj): New function.
3657 (Symbol_table::set_file_offset): New function.
3658
b961d0d7
CC
36592011-04-05 Cary Coutant <ccoutant@google.com>
3660
3661 * incremental-dump.cc (dump_incremental_inputs): Change signature
3662 to take a Sized_incremental_binary; change caller. Use readers
3663 in Sized_incremental_binary.
3664 * incremental.cc
3665 (Sized_incremental_binary::find_incremental_inputs_sections):
3666 Rename do_find_incremental_inputs_sections to this.
3667 (Sized_incremental_binary::setup_readers): New function.
3668 (Sized_incremental_binary::do_check_inputs): Check
3669 has_incremental_info_ flag; move setup code to setup_readers;
3670 use input readers.
3671 (Sized_incremental_binary::do_file_is_unchanged): New function.
3672 (Sized_incremental_binary::do_get_input_reader): New function.
3673 * incremental.h (class Incremental_binary): Move to end of file.
3674 (Incremental_binary::file_is_unchanged): New function.
3675 (Incremental_binary::do_file_is_unchanged): New function.
3676 (Incremental_binary::Input_reader): New class.
3677 (Incremental_binary::get_input_reader): New function.
3678 (class Sized_incremental_binary): Move to end of file.
3679 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3680 input section reader classes.
3681 (Sized_incremental_binary::has_incremental_info): New function.
3682 (Sized_incremental_binary::inputs_reader): New function.
3683 (Sized_incremental_binary::symtab_reader): New function.
3684 (Sized_incremental_binary::relocs_reader): New function.
3685 (Sized_incremental_binary::got_plt_reader): New function.
3686 (Sized_incremental_binary::do_file_is_unchanged): New function.
3687 (Sized_incremental_binary::Sized_input_reader): New class.
3688 (Sized_incremental_binary::get_input_reader): New function.
3689 (Sized_incremental_binary::find_incremental_inputs_sections):
3690 Rename do_find_incremental_inputs_sections to this.
3691 (Sized_incremental_binary::setup_readers): New function.
3692 (Sized_incremental_binary::has_incremental_info_): New data member.
3693 (Sized_incremental_binary::inputs_reader_): New data member.
3694 (Sized_incremental_binary::symtab_reader_): New data member.
3695 (Sized_incremental_binary::relocs_reader_): New data member.
3696 (Sized_incremental_binary::got_plt_reader_): New data member.
3697 (Sized_incremental_binary::current_input_file_): New data member.
3698
a869183f
PP
36992011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3700
3701 PR gold/12640
3702 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3703 violation.
3704
37052011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
3706
3707 * archive.cc (Archive::include_member): Adjust call to report_object.
3708 (Add_archive_symbols::run): Add script_info to call to
3709 report_archive_begin.
3710 (Lib_group::include_member): Adjust call to report_object.
3711 (Add_lib_group_symbols::run): Adjust call to report_object.
3712 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3713 blocks. Add object count for script input files.
3714 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3715 script_info parameter; change all callers.
3716 (Incremental_inputs::report_object): Add script_info parameter;
3717 change all callers.
3718 (Incremental_inputs::report_script): Store backpointer to
3719 incremental info entry.
3720 (Output_section_incremental_inputs::set_final_data_size): Record
3721 additional information for scripts.
3722 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3723 * incremental.h (Incremental_script_entry::add_object): New function.
3724 (Incremental_script_entry::get_object_count): New function.
3725 (Incremental_script_entry::get_object): New function.
3726 (Incremental_script_entry::objects_): New data member; adjust
3727 constructor.
3728 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3729 (Incremental_inputs::report_object): Add script_info parameter.
3730 (Incremental_inputs_reader::get_object_count): New function.
3731 (Incremental_inputs_reader::get_object_offset): New function.
3732 * options.cc (Input_arguments::add_file): Return reference to
3733 new input argument.
3734 * options.h (Input_argument::set_script_info): New function.
3735 (Input_argument::script_info): New function.
3736 (Input_argument::script_info_): New data member; adjust all
3737 constructors.
3738 (Input_file_group::add_file): Return reference to new input argument.
3739 (Input_file_lib::add_file): Likewise.
3740 (Input_arguments::add_file): Likewise.
3741 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3742 * script.cc (Parser_closure::Parser_closure): Add script_info
3743 parameter; adjust all callers.
3744 (Parser_closure::script_info): New function.
3745 (Parser_closure::script_info_): New data member.
3746 (read_input_script): Report scripts earlier to incremental info.
3747 (script_add_file): Set script_info in Input_argument.
3748 (script_add_library): Likewise.
3749 * script.h (Script_options::Script_info): Rewrite class.
3750
a869183f 37512011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
3752
3753 * archive.cc (Library_base::should_include_member): Move
3754 method here from class Archive.
3755 (Archive::Archive): Initialize base class.
3756 (Archive::should_include_member): Move to base class.
3757 (Archive::do_for_all_unused_symbols): New function.
3758 (Add_archive_symbols::run): Remove redundant access to
3759 incremental_inputs.
3760 (Lib_group::Lib_group): Initialize base class.
3761 (Lib_group::do_filename): New function.
3762 (Lib_group::include_member): Pass pointer to Lib_group to
3763 report_object.
3764 (Lib_group::do_for_all_unused_symbols): New function.
3765 (Add_lib_group_symbols::run): Report archive information for
3766 incremental links.
3767 * archive.h (class Library_base): New base class.
3768 (class Archive): Derive from Library_base.
3769 (Archive::filename): Move to base class.
3770 (Archive::set_incremental_info): Likewise.
3771 (Archive::incremental_info): Likewise.
3772 (Archive::Should_include): Likewise.
3773 (Archive::should_include_member): Likewise.
3774 (Archive::Armap_entry): Remove.
3775 (Archive::Unused_symbol_iterator): Remove.
3776 (Archive::unused_symbols_begin): Remove.
3777 (Archive::unused_symbols_end): Remove.
3778 (Archive::do_filename): New function.
3779 (Archive::do_get_mtime): New function.
3780 (Archive::do_for_all_unused_symbols): New function.
3781 (Archive::task_): Move to base class.
3782 (Archive::incremental_info_): Likewise.
3783 (class Lib_group): Derive from Library_base.
3784 (Lib_group::do_filename): New function.
3785 (Lib_group::do_get_mtime): New function.
3786 (Lib_group::do_for_all_unused_symbols): New function.
3787 (Lib_group::task_): Move to base class.
3788 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3789 function.
3790 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3791 function.
3792 * incremental.cc (Incremental_inputs::report_archive_begin):
3793 Use Library_base; call library's get_mtime; add incremental inputs
3794 entry before members.
3795 (class Unused_symbol_visitor): New class.
3796 (Incremental_inputs::report_archive_end): Use Library_base; use
3797 visitor class to record unused symbols; don't add incremental inputs
3798 entry after members.
3799 (Incremental_inputs::report_object): Use Library_base.
3800 * incremental.h
3801 (Incremental_archive_entry::Incremental_archive_entry): Remove
3802 unused Archive parameter.
3803 (Incremental_inputs::report_archive_begin): Use Library_base.
3804 (Incremental_inputs::report_archive_end): Likewise.
3805 (Incremental_inputs::report_object): Likewise.
3806 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3807 function.
3808 * object.h (Object::for_all_global_symbols): New function.
3809 (Object::do_for_all_global_symbols): New function.
3810 (Sized_relobj::do_for_all_global_symbols): New function.
3811 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3812 function.
3813 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3814 function.
3815
61ab3e40
ILT
38162011-03-27 Ian Lance Taylor <iant@google.com>
3817
3818 * archive.cc (Archive::interpret_header): Return -1 if something
3819 goes wrong. Change callers accordingly.
3820
30e1f9e6
CC
38212011-03-25 Cary Coutant <ccoutant@google.com>
3822
3823 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3824 * testsuite/Makefile.in: Regenerate.
3825
9370ce59 38262011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
9c793f14
RÁE
3827
3828 * plugin.cc (get_view): New.
3829 (Plugin::load): Pass get_view to the plugin.
3830 (Plugin_manager::get_view): New.
3831
9312bb0a
ILT
38322011-03-21 Ian Lance Taylor <iant@google.com>
3833
3834 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 3835 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 3836
7e12ba9e
ST
38372011-03-21 Sriraman Tallam <tmsriram@google.com>
3838
3839 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3840 Change == to -eq.
3841 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3842 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3843 Change == to -eq.
3844 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3845 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3846
fd7a005d
ILT
38472011-03-14 Ian Lance Taylor <iant@google.com>
3848
3849 * script-sections.cc (Sort_output_sections::script_compare):
3850 Rename from is_before, change return type.
3851 (Sort_output_sections::operator()): Adjust accordingly.
3852
ed16fd1b
ILT
38532011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3854
3855 PR gold/12572
3856 * testsuite/odr_violation2.cc: Add comment to make all error line
3857 numbers double digits.
3858 * testsuite/debug_msg.sh: Adjust expected errors.
3859
71ff8986
ILT
38602011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3861
3862 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3863 but mark earlier ones as non-canonical
3864 (offset_to_iterator): Update search target and example
3865 (do_addr2line): Return extra lines in a vector*
3866 (format_file_lineno): Extract from do_addr2line
3867 (one_addr2line): Add vector* out-param
3868 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3869 when a lineno entry appeared last for its instruction
3870 (Dwarf_line_info): Add vector* out-param
3871 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3872 * symtab.cc (Odr_violation_compare): Include the lineno in the
3873 comparison again.
3874 (linenos_from_loc): New. Combine the canonical line for an
3875 address with its other lines.
3876 (True_if_intersect): New. Helper functor to make
3877 std::set_intersection a query.
3878 (detect_odr_violations): Compare sets of lines instead of just
3879 one line for each function. This became less deterministic, but
3880 has fewer false positives.
3881 * symtab.h: Declarations.
3882 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3883 mix an optimized and non-optimized object in the same binary
3884 (odr_violation2.so): Same.
3885 * testsuite/Makefile.in: Regenerate from Makefile.am.
3886 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3887 * testsuite/debug_msg.sh: Update line numbers and add
3888 assertions.
3889 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3890 non-optimized context.
3891 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3892 isn't inlined, and use OdrDerived in an optimized context.
3893 * testsuite/odr_header1.h: Defines OdrDerived, where
3894 optimization will change the
3895 first-instruction-in-the-destructor's file and line number.
3896 * testsuite/odr_header2.h: Defines OdrBase.
3897
a19fefdc
ILT
38982011-03-09 Ian Lance Taylor <iant@google.com>
3899
3900 * fileread.cc (File_read::clear_views): Don't delete the whole
3901 file view.
3902
ecb351e9
ILT
39032011-03-08 Ian Lance Taylor <iant@google.com>
3904
3905 PR gold/12525
3906 * fileread.cc: #include <climits>.
3907 (GOLD_IOV_MAX): Define.
3908 (File_read::read_multiple): Limit number of entries by iov_max.
3909 * fileread.h (class File_read): Always set max_readv_entries to
3910 128.
3911
b821d13c
ILT
39122011-03-07 Ian Lance Taylor <iant@google.com>
3913
3914 PR gold/12525
3915 * options.h (class General_options): Add -dy and -dn.
3916
89243142
CC
39172011-03-02 Cary Coutant <ccoutant@google.com>
3918
3919 * testsuite/script_test_9.t: Add TLS segment.
3920
d0773f31
ILT
39212011-03-02 Simon Baldwin <simonb@google.com>
3922
3923 * configure.ac: Add check for gnu_indirect_function support in
3924 the toolchain building binutils.
3925 * configure: Rebuild.
3926
9370ce59 39272011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
badc8139
RÁE
3928
3929 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3930 plugin only symbols.
3931 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3932 in plugin files as not needed in the symbol table.
3933
4cf7a849
ST
39342011-02-11 Sriraman Tallam <tmsriram@google.com>
3935
3936 * output.cc (Output_section::add_input_section): Delay fill
3937 generation for section ordering.
3938
b578bd7d
ILT
39392011-02-09 Ian Lance Taylor <iant@google.com>
3940
3941 PR gold/12316
3942 * object.h (class Sized_relobj): Remove clear_local_symbols.
3943 * reloc.cc (Sized_relobj::do_relocate): Don't call
3944 clear_local_symbols.
3945
9370ce59 39462011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
84ced98a
RÁE
3947
3948 * plugin.cc (is_visible_from_outside): Return true for symbols
3949 in the -u option.
3950
55382fb7
ILT
39512011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3952
3953 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3954 filename.
3955
4e271fff
ST
39562011-02-02 Sriraman Tallam <tmsriram@google.com>
3957
3958 * icf.h (is_section_foldable_candidate): Change type of parameter
2e702c99 3959 to std::string.
4e271fff 3960 * icf.cc (Icf::find_identical_sections): Change type of local variable
2e702c99 3961 section_name to be std::string.
4e271fff
ST
3962 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3963
d433c3ac
ILT
39642011-01-25 Ian Lance Taylor <iant@google.com>
3965
3966 * script.cc (script_add_extern): Rewrite to use
3967 add_symbol_reference.
3968
880473a6
DK
39692011-01-25 Doug Kwan <dougkwan@google.com>
3970
d433c3ac 3971 * icf.cc (get_section_contents): Always lock section's object.
880473a6 3972
f30f86fa
ILT
39732011-01-24 Ian Lance Taylor <iant@google.com>
3974
3975 * options.h (class General_options): Accept
3976 --no-detect-odr-violations.
3977
8e51a0b9
ILT
39782011-01-24 Ian Lance Taylor <iant@google.com>
3979
3980 * version.cc (version_string): Bump to 1.11.
3981
0f3b89d8
ILT
39822011-01-24 Ian Lance Taylor <iant@google.com>
3983
3984 * plugin.cc (class Plugin_rescan): Define new class.
3985 (Plugin_manager::claim_file): Set any_claimed_.
3986 (Plugin_manager::save_archive): New function.
3987 (Plugin_manager::save_input_group): New function.
3988 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3989 necessary.
3990 (Plugin_manager::new_undefined_symbol): New function.
3991 (Plugin_manager::rescan): New function.
3992 (Plugin_manager::rescannable_defines): New function.
3993 (Plugin_manager::add_input_file): Set any_added_.
3994 * plugin.h (class Plugin_manager): define new fields rescannable_,
3995 undefined_symbols_, any_claimed_, and any_added_. Declare
3996 Plugin_rescan as friend. Declare new functions.
3997 (Plugin_manager::Rescannable): Define type.
3998 (Plugin_manager::Rescannable_list): Define type.
3999 (Plugin_manager::Undefined_symbol_list): Define type.
4000 (Plugin_manager::Plugin_manager): Initialize new fields.
4001 * archive.cc (Archive::defines_symbol): New function.
4002 (Add_archive_symbols::run): Pass archive to plugins if any.
4003 * archive.h (class Archive): Declare defines_symbol.
4004 * readsyms.cc (Input_group::~Input_group): New function.
4005 (Finish_group::run): Pass input_group to plugins if any.
4006 * readsyms.h (class Input_group): Declare destructor.
4007 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4008 any.
4009
3bb951e5
ILT
40102011-01-10 Ian Lance Taylor <iant@google.com>
4011
4012 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4013 section as relro.
4014 (Layout::set_segment_offsets): Reset increase_relro before calling
4015 set_section_addresses a second time.
4016
0aa45fac
CC
40172011-01-04 Cary Coutant <ccoutant@google.com>
4018
4019 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4020 sections before NOBITS sections.
4021
0db46eb4
L
40222011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4023
4024 * version.cc (print_version): Update copyright to 2011.
4025
829c9745
CC
40262010-12-23 Cary Coutant <ccoutant@google.com>
4027
4028 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4029 of OS to this->add. Add OD parameter to second form of the function.
4030
7500420b
ILT
40312010-12-20 Ian Lance Taylor <iant@google.com>
4032
4033 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4034 second of two consecutive entries with same offset.
4035
f8e9a930
RW
40362010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4037
4038 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4039 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4040 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4041 to avoid unneeded links against $(LDADD).
4042 * testsuite/Makefile.in: Regenerate.
4043
2fbb4320
ILT
40442010-12-15 Ian Lance Taylor <iant@google.com>
4045
4046 PR gold/12324
4047 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4048 for R_X86_64_32 and R_X86_64_PC32.
4049 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4050 ver_matching_def_pic.o.
4051 (ver_matching_def_pic.o): New target.
4052
fedb228d
RW
40532010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4054
4055 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4056 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4057 Move definition before File_read::View member definitions.
4058 (File_read::View::~View): Initialize and hold lock before
4059 updating current_mapped_bytes.
4060
9b547ce6
RW
40612010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4062
4063 * dwarf_reader.cc: Remove outdated comment.
4064 * gold-threads.cc: Fix typo in error message.
4065 * archive.cc: Fix typos in comments.
4066 * archive.h: Likewise.
4067 * arm-reloc-property.cc: Likewise.
4068 * arm-reloc-property.h: Likewise.
4069 * arm-reloc.def: Likewise.
4070 * arm.cc: Likewise.
4071 * attributes.h: Likewise.
4072 * cref.cc: Likewise.
4073 * ehframe.cc: Likewise.
4074 * fileread.h: Likewise.
4075 * gold.h: Likewise.
4076 * i386.cc: Likewise.
4077 * icf.cc: Likewise.
4078 * incremental.h: Likewise.
4079 * int_encoding.cc: Likewise.
4080 * layout.h: Likewise.
4081 * main.cc: Likewise.
4082 * merge.h: Likewise.
4083 * object.cc: Likewise.
4084 * object.h: Likewise.
4085 * options.cc: Likewise.
4086 * readsyms.cc: Likewise.
4087 * reduced_debug_output.cc: Likewise.
4088 * reloc.cc: Likewise.
4089 * script-sections.cc: Likewise.
4090 * sparc.cc: Likewise.
4091 * symtab.h: Likewise.
4092 * target-reloc.h: Likewise.
4093 * target.cc: Likewise.
4094 * target.h: Likewise.
4095 * timer.cc: Likewise.
4096 * timer.h: Likewise.
4097 * x86_64.cc: Likewise.
4098
83e17bd5
CC
40992010-12-09 Cary Coutant <ccoutant@google.com>
4100
4101 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4102 stack.
4103 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4104 parameter; change all callers.
4105 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4106 * options.h (warn_execstack): New option.
4107
017257f8
DK
41082010-12-07 Doug Kwan <dougkwan@google.com>
4109
4110 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4111 like function call relocations.
4112
c20cbc06
ILT
41132010-12-07 Ian Lance Taylor <iant@google.com>
4114
4115 * archive.cc (Archive::get_elf_object_for_member): Permit
4116 punconfigured to be NULL.
4117 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4118 (Archive::include_member): Pass NULL to get_elf_object_for_member
4119 if we searched for the archive and this is the first included
4120 object.
4121
4dbfafcc
ILT
41222010-12-01 Ian Lance Taylor <iant@google.com>
4123
4124 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4125 track_relocs_type_ field.
4126 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4127 Set track_relocs_type_.
4128 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4129 contents when using RELA relocs.
4130 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4131 reloc_map_.
4132 * reloc.cc (Track_relocs::next_addend): New function.
4133 * reloc.h (class Track_relocs): Declare next_addend.
4134
e5e19edd
ILT
41352010-12-01 Ian Lance Taylor <iant@google.com>
4136
4137 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4138 virtual destructor.
4139
9a5ce24c
ILT
41402010-12-01 Ian Lance Taylor <iant@google.com>
4141
4142 * README: Update compilers known to work and fail.
4143
c7791212
NC
41442010-11-23 Matthias Klose <doko@ubuntu.com>
4145
4146 * configure.in: For --enable-gold, handle value `default' instead of
4147 `both*'. Always install ld as ld.bfd, install as ld if gold is
4148 not the default.
4149 * configure: Regenerate.
4150
0ad220c9
DK
41512010-11-18 Doug Kwan <dougkwan@google.com>
4152
4153 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4154 and right_alignment to be zero. Store result alignment only if it is
4155 greater than existing alignment.
4156
ab8056e0
CC
41572010-11-16 Cary Coutant <ccoutant@google.com>
4158
4159 PR gold/12220
4160 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4161 Check for ".zdebug_line".
4162
fd064a5b
CC
41632010-11-16 Doug Kwan <dougkwan@google.com>
4164 Cary Coutant <ccoutant@google.com>
4165
4166 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4167 by reference; adjust all callers.
4168 * output.cc (Output_segment::set_section_addresses): Adjust references
4169 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4170 list is empty.
4171 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4172 end at page boundary.
4173
6fc6ea19
CC
41742010-11-16 Cary Coutant <ccoutant@google.com>
4175
4176 PR gold/12220
4177 * layout.cc (Layout::choose_output_section): Transform names of
4178 compressed sections even when using a script with a SECTIONS clause.
4179 (Layout::output_section_name): Remove code to transform
4180 compressed debug section names.
4181 * output.cc (Output_section::add_input_section): Use uncompressed
4182 section size when tracking input sections.
4183
95a2c8d6
RS
41842010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4185
4186 * symtab.h (Symbol::NON_PIC_REF): Remove.
4187 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4188 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4189 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4190 (Symbol::use_plt_offset): Take a flags argument and pass it
4191 directly to needs_dynamic_reloc. Restrict check for undefined
4192 weak symbols to function calls.
4193 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4194 (Target_arm::Scan::global): Use it.
4195 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4196 (Target_arm::Relocate::relocate): Likewise.
4197 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4198 parameter with an r_type parameter. Use get_reference_flags
4199 to get the flags.
4200 (Target_arm::Relocate::relocate): Update accordingly.
4201 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4202 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4203 (Target_i386::Scan::global): Likewise.
4204 (Target_i386::Relocate::relocate): Likewise.
4205 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4206 parameter with an r_type parameter. Use get_reference_flags
4207 to get the flags.
4208 (Target_i386::Relocate::relocate): Update accordingly.
4209 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4210 (Target_powerpc::Scan::global): Use it.
4211 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4212 (Target_powerpc::Relocate::relocate): Likewise.
4213 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4214 (Target_sparc::Scan::global): Use it.
4215 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4216 (Target_sparc::Relocate::relocate): Likewise.
4217 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4218 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4219 (Target_x86_64::Scan::global): Likewise.
4220 (Target_x86_64::Relocate::relocate): Likewise.
4221
f625ae50
DK
42222010-11-08 Doug Kwan <dougkwan@google.com>
4223 Cary Coutant <ccoutant@google.com>
4224
4225 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4226 (Arm_exidx_merge_section::section_contents_): New data member.
4227 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4228 (Arm_input_section::~Arm_input_section): De-allocate memory.
58797674 4229 (Arm_input_section::original_contents_): New data member.
f625ae50
DK
4230 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4231 in parameters instead of calling Object::section_contents without
4232 locking.
4233 (Arm_output_section::group_section): New parameter TASK. Pass it
4234 to callees that need locking objects.
4235 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4236 to lock EXIDX input sections. Fix a formatting issue. Call
4237 Arm_exidx_merged_section::build_contents to create merged section
4238 contents.
4239 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4240 to lock object of stub table owner.
4241 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4242 TEXT_SIZE to initialize data member TEXT_SIZE_.
4243 (Arm_exidx_input_section::addralign): Fix typo in comment.
4244 (Arm_exidx_input_section::text_size): New method.
4245 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4246 that require locking objects. Lock objects before scanning for stubs
4247 and updating local symbols.
4248 (Arm_input_section<big_endian>::init): Copy contents of original
4249 input section.
2e702c99 4250 (Arm_input_section<big_endian>::do_write): Use saved contents of
f625ae50
DK
4251 original input section instead of calling Object::section_contents
4252 without locking.
4253 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4254 size without calling Object::section_size().
4255 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4256 for size. Allocate a buffer for merged EXIDX entries.
4257 (Arm_exidx_merged_section::build_contents): New method.
2e702c99 4258 (Arm_exidx_merged_section::do_write): Move merge section contents
f625ae50
DK
4259 building code to Arm_exidx_merged_section::build_contetns. Write
4260 out contetns in buffer instead of building it on the fly.
4261 (Arm_relobj::make_exidx_input_section): Also pass text section size
4262 to Arm_exidx_input_section constructor.
4263 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4264 (Arm_dynobj::do_read_symbols): Fix memory leak.
4265 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4266 * target.h: (class Task): Add forward declaration.
4267 (Target::relax): Add new parameter TASK and pass it to
4268 Target::do_relax().
4269 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4270
5f9bcf58
CC
42712010-11-05 Cary Coutant <ccoutant@google.com>
4272
4273 PR gold/10708
4274 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4275 object when reading from the file.
4276 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4277 second layout pass.
4278 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4279 when reading section contents.
4280 (get_section_contents): Likewise.
4281 (icf::find_identical_sections): Likewise.
4282 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4283 object when reading from the file.
4284 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4285 the object when doing deferred section layout.
4286
e597fa08
NC
42872010-11-03 Nick Clifton <nickc@redhat.com>
4288
4289 PR gold/12001
4290 * script.h (class Symbol_assignment: name): New member. Returns
4291 the name of the symbol.
4292 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4293 Returns true if the given symbol name is on the list of
4294 assignments wating to be processed.
4295 * archive.cc (should_incldue_member): If the symbol is undefined,
4296 check to see if it is on the list of symbols pending assignment.
4297
3f9a3278
ILT
42982010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4299
4300 * script-sections.cc (Script_sections::find_memory_region): Check
4301 for a NULL output section pointer.
4302
d06fb4d1
DK
43032010-10-29 Doug Kwan <dougkwan@google.com>
4304
4305 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4306 Output_section::add_relaxed_input_section.
4307 * output.cc (Output_section::add_relaxed_input_section): Add new
4308 arguments LAYOUT and NAME. Set section order index.
4309 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4310 Copy section order index.
4311 * output.h (Output_section::add_relaxed_input_section): Add new
4312 arguments LAYOUT and NAME.
4313
90e24de5
ILT
43142010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4315
4316 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2e702c99 4317 NATIVE_OR_CROSS_LINKER.
90e24de5
ILT
4318 * testsuite/Makefile.in: Regenerate.
4319
c9484ea5
DK
43202010-10-20 Doug Kwan <dougkwan@google.com>
4321
4322 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4323 without SHF_LINK_ORDER flags.
4324 * layout.cc (Layout::choose_output_section): Do not filter
4325 SHF_LINK_ORDER flag in a relocatable link.
4326
5bc2f5be
CC
43272010-10-17 Cary Coutant <ccoutant@google.com>
4328
4329 * output.h (Output_segment::set_section_addresses): Change function
4330 signature. Update all callers.
4331 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4332 sections.
4333 (Output_segment::set_section_addresses): Align after last TLS
4334 section. Add padding before last relro section instead of after.
4335
0c91cf04
DK
43362010-10-17 Doug Kwan <dougkwan@google.com>
4337
4338 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4339 GOT output section to be writable.
4340
8c21d9d3
CC
43412010-10-14 Cary Coutant <ccoutant@google.com>
4342
4343 * debug.h (DEBUG_INCREMENTAL): New flag.
2e702c99
RM
4344 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4345 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4346 mode.
4347 * incremental.cc (report_command_line): Ignore all forms of
4348 --incremental.
4349 * layout.cc (Layout::Layout): Check parameters for incremental link
4350 mode.
4351 * options.cc (General_options::parse_incremental): New function.
4352 (General_options::parse_no_incremental): New function.
4353 (General_options::parse_incremental_full): New function.
4354 (General_options::parse_incremental_update): New function.
4355 (General_options::incremental_mode_): New data member.
4356 (General_options::finalize): Check incremental_mode_.
4357 * options.h (General_options): Update help text for --incremental.
4358 Add --no-incremental, --incremental-full, --incremental-update.
4359 (General_options::Incremental_mode): New enum type.
4360 (General_options::incremental_mode): New function.
4361 (General_options::incremental_mode_): New data member.
4362 * parameters.cc (Parameters::incremental_mode_): New data member.
4363 (Parameters::set_options): Set incremental_mode_.
4364 (Parameters::set_incremental_full): New function.
4365 (Parameters::incremental): New function.
4366 (Parameters::incremental_update): New function.
4367 (set_parameters_incremental_full): New function.
4368 * parameters.h (Parameters::set_incremental_full): New function.
4369 (Parameters::incremental): New function.
4370 (Parameters::incremental_update): New function.
4371 (Parameters::incremental_mode_): New data member.
4372 (set_parameters_incremental_full): New function.
4373 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4374 incremental link mode.
4375 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4376 (Sized_relobj::do_relocate_sections): Likewise.
4377 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4378 option.
4379 * testsuite/Makefile.in: Regenerate.
4380 * testsuite/incremental_test.sh: Filter all forms of --incremental.
8c21d9d3 4381
bb32aa18 43822010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
4383
4384 * script-sections.h (class Script_sections): Make
4385 Sections_elements typedef public.
4386 * script-sections.cc (class Sort_output_sections): Add elements_
4387 field. Add constructor which sets it; change all callers.
4388 (Sort_output_sections::is_before): New function.
4389 (Sort_output_sections::operator()): Call is_before.
4390 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4391 conditional.
4392 * testsuite/script_test_10.sh: New test. Test script section
4393 order.
4394 * testsuite/script_test_10.t: Likewise.
4395 * testsuite/script_test_10.s: Likewise.
4396 * testsuite/Makefile.am: Wrap the cross linker tests and the
4397 common tests into NATIVE_OR_CROSS_LINKER.
4398 (check_SCRIPTS): Add script_test_10.sh.
4399 (check_DATA): Add script_test_10.stdout.
4400 (script_test_10.o, script_test_10): New targets.
4401 (script_test_10.stdout): New target.
4402 * configure, testsuite/Makefile.in: Regenerate.
4403
3cef7179
ILT
44042010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4405
4406 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4407 error for the deprecated relocations.
4408 (Target_arm::Scan::global): Likewise.
4409 (Target_arm::Relocate::relocate): Likewise.
4410
7411e9a8
RS
44112010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4412
4413 * fileread.cc (Input_file::find_file): Initialize *found_name
4414 and *namep when using the fallback search for case 4.
4415
6a9da32a
CC
44162010-10-11 Cary Coutant <ccoutant@google.com>
4417
4418 * options.h (class General_options): Redefine -z lazy as an alias for
4419 the negation of -z now.
4420
ac897c20
ILT
44212010-10-11 Ian Lance Taylor <iant@google.com>
4422
4423 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4424 binding.
4425
ea5cae92
NC
44262010-10-06 Nick Clifton <nickc@redhat.com>
4427
4428 * script-sections.cc(class Memory_region): Remove
4429 current_lma_offset_ field. Rename current_vma_offset_ to
4430 current_offset_. Add last_section_ field.
4431 (Memory_region::get_current_vma_address): Rename to
4432 get_current_address.
4433 (Memory_region::get_current_lma_address): Delete.
4434 (Memory_region::increment_vma_offset): Rename to
4435 increment_offset.
4436 (Memory_region::increment_lma_offset): Delete.
4437 (Memory_region::attributes_compatible): New method. Returns
4438 true if the provided section is compatible with the region.
4439 (Memory_region::get_last_section): New method. Returns the last
4440 section to use the region.
4441 (Memory_region::set_last_section): New method. Stores the last
4442 section to use the region.
4443 (Script_sections::block_in_region): New method. Returns true if
4444 a block of memory is contained within a region.
4445 (Script_sections::find_memory_region): New method. Locates a
4446 memory region to be used to set a VMA or LMA address.
4447 (Output_section_definition::set_section_addresses): Add code to
4448 check for addresses set by memory regions.
4449 (Output_segment::set_section_addresses): Remove memory region
4450 walking code.
4451 (Script_sections::create_segment): Add a warning if a header
4452 segment is created outside of any region.
4453 * script-sections.h (class Script_sections): Add prototypes for
4454 find_memory_region and block_in_region methods.
4455 * testsuite/memory_test.s: Use .long instead of .word.
4456 * testsuite/memory_test.t: Add some more output sections.
4457 * testsuite/memory_test.sh: Update expected output.
4458
a9bfd952
DK
44592010-10-02 Doug Kwan <dougkwan@google.com>
4460
4461 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4462 defintion to symtab.h
4463 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4464 declaration to defintion.
4465
bacff3ab
NC
44662010-10-01 Nick Clifton <nickc@redhat.com>
4467
4468 * expression.cc (eval): Replace dummy argument with NULL.
4469 (eval_maybe_dot): Check for a NULL result section pointer.
4470 (Symbol_expression::value): Likewise.
4471 (Dot_expression::value): Likewise.
4472 (BINARY_EXPRESSION): Likewise.
4473 (Max_expression::value): Likewise.
4474 (Min_expression::value): Likewise.
4475 (Absolute_expression::value): Likewise.
4476 (Addr_expression::value_from_output_section): Likewise.
4477 (Loaddddr_expression::value_from_output_section): Likewise.
4478 (Segment_start_expression::value): Likewise.
4479 * script-sections.cc
4480 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4481 argument with NULL.
4482 (Sections_elememt_dot_assignment::set_section_addresses):
4483 Likewise.
4484 (Output_data_expression::do_write_to_buffer): Likewise.
4485 (Output_section_definition::finalize_symbols): Likewise.
4486 (Output_section_definition::set_section_addresses): Likewise.
4487
f81bc8b5
DK
44882010-09-30 Doug Kwan <dougkwan@google.com>
4489
4490 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4491
c95e9f27
ST
44922010-09-28 Sriraman Tallam <tmsriram@google.com>
4493
4494 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 4495 function.
c95e9f27
ST
4496 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4497 virtual function.
4498 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4499 virtual function.
4500 * icf.cc (get_section_contents): Inline merge sections only when
4501 target allows it.
4502
3cac54d2
RW
45032010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4504
4505 * configure: Regenerate.
4506
2904037a
ILT
45072010-09-17 Ian Lance Taylor <iant@google.com>
4508
4509 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
4510 * testsuite/Makefile.am (memory_test.o): New target.
4511 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4512 memory_test.t.
4513 * testsuite/Makefile.in: Rebuild.
2904037a 4514
bca7fb63
DK
45152010-09-17 Doug Kwan <dougkwan@google.com>
4516
4517 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4518 defintion if relocation uses GOT entries of the symbol.
4519 * testsuite/icf_safe_test.sh: Fix test.
4520 * testsuite/icf_safe_so_test.sh: Fix test.
4521
4ef28648
CC
45222010-09-16 Cary Coutant <ccoutant@google.com>
4523
4524 * script_sections.cc (class Memory_region): Remove "NULL" from
4525 vector initializations.
4526
793990de
CC
45272010-09-15 Cary Coutant <ccoutant@google.com>
4528
4529 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4530 Resolve forwarding symbols.
4531
81e015e2
DK
45322010-09-15 Doug Kwan <dougkwan@google.com>
4533
4534 * gold/testsuite/script_test_3.t: Add ARM special sections.
4535 * gold/testsuite/script_test_4.t: Same.
4536 * gold/testsuite/script_test_5.t: Same.
4537 * gold/testsuite/script_test_6.t: Same.
4538 * gold/testsuite/script_test_7.t: Same.
4539 * gold/testsuite/script_test_7.t: Same.
4540 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4541
36171d64
CC
45422010-09-14 Cary Coutant <ccoutant@google.com>
4543
4544 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4545 (Target_x86_64::Relocate::relocate_tls): Replace check for
4546 saw_tls_block_reloc_ with test for executable section.
4547
d89051bd
CC
45482010-09-12 Cary Coutant <ccoutant@google.com>
4549
4550 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4551 position-independent executables to shared libraries need dynamic
4552 relocations.
4553 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4554 position-independent executables.
4555 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4556 * testsuite/Makefile.in: Regenerate.
4557
fca41f0f
NC
45582010-09-10 Nick Clifton <nickc@redhat.com>
4559
4560 PR gold/11997
4561 * testsuite/memory_test.t: Discard any sections that are not
4562 needed.
4563
6695e4b3
L
45642010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4565
4566 PR gold/11996
4567 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4568 "This::" to work around a bug in gcc 4.2.
4569
4570 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4571
0f72bf6f
RÁE
45722010-09-09 Rafael Espindola <espindola@google.com>
4573
4574 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4575 sections with different PF_X flags in the same segment.
4576 (Layout::find_first_load_seg): Search all segments to find the first
4577 one.
4578 * options.h (rosegment): New.
4579
45802010-09-08 Rafael Espindola <espindola@google.com>
a6577478 4581
05a79166 4582 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 4583
aa98ff75
DK
45842010-09-08 Doug Kwan <dougkwan@google.com>
4585
4586 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4587 (Arm_relobj::do_relocate_sections): Add new parameter for output
4588 file to match the parent.
4589 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4590 of local symbols instead of input values. Update code to track
4591 changes in gold::relocate_section.
4592 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4593 (Sized_relobj::compute_final_local_value_internal): New methods.
4594 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4595 body into private version of Sized_relobj::compute_final_local_value.
4596 Call the inline method.
4597 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4598 merged symbol value if there is one.
4599 (Symbol_value::has_output_value): New method defintiion.
4600 (Sized_relobj::Compute_final_local_value_status): New enum type.
4601 (Sized_relobj::compute_final_local_value): New methods.
4602 (Sized_relobj::compute_final_local_value_internal): New methods.
4603 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4604 and arm_cortex_a8.sh.
4605 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4606 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4607 New tests.
4608 * Makefile.in: Regenerate.
4609 * testsuite/arm_bl_out_of_range.s: Update test.
4610 * testsuite/thumb_bl_out_of_range.s: Ditto.
4611 * testsuite/thumb_blx_out_of_range.s: Ditto.
4612 * testsuite/arm_branch_out_of_range.sh: New file.
4613 * testsuite/arm_cortex_a8.sh: Ditto.
4614 * testsuite/arm_cortex_a8_b.s: Ditto.
4615 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4616 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4617 * testsuite/arm_cortex_a8_bl.s: Ditto.
4618 * testsuite/arm_cortex_a8_blx.s: Ditto.
4619 * testsuite/arm_cortex_a8_local.s: Ditto.
4620 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4621 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4622
05a79166
L
46232010-09-08 Rafael Espindola <espindola@google.com>
4624
4625 * Makefile.am (memory_test.stdout): Run readelf with -W.
4626 * Makefile.in: Regenerate.
4627 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4628 64 bit output.
4629
33dbc701
RÁE
46302010-09-08 Rafael Espindola <espindola@google.com>
4631
4632 * script-sections.cc (Script_sections::add_memory_region): Convert
4633 field precision to int.
4634 * script.cc (script_set_section_region, script_set_section_region):
4635 Convert field precision to int.
4636
731ca54a
RÁE
46372010-09-08 Rafael Espindola <espindola@google.com>
4638
4639 * arm.cc (do_finalize_sections): Create the __exidx_start and
4640 __exdix_end symbols even when the section is missing.
4641
7f8cd844
NC
46422010-09-08 Nick Clifton <nickc@redhat.com>
4643
4644 * README: Remove claim that MEMORY is not supported.
4645 * expression.cc (script_exp_function_origin)
4646 (script_exp_function_length): Move from here to ...
4647 * script.cc: ... here.
4648 (script_set_section_region, script_add_memory)
4649 (script_parse_memory_attr, script_include_directive): New
4650 functions.
4651 * script-sections.cc
4652 (class Memory_region): New class.
4653 (class Output_section_definition): Add set_memory_region,
4654 set_section_vma, set_section_lma and get_section_name methods.
4655 (class Script_Sections): Add add_memory_region,
4656 find_memory_region, find_memory_region_origin,
4657 find_memory_region_length and set_memory_region methods.
4658 Have set_section_addresses method walk the list of set memory
4659 regions.
4660 Extend the print methos to display memory regions.
4661 * script-sections.h: Add prototypes for new methods.
4662 Add enum for MEMORY region attributes.
4663 * yyscript.y: Add support for parsing MEMORY regions.
4664 * script-c.h: Add prototypes for new functions.
4665 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4666 * testsuite/Makefile.in: Regenerate.
4667 * testsuite/memory_test.sh: New script.
4668 * testsuite/memory_test.s: New assembler source file.
4669 * testsuite/memory_test.t: New linker script.
4670
a4649286
DK
46712010-08-27 Doug Kwan <dougkwan@google.com>
4672
4673 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4674 reference override an existing dynamic weak reference.
4675 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4676 * testsuite/Makefile.in: Regenerate.
4677 * testsuite/dyn_weak_ref.sh: New file.
4678 * testsuite/dyn_weak_ref_1.c: Ditto.
4679 * testsuite/dyn_weak_ref_2.c: Ditto.
4680
b56648ad
ILT
46812010-08-27 Ian Lance Taylor <iant@google.com>
4682
4683 * incremental.h (class Incremental_input_entry): Add virtual
4684 destructor.
4685
809313cb
ILT
46862010-08-27 Ian Lance Taylor <iant@google.com>
4687
4688 * testsuite/start_lib_test_3.c: Mark t3 as used.
4689
11e32464
NC
46902010-08-27 Nick Clifton <nickc@redhat.com>
4691
4692 * options.cc (version_script): Fix small typo in previous
4693 whitespace tidyup.
4694
ca09d69a
NC
46952010-08-25 Nick Clifton <nickc@redhat.com>
4696
4697 * archive.cc: Formatting fixes: Remove whitespace between
4698 typename and following asterisk. Remove whitespace between
4699 function name and opening parenthesis.
4700 * archive.h: Likewise.
4701 * arm.cc: Likewise.
4702 * attributes.cc: Likewise.
4703 * attributes.h: Likewise.
4704 * common.cc: Likewise.
4705 * copy-relocs.cc: Likewise.
4706 * dirsearch.h: Likewise.
4707 * dynobj.cc: Likewise.
4708 * ehframe.cc: Likewise.
4709 * ehframe.h: Likewise.
4710 * expression.cc: Likewise.
4711 * fileread.cc: Likewise.
4712 * fileread.h: Likewise.
4713 * gc.h: Likewise.
4714 * gold-threads.cc: Likewise.
4715 * gold.cc: Likewise.
4716 * i386.cc: Likewise.
4717 * icf.h: Likewise.
4718 * incremental-dump.cc: Likewise.
4719 * incremental.cc: Likewise.
4720 * layout.cc: Likewise.
4721 * layout.h: Likewise.
4722 * main.cc: Likewise.
4723 * merge.cc: Likewise.
4724 * merge.h: Likewise.
4725 * object.cc: Likewise.
4726 * object.h: Likewise.
4727 * options.cc: Likewise.
4728 * options.h: Likewise.
4729 * output.cc: Likewise.
4730 * output.h: Likewise.
4731 * plugin.cc: Likewise.
4732 * plugin.h: Likewise.
4733 * powerpc.cc: Likewise.
4734 * reloc.cc: Likewise.
4735 * script-c.h: Likewise.
4736 * script-sections.cc: Likewise.
4737 * script.cc: Likewise.
4738 * stringpool.cc: Likewise.
4739 * symtab.cc: Likewise.
4740 * symtab.h: Likewise.
4741 * target.cc: Likewise.
4742 * timer.cc: Likewise.
4743 * timer.h: Likewise.
4744 * version.cc: Likewise.
4745 * x86_64.cc: Likewise.
4746
b8fa8750
NC
47472010-08-24 Nick Clifton <nickc@redhat.com>
4748
4749 PR 11899
4750 * layout.cc (segment_precedes): Sort segments by their physical
4751 addresses, if they have been set.
4752
9919d93b
CC
47532010-08-23 Cary Coutant <ccoutant@google.com>
4754
4755 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4756 symbols data.
4757 (Lib_group::include_member): Unlock object after deleting its
4758 symbols data.
4759 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4760 the bug fixed here.
4761
97b4be1c
CC
47622010-08-19 Neil Vachharajani <nvachhar@google.com>
4763 Cary Coutant <ccoutant@google.com>
4764
4765 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4766 constructor, and set_blocker.
4767 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4768 readsyms_blocker_.
4769 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4770 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4771 * testsuite/Makefile.am (start_lib_test): New test case.
4772 * testsuite/Makefile.in: Regenerate.
4773 * testsuite/start_lib_test_main.c: New file.
4774 * testsuite/start_lib_test_1.c: New file.
4775 * testsuite/start_lib_test_2.c: New file.
4776 * testsuite/start_lib_test_3.c: New file.
4777
dd0b1884
ILT
47782010-08-19 Ian Lance Taylor <iant@google.com>
4779
4780 * Makefile.in: Rebuild with automake 1.11.1.
4781 * aclocal.m4: Likewise.
4782 * testsuite/Makefile.in: Likewise.
4783
7223e9ca
ILT
47842010-08-19 Ian Lance Taylor <iant@google.com>
4785
4786 PR 10893
4787 * i386.cc (class Output_data_plt_i386): Update declarations.
4788 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4789 local_ifuncs_ fields.
4790 (Target_i386::do_plt_section_for_global): New function.
4791 (Target_i386::do_plt_section_for_local): New function.
4792 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4793 parameter; change all callers. Initialize global_ifuncs_ and
4794 local_ifuncs_. If doing a static link define __rel_iplt_start and
4795 __rel_iplt_end.
4796 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4797 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4798 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4799 symbols.
4800 (Target_i386::make_plt_section): New function, broken out of
4801 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4802 (Target_i386::make_plt_entry): Call make_plt_section.
4803 (Target_i386::make_local_ifunc_plt_entry): New function.
4804 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4805 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4806 R_386_IRELATIVE to switch.
4807 (Target_i386::Scan::global): Likewise.
4808 (Target_i386::Relocate::relocate): Likewise.
4809 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4810 switch.
4811 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4812 (Target_x86_64::do_plt_section_for_global): New function.
4813 (Target_x86_64::do_plt_section_for_local): New function.
4814 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4815 parameter; change all callers. If doing a static link define
4816 __rela_iplt_start and __rela_iplt_end.
4817 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4818 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4819 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4820 to point to .plt.
4821 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4822 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4823 switch.
4824 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4825 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4826 R_X86_64_IRELATIVE to switch.
4827 (Target_x86_64::Scan::global): Likewise.
4828 (Target_x86_64::Relocate::relocate): Likewise.
4829 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4830 switch.
4831 * target.h (class Target): Add plt_section_for_global and
4832 plt_section_for_local functions. Add do_plt_section_for_global
4833 and do_plt_section_for_local virtual functions.
4834 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4835 clarifying comments.
4836 (Symbol::use_plt_offset): Handle IFUNC symbol.
4837 * object.cc (Sized_relobj::Sized_relobj): Initialize
4838 local_plt_offsets_.
4839 (Sized_relobj::local_has_plt_offset): New function.
4840 (Sized_relobj::local_plt_offset): New function.
4841 (Sized_relobj::set_local_plt_offset): New function.
4842 (Sized_relobj::do_count): Handle IFUNC symbol.
4843 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4844 a bit away from input_shndx_ field. Add set_is_func_symbol and
4845 is_ifunc_symbol functions.
4846 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4847 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4848 local_plt_offsets_ field.
4849 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4850 * output.h (class Output_section_data): Add non-const
4851 output_section function.
4852 (class Output_data_got): Update declarations.
4853 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4854 Add use_plt_offset parameter to global and local constructors.
4855 Change all callers. Change local_sym_index_ field to 31 bits.
4856 Change GSYM_CODE and CONSTANT_CODE accordingly.
4857 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4858 doing a static link don't set sh_link field.
4859 (Output_data_got::Got_entry::write): Use PLT offset if
4860 appropriate.
4861 (Output_data_got::add_global_plt): New function.
4862 (Output_data_got::add_local_plt): New function.
4863 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4864 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4865 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4866 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4867 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4868 IFUNC conditional.
4869 * testsuite/ifunc-sel.h: New file.
4870 * testsuite/ifuncmain1.c: New file.
4871 * testsuite/ifuncmain1vis.c: New file.
4872 * testsuite/ifuncmod1.c: New file.
4873 * testsuite/ifuncdep2.c: New file.
4874 * testsuite/ifuncmain2.c: New file.
4875 * testsuite/ifuncmain3.c: New file.
4876 * testsuite/ifuncmod3.c: New file.
4877 * testsuite/ifuncmain4.c: New file.
4878 * testsuite/ifuncmain5.c: New file.
4879 * testsuite/ifuncmod5.c: New file.
4880 * testsuite/ifuncmain6pie.c: New file.
4881 * testsuite/ifuncmod6.c: New file.
4882 * testsuite/ifuncmain7.c: New file.
4883 * configure, testsuite/Makefile.in: Rebuild.
4884
56f75c03
ILT
48852010-08-18 Ian Lance Taylor <iant@google.com>
4886
4887 * incremental.cc
4888 (Output_section_incremental_inputs::write_input_files): Add cast
4889 to avoid signed/unsigned comparison warning.
4890 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4891
55455f89
CC
48922010-08-12 Cary Coutant <ccoutant@google.com>
4893
4894 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4895
e2054bcb
ILT
48962010-08-13 Ian Lance Taylor <iant@google.com>
4897
4898 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4899
74f67560
DK
49002010-08-12 Cary Coutant <ccoutant@google.com>
4901 Doug Kwan <dougkwan@google.com>
4902
4903 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4904 defintion overrides non-weak undef, remember that the original undef
4905 is not weak.
4906 * symtab.cc (Symbol_table::sized_write_global): For undef without
4907 an original weak binding, set binding to global in output.
4908 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4909 * testsuite/Makefile.in: Regenerate.
4910 * testsuite/strong_ref_weak_def.sh: New file.
4911 * testsuite/strong_ref_weak_def_1.c: Ditto.
4912 * testsuite/strong_ref_weak_def_2.c: Ditto.
4913
d1238d12
CC
49142010-08-12 Cary Coutant <ccoutant@google.com>
4915
4916 * testsuite/incremental_test.sh: Rewrite.
4917 * testsuite/incremental_test_1.c: Rewrite.
4918 * testsuite/incremental_test_2.c: Rewrite.
4919
0e70b911
CC
49202010-08-12 Cary Coutant <ccoutant@google.com>
4921
4922 * arm.cc (Target_arm::got_size): Add const.
4923 (Target_arm::got_entry_count): New function.
4924 (Target_arm::plt_entry_count): New function.
4925 (Target_arm::first_plt_entry_offset): New function.
4926 (Target_arm::plt_entry_size): New function.
4927 (Output_data_plt_arm::entry_count): New function.
4928 (Output_data_plt_arm::first_plt_entry_offset): New function.
4929 (Output_data_plt_arm::get_plt_entry_size): New function.
4930 * i386.cc (Target_i386::got_size): Add const.
4931 (Target_i386::got_entry_count): New function.
4932 (Target_i386::plt_entry_count): New function.
4933 (Target_i386::first_plt_entry_offset): New function.
4934 (Target_i386::plt_entry_size): New function.
4935 (Output_data_plt_i386::entry_count): New function.
4936 (Output_data_plt_i386::first_plt_entry_offset): New function.
4937 (Output_data_plt_i386::get_plt_entry_size): New function.
4938 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4939 find_incremental_inputs_sections. Dump incremental_got_plt section.
4940 * incremental.cc: Include target.h.
4941 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4942 parameter. Adjust all callers. Find incremental_got_plt section.
4943 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4944 section.
4945 (Output_section_incremental_inputs::set_final_data_size): Calculate
4946 size of incremental_got_plt section.
4947 (Output_section_incremental_inputs::do_write): Write the
4948 incremental_got_plt section.
4949 (Got_plt_view_info): New struct.
4950 (Local_got_offset_visitor): New class.
4951 (Global_got_offset_visitor): New class.
4952 (Global_symbol_visitor_got_plt): New class.
4953 (Output_section_incremental_inputs::write_got_plt): New function.
4954 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4955 Add parameter. Adjust all callers.
4956 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4957 (Incremental_inputs::got_plt_section): New function.
4958 (Incremental_inputs::got_plt_section_): New data member.
4959 (Incremental_got_plt_reader): New class.
4960 * layout.cc (Layout::create_incremental_info_sections): Add the
4961 incremental_got_plt section.
4962 * object.h (Got_offset_list::get_list): New function.
4963 (Got offset_list::for_all_got_offsets): New function.
4964 (Sized_relobj::local_got_offset_list): New function.
4965 * powerpc.cc (Target_powerpc::got_size): Add const.
4966 (Target_powerpc::got_entry_count): New function.
4967 (Target_powerpc::plt_entry_count): New function.
4968 (Target_powerpc::first_plt_entry_offset): New function.
4969 (Target_powerpc::plt_entry_size): New function.
4970 (Output_data_plt_powerpc::entry_count): New function.
4971 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4972 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4973 * sparc.cc (Target_sparc::got_size): Add const.
4974 (Target_sparc::got_entry_count): New function.
4975 (Target_sparc::plt_entry_count): New function.
4976 (Target_sparc::first_plt_entry_offset): New function.
4977 (Target_sparc::plt_entry_size): New function.
4978 (Output_data_plt_sparc::entry_count): New function.
4979 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4980 (Output_data_plt_sparc::get_plt_entry_size): New function.
4981 * symtab.h (Symbol::got_offset_list): New function.
4982 (Symbol_table::for_all_symbols): New function.
4983 * target.h (Sized_target::got_entry_count): New function.
4984 (Sized_target::plt_entry_count): New function.
4985 (Sized_target::plt_entry_size): New function.
4986 * x86_64.cc (Target_x86_64::got_size): Add const.
4987 (Target_x86_64::got_entry_count): New function.
4988 (Target_x86_64::plt_entry_count): New function.
4989 (Target_x86_64::first_plt_entry_offset): New function.
4990 (Target_x86_64::plt_entry_size): New function.
4991 (Output_data_plt_x86_64::entry_count): New function.
4992 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4993 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4994
09ec0418
CC
49952010-08-12 Cary Coutant <ccoutant@google.com>
4996
4997 * archive.cc: Include incremental.h.
4998 (Archive::Archive): Initialize incremental_info_.
4999 (Archive::include_member): Record archive members in incremental info.
5000 (Add_archive_symbols::run): Record begin and end of an archive in
5001 incremental info.
5002 (Lib_group::include_member): Record objects in incremental info.
5003 * archive.h (Incremental_archive_entry): Forward declaration.
5004 (Archive::set_incremental_info): New member function.
5005 (Archive::incremental_info): New member function.
5006 (Archive::Unused_symbol_iterator): New class.
5007 (Archive::unused_symbols_begin): New member function.
5008 (Archive::unused_symbols_end): New member function.
5009 (Archive::incremental_info_): New data member.
5010 * incremental-dump.cc (find_input_containing_global): New function.
5011 (dump_incremental_inputs): Dump new incremental info sections.
5012 * incremental.cc: Include symtab.h.
5013 (Output_section_incremental_inputs): New class.
5014 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5015 new incremental info sections.
5016 (Sized_incremental_binary::do_check_inputs): Likewise.
5017 (Incremental_inputs::report_archive): Remove.
5018 (Incremental_inputs::report_archive_begin): New function.
5019 (Incremental_inputs::report_archive_end): New function.
5020 (Incremental_inputs::report_object): New function.
5021 (Incremental_inputs::finalize_inputs): Remove.
5022 (Incremental_inputs::report_input_section): New function.
5023 (Incremental_inputs::report_script): Rewrite.
5024 (Incremental_inputs::finalize): Do nothing but finalize string table.
5025 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5026 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5027 (Incremental_inputs::create_data_sections): New function.
5028 (Incremental_inputs::relocs_entsize): New function.
5029 (Output_section_incremental_inputs::set_final_data_size): New function.
5030 (Output_section_incremental_inputs::do_write): New function.
5031 (Output_section_incremental_inputs::write_header): New function.
5032 (Output_section_incremental_inputs::write_input_files): New function.
5033 (Output_section_incremental_inputs::write_info_blocks): New function.
5034 (Output_section_incremental_inputs::write_symtab): New function.
5035 * incremental.h (Incremental_script_entry): Forward declaration.
5036 (Incremental_object_entry): Forward declaration.
5037 (Incremental_archive_entry): Forward declaration.
5038 (Incremental_inputs): Forward declaration.
5039 (Incremental_inputs_header_data): Remove.
5040 (Incremental_inputs_header): Remove.
5041 (Incremental_inputs_header_write): Remove.
5042 (Incremental_inputs_entry_data): Remove.
5043 (Incremental_inputs_entry): Remove.
5044 (Incremental_inputs_entry_write): Remove.
5045 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5046 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5047 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5048 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5049 Likewise.
5050 (Incremental_input_entry): New class.
5051 (Incremental_script_entry): New class.
5052 (Incremental_object_entry): New class.
5053 (Incremental_archive_entry): New class.
5054 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5055 (Incremental_inputs::report_inputs): Remove.
5056 (Incremental_inputs::report_archive): Remove.
5057 (Incremental_inputs::report_archive_begin): New function.
5058 (Incremental_inputs::report_archive_end): New function.
5059 (Incremental_inputs::report_object): Change prototype.
5060 (Incremental_inputs::report_input_section): New function.
5061 (Incremental_inputs::report_script): Change prototype.
5062 (Incremental_inputs::get_reloc_count): New function.
5063 (Incremental_inputs::set_reloc_count): New function.
5064 (Incremental_inputs::create_data_sections): New function.
5065 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5066 (Incremental_inputs::inputs_section): New function.
5067 (Incremental_inputs::symtab_section): New function.
5068 (Incremental_inputs::relocs_section): New function.
5069 (Incremental_inputs::get_stringpool): Add const.
5070 (Incremental_inputs::command_line): Add const.
5071 (Incremental_inputs::inputs): Remove.
5072 (Incremental_inputs::command_line_key): New function.
5073 (Incremental_inputs::input_file_count): New function.
5074 (Incremental_inputs::input_files): New function.
5075 (Incremental_inputs::relocs_entsize): New function.
5076 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5077 (Incremental_inputs::finalize_inputs): Remove.
5078 (Incremental_inputs::Input_info): Remove.
5079 (Incremental_inputs::lock_): Remove.
5080 (Incremental_inputs::inputs_): Change type.
5081 (Incremental_inputs::inputs_map_): Remove.
5082 (Incremental_inputs::current_object_entry_): New data member.
5083 (Incremental_inputs::inputs_section_): New data member.
5084 (Incremental_inputs::symtab_section_): New data member.
5085 (Incremental_inputs::relocs_section_): New data member.
5086 (Incremental_inputs::reloc_count_): New data member.
5087 (Incremental_inputs_reader): New class.
5088 (Incremental_symtab_reader): New class.
5089 (Incremental_relocs_reader): New class.
5090 * layout.cc (Layout::finalize): Move finalization of incremental info
5091 and creation of incremental info sections to follow finalization of
5092 symbol table. Set offsets for postprocessing sections.
5093 (Layout::create_incremental_info_sections): Call
5094 Incremental_inputs::create_data_sections. Add incremental symtab
5095 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5096 sections to layout after input sections.
5097 * layout.h (struct Timespec): Forward declaration.
5098 (Layout::incremental_inputs): Add const.
5099 (Layout::create_incremental_info_sections): Add parameter.
5100 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5101 * object.cc: Include incremental.h.
5102 (Relobj::finalize_incremental_relocs): New function.
5103 (Sized_relobj::do_layout): Record input sections in incremental info.
5104 * object.h (Object::output_section): New function.
5105 (Object::output_section_offset): Moved from Relobj.
5106 (Object::get_incremental_reloc_base): New function.
5107 (Object::get_incremental_reloc_count): New function.
5108 (Object::do_output_section): New function.
5109 (Object::do_output_section_offset): Moved from Relobj.
5110 (Object::do_get_incremental_reloc_base): New function.
5111 (Object::do_get_incremental_reloc_count): New function.
5112 (Object::Object): Initialize new data members.
5113 (Relobj::output_section): Renamed do_output_section and moved to
5114 protected.
5115 (Relobj::output_section_offset): Moved to Object.
5116 (Relobj::do_get_incremental_reloc_base): New function.
5117 (Relobj::do_get_incremental_reloc_count): New function.
5118 (Relobj::allocate_incremental_reloc_counts): New function.
5119 (Relobj::count_incremental_reloc): New function.
5120 (Relobj::finalize_incremental_relocs): New function.
5121 (Relobj::next_incremental_reloc_index): New function.
5122 (Relobj::reloc_counts_): New data member.
5123 (Relobj::reloc_bases_): New data member.
5124 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5125 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5126 (Sized_relobj::incremental_relocs_scan): New function.
5127 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5128 (Sized_relobj::incremental_relocs_write): New function.
5129 (Sized_relobj::incremental_relocs_write_reltype): New function.
5130 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5131 incremental link.
5132 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5133 archives and object files elsewhere.
5134 (Add_symbols::run): Report object files here.
5135 (Finish_group::run): Report end of archive at end of group.
5136 * reloc.cc: Include layout.h, incremental.h.
5137 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5138 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5139 (Sized_relobj::incremental_relocs_scan): New function.
5140 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5141 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5142 (Sized_relobj::incremental_relocs_write): New function.
5143 (Sized_relobj::incremental_relocs_write_reltype): New function.
5144 * script.cc (read_input_script): Rewrite test for incremental link.
5145 Change call to Incremental_inputs::report_script.
5146 * symtab.h (Symbol_table::first_global_index): New function.
5147 (Symbol_table::output_count): New function.
5148
ce0d1972
DK
51492010-08-12 Doug Kwan <dougkwan@google.com>
5150
5151 * arm.cc (Target_arm::merge_object_attributes): Check command line
5152 options --no-wchar-size-warning and --no-enum-size-warning.
5153 * options.h (General_options): Add ld-compatible options
5154 --no-enum-size-warning and --no-wchar-size-warning.
5155
6e5710ce
ILT
51562010-08-04 Ian Lance Taylor <iant@google.com>
5157
5158 * x86_64.cc (Target_x86_64::Scan::local): Use
5159 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5160 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5161 (Target_x86_64::Scan::global): Likewise.
5162 (Target_x86_64::Relocate::relocate): Likewise.
5163 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5164 Likewise.
5165
fef830db
CC
51662010-08-03 Cary Coutant <ccoutant@google.com>
5167
5168 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5169 to reserve space in merged_strings vector. Keep total input size
5170 for stats.
5171 (Output_merge_string::do_print_merge_stats): Print total input size.
5172 * merge.h (Output_merge_string): Add input_size_ field.
5173 * stringpool.cc (Stringpool_template::string_length): Move
5174 implementations out of Stringpool_template class and place in
5175 stringpool.h.
5176 * stringpool.h (string_length): Move out of Stringpool_template.
5177
1e3811b0
ILT
51782010-08-03 Ian Lance Taylor <iant@google.com>
5179
5180 PR 11712
5181 * layout.cc (relaxation_loop_body): If address of load segment is
5182 set, adjust address to include headers if possible.
5183
7af0c620
ILT
51842010-08-03 Ian Lance Taylor <iant@google.com>
5185
5186 * version.cc (version_string): Bump to 1.10.
5187
22f0da72
ILT
51882010-08-03 Ian Lance Taylor <iant@google.com>
5189
5190 PR 11805
5191 * layout.h (enum Output_section_order): Define.
5192 (class Layout): Update declarations.
5193 * layout.cc (Layout::get_output_section): Add order parameter.
5194 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5195 is_first_non_relro parameters. Change all callers.
5196 (Layout::choose_output_section): Likewise.
5197 (Layout::add_output_section_data): Likewise.
5198 (Layout::make_output_section): Likewise. Set order.
5199 (Layout::default_section_order): New function.
5200 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5201 * output.cc (Output_section::Output_section): Initialize order_.
5202 Don't initialize deleted fields.
5203 (Output_segment::Output_segment): Don't initialize deleted
5204 fields.
5205 (Output_segment::add_output_section_to_load): New function
5206 replacing add_output_section. Change all callers to call this or
5207 add_output_section_to_nonload.
5208 (Output_segment::add_output_section_to_nonload): New function.
5209 (Output_segment::remove_output_section): Rewrite.
5210 (Output_segment::add_initial_output_data): Likewise.
5211 (Output_segment::has_any_data_sections): Likewise.
5212 (Output_segment::is_first_section_relro): Likewise.
5213 (Output_segment::maximum_alignment): Likewise.
5214 (Output_segment::has_dynamic_reloc): New function replacing
5215 dynamic_reloc_count. Change all callers.
5216 (Output_segment::has_dynamic_reloc_list): New function replacing
5217 dynamic_reloc_count_list. Change all callers.
5218 (Output_segment::set_section_addresses): Rewrite.
5219 (Output_segment::set_offset): Rewrite.
5220 (Output_segment::find_first_and_last_list): Remove.
5221 (Output_segment::set_tls_offsets): Rewrite.
5222 (Output_segment::first_section_load_address): Likewise.
5223 (Output_segment::output_section_count): Likewise.
5224 (Output_segment::section_with_lowest_load_address): Likewise.
5225 (Output_segment::write_section_headers): Likewise.
5226 (Output_segment::print_sections_to_map): Likewise.
5227 * output.h (class Output_data): Remove dynamic_reloc_count_
5228 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5229 (Output_data::add_dynamic_reloc): Rewrite.
5230 (Output_data::has_dynamic_reloc): New function.
5231 (Output_data::dynamic_reloc_count): Remove.
5232 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5233 is_last_relro_, is_first_non_relro_, is_interp_,
5234 is_dynamic_linker_section_ fields. Add order and set_order
5235 functions. Remove is_relro_local, set_is_relro_local,
5236 is_last_relro, set_is_last_relro, is_first_non_relro,
5237 set_is_first_non_relro functions, is_interp, set_is_interp,
5238 is_dynamic_linker_section, and set_is_dynamic_linker_section
5239 functions.
5240 (class Output_segment): Change Output_data_list from std::list to
5241 std:;vector. Add output_lists_ field. Remove output_data_ and
5242 output_bss_ fields. Update declarations.
5243
3ff2ccb0
ILT
52442010-08-02 Ian Lance Taylor <iant@google.com>
5245
5246 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5247 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5248 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5249
88a4108b
ILT
52502010-08-02 Ian Lance Taylor <iant@google.com>
5251
5252 PR 11855
5253 * script.cc (Script_options::Script_options): Initialize
5254 symbol_definitions_ and symbol_references_.
5255 (Script_options::add_symbol_assignment): Update
5256 symbol_definitions_ and symbol_references_.
5257 (Script_options::add_symbol_reference): New function.
5258 (script_symbol): New function.
5259 * script.h (class Script_options): Add symbol_definitions_ and
5260 symbol_references_ fields.
5261 (Script_options::referenced_const_iterator): New type.
5262 (Script_options::referenced_begin): New function.
5263 (Script_options::referenced_end): New function.
5264 (Script_options::is_referenced): New function.
5265 (Script_options::any_unreferenced): New function.
5266 * script-c.h (script_symbol): Declare.
5267 * yyscript.y (exp): Call script_symbol.
5268 * symtab.cc: Include "script.h".
5269 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5270 Change all callers. Check symbols referenced by scripts.
5271 (Symbol_table::add_undefined_symbols_from_command_line): Add
5272 layout parameter. Change all callers.
5273 (Symbol_table::do_add_undefined_symbols_from_command_line):
5274 Likewise. Break out loop body. Check symbols referenced by
5275 scripts.
5276 (Symbol_table::add_undefined_symbol_from_command_line): New
5277 function broken out of
5278 do_add_undefined_symbols_from_command_line.
5279 * symtab.h (class Symbol_table): Update declarations.
5280 * archive.cc: Include "layout.h".
5281 (Archive::should_include_member): Add layout parameter. Change
5282 all callers. Check for symbol mentioned in expression.
5283 * archive.h (class Archive): Update declaration.
5284 * object.cc (Sized_relobj::do_should_include_member): Add layout
5285 parameter.
5286 * object.h (Object::should_include_member): Add layout parameter.
5287 Change all callers.
5288 (Object::do_should_include_member): Add layout parameter.
5289 (class Sized_relobj): Update declaration.
5290 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5291 parameter.
5292 * dynobj.h (class Sized_dynobj): Update declaration.
5293 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5294 layout parameter.
5295 * plugin.h (class Sized_pluginobj): Update declaration.
5296
5f1ab67a
ILT
52972010-08-02 Ian Lance Taylor <iant@google.com>
5298
5299 PR 11866
5300 * output.cc (Output_segment::set_offset): Search for the first and
5301 last sections rather than assuming that the list is in order.
5302 (Output_segment::find_first_and_last_list): New function.
5303 * output.h (class Output_segment): Update declarations.
5304 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5305 (relro_strip_test_SOURCES): New variable.
5306 (relro_strip_test_DEPENDENCIES): New variable.
5307 (relro_strip_test_LDFLAGS): New variable.
5308 (relro_strip_test_LDADD): New variable.
5309 (relro_strip_test.so): New target.
5310
a8df5856
ILT
53112010-08-02 Ian Lance Taylor <iant@google.com>
5312
5313 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5314 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5315 (Target_i386::got_tlsdesc_section): New function.
5316 (Target_i386::got_section): Create space for GOT entries for
5317 TLSDESC relocations.
5318 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5319 R_386_TLS_GOTDESC.
5320 (Target_i386::Scan::global): Likewise.
5321 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5322 using TLSDESC GOT.
5323 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5324 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5325 (Target_x86_64::got_tlsdesc_section): New function.
5326 (Target_x86_64::got_section): Create space for GOT entries for
5327 TLSDESC relocations.
5328 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5329 R_386_TLS_GOTDESC.
5330 (Target_x86_64::Scan::global): Likewise.
5331 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5332 using TLSDESC GOT.
5333
0c10a0a6
ILT
53342010-08-02 Ian Lance Taylor <iant@google.com>
5335
5336 * testsuite/final_layout.sh: Use dc to convert from hex to
5337 decimal.
5338
41cbeecc
ST
53392010-07-29 Sriraman Tallam <tmsriram@google.com>
5340
5341 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5342 paramter to the call to gold::gc_process_relocs.
5343 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5344 paramter to the call to gold::gc_process_relocs.
5345 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5346 parameter to the call to gold::gc_process_relocs.
5347 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5348 template parameter to the call to gold::gc_process_relocs.
5349 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5350 paramter to the call to gold::gc_process_relocs.
5351 * gc.h (get_embedded_addend_size): New function.
5352 (gc_process_relocs): Save the size of the reloc for use by ICF.
5353 * icf.cc (get_section_contents): Get the addend from the text section
5354 for SHT_REL relocation sections.
5355 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5356 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5357 * int_encoding.h (read_from_pointer): New overloaded function.
5358 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5359 * testsuite/icf_sht_rel_addend_test.sh: New file.
5360 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5361 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5362
6ea55b82
RW
53632010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5364
5365 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5366 * Makefile.in: Regenerate.
5367 * testsuite/Makefile.in: Regenerate.
5368
9691462b
ILT
53692010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5370
5371 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5372 * gold/testsuite/debug_msg.cc: Likewise.
5373 * gold/testsuite/odr_violation1.cc
5374 * gold/testsuite/odr_violation2.cc
5375
76897331
CC
53762010-07-21 Cary Coutant <ccoutant@google.com>
5377
5378 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5379 string, and length fields.
5380 (Output_merge_string::Merged_strings_list): New type.
5381 (Output_merge_string::Merged_strings_lists): New typedef.
5382 (Output_merge_string): Replace merged_strings_ with
5383 merged_strings_lists_.
5384 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5385 Merged_strings_list per input object and section. Don't store pointer
5386 to the string. Don't store length with each merged string entry.
5387 (Output_merge_string::finalize_merged_data): Loop over list of merged
5388 strings lists. Recompute length of each merged string.
5389
78384e8f
CC
53902010-07-15 Cary Coutant <ccoutant@google.com>
5391
5392 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5393 here.
5394
783659f9
ILT
53952010-07-14 Ian Lance Taylor <iant@google.com>
5396
5397 * descriptors.cc (Descriptors::open): Report correct name in error
5398 message.
5399
131687b4
DK
54002010-07-13 Doug Kwan <dougkwan@google.com>
5401
5402 * arm.cc (Arm_input_section::Arm_input_section): For a
5403 SHT_ARM_EXIDX section, always keeps the input sections.
5404 (Arm_input_section::set_exidx_section_link): New method.
5405 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5406 has_errors_ to false.
5407 (Arm_exidx_input_section::has_errors,
5408 Arm_exidx_input_section::set_has_errors): New methods.
5409 (Arm_exidx_input_section::has_errors_): New data member.
5410 (Arm_relobj::get_exidx_shndx_list): New method.
5411 (Arm_output_section::append_text_sections_to_list): Do not skip
5412 section without SHF_EXECINSTR.
5413 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5414 errors.
2e702c99 5415 (Arm_relobj::make_exidx_input_section): Add new parameter for text
131687b4
DK
5416 section header. Make error messages more verbose. Check for
5417 a non-executable section linked to an EXIDX section.
5418 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5419 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5420 check that there is no deferred EXIDX section if we exit early.
5421 Instead of not making an EXIDX section in case of an error, make one
5422 and set the has_errors flag of it.
5423 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5424 in a relocatable link.
5425 (Target_arm::do_relax): Look for the EXIDX output section instead of
5426 assuming that it is called .ARM.exidx.
2e702c99 5427 (Target_arm::fix_exidx_coverage): Add a new parameter for input
131687b4
DK
5428 section list. Do not check for SHF_EXECINSTR section flags but
5429 skip any input section with errors.
5430 * output.cc (Output_section::Output_section): Initialize
5431 always_keeps_input_sections_ to false.
5432 (Output_section::add_input_section): Check for
5433 always_keeps_input_sections_.
5434 * output.h (Output_section::always_keeps_input_sections,
5435 Output_section::set_always_keeps_input_sections): New methods.
5436 (Output_section::always_keeps_input_sections): New data member.
5437
69517287
RÁE
54382010-07-13 Rafael Espindola <espindola@google.com>
5439
5440 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5441 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5442
82742395
ILT
54432010-07-13 Philip Herron <herron.philip@googlemail.com>
5444 Ian Lance Taylor <iant@google.com>
5445
5446 * output.h (Output_section_lookup_maps::add_merge_section):
5447 Correct check of whether value was inserted.
5448 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5449 (Output_section_lookup_maps::add_relaxed_input_section):
5450 Likewise.
5451 * arm.cc (Target_arm::got_section): Remove used local os.
5452 * i386.cc (Target_i386::got_section): Likewise.
5453 * x86_64.cc (Target_x86_64::got_section): Likewise.
5454 * sparc.cc (Target_sparc::got_section): Likewise.
5455 (Target_sparc::relocate): Remove unused local have_got_offset.
5456 * powerpc.cc (Target_powerpc::relocate): Likewise.
5457
f2d707b5
ILT
54582010-07-13 Ian Lance Taylor <iant@google.com>
5459
241531d6
ILT
5460 * compressed_output.cc (zlib_decompress): Fix signature in
5461 !HAVE_ZLIB_H case.
5462
f2d707b5
ILT
5463 * archive.cc (Archive::include_member): Unlock an external member
5464 of a thin archive. Don't bother to delete an object we know is
5465 NULL.
5466
a2e47362
CC
54672010-07-12 Cary Coutant <ccoutant@google.com>
5468
5469 * compressed_output.cc (zlib_decompress): New function.
5470 (get_uncompressed_size): New function.
5471 (decompress_input_section): New function.
5472 * compressed_output.h (get_uncompressed_size): New function.
5473 (decompress_input_section): New function.
5474 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5475 Handle compressed debug sections.
5476 * layout.cc (is_compressed_debug_section): New function.
5477 (Layout::output_section_name): Map compressed section names to
5478 canonical names.
5479 * layout.h (is_compressed_debug_section): New function.
5480 (is_debug_info_section): Recognize compressed debug sections.
5481 * merge.cc: Include compressed_output.h.
5482 (Output_merge_data::do_add_input_section): Handle compressed
5483 debug sections.
5484 (Output_merge_string::do_add_input_section): Handle compressed
5485 debug sections.
5486 * object.cc: Include compressed_output.h.
5487 (Sized_relobj::Sized_relobj): Initialize new data members.
5488 (build_compressed_section_map): New function.
5489 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5490 * object.h (Object::section_is_compressed): New method.
5491 (Object::do_section_is_compressed): New method.
5492 (Sized_relobj::Compressed_section_map): New type.
5493 (Sized_relobj::do_section_is_compressed): New method.
5494 (Sized_relobj::compressed_sections_): New data member.
5495 * output.cc (Output_section::add_input_section): Handle compressed
5496 debug sections.
5497 * reloc.cc: Include compressed_output.h.
5498 (Sized_relobj::write_sections): Handle compressed debug sections.
5499
ce279a62
CC
55002010-07-08 Cary Coutant <ccoutant@google.com>
5501
5502 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5503 weak when resolving to a dynamic def.
5504 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5505 for weak undef/dynamic def cases. Adjust callers.
5506 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5507 undef_binding_weak_.
5508 (Symbol_table::sized_write_globals): Adjust symbol binding.
5509 (Symbol_table::sized_write_symbol): Add binding parameter.
5510 * symtab.h (Symbol::set_undef_binding): New method.
5511 (Symbol::is_undef_binding_weak): New method.
5512 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5513 (Symbol_table::should_override): Add new parameter.
5514 (Symbol_table::sized_write_symbol): Add new parameter.
5515
5516 * testsuite/weak_undef_file1.cc: Add new test case.
5517 * testsuite/weak_undef_file2.cc: Fix header comment.
5518 * testsuite/weak_undef_test.cc: Add new test case.
5519
b2286c10
DK
55202010-06-29 Doug Kwan <dougkwan@google.com>
5521
5522 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5523 Initialize USE_SYMBOL_.
5524 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5525 definition.
5526 (Arm_reloc_property::uses_symbol_): New data member declaration.
5527 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5528 uses symbol value and symbol is undefined but not weakly undefined.
5529
4802450a
RÁE
55302010-06-28 Rafael Espindola <espindola@google.com>
5531
5532 * plugin.cc (Plugin::load): Use dlerror.
5533
e5ca47ba
ILT
55342010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5535
5536 * symtab.cc (detect_odr_violations): When reporting an ODR
5537 violation, report an object where the symbol is defined.
5538
8a75a161
DK
55392010-06-25 Doug Kwan <dougkwan@google.com>
5540
5541 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5542 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5543 definition.
5544 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5545 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5546 target hook to detect function points.
5547 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5548 * icf.h (Icf::check_section_for_function_pointers): Change type of
5549 parameter SECTION_NAME to const reference to std::string. Use
5550 target hook to determine if section may have unsafe pointers.
5551 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5552 method definition.
5553
42218b9f
RÁE
55542010-06-21 Rafael Espindola <espindola@google.com>
5555
5556 * fileread.cc (Input_file::find_fie): New
5557 (Input_file::open): Use Input_file::find_fie.
5558 * fileread.h (Input_file::find_fie): New
5559 * plugin.cc (set_extra_library_path): New.
5560 (Plugin::load): Add set_extra_library_path to the transfer vector.
5561 (Plugin_manager::set_extra_library_path): New.
5562 (Plugin_manager::add_input_file): Use the extra search path if set.
5563 (set_extra_library_path(): New.
5564 * plugin.h (Plugin_manager): Add set_extra_library_path and
5565 extra_search_path_.
5566
a0506cca
CC
55672010-06-19 Cary Coutant <ccoutant@google.com>
5568
5569 * layout.cc (gdb_sections): Add .debug_types.
5570 (lines_only_debug_sections): Likewise.
5571
6508b958
RÁE
55722010-06-18 Rafael Espindola <espindola@google.com>
5573
5574 * plugin.cc (add_input_file,add_input_library)
5575 (Plugin_manager::add_input_file): Make filename arguments const.
5576 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5577 const.
5578
3e235302
DK
55792010-06-16 Doug Kwan <dougkwan@google.com>
5580
5581 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5582 .ARM.attributes section if we have not merged any input
5583 attributes sections.
5584
106e8a6c
DK
55852010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5586
5587 * arm.cc: Allow combining objects with no EABI version
5588 information.
5589
91ff43fe
RÁE
55902010-06-15 Rafael Espindola <espindola@google.com>
5591
5592 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5593
68ed838c
ILT
55942010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5595
5596 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5597 (struct iovec): Correct !HAVE_READV definition.
5598
f3a2388f
CC
55992010-06-10 Cary Coutant <ccoutant@google.com>
5600
5601 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5602 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5603 reloc sections.
5604 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5605
5606 PR 11683
5607 * symtab.h (Symbol::is_placeholder): New member function.
5608 * target-reloc.h (relocate_section): Check for placeholder symbols.
5609
5610 * testsuite/Makefile.am (plugin_test_8): New test.
5611 (plugin_test_9): New test.
5612 * testsuite/Makefile.in: Regenerate.
5613
e1df38aa
NC
56142010-06-09 Nick Clifton <nickc@redhat.com>
5615
5616 * yyscript.y (input_list_element): Allow strings prefixed with
5617 the '-' character. Treat these as libraries.
5618 * script.cc (script_add_library): New function. Adds a library
5619 specified by "-l<name>" found in an input script.
5620 * script-c.h: Add prototype for script_add_library.
5621
25bbe950
DK
56222010-06-07 Doug Kwan <dougkwan@google.com>
5623
5624 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5625 Restrict stub-group size to be within long conditional branch
5626 range when working around cortex-A8 erratum.
5627
0f32ea4c
ILT
56282010-06-07 Damien Diederen <dd@crosstwine.com>
5629
5630 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5631 #ifdef typo.
5632
8fe2a369
ST
56332010-06-03 Sriraman Tallam <tmsriram@google.com>
5634
5635 PR gold/11658
5636 * output.cc
5637 (Output_section::Input_section_sort_entry::compare_section_ordering):
5638 Change to return non-zero correctly.
5639 (Output_section::Input_section_sort_section_order_index_compare
5640 ::operator()): Change to fix ambiguity in comparisons.
5641
6e9ba2ca
ST
56422010-06-01 Sriraman Tallam <tmsriram@google.com>
5643
5644 * gold.h (is_wildcard_string): New function.
5645 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5646 (Layout::layout_eh_frame): Ditto.
5647 (Layout::find_section_order_index): New method.
5648 (Layout::read_layout_from_file): New method.
5649 * layout.h (Layout::find_section_order_index): New method.
5650 (Layout::read_layout_from_file): New method.
5651 (Layout::input_section_position_): New private member.
5652 (Layout::input_section_glob_): New private member.
5653 * main.cc (main): Call read_layout_from_file here.
5654 * options.h (--section-ordering-file): New option.
5655 * output.cc (Output_section::input_section_order_specified_): New
5656 member.
5657 (Output_section::Output_section): Initialize new member.
5658 (Output_section::add_input_section): Add new parameter.
5659 Keep input sections when --section-ordering-file is used.
5660 (Output_section::set_final_data_size): Sort input sections when
5661 section ordering file is specified.
5662 (Output_section::Input_section_sort_entry): Add new parameter.
5663 Check sorting type.
5664 (Output_section::Input_section_sort_entry::compare_section_ordering):
5665 New method.
5666 (Output_section::Input_section_sort_compare::operator()): Change to
5667 consider section_order_index.
5668 (Output_section::Input_section_sort_init_fini_compare::operator()):
5669 Change to consider section_order_index.
5670 (Output_section::Input_section_sort_section_order_index_compare
5671 ::operator()): New method.
5672 (Output_section::sort_attached_input_sections): Change to sort
5673 according to section order when specified.
e1df38aa
NC
5674 (Output_section::add_input_section<32, true>): Add new parameter.
5675 (Output_section::add_input_section<64, true>): Add new parameter.
5676 (Output_section::add_input_section<32, false>): Add new parameter.
5677 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
5678 * output.h (Output_section::add_input_section): Add new parameter.
5679 (Output_section::input_section_order_specified): New
5680 method.
5681 (Output_section::set_input_section_order_specified): New method.
5682 (Input_section::Input_section): Initialize section_order_index_.
5683 (Input_section::section_order_index): New method.
5684 (Input_section::set_section_order_index): New method.
5685 (Input_section::section_order_index_): New member.
5686 (Input_section::Input_section_sort_section_order_index_compare): New
5687 struct.
5688 (Output_section::input_section_order_specified_): New member.
5689 * script-sections.cc (is_wildcard_string): Delete and move modified
5690 method to gold.h.
5691 (Output_section_element_input::Output_section_element_input): Modify
5692 call to is_wildcard_string.
5693 (Output_section_element_input::Input_section_pattern
5694 ::Input_section_pattern): Ditto.
5695 (Output_section_element_input::Output_section_element_input): Ditto.
5696 * testsuite/Makefile.am (final_layout): New test case.
5697 * testsuite/Makefile.in: Regenerate.
5698 * testsuite/final_layout.cc: New file.
5699 * testsuite/final_layout.sh: New file.
5700
3537c84b
RÁE
57012010-06-01 Rafael Espindola <espindola@google.com>
5702
5703 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5704
105b6afd
RÁE
57052010-06-01 Rafael Espindola <espindola@google.com>
5706
5707 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5708 visibility of symbols.
5709
29e11421
DK
57102010-05-27 Doug Kwan <dougkwan@google.com>
5711
5712 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5713 from start of output section instead of address for a local symbol
5714 in a merged or relaxed section when doing a relocatable link.
5715
5e0f337e
RÁE
57162010-05-26 Rafael Espindola <espindola@google.com>
5717
703d02da 5718 PR 11604
5e0f337e
RÁE
5719 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5720 adding sections the garbage collector removed.
5721 * gold/testsuite/Makefile.am: Add test.
5722 * gold/testsuite/Makefile.in: Regenerate.
5723 * gold/testsuite/plugin_test_7.sh: New.
5724 * gold/testsuite/plugin_test_7_1.c: New.
5725 * gold/testsuite/plugin_test_7_2.c: New.
5726
f4187277
RÁE
57272010-05-26 Rafael Espindola <espindola@google.com>
5728
5729 * script-sections.cc (Output_section_definition::set_section_addresses):
5730 Check for --section-start.
5731
5c388529
DK
57322010-05-26 Doug Kwan <dougkwan@google.com>
5733
5734 * arm.cc (Arm_scan_relocatable_relocs): New class.
5735 (Target_arm::relocate_special_relocatable): New method.
5736 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5737 (Arm_relocate_functions::thumb_branch_common): Same.
5738 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5739 instead of Default_scan_relocatable_relocs.
5740 * target-reloc.h (relocate_for_relocatable): Let target handle
5741 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5742 * target.h (Sized_target::relocate_special_relocatable): New method.
5743
bca1c3ae
ILT
57442010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5745
5746 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5747
0439c796
DK
57482010-05-23 Doug Kwan <dougkwan@google.com>
5749
5750 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5751 instead of a cast.
5752 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5753 with a direct branch, not a conditional branch, to a stub.
5754 * merge.cc (Output_merge_base::record_input_section): New method
5755 defintion.
5756 (Output_merge_data::do_add_input_section): Record input section if
5757 keeps-input-sections flag is set.
5758 (Output_merge_string::do_add_input_section): Ditto.
5759 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5760 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5761 INPUT_SECTIONS_.
5762 (Output_merge_base::keeps_input_sections,
5763 Output_merge_base::set_keeps_input_sections,
5764 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5765 method definitions.
5766 (Output_merge_base::Input_sections): New type declaration.
5767 (Output_merge_base::input_sections_begin,
5768 Output_merge_base::input_sections_end,
5769 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5770 (Output_merge_base::bool keeps_input_sections_,
5771 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5772 Output_merge_base::input_sections_): New data members.
5773 (Output_merge_data::do_set_keeps_input_sections): New method
5774 defintion.
5775 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5776 * output.cc (Output_section::Input_section::relobj): Move method
5777 defintion from class declaration to here and handle merge sections.
5778 (Output_section::Input_section::shndx): Ditto.
5779 (Output_section::Output_section): Remove initializations of removed
5780 data members and initialize new data member LOOKUP_MAPS_.
5781 (Output_section::add_input_section): Set keeps-input-sections flag
5782 for a newly created merge output section as appropriate. Adjust code
5783 to use Output_section_lookup_maps class.
5784 (Output_section::add_relaxed_input_section): Adjst code for lookup
5785 maps code refactoring.
2e702c99 5786 (Output_section::add_merge_input_section): Add a new parameter
0439c796
DK
5787 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5788 class. If adding input section to a newly created merge output
5789 section fails, remove the new merge section.
5790 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 5791 Adjust code for use of the Output_section_lookup_maps class.
2e702c99 5792 (Output_section::find_merge_section): Ditto.
0439c796 5793 (Output_section::build_lookup_maps): New method defintion.
2e702c99 5794 (Output_section::find_relaxed_input_section): Adjust code to use
0439c796
DK
5795 Output_section_lookup_maps class.
5796 (Output_section::get_input_sections): Export merge sections. Adjust
5797 code to use Output_section_lookup_maps class.
5798 (Output_section:::add_script_input_section): Adjust code to use
5799 Output_section_lookup_maps class. Update lookup maps for merge
5800 sections also.
5801 (Output_section::discard_states): Use Output_section_lookup_maps.
5802 (Output_section::restore_states): Same.
5803 * output.h (Merge_section_properties): Move class defintion out of
5804 Output_section.
5805 (Output_section_lookup_maps): New class.
5806 (Output_section::Input_section::is_merge_section): New method
5807 defintion.
5808 (Output_section::Input_section::relobj): Move defintion out of class
5809 defintion. Declare method only.
5810 (Output_section::Input_section::shndx): Ditto.
5811 (Output_section::Input_section::output_merge_base): New method defintion.
2e702c99 5812 (Output_section::Input_section::u2_.pomb): New union field.
0439c796
DK
5813 (Output_section::Merge_section_by_properties_map,
5814 Output_section::Output_section_data_by_input_section_map,
5815 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5816 Remove types.
2e702c99 5817 (Output_section::add_merge_input_section): Add new parameter
0439c796
DK
5818 KEEPS_INPUT_SECTIONS.
5819 (Output_section::build_lookup_maps): New method declaration.
5820 (Output_section::merge_section_map_,
5821 Output_section::merge_section_by_properties_map_,
5822 Output_section::relaxed_input_section_map_,
5823 Output_section::is_relaxed_input_section_map_valid_): Remove data
5824 members.
5825 (Output_section::lookup_maps_): New data member.
5826
76295588
L
58272010-05-21 Doug Kwan <dougkwan@google.com>
5828
5829 PR gold/11619
5830 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5831 avoid a compilation error.
5832
d103a984
RÁE
58332010-05-19 Rafael Espindola <espindola@google.com>
5834
5835 * script-sections.cc (Output_section_definition::allocate_to_segment):
5836 Update the phdrs_list even when the output section is NULL.
5837 * testsuite/Makefile.am: Add test.
5838 * testsuite/Makefile.in: Regenerate.
5839 * testsuite/script_test_9.cc: New.
5840 * testsuite/script_test_9.sh: New.
5841 * testsuite/script_test_9.t: New.
5842
6625d24e
DK
58432010-05-19 Doug Kwan <dougkwan@google.com>
5844
5845 * arm.cc (Arm_input_section::original_size): New method.
5846 (Arm_input_section::do_addralign): Add a cast.
5847 (Arm_input_section::do_output_offset): Remove static cast.
5848 (Arm_input_section::original_addralign,
5849 Arm_input_section::original_size_): Change type to uint32_t.
5850 (Arm_input_section::init): Add safe casts for section alignment
5851 and size.
5852 (Arm_input_section::set_final_data_size): Do not set address and
5853 offset of stub table.
5854 (Arm_output_section::fix_exidx_coverage): Change use of of
5855 Output_section::Simple_input_section to that of
5856 Output_section::Input_section.
5857 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5858 except for the first pass.
5859 * output.cc (Output_section::get_input_sections): Change type of
5860 input_sections to std::list<Input_section>.
5861 (Output_section::add_script_input_section): Rename from
5862 Output_section::add_simple_input_section. Change type of SIS
5863 parameter from Simple_input_section to Input_section.
5864 * output.h (Output_section::Simple_input_section): Remove class.
5865 (Output_section::Input_section): Change class visibility to public.
5866 (Output_section::Input_section::addralign): Use stored alignments
5867 for special input sections if set.
5868 (Output_section::Input_section::set_addralign): New method.
5869 (Output_section::get_input_sections): Change parameter type from
5870 list of Simple_input_section to list of Input_section.
5871 (Output_section::add_script_input_section): Rename from
5872 Output_section::add_simple_input_section. Change first parameter's
5873 type from Simple_input_section to Input_section and remove the
5874 second and third parameters.
5875 * script-sections.cc (Input_section::Input_section_list): Change
5876 type to list of Output_section::Input_section/
5877 (Input_section_info::Input_section_info): Change parameter type of
5878 INPUT_SECTION to Output_section::Input_section.
5879 (Input_section_info::input_section): Change return type.
5880 (Input_section_info::input_section_): Change type to
5881 Output_section::Input_section.
5882 (Output_section_element_input::set_section_addresses): Adjust code
5883 to use Output_section::Input_section instead of
5884 Output_section::Simple_input_section. Adjust code for renaming
5885 of Output_section::add_simple_input_section.
5886 (Orphan_output_section::set_section_addresses): Ditto.
5887
e1e82ea4
RW
58882010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5889
5890 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5891 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5892
91e75c8a
RÁE
58932010-05-18 Rafael Espindola <espindola@google.com>
5894
5895 * options.cc (General_options::finalize): Handle -nostdlib.
5896 * options.h (nostdlib): New option.
5897 * script.cc (script_add_search_dir): Handle -nostdlib.
5898
da59ad79
DK
58992010-05-12 Doug Kwan <dougkwan@google.com>
5900
5901 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5902 attributes section only if there no attributes section after merging.
5903 (Target_arm::merge_object_attributes): Move value of
e1df38aa 5904 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
5905 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5906 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5907 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5908 and arm_attr_merge_7.stdout.
5909 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5910 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5911 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5912 arm_attr_merge_7b.o): New rules.
5913 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5914 arm_attr_merge_7
5915 * testsuite/Makefile.in: Regenerate.
5916 * testsuite/arm_attr_merge.sh: New file.
5917 * testsuite/arm_attr_merge_[67][ab].s: Same.
5918
3e01a7fd
NC
59192010-05-05 Nick Clifton <nickc@redhat.com>
5920
5921 * po/es.po: Updated Spanish translation.
5922
7ad2014a
L
59232010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5924
5925 * Makefile.am (install-exec-local): Properly install gold as
5926 default cross linker.
5927 * Makefile.in: Regenerated.
5928
4fda8867
NC
59292010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5930 Nick Clifton <nickc@redhat.com>
5931
5932 * configure.ac (install_as_default): Define and set to false
5933 unless --enable-gold or --enable-gold=both/gold has been
5934 specified.
5935 * configure: Regenerate.
5936
5937 * Makefile.am (install-exec-local): Install the executable as
5938 'ld.gold'. If install_as_default is true then also install it as
5939 'ld'.
5940 * Makefile.in: Regenerated.
5941
bd288ea2
ILT
59422010-04-24 Ian Lance Taylor <iant@google.com>
5943
5944 * layout.cc (Layout::layout_reloc): In relocatable link don't
5945 combine reloc sections for grouped sections.
5946
ef38fd8a
ST
59472010-04-23 Sriraman Tallam <tmsriram@google.com>
5948
5949 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5950 sections that are not ordinary to icf.
5951 * icf.cc (get_section_contents): Handle relocation pointing to section
5952 with no object or shndx information.
5953 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5954 * testsuite/Makefile.in: Regenerate.
5955 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5956 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5957
f6973bdc
ILT
59582010-04-22 Ian Lance Taylor <iant@google.com>
5959
5960 * expression.cc (Expression::Expression_eval_info): Add
5961 result_alignment_pointer field.
5962 (Expression::eval_with_dot): Add result_alignment_pointer
5963 parameter. Change all callers.
5964 (Expression::eval_maybe_dot): Likewise.
5965 (class Binary_expression): Add alignment_pointer parameter to
5966 left_value and right_value. Change all callers.
5967 (BINARY_EXPRESSION): Set result alignment.
5968 (class Trinary_expression): Add alignment_pointer parameter to
5969 arg2_value and arg3_value. Change all callers.
5970 (Trinary_cond::value): Set result alignment.
5971 (Max_expression::value, Min_expression::value): Likewise.
5972 (Align_expression::value): Likewise.
5973 * script-sections.cc (class Sections_element): Add dot_alignment
5974 parameter to set_section_addresses virtual function. Update
5975 instantiations.
5976 (class Output_section_element): Likewise.
5977 (Script_sections::create_segments): Add dot_alignment parameter.
5978 Change all callers.
5979 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5980 (Script_sections::set_phdrs_clause_addresses): Likewise.
5981 * script-sections.h: Update declarations.
5982 * script.h: Update declarations.
5983 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5984 min_p_align.
5985 * testsuite/script_test_3.t: Set large alignment.
5986 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5987 segment has expected alignment.
5988
9c9c98a5
NC
59892010-04-22 Nick Clifton <nickc@redhat.com>
5990
5991 * po/gold.pot: Updated by the Translation project.
5992 * po/vi.po: Updated Vietnamese translation.
5993
2253bfba
L
59942010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5995
5996 * testsuite/Makefile.am (check_PROGRAMS): Add
5997 icf_virtual_function_folding_test.
5998 * testsuite/Makefile.in: Regenerated.
5999
85fdf906
AH
60002010-04-15 Andrew Haley <aph@redhat.com>
6001
6002 * options.h (merge_exidx_entries): New option.
6003 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6004 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6005 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6006 (Target_arm::merge_exidx_entries): New function.
6007 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6008 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6009 to Arm_exidx_fixup constructor.
6010 Add new arg, merge_exidx_entries.
6011 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6012 Arm_output_section::fix_exidx_coverage.
6013
ce97fa81
ST
60142010-04-18 Sriraman Tallam <tmsriram@google.com>
6015
6016 * icf.cc (get_section_contents): Check for preemptible functions.
6017 Ignore addend when appropriate.
6018 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6019 section folded.
6020 (add_from_relobj): Check for section folded.
6021 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6022 * symtab.h (should_add_dynsym_entry): Add new parameter.
6023 * target-reloc.h (scan_relocs): Check for section folded.
6024 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6025 Check reloc types for function pointers in shared objects.
6026 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6027 case.
6028 (icf_preemptible_functions_test): New test case.
6029 (icf_string_merge_test): New test case.
6030 * testsuite.Makefile.in: Regenerate.
6031 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6032 bar_glob. Refactor code.
6033 * testsuite/icf_preemptible_functions_test.cc: New file.
6034 * testsuite/icf_preemptible_functions_test.sh: New file.
6035 * testsuite/icf_string_merge_test.cc: New file.
6036 * testsuite/icf_string_merge_test.sh: New file.
6037 * testsuite/icf_virtual_function_folding_test.cc: New file.
6038 * testsuite/icf_virtual_function_folding_test.sh: New file.
6039
04ceb17c
DK
60402010-04-14 Doug Kwan <dougkwan@google.com>
6041
6042 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6043 for local symbol recounting if we remove a section due to ICF.
6044 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6045 there are no regular objects in input.
6046
153e7da4
DK
60472010-04-13 Doug Kwan <dougkwan@google.com>
6048
6049 * arm.cc (Arm_input_section::set_final_data_size): Compute
6050 accurate final data size instead of using current data size.
6051
4dbd9faf
DK
60522010-04-09 Doug Kwan <dougkwan@google.com>
6053
6054 * layout.cc (Layout::choose_output_section): Handle script section
6055 types.
6056 (Layout::make_output_section_for_script): Add section type parameter.
6057 Handle script section types.
6058 * layout.h (Layout::make_output_section_for_script): Add section
6059 type parameter.
6060 * output.cc (Output_section::Output_section): Initialize data member
6061 is_noload_.
6062 (Output_section::do_reset_address_and_file_offset): Do not set address
6063 to 0 if section is a NOLOAD section.
6064 * output.h (Output_section::is_noload): New method.
6065 (Output_section::set_is_noload): Ditto.
6066 (Output_section::is_noload_): New data member.
6067 * script-c.h (Script_section_type): New enum type.
6068 (struct Parser_output_section_header): Add new file section_type.
6069 * script-sections.cc (Sections_element::output_section_name): Add
6070 parameter for returning script section type.
6071 (Output_section_definition::output_section_name): Ditto.
6072 (Output_section_definition::section_type)P; New method.
6073 (Output_section_definiton::script_section_type_name): Ditto.
6074 (Output_section_definition::script_section_type_): New data member.
6075 (Output_section_definition::Output_section_definition): Initialize
6076 data member Output_section_definition::script_section_type_.
6077 (Output_section_definition::create_sections): Pass script section type
6078 to Layout::make_output_section_for_script.
6079 (Output_section_definition::output_section_name): Return script
6080 section type to caller.
6081 (Output_section_definition::set_section_address): Do not advance
6082 dot value and load address if section type is NOLOAD. Set address
6083 of NOLOAD sections regardless of section flags.
6084 (Output_section_definition::print): Print section type if it is
6085 not SCRIPT_SECTION_TYPE_NONE.
6086 (Output_section_definition::section_type): New method.
6087 (Output_section_definition::script_section_type_name): Ditto.
6088 (Script_sections::output_section_name): Add new parameter
6089 PSECTION_TYPE for returning script section type. Pass it to
6090 section elements. Handle discard sections.
6091 (Sort_output_sections::operator()): Handle NOLOAD sections.
6092 * script-sections.h (Script_sections::Section_type): New enum type.
2e702c99 6093 (Script_sections::output_section_name): Add a new parameter for
4dbd9faf
DK
6094 returning script section type.
6095 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6096 INFO and NOLOAD.
6097 * yyscript.y (union): Add new field SECTION_TYPE.
6098 (COPY, DSECT, INFO, NOLOAD): New tokens.
6099 (opt_address_and_section_type): Change type to output_section_header.
6100 (section_type): New non-terminal
6101 (section_header): Handle section type.
2253bfba 6102 (opt_address_and_section_type): Return section type value.
4dbd9faf 6103
721ea635
L
61042010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6105
6106 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6107 * testsuite/plugin_common_test_2.c (foo): Likewise.
6108
6bf924b0
DK
61092010-04-08 Doug Kwan <dougkwan@google.com>
6110
6111 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6112 Output_merge_data.
6113 * output.cc (Output_section::add_merge_input_section): Simplify
6114 code and return status of Output_merge_base::add_input_section.
e1df38aa 6115 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
6116 returns true.
6117
24af6f92
DK
61182010-04-07 Doug Kwan <dougkwan@google.com>
6119
6120 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6121 if section is marked as containing instructions but has no mapping
6122 symbols.
6123 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6124 correct section index.
6125 (Arm_relobj::find_linked_text_section): Ditto.
6126
00698fc5
CC
61272010-04-07 Cary Coutant <ccoutant@google.com>
6128
6129 * archive.cc (include_member): Destroy Read_symbols_data object before
6130 releasing file.
6131 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6132 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6133 (Read_symbols_data::~Read_symbols_data) New destructor.
6134 (Section_relocs::Section_relocs) New constructor.
6135 (Section_relocs::~Section_relocs) New destructor.
6136 (Read_relocs_data::Read_relocs_data) New constructor.
6137 (Read_relocs_data::~Read_relocs_data) New destructor.
6138 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6139 pointers to NULL after deleting.
6140
7296d933
DK
61412010-04-07 Doug Kwan <dougkwan@google.com>
6142
6143 * arm.cc: Replace "endianity" with "endianness" in comments.
6144 (Arm_exidx_cantunwind): Ditto.
6145 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6146 (Arm_relobj::merge_flags_and_attributes): New method.
6147 (Arm_relobj::merge_flags_and_attributes_): New data member.
6148 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6149 (Arm_relobj::scan_sections_for_stubs): Ditto.
6150 (Arm_relobj::do_read_symbols): Check to see if we really want to
6151 merge processor-specific flags and attributes. Exit early if
6152 an object is empty except for section names and the undefined symbol.
6153 (Target_arm::do_finalize_sections): Move check for ELF format to
6154 Arm_relobj::do_read_symbols. Merge processor specific flags and
6155 attributes from a regular object only when we have determined that
6156 it is aapropriate. Do not create an .ARM.attributes section in
6157 output if there is no regular input object.
6158 (Target_arm::merge_processor_specific_flags): Check
6159 --warn-mismatch before printing any error.
6160 (Target_arm::merge_object_attributes): Ditto.
6161 * gold.cc (queue_middle_tasks): Handle the case in which there is
6162 no regular object in input.
6163 * options.cc (General_options::parse_EB): New method.
6164 (General_options::parse_EL): Same.
6165 (General_options::General_options): Initialize endianness_.
6166 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6167 New options.
6168 (General_options::Endianness): New enum.
6169 (General_options::endianness): New method.
6170 (General_options::endianness_): New data member.
6171 * parameters.cc (Parameters::set_options): Check target endianness.
6172 (Parameters::set_target_once): Ditto.
6173 (Parameters::check_target_endianness): New method.
6174 (parameters_force_valid_target): If either -EL or -EB is specified,
6175 use it to define endianness of default target.
6176 * parameters.h (Parameters::check_target_endianness): New method
6177 declaration.
6178 * target.h (class Target): Change "endianity" to "endianness"
6179 in comments.
6180
efc8d4f2
RW
61812010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6182
6183 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6184 * configure: Regenerate.
6185 * Makefile.in: Regenerate.
6186 * testsuite/Makefile.in: Regenerate.
6187
be234d88
CC
61882010-04-06 Cary Coutant <ccoutant@google.com>
6189
6190 gcc PR lto/42757
6191 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6192 prevailing definitions of common symbols.
6193 * testsuite/plugin_test_6.sh: New test case.
6194 * testsuite/plugin_common_test_1.c: New test case.
6195 * testsuite/plugin_common_test_2.c: New test case.
6196 * testsuite/Makefile.am (plugin_test_6): New test case.
6197 * testsuite/Makefile.in: Regenerate.
6198
bd32c6bd
NC
61992010-04-06 Nick Clifton <nickc@redhat.com>
6200
6201 * po/vi.po: New Vietnamese translation.
6202
323c532f
DK
62032010-03-30 Doug Kwan <dougkwan@google.com>
6204
6205 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6206
4fcd97eb
DK
62072010-03-25 Doug Kwan <dougkwan@google.com>
6208
6209 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6210 to avoid a conversion warning on a 32-bit host.
6211
4ebf39db
ILT
62122010-03-24 Ian Lance Taylor <iant@google.com>
6213
6214 * testsuite/script_test_3.t: Add a TLS segment.
6215 * testsuite/Makefile.am (check_PROGRAMS): Add
6216 tls_phdrs_script_test.
6217 (tls_phdrs_script_test_SOURCES): Define.
6218 (tls_phdrs_script_test_DEPENDENCIES): Define.
6219 (tls_phdrs_script_test_LDFLAGS): Define.
6220 (tls_phdrs_script_test_LDADD): Define.
6221 * testsuite/Makefile.in: Rebuild.
6222
4a599bdd
CC
62232010-03-23 Cary Coutant <ccoutant@google.com>
6224
6225 * fileread.cc (find_or_make_view): Fix comment.
6226
6c93b22c
ILT
62272010-03-23 Ian Lance Taylor <iant@google.com>
6228
6229 * script-sections.cc (class Orphan_section_placement): Define
6230 PLACE_TLS and PLACE_TLS_BSS.
6231 (Orphan_section_placement::Orphan_section_placement): Initialize
6232 new places.
6233 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6234 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6235 (tls_script_test_SOURCES): Define.
6236 (tls_script_test_DEPENDENCIES): Define.
6237 (tls_script_test_LDFLAGS): Define.
6238 (tls_script_test_LDADD): Define.
6239 * testsuite/Makefile.in: Rebuild.
6240
a2c7281b
DK
62412010-03-22 Doug Kwan <dougkwan@google.com>
6242
6243 * arm.cc (Arm_relocate_functions::abs8,
6244 Arm_relocate_functions::abs16): Use correct check for overflow
6245 specified in the ARM ELF specs.
6246 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6247 target of a BLX instruction specially.
6248 (Reloc_stub::stub_type_for_reloc): Ditto.
6249 (Relocate::relocate): Use symbolic names instead of numeric relocation
6250 codes to report error.
6251 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6252 workaround.
6253 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6254 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6255 thumb2_blx_out_of_range.stdout
6256 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6257 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6258 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6259 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6260 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6261 thumb2_blx_in_range, thumb2_blx_in_range.o,
6262 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6263 thumb2_blx_out_of_range.o): New rules.
2e702c99 6264 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
a2c7281b
DK
6265 thumb2_blx_in_range and thumb2_blx_out_of_range.
6266 * testsuite/Makefile.in: Regenerate.
6267 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6268 * testsuite/thumb_blx_in_range.s: New file.
6269 * testsuite/thumb_blx_out_of_range.s: New file.
6270
b0193076
RÁE
62712010-03-22 Rafael Espindola <espindola@google.com>
6272
6273 * archive.cc (Should_include): Move to archive.h.
6274 (should_include_member): Make it a member of Archive.
6275 (Lib_group): New.
6276 (Add_lib_group_symbols): New.
6277 * archive.h: Include options.h.
6278 (Archive_member): Moved from Archive.
6279 (Should_include): Moved from archive.cc.
6280 (Lib_group): New.
6281 (Add_lib_group_symbols): New.
6282 * dynobj.cc (do_should_include_member): New.
6283 * dynobj.h (do_should_include_member): New.
6284 * gold.cc (queue_initial_tasks): Update call to queue.
6285 * main.cc (main): Print lib group stats.
6286 * object.cc (do_should_include_member): New.
6287 * object.h: Include archive.h.
6288 (Object::should_include_member): New.
6289 (Object::do_should_include_member): New.
6290 (Sized_relobj::do_should_include_member): New.
6291 * options.cc (General_options::parse_start_lib): New.
6292 (General_options::parse_end_lib): New.
6293 (Input_arguments::add_file): Handle lib groups.
6294 (Input_arguments::start_group): Check we are not in a lib.
6295 (Input_arguments::start_lib): New.
6296 (Input_arguments::end_lib): New.
6297 * options.h (General_options): Add start_lib and end_lib.
6298 (Input_argument::lib_): New.
6299 (Input_argument::lib): New.
6300 (Input_argument::is_lib): New.
6301 (Input_file_lib): New.
6302 (Input_arguments::in_lib_): New.
6303 (Input_arguments::in_lib): New.
6304 (Input_arguments::start_lib): New.
6305 (Input_arguments::end_lib_): New.
6306 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6307 in unused members as preempted.
6308 (Sized_pluginobj::do_should_include_member): New.
6309 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6310 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6311 return the blocker.
6312 (Read_symbols::do_whole_lib_group): New.
6313 (Read_symbols::do_lib_group): New.
6314 (Read_symbols::do_read_symbols): Handle lib groups.
6315 (Read_symbols::get_name): Handle lib groups.
6316 * readsyms.h (Read_symbols): Add an archive member pointer.
6317 (Read_symbols::do_whole_lib_group): New.
6318 (Read_symbols::do_lib_group): New.
6319 (Read_symbols::member_): New.
6320 * script.cc (read_input_script): Update call to queue_soon.
6321
d099120c
DK
63222010-03-19 Doug Kwan <dougkwan@google.com>
6323
6324 * arm.cc (Stub_table::Stub_table): Initialize new data members
6325 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6326 (Stub_table::add_reloc_stub): Assign stub offset and update
6327 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6328 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6329 New data members.
2e702c99 6330 (Stub_table::update_data_size_and_addralign): Use
d099120c
DK
6331 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6332 instead of going over all reloc stubs.
2e702c99 6333 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
d099120c
DK
6334 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6335 Stringpool_template::offset_ to size of Stringpool_char.
2e702c99 6336 (Stringpool_template::new_key_offset): Remove code to initialize
d099120c
DK
6337 Stringpool_template::offset_.
6338 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6339 Stringpool_template::offset_ to zero.
6340
1aa37384
DK
63412010-03-15 Doug Kwan <dougkwan@google.com>
6342
6343 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6344 offset_.
6345 (Stringpool_template::new_key_offset): New method.
6346 (Stringpool_template::add_string): Assign offsets when adding new
6347 strings.
6348 (Stringpool_template::set_string_offsets): Do not set string offsets
6349 when not optimizing.
6350 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6351 member size_.
2e702c99
RM
6352 (Chunked_vector::clear): Clear size_.
6353 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6354 (Chunked_vector::size): Return size_.
6355 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 6356 (Chunked_vector::size_): New data member.
1aa37384
DK
6357 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6358 (Stringpool_template::new_key_offset): New method declaration.
6359 (Stringpool_template::offset_): New data member.
6360
b672b057
RÁE
63612010-03-15 Rafael Espindola <espindola@google.com>
6362
6363 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6364 Add_symbols' constructor.
6365 * readsyms.h (Add_symbols): Remove the input_group member.
6366
b6848d3c
ILT
63672010-03-10 Ian Lance Taylor <iant@google.com>
6368
6369 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6370 target to ask whether a reference to a symbol requires a stack
6371 split.
6372 * target.h (Target::is_call_to_non_split): New function.
6373 (Target::do_is_call_to_non_split): Declare virtual function.
6374 * target.cc: Include "symtab.h".
6375 (Target::do_is_call_to_non_split): New function.
6376 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6377
a2a5469e
CC
63782010-03-10 Cary Coutant <ccoutant@google.com>
6379
6380 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6381 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6382 (File_read::open[2]): Add whole_file_view_ to list of views.
6383 (File_read::make_view): Remove test of whole_file_view_.
6384 (File_read::find_or_make_view): Create whole_file_view_ if
6385 necessary.
6386 (File_read::clear_views): Replace bool parameter with enum;
6387 adjust all callers. Don't delete views with permanent data;
6388 do delete cached views and views from archives if
6389 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6390 if clearing the corresponding view.
6391 * fileread.h (File_read::Clear_views_mode): New enum.
6392 (File_read::View::is_permanent_view): New method.
6393 (File_read::clear_views): Replace bool parameter
6394 with enum; adjust all callers.
6395 * options.h (General_options): Change keep_files_mapped option;
6396 add map_whole_files.
6397 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6398 releasing the file.
6399 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6400 the file.
6401
8861f32b
DM
64022010-03-10 David S. Miller <davem@davemloft.net>
6403
6404 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6405
d62d0f5f
ST
64062010-03-09 Sriraman Tallam <tmsriram@google.com>
6407
6408 * icf.cc (get_section_contents): Add '@' marker after processing the
6409 merge reloc.
6410
9177756d
DK
64112010-03-08 Doug Kwan <dougkwan@google.com>
6412
6413 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6414 due to a conversion warning.
6415 (Arm_relobj::update_output_local_symbol_count): Check for local
6416 symbol with unset output index.
6417
9e9e071b
ILT
64182010-03-05 Ian Lance Taylor <iant@google.com>
6419
6420 * options.h (class General_options): Add --spare-dynamic-tags.
6421 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6422 --spare-dynamic-tags.
6423
a81ee015
ILT
64242010-03-05 Ian Lance Taylor <iant@google.com>
6425
6426 * incremental.cc: Include "libiberty.h".
6427
44ec90b9
RO
64282010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6429
6430 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6431 function, is_info_ member.
6432 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6433 (Versions::Versions): Update caller.
6434 (Versions::define_base_version): Likewise.
6435 (Versions::add_def): Likewise.
6436
0897ed3b
ST
64372010-03-03 Sriraman Tallam <tmsriram@google.com>
6438
6439 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6440 (Scan::possible_function_pointer_reloc): New function.
6441 (Scan::local_reloc_may_be_function_pointer): Change to call
6442 possible_function_pointer_reloc.
6443 (Scan::global_reloc_may_be_function_pointer): Ditto.
6444 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6445 relocations in ".data.rel.ro._ZTV" section.
6446 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6447 * testsuite/icf_safe_so_test.cc: Ditto.
6448 * testsuite/icf_safe_test.cc: Ditto.
6449 * testsuite/icf_safe_test.sh: Ditto.
6450
d3bbad62
ILT
64512010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6452 Ian Lance Taylor <iant@google.com>
6453
6454 * target-reloc.h (relocate_section): Check the symbol table index
6455 for -1U before setting the local symbol index.
6456 (scan_relocatable_relocs): If copying the relocation, record that
6457 the local symbol is required.
6458 * object.h (Symbol_value::is_output_symtab_index_set): New
6459 function.
6460 (Symbol_value::may_be_discarded_from_output_symtab): New
6461 function.
6462 (Symbol_value::has_output_symtab_entry): New function.
6463 (Symbol_value::needs_output_symtab_entry): Remove.
6464 (Symbol_value::output_symtab_index): Make sure the symbol index is
6465 set.
6466 (Symbol_value::set_output_symtab_index): Make sure the symbol
6467 index is not set. Make sure the new index is valid.
6468 (Symbol_value::set_must_have_output_symtab_entry): New function.
6469 (Symbol_value::has_output_dynsym_entry): New function.
6470 (Symbol_value::set_output_dynsym_index): Make sure the new index
6471 is valid.
6472 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6473 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6474 local symbol if permitted.
6475 (Sized_relobj::do_finalize_local_symbols): Call
6476 is_output_symtab_index_set rather than needs_output_symtab_entry.
6477 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6478 rather than needs_output_symtab_entry. Call
6479 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6480 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6481 is_output_symtab_index_set rather than needs_output_symtab_entry.
6482 * testsuite/discard_locals_relocatable_test.c: New file.
6483 * testsuite/discard_locals_test.sh: Test -r.
6484 * testsuite/Makefile.am (check_DATA): Add
6485 discard_locals_relocatable_test1.syms,
6486 discard_local_relocatable_test2.syms.
6487 (MOSTLYCLEANFILES): Likewise. Also add
6488 discard_locals_relocatable_test1.lout and
6489 discard_locals_relocatable_test2.out.
6490 (discard_locals_relocatable_test1.syms): New target.
6491 (discard_locals_relocatable_test.o): New target.
6492 (discard_locals_relocatable_test1.out): New target.
6493 (discard_locals_relocatable_test2.syms): New target.
6494 (discard_locals_relocatable_test2.out): New target.
6495 (various): Add missing ../ld-new dependencies.
6496 * testsuite/Makefile.in: Rebuild.
6497
7e8ccf26
NC
64982010-03-03 Nick Clifton <nickc@redhat.com>
6499
6500 * po/fi.po: New Finnish translation.
6501
2a0ff005
DK
65022010-03-01 Doug Kwan <dougkwan@google.com>
6503
6504 * layout.cc (Layout::Layout): Force section types of .init_array*,
6505 .preinit_array* and .fini_array* sections.
6506 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6507 Fix check of return value of std::string::find.().
6508 (Output_section::Input_section_sort_compare::operator()): Remove
6509 comment about .init_array.
6510 (Output_section::Input_section_sort_init_fini_compare::operator()):
6511 New method.
6512 (Output_section::sort_attached_input_sections): Handle .init_array
6513 and .fini_array specially.
6514 * output.h (Output_section::Inut_section_sort_compare): Update
6515 comment.
6516 (Output_section::Input_section_sort_init_fini_compare): New struct.
6517
c3e4ae29
DK
65182010-02-26 Doug Kwan <dougkwan@google.com>
6519
6520 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6521 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6522 * testsuite/debug_msg.sh: Avoid matching source line number for
6523 use of global variable undef_int.
6524
2fd9ae7a
DK
65252010-02-26 Doug Kwan <dougkwan@google.com>
6526
6527 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6528 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6529 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6530 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6531 * options.cc (General_options::General_options): Initialize member
6532 fix_v4bx_.
6533 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6534 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6535 and rm_no_fix_v4bx.stdout
6536 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6537 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6538 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6539 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6540 and arm_no_fix_v4bx.
6541 * Makefile.in: Regenerate.
6542 * testsuite/arm_fix_v4bx.s: New file.
6543 * testsuite/arm_fix_v4bx.sh: Ditto.
6544
67ec7d0b
DK
65452010-02-24 Doug Kwan <dougkwan@google.com>
6546
6547 * arm.cc (Target_arm::got_section): Make the .got section the first
6548 non RELRO section in the data segment.
6549 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6550 suffixes of section names.
6551
10165461
DK
65522010-02-24 Doug Kwan <dougkwan@google.com>
6553
6554 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6555 flags and attributes merging if an input file is a binary file.
6556 * fileread.cc (Input_file::open): Record format of original file.
6557 * fileread.h (Input_file::Format): New enum type.
2e702c99 6558 (Input_file::Input_file): Initialize data member format_.
10165461
DK
6559 (Input_file::format): New method definition.
6560 (Input_file::format_):: New data member.
6561
4a54abbb
DK
65622010-02-24 Doug Kwan <dougkwan@google.com>
6563
6564 * arm.cc (Arm_output_data_got): New class.
6565 (ARM_TCB_SIZE): New constant
6566 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6567 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6568 If user uses a script with a SECTIONS clause, issue only a warning
6569 for a misplaced EXIDX input section. Otherwise, issue an error.
2e702c99 6570 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4a54abbb
DK
6571 garbage collection.
6572 (Target_arm::got_mode_index_entry): Handle static linking.
6573 (Target_arm::Scan::local): Ditto.
6574 (Target_arm::Scan::global): Ditto.
6575 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6576 all incorrectly implemented relocations.
e1df38aa 6577 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
6578 Arm_output_section::fix_exidx_coverage.
6579 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6580 from ".ARM.exidx." and ".ARM.extab.".
6581
ca419a6f
ILT
65822010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6583
6584 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6585 section if it does not already exist.
6586 * attributes.cc (Attributes_section_data::Attributes_section_data):
6587 Don't crash if size is zero.
6588
135b9c78
ILT
65892010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6590 Ian Lance Taylor <iant@google.com>
6591
6592 * gold.cc (queue_middle_tasks): If no input files were opened,
6593 exit.
6594 * workqueue.h (Task_function::Task_function): Assert that there is
6595 a blocker.
6596
bb0bfe4f
DK
65972010-02-22 Doug Kwan <dougkwan@google.com>
6598
6599 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6600 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6601 types to avoid warnings due to different uint64_t implementations
6602 on different hosts.
6603
2a2b6d42
DK
66042010-02-21 Doug Kwan <dougkwan@google.com>
6605
6606 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6607 handling of the maximum backward branch offset.
2e702c99 6608 (Arm_relocate_functions::thumb_branch_common): Ditto.
2a2b6d42
DK
6609 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6610 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 6611 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
6612 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6613 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6614 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6615 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6616 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6617 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6618 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6619 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6620 thumb2_bl_out_of_range.o): New rules.
6621 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6622 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6623 thumb2_bl_out_of_range
6624 * testsuite/Makefile.in: Regenerate.
6625 * testsuite/arm_bl_in_range.s: New file.
6626 * testsuite/arm_bl_out_of_range.s: Ditto.
6627 * testsuite/arm_branch_in_range.sh: Ditto.
6628 * testsuite/arm_branch_range.t: Ditto.
6629 * testsuite/thumb2_branch_range.t: Ditto.
6630 * testsuite/thumb_bl_in_range.s: Ditto.
6631 * testsuite/thumb_bl_out_of_range.s: Ditto.
6632 * testsuite/thumb_branch_range.t: Ditto.
6633
b487ad64
ST
66342010-02-20 Sriraman Tallam <tmsriram@google.com>
6635
6636 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6637 Add reloc offset information.
6638 * icf.cc (get_section_contents): Change iterators to point to the new
6639 vectors. Add reloc offset information to the contents.
6640 * icf.h (Icf::Sections_reachable_info): New typedef.
6641 (Icf::Sections_reachable_list): New typedef.
6642 (Icf::Offset_info): New typedef.
6643 (Icf::Reloc_info): New struct typedef.
6644 (Icf::Reloc_info_list): New typedef.
6645 (Icf::symbol_reloc_list): Delete method.
6646 (Icf::addend_reloc_list): Delete method.
6647 (Icf::section_reloc_list): Delete method.
6648 (Icf::reloc_info_list): New method.
6649 (Icf::reloc_info_list_): New member.
6650
f96accdf
DK
66512010-02-19 Doug Kwan <dougkwan@google.com>
6652
6653 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6654 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6655 * arm.cc (Arm_relocation_functions): New forward declaration.
6656 (Target_arm::Target_arm): Initialize new data members
6657 got_mod_index_offset_ and tls_base_symbol_defined_.
6658 (Target_arm::Relocate::relocate_tls): New method.
6659 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6660 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6661 New methods.
2e702c99 6662 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
f96accdf
DK
6663 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6664 (Target_arm::got_mod_index_offset_,
6665 Target_arm::tls_base_symbol_defined_): New data members.
6666 (Target_arm::Scan::local, Target::Scan::global,
6667 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6668 relocations.
6669
c8761b9a
DK
66702010-02-18 Doug Kwan <dougkwan@google.com>
6671
6672 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6673 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6674 text section as a parameter becuase some broken tools may not set
6675 the link in section header.
6676 (Target_arm::has_got_section): New method.
6677 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6678 without any mapping symbol as data only. Remove warning.
6679 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6680 link in its section header, try to discover the link by inspecting the
6681 REL31 relocation at the beginning of the section.
6682 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6683 in error message.
6684 (Target_arm::Scan::global): Treat any reference to the symbol
6685 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6686
21bb3914
ST
66872010-02-12 Sriraman Tallam <tmsriram@google.com>
6688
6689 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6690 (Scan::global_reloc_may_be_function_pointer): New function.
6691 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6692 (Scan::global_reloc_may_be_function_pointer): New function.
6693 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6694 (Scan::global_reloc_may_be_function_pointer): New function.
6695 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6696 (Scan::global_reloc_may_be_function_pointer): New function.
6697 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6698 (Scan::global_reloc_may_be_function_pointer): New function.
6699 (Scan::possible_function_pointer_reloc): New function.
6700 (Target_x86_64::can_check_for_function_pointers): New function.
6701 * gc.h (gc_process_relocs): Scan relocation types to determine if
6702 function pointers were taken for targets that support it.
6703 * icf.cc (Icf::find_identical_sections): Include functions for
6704 folding in safe ICF whose pointer is not taken.
6705 * icf.h (Secn_fptr_taken_set): New typedef.
6706 (fptr_section_id_): New member.
6707 (section_has_function_pointers): New function.
6708 (set_section_has_function_pointers): New function.
6709 (check_section_for_function_pointers): New function.
6710 * options.h: Fix comment for safe ICF option.
6711 * target.h (can_check_for_function_pointers): New function.
6712 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6713 Modify icf_safe_test for X86-64.
6714 * testsuite/Makefile.in: Regenerate.
6715 * testsuite/icf_safe_so_test.cc: New file.
6716 * testsuite/icf_safe_so_test.sh: New file.
6717 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6718 (main): Change to take pointer to function kept_func_3.
6719 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6720 folding is done correctly for X86-64.
6721
0da6fa6c
DM
67222010-02-12 David S. Miller <davem@davemloft.net>
6723
6724 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6725 is_symbolless parameter.
6726 (Output_reloc<SHT_REL>::is_symbolless): New.
6727 (Output_reloc<SHT_REL>::is_symbolless_): New.
6728 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6729 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6730 (Output_reloc<SHT_RELA>::is_symbolless): New.
6731 (Output_data_reloc::add_global): Handle is_symbolless.
6732 (Output_data_reloc::add_global_relative): Likewise.
6733 (Output_data_reloc::add_local): Likewise.
6734 (Output_data_reloc::add_local_relative): Likewise.
6735 (Output_data_reloc::add_symbolless_global_addend): New.
6736 (Output_data_reloc::add_symbolless_local_addend): New.
6737 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6738 is_symbolless.
6739 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6740 instead of ->is_relative_
6741 (Output_reloc::write): Likewise.
6742 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6743 (Output_reloc::write_rel): Simplify.
6744
6745 * sparc.cc (Target_sparc::Scan::local): Use
6746 ->add_symbolless_local_addend as needed.
6747 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6748 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6749 based upon relocation offset.
6750
e4782e83
DK
67512010-02-11 Doug Kwan <dougkwan@google.com>
6752
6753 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6754 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6755 beginning of function.
6756 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6757 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6758 parameter is_32bit in calls to should_apply_static_reloc.
6759 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6760 (check_DATA): Add arm_abs_global.stdout.
6761 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6762 arm_abs_global.stdout): New rules.
6763 (MOSTLLYCLEANFILES): Add arm_abs_global
6764 * Makefile.in: Regenerate.
6765 * testsuite/arm_abs_global.s: New file.
6766 * testsuite/arm_abs_global.sh: Ditto.
6767 * testsuite/arm_abs_lib.s: Ditto.
6768
93ceb764
ILT
67692010-02-11 Ian Lance Taylor <iant@google.com>
6770
6771 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6772 Read_relocs task.
6773 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6774 Allocate_commons_task first.
6775 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6776 task, rather than symtab_lock_.
6777 (Gc_process_relocs::~Gc_process_relocs): New function.
6778 (Gc_process_relocs::is_runnable): Check this_blocker_.
6779 (Gc_process_relocs::locks): Use next_blocker_ rather than
6780 blocker_.
6781 (Scan_relocs::~Scan_relocs): New function.
6782 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6783 symtab_lock_.
6784 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6785 next_blocker_.
6786 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6787 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6788 constructor accordingly.
6789 (class Gc_process_relocs): Likewise.
6790 (class Scan_relocs): Likewise.
6791 * common.h (class Allocate_commons_task): Remove symtab_lock_
6792 field, and corresponding constructor parameter.
6793 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6794 symtab_lock_.
6795 (Allocate_commons_task::locks): Likewise.
6796
114dfbe1
ILT
67972010-02-11 Ian Lance Taylor <iant@google.com>
6798
6799 * gold-threads.h (class Once): Define.
6800 (class Initialize_lock): Rewrite as child of Once.
6801 * gold-threads.cc (class Once_initialize): Define.
6802 (once_pointer_control): New static variable.
6803 (once_pointer, once_arg): New static variables.
6804 (c_run_once): New static function.
6805 (Once::Once, Once::run_once, Once::internal_run): New functions.
6806 (class Initialize_lock_once): Remove.
6807 (initialize_lock_control): Remove.
6808 (initialize_lock_pointer): Remove.
6809 (initialize_lock_once): Remove.
6810 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6811 (Initialize_lock::initialize): Rewrite.
6812 (Initialize_lock::do_run_once): New function.
6813 * archive.cc (Archive::interpret_header): Only clear name if it is
6814 not already empty.
6815 * fileread.cc: Include "gold-threads.h"
6816 (file_counts_lock): New static variable.
6817 (file_counts_initialize_lock): Likewise.
6818 (File_read::release): Only increment counts when using --stats.
6819 Use a lock around the increment.
6820 * parameters.cc (class Set_parameters_target_once): Define.
6821 (set_parameters_target_once): New static variable.
6822 (Parameters::Parameters): Move here from parameters.h.
6823 (Parameters::set_target): Rewrite.
6824 (Parameters::set_target_once): New function.
6825 (Parameters::clear_target): Move here and rewrite.
6826 * parameters.h (class Parameters): Update declarations. Add
6827 set_parameters_target_once_ field.
6828 (Parameters::Parameters): Move to parameters.cc.
6829 (Parameters::clear_target): Likewise.
6830 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6831 task.
6832 (Start_group::~Start_group): New function.
6833 (Start_group::is_runnable): New function.
6834 (Start_group::locks, Start_group::run): New functions.
6835 (Finish_group::run): Change saw_undefined to size_t.
6836 * readsyms.h (class Start_group): Define.
6837 (class Finish_group): Change saw_undefined_ field to size_t.
6838 (Finish_group::Finish_group): Remove saw_undefined and
6839 this_blocker parameters. Change all callers.
6840 (Finish_group::set_saw_undefined): New function.
6841 (Finish_group::set_blocker): New function.
6842 * symtab.h (class Symbol_table): Change saw_undefined to return
6843 size_t. Change saw_undefined_ field to size_t.
6844 * target-select.cc (Set_target_once::do_run_once): New function.
6845 (Target_selector::Target_selector): Initialize set_target_once_
6846 field. Don't initialize lock_ and initialize_lock_ fields.
6847 (Target_selector::instantiate_target): Rewrite.
6848 (Target_selector::set_target): New function.
6849 * target-select.h (class Set_target_once): Define.
6850 (class Target_selector): Update declarations. Make
6851 Set_target_once a friend. Remove lock_ and initialize_lock_
6852 fields. Add set_target_once_ field.
6853
fa17a3f4
ILT
68542010-02-10 Ian Lance Taylor <iant@google.com>
6855
6856 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6857 queueing any tasks.
6858 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6859 (queue_middle_tasks): Add all blockers before queueing any tasks.
6860 (queue_final_tasks): Likewise.
6861 * token.h (Task_token::add_blockers): New function.
6862 * object.h (Input_objects::number_of_relobjs): New function.
6863
c7177d31
ILT
68642010-02-10 Ian Lance Taylor <iant@google.com>
6865
5de0e392
ILT
6866 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6867 shared, not if not position independent.
6868 * x86_64.cc (Relocate::relocate_tls): Likewise.
6869 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6870 (tls_pie_pic_test): New target.
6871 * testsuite/Makefile.in: Rebuild.
6872
c7177d31
ILT
6873 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6874 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6875 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6876 * testsuite/Makefile.in: Rebuild.
6877
684b268a
DM
68782010-02-09 David S. Miller <davem@davemloft.net>
6879
6880 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6881 R_SPARC_RELATIVE using ->add_local_relative().
6882 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6883
612a8d3d
DM
6884 * output.h (Output_data_dynamic::add_section_size): New method
6885 that takes two Output_data objects.
6886 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6887 entry param. Handle it in initializers.
6888 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6889 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6890 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6891 arg.
6892 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6893 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6894 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6895 for dynrel_includes_plt.
6896 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6897 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6898 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6899 before .rela.plt
6900 (Target_sparc::do_finalize_sections): Update to pass true for
6901 dynrel_includes_plt.
6902 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6903 output before .rela.plt
6904 (Target_powerpc::do_finalize_sections): Update to pass true for
6905 dynrel_includes_plt when 32-bit.
6906
cb1be87e
DK
69072010-02-08 Doug Kwan <dougkwan@google.com>
6908
6909 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6910 method.
6911 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6912 Arm_relobj::scan_section_for_cortex_a8_stubs,
6913 Arm_relobj::do_relocation_section): Instead of calling
6914 Output_section::output_address, use faster
6915 Arm_relobj::simple_input_section_output_address.
6916
705b5121
DM
69172010-02-08 David S. Miller <davem@davemloft.net>
6918
6919 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6920 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6921 relocation helper function.
6922
024c4466
DM
6923 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6924 just like R_SPARC_GOT{10,13,22}.
6925 (Target_sparc::Scan::local): Likewise.
6926 (Target_sparc::Relocate:relocate): Likewise.
6927
9109c078
ILT
69282010-02-06 Ian Lance Taylor <iant@google.com>
6929
6930 * configure.ac: Rewrite targetobjs duplicate removal code to use
6931 only shell constructs.
6932 * configure: Rebuild.
6933
cf846138
DK
69342010-02-05 Doug Kwan <dougkwan@google.com>
6935
6936 PR 11247
6937 * arm.cc (Arm_relobj::section_is_scannable): New method.
6938 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6939 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6940
6cfaf60b
DK
69412010-02-04 Doug Kwan <dougkwan@google.com>
6942
6943 PR 11247
6944 * arm-reloc-property.cc (cstdio): Include.
6945 * configure.ac (targetobjs): Remove duplicates.
6946 * configure: Regenerate.
6947 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6948 big and little endian version for a given address size.
6949
5c57f1be
DK
69502010-02-03 Doug Kwan <dougkwan@google.com>
6951
6952 * arm-reloc-property.cc
6953 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6954 definition.
6955 * arm-reloc-property.h
6956 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6957 New method definition.
6958 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6959 declaration.
6960 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6961 overflow to N.
6962 (GOT_PREL): Change implemented to Y.
6963 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6964 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6965 (Arm_relocate_functions::movw_abs_nc): Remove method.
6966 (Arm_relocate_functions::movt_abs): Ditto.
6967 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6968 (Arm_relocate_functions::thm_movt_abs): Ditto.
6969 (Arm_relocate_functions::movw_rel_nc): Ditto.
6970 (Arm_relocate_functions::movw_rel): Ditto.
6971 (Arm_relocate_functions::movt_rel): Ditto.
6972 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6973 (Arm_relocate_functions:thm_movw_rel): Ditto.
6974 (Arm_relocate_functions:thm_movt_rel): Ditto.
6975 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6976 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6977 New method definitions.
6978 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6979 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6980 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6981 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6982 (Target_arm::Relocate::relocate): Check for non-static or
6983 unimplemented relocation code and exit early. Change calls to
6984 Target_arm::reloc_uses_thumb_bit and
6985 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6986 instead. Refactor code to handle similar relocations to increase
6987 code sharing. Remove check for unsupported relocation code in switch
6988 statement.
6989 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6990 relocation property table to find out size. Change error message to
6991 print out the name of a relocation code instead of the numeric value.
6992 (Target_arm::scan_reloc_for_stub): Use relocation property table
6993 instead of calling Target_arm::reloc_uses_thumb_bit().
6994
218c5831
DK
69952010-02-02 Doug Kwan <dougkwan@google.com>
6996
6997 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6998 types of relaxed input section.
6999
0d31c79d
DK
70002010-02-02 Doug Kwan <dougkwan@google.com>
7001
7002 * Makefile.am (HFILES): Add arm-reloc-property.h.
7003 (DEFFILES): New.
2e702c99
RM
7004 (TARGETSOURCES): Add arm-reloc-property.cc
7005 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
0d31c79d
DK
7006 (libgold_a_SOURCES): $(DEFFILES)
7007 * Makefile.in: Regenerate.
7008 * arm-reloc-property.cc: New file.
7009 * arm-reloc-property.h: New file.
7010 * arm-reloc.def: New file.
7011 * arm.cc: Update comments.
7012 (arm-reloc-property.h): New included header.
7013 (arm_reloc_property_table): New global variable.
7014 (Target_arm::do_select_as_default_target): New method definition.
7015 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7016 arm-reloc-property to targ_extra_obj.
7017 * parameters.cc (set_parameters_target): Call
7018 Target::select_as_default_target().
7019 * target.h (Target::select_as_default_target): New method definition.
7020 (Target::do_select_as_default_target): Same.
7021
546c7457
DK
70222010-02-01 Doug Kwan <dougkwan@google.com>
7023
7024 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7025 first_output_text_section_.
7026 (Arm_exidx_fixup::first_output_text_section): New method definition.
7027 (Arm_exidx_fixup::first_output_text_section_): New data member.
7028 (Arm_exidx_fixup::process_exidx_section): Record the first text
7029 output section seen.
7030 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7031 and entsize in output section header.
7032
11b861d5
DK
70332010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7034
7035 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7036 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7037 (Arm_relocate_functions::thm_alu11): New Method.
7038 (Arm_relocate_functions::thm_pc8): New Method.
7039 (Arm_relocate_functions::thm_pc12): New Method.
7040 (Target_arm::Scan::local): Handle the relocations.
7041 (Target_arm::Scan::global): Likewise.
7042 (Target_arm::Relocate::relocate): Likewise.
7043 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7044
c9a2c125
DK
70452010-01-29 Doug Kwan <dougkwan@google.com>
7046
7047 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7048 of relocation types as ld.
7049
1521477a
DK
70502010-01-29 Doug Kwan <dougkwan@google.com>
7051
7052 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7053 to public.
7054 (Arm_relocate_functions::thumb_branch_common): Ditto.
7055 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7056 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7057 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7058 Arm_relocate_functions::jump24): Remove.
7059 (Target_arm::Relocate::relocate): Adjust code to call
7060 Arm_relocation_functions::arm_branch_common and
7061 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 7062 wrappers. Merge switch-cases together to reduce source code size.
1521477a 7063
e7eca48c
DK
70642010-01-29 Doug Kwan <dougkwan@google.com>
7065
7066 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7067 output_local_symbol_count_needs_update_.
7068 (Arm_relobj::output_local_symbol_count_needs_update,
7069 Arm_relobj::set_output_local_symbol_count_needs_update,
7070 Arm_relobj::update_output_local_symbol_count): New methods.
7071 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7072 member.
7073 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7074 of pointed function as in a R_ARM_PREL31 relocation.
7075 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7076 for output local symbol count updating.
7077 (Target_arm::do_relax): Update output local symbol counts in objects
7078 if necessary.
7079 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7080
02961d7e
ILT
70812010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7082
7083 * arm.cc: Added support for the ARM relocations:
7084 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7085 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7086 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7087 movw_prel_nc).
7088 (Arm_relocate_functions::movw_rel): New method.
7089 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7090 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7091 thm_movw_prel_nc).
7092 (Arm_relocate_functions::thm_movw_rel): New method.
7093 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7094 thm_movt_prel).
7095 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7096 relocations.
7097 (Target_arm::Scan::global): Likewise.
7098 (Target_arm::Relocate::relocate): Likewise.
7099 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7100 Likewise.
7101
b10d2873
ILT
71022010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7103
7104 * arm.cc: Added support for ARM group relocations.
7105 (Target_arm::reloc_needs_sym_origin): New method.
7106 (Arm_relocate_functions::calc_grp_kn): New method.
7107 (Arm_relocate_functions::calc_grp_residual): New method.
7108 (Arm_relocate_functions::calc_grp_gn): New method.
7109 (Arm_relocate_functions::arm_grp_alu): New Method.
7110 (Arm_relocate_functions::arm_grp_ldr): New Method.
7111 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7112 (Arm_relocate_functions::arm_grp_ldc): New Method.
7113 (Target_arm::Scan::local): Handle the ARM group relocations.
7114 (Target_arm::Scan::global): Likewise.
7115 (Target_arm::Relocate::relocate): Likewise.
7116 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7117 Likewise.
7118
2b328d4e
DK
71192010-01-26 Doug Kwan <dougkwan@google.com>
7120
7121 * arm.cc (set): Include.
7122 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7123 pointer type.
2e702c99 7124 (Arm_output_section::Text_section_list): New type.
2b328d4e
DK
7125 (Arm_output_section::append_text_sections_to_list): New method.
7126 (Arm_output_section::fix_exidx_coverage): Ditto.
7127 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
2e702c99 7128 (Arm_relobj::convert_input_section_to_relaxed_section): Use
2b328d4e
DK
7129 Relobj::set_section_offset() instead of
7130 Sized_relobj::invalidate_section_offset().
2e702c99 7131 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
2b328d4e
DK
7132 parameter for section headers. Ignore relocation sections for
7133 unallocated sections and EXIDX sections.
7134 (Target_arm::fix_exidx_coverage): New method.
7135 (Target_arm::output_section_address_less_than): New type.
7136 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7137 linked text section instead of the EXIDX section.
7138 (Arm_output_section::create_stub_group): Add an assertion to check
7139 that this is not an EXIDX output section.
7140 (Arm_output_section::append_text_sections_to_list): New method.
7141 (Arm_output_section::fix_exidx_coverage): Ditto.
7142 (Arm_relobj::scan_sections_for_stubs): Adjust call to
2e702c99 7143 Arm_relobj::section_needs_reloc_stub_scanning.
2b328d4e
DK
7144 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7145 first pass.
7146 (Target_arm::fix_exidx_coverage): New method.
7147 * object.h (Relobj::set_output_section): New method.
7148 (Sized_relobj::invalidate_section_offset): Remove method.
7149 (Sized_relobj::do_invalidate_section_offset): Remove method.
7150 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7151
c7f3c371
DK
71522010-01-25 Doug Kwan <dougkwan@google.com>
7153
7154 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7155 Fix warning due to signed and unsigned comparison on a 32-bit host.
7156
8923b24c
DK
71572010-01-22 Doug Kwan <dougkwan@google.com>
7158
7159 * arm.cc (Target_arm::do_relax): Record an output section for section
7160 offset adjustment it contains any stub table that has changed.
7161 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7162 offsets in an output section if necessary.
7163 * output.cc (Output_section::Output_section): Initialize
7164 section_offsets_need_adjustments_.
7165 (Output_section::add_input_section_for_script): Renamed to
7166 Output_section::add_simple_input_section.
7167 (Output_section::save_states): Add a comment.
7168 (Output_section::discard_states): New method defintion.
7169 (Output_section::adjust_section_offsets): Same.
7170 * output.h (Output_section::add_input_section_for_script): Renamed to
7171 Output_section::add_simple_input_section.
7172 (Output_section::discard_states): New method declaration.
7173 (Output_section::adjust_section_offsets): Same.
7174 (Output_section::section_offsets_need_adjustment,
7175 Output_section::set_section_offsets_need_adjustment): New method
7176 definitions.
7177 (Output_section::section_offsets_need_adjustment_): New data member.
7178 * script-sections.cc
7179 (Output_section_element_input::set_section_address): Adjust code for
7180 renaming of Output_section::add_input_section_for_script.
7181 (Orphan_output_section::set_section_address): Same.
7182
9b2fd367
DK
71832010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7184
7185 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7186 Fix_v4bx enum values .
7187 * gold/options.h (General_options): New option definitions.
7188 (General_options::fix_v4bx): New method.
7189 (General_options::Fix_v4bx): New enum.
7190 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7191 (General_options::parse_fix_v4bx_interworking): New method.
7192
80d0d023
DK
71932010-01-22 Doug Kwan <dougkwan@google.com>
7194
7195 * arm.cc (Arm_exidx_fixup): New class.
7196
af2cdeae
DK
71972010-01-21 Doug Kwan <dougkwan@google.com>
7198
7199 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7200 classes.
7201 (Arm_exidx_section_offset_map): New type.
7202
993d07c1
DK
72032010-01-21 Doug Kwan <dougkwan@google.com>
7204
7205 * arm.cc (Arm_exidx_input_section): New class.
7206 (Arm_relobj::exidx_input_section_by_link,
7207 Arm_relobj::exidx_input_section_by_shndx,
7208 Arm_relobj::make_exidx_input_section): New methods.
7209 (read_arm_attributes_section): Remove.
7210 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7211 information about them.
7212 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7213 to here.
7214
5ac169d4
DK
72152010-01-20 Doug Kwan <dougkwan@google.com>
7216
7217 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7218 Input_section_specifier to Section_id.
7219 (Target_arm::new_arm_input_section: Adjust code for change of key
7220 type.
7221 (Target_arm::find_arm_input_section): Ditto.
7222 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7223 (Section_id): Remove.
7224 (Garbage_collection::Section_id_hash): Remove.
7225 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7226 (Section_id): Remove.
7227 (Icf::Section_id_hash): Remove.
7228 * object.h (Section_id, Const_section_id, Section_id_hash,
7229 Const_section_id_hash): New type definitions.
7230 * output.cc (Output_section::add_relaxed_input_section): Change to
7231 use Const_section_id instead of Input_section_specifier as key type.
7232 (Output_section::add_merge_input_section): Ditto.
7233 (Output_section::build_relaxation_map): Change to use Section_id
7234 instead of Input_section_specifier as key type.
2e702c99 7235 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5ac169d4
DK
7236 Ditto.
7237 (Output_section::convert_input_sections_to_relaxed_sections): Change
7238 to use Const_section_id instead of Input_section_specifier as key type.
2e702c99 7239 (Output_section::find_merge_section): Ditto.
5ac169d4
DK
7240 (Output_section::find_relaxed_input_section): Ditto.
7241 * output.h (Input_section_specifier): Remove class.
7242 (Output_section::Output_section_data_by_input_section_map): Change
7243 key type to Const_section_id.
7244 (Output_section::Output_relaxed_input_section_by_input_section_map):
7245 Ditto.
7246 (Output_section::Relaxation_map): Change key type to Section_id.
7247
a2162063
ILT
72482010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7249
7250 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7251 (class Arm_v4bx_stub): New class.
7252 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7253 (Stub_factory::make_arm_v4bx_stub): New method.
7254 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7255 (Stub_table::empty): Handle v4bx stubs.
7256 (Stub_table::add_arm_v4bx_stub): New method.
7257 (Stub_table::find_arm_v4bx_stub): New method.
7258 (Arm_relocate_functions::v4bx): New method.
7259 (Target_arm::fix_v4bx): New method.
7260 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7261 (Stub_table::relocate_stubs): Likewise.
7262 (Stub_table::do_write): Likewise.
7263 (Stub_table::update_data_size_and_addralign): Likewise.
7264 (Stub_table::finalize_stubs): Likewise.
7265 (Target_arm::Scan::local): Likewise.
7266 (Target_arm::Scan::global): Likewise.
7267 (Target_arm::do_finalize_sections): Likewise.
7268 (Target_arm::Relocate::relocate): Likewise.
7269 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7270 Likewise.
7271 (Target_arm::scan_reloc_for_stub): Likewise.
7272 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7273
5696ab0b
ILT
72742010-01-19 Ian Lance Taylor <iant@google.com>
7275
7276 * output.cc (Output_section_headers::do_sized_write): Write large
7277 segment count to sh_info field.
7278 (Output_file_header::do_sized_write): For large segment count,
7279 write PN_XNUM to e_phnum field.
7280
800d0f56
ILT
72812010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7282
7283 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7284 (Arm_relocate_functions::thm_jump8): New function.
7285 (Arm_relocate_functions::thm_jump11): New function.
7286 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7287 R_ARM_THM_JUMP11.
7288 (Target_arm::Scan::global): Likewise.
7289 (Target_arm::Relocate::relocate): Likewise.
7290 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7291 Likewise.
7292
41263c05
DK
72932010-01-14 Doug Kwan <dougkwan@google.com>
7294
7295 * arm.cc (map, utility): Include headers.
7296 (Target_arm::apply_cortex_a8_workaround): New method.
7297 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7298 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7299 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7300 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7301 the --[no-]fix-cortex-a8 command line options.
7302 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7303 (Target_arm::relocate_stub): Use addend in instruction template.
7304 * options.h (DEFINE_bool): Set the user-set flag.
7305 (General_options): Add --[no-]-fix-cortex options.
7306 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 7307 : Update fast look-up map after conversion.
41263c05 7308
459e9b03
ST
73092010-01-14 Sriraman Tallam <tmsriram@google.com>
7310
7311 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7312 in the first pass of do_layout.
7313
b521dfe4
DK
73142010-01-13 Doug Kwan <dougkwan@google.com>
7315
7316 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7317 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7318 apparent compiler problem of not folding static constant integral
7319 data members of elfcpp::Elf_sizes<32>.
7320
44272192
DK
73212010-01-13 Doug Kwan <dougkwan@google.com>
7322
7323 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7324 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7325 Arm_relobj::scan_section_for_cortex_a8_erratum,
7326 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7327 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7328 sections to scan for relocation stubs into a new method
7329 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7330 relocation and Cortex-A8 stub scanning.
7331 (Target_arm::do_relax): Force stubs to be after stubbed sections
7332 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 7333 the beginning of a new relaxation pass. Update a comment.
44272192
DK
7334 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7335
44b71ece
ILT
73362010-01-12 Ian Lance Taylor <iant@google.com>
7337
7338 * target-reloc.h (visibility_error): New inline function.
7339 (relocate_section): Call visibility_error.
7340 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7341 (MOSTLYCLEANFILES): Likewise.
7342 (protected_4_pic.o, protected_3.err): New targets.
7343 * testsuite/protected_4.cc: New file.
7344
a120bc7f
DK
73452010-01-12 Doug Kwan <dougkwan@google.com>
7346
7347 * arm.cc (Cortex_a8_reloc): New class.
7348 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7349 and cortex_a8_relocs_info_.
7350 (Target_arm::fix_cortex_a8): New method definition.
7351 (Target_arm::Cortex_a8_relocs_info): New type.
7352 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7353 New data member declarations.
7354 (Target_arm::scan_reloc_for_stub): Record information about
7355 relocations for THUMB branches that might be exempted from the
7356 Cortex-A8 workaround.
7357 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7358 at the beginning of a relaxation pass.
7359
20138696
DK
73602010-01-12 Doug Kwan <dougkwan@google.com>
7361
7362 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7363 (Arm_relobj::Mapping_symbol_position,
7364 Arm_reloj::Mapping_symbol_position_less,
7365 Arm_relobj::Mapping_symbols_info): New types.
7366 (Target_arm::is_mapping_symbol_name): New method definition.
7367 (Arm_relobj::do_count_local_symbols): Save information about mapping
7368 symbols.
7369
089d69dc
DK
73702010-01-11 Doug Kwan <dougkwan@google.com>
7371
7372 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7373 Arm_relocate_functions::thumb32_branch_upper,
7374 Arm_relocate_functions::thumb32_branch_lower,
7375 Arm_relocate_functions::thumb32_cond_branch_offset,
7376 Arm_relocate_functions::thumb32_cond_branch_upper,
7377 Arm_relocate_functions::thumb32_cond_branch_lower,
7378 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7379 branch offset encoding.
7380 (Arm_relocate_functions::thumb_branch_common): Use new branch
7381 offset encoding methods to avoid code duplication.
7382 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7383 (Stub_addend_reader::operator()): Use new branch encoding method
7384 to avoid code duplication.
7385
99e5bff2
DK
73862010-01-11 Doug Kwan <dougkwan@google.com>
7387
7388 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7389 (Target_arm::do_finalize_sections): Define special EXIDX section
7390 symbols only if referenced.
7391 * gc.h (Garbage_collection::add_reference): New method.
7392 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7393 code duplication.
7394
98e090bd
ILT
73952010-01-11 Ian Lance Taylor <iant@google.com>
7396
d0a91bd8
ILT
7397 * script.cc (Version_script_info::build_expression_list_lookup):
7398 Change complaing about duplicate wildcard match from error to
7399 warning.
7400
98e090bd
ILT
7401 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7402 of 2009-12-30.
7403 (Version_script_info::Version_script_info): Initialize globs_,
7404 default_version_, default_is_global_, and exact_. Don't
7405 initialize globals_ or locals_.
7406 (Version_script_info::build_lookup_tables): Build local symbols
7407 first.
7408 (Version_script_info::unquote): New function.
7409 (Version_script_info::add_exact_match): New function.
7410 (Version_script_info::build_expression_list_lookup): Remove lookup
7411 parameter. Add is_global parameter. Change all callers. Handle
7412 wildcard pattern specially. Unquote pattern. Call
7413 add_exact_match.
7414 (Version_script_info::get_name_to_match): New function.
7415 (Version_script_info::get_symbol_version): New function.
7416 (Version_script_info::get_symbol_version_helper): Remove.
7417 (Version_script_info::check_unmatched_names): Call unquote.
7418 * script.h (class Version_script_info): Change get_symbol_version
7419 to be non-inline and add is_global parameter; change all callers.
7420 Rewrite symbol_is_local. Update declarations. Define struct
7421 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7422 Remove globals_ and locals_ members. Add exact_, globs_,
7423 default_version_, is_global_.
7424 (Version_script_info::Glob): Remove pattern, add expression and
7425 is_global. Update constructor. Change all callers.
7426 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7427 default version.
7428 (Versions::symbol_section_contents): If a symbol is undefined, or
7429 defined in a dynamic object, set the version index to
7430 VER_NDX_LOCAL.
7431 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7432 symbol_is_local.
7433 (Symbol_table::add_from_pluginobj): Likewise.
7434 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7435
d56962d3
DK
74362010-01-11 Doug Kwan <dougkwan@google.com>
7437
7438 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7439 (incremental_dump_LDADD): Add linking option for libintl.
7440 * Makefile.in: Regenerate.
7441
94e6ee91
L
74422010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7443
7444 PR gold/11144
7445 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7446 instead of -Ds.
7447 * testsuite/Makefile.in: Regenerated.
7448
e96c574b
DK
74492010-01-10 Doug Kwan <dougkwan@google.com>
7450
7451 * options.h (DEFINE_var): Use parentheses around argument varname__
7452 in macro body to avoid any unintended subsequent substitutions.
7453
7198066b
ILT
74542010-01-10 Ian Lance Taylor <iant@google.com>
7455
ba4d53bf
ILT
7456 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7457 candidates before doing symbol resolution.
7458
7198066b
ILT
7459 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7460 ODR candidates if only one is weak.
7461
a2beed37
ILT
74622010-01-08 Ian Lance Taylor <iant@google.com>
7463
7464 * script.cc (Version_script_info::build_expression_list_lookup):
7465 Don't warn about ambiguous version, just record the ambiguity.
7466 (Version_script_info::get_symbol_version_helper): Give error if
7467 version is ambiguous.
7468
2fb7225c
DK
74692010-01-08 Doug Kwan <dougkwan@google.com>
7470
7471 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
703d02da
AM
7472 prev_data_size_ and prev_addralign_. Remove initializer for
7473 deleted data member has_been_changed_.
7474 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7475 to determine if the table is empty.
7476 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7477 Remove.
7478 (Stub_table::add_reloc_stub): Define method in class definition
7479 instead of just declaring it there.
7480 (Stub_table::add_cortex_a8_stub): New method definition.
7481 (Stub_table::update_data_size_and_addralign): Ditto.
7482 (Stub_table::finalize_stubs): Ditto.
7483 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7484 (Stub_table::do_addralign_): Return address alignment in the
7485 (Stub_table::do_reset_address_and_file_offset): Define method in
7486 class definition instead of declaring it there. Set current data
7487 size to be the data size of the previous pass.
7488 (Stub_table::set_final_data_size): Use current data size as the
7489 final data size.
7490 (Stub_table::relocate_stub): Change parameter type of stub from
7491 Reloc_stub pointer to Stub pointer.
7492 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7493 (Stub_table::Cortex_a8_stub_list): New typedef.
7494 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7495 Stub_table::prev_addralign_): New data member.
7496 (Arm_relobj::Arm_relobj): Initialize data member
7497 section_has_cortex_a8_workaround_.
7498 (Arm_relobj::section_has_cortex_a8_workaround,
7499 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7500 definitions.
7501 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7502 declarations.
7503 (Target_arm::relocate_stub): Change parameter type of stub from
7504 Reloc_stub pointer to Stub pointer.
7505 (Insn_template::size, Insn_template::alignment): Handle
7506 THUMB16_SPECIAL_TYPE.
7507 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7508 Stub_table::update_data_size_and_addralign,
7509 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7510 definitions.
7511 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7512 (Stub_table::do_write): Ditto.
7513 (Target_arm::do_relax): Adjust code for changes in Stub_table.
2fb7225c 7514
880cd20d
ILT
75152010-01-08 Ian Lance Taylor <iant@google.com>
7516
7517 PR 11108
7518 * symtab.h (class Symbol): Remove fields is_target_special_ and
7519 has_plt_offset_. Add field is_defined_in_discarded_section_.
7520 (Symbol::is_defined_in_discarded_section): New function.
7521 (Symbol::set_is_defined_in_discarded_section): New function.
7522 (Symbol::has_plt_offset): Rewrite.
7523 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7524 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7525 Don't initialize is_target_special_ or has_plt_offset_.
7526 Initialize is_defined_in_discarded_section_.
7527 (Symbol_table::add_from_relobj): If appropriate, set
7528 is_defined_in_discarded_section.
7529 * resolve.cc (Symbol::override_base_with_special): Don't test
7530 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7531 * target-reloc.h (relocate_section): Do special handling for
7532 symbols defined in discarded sections for global symbols as well
7533 as local symbols.
7534
2703e3eb
ILT
75352010-01-08 Ian Lance Taylor <iant@google.com>
7536
7537 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7538 the SHT_SYMTAB case.
7539
339d40a3
ILT
75402010-01-08 Ian Lance Taylor <iant@google.com>
7541
7542 * object.cc (Sized_relobj::do_layout): Don't get confused if
7543 layout_eh_frame returns NULL.
7544
abecea76
ILT
75452010-01-08 Ian Lance Taylor <iant@google.com>
7546
7547 PR 11084
7548 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7549 dynamic symbol table, use the normal symbol table.
7550 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7551 symbol table.
7552
6b7dd3f3
ILT
75532010-01-08 Ian Lance Taylor <iant@google.com>
7554
7555 PR 11072
7556 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7557 sections.
7558
36c50e63
L
75592010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7560
7561 * version.cc (print_version): Change to "Copyright 2010".
7562
e291e7b9
ILT
75632010-01-08 Ian Lance Taylor <iant@google.com>
7564
7565 PR 10287
7566 PR 11063
7567 * i386.cc (class Target_i386): Change return type of plt_section
7568 to be non-const.
7569 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7570 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7571 tls_desc_rel_ field.
7572 (Output_data_plt_i386::rel_tls_desc): New function.
7573 (Target_i386::rel_tls_desc_section): New function.
7574 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7575 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7576 R_386_TLS_DESC reloc in rel_tls_desc_section.
7577 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7578 Define struct Tlsdesc_info.
7579 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7580 (Target_x86_64::do_reloc_symbol_index): New function.
7581 (Target_x86_64::add_tlsdesc_info): New function.
7582 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7583 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7584 tlsdesc_rel_ field.
7585 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7586 all callers.
7587 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7588 (Target_x86_64::rela_tlsdesc_section): New function.
7589 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7590 handling.
7591 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7592 (Target_x86_64::do_reloc_addend): New function.
7593 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7594 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7595 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7596 (Output_reloc::type): New function.
7597 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7598 (Output_reloc::is_target_specific): New function.
7599 (Output_reloc::target_arg): New function.
7600 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7601 absolute relocs and target specific relocs.
7602 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7603 add_target_specific.
7604 (class Output_data_reloc) [SHT_RELA]: Likewise.
7605 * output.cc (Output_reloc::Output_reloc): Add four new versions
7606 for absolute relocs and target specific relocs.
7607 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7608 (Output_reloc::get_symbol_index): Likewise.
7609 (Output_reloc::local_section_offset): Check that local_sym_index_
7610 is not TARGET_CODE or 0.
7611 (Output_reloc::symbol_value): Likewise.
7612 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7613 reloc.
7614 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7615 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7616 functions.
7617 * layout.cc (add_target_dynamic_tags): Use output section for
7618 DT_PLTRELSZ and DT_JMPREL.
7619
3a44184e
ILT
76202010-01-07 Ian Lance Taylor <iant@google.com>
7621
7622 PR 11061
7623 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7624 function.
7625 (class Output_data_reloc_generic): Define.
7626 (class Output_data_reloc_base): Change base class to
7627 Output_data_reloc_generic. Change add() method to call
7628 bump_relative_reloc_count for a relative reloc. Remove
7629 sort_relocs_ field.
7630 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7631 to sort_relocs().
7632 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7633 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7634 appropriate.
7635 * layout.h (class Layout): Update declaration.
7636
ea715a34
ILT
76372010-01-07 Ian Lance Taylor <iant@google.com>
7638
7639 * output.h (class Output_data): Add const version of
7640 output_section and do_output_section.
7641 (class Output_section_data): Add const version of
7642 do_output_section.
7643 (class Output_section): Likewise.
7644 * layout.cc (Layout::add_target_dynamic_tags): New function.
7645 * layout.h (class Layout): Update declarations.
7646 * arm.cc (Target_arm::do_finalize_sections): Use
7647 add_target_dynamic_tags.
7648 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7649 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7650 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7651 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7652
659948a4
ILT
76532010-01-07 Ian Lance Taylor <iant@google.com>
7654
7655 PR 11042
7656 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7657 object as needed.
7658
9d3b86f6
ILT
76592010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7660 Ian Lance Taylor <iant@google.com>
7661
7662 PR 11019
7663 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7664 Xindex::read_symtab_xindex.
7665
bb0d3eb0
DK
76662010-01-07 Doug Kwan <dougkwan@google.com>
7667
7668 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7669 (Insn_template::thumb16_bcond_insn): New method declaration.
7670 (Insn_template): Fix spelling.
7671 (Stub::thumb16_special): New method declaration.
7672 (Stub::do_write): Define virtual method which was previously pure
7673 virtual.
7674 (Stub::do_thumb16_special): New method declaration.
7675 (Stub::do_fixed_endian_write): New template member.
7676 (Reloc_stub::do_write): Remove.
7677 (Reloc_stub::do_fixed_endian_write): Remove.
7678 (Cortex_a8_stub): New class definition.
7679 (Stub_factory::make_cortex_a8_stub): New method definition.
7680 (Stub_factory::Stub_factory): Add missing static storage class
7681 qualifier for elf32_arm_stub_a8_veneer_blx.
7682
ffeef7df
ILT
76832010-01-07 Ian Lance Taylor <iant@google.com>
7684
dc3f80fe
ILT
7685 PR 10980
7686 * options.h (class General_options): Add --warn-unresolved-symbols
7687 and --error-unresolved-symbols.
7688 * errors.cc (Errors::undefined_symbol): Implement
7689 --warn-unresolved-symbols.
7690
ffeef7df
ILT
7691 * options.h (class General_options): Add -z text and -z textoff.
7692 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7693
f1ec9ded
ST
76942010-01-06 Sriraman Tallam <tmsriram@google.com>
7695
7696 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7697 (Garbage_collection::cident_sections): New function.
7698 (Garbage_collection::add_cident_section): New function.
7699 (Garbage_collection::cident_sections_): New member.
7700 (gc_process_relocs): Add references to sections whose names are C
7701 identifiers.
7702 * gold.h (cident_section_start_prefix): New constant.
7703 (cident_section_stop_prefix): New constant.
7704 (is_cident): New function.
7705 * layout.cc (Layout::define_section_symbols): Replace string constants
7706 with the newly defined constants.
7707 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7708 C identifiers.
7709 * testsuite/Makefile.am: Add gc_orphan_section_test.
7710 * testsuite/Makefile.in: Regenerate.
7711 * testsuite/gc_orphan_section_test.cc: New file.
7712 * testsuite/gc_orphan_section_test.sh: New file.
7713
6eda8c29
ILT
77142010-01-06 Ian Lance Taylor <iant@google.com>
7715
b9674e17
ILT
7716 PR 10980
7717 * options.h (class General_options): Add --warn-shared-textrel.
7718 * layout.cc (Layout::finish_dynamic_section): Implement
7719 --warn-shared-textrel.
7720
6eda8c29
ILT
7721 PR 10980
7722 * options.h (class General_options): Add --warn-multiple-gp.
7723
32dcd44e
ILT
77242010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7725
7726 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7727 $(THREADSLIB) and $(LIBDL).
7728 * Makefile.in: Rebuild.
7729
a192ba05
ILT
77302010-01-06 Ian Lance Taylor <iant@google.com>
7731
7732 PR 10980
7733 * options.cc (General_options::parse_section_start): New function.
7734 (General_options::section_start): New function.
7735 (General_options::General_options): Initialize all members.
7736 * options.h: Include <map>
7737 (class General_options): Add --section-start. Add section_starts_
7738 member.
7739 * layout.cc (Layout::attach_allocated_section_to_segment): If
7740 --section-start was used, set the address of the segment. Remove
7741 local sort_sections.
7742 (Layout::relaxation_loop_body): If the address of the load segment
7743 has been set by --section-start, don't use it.
7744 * output.h (Output_segment::update_flags_for_output_section): New
7745 function.
7746 * output.cc (Output_segment::add_output_section): Call
7747 update_flags_for_output_section.
7748
dde3f402
ILT
77492010-01-05 Ian Lance Taylor <iant@google.com>
7750
62dfdd4d
ILT
7751 PR 10980
7752 * options.h (class General_options): Add --undefined-version.
7753 * script.cc (struct Version_expression): Add was_matched_by_symbol
7754 field.
7755 (Version_script_info::matched_symbol): New function.
7756 (Version_script_info::get_symbol_version_helper): Call
7757 matched_symbol.
7758 (Version_script_info::check_unmatched_names): New function.
7759 * script.h (class Version_script_info): Update declarations.
7760 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7761
9c4ae156
ILT
7762 * options.h (class General_options): Use DEFINE_bool_alias for
7763 allow_multiple_definition.
7764 * resolve.cc (Symbol_table::should_override): Don't test
7765 allow_multiple_definition.
7766
dde3f402
ILT
7767 PR 10980
7768 * options.h (class General_options): Add --cref.
7769 * main.cc (main): Print cref table if --cref. Don't close mapfile
7770 until after printing cref table.
7771 * cref.cc: Include "symtab.h".
7772 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7773 (Cref_table_compare::operator()): New function.
7774 (Cref_inputs::gather_cref): New function.
7775 (filecol): New static const.
7776 (Cref_inputs::print_cref): New function.
7777 (Cref::print_cref): New function.
7778 * cref.h: Include <cstdio>.
7779 (class Cref): Update declarations.
7780 * mapfile.h (Mapfile::file): New function.
7781 * object.h (class Object): Define Symbols. Declare virtual
7782 do_get_global_symbols.
7783 (Object::get_global_symbols): New function.
7784 * object.cc (Input_objects::add_object): Pass object to cref_ if
7785 --cref.
7786 (Input_objects::archive_start): Likewise.
7787 (Input_objects::archive_stop): Likewise.
7788 (Input_objects::print_cref): New function.
7789 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7790 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7791 --cref.
7792 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7793 function.
7794 * plugin.h (class Sized_pluginobj): Update declarations.
7795
8781f709
ILT
77962010-01-05 Ian Lance Taylor <iant@google.com>
7797
7798 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7799 to is_default_version. Rename insdef to insdefault.
7800 (Symbol_table::add_from_relobj): Rename def to is_default_version
7801 and local to is_forced_local.
7802 (Symbol_table::add_from_pluginobj): Likewise.
7803 (Symbol_table::add_from_dynobj): Likewise.
7804 (Symbol_table::define_special_symbol): Rename insdef to
7805 insdefault.
7806
fe35d28d
ILT
78072010-01-04 Ian Lance Taylor <iant@google.com>
7808
30bc8c46
ILT
7809 PR 10980
7810 * options.h (class General_options): Add
7811 --allow-multiple-definition and -z muldefs.
7812 * resolve.cc (Symbol_table::should_override): Don't warn about a
7813 multiple symbol definition if --allow-multiple-definition or -z
7814 muldefs.
7815
7eaea549
ILT
7816 PR 10980
7817 * options.h (class General_options): Add --add-needed and
7818 --copy-dt-needed-entries. Tweak --as-needed help entry.
7819 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7820 error if --copy-dt-needed-entries aka --add-needed is used and
7821 would cause a change in behaviour.
7822
fe35d28d
ILT
7823 PR 10980
7824 * options.h (class General_options): Add -G as a short version of
7825 --shared. Add no-op options -assert, -g, and -i.
7826
55a2bb35
ST
78272010-01-04 Sriraman Tallam <tmsriram@google.com>
7828
7829 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7830 check for .text or .gnu.linkonce.t sections.
7831 * icf.cc (Icf::find_identical_sections): Ditto.
7832 Change the detection for mangled function name within the section
7833 name.
7834 * icf.h (is_section_foldable_candidate): New function.
7835
719328e1
ILT
78362009-12-30 Ian Lance Taylor <iant@google.com>
7837
7838 PR 10980
7839 * options.h (class General_options): Permit two dashes with
7840 --retain-symbols-file.
7841
d7bb5745
ILT
78422009-12-30 Ian Lance Taylor <iant@google.com>
7843
403a15dd
ILT
7844 PR 10979
7845 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7846 don't put the file header and segment headers in the text
7847 segment.
7848
eda294df
ILT
7849 PR 10979
7850 * common.cc (Sort_commons::operator()): Stabilize sort when both
7851 entries are NULL.
7852 (Symbol_table::do_allocate_commons_list): When allocating common
7853 symbols, skip a symbol which is no longer common.
7854 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7855 an object before checking its type.
7856 * testsuite/common_test_2.c: New file.
7857 * testsuite/common_test_3.c: New file.
7858 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7859 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7860 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7861 (common_test_2_pic.o, common_test_2.so): New targets.
7862 (common_test_3_pic.o, common_test_3.so): New targets.
7863 * testsuite/Makefile.in: Rebuild.
7864
d7bb5745
ILT
7865 PR 10979
7866 * script.cc (read_input_script): If we see a new SECTIONS clause,
7867 and we have added an input section, give an error.
7868 * layout.h (class Layout): Add have_added_input_section function.
7869 Add have_added_input_section_ field.
7870 * layout.cc (Layout::Layout): Initialize
7871 have_added_input_section_.
7872 (Layout::layout): Set have_added_input_section_.
7873 (Layout::layout_eh_frame): Likewise.
7874
fc59c572
ILT
78752009-12-30 Ian Lance Taylor <iant@google.com>
7876
7877 PR 10931
7878 * options.h (class General_options): Add --sort-common option.
7879 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7880 * common.cc (Sort_common): Add sort_order parameter to
7881 constructor. Add sort_order_ field.
7882 (Sort_commons::operator): Check sort_order_.
7883 (Symbol_table::allocate_commons): Determine the sort order.
7884 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7885 Change all callers.
7886 (Symbol_table::do_allocate_commons_list): Likewise.
7887
1c74fab0
ILT
78882009-12-30 Ian Lance Taylor <iant@google.com>
7889
7890 PR 10916
7891 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7892 symbols from this object, don't change the visibility of an
7893 undefined symbol.
7894 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7895
6affe781
ILT
78962009-12-30 Ian Lance Taylor <iant@google.com>
7897
7898 PR 10861
7899 * script.h (class Version_script_info): Define Language enum.
7900 Update declarations. Define Glob, Exact, and Lookup types. Add
7901 new fields globals_, locals_, and is_finalized_.
7902 * script.cc: Various formatting fixes.
7903 (class Parser_closure): Change language_stack_ from a vector of
7904 std::string to one of Version_script_info::Language. Adjust all
7905 uses accordingly.
7906 (class Lazy_demangler): Remove.
7907 (struct Version_expression): Change language from std::string to
7908 Version_script_info::Language.
7909 (Version_script_info::Version_script_info): New function.
7910 (Version_script_info::~Version_script_info): Don't call clear.
7911 (Version_script_info::finalize): New function.
7912 (Version_script_info::build_lookup_tables): New function.
7913 (Version_script_info::build_expression_list_lookup): New
7914 function.
7915 (Version_script_info::get_symbol_version_helper): Rewrite to use
7916 lookup tables.
7917 (Version_script_info::print_expression_list): Adjust to use
7918 Version_script_info::Language.
7919 (script_push_lex_into_version_mode): Check that the version script
7920 has not been finalized.
7921 (version_script_push_lang): Change language string to
7922 Version_script_info::Language.
7923 * options.cc (Command_line::version_script): New function.
7924 * options.h (class General_options): Add finalize_dynamic_list
7925 function. Change version_script from declaration to definition.
7926 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7927 * testsuite/version_script.map: Remove duplicate def of foo.
7928 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7929 version_script.map.
7930 * testsuite/Makefile.in: Rebuild.
7931
818bf354
ILT
79322009-12-30 Ian Lance Taylor <iant@google.com>
7933
7934 PR 10843
7935 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7936 if the input symbol index is 0, make the output symbol index 0.
7937
ebcc8304
ILT
79382009-12-30 Ian Lance Taylor <iant@google.com>
7939
7940 PR 10670
7941 * options.h (class General_options): Add -x/--discard-all.
7942 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7943 --discard-all. If the local symbol needs a dynamic entry, check
7944 that before handling --discard-locals.
7945
176fe33f
ILT
79462009-12-30 Ian Lance Taylor <iant@google.com>
7947
bb321bb1
ILT
7948 PR 10450
7949 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7950 flags to PF_R.
7951 (Output_segment::add_output_section): Don't change the flags if
7952 the type is PT_TLS.
7953
176fe33f
ILT
7954 PR 10450
7955 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7956 GNU hash table if they need a dynamic value. Otherwise, don't add
7957 them if they are defined in a dynamic object or are forced local.
7958
e8cd95c7
ILT
79592009-12-29 Ian Lance Taylor <iant@google.com>
7960
1b81fb71
ILT
7961 PR 10450
7962 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7963 .gnu.hash table for a 32-bit target.
7964
8d6d383d
ILT
7965 PR 10450
7966 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7967 regular and a dynamic object only needs a dynamic symbol table
7968 entry if it is externally visible.
7969
e785ec03
ILT
7970 PR 10450
7971 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7972 constructor. Add global_offset_table_ field.
7973 (Target_i386::got_section): Set global_offset_table_.
7974 (Target_i386::do_finalize_sections): Set global_offset_table_
7975 size.
7976 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7977 in constructor. Add global_offset_table_ field.
7978 (Target_x86_64::got_section): Set global_offset_table_.
7979 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7980 size.
7981
1a2dff53
ILT
7982 * layout.cc (Layout::Layout): Initialize increase_relro_.
7983 (Layout::get_output_section): Add is_relro, is_last_relro, and
7984 is_first_non_relro parameters. Change all callers.
7985 (Layout::choose_output_section): Likewise.
7986 (Layout::add_output_section_data): Likewise.
7987 (Layout::make_output_section): Likewise.
7988 (Layout::set_segment_offsets): Clear increase_relro when using a
7989 linker script.
7990 * layout.h (class Layout): Add increase_relro method. Add
7991 increase_relro_ field. Update declarations.
7992 * output.cc (Output_section::Output_section): Initialize
7993 is_last_relro_ and is_first_non_relro_.
7994 (Output_segment::add_output_section): Group relro sections is
7995 do_sort is true. Handle is_last_relro and is_first_non_relro.
7996 (Output_segment::maximum_alignment): Remove relro handling.
7997 (Output_segment::set_section_addresses): Add increase_relro
7998 parameter. Change all callers. Add initial alignment to align
7999 relro sections on separate page. Remove old relro handling.
8000 (Output_segment::set_section_list_addresses): Remove in_relro
8001 parameter. Change all callers.
8002 (Output_segment::set_offset): Add increase parameter. Change all
8003 callers. Remove old relro handling.
8004 * output.h (class Output_section): Add new methods: is_last_relro,
8005 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8006 Add is_last_relro_ and is_first_non_relro_ fields.
8007 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8008 Create separate .got.plt section. Call increase_relro.
8009 * x86_64.cc (Target_x86_64::got_section): Likewise.
8010 * testsuite/relro_script_test.t: Add .got.plt.
8011
f0ba79e2
ILT
8012 PR 10450
8013 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8014 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8015 (Layout::finalize): Call set_dynamic_symbol_size.
8016 (Layout::set_dynamic_symbol_size): New function.
8017 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8018 set_dynamic_symbol_size.
8019
e8cd95c7
ILT
8020 PR 10450
8021 * output.h (class Output_section): Add is_entsize_zero_ field.
8022 * output.cc (Output_section::Output_section): Initialize
8023 is_entsize_zero_.
8024 (Output_section::set_entsize): If two different entsizes are
8025 requested, force it to zero.
8026 (Output_section::add_input_section): Set flags for .debug_str
8027 before updating section flags. Set entsize.
8028 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8029 and SHF_STRING if all input sections have those flags.
8030
3e1b9a8a
RÁE
80312009-12-29 Rafael Espindola <espindola@google.com>
8032
8033 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
8034 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8035 reporting.
3e1b9a8a 8036
3dcad376
ST
80372009-12-29 Sriraman Tallam <tmsriram@google.com>
8038
8039 * options.cc (General_options::parse_version): Allow -v to exit
8040 without an error if there is nothing to link.
8041
084e2665
ILT
80422009-12-29 Ian Lance Taylor <iant@google.com>
8043
8044 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8045 using a version of gcc before 4.1.
8046 * configure: Rebuild.
8047
250acde3
CD
80482009-12-28 Chris Demetriou <cgd@google.com>
8049
8050 * attributes.cc (Output_attributes_section_data::do_write): Use
8051 std::vector::front rather than std::vector::data.
8052
99fff23b
ILT
80532009-12-28 Ian Lance Taylor <iant@google.com>
8054
8055 * symtab.h (class Symbol_table): Add enum Defined.
8056 * resolve.cc (Symbol_table::should_override): Add defined
8057 parameter. Change all callers. Test whether object is NULL
8058 before calling a method on it.
8059 (Symbol_table::report_resolve_problem): Add defined parameter.
8060 Change all callers.
8061 (Symbol_table::should_override_with_special): Likewise.
8062 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8063 parameter. Change all callers.
8064 (Symbol_table::do_define_in_output_data): Likewise.
8065 (Symbol_table::define_in_output_segment): Likewise.
8066 (Symbol_table::do_define_in_output_segment): Likewise.
8067 (Symbol_table::define_as_constant): Likewise.
8068 (Symbol_table::do_define_as_constant): Likewise.
8069 * script.h (class Symbol_assignment): Add is_defsym parameter to
8070 constructor; change all callers.
8071 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8072 parameter. Change all callers. Add is_defsym_ field.
8073 (class Parser_closure): Add parsing_defsym parameter to
8074 constructor; change all callers. Add parsing_defsym accessor
8075 function. Add parsing_defsym_ field.
8076
556bd683
ILT
80772009-12-28 Ian Lance Taylor <iant@google.com>
8078
8079 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 8080 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 8081
1782c879
ILT
80822009-12-23 Ian Lance Taylor <iant@google.com>
8083
8084 * i386.cc (Target_i386::do_calls_non_split): Recognize
8085 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
8086 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8087 -fsplit-stack prologue when using %r11.
1782c879 8088
329ca2b1
ST
80892009-12-21 Sriraman Tallam <tmsriram@google.com>
8090
8091 * options.cc (General_options::parse_version): Make -v continue and do
8092 the link like GNU ld does.
8093
d675ff46
RÁE
80942009-12-17 Rafael Avila de Espindola <espindola@google.com>
8095
8096 * Makefile.am (CCFILES): Add timer.cc.
8097 (HFILES): Add timer.h.
8098 * configure.ac: Check for sysconf and times.
8099 * main.cc: include timer.h.
8100 (main): Use Timer instead of get_run_time.
8101 * timer.cc: New.
8102 * timer.h: New.
8103 * workqueue.cc: include timer.h.
8104 (Workqueue::find_and_run_task):
8105 Report user, sys and wall time.
8106 * Makefile.in: Regenerate.
8107 * config.in: Regenerate.
8108 * configure: Regenerate.
8109
d6344fb5
DK
81102009-12-16 Doug Kwan <dougkwan@google.com>
8111
8112 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8113 sections.
8114 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8115 relaxed input sections.
8116 * output.cc (Output_section::find_relaxed_input_section): Change
8117 return type to Output_relaxed_input_section pointer. Adjust code
8118 for new type of relaxed_input_section_map_.
8119 * output.h (Output_section::find_relaxed_input_section): Change
8120 return type to Output_relaxed_input_section pointer.
8121 (Output_section::Output_relaxed_input_section_by_input_section_map):
8122 New type.
8123 (Output_section::relaxed_input_section_map_): Change type to
8124 Output_section::Output_relaxed_input_section_by_input_section_map.
8125 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8126 input section.
8127
0e0d5469
ILT
81282009-12-15 Ian Lance Taylor <iant@google.com>
8129
8130 * layout.cc (Layout::create_shstrtab): Only write out after input
8131 sections if we are compressing debug sections.
8132
0649a889
ILT
81332009-12-15 Ian Lance Taylor <iant@google.com>
8134
8135 * archive.cc (Archive::add_symbols): Only look up a symbol without
8136 a version if there is, in fact, a version.
8137
2ea97941
ILT
81382009-12-14 Ian Lance Taylor <iant@google.com>
8139
8140 Revert -Wshadow changes, all changes from:
8141 2009-12-11 Doug Kwan <dougkwan@google.com>
8142 2009-12-11 Nick Clifton <nickc@redhat.com>
8143 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8144
b0eec2cc
DK
81452009-12-11 Doug Kwan <dougkwan@google.com>
8146
8147 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8148 due to -Wshadow.
8149 * attributes.cc (Object_attribute::size): Ditto.
8150 (Attributes_section_data::size): Ditto.
8151 (Attributes_section_data::Attributes_section_data): Ditto.
8152 (Output_attributes_section_data::do_write): Ditto.
8153 * attributes.h (Object_attribute::set_type): Ditto.
8154 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8155
91d6fa6a
NC
81562009-12-11 Nick Clifton <nickc@redhat.com>
8157
8158 * archive.cc: Fix shadowed variable warnings.
8159 * arm.cc: Likewise.
8160 * compressed_output.cc: Likewise.
8161 * compressed_output.h: Likewise.
8162 * configure: Likewise.
8163 * dwarf_reader.cc: Likewise.
8164 * dynobj.cc: Likewise.
8165 * dynobj.h: Likewise.
8166 * ehframe.cc: Likewise.
8167 * ehframe.h: Likewise.
8168 * errors.cc: Likewise.
8169 * expression.cc: Likewise.
8170 * fileread.cc: Likewise.
8171 * fileread.h: Likewise.
8172 * freebsd.h: Likewise.
8173 * i386.cc: Likewise.
8174 * icf.cc: Likewise.
8175 * incremental.h: Likewise.
8176 * layout.cc: Likewise.
8177 * layout.h: Likewise.
8178 * mapfile.cc: Likewise.
8179 * merge.cc: Likewise.
8180 * merge.h: Likewise.
8181 * object.cc: Likewise.
8182 * object.h: Likewise.
8183 * options.h: Likewise.
8184 * output.cc: Likewise.
8185 * output.h: Likewise.
8186 * parameters.cc: Likewise.
8187 * plugin.cc: Likewise.
8188 * powerpc.cc: Likewise.
8189 * reduced_debug_output.cc: Likewise.
8190 * reduced_debug_output.h: Likewise.
8191 * reloc.cc: Likewise.
8192 * reloc.h: Likewise.
8193 * resolve.cc: Likewise.
8194 * script-sections.cc: Likewise.
8195 * script.cc: Likewise.
8196 * script.h: Likewise.
8197 * sparc.cc: Likewise.
8198 * symtab.cc: Likewise.
8199 * symtab.h: Likewise.
8200 * target-select.cc: Likewise.
8201 * target-select.h: Likewise.
8202 * token.h: Likewise.
8203 * workqueue.cc: Likewise.
8204 * workqueue.h: Likewise.
8205 * x86_64.cc: Likewise.
8206
a0351a69
DK
82072009-12-10 Doug Kwan <dougkwan@google.com>
8208
8209 * arm.cc (attributes.h): New include.
8210 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8211 (Arm_relobj::~Arm_relobj): Delete object pointed by
8212 attributes_section_data_.
8213 (Arm_relobj::attributes_section_data): New method definition.
8214 (Arm_relobj::attributes_section_data_): New data member declaration.
8215 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8216 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8217 attributes_section_data_.
8218 (Arm_dynobj::attributes_section_data): New method definition.
8219 (Arm_dynobj::attributes_section_data_): New data member declaration.
8220 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8221 initialization value of may_use_blx_ to false.
2e702c99 8222 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
a0351a69
DK
8223 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8224 object attributes to compute results instead of hard-coding.
8225 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8226 Target_arm::get_secondary_compatible_arch,
8227 Target_arm::set_secondary_compatible_arch
8228 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8229 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8230 New method declarations.
8231 (Target_arm::get_aeabi_object_attribute): New method definition.
8232 (Target_arm::attributes_section_data_): New data member declaration.
8233 (read_arm_attributes_section): New template definition.
8234 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8235 (Arm_dynobj::do_read_symbols): Ditto.
8236 (Target_arm::do_finalize_sections): Merge attributes sections from
8237 input. Check for BLX use after attributes section merging.
8238 Fix __exidx_start and __exidx_end visibility. Create an
8239 .ARM.attributes section if necessary.
8240 (Target_arm::get_secondary_compatible_arch,
8241 Target_arm::set_secondary_compatible_arch,
8242 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8243 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 8244 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
8245 New method definitions.
8246
b59befec
ILT
82472009-12-09 Ian Lance Taylor <iant@google.com>
8248
8249 * plugin.cc (Plugin::load): Don't cast from void* to a function
8250 pointer.
8251
1276bc89
ILT
82522009-12-09 Ian Lance Taylor <iant@google.com>
8253
8254 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8255 information fields.
8256
2f2de248
L
82572009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8258
8259 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8260 Replace two_file_shared_1.so with two_file_shared_2.so.
8261 * testsuite/Makefile.in: Regenerated.
8262
4f787271
DK
82632009-12-08 Doug Kwan <dougkwan@google.com>
8264
8265 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8266 (HFILES): Add attributes.h and int_encoding.h.
8267 * Makefile.in: Regenerate.
8268 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8269 function definitions to int_encoding.cc
8270 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8271 prototypes to int_encoding.h
8272 * reduced_debug_output.cc (int_encoding.h): New include.
8273 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8274 function definitions to int_encoding.cc
8275 (insert_into_vector, read_from_pointer): Move template definitions to
8276 int_encoding.h
8277 * attributes.cc: New file.
8278 * attributes.h: New file.
8279 * int_encoding.cc: New file.
8280 * int_encoding.h: New file.
8281
20b52f1a
RÁE
82822009-12-07 Rafael Avila de Espindola <espindola@google.com>
8283
8284 PR gold/11055
8285 * incremental-dump.cc (dump_incremental_inputs): New.
8286 (main): Use dump_incremental_inputs.
8287
53d7974c
L
82882009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8289
8290 PR gold/10893
8291 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8292 checking elfcpp::STT_FUNC.
8293 (Target_i386::Relocate::relocate): Likewise.
8294 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8295
8296 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8297 symbols from shared libraries into normal FUNC symbols.
8298
8299 * symtab.h (Symbol): Add is_func and use it.
8300
05a352e6
DK
83012009-12-05 Doug Kwan <dougkwan@google.com>
8302
8303 * arm.cc (Target_arm::arm_info): Initialize new fields
8304 attributes_section and attributes_vendor.
8305 * i386.cc (Target_i386::i386_info): Same.
8306 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8307 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8308 fields attributes_section and attributes_vendor.
53d7974c 8309 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
8310 * target.h (Target::attributes_section, Target::attributes_vendor,
8311 Target::is_attributes_section, Target::attribute_arg_type,
8312 Target::attributes_order): New method definitions.
8313 (Target::Target_info::attributes_section,
8314 Target::Target_info::attributes_vendor): New fields.
8315 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8316 virtual method definitions.
8317 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8318 attributes_section and attributes_vendor.
8319 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8320
f4e5969c
DK
83212009-12-05 Doug Kwan <dougkwan@google.com>
8322
8323 * arm.cc: Update comments about interworking and stub generation.
8324 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8325 considered as non-PIC.
8326 (Arm_relocate_functions::base_abs): Fix formatting.
8327 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8328 of function to use GOT entry address instead of offset.
8329 (Target_arm::Scan::global): Issue an error if a symbol would need a
8330 PLT does not get one because it is untyped. Remove code to create
8331 dynamic symbols for relative branches.
8332 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8333 takes unsigned integer instead of boolean.
8334
1abce4a6
L
83352009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8336
8337 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8338 (two_file_test_LDADD): Likewise.
8339 (common_test_1_LDADD): Likewise.
8340 (exception_test_LDADD) Likewise.
8341 (weak_test_LDADD): Likewise.
8342 (many_sections_test_LDADD): Likewise.
8343 (initpri1_LDADD): Likewise.
8344 (script_test_1_LDADD): Likewise.
8345 (script_test_2_LDADD): Likewise.
8346 (justsyms_LDADD): Likewise.
8347 (binary_test_LDADD): Likewise.
8348 (large_LDADD): Likewise.
8349 * testsuite/Makefile.in: Regenerated.
8350
adcf2816 83512009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 8352
adcf2816
L
8353 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8354 (Symbol_table::override_with_special): Likewise.
8355 (Symbol_table::add_from_object): Likewise.
8356
28e67f5d
RÁE
83572009-12-04 Rafael Avila de Espindola <espindola@google.com>
8358
8359 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8360 Don't set the data_offset twice.
8361
ae10a101
RÁE
83622009-12-04 Rafael Avila de Espindola <espindola@google.com>
8363
8364 * testsuite/Makefile.in: Regenerate.
8365
f59f41f3
DK
83662009-12-03 Doug Kwan <dougkwan@google.com>
8367
8368 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8369 (Target_arm::do_finalize_sections): Add parameter for symbol table
8370 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8371 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8372 parameter for symbol table pointer.
8373 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8374 an additional parameter for a pointer to symbol table.
8375 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8376 parameter for a symbol table pointer.
8377 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8378 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8379 Ditto.
8380 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8381 parameter for a symbol table pointer.
8382
ca55d848
RÁE
83832009-12-03 Rafael Avila de Espindola <espindola@google.com>
8384
8385 * incremental.cc (Incremental_inputs_header)
8386 (Incremental_inputs_header_write, Incremental_inputs_entry)
8387 (Incremental_inputs_entry_write): Move ...
8388 * incremental.h (Incremental_inputs_header)
8389 (Incremental_inputs_header_write, Incremental_inputs_entry)
8390 (Incremental_inputs_entry_write): here.
8391
3aec4f9c
RÁE
83922009-12-02 Rafael Avila de Espindola <espindola@google.com>
8393
8394 * incremental.cc (make_sized_incremental_binary): Set the target.
8395 Error if it is incompatible.
8396 * output.h (Output_file): Add filename method.
8397
9c0ae74d
RÁE
83982009-12-02 Rafael Avila de Espindola <espindola@google.com>
8399
8400 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8401 from the get_* methods.
8402
a45500ae
RÁE
84032009-12-02 Rafael Avila de Espindola <espindola@google.com>
8404
8405 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8406 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8407 Write 0 for the data_offset of scripts.
8408
325e6408
RÁE
84092009-12-02 Rafael Avila de Espindola <espindola@google.com>
8410
8411 * testsuite/Makefile.am: Add the incremental_test.sh test.
8412 * testsuite/incremental_test.sh: New.
8413 * testsuite/incremental_test_1.c: New.
8414 * testsuite/incremental_test_2.c: New.
8415
954c3e2e
RÁE
84162009-12-01 Rafael Avila de Espindola <espindola@google.com>
8417
703d02da 8418 * incremental-dump.cc (main): Fix typos.
954c3e2e 8419
f8086623
RÁE
84202009-11-27 Rafael Avila de Espindola <espindola@google.com>
8421
8422 PR gold/11025
8423 * incremental-dump.cc (main): Use llu to print 64 bit values.
8424
3b0dd6ac
L
84252009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8426 H.J. Lu <hongjiu.lu@intel.com>
8427
8428 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8429 $(LIBDL).
8430 (incremental_dump_LDADD): Likewise.
8431 * Makefile.in: Regenerated.
8432
a6d1ef57 84332009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 8434
a6d1ef57
DK
8435 Revert:
8436
8437 2009-11-25 Doug Kwan <dougkwan@google.com>
8438
8439 * arm.cc (Target_arm::Target_arm): Move method definition
8440 outside of class definition. Add code to handle
8441 --target1-rel, --target1-abs and --target2= options.
8442 (Target_arm::get_reloc_reloc_type): Change method to be
8443 non-static and const.
8444 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8445 New data member declaration.
8446 (Target_arm::Scan::local, Target_arm::Scan::global,
8447 Target_arm::Relocate::relocate,
8448 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8449 Adjust call to Target_arm::get_real_reloc_type.
8450 (Target_arm::get_real_reloc_type): Use command line options
8451 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8452 * options.h (--target1-rel, --target1-abs, --target2): New
8453 ARM-only options.
8454
50aeb7d4
DK
84552009-11-25 Doug Kwan <dougkwan@google.com>
8456
8457 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8458 class definition. Add code to handle --target1-rel, --target1-abs
8459 and --target2= options.
8460 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8461 and const.
8462 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8463 member declaration.
8464 (Target_arm::Scan::local, Target_arm::Scan::global,
8465 Target_arm::Relocate::relocate,
8466 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8467 call to Target_arm::get_real_reloc_type.
8468 (Target_arm::get_real_reloc_type): Use command line options to
8469 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8470 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8471 options.
8472
51938283
DK
84732009-11-25 Doug Kwan <dougkwan@google.com>
8474
8475 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8476 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8477 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8478 formatting.
8479 (Arm_relocate_functions::thm_call): Replace body with a call to
8480 Arm_relocate_functions::thumb_branch_common.
8481 (Arm_relocate_functions::thm_jump24,
8482 Arm_relocate_functions::thm_xpc22): New method definitions.
8483 (Arm_relocate_functions::thumb_branch_common): New method definition.
8484 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8485 operator.
8486 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8487 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8488
e2b8f3c4
RÁE
84892009-11-24 Rafael Avila de Espindola <espindola@google.com>
8490
8491 * Makefile.am: Build incremental-dump
8492 * Makefile.in: Regenerate.
8493 * incremental-dump.cc: New.
8494 * incremental.cc (Incremental_inputs_header_data,
8495 Incremental_inputs_entry_data): Move to incremental.h
8496 * incremental.h: (Incremental_inputs_header_data,
8497 Incremental_inputs_entry_data): Move from incremental.cc
8498
bcba9aec
RÁE
84992009-11-24 Rafael Avila de Espindola <espindola@google.com>
8500
8501 * incremental.cc (Incremental_inputs_header,
8502 Incremental_inputs_header_write, Incremental_inputs_entry,
8503 Incremental_inputs_entry_write): Add a typedef with the data type.
8504
7c3afe08
RÁE
85052009-11-24 Rafael Avila de Espindola <espindola@google.com>
8506
8507 * incremental.cc (Incremental_inputs_header,
8508 Incremental_inputs_header_write, Incremental_inputs_entry,
8509 Incremental_inputs_entry_write): Update comment about which
8510 type has the filed descriptions.
8511
d204b6e9
DK
85122009-11-15 Doug Kwan <dougkwan@google.com>
8513
8514 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8515 (Arm_relocate_functions::arm_branch_common): Change method defintion
8516 in class definition to a method declaration and update list of formal
8517 parameters.
8518 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8519 Arm_relocation_functions::jump24): Adjust call to
8520 Arm_relocate_functions::arm_branch_common. Update list of formal
8521 parameters.
8522 (Arm_relocate_functions::xpc25): New method definition.
8523 (Arm_relocate_functions::arm_branch_common): Move method defintion
8524 out from class definition. Use stubs for mode-switching and extending
8525 branch ranges.
8526 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8527 specially. Change code to enable use of stubs in ARM branches.
8528
43d12afe
DK
85292009-11-10 Doug Kwan <dougkwan@google.com>
8530
8531 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8532 in method declaration.
8533 (Target_arm::relocate_stub): New method declaration.
8534 (Target_arm::default_target): Change to return a pointer instead of
8535 a const reference.
8536 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8537 Target_arm::default_target.
8538 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8539 method definition.
8540 (Target_arm::relocate_section): Adjust view.
8541 (Target_arm::relocate_stub): New method definition.
8542
ac33a407
DK
85432009-11-10 Doug Kwan <dougkwan@google.com>
8544
8545 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8546 a format warning.
8547 * incremental.cc (open_incremental_binary): Initialized local
8548 variables to avoid warnings.
8549 * object.cc (make_elf_object): Ditto.
8550 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8551 a format warning.
e1df38aa 8552
88ee28e9
L
8553009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8554
8555 PR gold/10930
8556 * testsuite/plugin_test.c: Include "config.h".
8557
2daedcd6
DK
85582009-11-09 Doug Kwan <dougkwan@google.com>
8559
8560 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8561 (arm_symbol_value): Remove.
8562 (Arm_relocate_functions::arm_branch_common,
8563 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8564 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8565 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8566 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8567 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8568 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8569 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8570 Arm_relocate_functions::thm_mobw_abs_nc,
8571 Arm_relocate_functions::thm_mov_abs,
8572 Arm_relocate_functions::movw_prel_nc,
8573 Arm_relocate_functions::thm_movt_abs,
8574 Arm_relocate_functions::movt_prel,
8575 Arm_relocate_functions::thm_movw_prel_nc,
8576 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8577 (Target_arm::Relocate::relocate): Only decompose address into two
8578 parts if relocation type uses the thumb-bit and pass the actual
8579 bit instead of a flag indicating that the thumb-bit is used. Adjust
8580 calls to methods in Arm_relocate_functions for this change.
8581
1276bc89 85822009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
8583
8584 PR 10925
8585 * reloc.cc: Instantiate
8586 Sized_relobj::initialize_input_to_output_maps and
8587 Sized_relobj:free_input_to_output_maps.
8588
e53ad1b5
ILT
85892009-11-06 Ian Lance Taylor <iant@google.com>
8590
8591 PR 10876
8592 * defstd.cc (in_segment): Set only_if_ref true for "end".
8593
eb44217c
DK
85942009-11-06 Doug Kwan <dougkwan@google.com>
8595
8596 * arm.cc (class Reloc_stub): Correct a comment.
8597 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8598 (Target_arm::scan_section_for_stubs): New method declaration.
8599 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8600 Change methods from private to protected.
8601 (Target_arm::do_may_relax): New method definition.
8602 (Target_arm::do_relax, Target_arm::group_sections,
8603 Target_arm::scan_reloc_for_stub,
8604 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8605 (Target_arm::arm_input_section_map_): New data member declaration.
8606 (Target_arm::scan_reloc_for_stub,
8607 Target_arm::scan_reloc_section_for_stubs,
8608 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8609 Target_arm::do_relax): New method definitions.
8610
5d329b7d
ILT
86112009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8612
8613 * configure.ac: Check for (struct stat)::st_mtim
8614 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8615 * config.in: Regenerate.
8616 * configure: Regenerate.
8617
96a0d71b
ILT
86182009-11-05 Ian Lance Taylor <iant@google.com>
8619
8620 PR 10910
8621 * output.cc (Output_segment::add_output_section): Add missing
8622 return statement.
8623
594c8e5e
ILT
86242009-11-04 Ian Lance Taylor <iant@google.com>
8625
8626 PR 10880
8627 * object.h (class Object): Add is_needed and set_is_needed
8628 methods. Add is_needed_ field. Make bool fields into bitfields.
8629 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8630 defined in a dynamic object and referenced by a regular object,
8631 set is_needed for the dynamic object.
8632 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8633 if the file is marked with as_needed and it is not needed.
8634
22b127cc
ILT
86352009-11-04 Ian Lance Taylor <iant@google.com>
8636
8637 PR 10887
8638 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8639 tags if data is discarded by linker script.
8640 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8641 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8642 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8643 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8644
f5c870d2
ILT
86452009-11-04 Ian Lance Taylor <iant@google.com>
8646
8647 * layout.cc (Layout::get_output_section): Add is_interp and
8648 is_dynamic_linker_section parameters. Change all callers.
8649 (Layout::choose_output_section): Likewise.
8650 (Layout::make_output_section): Likewise.
8651 (Layout::add_output_section_data): Add is_dynamic_linker_section
8652 parameter. Change all callers.
8653 * layout.h (class Layout): Update declarations.
8654 * output.h (class Output_section): Add is_interp, set_is_interp,
8655 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8656 Add is_interp_, is_dynamic_linker_section_ fields. Change
8657 generate_code_fills_at_write_ to a bitfield.
8658 * output.cc (Output_section::Output_sections): Initialize new
8659 fields.
8660 (Output_segment::add_output_section): Add do_sort parameter.
8661 Change all callers.
8662
1ae4d23b
ILT
86632009-11-03 Ian Lance Taylor <iant@google.com>
8664
8665 PR 10860
8666 * options.h (class General_options): Add --warn-common.
8667 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8668 merging two common symbols.
8669 (Symbol_table::should_override): Handle --warn-common when merging
8670 a common symbol with a defined symbol. Use report_resolve_problem
8671 for multiple definitions.
8672 (Symbol_table::report_resolve_problem): New function.
8673 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8674
55da9579
DK
86752009-11-03 Doug Kwan <dougkwan@google.com>
8676
8677 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8678 stub_factory_.
8679 (Target_arm::stub_factory): New method definition.
8680 (Target_arm::new_arm_input_section,
8681 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8682 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 8683 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
8684 New type definitions.
8685 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8686 member declarations.
8687 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8688 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8689 New method definitions.
8690
37a9ac43
ILT
86912009-11-03 Ian Lance Taylor <iant@google.com>
8692
8693 * options.h (class General_options): Add --warn_constructors.
8694
b3d6a3d4
ILT
86952009-11-03 Ian Lance Taylor <iant@google.com>
8696
8697 PR 10893
8698 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8699 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8700
934b01dd
ILT
87012009-11-03 Ian Lance Taylor <iant@google.com>
8702
8703 PR 10895
8704 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8705 --msgid-bugs-address.
8706 (install-pdf): New target.
8707 (install-data_yes): Look up one directory to find mkinstalldirs.
8708
03c1939b
L
87092009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8710
8711 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8712 tree.
8713
ebd95253
DK
87142009-10-30 Doug Kwan <dougkwan@google.com>
8715
8716 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8717
e9bbb538
DK
87182009-10-30 Doug Kwan <dougkwan@google.com>
8719
8720 * arm.cc (Stub_addend_reader): New struct template definition
8721 and partial specializations.
8722 (Stub_addend_reader::operator()): New method definition for a
8723 partially specialized template.
8724
d5b40221
DK
87252009-10-30 Doug Kwan <dougkwan@google.com>
8726
8727 * arm.cc (Arm_relobj::processor_specific_flags): New method
8728 definition.
8729 (Arm_relobj::do_read_symbols): New method declaration.
8730 (Arm_relobj::processor_specific_flags_): New data member declaration.
8731 (Arm_dynobj): New class definition.
8732 (Target_arm::do_finalize_sections): Add input_objects parameter.
8733 (Target_arm::do_adjust_elf_header): New method declaration.
8734 (Target_arm::are_eabi_versions_compatible,
8735 (Target_arm::merge_processor_specific_flags): New method declaration.
8736 (Target_arm::do_make_elf_object): New overloaded method definitions
8737 and declaration.
8738 (Arm_relobj::do_read_symbols): New method definition.
8739 (Arm_dynobj::do_read_symbols): Ditto.
8740 (Target_arm::do_finalize_sections): Add input_objects parameters.
8741 Merge processor-specific flags from all input objects.
8742 (Target_arm::are_eabi_versions_compatible,
8743 Target_arm::merge_processor_specific_flags,
8744 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8745 New method definitions.
8746 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8747 Input_objects pointer type parameter.
8748 * layout.cc (Layout::finalize): Pass input objects to target's.
8749 finalize_sections function.
8750 * output.cc (Output_file_header::do_sized_write): Set ELF file
8751 header's processor-specific flags.
8752 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8753 Input_objects pointer type parameter.
8754 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8755 * target.h (Input_objects): New forward class declaration.
8756 (Target::processor_specific_flags,
8757 Target::are_processor_specific_flags_sect): New method definitions.
8758 (Target::finalize_sections): Add input_objects parameter.
8759 (Target::Target): Initialize processor_specific_flags_ and
8760 are_processor_specific_flags_set_.
8761 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8762 parameter.
8763 (Target::set_processor_specific_flags): New method definition.
8764 (Target::processor_specific_flags_,
8765 Target::are_processor_specific_flags_set_): New data member
8766 declarations.
8767 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8768 Input_objects pointer type parameter.
8769
ebabffbd
DK
87702009-10-30 Doug Kwan <dougkwan@google.com>
8771
8772 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8773
ad0f2072
ILT
87742009-10-28 Ian Lance Taylor <iant@google.com>
8775
8776 * object.h (class Relobj): Drop options parameter from
8777 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8778 do_scan_relocs, do_relocate. Change all callers.
8779 (class Sized_relobj): Drop options parameters from
8780 do_gc_process_relocs, do_scan_relocs, do_relocate,
8781 do_relocate_sections, relocate_sections, emit_relocs_scan,
8782 emit_relocs_scan_reltype. Change all callers.
8783 (struct Relocate_info): Remove options field and all references to
8784 it.
8785 * reloc.h (class Read_relocs): Remove options constructor
8786 parameter and options_ field. Change all callers.
8787 (class Gc_process_relocs, class Scan_relocs): Likewise.
8788 (class Relocate_task): Likewise.
8789 * target-reloc.h (scan_relocs): Remove options parameter. Change
8790 all callers.
8791 (scan_relocatable_relocs): Likewise.
8792 * target.h (class Sized_target): Remove options parameter from
8793 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8794 all callers.
8795 * gc.h (gc_process_relocs): Remove options parameter. Change all
8796 callers.
8797 * arm.cc: Update functions to remove options parameters.
8798 * i386.cc: Likewise.
8799 * powerpc.cc: Likewise.
8800 * sparc.cc: Likewise.
8801 * x86_64.cc: Likewise.
8802 * testsuite/testfile.cc: Likewise.
8803
8ffa3667
DK
88042009-10-28 Doug Kwan <dougkwan@google.com>
8805
8806 * arm.cc (Arm_relobj): New class definition.
e1df38aa 8807 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
8808 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8809 New method definitions.
8810
40f36857
CC
88112009-10-28 Cary Coutant <ccoutant@google.com>
8812
8813 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8814 (Plugin::cleanup_done_): New member.
8815 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8816 (Plugin_manager::cleanup_done_): Remove.
8817 (Plugin_manager::add_input_file): Edit error message.
8818 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8819 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8820
2c849493
ILT
88212009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8822
8823 * fileread.cc: (File_read::View::~View): Use the new
8824 data_ownership_ filed.
8825 (File_read::~File_read): Dispose the new whole_file_view_.
8826 (File_read::open): Mmap the whole file if needed.
8827 (File_read::open): Use whole_file_view_ instead of contents_.
8828 (File_read::find_view): Use whole_file_view_ if applicable.
8829 (File_read::do_read): Use whole_file_view_ instead of contents_.
8830 (File_read::make_view): Use whole_file_view_ instead of contents_,
8831 update File_read::View::View call.
8832 (File_read::find_or_make_view): Update File_read::View::View
8833 call.
8834 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8835 remove contents_
8836 (File_read::View::Data_ownership): New enum.
8837 (File_read::View::View): Replace bool mapped_ with Data_ownership
8838 argument.
8839 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8840 (File_read::View::data_ownership_): New field.
8841 (File_read::contents_): Remove (replaced by whole_file_view_).
8842 (File_read::whole_file_view_): New field.
8843 * options.h (class General_options): Add --keep-files-mapped.
8844
24998053
CC
88452009-10-27 Cary Coutant <ccoutant@google.com>
8846
8847 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8848 * testsuite/Makefile.am (plugin_test_5): New test case.
8849 * testsuite/Makefile.in: Regenerate.
8850
72adc4fa
DK
88512009-10-25 Doug Kwan <dougkwan@google.com>
8852
8853 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8854 from private to protected to allow access by child class.
8855 (Sized_relobj::do_relocate_sections): New method declaration.
8856 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 8857 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
8858 Sized_relobj::relocate_sections. Instantiate template explicitly
8859 for different target sizes and endianity.
8860
07f508a2
DK
88612009-10-24 Doug Kwan <dougkwan@google.com>
8862
8863 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8864 (Arm_input_section::as_arm_input_section): New method.
8865 (Arm_output_section): New class definition.
8866 (Arm_output_section::create_stub_group,
8867 Arm_output_section::group_sections): New method definitions.
8868
10ad9fe5
DK
88692009-10-22 Doug Kwan <dougkwan@google.com>
8870
8871 * arm.cc (Arm_input_section): New class definition.
8872 (Arm_input_section::init, Arm_input_section:do_write,
8873 Arm_input_section::set_final_data_size,
8874 Arm_input_section::do_reset_address_and_file_offset): New method
8875 definitions.
8876
56ee5e00
DK
88772009-10-21 Doug Kwan <dougkwan@google.com>
8878
8879 * arm.cc (Stub_table, Arm_input_section): New forward class
8880 declarations.
8881 (Stub_table): New class defintion.
8882 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8883 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8884 New method definition.
8885
b569affa
DK
88862009-10-21 Doug Kwan <dougkwan@google.com>
8887
8888 * arm.cc: Update copyright comments.
8889 (Target_arm): New forward class template declaration.
8890 (Arm_address): New type.
8891 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8892 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8893 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8894 constants.
8895 (Insn_template): Same.
8896 (DEF_STUBS): New macro.
8897 (Stub_type): New enum type.
8898 (Stub_template): New class definition.
8899 (Stub): Same.
8900 (Reloc_stub): Same.
8901 (Stub_factory): Same.
8902 (Target_arm::Target_arm): Initialize may_use_blx_ and
8903 should_force_pic_veneer_.
8904 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8905 Target_arm::should_force_pic_veneer,
8906 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8907 Target_arm::using_thumb_only, Target_arm:;default_target): New
8908 method defintions.
8909 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8910 New data member declarations.
8911 (Insn_template::size, Insn_template::alignment): New method defintions.
8912 (Stub_template::Stub_template): New method definition.
8913 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8914 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8915 (Stub_factory::Stub_factory): New method definition.
8916 * gold.h (string_hash): New template.
8917 * output.h (Input_section_specifier::hash_value): Use
8918 gold::string_hash.
8919 (Input_section_specifier::string_hash): Remove.
8920 * stringpool.cc (Stringpool_template::string_hash): Use
8921 gold::string_hash.
8922
6c172549
DK
89232009-10-20 Doug Kwan <dougkwan@google.com>
8924
8925 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8926 symbols of relaxed input sections.
8927 * output.h (Output_section::find_relaxed_input_section): Make
8928 method public.
8929
c5617f2f
DK
89302009-10-16 Doug Kwan <dougkwan@google.com>
8931
8932 * dynobj.cc (Versions::Versions): Initialize version_script_.
8933 Only insert base version symbol definition for a shared object
8934 if version script defines any version versions.
8935 (Versions::define_base_version): New method definition.
8936 (Versions::add_def): Check that base version is not needed.
8937 (Versions::add_need): Define base version lazily.
8938 * dynobj.h (Versions::define_base_version): New method declaration.
8939 (Versions::needs_base_version_): New data member declaration.
8940 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8941 (check_DATA): Add no_version_test.stdout.
8942 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8943 New make rules.
8944 * testsuite/Makefile.in: Regenerate.
8945 * testsuite/no_version_test.c: New file.
8946 * testsuite/no_version_test.sh: Ditto.
8947
3c12dcdb
DK
89482009-10-16 Doug Kwan <dougkwan@google.com>
8949
8950 * expression.cc (class Segment_start_expression): New class definition.
8951 (Segment_start_expression::value): New method definition.
8952 (script_exp_function_segment_start): Return a new
8953 Segment_start_expression.
8954 * gold/script-c.h (script_saw_segment_start_expression): New function
8955 prototype.
8956 * script-sections.cc (Script_sections::Script_sections): Initialize
8957 SAW_SEGMENT_START_EXPRESSION_ to false.
8958 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8959 and -Tbbs options to specify section addresses if given in
8960 command line and no SEGMENT_START expression is seen in a script.
8961 * script-sections.h (Script_sections::saw_segment_start_expression,
8962 Script_sections::set_saw_segment_start_expression): New method
8963 definition.
8964 (Script_sections::saw_segment_start_expression_): New data member
8965 declaration.
8966 * script.cc (script_saw_segment_start_expression): New function.
8967 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8968 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8969 script_test_7.sh and script_test_8.sh.
8970 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8971 script_test_8.stdout.
8972 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8973 (script_test_6, script_test_6.stdout, script_test_7,
8974 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8975 * Makefile.in: Regenerate.
8976 * testsuite/script_test_6.sh: New file.
8977 * testsuite/script_test_6.t: Same.
8978 * testsuite/script_test_7.sh: Same.
8979 * testsuite/script_test_7.t: Same.
8980 * testsuite/script_test_8.sh: Same.
8981
64b1ae37
DK
89822009-10-16 Doug Kwan <dougkwan@google.com>
8983
8984 * output.cc (Output_segment::set_section_list_address): Cast
8985 expressions to unsigned long long type to avoid format warnings.
8986
661be1e2
ILT
89872009-10-15 Ian Lance Taylor <iant@google.com>
8988
12edd763 8989 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 8990 dot assignment to script_sections_.
12edd763
ILT
8991 * script-sections.cc (Script_sections::add_dot_assignment):
8992 Initialize if necessary.
8993
68b6574b
ILT
8994 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8995 program headers with no load segment if there is a linker script.
8996
661be1e2
ILT
8997 * layout.cc (Layout::set_segment_offsets): Align the file offset
8998 to the segment aligment for -N or -n with no load segment.
8999 * output.cc (Output_segment::add_output_section): Don't crash if
9000 the first section is a TLS section.
9001 (Output_segment::set_section_list_addresses): Print an error
9002 message if the address moves backward in a linker script.
9003 * script-sections.cc
9004 (Output_section_element_input::set_section_addresses): Don't
9005 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9006 (Orphan_output_section::set_section_addresses): Likewise.
9007
f15f61a7
DK
90082009-10-15 Doug Kwan <dougkwan@google.com>
9009
9010 * layout.cc (Layout::finish_dynamic_section): Generate tags
9011 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9012 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9013 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9014
82bb573a
ILT
90152009-10-14 Ian Lance Taylor <iant@google.com>
9016
9017 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9018 fields.
9019 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9020 data_shdr fields of relinfo.
9021 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9022 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9023 R_386_TLS_LDO_32, adjust based on section flags.
9024 (Target_i386::Relocate::fix_up_ldo): Remove.
9025
374ad285
ILT
90262009-10-13 Ian Lance Taylor <iant@google.com>
9027
9028 Add support for -pie.
9029 * options.h (class General_options): Add -pie and
9030 --pic-executable.
9031 (General_options::output_is_position_independent): Test -pie.
9032 (General_options::output_is_executable): Return true if not shared
9033 and not relocatable.
9034 (General_options::output_is_pie): Remove.
9035 * options.cc (General_options::finalize): Reject incompatible uses
9036 of -pie.
9037 * gold.cc (queue_middle_tasks): A -pie link is not static.
9038 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9039 * symtab.cc (Symbol::final_value_is_known): Return false if
9040 output_is_position_independent.
9041 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9042 output_is_position_independent.
9043 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9044 output_is_position_independent.
9045 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9046 output_is_position_independent.
9047 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9048 two_file_pie_test.
9049 (basic_pie_test.o, basic_pie_test): New targets.
9050 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9051 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9052 (two_file_pie_test): New target.
9053 * testsuite/Makefile.in: Rebuild.
9054 * README: Remove note saying that -pie is not supported.
9055
c6585162
ILT
90562009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9057
9058 * options.h (class General_options): Add -init and -fini.
9059 * layout.cc (Layout::finish_dynamic_section): Emit
9060 given init and fini functions.
9061
032ce4e9
ST
90622009-10-13 Sriraman Tallam <tmsriram@google.com>
9063
9064 * gc.h (gc_process_relocs): Check if icf is enabled using new
9065 function.
9066 * gold.cc (queue_initial_tasks): Likewise.
9067 (queue_middle_tasks): Likewise.
9068 * object.cc (do_layout): Likewise.
9069 * symtab.cc (is_section_folded): Likewise.
9070 * main.cc (main): Likewise.
9071 * reloc.cc (Read_relocs::run): Likewise.
9072 (Sized_relobj::do_scan_relocs): Likewise.
9073 * icf.cc (is_function_ctor_or_dtor): New function.
9074 (Icf::find_identical_sections): Check if function is ctor or dtor when
9075 safe icf is chosen.
9076 * options.h (General_options::icf): Change option to be an enum.
9077 (Icf_status): New enum.
9078 (icf_enabled): New method.
9079 (icf_safe_folding): New method.
9080 (set_icf_status): New method.
9081 (icf_status_): New variable.
9082 * (options.cc) (General_options::finalize): Set icf_status_.
9083 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9084 icf_test and icf_keep_unique_test to use the --icf enum flag.
9085 * testsuite/icf_safe_test.sh: New file.
e1df38aa 9086 * testsuite/icf_safe_test.cc: New file.
032ce4e9 9087
f345227a
ST
90882009-10-12 Sriraman Tallam <tmsriram@google.com>
9089
9090 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9091 includes to gc.h and icf.h.
9092 * arm.cc: Include gc.h.
9093 * gold.cc: Likewise.
9094 * i386.cc: Likewise.
9095 * powerpc.cc: Likewise.
9096 * sparc.cc: Likewise.
9097 * x86_64.cc: Likewise.
9098 * gc.h: Include icf.h.
9099
1c7814ed
ILT
91002009-10-11 Ian Lance Taylor <iant@google.com>
9101
9102 * plugin.cc: Include "gold.h" before other header files.
9103
ae3b5189
CD
91042009-10-10 Chris Demetriou <cgd@google.com>
9105
9106 * options.h (Input_file_argument::Input_file_type): New enum.
9107 (Input_file_argument::is_lib_): Replace with...
9108 (Input_file_argument::type_): New member.
9109 (Input_file_argument::Input_file_argument): Take Input_file_type
9110 'type' rather than boolean 'is_lib' as second argument.
9111 (Input_file_argument::is_lib): Use type_.
9112 (Input_file_argument::is_searched_file): New function.
9113 (Input_file_argument::may_need_search): Handle is_searched_file.
9114 * options.cc (General_options::parse_library): Support -l:filename.
9115 (General_options::parse_just_symbols): Update for Input_file_argument
9116 changes.
9117 (Command_line::process): Likewise.
9118 * archive.cc (Archive::get_file_and_offset): Likewise.
9119 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9120 * script.cc (read_script_file, script_add_file): Likewise.
9121 * fileread.cc (Input_file::Input_file): Likewise.
9122 (Input_file::will_search_for): Handle is_searched_file.
9123 (Input_file::open): Likewise.
9124 * readsyms.cc (Read_symbols::get_name): Likewise.
9125 * testsuite/Makefile.am (searched_file_test): New test.
9126 * testsuite/Makefile.in: Regenerate.
9127 * testsuite/searched_file_test.cc: New file.
9128 * testsuite/searched_file_test_lib.cc: New file.
9129
f3048a1d
ILT
91302009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9131 Ian Lance Taylor <iant@google.com>
9132
9133 * descriptor.cc: Include <cstdio> and "binary-io.h".
9134 (Descriptors::open): Open the files in binary mode always.
9135 * script.cc (Lex::get_token): Treat \r as whitespace.
9136
d4780e57
ILT
91372009-10-09 Ian Lance Taylor <iant@google.com>
9138
9139 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9140
d9a893b8
ILT
91412009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9142 Ian Lance Taylor <iant@google.com>
9143
9144 * configure.ac: Check for readv function also.
9145 * fileread.cc (readv): Define if not HAVE_READV.
9146 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9147 does not exist.
9148 * config.in: Regenerate.
9149 * configure: Regenerate.
9150
c0a62865
DK
91512009-10-09 Doug Kwan <dougkwan@google.com>
9152
9153 * layout.cc (Layout::make_output_section): Call target hook to make
9154 ordinary output section.
9155 (Layout::finalize): Adjust parameter list of call the
9156 Target::may_relax().
9157 * layout.h (class Layout::section_list): New method.
9158 * merge.h (Output_merge_base::entsize): Change visibility to public.
9159 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9160 New methods.
9161 (Output_merge_string::do_is_string): New method.
9162 * object.cc (Sized_relobj::do_setup): renamed from
9163 Sized_relobj::set_up.
9164 * object.h (Sized_relobj::adjust_shndx,
9165 Sized_relobj::initializ_input_to_output_maps,
9166 Sized_relobj::free_input_to_output_maps): Change visibilities to
9167 protected.
9168 (Sized_relobj::setup): Virtualize.
9169 (Sized_relobj::do_setup): New method declaration.
9170 (Sized_relobj::invalidate_section_offset,
9171 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9172 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9173 * options.cc (parse_int): New function.
9174 * options.h (parse_int): New declaration.
9175 (DEFINE_int): New macro.
9176 (stub_group_size): New option.
9177 * output.cc (Output_section::Output_section): Initialize memebers
9178 merge_section_map_, merge_section_by_properties_map_,
9179 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9180 (Output_section::add_input_section): Handled deferred code-fill
9181 generation and remove an old comment.
9182 (Output_section::add_relaxed_input_section): New method definition.
9183 (Output_section::add_merge_input_section): Use merge section by
9184 properties map to speed to search. Update merge section maps
9185 as appropriate.
9186 (Output_section::build_relaxation_map): New method definition.
9187 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9188 Same.
9189 (Output_section::relax_input_section): Renamed to
9190 Output_section::convert_input_sections_to_relaxed_sections and change
9191 interface to take a vector of pointers to relaxed sections.
9192 (Output_section::find_merge_section,
9193 Output_section::find_relaxed_input_section): New method definitions.
9194 (Output_section::is_input_address_mapped,
9195 Output_section::output_offset, Output_section::output_address):
9196 Use output section data maps to speed up searching.
9197 (Output_section::find_starting_output_address): Add comments.
9198 (Output_section::do_write,
9199 Output_section::write_to_postprocessing_buffer): Do code-fill
9200 generation as appropriate.
9201 (Output_section::get_input_sections): Invalidate relaxed input section
9202 map.
9203 (Output_section::restore_states): Adjust type of checkpoint .
9204 Invalidate relaxed input section map.
9205 * output.h (Output_merge_base): New class declaration.
9206 (Input_section_specifier): New class defintion.
9207 (class Output_relaxed_input_section) Change base class to
9208 Output_section_data_build.
9209 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9210 base class initializer.
9211 (Output_section::add_relaxed_input_section): New method declaration.
9212 (Output_section::Input_section): Change visibility to protected.
2e702c99 9213 (Output_section::Input_section::relobj,
c0a62865
DK
9214 Output_section::Input_section::shndx): Handle relaxed input sections.
9215 Output_section::input_sections) Change visibility to protected. Also
9216 define overload to return a non-const pointer.
9217 (Output_section::Merge_section_properties): New class defintion.
9218 (Output_section::Merge_section_by_properties_map,
9219 Output_section::Output_section_data_by_input_section_map,
9220 Output_section::Relaxation_map): New types.
9221 (Output_section::relax_input_section): Rename method to
9222 Output_section::convert_input_sections_to_relaxed_sections and change
9223 interface to take a vector of relaxed section pointers.
9224 (Output_section::find_merge_section,
9225 Output_section::find_relaxed_input_section,
9226 Output_section::build_relaxation_map,
9227 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9228 New method declarations.
9229 (Output_section::merge_section_map_
9230 Output_section::merge_section_by_properties_map_,
9231 Output_section::relaxed_input_section_map_,
9232 Output_section::is_relaxed_input_section_map_valid_,
9233 Output_section::generate_code_fills_at_write_): New data members.
9234 * script-sections.cc
9235 (Output_section_element_input::set_section_addresses): Call
9236 current_data_size and addralign methods of relaxed input sections.
9237 (Orphan_output_section::set_section_addresses): Call current_data_size
9238 and addralign methods of relaxed input sections.
9239 * symtab.cc (Symbol_table::compute_final_value): Extract template
9240 from the body of Symbol_table::sized_finalize_symbol.
9241 (Symbol_table::sized_finalized_symbol): Call
9242 Symbol_table::compute_final_value.
9243 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9244 (Symbol_table::compute_final_value): New templated method declaration.
9245 * target.cc (Target::do_make_output_section): New method defintion.
9246 * target.h (Target::make_output_section): New method declaration.
9247 (Target::relax): Add more parameters for input objects, symbol table
9248 and layout. Adjust call to do_relax.
9249 (Target::do_make_output_section): New method declaration.
9250 (Target::do_relax): Add parameters for input objects, symbol table
9251 and layout.
9252
d446d6c4
ILT
92532009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9254
9255 * pread.c: Include stdio.h.
9256
bc06c745
ILT
92572009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9258
9259 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9260 defined.
9261
75aea3d0
ILT
92622009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9263
9264 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9265 Change read_shndx type to unsigned int.
9266 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9267 int.
9268 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9269 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9270 Change read_shndx type to unsigned int.
9271 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9272 int.
9273 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9274 * layout.cc (Layout::create_symtab_sections): Cast the result of
9275 local_symcount * symsize to off_t in the gold_assert.
9276
be8fcb75
ILT
92772009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9278
9279 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9280 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9281 R_ARM_BASE_ABS.
9282 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9283 (Arm_relocate_functions::thm_abs5): New function.
9284 (Arm_relocate_functions::abs12): New function.
9285 (Arm_relocate_functions::abs16): New function.
9286 (Arm_relocate_functions::base_abs): New function.
9287 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9288 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9289 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9290 R_ARM_BASE_ABS.
9291 (Scan::global): Likewise.
9292 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9293 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9294 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9295 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9296 R_ARM_BASE_ABS.
9297
c2a122b6
ILT
92982009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9299
9300 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9301 (Arm_relocate_functions::movt_prel): New function.
9302 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9303 (Arm_relocate_functions::thm_movt_prel): New function.
9304 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9305 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9306 (Scan::global, Relocate::relocate): Likewise.
9307 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9308
c4aa1e2d
ILT
93092009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9310
9311 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9312 Incremental_checker.
9313 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9314 unsigned int.
9315 (class Incremental_inputs_header): New class.
9316 (Incremental_inputs_header_writer): Edit comment.
9317 (Incremental_inputs_entry): New class.
9318 (Incremental_inputs_entry_writer): Edit comment.
9319 (Sized_incremental_binary::do_find_incremental_inputs_section):
9320 Add *strtab_shndx parameter, fill it.
9321 (Sized_incremental_binary::do_check_inputs): New method.
9322 (Incremental_checker::can_incrementally_link_output_file): Use
9323 Sized_incremental_binary::check_inputs.
9324 (Incremental_inputs::report_command_line): Save command line in
9325 command_line_.
9326 * incremental.h:
9327 (Incremental_binary::find_incremental_inputs_section): New
9328 method.
9329 (Incremental_binary::do_find_incremental_inputs_section): Add
9330 strtab_shndx parameter.
9331 (Incremental_binary::do_check_inputs): New pure virtual method.
9332 (Sized_incremental_binary::do_check_inputs): Declare.
9333 (Incremental_checker::Incremental_checker): Add incremental_inputs
9334 parameter, use it to initialize incremental_inputs_.
9335 (Incremental_checker::incremental_inputs_): New field.
9336 (Incremental_checker::command_line): New method.
9337 (Incremental_checker::inputs): New method.
9338 (Incremental_checker::command_line_): New field.
9339
c549a694
ILT
93402009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9341
9342 * incremental.cc: Include <cstdarg> and "target-select.h".
9343 (vexplain_no_incremental): New function.
9344 (explain_no_incremental): New function.
9345 (Incremental_binary::error): New method.
9346 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9347 method.
9348 (make_sized_incremental_binary): New function.
9349 (open_incremental_binary): New function.
9350 (can_incrementally_link_file): Add checks if output is ELF and has
9351 inputs section.
9352 * incremental.h: Include "elfcpp_file.h" and "output.h".
9353 (Incremental_binary): New class.
9354 (Sized_incremental_binary): New class.
9355 (open_incremental_binary): Declare.
9356 * object.cc (is_elf_object): Use
9357 elfcpp::Elf_recognizer::is_elf_file.
9358 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9359 * output.h (Output_file::filesize): New method.
9360
fd3c5f0b
ILT
93612009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9362
9363 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9364 New function.
9365 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9366 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9367 function.
9368 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9369 function.
9370 (Arm_relocate_functions::movw_abs_nc): New function.
9371 (Arm_relocate_functions::movt_abs): New function.
9372 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9373 (Arm_relocate_functions::thm_movt_abs): New function.
9374 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9375 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9376 (Scan::global): Likewise.
9377 (Relocate::relocate): Likewise.
9378 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9379
7f5309a5
ILT
93802009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9381
9382 * arm.cc (Arm_relocate_functions::got_prel) New function.
9383 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9384 (Relocate::relocate): Likewise.
9385 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9386
364c7fa5
ILT
93872009-10-06 Ian Lance Taylor <iant@google.com>
9388
9389 * options.h (class General_options): Define
9390 split_stack_adjust_size parameter.
9391 * object.h (class Object): Add uses_split_stack_ and
9392 has_no_split_stack_ fields. Add uses_split_stack and
9393 has_no_split_stack accessor functions. Declare
9394 handle_split_stack_section.
9395 (class Reloc_symbol_changes): Define.
9396 (class Sized_relobj): Define Function_offsets. Declare
9397 split_stack_adjust, split_stack_adjust_reltype, and
9398 find_functions.
9399 * object.cc (Object::handle_split_stack_section): New function.
9400 (Sized_relobj::do_layout): Call handle_split_stack_section.
9401 * dynobj.cc (Sized_dynobj::do_layout): Call
9402 handle_split_stack_section.
9403 * reloc.cc (Sized_relobj::relocate_sections): Call
9404 split_stack_adjust for executable sections in split_stack
9405 objects. Pass reloc_map to relocate_section.
9406 (Sized_relobj::split_stack_adjust): New function.
9407 (Sized_relobj::split_stack_adjust_reltype): New function.
9408 (Sized_relobj::find_functions): New function.
9409 * target-reloc.h: Include "object.h".
9410 (relocate_section): Add reloc_symbol_changes parameter. Change
9411 all callers.
9412 * target.h (class Target): Add calls_non_split method. Declare
9413 do_calls_non_split virtual method. Declare match_view and
9414 set_view_to_nop.
9415 * target.cc: Include "elfcpp.h".
9416 (Target::do_calls_non_split): New function.
9417 (Target::match_view): New function.
9418 (Target::set_view_to_nop): New function.
9419 * gold.cc (queue_middle_tasks): Give an error if mixing
9420 split-stack and non-split-stack objects with -r.
9421 * i386.cc (Target_i386::relocate_section): Add
9422 reloc_symbol_changes parameter.
9423 (Target_i386::do_calls_non_split): New function.
9424 * x86_64.cc (Target_x86_64::relocate_section): Add
9425 reloc_symbol_changes parameter.
9426 (Target_x86_64::do_calls_non_split): New function.
9427 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9428 parameter.
9429 * powerpc.cc (Target_powerpc::relocate_section): Add
9430 reloc_symbol_changes parameter.
9431 * sparc.cc (Target_sparc::relocate_section): Add
9432 reloc_symbol_changes parameter.
9433 * configure.ac: Call AM_CONDITIONAL for the default target.
9434 * configure: Rebuild.
9435 * testsuite/Makefile.am (TEST_AS): New variable.
9436 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9437 (check_DATA): Add split_i386 and split_x86_64 files.
9438 (SPLIT_DEFSYMS): Define.
9439 (split_i386_[1234n].o): New targets.
9440 (split_i386_[124]): New targets.
9441 (split_i386_[1234r].stdout): New targets.
9442 (split_x86_64_[1234n].o): New targets.
9443 (split_x86_64_[124]): New targets.
9444 (split_x86_64_[1234r].stdout): New targets.
9445 (MOSTLYCLEANFILES): Add new executables.
9446 * testsuite/split_i386.sh: New file.
9447 * testsuite/split_x86_64.sh: New file.
9448 * testsuite/split_i386_1.s: New file.
9449 * testsuite/split_i386_2.s: New file.
9450 * testsuite/split_i386_3.s: New file.
9451 * testsuite/split_i386_4.s: New file.
9452 * testsuite/split_i386_n.s: New file.
9453 * testsuite/split_x86_64_1.s: New file.
9454 * testsuite/split_x86_64_2.s: New file.
9455 * testsuite/split_x86_64_3.s: New file.
9456 * testsuite/split_x86_64_4.s: New file.
9457 * testsuite/split_x86_64_n.s: New file.
9458 * testsuite/testfile.cc (Target_test): Update relocation_section
9459 function.
9460 * testsuite/Makefile.in: Rebuild.
9461
e8a9fcda
ILT
94622009-10-06 Ian Lance Taylor <iant@google.com>
9463
9464 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9465 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9466 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9467 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9468 the address on ldo_addrs_.
9469 (Target_i386::Relocate::fix_up_ldo): New function.
9470
e99daf92
ILT
94712009-10-06 Rafael Espindola <espindola@google.com>
9472
9473 * plugin.cc (add_input_library): New.
9474 (Plugin::load): Add add_input_library to tv.
9475 (Plugin_manager::add_input_file): Add the is_lib argument.
9476 (add_input_file): Update call to Plugin_manager::add_input_file.
9477 (add_input_library): New.
9478 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9479
966d4097
DK
94802009-09-30 Doug Kwan <dougkwan@google.com>
9481
9482 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9483 symbol and call Symbol::may_need_copy_reloc to determine if
9484 a copy reloc is needed.
9485 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9486 nocopyreloc is given in command line.
9487 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9488 given in command line.
9489 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9490 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9491 of the removed Target_i386::may_need_copy_reloc.
9492 * options.h (copyreloc): New option with default value false.
9493 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9494 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9495 instead of the removed Target_powerpc::may_need_copy_reloc.
9496 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9497 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9498 instead of the removed Target_sparc::may_need_copy_reloc.
9499 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9500 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9501 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9502 instead of the removed Target_x86_64::may_need_copy_reloc.
9503
029ba973
ILT
95042009-09-30 Ian Lance Taylor <iant@google.com>
9505
9506 * object.h (class Object): Remove target_ field, and target,
9507 sized_target, and set_target methods.
9508 (Object::sized_target): Remove.
9509 (class Sized_relobj): Update declarations. Remove sized_target.
9510 * object.cc (Sized_relobj::setup): Remove target parameter.
9511 Change all callers.
9512 (Input_objects::add_object): Don't do anything with the target.
9513 (make_elf_sized_object): Add punconfigured parameter. Change all
9514 callers. Set or test parameter target.
9515 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9516 Change all callers.
9517 * parameters.cc (Parameters::set_target): Change parameter type to
9518 be non-const.
9519 (Parameters::default_target): Remove.
9520 (set_parameters_target): Change parameter type to be non-const.
9521 (parameters_force_valid_target): New function.
9522 (parameters_clear_target): New function.
9523 * parameters.h (class Parameters): Update declarations. Remove
9524 default_target method. Add sized_target and clear_target
9525 methods. Change target_ to be non-const.
9526 (set_parameters_target): Update declaration.
9527 (parameters_force_valid_target): Declare.
9528 (parameters_clear_target): Declare.
9529 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9530 as NULL if we aren't searching.
9531 (Add_symbols::run): Don't check for compatible target.
9532 * fileread.cc (Input_file::open_binary): Call
9533 parameters_force_valid_target.
9534 * gold.cc (queue_middle_tasks): Likewise.
9535 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9536 set_target on object.
9537 * dynobj.h (class Sized_dynobj): Update declarations.
9538 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9539 make_elf_object returns NULL.
9540 (Archive::include_member): Don't check whether object target is
9541 compatible.
9542 * output.cc (Output_section::add_input_section): Get target from
9543 parameters.
9544 (Output_section::relax_input_section): Likewise.
9545 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9546 parameters.
9547 (Sized_relobj::do_scan_relocs): Likewise.
9548 (Sized_relobj::relocate_sections): Likewise.
9549 * resolve.cc (Symbol_table::resolve): Likewise.
9550 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9551 parameter. Change all callers.
9552 (Symbol_table::add_from_object): Get target from parameters.
9553 (Symbol_table::add_from_relobj): Don't check object target.
9554 (Symbol_table::add_from_dynobj): Likewise.
9555 (Symbol_table::define_special_symbol): Get target from
9556 parameters.
9557 * symtab.h (class Symbol_table): Update declaration.
9558 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9559 parameter. Change all callers. Clear parameter target.
9560 (Binary_test): Test target here.
9561 * testsuite/object_unittest.cc (gold_testsuite): Remove
9562 target_test_pointer parameter. Change all callers.
9563 (Object_test): Test target here.
9564
a6a22b83
ILT
95652009-09-26 Ian Lance Taylor <iant@google.com>
9566
9567 * testsuite/initpri1.c: Don't try to use constructor priorities if
9568 compiling with gcc before 4.3.
9569
6a8f49fe
ILT
95702009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9571
9572 * testsuite/retain_symbols_file_test.sh (check_present): Change
9573 output file name to retain_symbols_file_test.stdout.
9574 (check_absent): Likewise.
9575
8c604651
CS
95762009-09-18 Craig Silverstein <csilvers@google.com>
9577
9578 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9579 * options.cc: Include <cerrno> and <fstream>.
9580 (General_options::finalize): Parse -retain-symbols-file tag.
9581 * options.h: New flag.
9582 (General_options): New method should_retain_symbol, new
9583 variable symbols_to_retain.
9584 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9585 should_retain_symbol map.
9586 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9587 * testsuite/Makefile.in: Regenerate.
9588 * testsuite/retain_symbols_file_test.sh: New file.
9589
ca58b19f
NC
95902009-09-18 Nick Clifton <nickc@redhat.com>
9591
9592 * po/es.po: Updated Spanish translation.
9593
20e6d0d6
DK
95942009-09-17 Doug Kwan <dougkwan@google.com>
9595
9596 * debug.h (DEBUG_RELAXATION): New constant.
9597 (DEBUG_ALL): Add DEBUG_RELAXATION.
9598 (debug_string_to_enum): Add relaxation debug option.
9599 * layout.cc
9600 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9601 Layout::Relaxation_debug_check::read_sections,
9602 Layout::Relaxation_debug_check::read_sections): New method definitions.
9603 (Layout::Layout): Initialize data members
9604 record_output_section_data_from_scrips_,
9605 script_output_section_data_list_ and relaxation_debug_check_.
9606 (Layout::save_segments, Layout::restore_segments,
9607 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9608 Layout::relaxation_loop_body): New method definitions.
9609 (Layout::finalize): Support relaxation. Move section layout code to
9610 Layout::relaxation_loop_body.
9611 (Layout::set_asection_address_from_script): Move code for orphan
9612 section placement out.
9613 (Layout::place_orphan_sections_in_script): New method definition.
9614 * layout.h (Output_segment_headers, Output_file_header):
9615 New forward class declarations.
9616 (Layout::~Layout): Define.
9617 (Layout::new_output_section_data_from_script): New method definition.
9618 (Layout::place_orphan_sections_in_script): New method declaration.
9619 (Layout::Segment_states): New type declaration.
9620 (Layout::save_segments, Layout::restore_segments,
9621 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9622 Layout::relaxation_loop_body): New method declarations.
9623 (Layout::Output_section_data_list): New type declaration.
9624 (Layout::Relaxation_debug_check): New class definition.
9625 (Layout::record_output_section_data_from_script_,
9626 Layout::script_output_section_data_list_, Layout::segment_states_,
9627 Layout::relaxation_debug_check_): New data members.
9628 * output.cc: (Output_section_headers::do_size): New method definition.
9629 (Output_section_headers::Output_section_headers): Move size
9630 computation to Output_section_headers::do_size.
9631 (Output_segment_headers::do_size): New method definition.
e1df38aa 9632 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
9633 Output_file_header::do_size and call it.
9634 (Output_file_header::do_size): New method definition.
9635 (Output_data_group::Output_data_group): Adjust call to
9636 Output_section_data.
9637 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9638 (Output_symtab_xindex::do_write): Add array bound check.
2e702c99 9639 (Output_section::Input_section::print_to_mapfile): Handle
20e6d0d6
DK
9640 RELAXED_INPUT_SECTION_CODE.
9641 (Output_section::Output_section): Initialize data member checkpoint_.
9642 (Output_section::~Output_section): Delete checkpoint object pointed
9643 by checkpoint_.
9644 (Output_section::add_input_section): Always add an Input_section if
9645 relaxing.
9646 (Output_section::add_merge_input_section): Add assert.
9647 (Output_section::relax_input_section): New method definition.
9648 (Output_section::set_final_data_size): Set load address to zero for
9649 an unallocated section.
9650 (Output_section::do_address_and_file_offset_have_reset_values):
9651 New method definition.
9652 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9653 Handle relaxed input section.
9654 (Output_section::sort_attached_input_sections): Checkpoint input
9655 section list lazily.
9656 (Output_section::get_input_sections): Change type of input_sections to
9657 list of Simple_input_section pointers. Checkpoint input section list
9658 lazily. Also handle relaxed input sections.
9659 (Output_section::add_input_section_for_script): Take a reference to
9660 a Simple_input_section object instead of Relobj pointer and section
9661 index as parameter. Handle relaxed input sections.
9662 (Output_section::save_states, Output_section::restore_states): New
9663 method definitions.
9664 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9665 (Output_data::is_data_size_fixed): New method definition.
9666 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9667 if it is fixed.
9668 (Output_data::address_and_file_offset_have_reset_values): New method
9669 definition.
9670 (Output_data::do_address_and_file_offset_have_reset_values): New method
9671 definition.
9672 (Output_data::set_data_size): Check that data size is not fixed.
9673 (Output_data::fix_data_size): New method definition.
9674 (Output_data::is_data_size_fixed_): New data member.
9675 (Output_section_headers::set_final_data_size): New method definition.
9676 (Output_section_headers::do_size): New method declaration.
9677 (Output_segment_headers::set_final_data_size): New method definition.
9678 (Output_segment_headers::do_size): New method declaration.
9679 (Output_file_header::set_final_data_size)::New method definition.
9680 (Output_file_header::do_size)::New method declaration.
9681 (Output_section_data::Output_section_data): Add new parameter
9682 is_data_size_fixed and use it to fix data size.
9683 (Output_data_const::Output_data_const): Adjust call to base class
9684 constructor and fix data size.
9685 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9686 base class constructor and fix data size.
9687 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9688 base class constructor and fix data size.
9689 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9690 class constructor and fix data size.
9691 (Output_data_group::set_final_data_size): New method definition.
9692 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9693 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9694 class constructor and fix data size.
9695 (Output_relaxed_input_section): New class definition.
9696 (Output_section::Simple_input_section): New class definition.
9697 (Output_section::get_input_sections): Adjust parameter list.
9698 (Output_section::add_input_section_for_script): Same.
9699 (Output_section::save_states, Output_section::restore_states,
9700 Output_section::do_address_and_file_offset_have_reset_values,
9701 (Output_section::Input_section::Input_section): Handle
9702 RELAXED_INPUT_SECTION_CODE. Add new overload for
9703 Output_relaxed_input_section.
9704 (Output_section::Input_section::is_input_section,
9705 Output_section::Input_section::set_output_section): Handle relaxed
9706 input section.
9707 (Output_section::Input_section::is_relaxed_input_section,
9708 Output_section::Input_section::output_section_data,
9709 Output_section::Input_section::relaxed_input_section): New method
9710 definitions.
9711 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9712 value.
9713 (Output_section::Input_section::u1_): Update comments.
9714 (Output_section::Input_section::u2_): Add new union member poris.
9715 (Output_section::Checkpoint_output_section): New classs definition.
9716 (Output_section::relax_input_section): New method declaration.
9717 (Output_section::checkpoint_): New data member.
9718 (Output_segment): Update comments.
9719 (Output_segment::Output_segment): Un-privatize copy constructor.
9720 (Output_segment::operator=): Un-privatize.
9721 * script-sections.cc (Output_section_element::Input_section_list):
9722 Change element type to Output_section::Simple_input_section.
9723 (Output_section_element_dot_assignment::set_section_addresses):
9724 Register output section data for relaxation clean up.
9725 (Output_data_exression::Output_data_expression): Adjust call to base
9726 constructor to fix data size.
9727 (Output_section_element_data::set_section_addresses): Register
9728 Output_data_expression object for relaxation clean up.
9729 (struct Input_section_info): Replace Relobj pointer and section index
9730 pair with Output_section::Simple_input_section and Convert struct to a
9731 class.
9732 (Input_section_sorter::operator()): Adjust access to
e1df38aa 9733 Input_section_info data member to use accessors.
20e6d0d6
DK
9734 (Output_section_element_input::set_section_addresses): Use layout
9735 parameter. Adjust code to use Output_section::Simple_input_section
9736 and Input_secction_info classes. Register filler for relaxation
9737 clean up.
9738 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9739 and section index pair with Output_section::Simple_input_section
9740 class. Adjust code accordingly.
9741 (Phdrs_element::release_segment): New method definition.
9742 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9743 segment list.
9744 (Script_sections::release_segments): New method definition.
9745 * gold/script-sections.h (Script_sections::release_segments): New
9746 method declaration.
9747 * gold/target.h (Target::may_relax, Target::relax,
9748 Target::do_may_relax, Target::do_relax): New method definitions.
9749
5e445df6
ILT
97502009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9751
9752 * arm.cc (has_signed_unsigned_overflow): New function.
9753 (Arm_relocate_functions::abs8): New function.
9754 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9755 (Target_arm::Scan::global): Likewise.
9756 (Target_arm::relocate::relocate): Likewise.
9757 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9758 Likewise.
9759
8c604651 97602009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
9761
9762 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9763 * testsuite/Makefile.in: Regenerate.
9764
1e9cc1c2
NC
97652009-09-11 Nick Clifton <nickc@redhat.com>
9766
9767 * po/gold.pot: Updated by the Translation project.
9768
6a89f575
CC
97692009-09-08 Cary Coutant <ccoutant@google.com>
9770
9771 * output.cc (Output_file::open): Add execute permission to empty file.
9772 * testsuite/Makefile.am (permission_test): New test.
9773 * testsuite/Makefile.in: Regenerate.
9774
fdcac5af
ILT
97752009-09-02 Ian Lance Taylor <iant@google.com>
9776
9777 * output.cc (Output_file::resize): Call map_no_anonymous rather
9778 than map.
9779
44453f85
ILT
97802009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9781
9782 * gold.cc: Include "incremental.h".
9783 (queue_initial_tasks): Call Incremental_checker methods.
9784 * incremental.cc: Include "output.h".
9785 (Incremental_checker::can_incrementally_link_output_file): New
9786 method.
9787 * incremental.h (Incremental_checker): New class.
9788
9789 * output.cc (Output_file::open_for_modification): New method.
9790 (Output_file::map_anonymous): Changed return type to bool. Record
9791 map in base_ field.
9792 (Output_file::map_no_anonymous): New method, broken out of map.
9793 (Output_file::map): Use map_no_anonymous and map_anonymous.
9794 * output.h (class Output_file): Update declarations.
9795
293c1386
CC
97962009-08-24 Cary Coutant <ccoutant@google.com>
9797
9798 * options.h (Command_line::Pre_options): New class.
9799 (Command_line::pre_options): New member.
9800 * options.cc (gold::options::ready_to_register): New variable.
9801 (One_option::register_option): Do nothing if not registering options.
9802 Assert if same short option registered twice.
9803 (General_options::General_options): Turn off option registration when
9804 done constructing.
9805 (Command_line::Pre_options::Pre_options): New constructor.
9806
f773f3d2
CC
98072009-08-24 Cary Coutant <ccoutant@google.com>
9808
06a73cfe
CC
9809 * options.h (General_options::no_keep_memory): Remove incorrect
9810 short option.
f773f3d2 9811
a15af8e2
RW
98122009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9813
9814 * Makefile.am (am__skiplex, am__skipyacc): New.
9815 * Makefile.in: Regenerate.
9816
c462b41b
RW
98172009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9818
14ec8efd
RW
9819 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9820 (INCLUDES): ... this.
9821 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9822 (AM_CPPFLAGS): Renamed from ...
9823 (INCLUDE): ... this.
9824 * Makefile.in, testsuite/Makefile.in: Regenerate.
9825
81ecdfbb
RW
9826 * Makefile.in: Regenerate.
9827 * aclocal.m4: Likewise.
9828 * config.in: Likewise.
9829 * configure: Likewise.
9830 * testsuite/Makefile.in: Likewise.
9831
c462b41b
RW
9832 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9833 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9834 * Makefile.in: Regenerate.
9835 * testsuite/Makefile.in: Regenerate.
9836
2da73f13
CC
98372009-08-19 Cary Coutant <ccoutant@google.com>
9838
9839 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9840 symbols in shared libraries overridden by hidden or internal symbols
9841 in the main program.
9842
2db70501
CD
98432009-08-19 Chris Demetriou <cgd@google.com>
9844
9845 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9846 checking source file names in error messages.
9847
f733487b
DK
98482009-08-18 Doug Kwan <dougkwan@google.com>
9849
9850 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9851 an elcpp::Ehdr as parameter. Adjust call to set_target.
9852 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9853 an elfcpp::Ehdr as parameter.
9854 * object.cc (Object::set_target): Remove the version that looks up
9855 a target and sets it.
9856 (Sized_relobj::setup): Take a Target object instead of
9857 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9858 (make_elf_sized_object): Find target and ask target to
9859 make an ELF object.
9860 * object.h: (Object::set_target): Remove the version that looks up
9861 a target and sets it.
9862 (Sized_relobj::setup): Take a Target object instead of
9863 an elfcpp:Ehdr as parameter.
9864 * target.cc: Include dynobj.h.
9865 (Target::do_make_elf_object_implementation): New.
2e702c99 9866 (Target::do_make_elf_object): New.
f733487b
DK
9867 * target.h (Target::make_elf_object): New template declaration.
9868 (Target::do_make_elf_object): New method declarations.
9869 (Target::do_make_elf_object_implementation): New template declaration.
9870
cc70f101
ILT
98712009-08-14 Ian Lance Taylor <iant@google.com>
9872
9873 * gold.h (FUNCTION_NAME): Define.
9874 (gold_unreachable): Use FUNCTION_NAME.
9875
ef5e0cb1
ST
98762009-08-12 Sriraman Tallam <tmsriram@google.com>
9877
9878 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9879 symbol in the --keep-unique list is not found.
9880
48c187ce
ST
98812009-08-12 Sriraman Tallam <tmsriram@google.com>
9882
9883 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9884 been maked as --keep-unique.
9885 (Icf::unfold_section): New function.
9886 * icf.h (Icf::unfold_section): New function.
9887 * options.h (General_options::keep_unique): New option.
9888 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9889 * testsuite/Makefile.in: Regenerate.
9890 * testsuite/icf_keep_unique_test.sh: New file.
9891 * testsuite/icf_keep_unique_test.cc: New file.
9892
645afe0c
CC
98932009-08-12 Cary Coutant <ccoutant@google.com>
9894
9895 PR 10471
9896 * resolve.cc (Symbol_table::resolve): Check for references from
9897 dynamic objects to hidden and internal symbols.
9898 * testsuite/Makefile.am (hidden_test.sh): New test.
9899 * testsuite/Makefile.in: Regenerate.
9900 * testsuite/hidden_test.sh: New script.
9901 * testsuite/hidden_test_1.c: New test source.
9902 * testsuite/hidden_test_main.c: New test source.
9903
11af873f
DK
99042009-08-11 Doug Kwan <dougkwan@google.com>
9905
9906 * arm.cc: Update comments.
9907 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9908 segment to locate the .ARM.exidx section if present.
9909
b9f7d72d
DK
99102009-08-09 Doug Kwan <dougkwan@google.com>
9911
9912 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9913 patch.
9914
ddd3c53c
ST
99152009-08-07 Sriraman Tallam <tmsriram@google.com>
9916 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9917 compiler warnings.
9918
27721062
ST
99192009-08-06 Sriraman Tallam <tmsriram@google.com>
9920
9921 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9922 valid tls_segment only for non-debug-section relocations.
9923 * testsuite/Makefile.am: Add gc_tls_test.
9924 * testsuite/Makefile.in: Regenerate.
9925 * testsuite/gc_tls_test.cc: New file.
9926 * testsuite/gc_tls_test.sh: New file.
9927
ef15dade 99282009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 9929
ef15dade
ST
9930 * icf.cc: New file.
9931 * icf.h: New file.
9932 * Makefile.am (CCFILES): Add icf.cc.
9933 (HFILES): Add icf.h
9934 * Makefile.in: Regenerate.
9935 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9936 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9937 section, symbol and addend information for the relocs.
9938 * gold.cc (queue_middle_tasks): Call identical code folding.
9939 * gold.h: Add defines for multimap.
9940 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9941 to the call of finalize_local_symbols.
9942 * main.cc (main): Create object of class Icf.
9943 * object.cc (Sized_relobj::do_layout): Allow this function to be
9944 called twice during icf.
9945 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9946 to sections marked as identical by icf.
9947 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9948 when available.
9949 (Sized_relobj::do_section_entsize): New function.
9950 * object.h (Object::section_entsize): New function.
9951 (Object::do_section_entsize): New pure virtual function.
9952 (Relobj::finalize_local_symbols): Add new parameter.
9953 (Relobj::do_section_entsize): New function.
9954 * options.h (General_options::icf): New option.
9955 (General_options::icf_iterations): New option.
9956 (General_options::print_icf_sections): New option.
9957 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9958 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9959 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9960 icf.
9961 * symtab.cc (Symbol_table::is_section_folded): New function.
9962 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9963 to sections marked as identical by icf.
9964 * symtab.h (Symbol_table::set_icf): New function.
9965 (Symbol_table::icf): New function.
9966 (Symbol_table::is_section_folded): New function.
9967 (Symbol_table::icf_): New data member.
9968 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9969 * testsuite/Makefile.am: Add commands to build icf_test.
9970 * testsuite/Makefile.in: Regenerate.
9971 * testsuite/icf_test.sh: New file.
9972 * testsuite/icf_test.cc: New file.
9973
c3b65ac4
CD
99742009-07-24 Chris Demetriou <cgd@google.com>
9975
9976 * layout.cc (is_compressible_debug_section): Fix incorrect
9977 comment about compressed section names.
9978
1caf2c51
ILT
99792009-07-20 Ian Lance Taylor <ian@airs.com>
9980
9981 PR 10419
9982 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9983
1ef4d87f
ILT
99842009-07-16 Ian Lance Taylor <iant@google.com>
9985
9986 PR 10400
9987 * layout.h: #include <map>.
9988 (class Kept_section): Change from struct to class. Add accessors
9989 and setters. Add section size to Comdat_group mapping. Change
9990 Comdat_group to std::map. Add is_comdat_ field. Add
9991 linkonce_size field in union.
9992 (class Layout): Update declaration of find_or_add_kept_section.
9993 Don't declare find_kept_object.
9994 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9995 parameter. Add object, shndx, is_comdat, and is_group_name
9996 parameters. Change all callers. Adjust for new Kept_section.
9997 (Layout::find_kept_object): Remove.
9998 * object.cc (Sized_relobj::include_section_group): Update use of
9999 Kept_section. Rename secnum to shndx. Only record
10000 Kept_comdat_section if sections are the same size.
10001 (Sized_relobj::include_linkonce_section): Update use of
10002 Kept_section. Only record Kept_comdat_section if sections are the
10003 same size. Set size of linkonce section.
10004 (Sized_relobj::map_to_kept_section): Update call to
10005 get_kept_comdat_section.
10006 * object.h (class Sized_relobj): Rename fields in
10007 Kept_comdat_section to drop trailing underscores; change object
10008 field to Relobj*. Change Kept_comdat_section_table to store
10009 struct rather than pointer.
10010 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10011 Add kept_object and kept_shndx parameters. Change all callers.
10012 (Sized_relobj::get_kept_comdat_section): Change return type to
10013 bool. Add kept_object and kept_shndx parameters. Change all
10014 callers.
10015 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10016 Layout::find_or_add_kept_section.
10017
37c3b7b0
ILT
100182009-07-09 Ian Lance Taylor <iant@google.com>
10019
10020 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10021 Reserve space in the hash table.
10022
98fa85cb
ILT
100232009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10024
10025 * fileread.cc (File_read::get_mtime): New method.
10026 * fileread.h (Timespec): New structure.
10027 (File_read::get_mtime): New method.
10028 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10029 Renamed from timestamp_nsec.
10030 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10031 Elf_Xword.
e1df38aa 10032 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 10033 timestamp_nsec.
e1df38aa 10034 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
10035 (Incremental_inputs::report_obejct): Save mtime; style fix.
10036 (Incremental_inputs::report_script): Save mtime; style fix.
10037 (Incremental_inputs::finalize_inputs): Style fix.
10038 (Incremental_inputs::finalize): Style fix.
10039 (Incremental_inputs::create_input_section_data): Store inputs
10040 mtime.
10041 * incremental.h (Incremental_inputs::report_script): Add mtime
10042 argument.
10043 (Incremental_inputs::Input_info::Input_info): Intialize only one
10044 union member.
10045 (Incremental_inputs::Input_info::archive): Move to nameless
10046 union.
10047 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10048 (Incremental_inputs::Input_info::script): Move to nameless union.
10049 (Incremental_inputs::mtime): New field.
10050 * script.cc (read_input_script): Pass file mtime to
10051 Incremental_input.
10052 * script.h (Script_info::inputs): Style fix.
10053
c9d70757
ILT
100542009-07-01 Ian Lance Taylor <ian@airs.com>
10055
10056 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10057 instead of 32.
10058
9c547ec3
ILT
100592009-06-24 Ian Lance Taylor <iant@google.com>
10060
10061 PR 10156
10062 * layout.cc (Layout::choose_output_section): If we find an
10063 existing section, update the flags.
10064 (Layout::create_notes): New function, broken out of
10065 Layout::finalize.
10066 (Layout::finalize): Don't create note sections.
10067 (Layout::create_note): Don't crash if linker script discards
10068 section.
10069 (Layout::create_gold_note): Likewise.
10070 (Layout::create_build_id): Likewise. Don't set
10071 after_input_sections on the section.
10072 (Layout::create_executable_stack_info): Remove target parameter.
10073 Change caller.
10074 * layout.h (class Layout): Declare create_notes. Update
10075 declaration of create_executable_stack_info.
10076 * gold.cc (queue_middle_tasks): Call create_notes.
10077 * output.cc (Output_section::update_flags_for_input_section): Move
10078 here from output.h. If SHF_ALLOC flag is newly set, mark address
10079 invalid.
10080 * output.h (Output_data::mark_address_invalid): New function.
10081 (class Output_section): Only declare, not define,
10082 update_flags_for_input_section. Remove set_flags.
10083
55458500
ILT
100842009-06-24 Ian Lance Taylor <iant@google.com>
10085
10086 * script-sections.cc (Output_section_definition::
10087 set_section_addresses): Rename shadowing local load_address to
10088 laddr.
10089
1307d6cd
ILT
100902009-06-24 Ian Lance Taylor <iant@google.com>
10091
10092 PR 10244
10093 * reloc.cc (relocate_sections): Skip empty relocation sections.
10094
ec3f783e
ILT
100952009-06-23 Ian Lance Taylor <iant@google.com>
10096
10097 PR 10156
10098 * layout.cc (Layout::create_note): Use choose_output_section
10099 rather than make_output_section.
10100
459c9f1c
ILT
101012009-06-23 Ian Lance Taylor <iant@google.com>
10102
10103 PR 10237
10104 * options.cc (General_options::parse_V): Set printed_version_.
10105 (General_options::General_options): Initialize printed_version_.
10106 * options.h (class General_options): Add printed_version_ field.
10107 * gold.cc (queue_initial_tasks): If there are no input files,
10108 don't give a fatal error if we printed the version information.
10109 (queue_middle_tasks): If using -r with a shared object, give a
10110 fatal error rather than an ordinary error.
10111
1518dc8f
ILT
101122009-06-23 Ian Lance Taylor <iant@google.com>
10113
10114 PR 10219
10115 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10116 (Layout::make_output_section): Set have_stabstr_section_ if we see
10117 a .stab*str section.
10118 (Layout::finalize): Call link_stabs_sections.
10119 (Layout::link_stabs_sections): New file.
10120 * layout.h (class Layout): Add have_stabstr_section_ field.
10121 Declare link_stabs_sections.
10122
3d857b98
DK
101232009-06-23 Doug Kwan <dougkwan@google.com>
10124
10125 * Makefile.am (libgold_a_LIBADD): New.
10126 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
2e702c99 10127 * Makefile.in: Regenerate.
3d857b98
DK
10128 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10129 * configure: Regenerate.
10130 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10131 * fileread.cc: Include sys/state.h
10132 * gold.h: Declare memmem and strndup if found missing.
10133 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10134
0639a6f6
ILT
101352009-06-23 Ian Lance Taylor <iant@google.com>
10136
10137 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10138 * configure: Rebuild.
10139
8d63875c
ILT
101402009-06-23 Ian Lance Taylor <iant@google.com>
10141
10142 PR 10147
10143 * object.cc (Object::section_contents): Don't try to get a view if
10144 the section has length zero.
10145 (Object::handle_gnu_warning_section): If the section is empty, use
10146 the name of the section as the warning.
10147
f7c8a183
ILT
101482009-06-23 Ian Lance Taylor <iant@google.com>
10149
10150 PR 10133
10151 * stringpool.h (class Stringpool_template): Add optimize_ field.
10152 (Stringpool_template::set_optimize): New function.
10153 * stringpool.cc (Stringpool_template::Stringpool_template):
10154 Initialize optimize_ field.
10155 (Stringpool_template::set_string_offsets): Test local optimize
10156 fild rather than parameter.
10157 * layout.cc (Layout::Layout): Call set_optimize on the section
10158 name stringpool.
10159
e6a307ba
ILT
101602009-06-22 Ian Lance Taylor <iant@google.com>
10161
10162 PR 10030
10163 * yyscript.y: Parse TARGET.
10164 * script.cc (script_set_target): New function.
10165 * script-c.h (script_set_target): Declare.
10166 * options.cc (General_options::string_to_object_format): Rename
10167 from string_to_object_format in anonymous namespace. Change
10168 callers.
10169 * options.h (class General_options): Declare
10170 string_to_object_format.
10171
3ee173de
ILT
101722009-06-22 Ian Lance Taylor <iant@google.com>
10173
10174 * script-sections.cc (Script_sections::create_segments): Don't put
10175 program headers in a PT_LOAD segment if -n or -N.
10176
101772009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
10178
10179 PR 10141
10180 * options.h (class General_options): Add -z lazy and -z now. Sort
10181 -z options into alphabetical order.
10182 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10183
cd6739a1 101842009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
10185
10186 * layout.cc (Layout::make_output_section): Call
10187 Target::new_output_section.
10188 (Layout::attach_allocated_section_to_segment): Put large section
10189 sections in a separate load segment with the large segment flag
10190 set.
10191 (Layout::segment_precedes): Sort large data segments after other
10192 load segments.
10193 (align_file_offset): New static function.
10194 (Layout::set_segment_offsets): Use align_file_offset.
10195 * output.h (class Output_section): Add is_small_section_ and
10196 is_large_section_ fields.
10197 (Output_section::is_small_section): New function.
10198 (Output_section::set_is_small_section): New function.
10199 (Output_section::is_large_section): New function.
10200 (Output_section::set_is_large_section): New function.
10201 (Output_section::is_large_data_section): New function.
10202 (class Output_segment): Add is_large_data_segment_ field.
10203 (Output_segment::is_large_data_segment): New function.
10204 (Output_segment::set_is_large_data_segment): New function.
10205 * output.cc (Output_section::Output_section): Initialize new
10206 fields.
10207 (Output_segment::Output_segment): Likewise.
10208 (Output_segment::add_output_section): Add assertion that large
10209 data sections always go in large data segments. Force small data
10210 sections to the end of the list of data sections. Force small BSS
10211 sections to the start of the list of BSS sections. For large BSS
10212 sections to the end of the list of BSS sections.
10213 * symtab.h (class Symbol): Declare is_common_shndx.
10214 (Symbol::is_defined): Check Symbol::is_common_shndx.
10215 (Symbol::is_common): Likewise.
10216 (class Symbol_table): Define enum Commons_section_type. Update
10217 declarations. Add small_commons_ and large_commons_ fields.
10218 * symtab.cc (Symbol::is_common_shndx): New function.
10219 (Symbol_table::Symbol_table): Initialize new fields.
10220 (Symbol_table::add_from_object): Put small and large common
10221 symbols in the right list.
10222 (Symbol_table::sized_finalized_symbol): Check
10223 Symbol::is_common_shndx.
10224 (Symbol_table::sized_write_globals): Likewise.
10225 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10226 common symbol lists. Don't call do_allocate_commons_list if the
10227 list is empty.
10228 (Symbol_table::do_allocate_commons_list): Remove is_tls
10229 parameter. Add comons_section_type parameter. Change all
10230 callers. Handle small and large common symbols.
10231 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10232 Symbol::is_common_shndx.
10233 * resolve.cc (symbol_to_bits): Likewise.
10234 * target.h (Target::small_common_shndx): New function.
10235 (Target::small_common_section_flags): New function.
10236 (Target::large_common_shndx): New function.
10237 (Target::large_common_section_flags): New function.
10238 (Target::new_output_section): New function.
10239 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10240 small_common_section_flags, and large_common_section_flags
10241 fields.
10242 (Target::do_new_output_section): New virtual function.
10243 * arm.cc (Target_arm::arm_info): Initialize new fields.
10244 * i386.cc (Target_i386::i386_info): Likewise.
10245 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10246 Likewise.
10247 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10248 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10249 (Target_x86_64::do_new_output_section): New function.
10250 * configure.ac: Define conditional MCMODEL_MEDIUM.
10251 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10252 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10253 (large_LDFLAGS): Define.
10254 * testsuite/large.c: New file.
10255 * testsuite/testfile.cc (Target_test::test_target_info):
10256 Initialize new fields.
10257 * configure, testsuite/Makefile.in: Rebuild.
10258
bb04269c
DK
102592009-06-05 Doug Kwan <dougkwan@google.com>
10260
10261 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 10262 * Makefile.in: Regenerate.
bb04269c
DK
10263 * i386.cc (class Target_i386): Define new virtual method to
10264 override do_is_local_label_name in parent.
10265 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10266 local symbols if --discard-locals or -X is given.
10267 * options.h (class General_options): Declare new options
10268 '--discard-locals' and '-X' for discarding locals.
10269 * target.h (class Target): Define new methods is_local_label_name.
10270 Declare new virtual method do_is_local_label_name.
10271 * target.cc: New file.
10272 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10273 (check_SCRIPTS): Add discard_locals_test.sh.
10274 (check_DATA): Add discard_local_tests.syms.
10275 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10276 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10277 * testsuite/Makefile.in: Regenerate.
10278 * testsuite/discard_locals_test.c: New file.
10279 * testsuite/discard_locals_test.sh: Same.
10280
805bb01c
DK
102812009-06-05 Doug Kwan <dougkwan@google.com>
10282
10283 * object.cc (Sized_relobj::Sized_relobj): Initialize
10284 discarded_eh_frame_shndx_ to -1U.
10285 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10286 section.
10287 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10288 a discarded .eh_frame section.
10289 (Sized_relobj::do_finalize_local_symbols): Ditto.
10290 * object.h (class Sized_relobj): Declare new member
10291 discarded_eh_frame_shndx_.
10292 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10293 (local_labels_test.o, local_labels_test): New rules.
10294 * testsuite/Makefile.in: Regenerate.
10295
1dcd334d
DK
102962009-06-04 Doug Kwan <dougkwan@google.com>
10297
10298 * layout.cc (Layout::section_name_mapping): Add mapping for
10299 special ARM sections.
10300
96d49306
DK
103012009-06-03 Doug Kwan <dougkwan@google.com>
10302
10303 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10304 (utils::has_overflow): Same.
10305
dff16297
ILT
103062009-06-03 Ian Lance Taylor <iant@google.com>
10307
10308 * layout.cc (Layout::section_name_mapping): New array, replacing
10309 Layout::linkonce_mapping.
10310 (Layout::section_name_mapping_count): New variable, replacing
10311 Layout::linkonce_mapping_count.
10312 (Layout::linkonce_output_name): Remove.
10313 (Layout::output_section_name): Rewrite.
10314 * layout.h (class Layout): Rename Linkonce_mapping to
10315 Section_name_mapping, linkonce_mapping to section_name_mapping,
10316 linkonce_mapping_count to section_name_mapping_count. Don't
10317 declare linkonce_output_name.
10318
c121c671
DK
103192009-06-03 Doug Kwan <dougkwan@google.com>
10320
10321 * gold/arm.cc (namespace utils): New.
10322 (Target_arm::reloc_is_non_pic): Define new method.
10323 (class Arm_relocate_functions): New.
10324 (Target_arm::Relocate::relocate): Handle relocation types used by
10325 Android.
10326
07800fab
ILT
103272009-06-03 Ian Lance Taylor <iant@google.com>
10328
10329 * arm.cc (Target_arm::scan::global): Use || instead of |.
10330
c121c671
DK
103312009-06-02 Doug Kwan <dougkwan@google.com>
10332
10333 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10334 issued_non_pic_error_.
10335 (class Target_arm::Scan): Declare new method check_non_pic.
10336 Define new method symbol_needs_plt_entry.
10337 Declare new data member issued_non_pic_error_.
10338 (class Target_arm::Relocate): Declare new method
10339 should_apply_static_reloc.
10340 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10341 (Target_arm::Scan::check_non_pic): Define new method.
10342 (Target_arm::Scan::local): Handle a small subset of reloc types used
10343 by Android.
10344 (Target_arm::Scan::local): Same.
10345 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10346
b19b0c6d
ILT
103472009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10348
10349 * incremental.cc (Incremental_inputs::report_command_line): Filter
10350 out --incremental-* options.
10351
94cdfcff
DK
103522009-05-29 Doug Kwan <dougkwan@google.com>
10353
10354 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10355 template class.
10356 (class Target_arm): Update comment.
10357 (Target_arm::Target_arm): Initialize new data members GOT_,
10358 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10359 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10360 and Target_arm::rel_dyn_section.
10361 Declare new_enum Target_arm::Got_type.
10362 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10363 and DYNBSS_.
10364 Update commments for member do_dynsym_value.
10365 (Target_arm::got_size, Target_arm::plt_section,
10366 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10367 new methods inside class defintion.
10368 (Target_arm::got_section): Define new method.
10369 (Target_arm::rel_dyn_section): Same.
10370 (Output_data_plt_arm): New template class.
10371 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10372 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10373 (Output_data_plt_arm::add_entry): Same.
10374 (Output_data_plt_arm::first_plt_entry): Define new
10375 static data member for PLT instruction template.
10376 (Output_data_plt_arm::plt_entry): Same.
10377 (Output_data_plt_arm::do_write): Define new method.
10378 (Target_arm::make_plt_entry): Same.
10379 (Target_arm::do_finalize_sections): Same.
10380 (Target_arm::do_dynsym_value): Same.
10381
4a657b0d
DK
103822009-05-28 Doug Kwan <dougkwan@google.com>
10383
10384 * Makefile.am (TARGETSOURCES): Add arm.cc.
10385 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10386 * Makefile.in: Regenerate.
10387 * arm.cc: New file.
10388 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10389
e7ae8c36
DK
103902009-05-26 Doug Kwan <dougkwan@google.com>
10391
10392 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10393 (General_options::check_excluded_libs): Strip off directories in
10394 archive name before matching like GNU ld does.
10395 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10396 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10397 (exclude_libs_test_LDFLAGS): Add linker option
10398 -Wl,--exclude-libs,libexclude_libs_test_3
10399 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10400 an explicit archive without using -l.
10401 (alt/libexclude_libs_test_3.a): New make rule.
10402 * testsuite/Makefile.in: Regenerate.
10403 * testsuite/exclude_libs_test.c : Declare lib3_default().
10404 (main): Call it.
10405 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10406 * exclude_libs_test_3.c: New file.
10407
f12e7348
NC
104082009-05-26 Nick Clifton <nickc@redhat.com>
10409
10410 * po/id.po: New Indonesian translation.
10411 * po/gold.pot: Updated template file.
10412
4daadc0d
ST
104132009-05-22 Sriraman Tallam <tmsriram@google.com>
10414
e1df38aa 10415 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
10416 gc_comdat_test files. Add -Wl,--gc-sections to build
10417 gc_comdat_test.
10418 * testsuite/Makefile.in: Regenerate.
10419 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10420
531813ad
ST
104212009-05-21 Sriraman Tallam <tmsriram@google.com>
10422
10423 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10424 kept comdat section was garbage collected.
10425 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10426 * testsuite/Makefile.in: Regenerate.
10427 * testsuite/gc_comdat_test.sh: New file.
10428 * testsuite/gc_comdat_test_1.cc: New file.
10429 * testsuite/gc_comdat_test_2.cc: New file.
10430
65514900
CC
104312009-05-19 Doug Kwan <dougkwan@google.com>
10432
10433 * archive.cc (Archive::Archive): Move constructor from archive.h
10434 to here. Initialize no_export_.
10435 (Archive::get_elf_object_for_member): Set no_export flag of object.
10436 * archive.h (Archive::Archive): Move constructor body to
10437 archive.cc.
10438 (Archive::no_export): New method.
10439 (Archive::no_export_): New field.
10440 * object.h (Object::Object): Initialize no_export_ to false.
10441 (Object::no_export, Object::set_no_export): New methods.
10442 (Object::no_export_): New field.
10443 * options.cc (General_options::parse_exclude_libs): New method.
10444 (General_options::check_excluded_libs) Same.
10445 * options.h (exclude_libs): New option.
10446 (General_options::check_excluded_libs): New method declaration.
10447 (General_options::excluded_libs_): New field.
10448 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10449 default or protected visibility if an object has no-export flag set.
10450 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10451 (check_SCRIPTS): Add exclude_libs_test.sh.
10452 (check_DATA): Add exclude_libs_test.syms.
10453 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10454 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10455 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10456 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10457 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10458 libexclude_libs_test_2.a): New rules.
10459 * testsuite/Makefile.in: Regenerate.
10460 * testsuite/exclude_libs_test.c: New file.
10461 * testsuite/exclude_libs_test.sh: Ditto.
10462 * testsuite/exclude_libs_test_1.c: Ditto.
10463 * testsuite/exclude_libs_test_2.c: Ditto.
10464
1b77ea50
ILT
104652009-05-15 Ian Lance Taylor <iant@google.com>
10466
10467 * configure.ac: Check for declarations for cases where libiberty.h
10468 checks HAVE_DECL_xxx.
10469 * configure, config.in: Rebuild.
10470
072fe7ce
ILT
104712009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10472
10473 * gold.h (Incremental_argument_list): Remove (invalid) forward
10474 declaration.
10475 * incremental.cc (Incremental_inputs::report_achive): New method.
10476 (Incremental_inputs::report_object): New method.
10477 (Incremental_inputs::report_script): New method.
10478 (Incremental_inputs::finalize_inputs): New method.
10479 (Incremental_inputs::finalize): Call finalize_inputs().
10480 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10481 Create inputs entries.
10482 * incremental.h (Incremental_input_type): New enum.
10483 (Incremental_inputs::Incremental_input): Initialize new fields.
10484 (Incremental_inputs::report_inputs): New method.
10485 (Incremental_inputs::report_achive): New method.
10486 (Incremental_inputs::report_object): New method.
10487 (Incremental_inputs::report_script): New method.
10488 (Incremental_inputs::finalize_inputs): New method.
10489 (Incremental_inputs::Input_info): New struct.
10490 (Incremental_inputs::Input_info_map): New typedef.
10491 (Incremental_inputs::lock_): New field.
10492 (Incremental_inputs::Inputs_): New field.
10493 (Incremental_inputs::Inputs_map): New field.
10494 * main.cc (main): Call Incremental_input::report_inputs.
10495 * options.h (Input_argument_list): Typedef moved from
10496 Input_arguments.
10497 (Input_file_group::Files): Remove, use ::Input_argument_list.
10498 (Input_file_group::Input_argument_list): Remove, use
10499 ::Input_argument_list.
10500 * plugin.cc (Plugin_manager::add_input_file): Add error in
10501 incremental build.
10502 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10503 functions.
10504 * script.cc (read_input_script): Call
10505 Incremental_input::report_script.
10506 * script.h (Script_info): New class.
10507
b0481b0b
ILT
105082009-04-27 Ian Lance Taylor <iant@google.com>
10509
10510 * x86_64.cc (do_adjust_output_section): Set entsize to
10511 plt_entry_size.
10512
b22a5a41 105132009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
10514
10515 * output.cc (Output_file::close): After short writes, continue
10516 writing from the correct offset in the buffer being written.
10517
40fde488
CD
105182009-04-23 Chris Demetriou <cgd@google.com>
10519
10520 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10521 * configure: Regenerate.
10522 * config.in: Regenerate.
10523 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10524 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10525
3ce2c28e
ILT
105262009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10527
10528 * incremental.cc (Incremental_inputs_header_data): Renamed from
10529 Incremental_input_header_data.
10530 (Incremental_inputs_header_data::data_size): New field.
10531 (Incremental_inputs_header_data::put_input_file_count): Renamed
10532 from input_file_count.
10533 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10534 from command_line_offset.
10535 (Incremental_inputs_header_data::put_reserved): Renamed from
10536 put_reserved.
10537 (Incremental_inputs_entry_data): Renamed from
10538 Incremental_input_entry_data.
10539 (Incremental_inputs_entry_data::data_size): New field.
10540 (Incremental_inputs::report_command_line): New method.
10541 (Incremental_inputs::finalize): New method.
10542 (Incremental_inputs::create_incremental_inputs_data): New method.
10543 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10544 * incremental.h: New file.
10545 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
703d02da 10546 (Layout::finalize): Create incremental inputs section in
3ce2c28e 10547 incremental builds.
703d02da 10548 (Layout::create_incremental_info_sections): New method.
3ce2c28e 10549 * layout.h (Layout::incremental_inputs): New method.
703d02da
AM
10550 (Layout::create_incremental_info_sections): New method.
10551 (Layout::incremental_inputs_): New field.
3ce2c28e
ILT
10552 * main.cc (main): Notify Incremental_input of the command line.
10553
e55bde5e
ILT
105542009-04-01 Ian Lance Taylor <iant@google.com>
10555 Mikolaj Zalewski <mikolajz@google.com>
10556
10557 * gold.h (reserve_unordered_map): Define, three versions, one for
10558 each version of Unordered_map.
10559 * layout.cc (Layout::Layout): Remove options parameter. Add
10560 number_of_input_files parameter. Don't initialize options_.
10561 Initialize number_of_input_files_ and resized_signatures_. Move
10562 sections_are_attached_.
10563 (Layout::layout_group): Reserve space for group_signatures_.
10564 (Layout::find_or_add_kept_section): Change name parameter to be a
10565 reference. Resize signatures_ map when it gets large enough.
10566 (Layout::layout_eh_frame): Use parameters->options() instead of
10567 this->options_.
10568 (Layout::make_output_section): Likewise.
10569 (Layout::attach_allocated_section_to_segment): Likewise.
10570 (Layout::finalize, Layout::create_executable_stack): Likewise.
10571 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10572 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10573 * layout.h (class Layout): Update declarations. Remove options_
10574 field. Add number_of_input_files_ and resized_signatures_
10575 fields. Move sections_are_attached_ field.
10576 * main.cc (main): Pass number of input files to Layout
10577 constructor. Don't pass options.
10578
154b857c
ILT
105792009-03-30 Ian Lance Taylor <iant@google.com>
10580
10581 * ffsll.c (ffsll): Correct implementation.
10582
2f35ab9b
ILT
105832009-03-27 Ian Lance Taylor <iant@google.com>
10584
fd03461a
ILT
10585 * ffsll.c: New file.
10586 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10587 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10588 * ftruncate.c (ftruncate): Declare before definition.
10589 * mremap.c (mremap): Likewise.
10590 * pread.c (pread): Likewise.
10591 * configure, Makefile.in, config.in: Rebuild.
10592
2f35ab9b
ILT
10593 * mremap.c: New file.
10594 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10595 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10596 (mremap): Declare if HAVE_MREMAP is not defined.
10597 * configure, Makefile.in, config.in: Rebuild.
10598
33aea2fd
CC
105992009-03-27 Cary Coutant <ccoutant@google.com>
10600
10601 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10602 position independent.
10603 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10604 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10605
6d479619
CC
106062009-03-24 Cary Coutant <ccoutant@google.com>
10607
10608 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10609 an executable.
10610 (needs_dynamic_reloc): Likewise.
10611
afc06bb8
ILT
106122009-03-24 Ian Lance Taylor <iant@google.com>
10613
10614 * yyscript.y (file_cmd): Recognize EXTERN.
10615 (extern_name_list, extern_name_list_body): New nonterminals.
10616 * script.cc (script_add_extern): Define.
10617 * script-c.h (script_add_extern): Declare.
10618
f6060a4d
ILT
106192009-03-24 Rafael Avila de Espindola <espindola@google.com>
10620
10621 * object.cc (is_elf_object): Define.
10622 * object.h (is_elf_object): Declare.
10623 * archive.cc (Archive::get_elf_object_for_member): Call
10624 is_elf_object.
33aea2fd 10625 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 10626
26736d8e
ILT
106272009-03-24 Elliott Hughes <enh@google.com>
10628
10629 * output.cc (Output_file::map_anonymous): Define.
10630 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10631 try an anonymous one. Report the size if the mmap fails.
10632 * output.h (class Output_file): Declare map_anonymous.
10633
22fd9730
ILT
106342009-03-24 Ian Lance Taylor <iant@google.com>
10635
10636 * target-select.cc (instantiate_target): Don't acquire the lock if
10637 the instantiated_target_ field has already been set.
10638
cb010894
ILT
106392009-03-23 Ian Lance Taylor <iant@google.com>
10640
7f055c20
ILT
10641 * gold-threads.h (class Initialize_lock): Define.
10642 * gold-threads.cc (class Initialize_lock_once): Define.
10643 (initialize_lock_control): New static variable.
10644 (initialize_lock_pointer): New static variable.
10645 (initialize_lock_once): New static function.
10646 (Initialize_lock::Initialize_lock): Define.
10647 (Initialize_lock::initialize): Define.
10648 * target-select.h: Include "gold-threads.h".
10649 (class Target_selector): Add lock_ and initialize_lock_ fields.
10650 Don't define instantiate_target, just declare it.
10651 * target-select.cc (Target_selector::Target_selector): Initialize
10652 new fields.
10653 (Target_selector::instantiate_target): Define.
10654 * descriptors.h: Include "gold-threads.h".
10655 (class Descriptors): Add initialize_lock_ field.
10656 * descriptors.cc (Descriptors::Descriptors): Initialize new
10657 field.
10658 (Descriptors::open): Use initialize_lock_ field
10659 * errors.h (class Errors): Add initialize_lock_ field.
10660 * errors.cc (Errors::Errors): Initialize new field.
10661 (Errors::initialize_lock): Use initialize_lock_ field.
10662 * powerpc.cc (class Target_selector_powerpc): Remove
10663 instantiated_target_ field. In do_recognize call
10664 instantiate_target rather than do_instantiate_target. In
10665 do_instantiate_target just allocate a new target.
10666 * sparc.cc (class Target_selector_sparc): Likewise.
10667
36959681
ILT
10668 * freebsd.h: New file.
10669 * i386.cc: Include "freebsd.h".
10670 (Target_i386): Derive from Target_freebsd rather than
10671 Sized_target.
10672 (Target_selector_i386): Derive from Target_selector_freebsd rather
10673 than Target_selector.
10674 * x86_64.cc: Include "freebsd.h".
10675 (Target_x86_64): Derive from Target_freebsd rather than
10676 Sized_target.
10677 (Target_selector_x86_64): Derive from Target_selector_freebsd
10678 rather than Target_selector.
10679 * target.h (class Target): Add adjust_elf_header and
10680 do_adjust_elf_header.
10681 * output.cc (Output_file_header:: do_sized_write): Call target
10682 adjust_elf_header routine.
10683 * configure.tgt: Set targ_osabi.
10684 * configure.ac: Define GOLD_DEFAULT_OSABI.
10685 * parameters.cc (Parameters::default_target): Pass
10686 GOLD_DEFAULT_OSABI to select_target.
10687 * target-select.h (class Target_selector): Make instantiate_target
10688 protected rather than private.
10689 * Makefile.am (HFILES): Add freebsd.h.
10690 * configure, Makefile.in, config.in: Rebuild.
10691
cb010894
ILT
10692 * merge.cc (do_add_input_section): Correct pend value. Change
10693 message about last entry not being null terminated from error to
10694 warning.
10695
0e879927
ILT
106962009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10697
10698 * incremental.cc: New file.
10699 * Makefile.am (CCFILES): Add incremental.cc.
10700 * Makefile.in: Rebuild.
10701
41105937
PP
107022009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10703
10704 * layout.cc (Layout::output_section_name): Preserve names
10705 of '.note.' sections.
e1df38aa 10706
60439920
ILT
107072009-03-19 Ian Lance Taylor <iant@google.com>
10708
10709 * descriptors.cc (Descriptors::open): Check that the options are
10710 valid before using them.
10711
0d371ad3
ILT
107122009-03-18 Ian Lance Taylor <iant@google.com>
10713
10714 * script-sections.h: Include <list>.
10715 (class Script_sections): Change Sections_elements from std::vector
10716 to std::list. Typedef public Elements_iterator. Add
10717 orphan_section_placement_, data_segment_align_start_, and
10718 saw_data_segment_align_ fields. Remove data_segment_align_index_
10719 field.
10720 * script-sections.cc (class Orphan_section_placement): New class.
10721 (class Sections_element): Add virtual functions is_relro and
10722 orphan_section_init. Remove virtual function place_orphan_here.
10723 (class Output_section_definition): Add is_relro and
10724 orphan_section_init. Remove place_orphan_here.
10725 (class Orphan_output_section): Likewise.
10726 (Script_sections::Script_sections): Update for field changes.
10727 (Script_sections::data_segment_align): Set saw_data_segment_align_
10728 and data_segment_align_start_, not data_segment_align_index.
10729 (Script_sections::data_segment_relro_end): Check
10730 saw_data_segment_align_. Use data_segment_align_start_ rather
10731 than data_segment_align_index_.
10732 (Script_sections::place_orphan): Rewrite to use
10733 Orphan_section_placement.
10734
9201d894
ILT
107352009-03-17 Ian Lance Taylor <iant@google.com>
10736
9c5b8369
ILT
10737 * archive.cc (Archive::add_symbols): Check for a version attached
10738 to the symbol name in the archive map.
10739 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10740 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10741 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10742 (ver_test_11.a): New target.
10743 * testsuite/Makefile.in: Rebuild.
10744
9201d894
ILT
10745 * configure.ac: Check for chsize and posix_fallocate. Replace
10746 ftruncate.
10747 * ftruncate.c: New file, from gnulib.
10748 * output.cc (posix_fallocate): Define dummy version if not
10749 HAVE_POSIX_FALLOCATE.
10750 (Output_file::map): Call posix_fallocate rather than lseek and
10751 write.
10752 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10753 * configure, Makefile.in, config.in: Rebuild.
10754
ef4ab7a8 107552009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 10756
ef4ab7a8
PP
10757 * layout.h (Layout::create_note): Add section_name parameter.
10758 * layout.cc (Layout::create_note): Likewise.
10759 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 10760
8c500701
ILT
107612009-03-17 Ian Lance Taylor <iant@google.com>
10762
e85b18e1
ILT
10763 * descriptors.cc: Include "options.h".
10764 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10765 (Descriptors::open): Always use O_CLOEXEC when opening a new
10766 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10767 then set FD_CLOEXEC.
10768
9efe6174
ILT
10769 * sparc.cc (class Target_sparc): Add has_got_section.
10770 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10771 make sure we have a GOT section.
10772
10773 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10774 (Target_sparc::Scan::local): Likewise.
10775 (Target_sparc::Scan::global): Likewise.
10776 (Target_sparc::Relocate::relocate): Likewise.
10777 (Target_sparc::Relocate::relocate_tls): Likewise.
10778
8c500701
ILT
10779 * symtab.cc (Symbol_table::define_default_version): New function,
10780 broken out of add_from_object.
10781 (Symbol_table::add_from_object): Call define_default_version.
10782 (Symbol_table::define_special_symbol): Add resolve_oldsym
10783 parameter. Change all callers. If the version for a symbol comes
10784 from a version script, resolve it with the symbol with the same
10785 name with no version. Also add the symbol without a version if
10786 appropriate.
10787 (do_define_in_output_data): If resolving with oldsym, don't delete
10788 sym.
10789 (do_define_in_output_segment): Likewise.
10790 (do_define_as_constant): Likewise.
10791 * symtab.h (class Symbol_table): Update declarations.
10792
f1ed28fb
ILT
107932009-03-13 Ian Lance Taylor <iant@google.com>
10794
15f8229b
ILT
10795 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10796 (Read_symbols::requeue): New function.
10797 (Read_symbols::do_read_symbols): If make_elf_object fails because
10798 the target type is not configured, and the file was searched for,
10799 issue a warning and retry with the next directory.
10800 (Add_symbols::run): If the file has an incompatible format, and
10801 it was searched for, requeue the Read_symbols task. On error,
10802 release the object.
10803 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10804 dirindex parameter to constructor. Change all callers. Declare
10805 incompatible_warning and requeue.
10806 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10807 input_argument_ and input_group_ fields. Add them to
10808 constructor. Change all callers.
10809 (class Read_script): Add dirindex_ field. Add it to constructor.
10810 Change all callers.
10811 * archive.cc (Archive::setup): Remove input_objects parameter.
10812 Change all callers.
10813 (Archive::get_file_and_offset): Likewise.
10814 (Archive::read_all_symbols): Likewise.
10815 (Archive::read_symbols): Likewise.
10816 (Archive::get_elf_object_for_member): Remove input_objects
10817 parameter. Add punconfigured parameter. Change all callers.
10818 (Archive::add_symbols): Change return type to bool. Check return
10819 value of include_member.
10820 (Archive::include_all_members): Likewise.
10821 (Archive::include_member): Change return type to bool. Return
10822 false if first included object has incompatible target. Set
10823 included_member_ field.
10824 (Add_archive_symbols::run): If add_symbols returns false, requeue
10825 Read_symbols task.
10826 * archive.h (class Archive): Add included_member_ field.
10827 Initialize it in constructor. Add input_file and searched_for
10828 methods. Update declarations.
10829 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10830 input_argument_ fields. Add them to constructor. Change all
10831 callers.
10832 * script.cc: Include "target-select.h".
10833 (class Parser_closure): Add skip_on_incompatible_target_ and
10834 found_incompatible_target_ fields. Add
10835 skip_on_incompatible_target parameter to constructor. Change all
10836 callers. Add methods skip_on_incompatible_target,
10837 clear_skip_on_incompatible_target, found_incompatible_target, and
10838 set_found_incompatible_target.
10839 (read_input_script): Add dirindex parameter. Change all callers.
10840 If parser finds an incompatible target, requeue Read_symbols
10841 task.
10842 (script_set_symbol): Clear skip_on_incompatible_target in
10843 closure.
10844 (script_add_assertion, script_parse_option): Likewise.
10845 (script_start_sections, script_add_phdr): Likewise.
10846 (script_check_output_format): New function.
10847 * script.h (read_input_script): Update declaration.
10848 * script-c.h (script_check_output_format): Declare.
10849 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10850 (ignore_cmd): Remove OUTPUT_FORMAT.
10851 * fileread.cc (Input_file::Input_file): Add explicit this.
10852 (Input_file::will_search_for): New function.
10853 (Input_file::open): Add pindex parameter. Change all callers.
10854 * fileread.h (class Input_file): Add input_file_argument method.
10855 Declare will_search_for. Update declarations.
10856 * object.cc (make_elf_object): Add punconfigured parameter.
10857 Change all callers.
10858 * object.h (class Object): Make input_file public. Add
10859 searched_for method.
10860 (make_elf_object): Update declaration.
10861 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10862 restart search.
10863 * dirsearch.h (class Dirsearch): Update declaration.
10864 * options.h (class General_options): Add --warn-search-mismatch.
10865 * parameters.cc (Parameters::is_compatible_target): New function.
10866 * parameters.h (class Parameters): Declare is_compatible_target.
10867 * workqueue.cc (Workqueue::add_blocker): New function.
10868 * workqueue.h (class Workqueue): Declare add_blocker.
10869
f1ed28fb
ILT
10870 * fileread.cc (Input_file::open): Remove options parameter.
10871 Change all callers.
10872 (Input_file::open_binary): Likewise.
10873 * script.cc (read_input_script): Likewise.
10874 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10875 options parameter from constructor. Change all callers.
10876 (class Read_script): Likewise.
10877 * fileread.h (class Input_file): Update declarations.
10878 * script.h (read_input_script): Update declaration.
10879
34dd024a
NC
108802009-03-10 Nick Clifton <nickc@redhat.com>
10881
10882 * po/es.po: New Spanish translation.
10883
6d71b17c
CC
108842009-03-06 Cary Coutant <ccoutant@google.com>
10885
10886 * options.cc (parse_short_option): Keep dash_z from registering itself.
10887
031cdbed
ILT
108882009-03-03 Ian Lance Taylor <iant@google.com>
10889
10890 PR 9918
10891 * target-reloc.h (relocate_section): Pass output_section to
10892 relocate.
10893 * i386.cc (Target_i386::should_apply_static_reloc): Add
10894 output_section parameter. Change all callers.
10895 (Target_i386::Relocate::relocate): Add output_section parameter.
10896 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10897 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10898 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10899 * testsuite/two_file_shared.sh: New script.
10900 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10901 (check_DATA): Add two_file_shared.dbg.
10902 (two_file_shared.dbg): New target.
10903 * testsuite/Makefile.in: Rebuild.
10904
15d5fa16
ILT
109052009-03-01 Ian Lance Taylor <iant@google.com>
10906
10907 * configure.ac: Check for byteswap.h.
10908 * configure: Rebuild.
10909 * config.in: Rebuild.
10910
8a4c0b0d
ILT
109112009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10912
10913 * layout.cc (Layout::find_or_add_kept_section): New function.
10914 (Layout::add_comdat): Removed.
10915 * layout.h (struct Kept_section): Move out of class Layout.
10916 Remove trailing underscores from field names. Add group_sections
10917 field. Rename group_ field to is_group. Change all uses.
10918 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10919 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10920 comdat_groups_ field.
10921 (Sized_relobj::include_section_group): Use
10922 find_or_add_kept_section and Kept_section::group_sections.
10923 (Sized_relobj::include_linkonce_section): Likewise.
10924 * object.cc (class Sized_relobj): Don't define Comdat_group or
10925 Comdat_group_table. Remove find_comdat_group and
10926 add_comdat_group. Remove comdat_groups_ field.
10927 * plugin.cc (include_comdat_group): Use
10928 Layout::find_or_add_kept_section.
10929
b4ecf66b
ILT
109302009-02-28 Ian Lance Taylor <iant@google.com>
10931
14359ca0
ILT
10932 * README: --gc-sections and map files are now supported. Document
10933 some build requirements.
10934
b4ecf66b
ILT
10935 PR 6992
10936 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10937 relocatable link set the value of the section symbol to zero.
10938 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10939 relocatable link don't include the section address in the local
10940 symbol value.
10941
0602e05a
ILT
109422009-02-27 Ian Lance Taylor <iant@google.com>
10943
fd9d194f
ILT
10944 PR 6811
10945 * options.h (class Search_directory): Add is_system_directory.
10946 (class General_options): Declare is_in_system_directory.
10947 * options.cc (get_relative_sysroot): Make static.
10948 (get_default_sysroot): Make static.
10949 (General_optoins::is_in_system_directory): New function.
10950 * fileread.cc (Input_file::is_in_system_directory): New function.
10951 * fileread.h (class Input_file): Declare is_in_system_directory.
10952 * object.h (class Object): Add is_in_system_directory.
10953 (class Input_objects): Remove system_library_directory_ field.
10954 * object.cc (Input_objects::add_object): Don't set
10955 system_library_directory_.
10956 (input_objects::found_in_system_library_directory): Remove.
10957 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10958 parameter. Change all callers.
10959 (Symbol_table::sized_write_globals): Likewise.
10960 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10961 Call Object::is_in_system_directory.
10962 * symtab.h (class Symbol_table): Update declarations.
10963
61edd21f
ILT
10964 PR 5990
10965 * descriptors.h (Open_descriptor): Add is_on_stack field.
10966 * descriptors.cc (Descriptors::open): If the descriptor is on the
10967 top of the stack, remove it. Initialize is_on_stack field.
10968 (Descriptors::release): Only add pod to stack if it is not on the
10969 stack already.
10970 (Descriptors::close_some_descriptor): Clear stack_next and
10971 is_on_stack fields.
10972
e29e076a
ILT
10973 PR 7091
10974 * output.cc (Output_section::find_starting_output_address): Rename
10975 from starting_output_address; add PADDR parameter; change return
10976 type.
10977 * output.h (class Output_section): Declare
10978 find_starting_output_address instead of starting_output_address.
10979 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10980 section symbol for which we can't find a merge section.
10981
0602e05a
ILT
10982 PR 9836
10983 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10984 hidden or internal, force the symbol to be local.
10985 * resolve.cc (Symbol::override_visibility): Define.
10986 (Symbol::override_base): Use override_visibility.
10987 (Symbol_table::resolve): Likewise.
10988 (Symbol::override_base_with_special): Likewise.
10989 (Symbol_table::override_with_special): If the visibility is hidden
10990 or internal, force the symbol to be local.
10991 * symtab.h (class Symbol): Add set_visibility and
10992 override_visibility.
10993 * testsuite/ver_test_1.sh: New file.
10994 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10995 (check_DATA): Add ver_test_1.syms.
10996 (ver_test_1.syms): New target.
10997 * testsuite/Makefile.in: Rebuild.
10998
401a9a73
CC
109992009-02-25 Cary Coutant <ccoutant@google.com>
11000
11001 * layout.cc (Layout::choose_output_section): Don't rename sections
11002 when using a linker script that has a SECTIONS clause.
11003 * Makefile.in: Regenerate.
11004
11005 * testsuite/Makefile.am (script_test_5.sh): New test case.
11006 * testsuite/Makefile.in: Regenerate.
11007 * testsuite/script_test_5.cc: New file.
11008 * testsuite/script_test_5.sh: New file.
11009 * testsuite/script_test_5.t: New file.
11010
f488e4b0
CC
110112009-02-13 Rafael Avila de Espindola <espindola@google.com>
11012
11013 * archive.cc (Archive::include_member): Update calls to add_symbols.
11014 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11015 the Layout argument.
11016 * dynobj.h (do_add_symbols): Add the Layout argument.
11017 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11018 Layout argument.
11019 * object.h (Object::add_symbols): Add the Layout argument.
11020 (Object::do_add_symbols): Add the Layout argument.
11021 (Sized_relobj::do_add_symbols): Add the Layout argument.
11022 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11023 Unify the two versions.
11024 (Add_plugin_symbols): Remove.
11025 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11026 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11027 (Add_plugin_symbols): Remove.
11028 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11029 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11030 (Add_symbols::run): Make it work with Pulginobj.
11031
89dd1680
ILT
110322009-02-06 Ian Lance Taylor <iant@google.com>
11033
11034 * object.cc (Sized_relobj::do_layout): Make info message start
11035 with lower case letter.
11036
266d0a74
ILT
110372009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11038
602b464e
ILT
11039 * binary.cc: Fix file comment.
11040
266d0a74
ILT
11041 * options.h (enum Incremental_disposition): Define.
11042 (class General_options): Add new options: --incremental,
11043 --incremental_changed, --incremental_unchanged,
11044 --incremental_unknown. Add incremental_disposition_ and
11045 implicit_incremental_ fields.
11046 (General_options::incremental_disposition): New function.
11047 (class Position_dependent_options): Add incremental_disposition
11048 option.
11049 (Position_dependent_options::copy_from_options): Set incremental
11050 dispositions.
11051 * options.cc (General_options::parse_incremental_changed): New
11052 function.
2e702c99
RM
11053 (General_options::parse_incremental_unchanged): New function.
11054 (General_options::parse_incremental_unknown): New function.
11055 (General_options::General_options): Initialize new fields
266d0a74 11056 incremental_disposition_ and implicit_incremental_.
2e702c99 11057 (General_options::finalize): Check for uasge of --incremental-*
266d0a74
ILT
11058 without --incremental.
11059
f073bbf7
CD
110602009-02-06 Chris Demetriou <cgd@google.com>
11061
11062 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11063 pointer and to report location as the file name associated with
11064 the symbol.
11065 (gold_undefined_symbol_at_location): New function to replace the
11066 old gold_undefined_symbol functionality.
11067 * target-reloc.h (relocate_section): Update to use
11068 gold_undefined_symbol_at_location.
11069 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11070 Call gold_undefined_symbol function rather than gold_error.
11071 * errors.h (Errors::undefined_symbol): Take location as a
11072 string, rather than calculating it from a relocation.
11073 * errors.cc (Errors::fatal): Print "fatal error:" before the
11074 formatted message.
11075 (Errors::error, Errors::error_at_location): Print "error: "
11076 before the formatted message.
11077 (Errors::undefined_symbol): Take location as a string, rather
11078 than calculating it from a relocation.
11079 (gold_undefined_symbol_at_location): New function akin to
11080 old gold_undefined_symbol, calculates location from relocation.
11081 (gold_undefined_symbol): Change to take only a Symbol pointer
11082 and to report location as the file name associated with the symbol.
11083 * testsuite/debug_msg.sh: Update for changed error messages.
11084 * testsuite/undef_symbol.sh: Likewise.
11085
8e94a90c
ILT
110862009-02-04 Duncan Sands <baldrick@free.fr>
11087
11088 PR 9812
11089 * reduced_debug_output.h
11090 (Output_reduced_debug_abbrev_section::failed): Use format for
11091 gold_warning.
11092 (Output_reduced_debug_info_section::faild): Likewise.
11093
88a0e15b
ILT
110942009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11095
11096 * script.cc (Lazy_demangler): New class.
2e702c99 11097 (Version_script_info::get_symbol_version_helper): Demangle a
88a0e15b
ILT
11098 symbol only once.
11099
5efc7cd2
CC
111002009-01-29 Cary Coutant <ccoutant@google.com>
11101
11102 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11103 to __tls_get_addr.
11104 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11105
e0ebcf42
ILT
111062009-01-28 Ian Lance Taylor <iant@google.com>
11107
5efc7cd2 11108 * version.cc (version_string): Bump to 1.9.
75fe7426 11109
e0ebcf42
ILT
11110 * gold.h: Include <cstring> and <stdint.h>.
11111 * version.cc: Include <cstdio>.
11112 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11113 warning.
11114 * reduced_debug_output.cc (insert_into_vector): Rename from
11115 Insert_into_vector; change all callers. Use Swap_unaligned to
11116 avoid aliasing issue; remove union since it is unnecessary.
11117
8e2813be 111182009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
11119
11120 * Makefile.am (CCFILES): Add gc.cc.
11121 (HFILES): Add gc.h.
11122 * Makefile.in: Regenerate.
11123 * gold.cc (Gc_runner): New class.
11124 (queue_initial_tasks): Call garbage collection related tasks
11125 when corresponding options are invoked.
11126 (queue_middle_gc_tasks): New function.
11127 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11128 processed early before laying out sections during garbage collection.
11129 * gold.h (queue_middle_gc_tasks): New function.
11130 (is_prefix_of): Move from "layout.cc".
11131 * i386.cc (Target_i386::gc_process_relocs): New function.
11132 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11133 * main.cc (main): Create object of class "Garbage_collection".
11134 * object.cc (Relobj::copy_symbols_data): New function.
11135 (Relobj::is_section_name_included): New function.
e1df38aa
NC
11136 (Sized_relobj::do_layout): Allow this function to be called twice
11137 during garbage collection and defer layout of section during the
6d03d481
ST
11138 first call.
11139 * object.h (Relobj::get_symbols_data): New function.
11140 (Relobj::is_section_name_included): New function.
11141 (Relobj::copy_symbols_data): New function.
11142 (Relobj::set_symbols_data): New function.
11143 (Relobj::get_relocs_data): New function.
11144 (Relobj::set_relocs_data): New function.
11145 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11146 (Relobj::gc_process_relocs): New function.
11147 (Relobj::do_gc_process_relocs): New pure virtual function.
11148 (Relobj::sd_): New data member.
11149 (Sized_relobj::is_output_section_offset_invalid): New function.
11150 (Sized_relobj::do_gc_process_relocs): New function.
11151 * options.h (General_options::gc_sections): Modify to not be a no-op.
11152 (General_options::print_gc_sections): New option.
11153 * plugin.cc (Plugin_finish::run): Remove function call to
11154 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11155 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11156 * reloc.cc (Read_relocs::run): Add task to process relocs and
11157 determine unreferenced sections when doing garbage collection.
11158 (Gc_process_relocs): New class.
11159 (Sized_relobj::do_gc_process_relocs): New function.
11160 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11161 sections that are garbage collected.
11162 * reloc.h (Gc_process_relocs): New class.
11163 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11164 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11165 symbols whose corresponding sections are garbage collected.
11166 (Symbol_table::Symbol_table): Add new parameter for the garbage
11167 collection object.
11168 (Symbol_table::gc_mark_undef_symbols): New function.
11169 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11170 (Symbol_table::gc_mark_dyn_syms): New function.
11171 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11172 as garbage.
11173 (Symbol_table::add_from_object): Likewise.
11174 (Symbol_table::add_from_relobj): When building shared objects, do not
11175 treat externally visible symbols as garbage.
11176 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11177 table information for static and relocatable links.
11178 * symtab.h (Symbol_table::set_gc): New function.
11179 (Symbol_table::gc): New function.
11180 (Symbol_table::gc_mark_undef_symbols): New function.
11181 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11182 (Symbol_table::gc_mark_dyn_syms): New function.
11183 (Symbol_table::gc_): New data member.
e1df38aa 11184 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
11185 function.
11186 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11187 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11188
3b293544
CF
111892009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11190
11191 * options.h (General_options::gc_sections): Define as a no-op for now.
11192 (General_options::no_keep_memory): Ditto.
11193 (General_options::Bshareable): Define.
11194 * options.cc (General_options::finalize): Honor -Bshareable.
11195
83d22aa8
AS
111962009-01-20 Andreas Schwab <schwab@suse.de>
11197
11198 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11199 read the value in the contents, since we don't use it. Use the
11200 template endianness when writing.
11201 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11202
cd536b21
AS
112032009-01-19 Andreas Schwab <schwab@suse.de>
11204
11205 * configure.tgt (powerpc64-*): Fix targ_obj.
11206
99e9a495
ILT
112072009-01-15 Ian Lance Taylor <iant@google.com>
11208
11209 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11210 local symbols when stripping all symbols.
11211
bbbfea06
CC
112122009-01-14 Cary Coutant <ccoutant@google.com>
11213
99e9a495 11214 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 11215
0f7c0701
CC
112162009-01-14 Cary Coutant <ccoutant@google.com>
11217
11218 * archive.cc (Archive::get_elf_object_for_member): Remove call
11219 to File_read::claim_for_plugin.
11220 * descriptors.cc (Descriptors::open): Remove reference to
11221 is_claimed.
11222 (Descriptors::claim_for_plugin): Remove.
11223 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11224 (Descriptors::is_claimed): Remove.
11225 (claim_descriptor_for_plugin): Remove.
11226 * fileread.cc (File_read::claim_for_plugin): Remove.
11227 * fileread.h (File_read::claim_for_plugin): Remove.
11228 (File_read::descriptor): Reopen descriptor if necessary.
11229 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11230 (Plugin_manager::all_symbols_read): Add task parameter. Change
11231 all callers.
11232 (Plugin_manager::get_input_file): New function.
11233 (Plugin_manager::release_input_file): New function.
11234 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11235 corresponding data member.
11236 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11237 and pass to base constructor. Change all callers.
11238 (get_input_file, release_input_file): New functions.
11239 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11240 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11241 (Plugin_manager::all_symbols_read): Add task parameter.
11242 (Plugin_manager::get_input_file): New function.
11243 (Plugin_manager::release_input_file): New function.
11244 (Plugin_manager::task_): New data member.
11245 (Pluginobj::Pluginobj): Add filesize parameter.
11246 (Pluginobj::filename): New function.
11247 (Pluginobj::descriptor): New function.
11248 (Pluginobj::filesize): New function.
11249 (Pluginobj::filesize_): New data member.
11250 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11251 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11252 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11253
11254 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11255 with archive libraries.
11256 * testsuite/Makefile.in: Regenerate.
11257 * testsuite/plugin_test.c (struct sym_info): New type.
11258 (get_input_file, release_input_file): New static variables.
11259 (onload): Capture new transfer vector entries.
11260 (claim_file_hook): Stop reading at end of file according to filesize.
11261 Factor out parsing of readelf output into separate function.
11262 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11263 APIs and get the source file name from the symbol table. Convert
11264 source file name to corresponding object file name. Print info
11265 message when adding new input files.
11266 (parse_readelf_line): New function.
11267 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11268 * testsuite/plugin_test_2.sh: Likewise.
11269 * testsuite/plugin_test_3.sh: Likewise.
11270 * testsuite/plugin_test_4.sh: New test case.
11271
62a6d109
ILT
112722009-01-07 Ian Lance Taylor <iant@google.com>
11273
11274 * version.cc (version_string): Bump to 1.8.
11275
483620e8
CC
112762008-12-23 Cary Coutant <ccoutant@google.com>
11277
11278 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11279 * plugin.cc (Plugin_manager::finish): Rename as
11280 layout_deferred_objects. Move cleanup to separate function.
11281 (Plugin_manager::cleanup): New function.
11282 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11283 separately.
11284 * plugin.h (Plugin_manager::finish): Rename as
11285 layout_deferred_objects.
11286 (Plugin_manager::cleanup): New function.
11287 (Plugin_manager::cleanup_done): New field.
11288
d66a9eb3
CC
112892008-12-23 Cary Coutant <ccoutant@google.com>
11290
11291 * plugin.cc (is_visible_from_outside): New function.
11292 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11293 so we don't return "IR only" status for exported symbols or -r links.
11294
11295 * testsuite/Makefile.am (plugin_test_3): New test case.
11296 * testsuite/Makefile.in: Regenerate.
11297 * testsuite/plugin_test_3.sh: New file.
11298
5995b570
CC
112992008-12-22 Cary Coutant <ccoutant@google.com>
11300
11301 * object.cc (Sized_relobj::layout_section): New function.
11302 (Sized_relobj::do_layout): Defer layout of input sections until after
11303 plugin has provided replacement files.
11304 (Sized_relobj::do_layout_deferred_sections): New function.
11305 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11306 (Relobj::layout_deferred_sections): New function.
11307 (Relobj::do_layout_deferred_sections): New function.
11308 (Sized_relobj::do_layout_deferred_sections): New function.
11309 (Sized_relobj::layout_section): New function.
11310 (Sized_relobj::Deferred_layout): New structure.
11311 (Sized_relobj::deferred_layout_): New field.
11312 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11313 Change all callers. Layout deferred sections.
11314 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11315 references.
11316 (Plugin_hook::run): Move code from do_plugin_hook inline.
11317 (Plugin_hook::do_plugin_hook): Remove.
11318 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11319 (Plugin_manager::finish): Renamed, was cleanup.
11320 (Plugin_manager::should_defer_layout): New function.
11321 (Plugin_manager::add_deferred_layout_object): New function.
11322 (Plugin_manager::Deferred_layout_list): New type.
11323 (Plugin_manager::deferred_layout_objects_): New field.
11324 (Plugin_hook::do_plugin_hook): Remove.
11325
ee769c88
ILT
113262008-12-17 Ian Lance Taylor <iant@google.com>
11327
11328 * options.h (class General_options): Add --no case for
11329 --export-dynamic.
11330
abc8dcba
CC
113312008-12-16 Cary Coutant <ccoutant@google.com>
11332
11333 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11334 vector.
11335 (Plugin_manager::claim_file): Create plugin object even if
11336 plugin did not call the add_symbols callback.
11337 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11338 asking for more symbols than were added.
11339 * testsuite/Makefile.am (plugin_test_1): Add test case with
11340 no global symbols.
11341 (empty.syms): New target.
11342 * testsuite/Makefile.in: Regenerate.
11343 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11344 message. Don't call add_symbols if no globals.
11345 (all_symbols_read_hook): Don't provide replacement for empty
11346 claimed file.
11347
b0074644
ILT
113482008-12-12 Ian Lance Taylor <iant@google.com>
11349
68943102
ILT
11350 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11351 r_type == 0 for a local symbol with r_sym == 0.
11352 (scan_relocatable_relocs): Pass r_sym to
11353 local_non_section_strategy.
11354 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11355 r_sym parameter.
11356
b0074644
ILT
11357 * configure.ac: Update test for TLS descriptors: they are
11358 supported as of glibc 2.9.
11359 * configure: Rebuild.
11360
c2508178
ILT
113612008-12-11 Ian Lance Taylor <iant@google.com>
11362
11363 PR 7091
11364 * target-reloc.h (Default_scan_relocatable_relocs): For each
11365 function, map r_type == 0 to RELOC_DISCARD.
11366
2756a258
CC
113672008-12-10 Cary Coutant <ccoutant@google.com>
11368
11369 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11370 object to override a kept COMDAT group from a plugin object.
11371
bb6f53d3
ILT
113722008-12-09 Ian Lance Taylor <iant@google.com>
11373
fbc558e1
ILT
11374 PR 7088
11375 * yyscript.y (file_cmd): Handle INPUT.
11376
bb6f53d3
ILT
11377 * testsuite/initpri1.c: Change all declarations to be full
11378 prototypes by adding void, to avoid compiler warnings.
11379
4674ecfc
CC
113802008-12-05 Rafael Avila de Espindola <espindola@google.com>
11381
11382 * options.cc (General_options::parse_plugin_opt): New.
11383 (General_options::add_plugin): The argument now is just the filename.
11384 (General_options::add_plugin_option): New.
11385 * options.h (plugin_opt): New.
11386 (add_plugin): Change argument name.
11387 (add_plugin_option): New.
11388 * plugin.cc (Plugin::load): Don't parse the plugin option.
11389 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11390 (Plugin::add_option): New.
11391 (Plugin::args_): Change type.
11392 (Plugin::filename_): New.
11393 (Plugin_manager::add_plugin_option): New.
11394 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11395 * testsuite/Makefile.in: Regenerate.
11396
fd06b4aa
CC
113972008-12-05 Cary Coutant <ccoutant@google.com>
11398
11399 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11400 Handle --strip-lto-sections option.
11401 * options.h (strip_lto_sections): New option.
11402
6c52134c
CC
114032008-12-01 Cary Coutant <ccoutant@google.com>
11404
11405 * plugin.cc (ld_plugin_message): Change format parameter to const.
11406 Fix mismatch between new[] and delete.
11407
a45248e0
CC
114082008-11-14 Cary Coutant <ccoutant@google.com>
11409
11410 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11411 instead of -1U.
11412
c82fbeee
CS
114132008-11-05 Craig Silverstein <csilvers@google.com>
11414
11415 * options.cc (General_options::parse_dynamic_list): New function.
11416 * options.h (General_options): New flags dynamic_list,
11417 dynamic_list_data, dynamic_list_cpp_new, and
11418 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11419 (General_options::in_dynamic_list): New function.
11420 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11421 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11422 (Lex::can_continue_name): Likewise.
11423 (yylex): Likewise.
11424 (read_script_file): New parameter script_options.
11425 (read_dynamic_list): New function.
11426 (Script_options::define_dynamic_list): New function.
11427 (dynamic_list_keyword_parsecodes): New variable.
11428 (dynamic_list_keywords): New variable.
11429 * script.h (Script_options::define_dynamic_list): New function
11430 prototype.
11431 (read_dynamic_list): New function prototype.
11432 * symtab.cc (strprefix): New macro.
11433 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11434 dynamic_list_data, dynamic_list_cpp_new, and
11435 dynamic_list_cpp_typeinfo.
11436 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11437 (dynamic_list_expr): New rule.
11438 (dynamic_list_nodes): Likewise.
11439 (dynamic_list_node): Likewise.
11440 * testsuite/Makefile.am (dynamic_list): New test.
11441 * testsuite/Makefile.in: Regenerated.
11442 * testsuite/dynamic_list.t: New file.
11443 * testsuite/dynamic_list.sh: New file.
11444
e0bb29a5
CS
114452008-11-05 Craig Silverstein <csilvers@google.com>
11446
11447 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11448 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11449 (t11_last): Likewise.
11450 * testsuite/ver_test_6.c (main): Likewise.
11451
4e1e25e0
CC
114522008-10-07 Cary Coutant <ccoutant@google.com>
11453
11454 * options.c (General_options::finalize): Add check for -static and
11455 -shared.
11456 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11457 is not empty.
11458
92f03fcb
CC
114592008-10-02 Cary Coutant <ccoutant@google.com>
11460
11461 * plugin.cc (make_sized_plugin_object): Fix conditional
11462 compilation to work when not all targets are enabled.
11463
fbd8a257
CC
114642008-09-29 Cary Coutant <ccoutant@google.com>
11465
11466 * archive.cc (Archive::get_file_and_offset): Use filename instead
11467 of name to get library path.
11468 (Archive::include_member): Unlock external member of a thin archive.
11469
11470 * testsuite/Makefile.am (TEST_AR): New variable.
11471 (thin_archive_test_1): New test.
11472 (thin_archive_test_2): New test.
81636b3f
CC
11473 * testsuite/Makefile.in: Regenerate.
11474 * testsuite/thin_archive_main.cc: New file.
11475 * testsuite/thin_archive_test_1.cc: New file.
11476 * testsuite/thin_archive_test_2.cc: New file.
11477 * testsuite/thin_archive_test_3.cc: New file.
11478 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 11479
eff45813
CC
114802008-09-29 Cary Coutant <ccoutant@google.com>
11481
11482 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11483 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11484 instead of -1U.
11485 (Sized_relobj::do_finalize_local_symbols): Likewise.
11486 (Sized_relobj::map_to_kept_section): Likewise.
11487 * object.h (Sized_relobj::invalid_address): New constant.
11488 (Sized_relobj::do_output_section_offset): Check for invalid_address
11489 and return -1ULL.
11490 * output.cc (Output_reloc::local_section_offset): Use constant
11491 invalid_address instead of -1U.
11492 (Output_reloc::get_address): Likewise.
11493 (Output_section::output_address): Change -1U to -1ULL.
11494 * output.h (Output_reloc::invalid_address): New constant.
11495 * reloc.cc (Sized_relobj::write_sections): Use constant
11496 invalid_address instead of -1U.
11497 (Sized_relobj::relocate_sections): Likewise.
11498 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11499 values for merge sections.
11500 * target-reloc.h (relocate_for_relocatable): Use constant
11501 invalid_address instead of -1U.
11502
89fc3421
CC
115032008-09-19 Cary Coutant <ccoutant@google.com>
11504
11505 Add plugin functionality for link-time optimization (LTO).
11506 * configure.ac (plugins): Add --enable-plugins option.
11507 * configure: Regenerate.
11508 * config.in: Regenerate.
11509 * Makefile.am (LIBDL): New variable.
11510 (CCFILES): Add plugin.cc.
11511 (HFILES): Add plugin.h.
11512 (ldadd_var): Add LIBDL.
11513 * Makefile.in: Regenerate.
11514
11515 * archive.cc: Include "plugin.h".
11516 (Archive::setup): Don't preread archive symbols when using a plugin.
11517 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11518 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11519 files.
11520 (Archive::include_member): Add symbols from plugin objects.
11521 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11522 * descriptors.cc (Descriptors::open): Check for file descriptors
11523 abandoned by plugins.
11524 (Descriptors::claim_for_plugin): New function.
11525 * descriptors.h (Descriptors::claim_for_plugin): New function.
11526 (Open_descriptor::is_claimed): New field.
11527 (claim_descriptor_for_plugin): New function.
11528 * fileread.cc (File_read::claim_for_plugin): New function.
11529 * fileread.h (File_read::claim_for_plugin): New function.
11530 (File_read::descriptor): New function.
11531 * gold.cc: Include "plugin.h".
11532 (queue_initial_tasks): Add task to call plugin hooks for generating
11533 new object files.
11534 * main.cc: Include "plugin.h".
11535 (main): Load plugin libraries.
11536 * object.h (Pluginobj): Declare.
11537 (Object::pluginobj): New function.
11538 (Object::do_pluginobj): New function.
11539 (Object::set_target): New function.
11540 * options.cc: Include "plugin.h".
11541 (General_options::parse_plugin): New function.
11542 (General_options::General_options): Initialize plugins_ field.
11543 (General_options::add_plugin): New function.
11544 * options.h (Plugin_manager): Declare.
11545 (General_options): Add --plugin option.
11546 (General_options::has_plugins): New function.
11547 (General_options::plugins): New function.
11548 (General_options::add_plugin): New function.
11549 (General_options::plugins_): New field.
11550 * plugin.cc: New file.
11551 * plugin.h: New file.
11552 * readsyms.cc: Include "plugin.h".
11553 (Read_symbols::do_read_symbols): Check for archive before checking
11554 for ELF file. Call plugin hooks to claim files.
11555 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11556 from a real object file; force override when processing replacement
11557 files.
11558 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11559 (Symbol::init_base_object): Likewise.
11560 (Symbol::init_base_output_data): Likewise.
11561 (Symbol::init_base_output_segment): Likewise.
11562 (Symbol::init_base_constant): Likewise.
11563 (Symbol::init_base_undefined): Likewise.
11564 (Symbol::output_section): Assert that object is not a plugin.
11565 (Symbol_table::add_from_pluginobj): New function.
11566 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11567 undefined.
11568 (Symbol_table::sized_write_globals): Likewise.
11569 (Symbol_table::add_from_pluginobj): Instantiate template.
11570 * symtab.h (Sized_pluginobj): Declare.
11571 (Symbol::in_real_elf): New function.
11572 (Symbol::set_in_real_elf): New function.
11573 (Symbol::in_real_elf_): New field.
11574 (Symbol_table::add_from_pluginobj): New function.
11575
11576 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11577 (LIBDL): New variable.
11578 (LDADD): Add LIBDL.
11579 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11580 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11581 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11582 (MOSTLYCLEANFILES): Likewise.
11583 * testsuite/Makefile.in: Regenerate.
11584 * testsuite/plugin_test.c: New file.
11585 * testsuite/plugin_test_1.sh: New file.
11586 * testsuite/plugin_test_2.sh: New file.
11587
de31bda5
ILT
115882008-09-16 Ian Lance Taylor <iant@google.com>
11589
9c2d0ef9
ILT
11590 * target-reloc.h (relocate_section): Check whether a symbol is
11591 defined by the ABI before reporting an undefined symbol error.
11592 * target.h (Target::is_defined_by_abi): Make parameter const.
11593 (Target::do_is_defined_by_abi): Likewise.
11594 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11595 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11596 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11597 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11598 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11599 * testsuite/Makefile.in: Rebuild.
11600
de31bda5
ILT
11601 * fileread.cc (make_view): Add casts to avoid warning.
11602
9fa33bee
AO
116032008-09-16 Alexandre Oliva <aoliva@redhat.com>
11604
11605 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11606 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11607
183fd0e3
AO
116082008-09-16 Alexandre Oliva <aoliva@redhat.com>
11609
11610 * options.h (General_options::output_is_executable): New.
11611 (General_options::output_is_pie): New.
11612 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11613 for shared libraries.
11614 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11615
7be8330a
CD
116162008-09-11 Chris Demetriou <cgd@google.com>
11617
11618 * options.h (origin): New -z option.
11619 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11620 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11621 in DT_FLAGS_1.
11622
a9caad02
CC
116232008-09-05 Cary Coutant <ccoutant@google.com>
11624
11625 * fileread.cc (File_read::make_view): Add check for attempt to map
11626 beyond end of file.
11627
ae6dce4d
CC
116282008-09-05 Cary Coutant <ccoutant@google.com>
11629
11630 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11631 explicit instantiations.
11632
d7ab2a47
KVH
116332008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11634
11635 PR gold/6858
11636 * options.cc (General_options::finalize): Allow undefined symbols
11637 in shlibs if linking -shared.
11638
11639 PR gold/6859
11640 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11641 symbols as not needing a dynsym entry.
11642
1e52a9c1
CS
116432008-08-20 Craig Silverstein <csilvers@google.com>
11644
11645 * fileread.cc (File_read::open): Do not lock the file unless it
11646 was successfully opened.
11647
d85c80a3
CC
116482008-08-14 Cary Coutant <ccoutant@google.com>
11649
11650 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11651 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11652 * testsuite/tls_test.cc (struct int128): 128-bit struct
11653 for testing TLS relocs with non-zero addend.
11654 (v12): New TLS variable.
11655 (t12): New test.
11656 (t_last): Add check for v12.
11657 * testsuite/tls_test.h (t12): New function.
11658 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11659
2d924fd9
ILT
116602008-08-13 Ian Lance Taylor <iant@google.com>
11661
11662 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11663 set tls_segment_ or relro_segment_.
11664 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11665 when appropriate.
11666 * output.h (Output_section::clear_is_relro): New function.
11667 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11668 sections specially even when output_data_ is empty.
11669 (Output_segment::maximum_alignment): When first section is relro,
11670 only force alignment for PT_LOAD segments.
11671 * script.cc (script_data_segment_align): New function.
11672 (script_data_segment_relro_end): New function.
11673 * script-c.h (script_data_segment_align): Declare.
11674 (script_data_segment_relro_end): Declare.
11675 * script-sections.h (class Script_sections): Declare
11676 data_segment_align and data_segment_relro_end. Add fields
11677 segment_align_index_ and saw_relro_end_.
11678 * script-sections.cc (class Sections_element): Add set_is_relro
11679 virtual function. Add new bool* parameter to place_orphan_here.
11680 Add get_output_section virtual function.
11681 (class Output_section_definition): Add set_is_relro. Add new
11682 bool* parameter to place_orphan_here. Add get_output_section.
11683 Add is_relro_ field.
11684 (Output_section_definition::Output_section_definition): Initialize
11685 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11686 and is_relro_ fields.
11687 (Output_section_definition::place_orphan_here): Add is_relro
11688 parameter.
11689 (Output_section_definition::set_section_addresses): Set relro for
11690 output section.
11691 (Output_section_definition::alternate_constraint): Likewise.
11692 (class Orphan_output_section): Add new bool* parameter to
11693 place_orphan_here. Add get_output_section.
11694 (Orphan_output_section::place_orphan_here): Add is_relro
11695 parameter.
11696 (Script_sections::Script_sections): Initialize
11697 data_segment_align_index_ and saw_relro_end_.
11698 (Script_sections::data_segment_align): New function.
11699 (Script_sections::data_segment_relro_end): New function.
11700 (Script_sections::place_orphan): Set or clear is_relro.
11701 (Script_sections::set_section_addresses): Force alignment of first
11702 TLS section.
11703 * yyscript.y (exp): Call script_data_segment_align and
11704 script_data_segment_relro_end.
11705 * testsuite/relro_script_test.t: New file.
11706 * testsuite/relro_test.cc (using_script): Declare.
11707 (t1, t2): Test using_script.
11708 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11709 (relro_script_test_SOURCES): Define.
11710 (relro_script_test_DEPENDENCIES): Define.
11711 (relro_script_test_LDFLAGS): Define.
11712 (relro_script_test_LDADD): Define.
11713 (relro_script_test.so): New target.
11714 * testsuite/Makefile.in: Rebuild.
11715
f827c9a9
CC
117162008-08-06 Cary Coutant <ccoutant@google.com>
11717
11718 * archive.cc (Archive::total_archives, Archive::total_members)
11719 (Archive::total_members_loaded): New variables.
11720 (Archive::setup): Add parameter. Add option to preread
11721 archive symbols.
11722 (Archive::read_armap): Add counter.
11723 (Archive::get_file_and_offset): New function.
11724 (Archive::get_elf_object_for_member): New function.
11725 (Archive::read_all_symbols): New function.
11726 (Archive::read_symbols): New function.
11727 (Archive::add_symbols): Add counters.
11728 (Archive::include_all_members): Use armap to find members if it's
11729 already built.
11730 (Archive::include_member): Skip reading symbols if already read.
11731 Factored code into Archive::get_file_and_offset and
11732 Archive::get_elf_object_for_member. Changed call to
11733 Mapfile::report_include_archive_member.
11734 (Archive::print_stats): New function.
11735 * archive.h: Declare Object and Read_symbols_data classes.
11736 (Archive::Archive): Add initializers for new members.
11737 (Archive::setup): Add parameter.
11738 (Archive::print_stats): New function.
11739 (Archive::total_archives, Archive::total_members)
11740 (Archive::total_members_loaded): New variables.
11741 (Archive::get_file_and_offset): New function.
11742 (Archive::get_elf_object_for_member): New function.
11743 (Archive::read_all_symbols): New function.
11744 (Archive::read_symbols): New function.
11745 (Archive::Archive_member): New class.
11746 (Archive::members_): New member.
11747 (Archive::num_members_): New member.
11748 * main.cc: Include archive.h.
11749 (main): Call Archive::print_stats.
11750 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11751 archive parameter; member_name is now the fully-decorated name.
11752 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11753 * options.h: (General_options): Add --preread-archive-symbols option.
11754 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11755 Archive::setup.
11756
de4c45bd
ILT
117572008-08-04 Ian Lance Taylor <iant@google.com>
11758
11759 * symtab.h (Symbol::use_plt_offset): New function.
11760 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11761 * powerpc.cc (Relocate::relocate): Likewise.
11762 * sparc.cc (Relocate::relocate): Likewise.
11763 * x86_64.cc (Relocate::relocate): Likewise.
11764 * testsuite/weak_plt.sh: New test.
11765 * testsuite/weak_plt_main.cc: New test.
11766 * testsuite/weak_plt_shared.cc: New test.
11767 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11768 (check_PROGRAMS): Add weak_plt.
11769 (check_DATA): Add weak_plt_shared.so.
11770 (weak_plt_main_pic.o, weak_plt): New targets.
11771 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11772 * testsuite/Makefile.in: Rebuild.
11773
11774 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11775 gcctestdir/ld.
11776 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11777 * testsuite/Makefile.in: Rebuild.
11778
323ee3f4
AM
117792008-08-04 Alan Modra <amodra@bigpond.net.au>
11780
11781 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11782 * Makefile.in: Regenerate.
11783 * po/POTFILES.in: Regenerate.
11784
7c07ecec
ILT
117852008-07-29 Ian Lance Taylor <iant@google.com>
11786
11787 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11788 symbols before other symbols.
11789 * testsuite/script_test_2.cc (test_addr): Declare.
11790 (test_addr_alias): Declare.
11791 (main): Check that test_addr and test_addr_alias have the right
cd536b21 11792 values.
7c07ecec
ILT
11793 * testsuite/script_test_2.t: Define test_addr_alias and
11794 test_addr.
11795
5778530e
ILT
117962008-07-24 Ian Lance Taylor <iant@google.com>
11797
2a00e4fb
ILT
11798 PR 5990
11799 * descriptors.cc: New file.
11800 * descriptors.h: New file.
11801 * gold-threads.h (class Hold_optional_lock): New class.
11802 * fileread.cc: Include "descriptors.h".
11803 (File_read::~File_read): Release descriptor rather than closing
11804 it.
11805 (File_read::open) [file]: Call open_descriptor rather than open.
11806 Set is_descriptor_opened_.
11807 (File_read::open) [memory]: Assert that descriptor is not open.
11808 (File_read::reopen_descriptor): New function.
11809 (File_read::release): Release descriptor.
11810 (File_read::do_read): Make non-const. Reopen descriptor.
11811 (File_read::read): Make non-const.
11812 (File_read::make_view): Reopen descriptor.
11813 (File_read::do_readv): Likewise.
11814 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11815 Update declarations.
11816 * layout.cc: Include "descriptors.h".
11817 (Layout::create_build_id): Use open_descriptor rather than open.
11818 * output.cc: Include "descriptors.h".
11819 (Output_file::open): Use open_descriptor rather than open.
11820 * archive.cc (Archive::const_iterator): Change Archive to be
11821 non-const.
11822 (Archive::begin, Archive::end): Make non-const.
11823 (Archive::count_members): Likewise.
11824 * archive.h (class Archive): Update declarations.
11825 * object.h (Object::read): Make non-const.
11826 * Makefile.am (CCFILES): Add descriptors.cc.
11827 (HFILES): Add descriptors.h.
11828 * Makefile.in: Rebuild.
11829
801647d1
ILT
11830 PR 6716
11831 * gold.h: Always include <clocale>. Add Solaris workarounds
11832 following code in binutils/sysdep.h.
11833
5edd166e
ILT
11834 PR 6048
11835 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11836 this->eh_frame_hdr_ is NULL before using it.
11837
c89ad728
ILT
11838 * dynobj.cc (Versions::Versions): Update comment.
11839
aa86f06b
ILT
11840 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11841 the base version name.
11842
5778530e
ILT
11843 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11844 array size plus one.
11845 (Stringpool_template::set_string_offsets): Subtract one from key
11846 before using it as an array index.
11847 (Stringpool_template::get_offset_with_length): Likewise.
11848 (Stringpool_template::write_to_buffer): Likewise.
11849 * stringpool.h (Stringpool_template::get_offset_from_key):
11850 Likewise.
11851
057ead22
ILT
118522008-07-23 Ian Lance Taylor <iant@google.com>
11853
7f649c59
ILT
11854 PR 6658
11855 * object.h (Merged_symbol_value::value): Do our best to handle a
11856 negative addend.
11857
057ead22
ILT
11858 PR 6647
11859 * script.cc (Version_script_info::get_versions): Don't add empty
11860 version tag to return value.
11861 (Version_script_info::get_symbol_version_helper): Change return
11862 type to bool. Add pversion parameter. Change all callers.
11863 (script_register_vers_node): Don't require a non-NULL tag.
11864 * script.h (class Version_script_info): Update declarations.
11865 (Version_script_info::get_symbol_version): Change return type to
11866 bool. Add version parameter. Change all callers.
11867 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11868 handling. Handle an empty version from a version script.
11869 (Symbol_table::define_special_symbol): Likewise.
11870 * testsuite/ver_test_10.script: New file.
11871 * testsuite/ver_test_10.sh: New file.
11872 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11873 (check_DATA): Add ver_test_10.syms.
11874 (ver_test_10.syms, ver_test_10.so): New target.
11875 * testsuite/Makefile.in: Rebuild.
11876
58e54ac2
CD
118772008-07-23 Simon Baldwin <simonb@google.com>
11878
11879 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11880 to zero for undefined symbols from dynamic libraries.
11881
95d14cd3
ILT
118822008-07-23 Ian Lance Taylor <iant@google.com>
11883
11884 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11885 Change all callers.
11886 * symtab.h (class Symbol_table): Update declaration.
11887 * testsuite/ver_test_9.cc: New file.
11888 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11889 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11890 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11891 (ver_test_9.so, ver_test_9.o): New targets.
11892 * testsuite/Makefile.in: Rebuild.
11893
92de84a6
ILT
118942008-07-22 Ian Lance Taylor <iant@google.com>
11895
34810851
ILT
11896 * options.h (class General_options): Define --check-sections.
11897 * layout.cc (Layout::set_segment_offsets): Handle
11898 --check-sections.
11899
af6156ef
ILT
11900 * options.h (class General_options): Define -n/--nmagic and
11901 -N/--omagic.
11902 * options.cc (General_options::finalize): For -n/--nmagic or
11903 -N/--omagic, set -static.
11904 * layout.cc (Layout::attach_allocated_section_to_segment): If
11905 -N/--omagic, don't put read-only and read-write sections in
11906 different segments.
11907 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11908 finding a read-only segment.
11909 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11910 don't set the minimum segment alignment to the common page size,
11911 and don't set the file offset to the address modulo the page size.
11912 * script-sections.cc (Script_sections::create_segments): If
11913 -n/--omagic, don't put read-only and read-write sections in
11914 different segments.
11915
92de84a6
ILT
11916 * cref.cc: New file.
11917 * cref.h: New file.
11918 * options.h (class General_options): Add --print-symbol-counts.
11919 * main.cc (main): Issue defined symbol report if requested.
11920 * archive.cc (Archive::interpret_header): Make into a const member
11921 function.
11922 (Archive::add_symbols): Call Input_objects::archive_start and
11923 archive_stop.
11924 (Archive::const_iterator): Define new class.
11925 (Archive::begin, Archive::end): New functions.
11926 (Archive::include_all_members): Rewrite to use iterator.
11927 (Archive::count_members): New function.
11928 * archive.h (class Archive): Update declarations.
11929 (Archive::filename): New function.
11930 * object.cc: Include "cref.h".
11931 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11932 (Sized_relobj::do_get_global_symbol_counts): New function.
11933 (Input_objects::add_object): Add object to cross-referencer.
11934 (Input_objects::archive_start): New function.
11935 (Input_objects::archive_stop): New function.
11936 (Input_objects::print_symbol_counts): New function.
11937 * object.h: Declare Cref and Archive.
11938 (Object::get_global_symbol_counts): New function.
11939 (Object::do_get_global_symbol_counts): New pure virtual function.
11940 (class Sized_relobj): Add defined_count_ field. Update
11941 declarations.
11942 (class Input_objects): Add cref_ field. Update constructor.
11943 Update declarations.
11944 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11945 defined_count_.
11946 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11947 symbol counts.
11948 (Sized_dynobj::do_get_global_symbol_counts): New function.
11949 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11950 defined_count_. Update declarations. Define Symbols typedef.
11951 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11952 parameter. Change all callers.
11953 (Symbol_table::add_from_dynobj): Add sympointers and defined
11954 parameters. Change all callers.
11955 * symtab.h (class Symbol_table): Update declarations.
11956 * Makefile.am (CCFILES): Add cref.cc.
11957 (HFILES): Add cref.h.
11958 * Makefile.in: Rebuild.
11959
3f7c5e1d
CD
119602008-07-22 Simon Baldwin <simonb@google.com>
11961
11962 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11963 to zero when writing undefined symbols.
11964
e0b64032
ILT
119652008-07-22 Ian Lance Taylor <iant@google.com>
11966
11967 * output.cc (Output_section::add_input_section): Don't try to
11968 merge empty merge sections.
11969
096b02cf
CS
119702008-07-21 Craig Silverstein <csilvers@google.com>
11971
11972 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11973 Include symbol version in error message.
cd536b21 11974
1d1f116d
CD
119752008-07-20 Chris Demetriou <cgd@google.com>
11976
cd536b21 11977 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
11978 (RANDOM_SEED_CFLAGS): New substituted variable.
11979 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11980 * configure: Rebuild.
11981 * Makefile.in: Likewise.
11982 * testsuite/Makefile.in: Likewise.
11983
a18f591e
ILT
119842008-07-18 Ian Lance Taylor <iant@google.com>
11985
11986 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11987 where we see NAME/NULL and NAME/VERSION as separate symbols.
11988 * testsuite/ver_test_main.cc (main): Call t4.
11989 (t4, t4_2a): Define.
11990 * testsuite/ver_test_2.cc (t4_2): Define.
11991 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11992 * testsuite/ver_test_4.cc (t4_2a): Define.
11993 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11994 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11995
c6e3f6ed
ILT
119962008-07-17 Ian Lance Taylor <iant@google.com>
11997
11998 * dynobj.cc (Versions::add_def): If we give an error about a
11999 missing version, go ahead and create the version anyhow.
12000
ef9beddf
ILT
120012008-07-10 Ian Lance Taylor <iant@google.com>
12002
12003 Handle output sections with more than 0x7fffffff bytes.
12004 * object.h (class Relobj): Change map_to_output_ to
12005 output_sections_, and just keep a section pointer. Change all
12006 uses. Move comdat group support to Sized_relobj.
12007 (Relobj::is_section_specially_mapped): Remove.
12008 (Relobj::output_section): Remove poff parameter. Change all
12009 callers.
12010 (Relobj::output_section_offset): New function.
12011 (Relobj::set_section_offset): Rewrite.
12012 (Relobj::map_to_output): Remove.
12013 (Relobj::output_sections): New function.
12014 (Relobj::do_output_section_offset): New pure virtual function.
12015 (Relobj::do_set_section_offset): Likewise.
12016 (class Sized_relobj): Add section_offsets_ field. Add comdat
12017 group support from Relobj. Update declarations.
12018 (Sized_relobj::get_output_section_offset): New function.
12019 (Sized_relobj::do_output_section_offset): New function.
12020 (Sized_relobj::do_set_section_offset): New function.
12021 * object.cc (Relobj::output_section_address): Remove.
12022 (Sized_relobj::Sized_relobj): Initialize new fields.
12023 (Sized_relobj::include_section_group): Cast find_kept_object to
12024 Sized_relobj.
12025 (Sized_relobj::include_linkonce_section): Likewise.
12026 (Sized_relobj::do_layout): Use separate arrays for output section
12027 and output offset.
12028 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12029 output_sections.
12030 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12031 output_sections and section_offsets.
12032 (Sized_relobj::write_local_symbols): Likewise.
12033 (map_to_kept_section): Compute output address directly.
12034 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12035 output_sections and section_offsets.
12036 (Sized_relobj::write_sections): Likewise.
12037 (Sized_relobj::relocate_sections): Likewise.
12038 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12039 * output.h (class Output_reloc): Update declarations. Change
12040 u2_.relobj to Sized_relobj*.
12041 (class Output_data_reloc): Change add functions to use
12042 Sized_relobj*.
12043 * output.cc (Output_reloc::Output_reloc): Change relobj to
12044 Sized_relobj*.
12045 (Output_reloc::local_section_offset): Change return type to
12046 Elf_Addr. Use get_output_section_offset.
12047 (Output_reloc::get_address): Likewise.
12048 (Output_section::is_input_address_mapped): Don't call
12049 is_section_specially_mapped.
12050 (Output_section::output_offset): Likewise.
12051 (Output_section::output_address): Likewise.
12052 (Output_section::starting_output_address): Likewise.
12053 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12054 parameter to Sized_relobj*.
12055 (Copy_relocs::need_copy_reloc): Likewise.
12056 (Copy_relocs::save): Likewise.
12057 * copy-relocs.h (class Copy_relocs): Update declarations.
12058 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12059 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12060 * target-reloc.h (relocate_for_relocatable): Change
12061 offset_in_output_section type to Elf_Addr. Change code that uses
12062 it as well.
12063 * layout.cc (Layout::layout): Always set *off.
12064 * mapfile.cc (Mapfile::print_input_section): Use
12065 output_section_offset.
12066 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12067 Sized_relobj*.
12068 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12069 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12070 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12071
5cb66f97
ILT
120722008-07-03 Ian Lance Taylor <iant@google.com>
12073
12074 * layout.cc (Layout::include_section): Do not discard unrecognized
12075 SHT_STRTAB sections.
12076
afe47622
CS
120772008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12078
12079 * script.cc (Lex::can_continue_name): Make '?' allowable in
12080 version-script names.
12081 * testsuite/version_script.map: Change glob pattern to use '?'
12082
5adf9721
ILT
120832008-06-30 Manish Singh <yosh@gimp.org>
12084
12085 PR 6585
12086 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12087 Correct typo.
12088
e6fde208
ILT
120892008-06-30 Ian Lance Taylor <iant@google.com>
12090
12091 PR 6660
12092 PR 6682
12093 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12094 versions]: Don't try to read the value in the contents, since we
12095 don't use it. Use the template endianness when writing.
12096
3f2e6a2d
CC
120972008-06-25 Cary Coutant <ccoutant@google.com>
12098
12099 * fileread.cc (File_read::make_view): Assert on zero-length view.
12100 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12101 symbol table when there are no symbols to read.
12102
c43d3a48
CS
121032008-06-23 Craig Silverstein <csilvers@google.com>
12104
12105 * version.cc (version_string): Bump to 1.7
12106
5f494ea0
CS
121072008-06-18 Craig Silverstein <csilvers@google.com>
12108
12109 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12110 constant 0xFFFF to type Valtype.
12111 (Powerpc_relocate_functions::rel16_ha): Likewise.
12112
c42e122e
ILT
121132008-06-17 Ian Lance Taylor <iant@google.com>
12114
f34787f8
ILT
12115 * output.h (Output_section::Input_section): Initialize p2align_ to
12116 zero for Output_section_data constructors.
12117 (Output_section::Input_section::addralign): If not an input
12118 section, return the alignment of the Output_section_data.
12119 * testsuite/copy_test.cc: New file.
12120 * testsuite/copy_test_1.cc: New file.
12121 * testsuite/copy_test_2.cc: New file.
12122 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12123 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12124 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12125 (copy_test_1_pic.o, copy_test_1.so): New targets.
12126 (copy_test_2_pic.o, copy_test_2.so): New targets.
12127 * testsuite/Makefile.in: Rebuild.
12128
c42e122e
ILT
12129 * script-sections.cc (Script_sections::place_orphan): Initialize
12130 local variable exact.
12131
ce3ac18a
DE
121322008-06-13 David Edelsohn <edelsohn@gnu.org>
12133
12134 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12135
42cacb20
DE
121362008-06-12 David Edelsohn <edelsohn@gnu.org>
12137 David S. Miller <davem@davemloft.net>
12138
12139 * powerpc.cc: New file.
12140 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12141 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12142 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12143 * Makefile.in: Rebuild.
12144
7b308235
ILT
121452008-06-09 Ian Lance Taylor <iant@google.com>
12146
12147 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12148 <exception>.
12149 (throwing, orig_terminate): New static variables.
12150 (terminate_handler): New static function.
12151 (t2): Set terminate handler.
12152
f0b886e3
ILT
121532008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12154
12155 PR 6584
cd536b21 12156 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
12157 alignment.
12158
3e90f135
CC
121592008-05-30 Cary Coutant <ccoutant@google.com>
12160
12161 * archive.cc (Archive::include_all_members) Correct to step
12162 over symbol table and extended name table in thin archives.
12163
e09ad04a
ILT
121642008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12165
12166 PR 6407
12167 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12168 calculation.
12169
62b01cb5
ILT
121702008-05-28 Caleb Howe <cshowe@google.com>
12171
12172 * reduced_debug_output.cc: New file.
12173 * reduced_debug_output.h: New file.
92de84a6 12174 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
12175 * options.cc (General_options::finalize): Add strip_debug_non_line
12176 to the strip heirarchy.
12177 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12178 fields.
12179 * layout.cc: Include "reduced_debug_output.h".
12180 (Layout::Layout): Initialize new fields.
12181 (line_only_debug_sections): New static array.
12182 (is_lines_only_debug_sections): New static inline function.
12183 (Layout::include_section): Handle --strip-debug-non-line.
12184 (Layout::make_output_section): If --strip-debug-non-line, build
12185 new output sections for .debug_abbrev and .debug_info.
12186 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12187 gold. Warn about possible overflow.
12188 (read_signed_LEB_128): Likewise.
12189 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12190 (read_signed_LEB_128): Declare.
12191 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12192 (HFILES): Add reduced_debug_output.h.
12193 * Makefile.in: Rebuild.
12194
7d9e3d98
ILT
121952008-05-21 Ian Lance Taylor <iant@google.com>
12196
12197 * mapfile.cc: New file.
12198 * mapfile.h: New file.
12199 * options.h (class General_options): Add -M/--print-map and -Map.
12200 * options.cc (General_options::finalize): Make -M equivalent to
12201 -Map -.
12202 * main.cc: Include <cstdio> and "mapfile.h".
12203 (main): Open mapfile if requested.
12204 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12205 constructor. Change caller.
12206 (queue_initial_tasks): Add mapfile parameter. Change caller.
12207 (queue_middle_tasks): Likewise.
12208 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12209 declarations.
12210 * archive.cc: Include "mapfile.h".
12211 (Archive::add_symbols): Add mapfile parameter. Change all
12212 callers. Pass mapfile, symbol, and reason to include_member.
12213 (Archive::include_all_members): Add mapfile parameter. Change all
12214 callers.
12215 (Archive::include_member): Add mapfile, sym, and why parameters.
12216 Change all callers. Report inclusion to map file.
12217 * archive.h: Include "fileread.h".
12218 (class Archive): Update declarations.
12219 (Archive::file): New const method.
12220 (class Add_archive_symbols): Add mapfile_ field. Update
12221 constructor. Change all callers.
12222 * readsyms.h (class Read_symbols): Likewise.
12223 (class Finish_group): Likewise.
12224 (class Read_script): Likewise.
12225 * common.cc: Include "mapfile.h".
12226 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12227 all callers.
12228 (Symbol_table::do_allocate_commons): Likewise.
12229 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12230 symbol allocation to mapfile.
12231 * common.h (class Allocate_commons_task): Add mapfile_ field.
12232 Update constructor. Change all callers.
12233 * symtab.h (class Symbol_table): Update declarations.
12234 * layout.cc: Include "mapfile.h".
12235 (Layout_task_runner::run): Print information to mapfile.
12236 (Layout::create_gold_note): Change Output_data_fixed_space to
12237 Output_data_zero_fill.
12238 (Layout::create_build_id): Likewise.
12239 (Layout::print_to_mapfile): New function.
12240 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12241 constructor. Change caller.
12242 (class Layout): Declare print_to_mapfile.
12243 * output.cc (Output_section::Input_section::print_to_mapfile): New
12244 function.
12245 (Output_section::add_input_section): If producing a map, always
12246 add to input_sections_ list.
12247 (Output_section::do_print_to_mapfile): New function.
12248 (Output_segment::print_sections_to_mapfile): New function.
12249 (Output_segment::print_section_list_to_mapfile): New function.
12250 * output.h: Include "mapfile.h".
12251 (Output_data::print_to_mapfile): New function.
12252 (Output_data::do_print_to_mapfile): New virtual function.
12253 (Output_segment_headers::do_print_to_mapfile): New function.
12254 (Output_file_header::do_print_to_mapfile): New function.
12255 (Output_data_const::do_print_to_mapfile): New function.
12256 (class Output_data_const_buffer): Add map_name_ field. Update
12257 constructor. Change all callers. Add do_print_to_mapfile
12258 function.
12259 (class Output_data_fixed_space): Likewise.
12260 (class Output_data_space): Likewise.
12261 (class Output_data_zero_fill): New class.
12262 (Output_data_strtab::do_print_to_mapfile): New function.
12263 (Output_data_reloc_base::do_print_to_mapfile): New function.
12264 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12265 (Output_data_group::do_print_to_mapfile): New function.
12266 (Output_data_got::do_print_to_mapfile): New function.
12267 (Output_data_dynamic::do_print_to_mapfile): New function.
12268 (Output_symtab_xindex::do_print_to_mapfile): New function.
12269 (class Output_section): Declare do_print_to_mapflie. Declare
12270 print_to_mapfile in Input_section.
12271 (class Output_segment): Declare new functions.
12272 * object.h (Sized_relobj::symbol_count): New function.
12273 * script-sections.cc
12274 (Output_section_element_dot_assignment::set_section_addresses):
12275 Change Output_data_fixed_space to Output_data_zero_fill.
12276 (Output_data_expression::do_print_to_mapfile): New function.
12277 * script.cc (read_input_script): Add mapfile parameter. Change
12278 all callers.
12279 * script.h (read_input_script): Update declaration.
12280 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12281 (Eh_frame::do_print_to_mapfile): New function.
12282 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12283 (Output_merge_string::do_print_to_mapfile): New function.
12284 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12285 function.
12286 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12287 function.
12288 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12289 function.
12290 * Makefile.am (CCFILES): Add mapfile.cc.
12291 (HFILES): Add mapfile.h.
12292 * Makefile.in: Rebuild.
12293
9f1d377b
ILT
122942008-05-19 Ian Lance Taylor <iant@google.com>
12295
12296 * options.h (class General_options): Add -z relro.
12297 * layout.cc (Layout::Layout): Initialize relro_segment_.
12298 (Layout::add_output_section_data): Return the output section.
12299 (Layout::make_output_section): Rcognize relro sections and mark
12300 them appropriately.
12301 (Layout::attach_allocated_section_to_segment): Put relro sections
12302 in a PT_GNU_RELRO segment.
12303 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12304 section as relro.
12305 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12306 PT_TLS segments.
12307 (Layout::linkonce_mapping): Map d.rel.ro.local to
12308 .data.rel.ro.local.
12309 (Layout::output_section_name): Us .data.rel.ro.local for any
12310 section which begins with that.
12311 * layout.h (class Layout): Update add_output_section_data
12312 declaration. Add relro_segment_ field.
12313 * output.cc (Output_section::Output_section): Initialize is_relro_
12314 and is_relro_local_ fields.
12315 (Output_segment::add_output_section): Group relro sections.
12316 (Output_segment::is_first_section_relro): New function.
12317 (Output_segment::maximum_alignment): If there is a relro section,
12318 align the segment to the common page size.
12319 (Output_segment::set_section_addresses): Track whether we are
12320 looking at relro sections. If the last section is a relro
12321 section, align to the common page size.
12322 (Output_segment::set_section_list_addresses): Add in_relro
12323 parameter. Change all callers. Align to the page size when
12324 moving from relro to non-relro section.
12325 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12326 segment.
12327 * output.h (class Output_section): Add is_relro_ and
12328 is_relro_local_ fields.
12329 (Output_section::is_relro): New function.
12330 (Output_section::set_is_relro): New function.
12331 (Output_section::is_relro_local): New function.
12332 (Output_section::set_is_relro_local): New function.
12333 (class Output_segment): Update declarations.
12334 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12335 * sparc.cc (Target_sparc::got_section): Likewise.
12336 * x86_64.cc (Target_x86_64::got_section): Likewise.
12337 * testsuite/relro_test_main.cc: New file.
12338 * testsuite/relro_test.cc: New file.
12339 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12340 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12341 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12342 (relro_test.so, relro_test_pic.o): New targets.
12343 * testsuite/Makefile.in: Rebuild.
12344
a984ee1d
ILT
123452008-05-16 Ian Lance Taylor <iant@google.com>
12346
01676dcd
ILT
12347 * output.cc (Output_segment::add_output_section): Remove front
12348 parameter.
12349 * output.h (class Output_segment): Remove
12350 add_initial_output_section and overloaded add_output_section.
12351 Update declaration of remaining add_output_section.
12352 * layout.cc (Layout::create_interp): Call add_output_section
12353 rather than add_initial_output_section.
12354 (Layout::finish_dynamic_section): Likewise.
12355
497897f9
ILT
12356 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12357 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12358 know the dynamic type.
12359 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12360 field. Initialize it in constructor.
12361 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12362 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12363 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12364 reloc.
12365
a984ee1d
ILT
12366 * output.cc (Output_reloc::get_address): Change return type to
12367 Elf_Addr.
12368 * output.h (class Output_reloc): Update get_address declaration.
12369 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12370 for section addresses.
12371
55ba0940
ILT
123722008-05-09 Ian Lance Taylor <iant@google.com>
12373
12374 PR 6493
12375 * gold.cc (gold_nomem): Use return value of write.
12376
75517b77
ILT
123772008-05-08 Ian Lance Taylor <iant@google.com>
12378
12379 * symtab.c (Symbol::init_base_output_data): Add version
12380 parameter. Change all callers.
12381 (Symbol::init_base_output_segment): Likewise.
12382 (Symbol::init_base_constant): Likewise.
12383 (Symbol::init_base_undefined): Likewise.
12384 (Sized_symbol::init_output_data): Likewise.
12385 (Sized_symbol::init_output_segment): Likewise.
12386 (Sized_symbol::init_constant): Likewise.
12387 (Sized_symbol::init_undefined): Likewise.
12388 (Symbol_table::do_define_in_output_data): If the new symbol has a
12389 version, mark it as the default.
12390 (Symbol_table::do_define_in_output_segment): Likewise.
12391 (Symbol_table::do_define_as_constant): Likewise.
12392 * symtab.h (class Symbol): Update declarations.
12393 (class Sized_symbol): Likewise.
12394 * resolve.cc (Symbol::override_version): New function.
c42e122e 12395 (Symbol::override_base): Call override_version.
75517b77
ILT
12396 (Symbol::override_base_with_special): Likewise.
12397 * testsuite/ver_script_8.script: New file.
12398 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12399 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12400 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12401 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12402
f1f70eae
ILT
124032008-05-06 Ian Lance Taylor <iant@google.com>
12404
f3e9c5c5
ILT
12405 PR 6049
12406 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12407 functions.
12408 (class General_options): Remove existing --undefined, and add
12409 --no-undefined instead. Add new --undefined as synonym for -u.
12410 * archive.cc (Archive::add_symbols): Check whether symbol was
12411 named with -u.
12412 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12413 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12414 all uses. Add IS_UNDEFINED. Update declarations to split
12415 different versions of init_base. Declare init_base_undefined.
12416 (Symbol::is_defined): Handle IS_UNDEFINED.
12417 (Symbol::is_undefined): Likewise.
12418 (Symbol::is_weak_undefined): Call is_undefined.
12419 (Symbol::is_absolute): Handle IS_CONSTANT.
12420 (class Sized_symbol): Update declarations to split different
12421 versions of init. Declare init_undefined.
12422 (class Symbol_table): Declare new functions.
12423 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12424 Change all callers.
12425 (Symbol::init_base_output_data): Likewise.
12426 (Symbol::init_base_output_segment): Likewise.
12427 (Symbol::init_base_constant): Likewise.
12428 (Symbol::init_base_undefined): New function.
12429 (Sized_symbol::init_object): Rename from init. Change all
12430 callers.
12431 (Sized_symbol::init_output_data): Likewise.
12432 (Sized_symbol::init_output_segment): Likewise.
12433 (Sized_symbol::init_constant): Likewise.
12434 (Sized_symbol::init_undefined): New function.
12435 (Symbol_table::add_undefined_symbols_from_command_line): New
12436 function.
12437 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12438 function.
12439 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12440 (Symbol::output_section): Likewise.
12441 (Symbol::set_output_section): Likewise.
12442 (Symbol_table::sized_finalize_symbol): Likewise.
12443 (Symbol_table::sized_write_globals): Likewise.
12444 * resolve.cc (Symbol_table::should_override): Likewise.
12445 (Symbol::override_base_with_special): Likewise.
12446
8bdcdf2c
ILT
12447 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12448 symbol, change it to have default visibility.
12449 * testsuite/protected_1.cc: New file.
12450 * testsuite/protected_2.cc: New file.
12451 * testsuite/protected_3.cc: New file.
12452 * testsuite/protected_main_1.cc: New file.
12453 * testsuite/protected_main_2.cc: New file.
12454 * testsuite/protected_main_3.cc: New file.
12455 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12456 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12457 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12458 (protected_1.so): New target.
12459 (protected_1_pic.o, protected_2_pic.o): New targets.
12460 (protected_3_pic.o): New target.
12461 (check_PROGRAMS): Add protected_2.
12462 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12463 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12464 * testsuite/Makefile.in: Rebuild.
12465
2b706932
ILT
12466 * options.h (DEFINE_var): Add set_user_set_##varname__.
12467 (DEFINE_bool_alias): New macro.
12468 (class General_options): Define -Bstatic using DEFINE_bool_alias
12469 rather than DEFINE_special. Add --undefined as an alias for -z
12470 defs.
12471 * options.cc (General_options::parse_Bstatic): Remove.
12472
d82a5bcc
ILT
12473 * options.h (class General_options): Add --fatal-warnings.
12474 * main.cc (main): Implement --fatal-warnings.
12475 * errors.h (Errors::warning_count): New function.
12476
f1f70eae
ILT
12477 * options.h (class General_options): Add -Bsymbolic-functions.
12478 * symtab.h (Symbol::is_preemptible): Check for
12479 -Bsymbolic-functions.
12480
8825ac63
ILT
124812008-05-05 Ian Lance Taylor <iant@google.com>
12482
d98bc257
ILT
12483 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12484 as noVARNAME rather than no-VARNAME.
12485 (class General_options): Add option -z combreloc.
12486 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12487 get_address.
12488 (Output_reloc::sort_before) [SHT_REL]: New function.
12489 (Output_reloc::sort_before) [SHT_RELA]: New function.
12490 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12491 Sort_relocs_comparison.
12492 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12493 parameter. Change all callers.
12494 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12495 sort_relocs parameter. Change all callers.
12496 * output.cc (Output_reloc::get_address): New function, broken out
12497 of write_rel.
12498 (Output_reloc::write_rel): Call it.
12499 (Output_reloc::compare): New function.
12500 (Output_data_reloc_base::do_write): Optionally sort relocs.
12501
60b2b4e7
ILT
12502 * configure.ac: If targ_extra_obj is set, link it in.
12503 * configure.tgt: Initialize all variables.
12504 (x86_64*): Set targ_extra_obj and targ_extra_size.
12505 * configure: Rebuild.
12506
8825ac63
ILT
12507 * object.cc (Sized_relobj::include_section_group): Adjust section
12508 indexes read from group data. Build vector to pass to
12509 layout_group.
12510 * layout.cc (Layout::layout_group): Add flags and shndxes
12511 parameters. Remove contents parameter. Change caller. Update
12512 explicit instantiations.
12513 * layout.h (class Layout): Update layout_group declaration.
12514 * output.cc (Output_data_group::Output_data_group): Add flags and
12515 input_shndxes parameters. Remove contents parameter. Change
12516 caller.
12517 (Output_data_group::do_write): Change input_sections_ to
12518 input_shndxes_.
12519 * output.h (class Output_data_group): Update constructor
12520 declaration. Rename input_sections_ to input_shndxes_.
12521 * testsuite/many_sections_test.cc: Add template.
12522
e94cf127
CC
125232008-04-30 Cary Coutant <ccoutant@google.com>
12524
4418b2d5
CC
12525 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12526
e94cf127
CC
12527 * layout.cc (Layout::include_section): Refactored check for debug
12528 info section.
12529 (Layout::add_comdat): Add new parameters. Change type
12530 of signature parameter. Add object and shndx to signatures table.
12531 (Layout::find_kept_object): New function.
12532 * layout.h: Include <cstring>.
12533 (Layout::is_debug_info_section): New function.
12534 (Layout::add_comdat): Add new parameters.
12535 (Layout::find_kept_object): New function.
12536 (Layout::Kept_section): New struct.
12537 (Layout::Signatures): Change type of map range.
12538 * object.cc (Relobj::output_section_address): New function.
12539 (Sized_relobj::include_section_group): Add new parameters. Change
12540 calls to Layout::add_comdat. Change to build table of kept comdat
12541 groups and table mapping discarded sections to kept sections.
12542 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12543 (Sized_relobj::do_layout): Change calls to include_section_group and
12544 include_linkonce_section.
12545 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12546 value to zero when section is discarded.
12547 (Sized_relobj::map_to_kept_section): New function.
12548 * object.h (Relobj::output_section_address): New function.
12549 (Relobj::Comdat_group): New type.
12550 (Relobj::find_comdat_group): New function.
12551 (Relobj::Comdat_group_table): New type.
12552 (Relobj::Kept_comdat_section): New type.
12553 (Relobj::Kept_comdat_section_table): New type.
12554 (Relobj::add_comdat_group): New function.
12555 (Relobj::set_kept_comdat_section): New function.
12556 (Relobj::get_kept_comdat_section): New function.
12557 (Relobj::comdat_groups_): New field.
12558 (Relobj::kept_comdat_sections_): New field.
12559 (Symbol_value::input_value): Update comment.
12560 (Sized_relobj::map_to_kept_section) New function.
12561 (Sized_relobj::include_linkonce_section): Add new parameter.
12562 * target-reloc.h (Comdat_behavior): New type.
12563 (get_comdat_behavior): New function.
12564 (relocate_section): Add code to map a discarded section to the
12565 corresponding kept section when applying a relocation.
12566
e4e5049b
CS
125672008-04-30 Craig Silverstein <csilvers@google.com>
12568
12569 * dwarf_reader.cc (next_generation_count): New static var.
12570 (Addr2line_cache_entry): New struct.
12571 (addr2line_cache): New static var.
12572 (Dwarf_line_info::one_addr2line): Added caching.
12573 (Dwarf_line_info::clear_addr2line_cache): New function.
12574 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12575 cache-size parameter.
12576 (Dwarf_line_info::one_addr2line_cache): New function.
12577 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12578 new cache-size argument to one_addr2line(), and clear cache.
12579
d09e9154
CC
125802008-04-28 Cary Coutant <ccoutant@google.com>
12581
12582 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12583 R_386_PC8 relocations.
12584
7ef73768
ILT
125852008-04-23 Ian Lance Taylor <iant@google.com>
12586
55438702
ILT
12587 * object.cc (Sized_relobj::include_section_group): Check for
12588 invalid section group.
12589
c165fb93
ILT
12590 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12591 header size.
12592
7ef73768
ILT
12593 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12594 than read for file header.
12595 * archive.cc (Archive::include_member): Likewise.
12596
6194aaab
L
125972008-04-23 Paolo Bonzini <bonzini@gnu.org>
12598
12599 * aclocal.m4: Regenerate.
12600 * configure: Regenerate.
12601
d491d34e
ILT
126022008-04-19 Ian Lance Taylor <iant@google.com>
12603
5ea2bac6
ILT
12604 * version.cc (version_string): Bump to 1.6.
12605
7bc3e21a
ILT
12606 * testsuite/Makefile.am (many_sections_r_test): New target.
12607 (many_sections_r_test_SOURCES): Remove.
12608 (many_sections_r_test_DEPENDENCIES): Remove.
12609 (many_sections_r_test_LDFLAGS): Remove.
12610 (many_sections_r_test_LDADD): Remove.
12611
7fcd3aa9
ILT
12612 * object.cc (Sized_relobj::do_add_symbols): Always pass
12613 local_symbol_count_ to add_from_relobj.
12614
4c94d6ae
ILT
12615 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12616 every thousand variables.
12617 * testsuite/Makefile.in: Rebuild.
12618
d491d34e
ILT
12619 * object.cc (Xindex::initialize_symtab_xindex): New function.
12620 (Xindex::read_symtab_xindex): New function.
12621 (Xindex::sym_xindex_to_shndx): New function.
12622 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12623 available.
12624 (Sized_relobj::do_initialize_xindex): New function.
12625 (Sized_relobj::do_read_symbols): Adjust section links.
12626 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12627 parameter. Change all callers.
12628 (Sized_relobj::include_section_group): Adjust section links and
12629 symbol section indexes.
12630 (Sized_relobj::do_layout): Adjust section links.
12631 (Sized_relobj::do_count_local_symbols): Adjust section links and
12632 symbol section indexes.
12633 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12634 ordinary and special symbols.
12635 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12636 dynsym_xindex parameters. Change all callers. Adjust section
12637 links. Use SHN_XINDEX when needed.
12638 (Sized_relobj::get_symbol_location_info): Adjust section links.
12639 Don't get fooled by special symbols.
12640 * object.h (class Xindex): Define.
12641 (class Object): Add xindex_ parameter. Declare virtual functoin
12642 do_initialize_xindex.
12643 (Object::adjust_sym_shndx): New function.
12644 (Object::set_xindex): New protected function.
12645 (class Symbol_value): Add is_ordinary_shndx_ field.
12646 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12647 (Symbol_value::value): Assert ordinary section.
12648 (Symbol_value::initialize_input_to_output_map): Likewise.
12649 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12650 Change all callers.
12651 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12652 all callers.
12653 (class Sized_relobj): Update declarations.
12654 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12655 parameter. Change all callers.
12656 (Sized_relobj::adjust_shndx): New function.
12657 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12658 field.
12659 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12660 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12661 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12662 (Sized_dynobj::read_dynsym_section): Adjust section links.
12663 (Sized_dynobj::read_dynamic): Likewise.
12664 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12665 section links.
12666 (Sized_dynobj::do_initialize_xindex): New function.
12667 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12668 do_initialize_xindex.
12669 (Sized_dynobj::adjust_shndx): New function.
12670 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12671 dynsym_xindex_ fields.
12672 (Layout::finalize): Add a call to set_section_indexes before
12673 creating the symtab sections.
12674 (Layout::set_section_indexes): Don't do anything if the section
12675 already has a section index.
12676 (Layout::create_symtab_sections): Add shnum parameter. Change
12677 caller. Create .symtab_shndx section if needed.
12678 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12679 caller.
12680 (Layout::allocated_output_section_count): New function.
12681 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12682 needed.
12683 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12684 fields. Update declarations.
12685 (Layout::symtab_xindex): New function.
12686 (Layout::dynsym_xindex): New function.
12687 (class Write_symbols_task): Add layout_ field.
12688 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12689 Change caller.
12690 * output.cc (Output_section_headers::Output_section_headers): Add
12691 shstrtab_section parameter. Change all callers.
12692 (Output_section_headers::do_sized_write): Store overflow values
12693 for section count and section string table section index in
12694 section header zero.
12695 (Output_file_header::do_sized_write): Check for overflow of
12696 section count and section string table section index.
12697 (Output_symtab_xindex::do_write): New function.
12698 (Output_symtab_xindex::endian_do_write): New function.
12699 * output.h (class Output_section_headers): Add shstrtab_section_.
12700 Update declarations.
12701 (class Output_symtab_xindex): Define.
12702 (Output_section::has_out_shndx): New function.
12703 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12704 field.
12705 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12706 Change all callers.
12707 (Sized_symbol::init): Likewise.
12708 (Symbol::output_section): Check for ordinary symbol.
12709 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12710 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12711 callers.
12712 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12713 Change all callers. Simplify handling of symbols from sections
12714 not included in the link.
12715 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12716 distinction.
12717 (Weak_alias_sorter::operator()): Assert that symbols are
12718 ordinary.
12719 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12720 distinction.
12721 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12722 parameters. Change all callers.
12723 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12724 symbol distinction. Use SHN_XINDEX when needed.
12725 (Symbol_table::write_section_symbol): Add symtab_xindex
12726 parameter. Change all callers.
12727 (Symbol_table::sized_write_section_symbol): Likewise. Use
12728 SHN_XINDEX when needed.
12729 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12730 declarations.
12731 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12732 (Symbol::is_defined): Check is_ordinary.
12733 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12734 (Symbol::is_absolute, Symbol::is_common): Likewise.
12735 (class Sized_symbol): Update declarations.
12736 (class Symbol_table): Update declarations.
12737 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12738 parameters. Change all callers.
12739 (Sized_symbol::override): Likewise.
12740 (Symbol_table::override): Likewise.
12741 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12742 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12743 is_ordinary, and orig_st_shndx parameters. Change all callers.
12744 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12745 to be in an ordinary section.
12746 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12747 object and is_ordinary parameters. Change all callers.
12748 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12749 Change all callers. Don't add undefined or non-ordinary symbols
12750 to reloc_map_.
12751 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12752 Change all callers.
12753 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12754 declarations.
12755 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12756 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12757 (Sized_relobj::relocate_sections): Likewise.
12758 * target-reloc.h (scan_relocs): Adjust section symbol index.
12759 (scan_relocatable_relocs): Likewise.
12760 * i386.cc (Scan::local): Check for ordinary symbols.
12761 * sparc.cc (Scan::local): Likewise.
12762 * x86_64.cc (Scan::local): Likewise.
12763 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12764 to symbol_section_and_value.
12765 * testsuite/many_sections_test.cc: New file.
12766 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12767 (check_PROGRAMS): Add many_sections_test.
12768 (many_sections_test_SOURCES): Define.
12769 (many_sections_test_DEPENDENCIES): Define.
12770 (many_sections_test_LDFLAGS): Define.
12771 (BUILT_SOURCES): Add many_sections_define.h.
12772 (many_sections_define.h): New target.
12773 (BUILT_SOURCES): Add many_sections_check.h.
12774 (many_sections_check.h): New target.
12775 (check_PROGRAMS): Add many_sections_r_test.
12776 (many_sections_r_test_SOURCES): Define.
12777 (many_sections_r_test_DEPENDENCIES): Define.
12778 (many_sections_r_test_LDFLAGS): Define.
12779 (many_sections_r_test_LDADD): Define.
12780 (many_sections_r_test.o): New target.
12781 * testsuite/Makefile.in: Rebuild.
12782
c5818ff1
CC
127832008-04-17 Cary Coutant <ccoutant@google.com>
12784
12785 * errors.cc (Errors::info): New function.
12786 (gold_info): New function.
12787 * errors.h (Errors::info): New function.
12788 * gold.h (gold_info): New function.
12789 * object.cc (Input_objects::add_object): Print trace output.
12790 * options.cc (options::parse_set): New function.
12791 (General_options::parse_wrap): Deleted.
12792 (General_options::General_options): Deleted initializer.
12793 * options.h (options::String_set): New typedef.
12794 (options::parse_set): New function.
12795 (DEFINE_set): New macro.
12796 (General_options::wrap): Changed to use DEFINE_set. Changed
12797 callers of any_wrap_symbols and is_wrap_symbol.
12798 (General_options::trace, General_options::trace_symbol):
12799 New options.
12800 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12801 (General_options::wrap_symbols_): Deleted.
12802 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12803
b5be4a7c
DM
128042008-04-17 David S. Miller <davem@davemloft.net>
12805
12806 * options.cc (General_options::parse_V): New function.
12807 * options.h: Add entries for -V and -Qy.
12808
155a0dd7
ILT
128092008-04-17 Ian Lance Taylor <iant@google.com>
12810
12811 * common.cc (Symbol_table::allocate_commons): Remove options
12812 parameter. Change caller.
12813 (Symbol_table::do_allocate_commons): Remove options parameter.
12814 Change caller. Just call do_allocate_commons_list twice.
12815 (Symbol_table::do_allocate_commons_list): New function, broken out
12816 of do_allocate_commons.
12817 * common.h (class Allocate_commons_task): Remove options_ field.
12818 Update constructor.
12819 * symtab.cc (Symbol_table::Symbol_table): Initialize
12820 tls_commons_.
12821 (Symbol_table::add_from_object): Put TLS common symbols on
12822 tls_commons_ list.
12823 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12824 which are IN_OUTPUT_DATA.
12825 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12826 allocate_commons and do_allocate_commons declarations. Declare
12827 do_allocate_commons_list.
12828 * gold.cc (queue_middle_tasks): Update creation of
12829 Allocate_commons_task to not pass options.
12830 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12831 (TLS_TEST_C_FLAGS): New variable.
12832 (tls_test_c_pic.o): New target.
12833 (tls_test_shared.so): Link in tls_test_c_pic.o.
12834 (tls_test_c_pic_ie.o): New target.
12835 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12836 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12837 (tls_test_c.o): New target.
12838 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12839 (tls_pic_test_LDADD): Likewise.
12840 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12841 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12842 (tls_test_c_gnu2.o): New target.
12843 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12844 tls_test_c_gnu2.o.
12845 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12846 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12847 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12848 * testsuite/tls_test.cc: Include "config.h".
12849 (t_last): Call t11_last.
12850 * testsuite/tls_test.h (t11, t11_last): Declare.
12851 * testsuite/tls_test_c.c: New file.
12852 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12853 * configure.ac: Check for OpenMP support.
12854 * configure, config.in, Makefile.in: Rebuild.
12855 * testsuite/Makefile.in: Rebuild.
12856
edfbb029
CC
128572008-04-16 Cary Coutant <ccoutant@google.com>
12858
12859 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12860 (Target_i386::tls_base_symbol_defined_): New field.
12861 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12862 (Target_i386::Scan::global): Likewise.
12863 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12864 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12865 (Target_x86_64::tls_base_symbol_defined_): New field.
12866 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12867 (Target_x86_64::Scan::global): Likewise.
12868
f3c69fca
CC
128692008-04-16 Cary Coutant <ccoutant@google.com>
12870
12871 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12872 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12873 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12874 building shared libraries.
12875 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12876 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12877 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12878 * testsuite/Makefile.in: Rebuild.
12879 * testsuite/weak_undef.h: New file.
12880 * testsuite/weak_undef_file1.cc: Add extra test cases.
12881 * testsuite/weak_undef_file2.cc: Likewise.
12882 * testsuite/weak_undef_test.cc: Likewise.
12883
7c414435
DM
128842008-04-16 David S. Miller <davem@davemloft.net>
12885
32b769e1
DM
12886 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12887 Add issued_non_pic_error_ field. Declare check_non_pic.
12888 (Target_sparc::Scan::check_non_pic): New function.
12889 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12890 (Target_sparc::Scan::global): Likewise.
12891
11936fb1
DM
12892 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12893 * configure: Rebuild.
12894
7c414435
DM
12895 * options.h (DEFINE_enable): New macro.
12896 (new_dtags): New enable option.
12897 (initfirst, interpose, loadfltr, nodefaultlib,
12898 nodelete, nodlopen, nodump): New -z options.
12899 * layout.cc (Layout:finish_dynamic_section): If new
12900 dtags enabled, emit DT_RUNPATH. Also, emit a
12901 DT_FLAGS_1 containing any specified -z flags.
12902
85c7bf8b
ILT
129032008-04-16 Ian Lance Taylor <iant@google.com>
12904
12c0daef
ILT
12905 * copy-relocs.cc: New file.
12906 * copy-relocs.h: New file.
12907 * reloc.cc: Remove Copy_relocs code.
12908 * reloc.h: Likewise.
12909 * reloc-types.h (struct Reloc_types) [both versions]: Add
12910 get_reloc_addend_noerror.
12911 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12912 variants of add_global which take an addend which must be zero.
12913 * i386.cc: Include "copy-relocs.h".
12914 (class Target_i386): Change type of copy_relocs_ to variable,
12915 update initializer.
12916 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12917 Change all callers.
12918 (Target_i386::do_finalize_sections): Change handling of
12919 copy_relocs_.
12920 * sparc.cc: Include "copy-relocs.h".
12921 (class Target_sparc): Change type of copy_relocs_ to variable,
12922 update initializer.
12923 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12924 Change all callers.
12925 (Target_sparc::do_finalize_sections): Change handling of
12926 copy_relocs_.
12927 * x86_64.cc: Include "copy-relocs.h".
12928 (class Target_x86_64): Change type of copy_relocs_ to variable,
12929 update initializer.
12930 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12931 class. Change all callers.
12932 (Target_x86_64::do_finalize_sections): Change handling of
12933 copy_relocs_.
12934 * Makefile.am (CCFILES): Add copy-relocs.cc.
12935 (HFILES): Add copy-relocs.h.
12936
4f4995b6
ILT
12937 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12938
85c7bf8b
ILT
12939 * testsuite/script_test_4.sh: Permit leading zeroes.
12940
4f2a9edd
ILT
129412008-04-15 Ian Lance Taylor <iant@google.com>
12942
e6188289
ILT
12943 * script-sections.cc (Script_sections::create_segments): Use
12944 header_size_adjustment even when there is enough room for the
12945 headers.
12946 * testsuite/script_test_4.sh: New file.
12947 * testsuite/script_test_4.t: New file.
12948 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12949 (check_DATA): Add script_test_4.stdout.
12950 (MOSTLYCLEANFILES): Likewise.
12951 (script_test_4): New target.
12952 (script_test_4.stdout): New target.
12953 * testsuite/Makefile.in: Rebuild.
12954
4f2a9edd
ILT
12955 * sparc.cc: Add definitions for Output_data_plt_sparc class
12956 constants.
12957
f5314dd5
DM
129582008-04-14 David S. Miller <davem@davemloft.net>
12959
12960 * sparc.cc: New file.
12961 * Makefile.am (TARGETSOURCES): Add sparc.cc
12962 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12963 * configure.tgt: Document targ_extra_size and
12964 targ_extra_big_endian. Add entries for sparc-* and
12965 sparc64-*.
12966 * configure.ac: Handle targ_extra_size and
12967 targ_extra_big_endian.
12968 * Makefile.in: Rebuild.
12969 * configure: Likewise.
12970 * po/POTFILES.in: Likewise.
12971 * po/gold.pot: Likewise.
12972
154e0e9a
ILT
129732008-04-14 Ian Lance Taylor <iant@google.com>
12974
12975 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12976 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12977 in the name/type/flags to section mapping. Don't call
12978 allocate_output_section.
12979 (Layout::choose_output_section): Change parameter from adjust_name
12980 to is_input_section. Don't permit input sections after sections
12981 are attached to segments. Don't call allocate_output_section.
12982 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12983 not write_enable_output_section.
12984 (Layout::make_output_section): Don't push to
12985 unattached_section_list_ nor call attach_to_segment. Call
12986 attach_section_to_segment if sections are attached.
12987 (Layout::attach_sections_to_segments): New function.
12988 (Layout::attach_section_to_segment): New function.
12989 (Layout::attach_allocated_section_to_segment): Rename from
12990 attach_to_segment. Remove flags parameter.
12991 (Layout::allocate_output_section): Remove function.
12992 (Layout::write_enable_output_section): Remove function.
12993 * layout.h (class Layout): Update for above changes. Add new
12994 field sections_are_attached_.
12995 * output.h (Output_section::update_flags_for_input_section): New
12996 function.
12997 * output.cc (Output_section::add_input_section): Call
12998 update_flags_for_input_section.
12999 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13000
009a67a2
CC
130012008-04-11 Cary Coutant <ccoutant@google.com>
13002
13003 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13004 thought unnecessary.
13005 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13006
759b1a24
ILT
130072008-04-11 Ian Lance Taylor <iant@google.com>
13008
13009 * output.h (class Output_section_data): Remove inline definition
13010 of set_addralign.
13011 * output.cc (Output_section_data::set_addralign): New function.
13012
c2b45e22
CC
130132008-04-11 Cary Coutant <ccoutant@google.com>
13014
13015 Add support for TLS descriptors for i386 and x86_64.
13016 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13017 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13018 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13019 GOT_TYPE_TLS_DESC.
13020 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13021 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13022 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13023 relocations.
13024 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13025 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13026 Fix problem with initial-exec relocations.
13027 (Target_i386::Relocate::relocate_tls): Likewise.
13028 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13029 relaxation.
13030 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13031 support for section-plus-offset dynamic table entries.
13032 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13033 (Output_data_dynamic::Dynamic_entry): Add support for
13034 section-plus-offset dynamic table entries.
13035 (Output_data_dynamic::Classification): Likewise.
13036 (Output_data_dynamic::classification_): Renamed offset_.
13037 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13038 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13039 (Target_x86_64::make_plt_section): New function.
13040 (Target_x86_64::reserve_tlsdesc_entries): New function.
13041 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13042 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13043 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13044 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13045 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13046 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13047 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13048 add extra PLT entry for TLS descriptors.
13049 (Output_data_plt_x86_64::got_): New field.
13050 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13051 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13052 fields.
13053 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13054 descriptors.
13055 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13056 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13057 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13058 R_386_TLS_DESC_CALL relocations.
13059 (Target_x86_64::Scan::global): Likewise.
13060 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13061 for TLS descriptors.
13062 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13063 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13064 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13065 GD-to-IE relaxation.
13066 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13067 and TLS_DESCRIPTORS.
13068 * Makefile.in: Rebuild.
13069 * configure: Rebuild.
13070 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13071 (tls_test_shared2.so): New target.
13072 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13073 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13074 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13075 (tls_shared_gd_to_ie_test_LDADD): New variable.
13076 (tls_shared_gnu2_gd_to_ie_test): New target.
13077 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13078 New targets.
13079 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13080 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13081 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13082 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13083 (tls_shared_gnu2_test): New target.
13084 (tls_test_gnu2_shared.so): New target.
13085 (tls_shared_gnu2_test_SOURCES): New variable.
13086 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13087 (tls_shared_gnu2_test_LDFLAGS): New variable.
13088 (tls_shared_gnu2_test_LDADD): New variable.
13089 * testsuite/Makefile.in: Rebuild.
13090 * testsuite/Makefile.
13091
83bfb6b7
ILT
130922008-04-11 Ian Lance Taylor <iant@google.com>
13093
13094 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13095 justsyms.t.
13096 * testsuite/Makefile.in: Rebuild.
13097
13098 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13099 long.
13100 * testsuite/script_test_2.cc (main): Adjust test.
13101
706e1f5e
ILT
131022008-04-11 David S. Miller <davem@davemloft.net>
13103 Ian Lance Taylor <iant@google.com>
13104
13105 * options.h (General_options): Add entries for '-Y' and
13106 '-relax'.
13107 * options.cc (General_options:finalize): If -Y was used, add those
13108 entries to the library path instead of the default "/lib" and
13109 "/usr/lib".
13110
7c98e6bb
DM
131112008-04-11 David S. Miller <davem@davemloft.net>
13112
13113 * testsuite/justsyms.t: Start at 0x100.
13114 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
13115 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13116 long.
13117 * testsuite/script_test_2.cc: Adjust string and section length
13118 checks.
7c98e6bb 13119
99a37bfd
ILT
131202008-04-09 Ian Lance Taylor <iant@google.com>
13121
2cefc357
ILT
13122 PR gold/5996
13123 * script-sections.cc (Sections_element::allocate_to_segment): Add
13124 orphan parameter.
13125 (Output_section_definition::allocate_to_segment): Likewise.
13126 (Orphan_output_section::allocate_to_segment): Likewise.
13127 (Script_sections::attach_sections_using_phdrs_clause): Don't
13128 propagate non-PT_LOAD segments to orphan sections.
13129 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13130 readelf rather than objdump.
13131 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13132 .interp section and PT_INTERP segment are the same size.
13133 * testsuite/Makefile.in: Rebuild.
13134
99a37bfd
ILT
13135 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13136 aliases for symbols defined in the same object.
13137 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13138 (weak_alias_test_SOURCES): New variable.
13139 (weak_alias_test_DEPENDENCIES): New variable.
13140 (weak_alias_test_LDFLAGS): New variable.
13141 (weak_alias_test_LDADD): New variable.
13142 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13143 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13144 (weak_alias_test_3.o): New target.
13145 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13146 * testsuite/weak_alias_test_main.cc: New file.
13147 * testsuite/weak_alias_test_1.cc: New file.
13148 * testsuite/weak_alias_test_2.cc: New file.
13149 * testsuite/weak_alias_test_3.cc: New file.
13150
780e49c5
ILT
131512008-04-08 Ian Lance Taylor <iant@google.com>
13152
cdb0b8f5
ILT
13153 * options.h (class General_options): Add --noinhibit-exec option.
13154 * main.cc (main): Check --noinhibit-exec.
13155
0864d551
ILT
13156 * options.h (class General_options): Define --wrap as a special
13157 option. Add wrap_symbols_ field.
13158 (General_options::any_wrap_symbols): New function.
13159 (General_options::is_wrap_symbol): New function.
13160 * options.cc (General_options::parse_wrap): New function.
13161 (General_options::General_options): Initialize wrap_symbols_.
13162 * symtab.cc (Symbol_table::wrap_symbol): New function.
13163 (Symbol_table::add_from_object): Handle --wrap.
13164 * symtab.h (class Symbol_table): Declare wrap_symbol.
13165 * target.h (Target::wrap_char): New function.
13166 (Target::Target_info): Add wrap_char field.
13167 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13168 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13169 * testsuite/testfile.cc (Target_test::test_target_info):
13170 Likewise.
13171
789aa6de
ILT
13172 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13173 there is one.
13174
2c38906f
ILT
13175 * layout.h (class Layout): Add added_eh_frame_data_ field.
13176 * layout.cc (Layout::Layout): Initialize new field.
13177 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13178 output section until we find a section we merged successfully.
13179 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13180 that the size be non-zero.
13181
780e49c5
ILT
13182 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13183 qualifier.
13184
7fcd0256
ILT
131852008-04-08 Craig Silverstein <csilvers@google.com>
13186
13187 * configure.ac: Export new conditional variable HAVE_ZLIB.
13188 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13189 on HAVE_ZLIB.
13190 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13191 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13192
6835af53
ILT
131932008-04-07 Ian Lance Taylor <iant@google.com>
13194
e24f324c
ILT
13195 * version.cc (version_string): Set to "1.5".
13196
a036edd8
ILT
13197 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13198 Add issued_non_pic_error_ field. Declare check_non_pic.
13199 (Target_x86_64::Scan::check_non_pic): New function.
13200 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13201 (Target_x86_64::Scan::global): Likewise.
13202
624f8810
ILT
13203 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13204 addend parameter. Change caller. Handle merge sections.
13205 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13206 Address to Addend. Don't add in the result of
13207 local_section_offset, pass down the addend and use the returned
13208 value.
13209 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13210 Update declarations of local_section_offset and symbol_value.
13211 * testsuite/two_file_test_1.cc (t18): New function.
13212 * testsuite/two_file_test_2.cc (f18): New function.
13213 * testsuite/two_file_test_main.cc (main): Call t18.
13214 * testsuite/two_file_test.h (t18, f18): Declare.
13215
6835af53
ILT
13216 * configure.ac: Don't test for objdump, c++filt, or readelf.
13217 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13218 conditionals.
13219 (TEST_READELF): New variable.
13220 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13221 (check_PROGRAMS): Add two_file_strip_test.
13222 (two_file_strip_test): New target.
13223 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13224 (two_file_same_shared_strip_test_SOURCES): New variable.
13225 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13226 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13227 (two_file_same_shared_strip_test_LDADD): New variable.
13228 (two_file_shared_strip.so): New target.
13229 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13230 (ver_test_5.syms, ver_test_7.syms): Likewise.
13231 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13232 (strip_test_3.stdout): Use TEST_OBJDUMP.
13233 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13234
86925eef
CC
132352008-04-04 Cary Coutant <ccoutant@google.com>
13236
13237 * symtab.h (Symbol::is_weak_undefined): New function.
13238 (Symbol::is_strong_undefined): New function.
13239 (Symbol::is_absolute): New function.
13240 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13241 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13242 absolute symbols.
13243 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13244 (weak_undef_test): New target.
13245 * testsuite/Makefile.in: Rebuild.
13246 * testsuite/weak_undef_file1.cc: New file.
13247 * testsuite/weak_undef_file2.cc: New file.
13248 * testsuite/weak_undef_test.cc: New file.
13249
126f3ece
ILT
132502008-04-03 Craig Silverstein <csilvers@google.com>
13251
13252 * compressed_output.h (class Output_compressed_section): Use
13253 unsigned buffer.
13254 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13255 add zlib header.
13256 (zlib_compressed_suffix): Removed.
13257 (Output_compressed_section::set_final_data_size): Use unsigned
13258 buffers.
13259 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13260 Fix linker invocation.
13261 (flagstest_o_specialfile_and_compress_debug_sections):
13262 Likewise.
13263 * testsuite/Makefile.in: Regenerated.
13264
deae2a14
DM
132652008-04-02 David S. Miller <davem@davemloft.net>
13266
13267 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13268 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13269
70752818
ILT
132702008-04-02 Craig Silverstein <csilvers@google.com>
13271
13272 * TODO: New file.
13273
39d0cb0e
ILT
132742008-04-02 Ian Lance Taylor <iant@google.com>
13275
13276 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13277 parameters. Update for new key type to views_. Change all
13278 callers.
13279 (File_read::read): Adjust for byteshift in returned view.
13280 (File_read::add_view): New function, broken out of
13281 find_and_make_view.
13282 (File_read::make_view): New function, broken out of
13283 find_and_make_view.
13284 (File_read::find_or_make_view): Add offset and aligned
13285 parameters. Rewrite accordingly. Change all callers.
13286 (File_read::get_view): Add offset and aligned parameters. Adjust
13287 for byteshift in return value.
13288 (File_read::get_lasting_view): Likewise.
13289 * fileread.h (class File_read): Update declarations.
13290 (class File_read::View): Add byteshift_ field. Add byteshift to
13291 constructor. Add byteshift method.
13292 * archive.h (Archive::clear_uncached_views): New function.
13293 (Archive::get_view): Add aligned parameter. Change all callers.
13294 * object.h (Object::get_view): Add aligned parameter. Change all
13295 callers.
13296 (Object::get_lasting_view): Likewise.
13297
13298 * fileread.cc (File_read::release): Don't call clear_views if
13299 there are multiple objects.
13300 * fileread.h (File_read::clear_uncached_views): New function.
13301 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13302 on the archive.
13303
a1207466
CC
133042008-03-31 Cary Coutant <ccoutant@google.com>
13305
13306 Add thin archive support.
13307 * archive.cc (Archive::armagt): New const.
13308 (Archive::setup): Remove task parameter and calls to unlock.
13309 (Archive::unlock_nested_archives): New function.
13310 (Archive::read_header): Add nested_off parameter. Change
13311 all callers.
13312 (Archive::interpret_header): Likewise.
13313 (Archive::include_all_members): Change to handle thin
13314 archives.
13315 (Archive::include_member): Likewise.
13316 * archive.h (Archive::Archive): Add new parameters and
13317 initializers.
13318 (Archive::armagt): New const.
13319 (Archive::setup): Remove task parameter.
13320 (Archive::unlock_nested_archives): New function.
13321 (Archive::read_header): Add nested_off parameter.
13322 (Archive::interpret_header): Likewise.
13323 (Archive::Nested_archive_table): New typedef.
13324 (Archive::is_thin_archive_): New field.
13325 (Archive::nested_archives_): New field.
13326 (Archive::options_): New field.
13327 (Archive::dirpath_): New field.
13328 (Archive::task_): New field.
13329 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13330 for thin archives. Pass additional parameters to
13331 Archive::Archive. Unlock the archive file after calling
13332 Archive::setup.
cd536b21 13333
479f6503
ILT
133342008-03-29 Ian Lance Taylor <iant@google.com>
13335
686c8caf
ILT
13336 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13337 version symbol to be local.
13338 * testsuite/ver_test_4.sh: New file.
13339 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13340 (check_DATA): Add ver_test_4.syms.
13341 (ver_test_4.syms): New target.
13342 * testsuite/Makefile.in: Rebuild.
13343
ab794b6b
ILT
13344 * output.cc
13345 (Output_section::Input_section_sort_entry::has_priority): New
13346 function.
13347 (Output_section::Input_section_sort_entry::match_file_name): New
13348 function.
13349 (Output_section::Input_section_sort_entry::match_section_name):
13350 Remove.
13351 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13352 Remove.
13353 (Output_section::Input_section_sort_entry::match_section_file):
13354 Remove.
13355 (Output_section::Input_section_sort_compare::operator()): Rewrite
13356 using new Input_section_sort_entry functions. Sort crtbegin and
13357 crtend first. Sort sections with no priority before sections with
13358 a priority.
13359 * testsuite/initpri1.c (d3): Check j != 4.
13360 (cd5): New constructor/destructor function.
13361 (main): Check j != 2.
13362
479f6503
ILT
13363 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13364 new symbol when resolving, don't call set_is_default.
13365 * testsuite/ver_test_7.cc: New file.
13366 * testsuite/ver_test_7.sh: New file.
13367 * testsuite/Makefile.am (ver_test_7.so): New target.
13368 (ver_test_7.o): New target.
13369 (check_SCRIPTS): Add ver_test_7.sh.
13370 (check_DATA): Add ver_test_7.syms.
13371 (ver_test_7.syms): New target.
13372
2fd32231
ILT
133732008-03-28 Ian Lance Taylor <iant@google.com>
13374
13375 * layout.cc (Layout::layout): If we see an input section with a
13376 name that needs sorting, set the must_sort flag for the output
13377 section.
13378 (Layout::make_output_section): If the name of the output section
13379 indicates that it might require sorting, set the may_sort flag.
13380 * output.h (Output_section::may_sort_attached_input_sections): New
13381 function.
13382 (Output_section::set_may_sort_attached_input_sections): New
13383 function.
13384 (Output_section::must_sort_attached_input_sections): New
13385 function.
13386 (Output_section::set_must_sort_attached_input_sections): New
13387 function.
13388 (class Output_section): Declare Input_section_sort_entry. Define
13389 Input_section_sort_compare. Declare
13390 sort_attached_input_sections. Add new fields:
13391 may_sort_attached_input_sections_,
13392 must_sort_attached_input_sections_,
13393 attached_input_sections_are_sorted_.
13394 * output.cc (Output_section::Output_section): Initialize new
13395 fields.
13396 (Output_section::add_input_section): Add an entry to
13397 input_sections_ if may_sort or must_sort are true.
13398 (Output_section::set_final_data_size): Call
13399 sort_attached_input_sections if necessary.
13400 (Output_section::Input_section_sort_entry): Define new class.
13401 (Output_section::Input_section_sort_compare::operator()): New
13402 function.
13403 (Output_section::sort_attached_input_sections): New function.
13404 * configure.ac: Check whether the compiler supports constructor
13405 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13406 * testsuite/initpri1.c: New file.
13407 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13408 CONSTRUCTOR_PRIORITY.
13409 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13410 (initpri1_LDFLAGS): New variable.
13411 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13412
18e6b24e
ILT
134132008-03-27 Ian Lance Taylor <iant@google.com>
13414
49bdd526
ILT
13415 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13416 * testsuite/common_test_1.c: New file.
13417 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13418 (common_test_1_SOURCES): New variable.
13419 (common_test_1_DEPENDENCIES): New variable.
13420 (common_test_1_LDFLAGS): New variable.
13421
18e6b24e
ILT
13422 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13423 and commons_ correctly when NAME/VERSION does not override
13424 NAME/NULL.
13425 * testsuite/ver_test_6.c: New file.
13426 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13427 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13428 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13429
04bf7072
ILT
134302008-03-26 Ian Lance Taylor <iant@google.com>
13431
5871526f
ILT
13432 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13433 of an undefined symbol from a version script.
13434 * testsuite/Makefile.am (ver_test_5.so): New target.
13435 (ver_test_5.o): New target.
13436 (check_SCRIPTS): Add ver_test_5.sh.
13437 (check_DATA): Add ver_test_5.syms.
13438 (ver_test_5.syms): New target.
13439 * testsuite/ver_test_5.cc: New file.
13440 * testsuite/ver_test_5.script: New file.
13441 * testsuite/ver_test_5.sh: New file.
13442 * Makefile.in, testsuite/Makefile.in: Rebuild.
13443
04bf7072
ILT
13444 PR gold/5986
13445 Fix problems building gold with gcc 4.3.0.
13446 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13447 (gold_error_at_location, gold_warning_at_location): Use it.
13448 * configure.ac: Check whether we can compile and use a template
13449 function with a printf attribute.
13450 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13451 when jumping over bytes.
13452 * object.cc: Instantiate Object::read_section_data.
13453 * debug.h: Include <cstring>
13454 * dwarf_reader.cc: Include <algorithm>
13455 * main.cc: Include <cstring>.
13456 * options.cc: Include <cstring>.
13457 * output.cc: Include <cstring>.
13458 * script.cc: Include <cstring>.
13459 * script.h: Include <string>.
13460 * symtab.cc: Include <cstring> and <algorithm>.
13461 * target-select.cc: Include <cstring>.
13462 * version.cc: Include <string>.
13463 * testsuite/testmain.cc: Include <cstdlib>.
13464 * configure, config.in: Rebuild.
13465
874c5b28
ILT
134662008-03-25 Ian Lance Taylor <iant@google.com>
13467
819d6c3a
ILT
13468 * options.cc: Include "../bfd/bfdver.h".
13469 (options::help): Print bug reporting address.
13470
f4b2c6f5
ILT
13471 * version.cc (print_version): Adjust output for current value of
13472 BFD_VERSION_STRING.
13473
13474 * NEWS: New file.
13475
e96caa79
ILT
13476 * options.cc (options::help): Print list of supported targets.
13477 * target-select.h: Include <vector>.
13478 (class Target_selector): Make machine_, size_, and is_big_endian_
13479 fields const. Add bfd_name_ and instantiated_target_ fields.
13480 (Target_selector::Target_selector): Add bfd_name parameter.
13481 (Target_selector::recognize): Make non-virtual, call
13482 do_recognize.
13483 (Target_selector::recognize_by_name): Make non-virtual, call
13484 do_recognize_by_name.
13485 (Target_selector::supported_names): New function.
13486 (Target_selector::bfd_name): New function.
13487 (Target_selector::do_instantiate_target): New pure virtual
13488 function.
13489 (Target_selector::do_recognize): New virtual function.
13490 (Target_selector::do_recognize_by_name): New virtual function.
13491 (Target_selector::instantiate_target): New private function.
13492 (supported_target_names): Declare.
13493 * target-select.cc (Target_selector::Target_selector): Update for
13494 new parameter and fields.
13495 (select_target_by_name): Check that the name matches before
13496 calling recognize_by_name.
13497 (supported_target_names): New function.
13498 * i386.cc (class Target_selector_i386): Update Target_selector
13499 constructor call. Remove recognize and recognize_by_name. Add
13500 do_instantiate_target.
13501 * x86_64.cc (class Target_selector_x86_64): Likewise.
13502 * testsuite/testfile.cc (class Target_selector_test): Update for
13503 changes to Target_selector.
13504
874c5b28
ILT
13505 * README: Rewrite, with some notes on unsupported features.
13506
0a65a3a7
CC
135072008-03-24 Cary Coutant <ccoutant@google.com>
13508
13509 * i386.cc (Target_i386::Got_type): New enum declaration.
13510 (Target_i386::Scan::local): Updated callers of Output_data_got
13511 member functions.
13512 (Target_i386::Scan::global): Likewise.
13513 (Target_i386::Relocate::relocate): Likewise.
13514 (Target_i386::Relocate::relocate_tls): Likewise.
13515 * object.h (Got_offset_list): New class.
13516 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13517 (Sized_relobj::local_got_offset): Likewise.
13518 (Sized_relobj::set_local_got_offset): Likewise.
13519 (Sized_relobj::local_has_tls_got_offset): Removed.
13520 (Sized_relobj::local_tls_got_offset): Removed.
13521 (Sized_relobj::set_local_tls_got_offset): Removed.
13522 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13523 * output.cc (Output_data_got::add_global): Added got_type parameter.
13524 (Output_data_got::add_global_with_rel): Likewise.
13525 (Output_data_got::add_global_with_rela): Likewise.
13526 (Output_data_got::add_global_pair_with_rel): New function.
13527 (Output_data_got::add_global_pair_with_rela): New function.
13528 (Output_data_got::add_local): Added got_type parameter.
13529 (Output_data_got::add_local_with_rel): Likewise.
13530 (Output_data_got::add_local_with_rela): Likewise.
13531 (Output_data_got::add_local_pair_with_rel): New function.
13532 (Output_data_got::add_local_pair_with_rela): New function.
13533 (Output_data_got::add_global_tls): Removed.
13534 (Output_data_got::add_global_tls_with_rel): Removed.
13535 (Output_data_got::add_global_tls_with_rela): Removed.
13536 (Output_data_got::add_local_tls): Removed.
13537 (Output_data_got::add_local_tls_with_rel): Removed.
13538 (Output_data_got::add_local_tls_with_rela): Removed.
13539 * output.h (Output_data_got::add_global): Added got_type parameter.
13540 (Output_data_got::add_global_with_rel): Likewise.
13541 (Output_data_got::add_global_with_rela): Likewise.
13542 (Output_data_got::add_global_pair_with_rel): New function.
13543 (Output_data_got::add_global_pair_with_rela): New function.
13544 (Output_data_got::add_local): Added got_type parameter.
13545 (Output_data_got::add_local_with_rel): Likewise.
13546 (Output_data_got::add_local_with_rela): Likewise.
13547 (Output_data_got::add_local_pair_with_rel): New function.
13548 (Output_data_got::add_local_pair_with_rela): New function.
13549 (Output_data_got::add_global_tls): Removed.
13550 (Output_data_got::add_global_tls_with_rel): Removed.
13551 (Output_data_got::add_global_tls_with_rela): Removed.
13552 (Output_data_got::add_local_tls): Removed.
13553 (Output_data_got::add_local_tls_with_rel): Removed.
13554 (Output_data_got::add_local_tls_with_rela): Removed.
13555 * resolve.cc (Symbol::override_base_with_special): Removed
13556 reference to has_got_offset_ field.
13557 * symtab.cc (Symbol::init_fields): Replaced initialization
13558 of got_offset_ with got_offsets_. Removed initialization
13559 of has_got_offset_
53fcba31 13560 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
13561 (Symbol::got_offset): Likewise.
13562 (Symbol::set_got_offset): Likewise.
13563 (Symbol::has_tls_got_offset): Removed.
13564 (Symbol::tls_got_offset): Removed.
13565 (Symbol::set_tls_got_offset): Removed.
13566 (Symbol::got_offset_): Removed.
13567 (Symbol::tls_mod_got_offset_): Removed.
13568 (Symbol::tls_pair_got_offset_): Removed.
13569 (Symbol::got_offsets_): New field.
13570 (Symbol::has_got_offset): Removed.
13571 (Symbol::has_tls_mod_got_offset): Removed.
13572 (Symbol::has_tls_pair_got_offset): Removed.
13573 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13574 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13575 member functions.
13576 (Target_x86_64::Scan::global): Likewise.
13577 (Target_x86_64::Relocate::relocate): Likewise.
13578 (Target_x86_64::Relocate::relocate_tls): Likewise.
13579
bd52eafb
BE
135802008-03-25 Ben Elliston <bje@au.ibm.com>
13581
13582 * yyscript.y: Fix spelling error in comment.
13583
8b105e34
ILT
135842008-03-24 Ian Lance Taylor <iant@google.com>
13585
8ed814a9
ILT
13586 * options.h (class General_options): Define build_id option.
13587 * layout.h (class Layout): Declare write_build_id, create_note,
13588 create_build_id. Add build_id_note_ member.
13589 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13590 "libiberty.h", "md5.h", "sha1.h".
13591 (Layout::Layout): Initialize eh_frame_data_,
13592 eh_frame_hdr_section_, and build_id_note_.
13593 (Layout::finalize): Call create_build_id.
13594 (Layout::create_note): New function, broken out of
13595 Layout::create_gold_note.
13596 (Layout::create_gold_note): Call create_note.
13597 (Layout::create_build_id): New function.
13598 (Layout::write_build_id): New function.
13599 (Close_task_runner::run): Call write_build_id.
13600
8b105e34
ILT
13601 * x86_64.cc: Correct license to GPLv3.
13602
086a1841
ILT
136032008-03-23 Ian Lance Taylor <iant@google.com>
13604
13605 * options.cc: Include "demangle.h".
13606 (parse_optional_string): New function.
13607 (parse_long_option): Handle takes_optional_argument.
13608 (parse_short_option): Update dash_z initializer. Handle
13609 takes_optional_argument.
13610 (General_options::General_options): Initialize do_demangle_.
13611 (General_options::finalize): Set do_demangle_. Handle demangling
13612 style.
13613 * options.h (parse_optional_string): Declare.
13614 (struct One_option): Add optional_arg field. Update constructor.
13615 Update call constructor calls. Add takes_optional_argument
13616 function.
13617 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13618 (DEFINE_optional_string): Define.
13619 (General_options::demangle): Change from DEFINE_bool to
13620 DEFINE_optional_string.
13621 (General_options::no_demangle): New function.
13622 (General_options::do_demangle): New function.
13623 (General_options::set_do_demangle): New function.
13624 (General_options::execstack_status_): Move definition to end of
13625 class definition.
13626 (General_options::static_): Likewise.
13627 (General_options::do_demangle_): New field.
13628 * object.cc (big_endian>::get_symbol_location_info): Call
13629 Options::do_demangle, not Options::demangle.
13630 * symtab.cc (demangle): Likewise.
13631
cbb93e63
ILT
136322008-03-22 Ian Lance Taylor <iant@google.com>
13633
13634 * gold.h: Include <cstddef> and <sys/types.h>
13635 * options.h: Include <cstring>.
13636
ec531623
ILT
136372008-03-21 Ian Lance Taylor <iant@google.com>
13638
13639 * Added source code to GNU binutils.
This page took 0.83537 seconds and 4 git commands to generate.