2012-07-16 Sriraman Tallam <tmsriram@google.com>
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2012-07-16 Sriraman Tallam <tmsriram@google.com>
2
3 * gold.cc (queue_middle_tasks): Update function order only after
4 deferred objects due to plugins are processed.
5
6 2012-07-11 Ian Lance Taylor <iant@google.com>
7
8 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
9 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
10 (Target_arm::scan_reloc_for_stub): Likewise.
11 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
12 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
13 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
14 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
15 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
16
17 2012-07-10 Dodji Seketeli <dodji@redhat.com>
18 Ian Lance Taylor <iant@google.com>
19
20 PR gold/14309
21 * configure.ac: Test whether std::tr1::hash<off_t> works.
22 * gold.h: Add a specialization for std::tr1::hash<off_t> if
23 needed.
24 * output.h (class Output_fill): Add virtual destructor.
25 * configure, config.in: Rebuild.
26
27 2012-06-22 Roland McGrath <mcgrathr@google.com>
28
29 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
30
31 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
32
33 * plugin.cc (Plugin::load): Handle position independent executables.
34
35 2012-06-06 Cary Coutant <ccoutant@google.com>
36
37 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
38 add .debug_macro.
39 (lines_only_debug_sections): Likewise.
40 (gdb_fast_lookup_sections): New static array.
41 (is_gdb_debug_section): Rename formal parameter.
42 (is_lines_only_debug_section): Likewise.
43 (is_gdb_fast_lookup_section): New function.
44 (Layout::include_section): Check for ".zdebug_" prefix; pass
45 section name suffix to is_gdb_debug_section, et al.; check for
46 fast-lookup sections when building .gdb_index.
47 * options.h (--strip-debug-gdb): Update GDB version number.
48
49 2012-06-06 Cary Coutant <ccoutant@google.com>
50
51 * configure.ac: Add check for fallocate.
52 * configure: Regenerate.
53 * config.in: Regenerate.
54
55 * options.h (class General_options): Add --mmap-output-file and
56 --posix-fallocate options.
57 * output.cc: (posix_fallocate): Remove; replace with...
58 (gold_fallocate): New function.
59 (Output_file::map_no_anonymous): Call gold_fallocate.
60 (Output_file::map): Check --mmap-output-file option.
61
62 2012-06-05 Jing Yu <jingyu@google.com>
63
64 * gold.h (textdomain): Add do {} to empty while(0).
65 (bindtextdomain): Likewise.
66
67 2012-06-04 Cary Coutant <ccoutant@google.com>
68
69 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
70 has_dynsym_index.
71
72 2012-05-25 Sriraman Tallam <tmsriram@google.com>
73
74 * symtab.cc (Symbol_table::define_special_symbol):
75 Initialize *poldsym to prevent uninitialized variable errors.
76
77 2012-05-23 Cary Coutant <ccoutant@google.com>
78
79 * layout.cc (Layout::section_name_mapping): Add rules to handle
80 exact match on .data.rel.ro.local or .data.rel.ro.
81 (Layout::output_section_name): Check for exact matches.
82
83 2012-05-23 Cary Coutant <ccoutant@google.com>
84
85 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
86 more carefully.
87
88 2012-05-22 Cary Coutant <ccoutant@google.com>
89
90 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
91 object before exporting symbol.
92
93 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
94
95 * testsuite/tls_test.cc: Include "config.h" first.
96 * testsuite/tls_test_c.c: Likewise.
97
98 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
99 Nick Clifton <nickc@redhat.com>
100
101 PR 14072
102 * configure.in: Add check that sysdep.h has been included before
103 any system header files.
104 * configure: Regenerate.
105 * config.in: Regenerate.
106
107 2012-05-14 Cary Coutant <ccoutant@google.com>
108
109 * layout.cc (Layout::make_output_section): Mark .tdata section
110 as RELRO.
111 * testsuite/relro_test.cc: Add a TLS variable.
112
113 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
114
115 PR gold/14091
116 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
117 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
118 R_X86_64_64.
119
120 2012-05-08 Cary Coutant <ccoutant@google.com>
121
122 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
123 (lines_only_debug_sections): Likewise.
124
125 2012-05-02 Roland McGrath <mcgrathr@google.com>
126
127 * nacl.cc: New file.
128 * nacl.h: New file.
129 * Makefile.am (CCFILES, HFILES): Add them.
130 * Makefile.in: Regenerate.
131 * i386.cc (Output_data_plt_i386_nacl): New class.
132 (Output_data_plt_i386_nacl_exec): New class.
133 (Output_data_plt_i386_nacl_dyn): New class.
134 (Target_i386_nacl): New class.
135 (Target_selector_i386_nacl): New class.
136 (target_selector_i386): Use it instead of Target_selector_i386.
137 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
138 (Target_x86_64_nacl): New class.
139 (Target_selector_x86_64_nacl): New class.
140 (target_selector_x86_64, target_selector_x32): Use it instead of
141 Target_selector_x86_64.
142 * arm.cc (Output_data_plt_arm_nacl): New class.
143 (Target_arm_nacl): New class.
144 (Target_selector_arm_nacl): New class.
145 (target_selector_arm, target_selector_armbe): Use it instead of
146 Target_selector_arm.
147
148 * target-select.cc (select_target): Take new Input_file* and off_t
149 arguments, pass them on to recognize method of selector.
150 * object.cc (make_elf_sized_object): Update caller.
151 * parameters.cc (parameters_force_valid_target): Likewise.
152 * incremental.cc (make_sized_incremental_binary): Likewise.
153 * target-select.h: Update decl.
154 (Target_selector::recognize): Take new Input_file* argument,
155 pass it on to do_recognize.
156 (Target_selector::do_recognize): Take new Input_file* argument.
157 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
158 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
159 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
160 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
161
162 * target.h (Target::Target_info): New members isolate_execinstr
163 and rosegment_gap.
164 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
165 * arm.cc (Target_arm::arm_info): Update initializer.
166 * i386.cc (Target_i386::i386_info): Likewise.
167 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
168 * sparc.cc (Target_sparc::sparc_info): Likewise.
169 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
170 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
171 * layout.cc (Layout::attach_allocated_section_to_segment):
172 Take new const Target* argument. If target->isolate_execinstr(), act
173 like --rosegment.
174 (Layout::find_first_load_seg): Take new const Target* argument;
175 if target->isolate_execinstr(), reject PF_X segments.
176 (Layout::relaxation_loop_body): Update caller.
177 (Layout::set_segment_offsets): If target->isolate_execinstr(),
178 reset file offset to zero when we hit LOAD_SEG, and then do a second
179 loop over the segments before LOAD_SEG to reassign offsets after
180 addresses have been determined. Handle target->rosegment_gap().
181 (Layout::attach_section_to_segment): Take new const Target* argument;
182 pass it to attach_allocated_section_to_segment.
183 (Layout::make_output_section): Update caller.
184 (Layout::attach_sections_to_segments): Take new const Target* argument;
185 pass it to attach_section_to_segment.
186 * gold.cc (queue_middle_tasks): Update caller.
187 * layout.h (Layout): Update method decls with new arguments.
188
189 * arm.cc (Target_arm::Target_arm): Take optional argument for the
190 Target_info pointer to use.
191 (Target_arm::do_make_data_plt): New virtual method.
192 (Target_arm::make_data_plt): New method that calls it.
193 (Target_arm::make_plt_entry): Use it.
194 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
195 for the section alignment.
196 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
197 method.
198 (Output_data_plt_arm::first_plt_entry_offset): Call it.
199 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
200 method.
201 (Output_data_plt_arm::get_plt_entry_size): Call it.
202 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
203 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
204 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
205 method.
206 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
207 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
208 method instead of sizeof(plt_entry).
209 (Output_data_plt_arm::add_entry): Likewise.
210 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
211 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
212 than static method.
213 (Target_arm::plt_entry_size): Likewise.
214 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
215 Move to ...
216 (Output_data_plt_arm_standard): ... here, new class.
217 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
218 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
219 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
220
221 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
222 Take additional argument for the PLT entry size.
223 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
224 Use get_plt_entry_size method rather than plt_entry_size variable.
225 (Output_data_plt_x86_64::reserve_slot): Likewise.
226 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
227 (Output_data_plt_x86_64::add_entry): Likewise.
228 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
229 (Output_data_plt_x86_64::address_for_global): Likewise.
230 (Output_data_plt_x86_64::address_for_local): Likewise.
231 (Output_data_plt_x86_64::set_final_data_size): Likewise.
232 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
233 Make method non-static.
234 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
235 method.
236 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
237 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
238 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
239 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
240 virtual method.
241 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
242 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
243 virtual method.
244 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
245 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
246 virtual method.
247 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
248 (Output_data_plt_x86_64::plt_entry_size)
249 (Output_data_plt_x86_64::first_plt_entry)
250 (Output_data_plt_x86_64::plt_entry)
251 (Output_data_plt_x86_64::tlsdesc_plt_entry)
252 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
253 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
254 (Output_data_plt_x86_64_standard): ... here, new class.
255 (Target_x86_64::Target_x86_64): Take optional argument for the
256 Target_info pointer to use.
257 (Target_x86_64::do_make_data_plt): New virtual method.
258 (Target_x86_64::make_data_plt): New method to call it.
259 (Target_x86_64::init_got_plt_for_update): Use that.
260 Call this->plt_->add_eh_frame method here.
261 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
262 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
263 rather than static method.
264 (Target_x86_64::plt_entry_size): Likewise.
265 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
266 rather than plt_entry_size variable. Move guts of PLT filling to...
267 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
268 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
269 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
270
271 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
272 additional argument for the section alignment.
273 Don't do add_eh_frame_for_plt here.
274 (Output_data_plt_i386::first_plt_entry_offset): Make the method
275 non-static. Use get_plt_entry_size method rather than plt_entry_size
276 variable.
277 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
278 method.
279 (Output_data_plt_i386::get_plt_entry_size): Call it.
280 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
281 (Output_data_plt_i386::add_eh_frame): New method to call it.
282 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
283 method.
284 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
285 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
286 method.
287 (Output_data_plt_i386::fill_plt_entry): New method to call it.
288 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
289 method instead of plt_entry_size.
290 (Output_data_plt_i386::plt_entry_size)
291 (Output_data_plt_i386::plt_eh_frame_fde_size)
292 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
293 (Output_data_plt_i386_standard): ... here, new class.
294 (Output_data_plt_i386_exec): New class.
295 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
296 (Output_data_plt_i386_exec::first_plt_entry): ... here.
297 (Output_data_plt_i386::exec_plt_entry): Move to ...
298 (Output_data_plt_i386_exec::plt_entry): ... here.
299 (Output_data_plt_i386_dyn): New class.
300 (Output_data_plt_i386::first_plt_entry): Move to ...
301 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
302 (Output_data_plt_i386::dyn_plt_entry): Move to ...
303 (Output_data_plt_i386_dyn::plt_entry): ... here.
304 (Target_i386::Target_i386): Take optional argument for the Target_info
305 pointer to use.
306 (Target_i386::do_make_data_plt): New virtual method.
307 (Target_i386::make_data_plt): New method to call it.
308 (Target_i386::make_plt_section): Use that.
309 Call this->plt_->add_eh_frame method here.
310 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
311 rather than plt_entry_size variable.
312 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
313 (Output_data_plt_i386::address_for_local): Likewise.
314 (Output_data_plt_i386::do_write): Likewise.
315 Move guts of PLT filling to...
316 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
317 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
318 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
319 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
320
321 2012-05-01 Cary Coutant <ccoutant@google.com>
322
323 * dwarf_reader.cc (Dwarf_die::read_attributes)
324 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
325 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
326 * reduced_debug_output.cc
327 (Output_reduced_debug_info_section::get_die_end): Remove
328 DW_FORM_GNU_ref_index. Add default case.
329
330 2012-04-26 Mark Wielaard <mjw@redhat.com>
331
332 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
333 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
334 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
335 DW_AT_high_pc as offset from DW_AT_low_pc.
336
337 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
338 * testsuite/Makefile.in: Regenerate.
339 * testsuite/gdb_index_test_3.c: New test source file.
340 * testsuite/gdb_index_test_3.sh: New test source file.
341
342 2012-04-25 Ian Lance Taylor <iant@google.com>
343
344 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
345 pointer.
346 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
347 as a class, not a struct.
348 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
349 (Target_arm::apply_cortex_a8_workaround): Likewise.
350 * gc.h: Declare Reloc_types as a struct, not a class.
351 * object.h: Declare Symbols_data as a struct.
352 * reloc.h: Declare Read_relocs_data as a struct.
353 * target.h: Declare Relocate_info as a struct.
354
355 2012-04-24 David S. Miller <davem@davemloft.net>
356
357 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
358 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
359 and R_SPARC_WPLT30.
360
361 2012-04-24 Cary Coutant <ccoutant@google.com>
362
363 * incremental-dump.cc (find_input_containing_global): Replace
364 magic number with symbolic constant.
365 (dump_incremental_inputs): Update version number.
366 * incremental.cc (Output_section_incremental_inputs): Update version
367 number; import symbolic constants from Incremental_inputs_reader.
368 (Incremental_inputs::create_data_sections): Align relocations
369 section correctly for 64-bit targets.
370 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
371 constants; add padding.
372 (Output_section_incremental_inputs::write_header): Add assert for
373 header_size.
374 (Output_section_incremental_inputs::write_input_files): Add assert
375 for input_entry_size.
376 (Output_section_incremental_inputs::write_info_blocks): Add padding;
377 add assert for object_info_size, input_section_entry_size,
378 global_sym_entry_size.
379 * incremental.h (Incremental_inputs_reader): Add symbolic constants
380 for data structure sizes; use them.
381 (Incremental_input_entry_reader): Import symbolic constants from
382 Incremental_inputs_reader; use them.
383
384 2012-04-23 David S. Miller <davem@davemloft.net>
385
386 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
387 and elf_flags_set_.
388 (Target_sparc::Target_sparc): Initialize new fields.
389 (Target_sparc::do_make_elf_object): New function.
390 (Target_sparc::do_adjust_elf_header): New function.
391
392 2012-04-23 Cary Coutant <ccoutant@google.com>
393
394 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
395 CU range table of gdb index.
396
397 2012-04-20 David S. Miller <davem@davemloft.net>
398
399 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
400 instead of false.
401
402 2012-04-16 David S. Miller <davem@davemloft.net>
403
404 * sparc.cc (Target_sparc::got_address): New function.
405 (Sparc_relocate_functions::gdop_hix22): New function.
406 (Sparc_relocate_functions::gdop_lox10): New function.
407 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
408 relocs.
409 (Target_sparc::Scan::local): Likewise if the global symbol is not
410 preemptible and is not IFUNC.
411 (Target_sparc::Relocate::relocate): Perform GOTDATA code
412 transformations for local and non-preemptible non-IFUNC global
413 symbols.
414
415 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
416 writing out 64-bit part of ranges.
417
418 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
419 -fpic and -fpie respectively.
420 * Makefile.in: Regenerate.
421
422 * sparc.cc (class Target_sparc): Add rela_ifunc_.
423 (Target_sparc::Target_sparc): Initialize new field.
424 (Target_sparc::do_plt_section_for_global): New function.
425 (Target_sparc::do_plt_section_for_local): New function.
426 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
427 (Target_sparc::make_plt_section): New function, broken out of
428 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
429 (Target_sparc::make_plt_entry): Call make_plt_section.
430 (Target_sparc::make_local_ifunc_plt_entry): New function.
431 (Target_sparc::rela_ifunc_section): New function.
432 (Target_sparc::plt_section): Remove const.
433 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
434 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
435 and ifunc_count_ fields.
436 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
437 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
438 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
439 (Output_data_plt_sparc::rela_ifunc): New function.
440 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
441 (Output_data_plt_sparc::has_ifunc_section): New function.
442 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
443 (Output_data_plt_sparc::address_for_global): New function.
444 (Output_data_plt_sparc::address_for_local): New function.
445 (Output_data_plt_sparc::plt_index_to_offset): New function.
446 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
447 and entry_count.
448 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
449 entry_count.
450 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
451 R_SPARC_JMP_IREL to switch.
452 (Target_sparc::Scan::check_non_pic): Likewise.
453 (Target_sparc::Scan::local): Handle IFUNC symbols.
454 (Target_sparc::Scan::local): Likewise.
455 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
456 and plt_address_for_local.
457 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
458 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
459
460 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
461 (class Output_data_reloc): Adjust calls to Output_reloc_type.
462 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
463 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
464 global relocs too.
465 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
466 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
467 calls.
468 * sparc.cc (Target_sparc::Scan::global): Likewise.
469 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
470
471 2012-04-16 Cary Coutant <ccoutant@google.com>
472
473 * archive.cc (Library_base::should_include_member): Check for
474 --export-dynamic-symbol.
475 * options.h (class General_options): Add --export-dynamic-symbol.
476 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
477 --export-dynamic-symbol.
478 (Symbol_table::gc_mark_undef_symbols): Likewise.
479 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
480
481 2012-04-12 David S. Miller <davem@davemloft.net>
482
483 * sparc.cc (Reloc::wdisp10): New relocation method.
484 (Reloc::h34): Likewise.
485 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
486 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
487 R_SPARC_WDISP10.
488 (Target_sparc::Scan::local): Likewise.
489 (Target_sparc::Scan::global): Likewise.
490 (Target_sparc::Relocate::relocate): Likewise.
491
492 2012-04-09 Cary Coutant <ccoutant@google.com>
493
494 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
495 low_pc == 0.
496
497 2012-04-06 Ian Lance Taylor <iant@google.com>
498
499 * timer.cc: #include <unistd.h>.
500
501 2012-04-06 Roland McGrath <mcgrathr@google.com>
502
503 * configure.in (AC_CHECK_HEADERS): Add locale.h.
504 * config.in: Regenerate.
505 * configure: Regenerate.
506
507 2012-04-05 Nick Clifton <nickc@redhat.com>
508
509 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
510 (AM_LC_MESSAGES): Add.
511 * aclocal.m4: Regenerate.
512 * config.in: Regenerate.
513 * configure: Regenerate.
514
515 2012-03-21 Cary Coutant <ccoutant@google.com>
516
517 * Makefile.am: Add gdb-index.cc, gdb-index.h.
518 * Makefile.in: Regenerate.
519 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
520 (Sized_elf_reloc_mapper::symbol_section): New function.
521 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
522 (make_elf_reloc_mapper): New function.
523 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
524 (Dwarf_abbrev_table::do_read_abbrevs): New function.
525 (Dwarf_abbrev_table::do_get_abbrev): New function.
526 (Dwarf_ranges_table::read_ranges_table): New function.
527 (Dwarf_ranges_table::read_range_list): New function.
528 (Dwarf_pubnames_table::read_section): New function.
529 (Dwarf_pubnames_table::read_header): New function.
530 (Dwarf_pubnames_table::next_name): New function.
531 (Dwarf_die::Dwarf_die): New function.
532 (Dwarf_die::read_attributes): New function.
533 (Dwarf_die::skip_attributes): New function.
534 (Dwarf_die::set_name): New function.
535 (Dwarf_die::set_linkage_name): New function.
536 (Dwarf_die::attribute): New function.
537 (Dwarf_die::string_attribute): New function.
538 (Dwarf_die::int_attribute): New function.
539 (Dwarf_die::uint_attribute): New function.
540 (Dwarf_die::ref_attribute): New function.
541 (Dwarf_die::child_offset): New function.
542 (Dwarf_die::sibling_offset): New function.
543 (Dwarf_info_reader::check_buffer): New function.
544 (Dwarf_info_reader::parse): New function.
545 (Dwarf_info_reader::do_parse): New function.
546 (Dwarf_info_reader::do_read_string_table): New function.
547 (Dwarf_info_reader::lookup_reloc): New function.
548 (Dwarf_info_reader::get_string): New function.
549 (Dwarf_info_reader::visit_compilation_unit): New function.
550 (Dwarf_info_reader::visit_type_unit): New function.
551 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
552 Sized_elf_reloc_mapper.
553 (Sized_dwarf_line_info::symbol_section): Remove function.
554 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
555 (Sized_dwarf_line_info::read_line_mappings): Remove object
556 parameter, adjust callers.
557 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
558 * dwarf_reader.h: Include <sys/types.h>.
559 (class Track_relocs): Remove forward declaration.
560 (class Elf_reloc_mapper): New class.
561 (class Sized_elf_reloc_mapper): New class.
562 (class Dwarf_abbrev_table): New class.
563 (class Dwarf_range_list): New class.
564 (class Dwarf_ranges_table): New class.
565 (class Dwarf_pubnames_table): New class.
566 (class Dwarf_die): New class.
567 (class Dwarf_info_reader): New class.
568 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
569 (Sized_dwarf_line_info::symbol_section): Remove member function.
570 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
571 base class.
572 * gdb-index.cc: New source file.
573 * gdb-index.h: New source file.
574 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
575 and .debug_types sections, call Layout::add_to_gdb_index.
576 (Sized_relobj_incr::do_section_name): Implement.
577 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
578 return type; Implement.
579 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
580 return type.
581 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
582 parameter list and return type.
583 (Sized_incr_dynobj::do_section_contents): Likewise.
584 * layout.cc: Include gdb-index.h.
585 (Layout::Layout): Initialize gdb_index_data_.
586 (Layout::init_fixed_output_section): Check for .gdb_index section.
587 (Layout::add_to_gdb_index): New function. Instantiate.
588 * layout.h: Add forward declaration for class Gdb_index.
589 (Layout::add_to_gdb_index): New member function.
590 (Layout::gdb_index_data_): New data member.
591 * main.cc: Include gdb-index.h.
592 (main): Print statistics for gdb index.
593 * object.cc (Object::section_contents): Move code into
594 do_section_contents.
595 (need_decompressed_section): Check for sections needed when building
596 gdb index.
597 (build_compressed_section_map): Likewise.
598 (Sized_relobj_file::do_read_symbols): Need local symbols when building
599 gdb index.
600 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
601 sections; call Layout::add_to_gdb_index.
602 (Sized_relobj_file::do_decompressed_section_contents): Call
603 do_section_contents directly.
604 * object.h (Object::do_section_contents): Adjust parameter list and
605 return type.
606 (Object::do_decompressed_section_contents): Call do_section_contents
607 directly.
608 (Sized_relobj_file::do_section_contents): Adjust parameter list and
609 return type.
610 * options.h (class General_options): Add --gdb-index option.
611 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
612 list and return type.
613 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
614 * reloc.h (Track_relocs::checkpoint): New function.
615 (Track_relocs::reset): New function.
616
617 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
618 New test cases.
619 * testsuite/Makefile.in: Regenerate.
620 * testsuite/gdb_index_test.cc: New test source file.
621 * testsuite/gdb_index_test_1.sh: New test source file.
622 * testsuite/gdb_index_test_2.sh: New test source file.
623
624 2012-03-19 Doug Kwan <dougkwan@google.com>
625
626 * arm.cc (Target_arm::do_define_standard_symbols): New method.
627 (Target_arm::do_finalize_sections): Remove code which defines
628 __exidx_start and __exidx_end. Make symbol table parameter
629 anonymous as it is not used.
630 * gold.cc (queue_middle_tasks): Call target hook to define any
631 target-specific symbols.
632 * target.h (Target::define_standard_symbols): New method.
633 (Target::do_define_standard_symbols): Same.
634 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
635 * testsuite/Makefile.in: Regenerate.
636 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
637 and __exidx_end.
638 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
639 relocations are generated for __exidx_start and __exidx_end.
640
641 2012-03-16 Doug Kwan <dougkwan@google.com>
642
643 * testsuite/Makefile.am: Disable test initpri3b.
644 * testsuite/Makefile.in: Regenerate.
645
646 2012-03-15 Doug Kwan <dougkwan@google.com>
647
648 * arm.cc (Target_arm::got_section): Make .got section read-only
649 if -z now is given.
650
651 2012-03-15 Ian Lance Taylor <iant@google.com>
652
653 PR gold/13850
654 * layout.cc (Layout::make_output_section): Correctly mark
655 SHT_INIT_ARRAY, et. al., as relro.
656
657 2012-03-14 Doug Kwan <dougkwan@google.com>
658
659 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
660 dynamic relocations for protected symbols in shared objects.
661
662 2012-03-13 Ian Lance Taylor <iant@google.com>
663
664 * resolve.cc (Symbol_table::resolve): When merging common symbols,
665 keep the larger alignment.
666
667 2012-03-12 Cary Coutant <ccoutant@google.com>
668
669 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
670 handling of DW_LNE_define_file.
671
672 2012-03-12 Cary Coutant <ccoutant@google.com>
673
674 * reduced_debug_output.cc
675 (Output_reduced_debug_info_section::get_die_end): Add new FORM
676 codes to switch.
677
678 2012-02-29 Cary Coutant <ccoutant@google.com>
679
680 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
681
682 2012-02-29 Cary Coutant <ccoutant@google.com>
683
684 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
685 Call Object::decompressed_section_contents.
686 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
687 New dtor.
688 (Sized_dwarf_line_info::buffer_start_): New data member.
689 * merge.cc (Output_merge_data::do_add_input_section): Call
690 Object::decompressed_section_contents.
691 (Output_merge_string::do_add_input_section): Likewise.
692 * object.cc (need_decompressed_section): New function.
693 (build_compressed_section_map): Decompress sections needed later.
694 (Sized_relobj_file::do_decompressed_section_contents): New function.
695 (Sized_relobj_file::do_discard_decompressed_sections): New function.
696 * object.h (Object::decompressed_section_contents): New function.
697 (Object::discard_decompressed_sections): New function.
698 (Object::do_decompressed_section_contents): New function.
699 (Object::do_discard_decompressed_sections): New function.
700 (Compressed_section_info): New type.
701 (Compressed_section_map): Include decompressed section contents.
702 (Sized_relobj_file::do_decompressed_section_contents): New function.
703 (Sized_relobj_file::do_discard_decompressed_sections): New function.
704
705 2012-02-16 Cary Coutant <ccoutant@google.com>
706
707 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
708 * testsuite/Makefile.in: Regenerate.
709
710 2012-02-14 Cary Coutant <ccoutant@google.com>
711
712 * options.cc (General_options::finalize): Disallow -pie and -static.
713
714 2012-02-03 Doug Kwan <dougkwan@google.com>
715
716 * arm.cc (Arm_relocate_functions::abs8,
717 Arm_relocate_functions::abs16): Use
718 Bits::has_signed_unsigned_overflow32.
719 (Arm_relocate_functions::thm_abs8): Correct range of
720 overflow check.
721 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
722 in assertions.
723
724 2012-02-02 Doug Kwan <dougkwan@google.com>
725
726 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
727 position independent outputs, not just shared objects.
728
729 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
730
731 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
732 * configure: Regenerated.
733
734 2012-01-27 Ian Lance Taylor <iant@google.com>
735
736 * reloc.h (Bits): New class with static functions, copied from
737 namespace utils in arm.cc.
738 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
739 instead.
740
741 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
742
743 * incremental.cc (write_info_blocks): Correct relocation offset.
744
745 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
746
747 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
748 (Relocate::tls_gd_to_le): Likewise.
749
750 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
751
752 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
753
754 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
755
756 * configure.ac: Check if -mcmodel=medium works.
757 * configure: Regenerated.
758
759 2012-01-24 Cary Coutant <ccoutant@google.com>
760
761 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
762 definition and ...
763 (read_unsigned_LEB_128_x): ... this new function.
764 (read_signed_LEB_128): Replaced with inline definition and ...
765 (read_signed_LEB_128_x): ... this new function.
766 * int_encoding.h (read_unsigned_LEB_128_x): New function.
767 (read_unsigned_LEB_128): Add inline definition.
768 (read_signed_LEB_128_x): New function.
769 (read_signed_LEB_128): Add inline definition.
770 * testsuite/Makefile.am (leb128_unittest): New unit test.
771 * testsuite/Makefile.in: Regenerate.
772 * testsuite/leb128_unittest.cc: New unit test.
773
774 2012-01-23 Ian Lance Taylor <iant@google.com>
775
776 PR gold/13617
777 * i386.cc (Target_i386::do_code_fill): When using a jmp
778 instruction, pad with nop instructions.
779 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
780
781 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
782
783 * x86_64.cc (gc_process_relocs): Add typename on types used in
784 template.
785 (scan_relocs): Likewise.
786 (relocate_section): Likewise.
787 (apply_relocation): Likewise.
788
789 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
790
791 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
792 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
793 under x32.
794
795 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
796
797 * x86_64.cc: Initial support for x32.
798
799 2012-01-03 Cary Coutant <ccoutant@google.com>
800
801 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
802 Use abstract base class for GOT.
803 * gold/output.h (class Output_data_got_base): New abstract base class.
804 (class Output_data_got): Derive from new base class, adjust ctors.
805 (Output_data_got::reserve_slot): Make virtual; rename to
806 do_reserve_slot; Adjust callers.
807 * gold/target.h (Sized_target::init_got_plt_for_update): Return
808 pointer to abstract base class.
809 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
810
811 2011-12-18 Ian Lance Taylor <iant@google.com>
812
813 * object.h (Relobj::local_symbol_value): New function.
814 (Relobj::local_plt_offset): New function.
815 (Relobj::local_has_got_offset): New function.
816 (Relobj::local_got_offset): New function.
817 (Relobj::set_local_got_offset): New function.
818 (Relobj::do_local_symbol_value): New pure virtual function.
819 (Relobj::do_local_plt_offset): Likewise.
820 (Relobj::do_local_has_got_offset): Likewise.
821 (Relobj::do_local_got_offset): Likewise.
822 (Relobj::do_set_local_got_offset): Likewise.
823 (Sized_relobj::do_local_has_got_offset): Rename from
824 local_has_got_offset.
825 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
826 (Sized_relobj::do_set_local_got_offset): Rename from
827 set_local_got_offset.
828 (Sized_relobj_file::do_local_plt_offset): Rename from
829 local_plt_offset.
830 (Sized_relobj_file::do_local_symbol_value): New function.
831 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
832 local_plt_offset.
833 * output.cc (Output_data_got::Got_entry::write): Change object to
834 Relobj. Use local_symbol_value.
835 (Output_data_got::add_global_with_rel): Change rel_dyn to
836 Output_data_reloc_generic*. Use add_global_generic.
837 (Output_data_got::add_global_with_rela): Remove. Change all
838 callers to use add_global_with_rel.
839 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
840 Output_data_reloc_generic*. Use add_global_generic.
841 (Output_data_got::add_global_pair_with_rela): Remove. Change all
842 callers to use add_global_pair_with_rel.
843 (Output_data_got::add_local): Change object to Relobj*.
844 (Output_data_got::add_local_plt): Likewise.
845 (Output_data_got::add_local_with_rel): Change object to Relobj*,
846 change rel_dyn to Output_data_reloc_generic*. Use
847 add_local_generic.
848 (Output_data_got::add_local_with_rela): Remove. Change all
849 callers to use all_local_with_rel.
850 (Output_data_got::add_local_pair_with_rel): Change object to
851 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
852 add_output_section_generic.
853 (Output_data_got::add_local_pair_with_rela): Remove. Change all
854 callers to use add_local_pair_with_rel.
855 (Output_data_got::reserve_local): Change object to Relobj*.
856 * output.h: (class Output_data_reloc_generic): Add pure virtual
857 declarations for add_global_generic, add_local_generic,
858 add_output_section_generic.
859 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
860 functions for Output_data_reloc_generic. Update declarations for
861 changes listed in output.cc.
862 (class Output_data_got): Change template parameter to got_size.
863 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
864 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
865 function.
866 (Sized_relobj_incr::do_local_plt_offset): New function.
867 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
868 add_global_generic.
869
870 2011-12-17 Cary Coutant <ccoutant@google.com>
871
872 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
873 * resolve.cc (Symbol_table::resolve): Likewise.
874 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
875 arrays.
876 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
877
878 2011-12-16 Ian Lance Taylor <iant@google.com>
879
880 * output.h (Output_data_reloc_generic::add): Only call
881 add_dynamic_reloc if this is a dynamic reloc section.
882
883 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
884
885 PR gold/13505
886 * target-reloc.h (apply_relocation): Replace <64, false> with
887 <size, big_endian>.
888
889 2011-11-25 Nick Clifton <nickc@redhat.com>
890
891 * po/it.po: New Italian translation.
892
893 2011-11-17 Sterling Augustine <saugustine@google.com>
894
895 * script.cc (script_include_directive): Implement.
896 (read_script_file): New local variables name and search_path. Update
897 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
898 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
899 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
900
901 2011-11-11 Sterling Augustine <saugustine@google.com>
902
903 * yyscript.y (section_cmd): Add support for INCLUDE directive.
904 (file_or_sections_cmd): Likewise.
905
906 2011-11-11 Doug Kwan <dougkwan@google.com>
907
908 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
909 if --just-symbols is given.
910
911 2011-11-10 Doug Kwan <dougkwan@google.com>
912
913 PR gold/13362
914 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
915 when processing data relocs.
916 * reloc.h (Relocate_functions::rel_unaligned): New method.
917 (Relocate_functions::pcrel_unaligned): Ditto.
918 (Relocate_functions::rel32_unaligned): Ditto.
919 (Relocate_functions::pcrel32_unaligned): Ditto.
920
921 2011-11-09 Doug Kwan <dougkwan@google.com>
922
923 PR gold/13362
924 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
925 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
926 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
927 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
928 (Relocate_functions::rel_unaligned): New.
929 (Relocate_functions::rel32_unaligned): New.
930 * target-reloc.h (relocate_for_relocatable): Add code to handle
931 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
932 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
933 arm_unaligned_reloc_r): New targets.
934 * testsuite/Makefile.in: Regenerate.
935 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
936 linking.
937
938 2011-11-02 Ian Lance Taylor <iant@google.com>
939
940 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
941 NATIVE_LINKER.
942 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
943 * options.cc (General_options::finalize): Use library search path
944 from configure script if specified. If not native and no sysroot,
945 only search TOOLLIBDIR.
946 * options.h (Search_directory::Search_directory): Change name to
947 const std::string&.
948 (General_options::add_to_library_path_with_sysroot): Change arg to
949 const std::string&.
950 * configure, Makefile.in, config.in: Rebuild.
951
952 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
953
954 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
955 we are working around the ARM1176 Erratum.
956 * options.h (General_options::fix_arm1176): Add option.
957 * testsuite/Makefile.am: Add testcases, and keep current ones
958 working.
959 * testsuite/Makefile.in: Regenerate.
960 * testsuite/arm_fix_1176.s: New file.
961 * testsuite/arm_fix_1176.sh: Likewise.
962
963 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
964
965 * arm.cc (Target_arm::Target_arm): Remove initialisation of
966 may_use_blx_.
967 (Target_arm::may_use_blx): Remove method.
968 (Target_arm::set_may_use_blx): Likewise.
969 (Target_arm::may_use_v4t_interworking): New method.
970 (Target_arm::may_use_v5t_interworking): Likewise.
971 (Target_arm::may_use_blx_): Remove member variable.
972 (Arm_relocate_functions::arm_branch_common): Check for v5T
973 interworking.
974 (Arm_relocate_functions::thumb_branch_common): Likewise.
975 (Reloc_stub::stub_type_for_reloc): Likewise.
976 (Target_arm::do_finalize_sections): Correct interworking checks.
977 * testsuite/Makefile.am: Add new tests.
978 * testsuite/Makefile.in: Regenerate.
979 * testsuite/arm_farcall_arm_arm.s: New test.
980 * testsuite/arm_farcall_arm_arm.sh: Likewise.
981 * testsuite/arm_farcall_arm_thumb.s: Likewise.
982 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
983 * testsuite/arm_farcall_thumb_arm.s: Likewise.
984 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
985 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
986 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
987
988 2011-10-31 Cary Coutant <ccoutant@google.com>
989
990 PR gold/13023
991 * expression.cc (Expression::eval_with_dot): Add
992 is_section_dot_assignment parameter.
993 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
994 absolute and assigning to dot within a section.
995 * script-sections.cc
996 (Output_section_element_assignment::set_section_addresses): Pass
997 dot_section to set_if_absolute.
998 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
999 as is_section_dot_assignment flag to eval_with_dot.
1000 (Output_section_element_dot_assignment::set_section_addresses):
1001 Likewise.
1002 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1003 parameter. Also set value if relative to dot_section; set the
1004 symbol's output_section.
1005 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1006 parameter. Adjust all callers.
1007 (Expression::eval_maybe_dot): Likewise.
1008 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1009 Adjust all callers.
1010 * testsuite/script_test_2.t: Test assignment of an absolute value
1011 to dot within an output section element.
1012
1013 2011-10-31 Cary Coutant <ccoutant@google.com>
1014
1015 * options.h (class General_options): Add --[no-]gnu-unique options.
1016 * symtab.cc (Symbol_table::sized_write_globals): Convert
1017 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1018
1019 2011-10-31 Cary Coutant <ccoutant@google.com>
1020
1021 PR gold/13359
1022 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1023 unnecessary assertion.
1024 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1025
1026 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1027
1028 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1029 gc_mark_symbol.
1030 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1031 gc_mark_symbol.
1032 Change to just keep the section associated with symbol.
1033 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1034 they are externally visible and --export-dynamic is turned on.
1035 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1036
1037 2011-10-19 Ian Lance Taylor <iant@google.com>
1038
1039 PR gold/13163
1040 * script-sections.cc
1041 (Output_section_element_dot_assignment::needs_output_section): New
1042 function.
1043
1044 2011-10-19 Ian Lance Taylor <iant@google.com>
1045
1046 PR gold/13204
1047 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1048 --section-start option was seen.
1049 * options.h (General_options::any_section_start): New function.
1050
1051 2011-10-18 David S. Miller <davem@davemloft.net>
1052
1053 PR binutils/13301
1054 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1055 member to track relocation locations that have moved during TLS
1056 reloc optimizations.
1057 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1058 (Target_sparc::Relocate::relocate): Adjust view down by 4
1059 bytes if it matches reloc_adjust_addr_.
1060 (Target_sparc::Relocate::relocate_tls): Always move the
1061 __tls_get_addr call delay slot instruction forward 4 bytes when
1062 performing relaxation.
1063
1064 2011-10-18 Cary Coutant <ccoutant@google.com>
1065
1066 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1067 (Output_file::map_no_anonymous): Check for non-zero
1068 return code from posix_fallocate.
1069
1070 2011-10-17 Cary Coutant <ccoutant@google.com>
1071
1072 PR gold/13245
1073 * plugin.cc (is_visible_from_outside): Check for symbols
1074 referenced from dynamic objects.
1075 * resolve.cc (Symbol_table::resolve): Don't count references
1076 from dynamic objects as references from real ELF files.
1077 * testsuite/plugin_test_2.sh: Adjust expected result.
1078
1079 2011-10-17 Cary Coutant <ccoutant@google.com>
1080
1081 * gold.cc: Include timer.h.
1082 (queue_middle_tasks): Stamp time.
1083 (queue_final_tasks): Likewise.
1084 * main.cc (main): Store timer in parameters. Print timers
1085 for each pass.
1086 * parameters.cc (Parameters::Parameters): Initialize timer_.
1087 (Parameters::set_timer): New function.
1088 (set_parameters_timer): New function.
1089 * parameters.h (Parameters::set_timer): New function.
1090 (Parameters::timer): New function.
1091 (Parameters::timer_): New data member.
1092 (set_parameters_timer): New function.
1093 * timer.cc (Timer::stamp): New function.
1094 (Timer::get_pass_time): New function.
1095 * timer.h (Timer::stamp): New function.
1096 (Timer::get_pass_time): New function.
1097 (Timer::pass_times_): New data member.
1098
1099 2011-10-17 Cary Coutant <ccoutant@google.com>
1100
1101 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1102 task for members of lib groups.
1103
1104 2011-10-17 Cary Coutant <ccoutant@google.com>
1105
1106 PR gold/13288
1107 * fileread.cc (File_read::find_view): Add assert.
1108 (File_read::make_view): Move bounds check (replace with assert)...
1109 (File_read::find_or_make_view): ... to here.
1110
1111 2011-10-12 Cary Coutant <ccoutant@google.com>
1112
1113 * output.cc (Output_file::open_base_file): Handle case where
1114 ::read returns less than requested size.
1115
1116 2011-10-10 Cary Coutant <ccoutant@google.com>
1117
1118 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1119 Initialize defined_count_.
1120 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1121 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1122 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1123 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1124 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1125 * incremental.h (Sized_relobj_incr::defined_count_): New data
1126 member.
1127 (Sized_incr_dynobj::defined_count_): New data member.
1128 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1129 Return zeroes instead of internal error.
1130
1131 2011-10-10 Cary Coutant <ccoutant@google.com>
1132
1133 PR gold/13249
1134 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1135 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1136 * output.h (class Output_reloc): Add use_plt_offset flag.
1137 (Output_reloc::type_): Adjust size of bit field.
1138 (Output_reloc::use_plt_offset_): New bit field.
1139 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1140 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1141 flag. Adjust all callers.
1142 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1143 creating RELATIVE relocations.
1144
1145 2011-10-10 Nick Clifton <nickc@redhat.com>
1146
1147 * po/es.po: Updated Spanish translation.
1148 * po/fi.po: Updated Finnish translation.
1149
1150 2011-10-03 Diego Novillo <dnovillo@google.com>
1151
1152 * options.cc (parse_uint): Fix dereference of RETVAL.
1153
1154 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1155
1156 * layout.h (section_order_map_): New member.
1157 (get_section_order_map): New member function.
1158 * output.cc (Output_section::add_input_section): Check for patterns
1159 only when --section-ordering-file is specified.
1160 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1161 output_sections have been formed.
1162 * layout.cc (Layout_Layout): Initialize section_order_map_.
1163 * plugin.cc (update_section_order): Store order in order_map. Do not
1164 update the order.
1165 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1166 * testsuite/Makefile.in: Regenerate.
1167 * testsuite/plugin_section_order.c: New file.
1168 * testsuite/plugin_final_layout.cc: New file.
1169 * testsuite/plugin_final_layout.sh: New file.
1170
1171 2011-09-29 Cary Coutant <ccoutant@google.com>
1172
1173 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1174 Check for NULL.
1175 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1176 symbols during incremental update.
1177 (Symbol_table::add_from_dynobj): Likewise.
1178
1179 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1180 Ian Lance Taylor <iant@google.com>
1181
1182 * symtab.cc (Symbol_table::define_special_symbol): Always
1183 canonicalize version string.
1184
1185 2011-09-26 Cary Coutant <ccoutant@google.com>
1186
1187 * gold.cc (queue_initial_tasks): Move option checks ...
1188 * options.cc (General_options::finalize): ... to here. Disable
1189 some options; make others fatal.
1190
1191 2011-09-26 Cary Coutant <ccoutant@google.com>
1192
1193 gcc PR lto/47247
1194 * plugin.cc (get_symbols_v2): New function.
1195 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1196 (is_referenced_from_outside): New function.
1197 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1198 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1199 (get_symbols): Pass version parameter.
1200 (get_symbols_v2): New function.
1201 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1202 parameter.
1203 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1204 (onload): Add LDPT_GET_SYMBOLS_V2.
1205 (all_symbols_read_hook): Use get_symbols_v2; check for
1206 LDPR_PREVAILING_DEF_IRONLY_EXP.
1207 * testsuite/plugin_test_3.sh: Update expected results.
1208
1209 2011-09-23 Simon Baldwin <simonb@google.com>
1210
1211 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1212 configuration options.
1213 * configure: Regenerate.
1214 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1215 * Makefile.in: Regenerate.
1216 * testsuite/Makefile.in: Regenerate.
1217
1218 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1219
1220 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1221
1222 2011-09-19 Cary Coutant <ccoutant@google.com>
1223
1224 * incremental.cc (can_incremental_update): Fix typo in comment.
1225 * incremental.h (can_incremental_update): Likewise.
1226
1227 2011-09-18 Cary Coutant <ccoutant@google.com>
1228
1229 * incremental.cc (can_incremental_update): New function.
1230 * incremental.h (can_incremental_update): New function.
1231 * layout.cc (Layout::init_fixed_output_section): Call it.
1232 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1233 * object.cc (Sized_relobj_file::do_layout): Call
1234 can_incremental_update.
1235
1236 2011-09-13 Cary Coutant <ccoutant@google.com>
1237
1238 * configure.ac: Check for glibc support for gnu_indirect_function
1239 support with static linking, setting automake conditional
1240 IFUNC_STATIC.
1241 * Makefile.in: Regenerate.
1242 * configure: Regenerate.
1243
1244 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1245 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1246 for IFUNC_STATIC.
1247 * testsuite/Makefile.in: Regenerate.
1248
1249 2011-09-13 Cary Coutant <ccoutant@google.com>
1250
1251 * incremental.cc (Sized_relobj_incr::do_layout): Call
1252 report_comdat_group for kept comdat sections.
1253 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1254 * testsuite/Makefile.in: Regenerate.
1255 * testsuite/incr_comdat_test_1.cc: New source file.
1256 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1257 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1258 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1259
1260 2011-09-13 Ian Lance Taylor <iant@google.com>
1261
1262 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1263 variable external_symbols_offset.
1264
1265 2011-09-12 Ian Lance Taylor <iant@google.com>
1266
1267 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1268 triggered if object has no symbols.
1269
1270 2011-09-09 David S. Miller <davem@davemloft.net>
1271
1272 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1273 (Output_fill_debug_line::do_write): Likewise.
1274
1275 2011-08-29 Cary Coutant <ccoutant@google.com>
1276
1277 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1278 casts to match formatting specs.
1279 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1280
1281 2011-08-26 Cary Coutant <ccoutant@google.com>
1282
1283 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1284 remaining hole size when allocating.
1285 (Layout::make_output_section): Set fill methods for debug sections.
1286 * layout.h (Free_list::Free_list_node): Move from private to
1287 public.
1288 (Free_list::set_min_hole_size): New function.
1289 (Free_list::begin, Free_list::end): New functions.
1290 (Free_list::min_hole_): New data member.
1291 * output.cc: Include dwarf.h.
1292 (Output_fill_debug_info::do_minimum_hole_size): New function.
1293 (Output_fill_debug_info::do_write): New function.
1294 (Output_fill_debug_line::do_minimum_hole_size): New function.
1295 (Output_fill_debug_line::do_write): New function.
1296 (Output_section::Output_section): Initialize new data member.
1297 (Output_section::set_final_data_size): Ensure patch space is larger
1298 than minimum hole size.
1299 (Output_section::do_write): Fill holes in debug sections.
1300 * output.h (Output_fill): New class.
1301 (Output_fill_debug_info): New class.
1302 (Output_fill_debug_line): New class.
1303 (Output_section::set_free_space_fill): New function.
1304 (Output_section::free_space_fill_): New data member.
1305 * testsuite/Makefile.am (incremental_test_3): Add
1306 --incremental-patch option.
1307 (incremental_test_4): Likewise.
1308 (incremental_test_5): Likewise.
1309 (incremental_test_6): Likewise.
1310 (incremental_copy_test): Likewise.
1311 (incremental_common_test_1): Likewise.
1312 * testsuite/Makefile.in: Regenerate.
1313
1314 2011-08-26 Nick Clifton <nickc@redhat.com>
1315
1316 * po/es.po: Updated Spanish translation.
1317
1318 2011-08-01 Cary Coutant <ccoutant@google.com>
1319
1320 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1321 * gold/testsuite/Makefile.in: Regenerate.
1322 * gold/testsuite/justsyms_exec.c: New source file.
1323 * gold/testsuite/justsyms_lib.c: New source file.
1324
1325 2011-08-01 Cary Coutant <ccoutant@google.com>
1326
1327 * layout.cc (Layout::set_segment_offsets): Don't realign text
1328 segment if -Ttext was specified.
1329 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1330 file type.
1331 * object.h (Sized_relobj_file::e_type): New function.
1332 (Sized_relobj_file::e_type_): New data member.
1333 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1334 base address for ET_EXEC files.
1335 * target.cc (Target::do_make_elf_object_implementation): Allow
1336 ET_EXEC files with --just-symbols option.
1337
1338 2011-07-28 Cary Coutant <ccoutant@google.com>
1339
1340 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1341 Add thread_number parameter.
1342 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1343 * workqueue-threads.cc
1344 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1345 current thread if its thread number is greater than desired thread
1346 count.
1347 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1348 Add thread_number parameter.
1349 (Workqueue::should_cancel_thread): Likewise.
1350 (Workqueue::find_runnable_or_wait): Pass thread_number to
1351 should_cancel_thread.
1352 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1353 parameter.
1354
1355 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1356
1357 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1358 only after checking if it cannot be forced local.
1359 * symtab.h (is_externally_visible): Check if the symbol is not forced
1360 local.
1361
1362 2011-07-15 Ian Lance Taylor <iant@google.com>
1363
1364 * options.h (class General_options): Add --print-output-format.
1365 Move -EL next to -EB, for better --help output.
1366 * target-select.cc: Include <cstdio>, "options.h", and
1367 "parameters.h".
1368 (Target_selector::do_target_bfd_name): New function.
1369 (print_output_format): New function.
1370 * target-select.h (class Target_selector): Update declarations.
1371 (Target_selector::target_bfd_name): New function.
1372 (print_output_format): Declare.
1373 * main.cc: Include "target-select.h".
1374 (main): Handle --print-output-format.
1375 * gold.cc: Include "target-select.h".
1376 (queue_initial_tasks): Handle --print-output-format when there are
1377 no input files.
1378 * parameters.cc (parameters_force_valid_target): Give a better
1379 error message if -EB/-EL does not match target.
1380 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1381 function.
1382
1383 2011-07-15 Ian Lance Taylor <iant@google.com>
1384
1385 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1386 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1387 (Output_data_plt_i386::do_write): Write address of .dynamic
1388 section to first entry in .got.plt section.
1389 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1390 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1391 Initialize layout_.
1392 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1393 section to first entry in .got.plt section.
1394 * layout.h (Layout::dynamic_section): New function.
1395
1396 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1397
1398 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1399 to claim_file call.
1400 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1401 input_section_position_, and input_section_glob_.
1402 (read_layout_from_file): Call function section_ordering_specified.
1403 * layout.h (is_section_ordering_specified): New function.
1404 (section_ordering_specified): New function.
1405 (section_ordering_specified_): New boolean member.
1406 * main.cc(main): Call load_plugins after layout object is defined.
1407 * output.cc (Output_section::add_input_section): Use
1408 function section_ordering_specified to check if section ordering is
1409 needed.
1410 * output.cc (Output_section::add_relaxed_input_section): Use
1411 function section_ordering_specified to check if section ordering is
1412 needed.
1413 (Output_section::update_section_layout): New function.
1414 (Output_section::sort_attached_input_sections): Check if input section
1415 must be reordered.
1416 * output.h (Output_section::update_section_layout): New function.
1417 * plugin.cc (get_section_count): New function.
1418 (get_section_type): New function.
1419 (get_section_name): New function.
1420 (get_section_contents): New function.
1421 (update_section_order): New function.
1422 (allow_section_ordering): New function.
1423 (Plugin::load): Add the new interfaces to the transfer vector.
1424 (Plugin_manager::load_plugins): New parameter.
1425 (Plugin_manager::all_symbols_read): New parameter.
1426 (Plugin_manager::claim_file): New parameter. Save the elf object for
1427 unclaimed objects.
1428 (Plugin_manager::get_elf_object): New function.
1429 (Plugin_manager::get_view): Change to directly use the bool to check
1430 if get_view is called from claim_file_hook.
1431 * plugin.h (input_objects): New function
1432 (Plugin__manager::load_plugins): New parameter.
1433 (Plugin_manager::claim_file): New parameter.
1434 (Plugin_manager::get_elf_object): New function.
1435 (Plugin_manager::in_claim_file_handler): New function.
1436 (Plugin_manager::in_claim_file_handler_): New member.
1437 (layout): New function.
1438 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1439 handler with an extra parameter. Make the elf object before calling
1440 claim_file handler.
1441 * testsuite/plugin_test.c (get_section_count): New function pointer.
1442 (get_section_type): New function pointer.
1443 (get_section_name): New function pointer.
1444 (get_section_contents): New function pointer.
1445 (update_section_order): New function pointer.
1446 (allow_section_ordering): New function pointer.
1447 (onload): Check if the new interfaces exist.
1448
1449 2011-07-13 Ian Lance Taylor <iant@google.com>
1450
1451 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1452 relro section.
1453 * x86_64.cc (Target_x86_64::got_section): Likewise.
1454 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1455 (relro_now_test_SOURCES): New variable.
1456 (relro_now_test_DEPENDENCIES): New variable.
1457 (relro_now_test_LDFLAGS): New variable.
1458 (relro_now_test_LDADD): New variable.
1459 (relro_now_test.so): New target.
1460 * testsuite/Makefile.in: Rebuild.
1461
1462 2011-07-12 Ian Lance Taylor <iant@google.com>
1463
1464 PR gold/12980
1465 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1466 GLOB_DAT relocation rather than a RELATIVE relocation for a
1467 protected symbol when creating a shared library.
1468 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1469 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1470 * testsuite/protected_main_1.cc (main): Test that protected
1471 function has same address.
1472
1473 2011-07-11 Ian Lance Taylor <iant@google.com>
1474
1475 PR gold/12979
1476 * options.h (class General_options): Add -Bgroup.
1477 * options.cc (General_options::finalize): If -Bgroup is set,
1478 default to --unresolved-symbols=report-all.
1479 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1480 * target-reloc.h (issue_undefined_symbol_error): Handle
1481 --unresolved-symbols=report-all.
1482
1483 2011-07-08 Ian Lance Taylor <iant@google.com>
1484
1485 PR gold/11985
1486 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1487 if linker script discards key sections.
1488 (Layout::create_dynamic_symtab): Likewise.
1489 (Layout::assign_local_dynsym_offsets): Likewise.
1490 (Layout::sized_create_version_sections): Likewise.
1491 (Layout::create_interp): Likewise.
1492 (Layout::finish_dynamic_section): Likewise.
1493 (Layout::set_dynamic_symbol_size): Likewise.
1494
1495 2011-07-08 Ian Lance Taylor <iant@google.com>
1496
1497 PR gold/12386
1498 * options.h (class General_options): Add --unresolved-symbols.
1499 * target-reloc.h (issue_undefined_symbol_error): Check
1500 --unresolved-symbols. Add comments.
1501
1502 2011-07-08 Ian Lance Taylor <iant@google.com>
1503
1504 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1505 expression more complex.
1506
1507 2011-07-08 Ian Lance Taylor <iant@google.com>
1508
1509 PR gold/11317
1510 * target-reloc.h (issue_undefined_symbol_error): New inline
1511 function, broken out of relocate_section.
1512 (relocate_section): Call issue_undefined_symbol_error.
1513 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1514 there is no TLS segment if we are about to issue an undefined
1515 symbol error.
1516 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1517
1518 2011-07-08 Ian Lance Taylor <iant@google.com>
1519
1520 PR gold/12279
1521 * resolve.cc (Symbol_table::should_override): Add fromtype
1522 parameter. Change all callers. Give error when linking together
1523 TLS and non-TLS symbol.
1524 (Symbol_table::should_override_with_special): Add fromtype
1525 parameter. Change all callers.
1526 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1527 there is no TLS segment if we have reported some errors.
1528 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1529
1530 2011-07-08 Ian Lance Taylor <iant@google.com>
1531
1532 PR gold/12372
1533 * target.h (Target::plt_address_for_global): New function.
1534 (Target::plt_address_for_local): New function.
1535 (Target::plt_section_for_global): Remove.
1536 (Target::plt_section_for_local): Remove.
1537 (Target::do_plt_address_for_global): New virtual function.
1538 (Target::do_plt_address_for_local): New virtual function.
1539 (Target::do_plt_section_for_global): Remove.
1540 (Target::do_plt_section_for_local): Remove.
1541 (Target::register_global_plt_entry): Add Symbol_table and Layout
1542 parameters.
1543 * output.cc (Output_data_got::Got_entry::write): Use
1544 plt_address_for_global and plt_address_for_local.
1545 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1546 address of output section.
1547 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1548 got_irelative_, and irelative_count_ fields. Update
1549 declarations.
1550 (Output_data_plt_i386::has_irelative_section): New function.
1551 (Output_data_plt_i386::entry_count): Add irelative_count_.
1552 (Output_data_plt_i386::set_final_data_size): Likewise.
1553 (class Target_i386): Add got_irelative_ and rel_irelative_
1554 fields. Update declarations.
1555 (Target_i386::Target_i386): Initialize new fields.
1556 (Target_i386::do_plt_address_for_global): New function replacing
1557 do_plt_section_for_global.
1558 (Target_i386::do_plt_address_for_local): New function replacing
1559 do_plt_section_for_local.
1560 (Target_i386::got_section): Create got_irelative_.
1561 (Target_i386::rel_irelative_section): New function.
1562 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1563 fields. Don't define __rel_iplt_{start,end}.
1564 (Output_data_plt_i386::add_entry): Add symtab and layout
1565 parameters. Change all callers. Use different PLT and GOT for
1566 IFUNC symbols.
1567 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1568 layout parameters. Change all callers. Use different PLT and
1569 GOT.
1570 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1571 (Output_data_plt_i386::rel_irelative): New function.
1572 (Output_data_plt_i386::address_for_global): New function.
1573 (Output_data_plt_i386::address_for_local): New function.
1574 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1575 IRELATIVE GOT when changing IFUNC GOT entries.
1576 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1577 reloc.
1578 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1579 if we didn't create an IRELATIVE GOT.
1580 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1581 plt_address_for_local.
1582 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1583 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1584 got_irelative_, and irelative_count_ fields. Update
1585 declarations.
1586 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1587 Initialize new fields. Remove symtab parameter. Change all
1588 callers.
1589 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1590 irelative_count_.
1591 (Output_data_plt_x86_64::has_irelative_section): New function.
1592 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1593 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1594 fields. Update declarations.
1595 (Target_x86_64::Target_x86_64): Initialize new fields.
1596 (Target_x86_64::do_plt_address_for_global): New function replacing
1597 do_plt_section_for_global.
1598 (Target_x86_64::do_plt_address_for_local): New function replacing
1599 do_plt_section_for_local.
1600 (Target_x86_64::got_section): Create got_irelative_.
1601 (Target_x86_64::rela_irelative_section): New function.
1602 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1603 all callers. Don't create __rel_iplt_{start,end}.
1604 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1605 parameters. Change all callers. Use different PLT and GOT for
1606 IFUNC symbols.
1607 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1608 layout parameters. Change all callers. Use different PLT and
1609 GOT.
1610 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1611 parameters. Change all callers. Use different PLT and GOT for
1612 IFUNC symbols.
1613 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1614 (Output_data_plt_x86_64::rela_irelative): New function.
1615 (Output_data_plt_x86_64::address_for_global): New function.
1616 (Output_data_plt_x86_64::address_for_local): New function.
1617 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1618 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1619 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1620 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1621 parameters.
1622 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1623 reloc.
1624 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1625 symbols if we didn't create an IRELATIVE GOT.
1626 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1627 plt_address_for_local.
1628 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1629 * testsuite/ifuncvar1.c: New test file.
1630 * testsuite/ifuncvar2.c: New test file.
1631 * testsuite/ifuncvar3.c: New test file.
1632 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1633 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1634 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1635 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1636 * testsuite/Makefile.in: Rebuild.
1637
1638 2011-07-07 Cary Coutant <ccoutant@google.com>
1639
1640 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1641 (two_file_test_1_ndebug.o): Likewise.
1642 (two_file_test_1b_ndebug.o): Likewise.
1643 (two_file_test_2_ndebug.o): Likewise.
1644 (two_file_test_main_ndebug.o): Likewise.
1645 (incremental_test_2): Link with no-debug versions.
1646
1647 2011-07-06 Cary Coutant <ccoutant@google.com>
1648
1649 * gold/incremental.cc
1650 (Output_section_incremental_inputs::write_info_blocks): Check for
1651 hidden and internal symbols.
1652
1653 2011-07-06 Cary Coutant <ccoutant@google.com>
1654
1655 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1656 Check disposition for startup file.
1657 (Incremental_inputs::report_command_line): Ignore
1658 --incremental-startup-unchanged option.
1659 * options.cc (General_options::parse_incremental_startup_unchanged):
1660 New function.
1661 (General_options::General_options): Initialize new data member.
1662 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1663 (General_options): Add --incremental-startup-unchanged option.
1664 (General_options::incremental_startup_disposition): New function.
1665 (General_options::incremental_startup_disposition_): New data member.
1666
1667 2011-07-06 Cary Coutant <ccoutant@google.com>
1668
1669 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1670 input file index to Script_info ctor.
1671 (Sized_incremental_binary::do_file_has_changed): Find the
1672 command-line argument for files named in scripts.
1673 * incremental.h (Script_info::Script_info): New ctor
1674 with input file index.
1675 (Script_info::input_file_index): New function.
1676 (Script_info::input_file_index_): New data member.
1677 (Incremental_binary::get_library): Add const.
1678 (Incremental_binary::get_script_info): Add const.
1679 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1680 * testsuite/Makefile.am (incremental_test_5): New test case.
1681 (incremental_test_6): New test case.
1682 * testsuite/Makefile.in: Regenerate.
1683
1684 2011-07-06 Cary Coutant <ccoutant@google.com>
1685
1686 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1687 debug output when command lines differ.
1688
1689 2011-07-06 Cary Coutant <ccoutant@google.com>
1690
1691 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1692 --incremental-patch option.
1693 * layout.cc (Free_list::allocate): Extend allocation beyond original
1694 end if enabled.
1695 (Layout::make_output_section): Mark sections that should get
1696 patch space.
1697 * options.cc (parse_percent): New function.
1698 * options.h (parse_percent): New function.
1699 (DEFINE_percent): New macro.
1700 (General_options): Add --incremental-patch option.
1701 * output.cc (Output_section::Output_section): Initialize new data
1702 members.
1703 (Output_section::add_input_section): Print section name when out
1704 of patch space.
1705 (Output_section::add_output_section_data): Likewise.
1706 (Output_section::set_final_data_size): Add patch space when
1707 doing --incremental-full.
1708 (Output_section::do_reset_address_and_file_offset): Remove patch
1709 space.
1710 (Output_segment::set_section_list_addresses): Print debug output
1711 only if --incremental-update.
1712 * output.h (Output_section::set_is_patch_space_allowed): New function.
1713 (Output_section::is_patch_space_allowed_): New data member.
1714 (Output_section::patch_space_): New data member.
1715 * parameters.cc (Parameters::incremental_full): New function.
1716 * parameters.h (Parameters::incremental_full): New function
1717 * testsuite/Makefile.am (incremental_test_2): Add test for
1718 --incremental-patch option.
1719 * testsuite/Makefile.in: Regenerate.
1720 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1721 (t18): Remove function body.
1722
1723 2011-07-05 Doug Kwan <dougkwan@google.com>
1724
1725 PR gold/12771
1726 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1727 Arm_Address type for relocation result.
1728 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1729 overflow check.
1730 (Arm_relocate_functions::abs32): Use unaligned access.
1731 (Arm_relocate_functions::rel32): Ditto.
1732 (Arm_relocate_functions::prel31): Ditto.
1733 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1734 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1735 static data relocations.
1736 * testsuite/Makefile.in: Regnerate.
1737 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1738
1739 2011-07-05 Ian Lance Taylor <iant@google.com>
1740
1741 PR gold/12392
1742 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1743 symbols if necessary.
1744 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1745
1746 2011-07-05 Ian Lance Taylor <iant@google.com>
1747
1748 PR gold/12952
1749 * resolve.cc (Symbol::override_base_with_special): Simply override
1750 version with special symbol version, ignoring previous version.
1751
1752 2011-07-05 Ian Lance Taylor <iant@google.com>
1753
1754 * object.cc (Sized_relobj_file::include_section_group): Add
1755 information to comment about signature location.
1756
1757 2011-07-02 Ian Lance Taylor <iant@google.com>
1758
1759 PR gold/12957
1760 * options.h (class General_options): Add -f and -F.
1761 * options.cc (General_options::finalize): Fatal error if -f/-F
1762 are used without -shared.
1763 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1764
1765 2011-07-02 Ian Lance Taylor <iant@google.com>
1766
1767 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1768
1769 2011-07-01 Ian Lance Taylor <iant@google.com>
1770
1771 PR gold/12525
1772 PR gold/12952
1773 * resolve.cc (Symbol::override_base_with_special): Don't override
1774 the version if the overriding symbol has a different name.
1775 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1776 all callers. If we give an error about an undefined version,
1777 define the base version if necessary.
1778 * dynobj.h (class Versions): Update declaration.
1779 * testsuite/weak_alias_test_5.cc: New file.
1780 * testsuite/weak_alias_test.script: New file.
1781 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1782 and versioned_alias have the right value, and call t2.
1783 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1784 weak_alias_test_5.so.
1785 (weak_alias_test_LDADD): Likewise.
1786 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1787 * testsuite/Makefile.in: Rebuild.
1788
1789 2011-07-01 Ian Lance Taylor <iant@google.com>
1790
1791 PR gold/12525
1792 * options.h (class General_options): Support -z notext.
1793 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1794 -Wl,-z,notext.
1795 (two_file_shared_nonpic.so): Likewise.
1796 (two_file_shared_mixed.so): Likewise.
1797 (two_file_shared_mixed_1.so): Likewise.
1798 (weak_undef_lib_nonpic.so): Likewise.
1799 (alt/weak_undef_lib_nonpic.so): Likewise.
1800 (tls_test_shared_nonpic.so): Likewise.
1801 * testsuite/Makefile.in: Rebuild.
1802
1803 2011-07-01 Ian Lance Taylor <iant@google.com>
1804
1805 PR gold/12525
1806 * configure.ac: Test whether static linking works, setting
1807 the automake conditional HAVE_STATIC.
1808 * testsuite/Makefile.am: Disable tests using -static if
1809 HAVE_STATIC is not true.
1810 * configure, testsuite/Makefile.in: Rebuild.
1811
1812 2011-07-01 Ian Lance Taylor <iant@google.com>
1813
1814 PR gold/12525
1815 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1816 Assert if we see DW_EH_PE_indirect.
1817 * target.h (Target::ehframe_datarel_base): New function.
1818 (Target::do_ehframe_datarel_base): New target function.
1819 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1820 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1821 function.
1822
1823 2011-07-01 Ian Lance Taylor <iant@google.com>
1824
1825 PR gold/12571
1826 * options.h (class General_options): Add
1827 --ld-generated-unwind-info.
1828 * ehframe.cc (Fde::write): Add address parameter. Change all
1829 callers. If associated with PLT, fill in address and size.
1830 (Cie::set_output_offset): Only add merge mapping if there is an
1831 object.
1832 (Cie::write): Add address parameter. Change all callers.
1833 (Eh_frame::add_ehframe_for_plt): New function.
1834 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1835 input_offset_ fields into union u_, with new plt field.
1836 (Fde::Fde): Adjust for new union field.
1837 (Fde::Fde) [Output_data version]: New constructor.
1838 (Fde::add_mapping): Only add merge mapping if there is an object.
1839 (class Cie): Update declarations.
1840 (class Eh_frame): Declare add_ehframe_for_plt.
1841 * layout.cc (Layout::layout_eh_frame): Break out code into
1842 make_eh_frame_section, and call it.
1843 (Layout::make_eh_frame_section): New function.
1844 (Layout::add_eh_frame_for_plt): New function.
1845 * layout.h (class Layout): Update declarations.
1846 * merge.cc (Merge_map::add_mapping): Add assertion.
1847 * i386.cc: Include "dwarf.h".
1848 (class Output_data_plt_i386): Make first_plt_entry,
1849 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1850 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1851 and plt_eh_frame_fde.
1852 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1853 boundary. Call add_eh_frame_for_plt if appropriate.
1854 * x86_64.cc: Include "dwarf.h".
1855 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1856 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1857 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1858 and plt_eh_frame_fde.
1859 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1860 appropriate.
1861
1862 2011-06-29 Ian Lance Taylor <iant@google.com>
1863
1864 PR gold/12629
1865 * object.cc (Sized_relobj_file::layout_section): Change shdr
1866 parameter to be const.
1867 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1868 out of do_layout.
1869 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1870 appropriate. Call layout_eh_frame_section.
1871 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1872 sections.
1873 * object.h (class Sized_relobj_file): Update declarations.
1874
1875 2011-06-29 Ian Lance Taylor <iant@google.com>
1876
1877 PR gold/12652
1878 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1879 modifier.
1880 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1881
1882 2011-06-29 Ian Lance Taylor <iant@google.com>
1883
1884 PR gold/12675
1885 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1886 SHT_X86_64_UNWIND.
1887 * layout.cc (Layout::layout_eh_frame): Likewise.
1888
1889 2011-06-29 Ian Lance Taylor <iant@google.com>
1890
1891 PR gold/12695
1892 * layout.cc (Layout::symtab_section_shndx): New function.
1893 * layout.h (class Layout): Declare symtab_section_shndx.
1894 * output.cc (Output_section::write_header): Call it.
1895
1896 2011-06-29 Ian Lance Taylor <iant@google.com>
1897
1898 PR gold/12818
1899 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1900 symbols which are not used in a relocation.
1901
1902 2011-06-28 Ian Lance Taylor <iant@google.com>
1903
1904 PR gold/12898
1905 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1906 script create indistinguishable segments.
1907 (Layout::set_segment_offsets): Use stable_sort when sorting
1908 segments. Pass this to Compare_segments constructor.
1909 * layout.h (class Layout): Make segment_precedes non-static.
1910 (class Compare_segments): Change from struct to class. Add
1911 layout_ field. Add constructor.
1912 * script-sections.cc
1913 (Script_sections::attach_sections_using_phdrs_clause): Rename
1914 local orphan to is_orphan. Don't report failure to put empty
1915 section in segment. On attachment failure, report name of
1916 section, and attach to first PT_LOAD segment.
1917
1918 2011-06-28 Ian Lance Taylor <iant@google.com>
1919
1920 PR gold/12934
1921 * target-select.cc (Target_selector::Target_selector): Add
1922 emulation parameter. Change all callers.
1923 (select_target_by_bfd_name): Rename from select_target_by_name.
1924 Change all callers.
1925 (select_target_by_emulation): New function.
1926 (supported_emulation_names): New function.
1927 * target-select.h (class Target_selector): Add emulation_ field.
1928 Update declarations.
1929 (Target_selector::recognize_by_bfd_name): Rename from
1930 recognize_by_name. Change all callers.
1931 (Target_selector::supported_bfd_names): Rename from
1932 supported_names. Change all callers.
1933 (Target_selector::recognize_by_emulation): New function.
1934 (Target_selector::supported_emulations): New function.
1935 (Target_selector::emulation): New function.
1936 (Target_selector::do_recognize_by_bfd_name): Rename from
1937 do_recognize_by_name. Change all callers.
1938 (Target_selector::do_supported_bfd_names): Rename from
1939 do_supported_names. Change all callers.
1940 (Target_selector::do_recognize_by_emulation): New function.
1941 (Target_selector::do_supported_emulations): New function.
1942 (select_target_by_bfd_name): Change name in declaration.
1943 (select_target_by_emulation): Declare.
1944 (supported_emulation_names): Declare.
1945 * parameters.cc (parameters_force_valid_target): Try to find
1946 target based on emulation from -m option.
1947 * options.h (class General_options): Change doc string for -m.
1948 * options.cc (help): Print emulations.
1949 (General_options::parse_V): Likewise.
1950 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1951 Add emulation parameter. Change all callers.
1952
1953 2011-06-28 Ian Lance Taylor <iant@google.com>
1954
1955 * target.h (class Target): Add osabi_ field.
1956 (Target::osabi): New function.
1957 (Target::set_osabi): New function.
1958 (Target::Target): Initialize osabi_.
1959 (Target::do_adjust_elf_header): Make pure virtual.
1960 (Sized_target::do_adjust_elf_header): Declare.
1961 * target.cc (Sized_target::do_adjust_elf_header): New function.
1962 (class Sized_target): Instantiate all versions.
1963 * freebsd.h (class Target_freebsd): Remove.
1964 (Target_selector_freebsd::do_recognize): Call set_osabi on
1965 Target.
1966 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1967 (Target_selector_freebsd::set_osabi): Remove.
1968 * i386.cc (class Target_i386): Inherit from Sized_target rather
1969 than Target_freebsd.
1970 * x86_64.cc (class Target_x86_64): Likewise.
1971
1972 2011-06-28 Ian Lance Taylor <iant@google.com>
1973
1974 * target.h (Target::can_check_for_function_pointers): Rewrite.
1975 Make non-virtual.
1976 (Target::can_icf_inline_merge_sections): Likewise.
1977 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1978 (Target::Target_info): Add can_icf_inline_merge_sections field.
1979 (Target::do_can_check_for_function_pointers): New virtual
1980 function.
1981 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1982 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1983 from can_check_for_function_pointers, move in file.
1984 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1985 section_may_have_icf_unsafe_poineters, move in file.
1986 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1987 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1988 Rename from can_check_for_function_pointers, move in file.
1989 (Target_i386::can_icf_inline_merge_sections): Remove.
1990 (Target_i386::i386_info): Initialize
1991 can_icf_inline_merge_sections.
1992 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1993 Initialize can_icf_inline_merge_sections.
1994 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1995 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1996 Rename from can_check_for_function_pointers, move in file.
1997 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1998 (Target_x86_64::x86_64_info): Initialize
1999 can_icf_inline_merge_sections.
2000 * testsuite/testfile.cc (Target_test::test_target_info):
2001 Likewise.
2002 * icf.cc (get_section_contents): Correct formatting.
2003
2004 2011-06-27 Ian Lance Taylor <iant@google.com>
2005
2006 * symtab.cc (Symbol::versioned_name): New function.
2007 (Symbol_table::add_to_final_symtab): Use versioned_name when
2008 appropriate.
2009 (Symbol_table::sized_write_symbol): Likewise.
2010 * symtab.h (class Symbol): Declare versioned_name.
2011 * stringpool.h (class Stringpool_template): Add variant of add
2012 which takes a std::basic_string.
2013 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2014 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2015 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2016 (ver_test_12.o): New target.
2017 * testsuite/Makefile.in: Rebuild.
2018
2019 2011-06-27 Doug Kwan <dougkwan@google.com>
2020
2021 * arm.cc (Arm_relocate_functions::thm_jump8,
2022 Arm_relocate_functions::thm_jump11): Use a wider signed
2023 type to compute offset.
2024 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2025 arm_thm_jump8.
2026 * testsuite/Makefile.in: Regenerate.
2027 * testsuite/arm_branch_in_range.sh: Check test results of
2028 arm_thm_jump11 and arm_thm_jump8.
2029 * testsuite/arm_thm_jump11.s: New test source file.
2030 * testsuite/arm_thm_jump11.t: New linker script.
2031 * testsuite/arm_thm_jump8.s: New test source file.
2032 * testsuite/arm_thm_jump8.t: New linker script.
2033
2034 2011-06-24 Ian Lance Taylor <iant@google.com>
2035
2036 * layout.cc: Include "object.h".
2037 (ctors_sections_in_init_array): New static variable.
2038 (Layout::is_ctors_in_init_array): New function.
2039 (Layout::layout): Add entry to ctors_sections_in_init_array if
2040 appropriate.
2041 * layout.h (class Layout): Declare is_ctors_in_init_array.
2042 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2043 is_ctors_reverse_view is set.
2044 (Sized_relobj_file::write_sections): Add layout parameter. Change
2045 all callers. Set is_ctors_reverse_view field of View_size.
2046 (Sized_relobj_file::reverse_words): New function.
2047 * object.h (Sized_relobj_file::View_size): Add
2048 is_ctors_reverse_view field.
2049 (class Sized_relobj_file): Update declarations.
2050 * testsuite/initpri3.c: New test.
2051 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2052 initpri3b.
2053 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2054 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2055 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2056 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2057 * testsuite/Makefile.in: Rebuild.
2058
2059 2011-06-24 Cary Coutant <ccoutant@google.com>
2060
2061 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2062 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2063 (debug_msg_cdebug.err): New targets.
2064 * testsuite/Makefile.in: Regenerate.
2065 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2066 Fix checks for link with shared library.
2067
2068 2011-06-24 Doug Kwan <dougkwan@google.com>
2069
2070 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2071 skip empty text sections.
2072 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2073
2074 2011-06-22 Ian Lance Taylor <iant@google.com>
2075
2076 PR gold/12910
2077 * options.h (class General_options): Add --ctors-in-init-array.
2078 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2079 friends as SHT_PROGBITS for merging sections.
2080 (Layout::layout): Remove special handling of .init_array and
2081 friends. Don't sort if doing relocatable link. Sort for .ctors
2082 and .dtors if ctors_in_init_array.
2083 (Layout::make_output_section): Force correct section types for
2084 .init_array and friends. Don't sort if doing relocatable link,
2085 Don't sort .ctors and .dtors if ctors_in_init_array.
2086 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2087 (Layout::output_section_name): Add relobj parameter. Change all
2088 callers. Handle .ctors. and .dtors. in code rather than table.
2089 Handle .ctors and .dtors if ctors_in_init_array.
2090 (Layout::match_file_name): New function, moved from output.cc.
2091 * layout.h (class Layout): Update declarations.
2092 * output.cc: Include "layout.h".
2093 (Input_section_sort_entry::get_priority): New function.
2094 (Input_section_sort_entry::match_file_name): Just call
2095 Layout::match_file_name.
2096 (Output_section::Input_section_sort_init_fini_compare::operator()):
2097 Handle .ctors and .dtors. Sort by explicit priority rather than
2098 by name.
2099 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2100 * testsuite/initpri2.c: New test.
2101 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2102 (check_PROGRAMS): Add initpri2.
2103 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2104 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2105 * configure, testsuite/Makefile.in: Rebuild.
2106
2107 2011-06-19 Ian Lance Taylor <iant@google.com>
2108
2109 PR gold/12880
2110 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2111 .interp section to a PT_INTERP segment even if we have seen a
2112 --dynamic-linker option. Don't do it if we have seen a PHDRS
2113 clause in a linker script.
2114 (Layout::finalize): Don't create a .interp section if we've
2115 already create a PT_INTERP segment.
2116 (Layout::create_interp): Always call choose_output_section (revert
2117 patch of 2011-06-17). Don't create PT_INTERP segment.
2118 * script-sections.cc
2119 (Script_sections::create_note_and_tls_segments): Add a .interp
2120 section to a PT_INTERP segment even if we have seen a
2121 --dynamic-linker option.
2122
2123 2011-06-18 Ian Lance Taylor <iant@google.com>
2124
2125 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2126 merely because a non-PT_LOAD segment has a dynamic reloc.
2127
2128 2011-06-18 Ian Lance Taylor <iant@google.com>
2129
2130 * layout.cc (Layout::finish_dynamic_section): Don't create
2131 DT_FLAGS entry if not needed.
2132
2133 2011-06-18 Ian Lance Taylor <iant@google.com>
2134
2135 PR gold/12745
2136 * layout.cc (Layout::layout_eh_frame): Correct handling of
2137 writable .eh_frame section.
2138
2139 2011-06-17 Ian Lance Taylor <iant@google.com>
2140
2141 PR gold/12893
2142 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2143 symbol is redefined with the exact same object and value.
2144
2145 2011-06-17 Ian Lance Taylor <iant@google.com>
2146
2147 PR gold/12880
2148 * layout.h (class Layout): Add interp_segment_ field.
2149 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2150 (Layout::attach_allocated_section_to_segment): If making shared
2151 library, put .interp section in PT_INTERP segment.
2152 (Layout::finalize): Also call create_interp if -dynamic-linker
2153 option was used.
2154 (Layout::create_interp): Assert that there is no PT_INTERP
2155 segment. If not using a SECTIONS clause, use make_output_section.
2156 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2157 * script-sections.cc
2158 (Script_sections::create_note_and_tls_segments): If making shared
2159 library, put .interp section in PT_INTERP segment.
2160
2161 2011-06-17 Ian Lance Taylor <iant@google.com>
2162
2163 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2164 when making a shared library.
2165
2166 2011-06-17 Ian Lance Taylor <iant@google.com>
2167
2168 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2169 parameter. Change all callers. Don't issue warning about PC32
2170 against locally defined symbol.
2171
2172 2011-06-16 Ian Lance Taylor <iant@google.com>
2173
2174 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2175 occurs in same object.
2176
2177 2011-06-14 Alan Modra <amodra@gmail.com>
2178
2179 * po/POTFILES.in: Regenerate.
2180
2181 2011-06-09 Ian Lance Taylor <iant@google.com>
2182
2183 * script-sections.cc
2184 (Orphan_output_section::set_section_addresses): For a relocatable
2185 link set address to 0.
2186
2187 2011-06-09 Cary Coutant <ccoutant@google.com>
2188
2189 PR gold/12804
2190 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2191 used with --compress-debug-sections.
2192 * gold/object.cc (Sized_relobj_file::do_layout): Report
2193 uncompressed size of compressed input sections.
2194
2195 2011-06-08 Cary Coutant <ccoutant@google.com>
2196
2197 PR gold/12804
2198 * testsuite/two_file_test_2_v1.cc: Change initialization of
2199 v2 to keep it in .data.
2200
2201 2011-06-07 Cary Coutant <ccoutant@google.com>
2202
2203 * common.cc (Symbol_table::do_allocate_commons_list): Call
2204 gold_fallback.
2205 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2206 (Errors::fallback): New function.
2207 (gold_fallback): New function.
2208 * errors.h (Errors::fallback): New function.
2209 * gold.cc (gold_exit): Change status parameter to enum; adjust
2210 all callers.
2211 (queue_initial_tasks): Call gold_fallback.
2212 * gold.h: Include cstdlib.
2213 (Exit_status): New enum type.
2214 (gold_exit): Change status parameter to enum.
2215 (gold_fallback): New function.
2216 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2217 (Layout::create_symtab_sections): Likewise.
2218 (Layout::create_shdrs): Likewise.
2219 * main.cc (main): Adjust call to gold_exit.
2220 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2221 (Output_data_got::add_got_entry_pair): Likewise.
2222 (Output_section::add_input_section): Likewise.
2223 (Output_section::add_output_section_data): Likewise.
2224 (Output_segment::set_section_list_addresses): Likewise.
2225 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2226
2227 2011-06-07 Cary Coutant <ccoutant@google.com>
2228
2229 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2230 for incremental links.
2231 * output.cc (Output_segment::set_section_list_addresses): Remove
2232 FIXME and test for TLS or BSS.
2233
2234 2011-06-07 Cary Coutant <ccoutant@google.com>
2235
2236 * testsuite/Makefile.am: Add incremental_copy_test,
2237 incremental_common_test_1.
2238 * testsuite/Makefile.in: Regenerate.
2239 * testsuite/common_test_1_v1.c: New source file.
2240 * testsuite/common_test_1_v2.c: New source file.
2241 * testsuite/copy_test_v1.cc: New source file.
2242
2243 2011-06-07 Cary Coutant <ccoutant@google.com>
2244
2245 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2246 update, allocate common from bss section's free list.
2247 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2248 linker-defined symbols.
2249 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2250 Skip GOT and PLT entries that are no longer referenced.
2251 (Output_section_incremental_inputs::write_info_blocks): Mark
2252 linker-defined symbols.
2253 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2254 * output.cc (Output_section::allocate): New function.
2255 * output.h (Output_section::allocate): New function.
2256 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2257 linker-defined symbols.
2258 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2259 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2260 (Symbol::init_base_output_data): Likewise.
2261 (Symbol::init_base_output_segment): Likewise.
2262 (Symbol::init_base_constant): Likewise.
2263 (Sized_symbol::init_output_data): Likewise.
2264 (Sized_symbol::init_output_segment): Likewise.
2265 (Sized_symbol::init_constant): Likewise.
2266 (Symbol_table::do_define_in_output_data): Likewise.
2267 (Symbol_table::do_define_in_output_segment): Likewise.
2268 (Symbol_table::do_define_as_constant): Likewise.
2269 * symtab.h (Symbol::is_predefined): New function.
2270 (Symbol::init_base_output_data): Add is_predefined parameter.
2271 (Symbol::init_base_output_segment): Likewise.
2272 (Symbol::init_base_constant): Likewise.
2273 (Symbol::is_predefined_): New data member.
2274 (Sized_symbol::init_output_data): Add is_predefined parameter.
2275 (Sized_symbol::init_output_segment): Likewise.
2276 (Sized_symbol::init_constant): Likewise.
2277 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2278
2279 2011-06-07 Cary Coutant <ccoutant@google.com>
2280
2281 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2282 instead of emit_copy_reloc.
2283 (Copy_relocs::emit_copy_reloc): Refactor.
2284 (Copy_relocs::make_copy_reloc): New function.
2285 (Copy_relocs::add_copy_reloc): Remove.
2286 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2287 section.
2288 (Copy_relocs::make_copy_reloc): New function.
2289 (Copy_relocs::add_copy_reloc): Remove.
2290 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2291 unchanged input files.
2292 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2293 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2294 Reserve BSS space for COPY relocations.
2295 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2296 (Output_section_incremental_inputs::write_info_blocks): Record
2297 whether a symbol is copied from a shared object.
2298 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2299 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2300 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2301 (Incremental_input_entry_reader::get_output_symbol_index): Add
2302 is_copy parameter.
2303 (Incremental_binary::emit_copy_relocs): New function.
2304 (Incremental_binary::do_emit_copy_relocs): New function.
2305 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2306 new data member.
2307 (Sized_incremental_binary::add_copy_reloc): New function.
2308 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2309 (Sized_incremental_binary::Copy_reloc): New struct.
2310 (Sized_incremental_binary::Copy_relocs): New typedef.
2311 (Sized_incremental_binary::copy_relocs_): New data member.
2312 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2313 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2314 * target.h (Sized_target::emit_copy_reloc): New function.
2315 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2316
2317 2011-06-02 Cary Coutant <ccoutant@google.com>
2318
2319 PR gold/12163
2320 * gold/archive.cc (Archive::Archive): Initialize new data member.
2321 (Archive::include_all_members): Return if archive has already been
2322 included.
2323 * gold/archive.h (Archive::include_all_members_): New data member.
2324
2325 2011-06-02 Nick Clifton <nickc@redhat.com>
2326
2327 * dynobj.h: Fix spelling mistake in comment.
2328 * output.cc: Likewise.
2329
2330 2011-05-31 Doug Kwan <dougkwan@google.com>
2331 Asier Llano
2332
2333 PR gold/12826
2334 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2335 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2336 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2337 redundant arm_exidx_test.so.
2338 * testsuite/Makefile.in: Regenerate.
2339 (check_SCRIPTS): Add pr12826.sh
2340 (check_DATA): Add pr12826.stdout
2341 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2342 * testsuite/pr12826.sh: New file.
2343 * testsuite/pr12826_1.s: Ditto.
2344 * testsuite/pr12826_1.s: Ditto.
2345
2346 2011-05-30 Ian Lance Taylor <iant@google.com>
2347
2348 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2349 sections.
2350
2351 2011-05-29 Ian Lance Taylor <iant@google.com>
2352
2353 PR gold/12804
2354 * testsuite/Makefile.am: Use different file name for two_file_test
2355 temporary file for each incremental test.
2356 * testsuite/Makefile.in: Rebuild.
2357
2358 2011-05-29 Ian Lance Taylor <iant@google.com>
2359
2360 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2361 binary input file is empty.
2362
2363 2011-05-27 Ian Lance Taylor <iant@google.com>
2364
2365 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2366 (ver_test_9.so): Likewise.
2367 * testsuite/Makefile.in: Rebuild.
2368
2369 2011-05-26 Cary Coutant <ccoutant@google.com>
2370
2371 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2372 * incremental.cc (Incremental_inputs::report_input_section): Fix
2373 comment, indentation.
2374 (Incremental_inputs::report_comdat_group): New function.
2375 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2376 of data for incremental input file entry.
2377 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2378 group count, COMDAT group signatures.
2379 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2380 an unchanged input file.
2381 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2382 Initialize new data member.
2383 (Incremental_object_entry::add_comdat_group): New function.
2384 (Incremental_object_entry::get_comdat_group_count): New function.
2385 (Incremental_object_entry::get_comdat_signature_key): New function.
2386 (Incremental_object_entry::groups_): New data member.
2387 (Incremental_inputs::report_comdat_group): New function.
2388 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2389 data for incremental input file entry.
2390 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2391 (Incremental_input_entry_reader::get_input_section): Adjust size of
2392 data for incremental input file entry.
2393 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2394 (Incremental_input_entry_reader::get_comdat_group_signature): New
2395 function.
2396 * object.cc (Sized_relobj::include_section_group): Report kept
2397 COMDAT groups for incremental links.
2398
2399 2011-05-24 David Meyer <pdox@google.com>
2400
2401 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2402 with name parameter. Add found_name parameter.
2403 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2404 * dirsearch.h (class Dirsearch): Update declaration.
2405
2406 2011-05-24 Ian Lance Taylor <iant@google.com>
2407
2408 * archive.cc (Library_base::should_include_member): Pull in object
2409 from archive if it defines the entry symbol.
2410 * parameters.cc (Parameters::entry): New function.
2411 * parameters.h (class Parameters): Declare entry.
2412 * output.h (class Output_file_header): Remove entry_ field.
2413 * output.cc (Output_file_header::Output_file_header): Remove entry
2414 parameter. Change all callers.
2415 (Output_file_header::entry): Use parameters->entry.
2416 * gold.cc (queue_middle_tasks): Likewise.
2417 * plugin.cc (Plugin_hook::run): Likewise.
2418
2419 2011-05-24 Cary Coutant <ccoutant@google.com>
2420
2421 * gold.cc (queue_initial_tasks): Pass incremental base filename
2422 to Output_file::open_base_file; don't print error message.
2423 * incremental-dump.cc (main): Adjust call to
2424 Output_file::open_for_modification.
2425 * incremental-dump.cc (main): Likewise.
2426 * incremental.cc (Incremental_inputs::report_command_line):
2427 Ignore --incremental-base option when comparing command lines.
2428 Ignore parameter when given as separate argument.
2429 * options.h (class General_options): Add --incremental-base.
2430 * output.cc (Output_file::Output_file):
2431 (Output_file::open_base_file): Add base_name and writable parameters;
2432 read base file into new file; print error message here.
2433 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2434 callers.
2435 * output.h (Output_file::open_for_modification): Rename to...
2436 (Output_file::open_base_file): ...this; add base_name and
2437 writable parameters; adjust all callers.
2438 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2439 callers.
2440 * testsuite/Makefile.am (incremental_test_4): Test
2441 --incremental-base.
2442 * testsuite/Makefile.in: Regenerate.
2443
2444 2011-05-24 Cary Coutant <ccoutant@google.com>
2445
2446 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2447 incremental_test_4.
2448 * testsuite/Makefile.in: Regenerate.
2449 * testsuite/two_file_test_1_v1.cc: New test source file.
2450 * testsuite/two_file_test_1b_v1.cc: New test source file.
2451 * testsuite/two_file_test_2_v1.cc: New test source file.
2452
2453 2011-05-24 Cary Coutant <ccoutant@google.com>
2454
2455 * dynobj.h (Dynobj::do_dynobj): New function.
2456 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2457 flag and soname for shared objects.
2458 * incremental.cc (Incremental_inputs::report_object): Make
2459 either Incremental_object_entry or Incremental_dynobj_entry; add
2460 soname to string table.
2461 (Incremental_inputs::report_input_section): Add assertion.
2462 (Output_section_incremental_inputs::set_final_data_size): Adjust
2463 type of input file entry for shared libraries; adjust size of
2464 shared library info entry.
2465 (Output_section_incremental_inputs::write_input_files): Write
2466 as_needed flag for shared libraries.
2467 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2468 of input file entry for shared libraries; write soname.
2469 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2470 soname from incremental info.
2471 * incremental.h (enum Incremental_input_flags): Add
2472 INCREMENTAL_INPUT_AS_NEEDED.
2473 (Incremental_input_entry::Incremental_input_entry): Initialize new
2474 data member.
2475 (Incremental_input_entry::set_as_needed): New function.
2476 (Incremental_input_entry::as_needed): New function.
2477 (Incremental_input_entry::do_dynobj_entry): New function.
2478 (Incremental_input_entry::as_needed_): New data member.
2479 (Incremental_object_entry::Incremental_object_entry): Don't check
2480 for shared library.
2481 (Incremental_object_entry::do_type): Likewise.
2482 (class Incremental_dynobj_entry): New class.
2483 (Incremental_input_entry_reader::as_needed): New function.
2484 (Incremental_input_entry_reader::get_soname): New function.
2485 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2486 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2487 size of shared library info entry.
2488 * layout.cc (Layout::finish_dynamic_section): Don't test for
2489 incremental link when adding DT_NEEDED entries.
2490 * object.h (Object::Object): Initialize new data member.
2491 (Object::dynobj): New function.
2492 (Object::set_as_needed): New function.
2493 (Object::as_needed): New function.
2494 (Object::do_dynobj): New function.
2495 (Object::as_needed_): New data member.
2496
2497 2011-05-24 Cary Coutant <ccoutant@google.com>
2498
2499 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2500 info; adjust display of GOT entries.
2501 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2502 vector of input objects; remove file_status_.
2503 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2504 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2505 got_plt reader; call target hooks to reserve GOT entries.
2506 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2507 of input file info header and GOT info entry.
2508 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2509 relocation info.
2510 (Got_plt_view_info::got_descriptor): Remove.
2511 (Got_plt_view_info::sym_index): New data member.
2512 (Got_plt_view_info::input_index): New data member.
2513 (Local_got_offset_visitor::visit): Write input file index.
2514 (Global_got_offset_visitor::visit): Write 0 for input file index.
2515 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2516 with sym_index and input_index.
2517 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2518 incremental info GOT entry; replace got_descriptor with input_index.
2519 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2520 map from input file index to object.
2521 (Sized_relobj_incr::do_layout): Replace direct data member reference
2522 with accessor function.
2523 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2524 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2525 Adjust size of input file info header.
2526 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2527 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2528 (Incremental_input_entry_reader::get_input_section): Adjust size of
2529 input file info header.
2530 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2531 of incremental info GOT entry.
2532 (Incremental_got_plt_reader::get_got_desc): Remove.
2533 (Incremental_got_plt_reader::get_got_symndx): New function.
2534 (Incremental_got_plt_reader::get_got_input_index): New function.
2535 (Sized_incremental_binary::Sized_incremental_binary): Remove
2536 file_status_; add input_objects_.
2537 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2538 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2539 (Sized_incremental_binary::file_is_unchanged): Remove.
2540 (Sized_incremental_binary::set_input_object): New function.
2541 (Sized_incremental_binary::input_object): New function.
2542 (Sized_incremental_binary::file_status_): Remove.
2543 (Sized_incremental_binary::input_objects_): New data member.
2544 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2545 references.
2546 (Sized_relobj_incr::invalid_address): Move to base class.
2547 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2548 class.
2549 (Sized_relobj_incr::do_output_section_offset): Likewise.
2550 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2551 (Sized_relobj_incr::section_offsets_): Likewise.
2552 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2553 function.
2554 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2555 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2556 with accessor function.
2557 (Sized_relobj_file::do_layout): Likewise.
2558 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2559 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2560 (Sized_relobj_file::compute_final_local_value): Replace refs to
2561 section_offsets_ with accessor function.
2562 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2563 * object.h (Relobj::Relobj): Initialize new data members.
2564 (Relobj::add_dyn_reloc): New function.
2565 (Relobj::first_dyn_reloc): New function.
2566 (Relobj::dyn_reloc_count): New function.
2567 (Relobj::first_dyn_reloc_): New data member.
2568 (Relobj::dyn_reloc_count_): New data member.
2569 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2570 references.
2571 (Sized_relobj::Address): New typedef.
2572 (Sized_relobj::invalid_address): Move here from child class.
2573 (Sized_relobj::Sized_relobj): Initialize new data members.
2574 (Sized_relobj::sized_relobj): New function.
2575 (Sized_relobj::is_output_section_offset_invalid): Move here from
2576 child class.
2577 (Sized_relobj::get_output_section_offset): Likewise.
2578 (Sized_relobj::local_has_got_offset): Likewise.
2579 (Sized_relobj::local_got_offset): Likewise.
2580 (Sized_relobj::set_local_got_offset): Likewise.
2581 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2582 (Sized_relobj::clear_got_offsets): New function.
2583 (Sized_relobj::section_offsets): Move here from child class.
2584 (Sized_relobj::do_output_section_offset): Likewise.
2585 (Sized_relobj::do_set_section_offset): Likewise.
2586 (Sized_relobj::Local_got_offsets): Likewise.
2587 (Sized_relobj::local_got_offsets_): Likewise.
2588 (Sized_relobj::section_offsets_): Likewise.
2589 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2590 references.
2591 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2592 class.
2593 (Sized_relobj_file::sized_relobj): New function
2594 (Sized_relobj_file::local_has_got_offset): Move to base class.
2595 (Sized_relobj_file::local_got_offset): Likewise.
2596 (Sized_relobj_file::set_local_got_offset): Likewise.
2597 (Sized_relobj_file::get_output_section_offset): Likewise.
2598 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2599 (Sized_relobj_file::do_output_section_offset): Likewise.
2600 (Sized_relobj_file::do_set_section_offset): Likewise.
2601 (Sized_relobj_file::Local_got_offsets): Likewise.
2602 (Sized_relobj_file::local_got_offsets_): Likewise.
2603 (Sized_relobj_file::section_offsets_): Likewise.
2604 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2605 (all constructors).
2606 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2607 (Output_reloc::get_symbol_index): Likewise.
2608 (Output_reloc::local_section_offset): Likewise.
2609 (Output_reloc::get_address): Likewise.
2610 (Output_reloc::symbol_value): Likewise.
2611 (Output_data_got::reserve_slot): Move to class definition.
2612 (Output_data_got::reserve_local): New function.
2613 (Output_data_got::reserve_slot_for_global): Remove.
2614 (Output_data_got::reserve_global): New function.
2615 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2616 (all constructors, two instantiations).
2617 (Output_reloc::get_relobj): New function (two instantiations).
2618 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2619 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2620 (Output_data_reloc::add_global): Adjust type of relobj.
2621 (Output_data_reloc::add_global_relative): Likewise.
2622 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2623 (Output_data_reloc::add_local): Likewise.
2624 (Output_data_reloc::add_local_relative): Likewise.
2625 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2626 (Output_data_reloc::add_local_section): Likewise.
2627 (Output_data_reloc::add_output_section): Likewise.
2628 (Output_data_reloc::add_absolute): Likewise.
2629 (Output_data_reloc::add_target_specific): Likewise.
2630 (Output_data_got::reserve_slot): Move definition here.
2631 (Output_data_got::reserve_local): New function.
2632 (Output_data_got::reserve_global): New function.
2633 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2634 section_offsets_ with accessor function.
2635 (Sized_relobj_file::write_sections): Likewise.
2636 (Sized_relobj_file::do_relocate_sections): Likewise.
2637 * target.h (Sized_target::reserve_local_got_entry): New function.
2638 (Sized_target::reserve_global_got_entry): New function.
2639 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2640 (Target_x86_64::reserve_global_got_entry): New function.
2641 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2642
2643 2011-05-23 Cary Coutant <ccoutant@google.com>
2644
2645 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2646 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2647 bit when checking got_type.
2648 * incremental.cc (Sized_incremental_binary::setup_readers):
2649 Store symbol table and string table locations; initialize bit vector
2650 of file status flags.
2651 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2652 unchanged files.
2653 (Sized_incremental_binary::do_process_got_plt): New function.
2654 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2655 (Output_section_incremental_inputs::set_final_data_size): Record
2656 file index for each input file.
2657 (Output_section_incremental_inputs::write_got_plt): Store file index
2658 instead of input entry offset for each GOT entry.
2659 * incremental.h
2660 (Incremental_input_entry::Incremental_input_entry): Initialize new
2661 data member.
2662 (Incremental_input_entry::set_offset): Store file index.
2663 (Incremental_input_entry::get_file_index): New function.
2664 (Incremental_input_entry::file_index_): New data member.
2665 (Incremental_binary::process_got_plt): New function.
2666 (Incremental_binary::do_process_got_plt): New function.
2667 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2668 data members.
2669 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2670 (Sized_incremental_binary::set_file_is_unchanged): New function.
2671 (Sized_incremental_binary::file_is_unchanged): New function.
2672 (Sized_incremental_binary::do_process_got_plt): New function.
2673 (Sized_incremental_binary::file_status_): New data member.
2674 (Sized_incremental_binary::main_symtab_loc_): New data member.
2675 (Sized_incremental_binary::main_strtab_loc_): New data member.
2676 * output.cc (Output_data_got::Got_entry::write): Add case
2677 RESERVED_CODE.
2678 (Output_data_got::add_global): Call add_got_entry.
2679 (Output_data_got::add_global_plt): Likewise.
2680 (Output_data_got::add_global_with_rel): Likewise.
2681 (Output_data_got::add_global_with_rela): Likewise.
2682 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2683 (Output_data_got::add_global_pair_with_rela): Likewise.
2684 (Output_data_got::add_local): Call add_got_entry.
2685 (Output_data_got::add_local_plt): Likewise.
2686 (Output_data_got::add_local_with_rel): Likewise.
2687 (Output_data_got::add_local_with_rela): Likewise.
2688 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2689 (Output_data_got::add_local_pair_with_rela): Likewise.
2690 (Output_data_got::reserve_slot): New function.
2691 (Output_data_got::reserve_slot_for_global): New function.
2692 (Output_data_got::add_got_entry): New function.
2693 (Output_data_got::add_got_entry_pair): New function.
2694 (Output_section::add_output_section_data): Edit FIXME.
2695 * output.h
2696 (Output_section_data_build::Output_section_data_build): New
2697 constructor with size parameter.
2698 (Output_data_space::Output_data_space): Likewise.
2699 (Output_data_got::Output_data_got): Initialize new data member; new
2700 constructor with size parameter.
2701 (Output_data_got::add_constant): Call add_got_entry.
2702 (Output_data_got::reserve_slot): New function.
2703 (Output_data_got::reserve_slot_for_global): New function.
2704 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2705 (Output_data_got::add_got_entry): New function.
2706 (Output_data_got::add_got_entry_pair): New function.
2707 (Output_data_got::free_list_): New data member.
2708 * target.h (Sized_target::init_got_plt_for_update): New function.
2709 (Sized_target::register_global_plt_entry): New function.
2710 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2711 Initialize new data member; call init; add constructor with PLT count.
2712 (Output_data_plt_x86_64::init): New function.
2713 (Output_data_plt_x86_64::add_relocation): New function.
2714 (Output_data_plt_x86_64::reserve_slot): New function.
2715 (Output_data_plt_x86_64::free_list_): New data member.
2716 (Target_x86_64::init_got_plt_for_update): New function.
2717 (Target_x86_64::register_global_plt_entry): New function.
2718 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2719 incremental updates.
2720 (Output_data_plt_x86_64::add_relocation): New function.
2721 * testsuite/object_unittest.cc (Object_test): Set default options.
2722
2723 2011-05-16 Ian Lance Taylor <iant@google.com>
2724
2725 * options.h (class General_options): Make -i a synonym for -r.
2726
2727 2011-05-16 Ian Lance Taylor <iant@google.com>
2728
2729 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2730
2731 2011-05-10 Cary Coutant <ccoutant@google.com>
2732
2733 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2734 strip_all (-s).
2735
2736 2011-05-06 Ian Lance Taylor <iant@google.com>
2737
2738 * layout.cc (Layout::layout): If the output section flags change,
2739 update the ordering.
2740
2741 2011-04-25 Cary Coutant <ccoutant@google.com>
2742
2743 * incremental-dump.cc (dump_incremental_inputs): Print local
2744 symbol info for each input file.
2745 * incremental.cc
2746 (Output_section_incremental_inputs::set_final_data_size): Add local
2747 symbol info to input file entries in incremental info.
2748 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2749 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2750 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2751 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2752 implementation.
2753 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2754 (Sized_incr_relobj::do_relocate): Write the local symbols.
2755 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2756 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2757 Adjust size of input file header.
2758 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2759 (Incremental_inputs_reader::get_local_symbol_count): New function.
2760 (Incremental_inputs_reader::get_input_section): Adjust size of input
2761 file header.
2762 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2763 (Sized_incr_relobj::This): New typedef.
2764 (Sized_incr_relobj::sym_size): New const data member.
2765 (Sized_incr_relobj::Local_symbol): New struct.
2766 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2767 (Sized_incr_relobj::do_local_symbol_offset): New function.
2768 (Sized_incr_relobj::local_symbol_count_): New data member.
2769 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2770 (Sized_incr_relobj::local_symbol_index_): New data member.
2771 (Sized_incr_relobj::local_symbol_offset_): New data member.
2772 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2773 (Sized_incr_relobj::local_symbols_): New data member.
2774 * object.h (Relobj::output_local_symbol_count): New function.
2775 (Relobj::local_symbol_offset): New function.
2776 (Relobj::do_output_local_symbol_count): New function.
2777 (Relobj::do_local_symbol_offset): New function.
2778 (Sized_relobj::do_output_local_symbol_count): New function.
2779 (Sized_relobj::do_local_symbol_offset): New function.
2780
2781 2011-04-22 Vladimir Simonov <sv@sw.ru>
2782
2783 * descriptors.cc (set_close_on_exec): New function.
2784 (Descriptors::open): Use set_close_on_exec.
2785 * output.cc (S_ISLNK): Define if not defined.
2786
2787 2011-04-22 Cary Coutant <ccoutant@google.com>
2788
2789 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2790 global symbol map.
2791 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2792 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2793 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2794 relocations.
2795 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2796 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2797 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2798 * incremental.h
2799 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2800 function.
2801 (Incremental_binary::apply_incremental_relocs): New function.
2802 (Incremental_binary::do_apply_incremental_relocs): New function.
2803 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2804 data member.
2805 (Sized_incremental_binary::add_global_symbol): New function.
2806 (Sized_incremental_binary::global_symbol): New function.
2807 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2808 (Sized_incremental_binary::symbol_map_): New data member.
2809 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2810 * target.h (Sized_target::apply_relocation): New function.
2811 * target-reloc.h (apply_relocation): New function.
2812 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2813
2814 2011-04-22 Doug Kwan <dougkwan@google.com>
2815
2816 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2817 flag of a SHT_ARM_EXIDX section.
2818 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2819 * testsuite/Makefile.in: Regenerate.
2820 * testsuite/arm_exidx_test.s: New file.
2821 * testsuite/arm_exidx_test.sh: Same.
2822
2823 2011-04-20 Cary Coutant <ccoutant@google.com>
2824
2825 PR gold/12689
2826 * archive.h (Incremental_archive_entry::Archive_member):
2827 Initialize arg_serial_ (second constructor).
2828
2829 2011-04-17 Ian Lance Taylor <iant@google.com>
2830
2831 * object.cc (Relocate_info::location): Simplify location string.
2832 * errors.cc (Errors::error_at_location): Don't print program
2833 name.
2834 (Errors::warning_at_location): Likewise.
2835 (Errors::undefined_symbol): Likewise.
2836 * testsuite/debug_msg.sh: Update accordingly.
2837
2838 2011-04-14 Cary Coutant <ccoutant@google.com>
2839
2840 * gold/layout.cc (Layout::symtab_section_offset): New function.
2841 * gold/layout.h (Layout::symtab_section_offset): New function.
2842 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2843
2844 2011-04-12 Ian Lance Taylor <iant@google.com>
2845
2846 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2847 with MREMAP_MAYMOVE.
2848 * output.h (class Output_file): Add map_is_allocated_ field.
2849 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2850 not available, provide stubs. If mremap is not available, #define
2851 it to gold_mremap.
2852 (MREMAP_MAYMOVE): Define if not defined.
2853 (Output_file::Output_file): Initialize map_is_allocated_.
2854 (Output_file::resize): Check map_is_allocated_.
2855 (Output_file::map_anonymous): If mmap fails, use malloc.
2856 (Output_file::unmap): Don't do anything for an anonymous map.
2857 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2858 is not available, provide stubs.
2859 (File_read::View::~View): Use free rather than delete[].
2860 (File_read::make_view): Use malloc rather than new[]. If mmap
2861 fails, use malloc.
2862 (File_read::find_or_make_view): Use malloc rather than new[].
2863 * gold.h: Remove HAVE_REMAP code.
2864 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2865 exists. Rename mremap to gold_mremap. If mmap is not available
2866 don't do anything.
2867 * configure, config.in: Rebuild.
2868
2869 2011-04-11 Ian Lance Taylor <iant@google.com>
2870
2871 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2872 initialize local variable v.
2873
2874 2011-04-11 Cary Coutant <ccoutant@google.com>
2875
2876 * archive.cc (Archive::include_member): Adjust call to
2877 report_object.
2878 (Add_archive_symbols::run): Track argument serial numbers.
2879 (Lib_group::include_member): Likewise.
2880 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2881 * archive.h (Incremental_archive_entry::Archive_member):
2882 Initialize arg_serial_.
2883 (Archive_member::arg_serial_): New data member.
2884 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2885 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2886 incremental link.
2887 (Sized_dynobj::do_for_all_local_got_entries): New function.
2888 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2889 function.
2890 * fileread.cc (get_mtime): New function.
2891 * fileread.h (get_mtime): New function.
2892 * gold.cc (queue_initial_tasks): Check for incremental update.
2893 (process_incremental_input): New function.
2894 (queue_middle_tasks): Don't force valid target for incremental
2895 update.
2896 * incremental-dump.cc (find_input_containing_global): Adjust
2897 size of symbol info entry.
2898 (dump_incremental_inputs): Dump argument serial number and
2899 in_system_directory flag; bias shndx by 1; print symbol names
2900 when dumping per-file symbol lists; use new symbol info readers.
2901 * incremental.cc
2902 (Output_section_incremental_inputs:update_data_size): New function.
2903 (Sized_incremental_binary::setup_readers): Setup input readers
2904 for each input file; build maps for files added from libraries
2905 and scripts.
2906 (Sized_incremental_binary::check_input_args): New function.
2907 (Sized_incremental_binary::do_check_inputs): Build map of argument
2908 serial numbers to input arguments.
2909 (Sized_incremental_binary::do_file_has_changed): Rename
2910 do_file_is_unchanged to this; compare file modification times.
2911 (Sized_incremental_binary::do_init_layout): New function.
2912 (Sized_incremental_binary::do_reserve_layout): New function.
2913 (Sized_incremental_binary::do_get_input_reader): Remove.
2914 (Sized_incremental_binary::get_symtab_view): New function.
2915 (Incremental_checker::can_incrementally_link_output_file): Remove.
2916 (Incremental_inputs::report_command_line): Exclude --debug options.
2917 (Incremental_inputs::report_archive_begin): Add parameter; track
2918 argument serial numbers; don't put input file entry for archive
2919 before archive members.
2920 (Incremental_inputs::report_archive_end): Put input file entry
2921 for archive after archive members.
2922 (Incremental_inputs::report_object): Add parameter; track argument
2923 serial numbers and in_system_directory flag.
2924 (Incremental_inputs::report_script): Add parameter; track argument
2925 serial numbers.
2926 (Output_section_incremental_inputs::set_final_data_size): Adjust
2927 size of symbol info entry; check for forwarding symbols.
2928 (Output_section_incremental_inputs::write_input_files): Write
2929 in_system_directory flag and argument serial number.
2930 (Output_section_incremental_inputs::write_info_blocks): Map section
2931 indices between incremental info and original input file; store
2932 input section index for each symbol.
2933 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2934 change operator() to visit().
2935 (class Global_got_offset_visitor): Likewise.
2936 (class Global_symbol_visitor_got_plt):
2937 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2938 classes.
2939 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2940 (Sized_incr_relobj::do_read_symbols): New function.
2941 (Sized_incr_relobj::do_layout): New function.
2942 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2943 (Sized_incr_relobj::do_add_symbols): New function.
2944 (Sized_incr_relobj::do_should_include_member): New function.
2945 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2946 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2947 (Sized_incr_relobj::do_section_size): New function.
2948 (Sized_incr_relobj::do_section_name): New function.
2949 (Sized_incr_relobj::do_section_contents): New function.
2950 (Sized_incr_relobj::do_section_flags): New function.
2951 (Sized_incr_relobj::do_section_entsize): New function.
2952 (Sized_incr_relobj::do_section_address): New function.
2953 (Sized_incr_relobj::do_section_type): New function.
2954 (Sized_incr_relobj::do_section_link): New function.
2955 (Sized_incr_relobj::do_section_info): New function.
2956 (Sized_incr_relobj::do_section_addralign): New function.
2957 (Sized_incr_relobj::do_initialize_xindex): New function.
2958 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2959 (Sized_incr_relobj::do_read_relocs): New function.
2960 (Sized_incr_relobj::do_gc_process_relocs): New function.
2961 (Sized_incr_relobj::do_scan_relocs): New function.
2962 (Sized_incr_relobj::do_count_local_symbols): New function.
2963 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2964 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2965 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2966 (Sized_incr_relobj::do_relocate): New function.
2967 (Sized_incr_relobj::do_set_section_offset): New function.
2968 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2969 (Sized_incr_dynobj::do_read_symbols): New function.
2970 (Sized_incr_dynobj::do_layout): New function.
2971 (Sized_incr_dynobj::do_add_symbols): New function.
2972 (Sized_incr_dynobj::do_should_include_member): New function.
2973 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2974 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2975 (Sized_incr_dynobj::do_section_size): New function.
2976 (Sized_incr_dynobj::do_section_name): New function.
2977 (Sized_incr_dynobj::do_section_contents): New function.
2978 (Sized_incr_dynobj::do_section_flags): New function.
2979 (Sized_incr_dynobj::do_section_entsize): New function.
2980 (Sized_incr_dynobj::do_section_address): New function.
2981 (Sized_incr_dynobj::do_section_type): New function.
2982 (Sized_incr_dynobj::do_section_link): New function.
2983 (Sized_incr_dynobj::do_section_info): New function.
2984 (Sized_incr_dynobj::do_section_addralign): New function.
2985 (Sized_incr_dynobj::do_initialize_xindex): New function.
2986 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2987 (make_sized_incremental_object): New function.
2988 (Incremental_library::copy_unused_symbols): New function.
2989 (Incremental_library::do_for_all_unused_symbols): New function.
2990 * incremental.h (enum Incremental_input_flags): New type.
2991 (class Incremental_checker): Remove.
2992 (Incremental_input_entry::Incremental_input_entry): Add argument
2993 serial number.
2994 (Incremental_input_entry::arg_serial): New function.
2995 (Incremental_input_entry::set_is_in_system_directory): New function.
2996 (Incremental_input_entry::is_in_system_directory): New function.
2997 (Incremental_input_entry::arg_serial_): New data member.
2998 (Incremental_input_entry::is_in_system_directory_): New data member.
2999 (class Script_info): Move here from script.h.
3000 (Script_info::Script_info): Add filename parameter.
3001 (Script_info::filename): New function.
3002 (Script_info::filename_): New data member.
3003 (Incremental_script_entry::Incremental_script_entry): Add argument
3004 serial number.
3005 (Incremental_object_entry::Incremental_object_entry): Likewise.
3006 (Incremental_object_entry::add_input_section): Build list of input
3007 sections with map to original shndx.
3008 (Incremental_object_entry::get_input_section_index): New function.
3009 (Incremental_object_entry::shndx_): New data member.
3010 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3011 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3012 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3013 serial number.
3014 (Incremental_inputs::report_archive_begin): Likewise.
3015 (Incremental_inputs::report_object): Likewise.
3016 (Incremental_inputs::report_script): Likewise.
3017 (class Incremental_global_symbol_reader): New class.
3018 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3019 and store flags and input file type.
3020 (Incremental_input_entry_reader::arg_serial): New function.
3021 (Incremental_input_entry_reader::type): Extract type from flags.
3022 (Incremental_input_entry_reader::is_in_system_directory): New function.
3023 (Incremental_input_entry_reader::get_input_section_count): Call
3024 accessor function for type.
3025 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3026 function for type; adjust size of global symbol entry.
3027 (Incremental_input_entry_reader::get_global_symbol_count): Call
3028 accessor function for type.
3029 (Incremental_input_entry_reader::get_object_count): Likewise.
3030 (Incremental_input_entry_reader::get_object_offset): Likewise.
3031 (Incremental_input_entry_reader::get_member_count): Likewise.
3032 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3033 (Incremental_input_entry_reader::get_member_offset): Likewise.
3034 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3035 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3036 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3037 (Incremental_input_entry_reader::get_global_symbol_reader): New
3038 function.
3039 (Incremental_input_entry_reader::get_output_symbol_index): New
3040 function.
3041 (Incremental_input_entry_reader::type_): Remove.
3042 (Incremental_input_entry_reader::flags_): New data member.
3043 (Incremental_inputs_reader::input_file_offset): New function.
3044 (Incremental_inputs_reader::input_file_index): New function.
3045 (Incremental_inputs_reader::input_file): Call input_file_offset.
3046 (Incremental_inputs_reader::input_file_at_offset): New function.
3047 (Incremental_relocs_reader::get_r_type): Reformat.
3048 (Incremental_relocs_reader::get_r_shndx): Reformat.
3049 (Incremental_relocs_reader::get_r_offset): Reformat.
3050 (Incremental_relocs_reader::data): New function.
3051 (Incremental_binary::Incremental_binary): Initialize new data members.
3052 (Incremental_binary::check_inputs): Add cmdline parameter.
3053 (Incremental_binary::file_is_unchanged): Remove.
3054 (Input_reader::arg_serial): New function.
3055 (Input_reader::get_unused_symbol_count): New function.
3056 (Input_reader::get_unused_symbol): New function.
3057 (Input_reader::do_arg_serial): New function.
3058 (Input_reader::do_get_unused_symbol_count): New function.
3059 (Input_reader::do_get_unused_symbol): New function.
3060 (Incremental_binary::input_file_count): New function.
3061 (Incremental_binary::get_input_reader): Change signature to use
3062 index instead of filename.
3063 (Incremental_binary::file_has_changed): New function.
3064 (Incremental_binary::get_input_argument): New function.
3065 (Incremental_binary::get_library): New function.
3066 (Incremental_binary::get_script_info): New function.
3067 (Incremental_binary::init_layout): New function.
3068 (Incremental_binary::reserve_layout): New function.
3069 (Incremental_binary::output_file): New function.
3070 (Incremental_binary::do_check_inputs): New function.
3071 (Incremental_binary::do_file_is_unchanged): Remove.
3072 (Incremental_binary::do_file_has_changed): New function.
3073 (Incremental_binary::do_init_layout): New function.
3074 (Incremental_binary::do_reserve_layout): New function.
3075 (Incremental_binary::do_input_file_count): New function.
3076 (Incremental_binary::do_get_input_reader): Change signature.
3077 (Incremental_binary::input_args_map_): New data member.
3078 (Incremental_binary::library_map_): New data member.
3079 (Incremental_binary::script_map_): New data member.
3080 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3081 new data members.
3082 (Sized_incremental_binary::output_section): New function.
3083 (Sized_incremental_binary::inputs_reader): Add const.
3084 (Sized_incremental_binary::symtab_reader): Add const.
3085 (Sized_incremental_binary::relocs_reader): Add const.
3086 (Sized_incremental_binary::got_plt_reader): Add const.
3087 (Sized_incremental_binary::get_symtab_view): New function.
3088 (Sized_incremental_binary::Inputs_reader): New typedef.
3089 (Sized_incremental_binary::Input_entry_reader): New typedef.
3090 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3091 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3092 (Sized_incremental_binary::do_file_has_changed): New function.
3093 (Sized_incremental_binary::do_init_layout): New function.
3094 (Sized_incremental_binary::do_reserve_layout): New function.
3095 (Sized_input_reader::Inputs_reader): Remove.
3096 (Sized_input_reader::Input_entry_reader): Remove.
3097 (Sized_input_reader::do_arg_serial): New function.
3098 (Sized_input_reader::do_get_unused_symbol_count): New function.
3099 (Sized_input_reader::do_get_unused_symbol): New function.
3100 (Sized_incremental_binary::do_input_file_count): New function.
3101 (Sized_incremental_binary::do_get_input_reader): Change signature;
3102 use index instead of filename.
3103 (Sized_incremental_binary::section_map_): New data member.
3104 (Sized_incremental_binary::input_entry_readers_): New data member.
3105 (class Sized_incr_relobj): New class.
3106 (class Sized_incr_dynobj): New class.
3107 (make_sized_incremental_object): New function.
3108 (class Incremental_library): New class.
3109 * layout.cc (Free_list::num_lists): New static data member.
3110 (Free_list::num_nodes): New static data member.
3111 (Free_list::num_removes): New static data member.
3112 (Free_list::num_remove_visits): New static data member.
3113 (Free_list::num_allocates): New static data member.
3114 (Free_list::num_allocate_visits): New static data member.
3115 (Free_list::init): New function.
3116 (Free_list::remove): New function.
3117 (Free_list::allocate): New function.
3118 (Free_list::dump): New function.
3119 (Free_list::print_stats): New function.
3120 (Layout_task_runner::run): Resize output file for incremental updates.
3121 (Layout::Layout): Initialize new data members.
3122 (Layout::set_incremental_base): New function.
3123 (Layout::init_fixed_output_section): New function.
3124 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3125 incremental updates.
3126 (Layout::create_gold_note): Do not create gold note section for
3127 incremental updates.
3128 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3129 for incremental updates.
3130 (Layout::set_section_offsets): For incremental updates, allocate space
3131 from free list.
3132 (Layout::create_symtab_sections): Layout with offsets relative to
3133 start of section; for incremental updates, allocate space from free
3134 list.
3135 (Layout::create_shdrs): For incremental updates, allocate space from
3136 free list.
3137 (Layout::finish_dynamic_section): For incremental updates, do not
3138 check --as-needed (fixed in subsequent patch).
3139 * layout.h (class Free_list): New class.
3140 (Layout::set_incremental_base): New function.
3141 (Layout::incremental_base): New function.
3142 (Layout::init_fixed_output_section): New function.
3143 (Layout::allocate): New function.
3144 (Layout::incremental_base_): New data member.
3145 (Layout::free_list_): New data member.
3146 * main.cc (main): Print Free_list statistics.
3147 * object.cc (Relobj::finalize_incremental_relocs): Add
3148 clear_counts parameter; clear counts only when clear_counts is set.
3149 (Sized_relobj::Sized_relobj): Initialize new base class.
3150 (Sized_relobj::do_layout): Don't report special sections.
3151 (Sized_relobj::do_for_all_local_got_entries): New function.
3152 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3153 symtab_off to all symbol table offsets.
3154 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3155 * object.h (class Got_offset_list): Move to top of file.
3156 (Object::Object): Allow case where input_file == NULL.
3157 (Object::~Object): Likewise.
3158 (Object::input_file): Assert that input_file != NULL.
3159 (Object::lock): Allow case where input_file == NULL.
3160 (Object::unlock): Likewise.
3161 (Object::is_locked): Likewise.
3162 (Object::token): Likewise.
3163 (Object::release): Likewise.
3164 (Object::is_incremental): New function.
3165 (Object::get_mtime): New function.
3166 (Object::for_all_local_got_entries): New function.
3167 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3168 (Object::set_is_in_system_directory): New function.
3169 (Object::is_in_system_directory): New function.
3170 (Object::do_is_incremental): New function.
3171 (Object::do_get_mtime): New function.
3172 (Object::do_for_all_local_got_entries): New function.
3173 (Object::is_in_system_directory_): New data member.
3174 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3175 (class Sized_relobj_base): New class.
3176 (class Sized_relobj): Derive from Sized_relobj_base.
3177 (class Sized_relobj::Symbols): Redeclare from base class.
3178 (class Sized_relobj::local_got_offset_list): Remove.
3179 (class Sized_relobj::Output_sections): Redeclare from base class.
3180 (class Sized_relobj::do_for_all_local_got_entries): New function.
3181 (class Sized_relobj::write_local_symbols): Add offset parameter.
3182 (class Sized_relobj::local_symbol_offset_): Update comment.
3183 (class Sized_relobj::local_dynsym_offset_): Update comment.
3184 * options.cc (Input_arguments::add_file): Remove const.
3185 * options.h (Input_file_argument::Input_file_argument):
3186 Initialize arg_serial_ (all constructors).
3187 (Input_file_argument::set_arg_serial): New function.
3188 (Input_file_argument::arg_serial): New function.
3189 (Input_file_argument::arg_serial_): New data member.
3190 (Input_arguments::Input_arguments): Initialize file_count_.
3191 (Input_arguments::add_file): Remove const.
3192 (Input_arguments::number_of_input_files): New function.
3193 (Input_arguments::file_count_): New data member.
3194 (Command_line::number_of_input_files): Call
3195 Input_arguments::number_of_input_files.
3196 * output.cc (Output_segment_headers::Output_segment_headers):
3197 Set current size.
3198 (Output_section::Input_section::current_data_size): New function.
3199 (Output_section::Output_section): Initialize new data members.
3200 (Output_section::add_input_section): Don't do merge sections for
3201 an incremental link; allocate space from free list for an
3202 incremental update.
3203 (Output_section::add_output_section_data): Allocate space from
3204 free list for an incremental update.
3205 (Output_section::update_data_size): New function.
3206 (Output_section::set_fixed_layout): New function.
3207 (Output_section::reserve): New function.
3208 (Output_segment::set_section_addresses): Remove const.
3209 (Output_segment::set_section_list_addresses): Remove const; allocate
3210 space from free list for an incremental update.
3211 (Output_segment::set_offset): Adjust size of RELRO segment for an
3212 incremental update.
3213 * output.h (Output_data::current_data_size): Move here from
3214 child classes.
3215 (Output_data::pre_finalize_data_size): New function.
3216 (Output_data::update_data_size): New function.
3217 (Output_section_headers::update_data_size): new function.
3218 (Output_section_data_build::current_data_size): Move to Output_data.
3219 (Output_data_strtab::update_data_size): New function.
3220 (Output_section::current_data_size): Move to Output_data.
3221 (Output_section::set_fixed_layout): New function.
3222 (Output_section::has_fixed_layout): New function.
3223 (Output_section::reserve): New function.
3224 (Output_section::update_data_size): New function.
3225 (Output_section::has_fixed_layout_): New data member.
3226 (Output_section::free_list_): New data member.
3227 (Output_segment::set_section_addresses): Remove const.
3228 (Output_segment::set_section_list_addresses): Remove const.
3229 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3230 New function.
3231 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3232 New function.
3233 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3234 parameter when calling Add_symbols constructor; store argument
3235 serial number for members of a lib group.
3236 (Add_symbols::locks): Allow case where token == NULL.
3237 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3238 (Read_member::~Read_member): New function.
3239 (Read_member::is_runnable): New function.
3240 (Read_member::locks): New function.
3241 (Read_member::run): New function.
3242 (Check_script::~Check_script): New function.
3243 (Check_script::is_runnable): New function.
3244 (Check_script::locks): New function.
3245 (Check_script::run): New function.
3246 (Check_library::~Check_library): New function.
3247 (Check_library::is_runnable): New function.
3248 (Check_library::locks): New function.
3249 (Check_library::run): New function.
3250 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3251 (Add_symbols::library_): New data member.
3252 (class Read_member): New class.
3253 (class Check_script): New class.
3254 (class Check_library): New class.
3255 * reloc.cc (Read_relocs::is_runnable): Allow case where
3256 token == NULL.
3257 (Read_relocs::locks): Likewise.
3258 (Scan_relocs::locks): Likewise.
3259 (Relocate_task::locks): Likewise.
3260 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3261 to clear counters.
3262 (Sized_relobj::incremental_relocs_scan): Fix comment.
3263 (Sized_relobj::do_relocate): Pass output file offset to
3264 write_local_symbols.
3265 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3266 from class declaration.
3267 * script.cc (read_input_script): Allocate Script_info; pass
3268 argument serial number to report_script.
3269 * script.h (class Script_info): Move to incremental.h.
3270 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3271 * symtab.h (Symbol_table::add_from_incrobj): New function.
3272 (Symbol_table::set_file_offset): New function.
3273
3274 2011-04-05 Cary Coutant <ccoutant@google.com>
3275
3276 * incremental-dump.cc (dump_incremental_inputs): Change signature
3277 to take a Sized_incremental_binary; change caller. Use readers
3278 in Sized_incremental_binary.
3279 * incremental.cc
3280 (Sized_incremental_binary::find_incremental_inputs_sections):
3281 Rename do_find_incremental_inputs_sections to this.
3282 (Sized_incremental_binary::setup_readers): New function.
3283 (Sized_incremental_binary::do_check_inputs): Check
3284 has_incremental_info_ flag; move setup code to setup_readers;
3285 use input readers.
3286 (Sized_incremental_binary::do_file_is_unchanged): New function.
3287 (Sized_incremental_binary::do_get_input_reader): New function.
3288 * incremental.h (class Incremental_binary): Move to end of file.
3289 (Incremental_binary::file_is_unchanged): New function.
3290 (Incremental_binary::do_file_is_unchanged): New function.
3291 (Incremental_binary::Input_reader): New class.
3292 (Incremental_binary::get_input_reader): New function.
3293 (class Sized_incremental_binary): Move to end of file.
3294 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3295 input section reader classes.
3296 (Sized_incremental_binary::has_incremental_info): New function.
3297 (Sized_incremental_binary::inputs_reader): New function.
3298 (Sized_incremental_binary::symtab_reader): New function.
3299 (Sized_incremental_binary::relocs_reader): New function.
3300 (Sized_incremental_binary::got_plt_reader): New function.
3301 (Sized_incremental_binary::do_file_is_unchanged): New function.
3302 (Sized_incremental_binary::Sized_input_reader): New class.
3303 (Sized_incremental_binary::get_input_reader): New function.
3304 (Sized_incremental_binary::find_incremental_inputs_sections):
3305 Rename do_find_incremental_inputs_sections to this.
3306 (Sized_incremental_binary::setup_readers): New function.
3307 (Sized_incremental_binary::has_incremental_info_): New data member.
3308 (Sized_incremental_binary::inputs_reader_): New data member.
3309 (Sized_incremental_binary::symtab_reader_): New data member.
3310 (Sized_incremental_binary::relocs_reader_): New data member.
3311 (Sized_incremental_binary::got_plt_reader_): New data member.
3312 (Sized_incremental_binary::current_input_file_): New data member.
3313
3314 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3315
3316 PR gold/12640
3317 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3318 violation.
3319
3320 2011-03-30 Cary Coutant <ccoutant@google.com>
3321
3322 * archive.cc (Archive::include_member): Adjust call to report_object.
3323 (Add_archive_symbols::run): Add script_info to call to
3324 report_archive_begin.
3325 (Lib_group::include_member): Adjust call to report_object.
3326 (Add_lib_group_symbols::run): Adjust call to report_object.
3327 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3328 blocks. Add object count for script input files.
3329 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3330 script_info parameter; change all callers.
3331 (Incremental_inputs::report_object): Add script_info parameter;
3332 change all callers.
3333 (Incremental_inputs::report_script): Store backpointer to
3334 incremental info entry.
3335 (Output_section_incremental_inputs::set_final_data_size): Record
3336 additional information for scripts.
3337 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3338 * incremental.h (Incremental_script_entry::add_object): New function.
3339 (Incremental_script_entry::get_object_count): New function.
3340 (Incremental_script_entry::get_object): New function.
3341 (Incremental_script_entry::objects_): New data member; adjust
3342 constructor.
3343 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3344 (Incremental_inputs::report_object): Add script_info parameter.
3345 (Incremental_inputs_reader::get_object_count): New function.
3346 (Incremental_inputs_reader::get_object_offset): New function.
3347 * options.cc (Input_arguments::add_file): Return reference to
3348 new input argument.
3349 * options.h (Input_argument::set_script_info): New function.
3350 (Input_argument::script_info): New function.
3351 (Input_argument::script_info_): New data member; adjust all
3352 constructors.
3353 (Input_file_group::add_file): Return reference to new input argument.
3354 (Input_file_lib::add_file): Likewise.
3355 (Input_arguments::add_file): Likewise.
3356 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3357 * script.cc (Parser_closure::Parser_closure): Add script_info
3358 parameter; adjust all callers.
3359 (Parser_closure::script_info): New function.
3360 (Parser_closure::script_info_): New data member.
3361 (read_input_script): Report scripts earlier to incremental info.
3362 (script_add_file): Set script_info in Input_argument.
3363 (script_add_library): Likewise.
3364 * script.h (Script_options::Script_info): Rewrite class.
3365
3366 2011-03-29 Cary Coutant <ccoutant@google.com>
3367
3368 * archive.cc (Library_base::should_include_member): Move
3369 method here from class Archive.
3370 (Archive::Archive): Initialize base class.
3371 (Archive::should_include_member): Move to base class.
3372 (Archive::do_for_all_unused_symbols): New function.
3373 (Add_archive_symbols::run): Remove redundant access to
3374 incremental_inputs.
3375 (Lib_group::Lib_group): Initialize base class.
3376 (Lib_group::do_filename): New function.
3377 (Lib_group::include_member): Pass pointer to Lib_group to
3378 report_object.
3379 (Lib_group::do_for_all_unused_symbols): New function.
3380 (Add_lib_group_symbols::run): Report archive information for
3381 incremental links.
3382 * archive.h (class Library_base): New base class.
3383 (class Archive): Derive from Library_base.
3384 (Archive::filename): Move to base class.
3385 (Archive::set_incremental_info): Likewise.
3386 (Archive::incremental_info): Likewise.
3387 (Archive::Should_include): Likewise.
3388 (Archive::should_include_member): Likewise.
3389 (Archive::Armap_entry): Remove.
3390 (Archive::Unused_symbol_iterator): Remove.
3391 (Archive::unused_symbols_begin): Remove.
3392 (Archive::unused_symbols_end): Remove.
3393 (Archive::do_filename): New function.
3394 (Archive::do_get_mtime): New function.
3395 (Archive::do_for_all_unused_symbols): New function.
3396 (Archive::task_): Move to base class.
3397 (Archive::incremental_info_): Likewise.
3398 (class Lib_group): Derive from Library_base.
3399 (Lib_group::do_filename): New function.
3400 (Lib_group::do_get_mtime): New function.
3401 (Lib_group::do_for_all_unused_symbols): New function.
3402 (Lib_group::task_): Move to base class.
3403 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3404 function.
3405 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3406 function.
3407 * incremental.cc (Incremental_inputs::report_archive_begin):
3408 Use Library_base; call library's get_mtime; add incremental inputs
3409 entry before members.
3410 (class Unused_symbol_visitor): New class.
3411 (Incremental_inputs::report_archive_end): Use Library_base; use
3412 visitor class to record unused symbols; don't add incremental inputs
3413 entry after members.
3414 (Incremental_inputs::report_object): Use Library_base.
3415 * incremental.h
3416 (Incremental_archive_entry::Incremental_archive_entry): Remove
3417 unused Archive parameter.
3418 (Incremental_inputs::report_archive_begin): Use Library_base.
3419 (Incremental_inputs::report_archive_end): Likewise.
3420 (Incremental_inputs::report_object): Likewise.
3421 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3422 function.
3423 * object.h (Object::for_all_global_symbols): New function.
3424 (Object::do_for_all_global_symbols): New function.
3425 (Sized_relobj::do_for_all_global_symbols): New function.
3426 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3427 function.
3428 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3429 function.
3430
3431 2011-03-27 Ian Lance Taylor <iant@google.com>
3432
3433 * archive.cc (Archive::interpret_header): Return -1 if something
3434 goes wrong. Change callers accordingly.
3435
3436 2011-03-25 Cary Coutant <ccoutant@google.com>
3437
3438 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3439 * testsuite/Makefile.in: Regenerate.
3440
3441 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3442
3443 * plugin.cc (get_view): New.
3444 (Plugin::load): Pass get_view to the plugin.
3445 (Plugin_manager::get_view): New.
3446
3447 2011-03-21 Ian Lance Taylor <iant@google.com>
3448
3449 * testsuite/final_layout.sh: Rewrite to not use dc.
3450 * testsuite/relro_test.sh: Fail if dc is not present.
3451
3452 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3453
3454 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3455 Change == to -eq.
3456 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3457 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3458 Change == to -eq.
3459 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3460 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3461
3462 2011-03-14 Ian Lance Taylor <iant@google.com>
3463
3464 * script-sections.cc (Sort_output_sections::script_compare):
3465 Rename from is_before, change return type.
3466 (Sort_output_sections::operator()): Adjust accordingly.
3467
3468 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3469
3470 PR gold/12572
3471 * testsuite/odr_violation2.cc: Add comment to make all error line
3472 numbers double digits.
3473 * testsuite/debug_msg.sh: Adjust expected errors.
3474
3475 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3476
3477 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3478 but mark earlier ones as non-canonical
3479 (offset_to_iterator): Update search target and example
3480 (do_addr2line): Return extra lines in a vector*
3481 (format_file_lineno): Extract from do_addr2line
3482 (one_addr2line): Add vector* out-param
3483 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3484 when a lineno entry appeared last for its instruction
3485 (Dwarf_line_info): Add vector* out-param
3486 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3487 * symtab.cc (Odr_violation_compare): Include the lineno in the
3488 comparison again.
3489 (linenos_from_loc): New. Combine the canonical line for an
3490 address with its other lines.
3491 (True_if_intersect): New. Helper functor to make
3492 std::set_intersection a query.
3493 (detect_odr_violations): Compare sets of lines instead of just
3494 one line for each function. This became less deterministic, but
3495 has fewer false positives.
3496 * symtab.h: Declarations.
3497 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3498 mix an optimized and non-optimized object in the same binary
3499 (odr_violation2.so): Same.
3500 * testsuite/Makefile.in: Regenerate from Makefile.am.
3501 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3502 * testsuite/debug_msg.sh: Update line numbers and add
3503 assertions.
3504 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3505 non-optimized context.
3506 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3507 isn't inlined, and use OdrDerived in an optimized context.
3508 * testsuite/odr_header1.h: Defines OdrDerived, where
3509 optimization will change the
3510 first-instruction-in-the-destructor's file and line number.
3511 * testsuite/odr_header2.h: Defines OdrBase.
3512
3513 2011-03-09 Ian Lance Taylor <iant@google.com>
3514
3515 * fileread.cc (File_read::clear_views): Don't delete the whole
3516 file view.
3517
3518 2011-03-08 Ian Lance Taylor <iant@google.com>
3519
3520 PR gold/12525
3521 * fileread.cc: #include <climits>.
3522 (GOLD_IOV_MAX): Define.
3523 (File_read::read_multiple): Limit number of entries by iov_max.
3524 * fileread.h (class File_read): Always set max_readv_entries to
3525 128.
3526
3527 2011-03-07 Ian Lance Taylor <iant@google.com>
3528
3529 PR gold/12525
3530 * options.h (class General_options): Add -dy and -dn.
3531
3532 2011-03-02 Cary Coutant <ccoutant@google.com>
3533
3534 * testsuite/script_test_9.t: Add TLS segment.
3535
3536 2011-03-02 Simon Baldwin <simonb@google.com>
3537
3538 * configure.ac: Add check for gnu_indirect_function support in
3539 the toolchain building binutils.
3540 * configure: Rebuild.
3541
3542 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3543
3544 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3545 plugin only symbols.
3546 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3547 in plugin files as not needed in the symbol table.
3548
3549 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3550
3551 * output.cc (Output_section::add_input_section): Delay fill
3552 generation for section ordering.
3553
3554 2011-02-09 Ian Lance Taylor <iant@google.com>
3555
3556 PR gold/12316
3557 * object.h (class Sized_relobj): Remove clear_local_symbols.
3558 * reloc.cc (Sized_relobj::do_relocate): Don't call
3559 clear_local_symbols.
3560
3561 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3562
3563 * plugin.cc (is_visible_from_outside): Return true for symbols
3564 in the -u option.
3565
3566 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3567
3568 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3569 filename.
3570
3571 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3572
3573 * icf.h (is_section_foldable_candidate): Change type of parameter
3574 to std::string.
3575 * icf.cc (Icf::find_identical_sections): Change type of local variable
3576 section_name to be std::string.
3577 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3578
3579 2011-01-25 Ian Lance Taylor <iant@google.com>
3580
3581 * script.cc (script_add_extern): Rewrite to use
3582 add_symbol_reference.
3583
3584 2011-01-25 Doug Kwan <dougkwan@google.com>
3585
3586 * icf.cc (get_section_contents): Always lock section's object.
3587
3588 2011-01-24 Ian Lance Taylor <iant@google.com>
3589
3590 * options.h (class General_options): Accept
3591 --no-detect-odr-violations.
3592
3593 2011-01-24 Ian Lance Taylor <iant@google.com>
3594
3595 * version.cc (version_string): Bump to 1.11.
3596
3597 2011-01-24 Ian Lance Taylor <iant@google.com>
3598
3599 * plugin.cc (class Plugin_rescan): Define new class.
3600 (Plugin_manager::claim_file): Set any_claimed_.
3601 (Plugin_manager::save_archive): New function.
3602 (Plugin_manager::save_input_group): New function.
3603 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3604 necessary.
3605 (Plugin_manager::new_undefined_symbol): New function.
3606 (Plugin_manager::rescan): New function.
3607 (Plugin_manager::rescannable_defines): New function.
3608 (Plugin_manager::add_input_file): Set any_added_.
3609 * plugin.h (class Plugin_manager): define new fields rescannable_,
3610 undefined_symbols_, any_claimed_, and any_added_. Declare
3611 Plugin_rescan as friend. Declare new functions.
3612 (Plugin_manager::Rescannable): Define type.
3613 (Plugin_manager::Rescannable_list): Define type.
3614 (Plugin_manager::Undefined_symbol_list): Define type.
3615 (Plugin_manager::Plugin_manager): Initialize new fields.
3616 * archive.cc (Archive::defines_symbol): New function.
3617 (Add_archive_symbols::run): Pass archive to plugins if any.
3618 * archive.h (class Archive): Declare defines_symbol.
3619 * readsyms.cc (Input_group::~Input_group): New function.
3620 (Finish_group::run): Pass input_group to plugins if any.
3621 * readsyms.h (class Input_group): Declare destructor.
3622 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3623 any.
3624
3625 2011-01-10 Ian Lance Taylor <iant@google.com>
3626
3627 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3628 section as relro.
3629 (Layout::set_segment_offsets): Reset increase_relro before calling
3630 set_section_addresses a second time.
3631
3632 2011-01-04 Cary Coutant <ccoutant@google.com>
3633
3634 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3635 sections before NOBITS sections.
3636
3637 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3638
3639 * version.cc (print_version): Update copyright to 2011.
3640
3641 2010-12-23 Cary Coutant <ccoutant@google.com>
3642
3643 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3644 of OS to this->add. Add OD parameter to second form of the function.
3645
3646 2010-12-20 Ian Lance Taylor <iant@google.com>
3647
3648 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3649 second of two consecutive entries with same offset.
3650
3651 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3652
3653 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3654 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3655 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3656 to avoid unneeded links against $(LDADD).
3657 * testsuite/Makefile.in: Regenerate.
3658
3659 2010-12-15 Ian Lance Taylor <iant@google.com>
3660
3661 PR gold/12324
3662 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3663 for R_X86_64_32 and R_X86_64_PC32.
3664 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3665 ver_matching_def_pic.o.
3666 (ver_matching_def_pic.o): New target.
3667
3668 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3669
3670 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3671 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3672 Move definition before File_read::View member definitions.
3673 (File_read::View::~View): Initialize and hold lock before
3674 updating current_mapped_bytes.
3675
3676 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3677
3678 * dwarf_reader.cc: Remove outdated comment.
3679 * gold-threads.cc: Fix typo in error message.
3680 * archive.cc: Fix typos in comments.
3681 * archive.h: Likewise.
3682 * arm-reloc-property.cc: Likewise.
3683 * arm-reloc-property.h: Likewise.
3684 * arm-reloc.def: Likewise.
3685 * arm.cc: Likewise.
3686 * attributes.h: Likewise.
3687 * cref.cc: Likewise.
3688 * ehframe.cc: Likewise.
3689 * fileread.h: Likewise.
3690 * gold.h: Likewise.
3691 * i386.cc: Likewise.
3692 * icf.cc: Likewise.
3693 * incremental.h: Likewise.
3694 * int_encoding.cc: Likewise.
3695 * layout.h: Likewise.
3696 * main.cc: Likewise.
3697 * merge.h: Likewise.
3698 * object.cc: Likewise.
3699 * object.h: Likewise.
3700 * options.cc: Likewise.
3701 * readsyms.cc: Likewise.
3702 * reduced_debug_output.cc: Likewise.
3703 * reloc.cc: Likewise.
3704 * script-sections.cc: Likewise.
3705 * sparc.cc: Likewise.
3706 * symtab.h: Likewise.
3707 * target-reloc.h: Likewise.
3708 * target.cc: Likewise.
3709 * target.h: Likewise.
3710 * timer.cc: Likewise.
3711 * timer.h: Likewise.
3712 * x86_64.cc: Likewise.
3713
3714 2010-12-09 Cary Coutant <ccoutant@google.com>
3715
3716 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3717 stack.
3718 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3719 parameter; change all callers.
3720 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3721 * options.h (warn_execstack): New option.
3722
3723 2010-12-07 Doug Kwan <dougkwan@google.com>
3724
3725 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3726 like function call relocations.
3727
3728 2010-12-07 Ian Lance Taylor <iant@google.com>
3729
3730 * archive.cc (Archive::get_elf_object_for_member): Permit
3731 punconfigured to be NULL.
3732 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3733 (Archive::include_member): Pass NULL to get_elf_object_for_member
3734 if we searched for the archive and this is the first included
3735 object.
3736
3737 2010-12-01 Ian Lance Taylor <iant@google.com>
3738
3739 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3740 track_relocs_type_ field.
3741 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3742 Set track_relocs_type_.
3743 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3744 contents when using RELA relocs.
3745 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3746 reloc_map_.
3747 * reloc.cc (Track_relocs::next_addend): New function.
3748 * reloc.h (class Track_relocs): Declare next_addend.
3749
3750 2010-12-01 Ian Lance Taylor <iant@google.com>
3751
3752 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3753 virtual destructor.
3754
3755 2010-12-01 Ian Lance Taylor <iant@google.com>
3756
3757 * README: Update compilers known to work and fail.
3758
3759 2010-11-23 Matthias Klose <doko@ubuntu.com>
3760
3761 * configure.in: For --enable-gold, handle value `default' instead of
3762 `both*'. Always install ld as ld.bfd, install as ld if gold is
3763 not the default.
3764 * configure: Regenerate.
3765
3766 2010-11-18 Doug Kwan <dougkwan@google.com>
3767
3768 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3769 and right_alignment to be zero. Store result alignment only if it is
3770 greater than existing alignment.
3771
3772 2010-11-16 Cary Coutant <ccoutant@google.com>
3773
3774 PR gold/12220
3775 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3776 Check for ".zdebug_line".
3777
3778 2010-11-16 Doug Kwan <dougkwan@google.com>
3779 Cary Coutant <ccoutant@google.com>
3780
3781 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3782 by reference; adjust all callers.
3783 * output.cc (Output_segment::set_section_addresses): Adjust references
3784 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3785 list is empty.
3786 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3787 end at page boundary.
3788
3789 2010-11-16 Cary Coutant <ccoutant@google.com>
3790
3791 PR gold/12220
3792 * layout.cc (Layout::choose_output_section): Transform names of
3793 compressed sections even when using a script with a SECTIONS clause.
3794 (Layout::output_section_name): Remove code to transform
3795 compressed debug section names.
3796 * output.cc (Output_section::add_input_section): Use uncompressed
3797 section size when tracking input sections.
3798
3799 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3800
3801 * symtab.h (Symbol::NON_PIC_REF): Remove.
3802 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3803 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3804 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3805 (Symbol::use_plt_offset): Take a flags argument and pass it
3806 directly to needs_dynamic_reloc. Restrict check for undefined
3807 weak symbols to function calls.
3808 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3809 (Target_arm::Scan::global): Use it.
3810 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3811 (Target_arm::Relocate::relocate): Likewise.
3812 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3813 parameter with an r_type parameter. Use get_reference_flags
3814 to get the flags.
3815 (Target_arm::Relocate::relocate): Update accordingly.
3816 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3817 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3818 (Target_i386::Scan::global): Likewise.
3819 (Target_i386::Relocate::relocate): Likewise.
3820 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3821 parameter with an r_type parameter. Use get_reference_flags
3822 to get the flags.
3823 (Target_i386::Relocate::relocate): Update accordingly.
3824 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3825 (Target_powerpc::Scan::global): Use it.
3826 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3827 (Target_powerpc::Relocate::relocate): Likewise.
3828 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3829 (Target_sparc::Scan::global): Use it.
3830 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3831 (Target_sparc::Relocate::relocate): Likewise.
3832 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3833 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3834 (Target_x86_64::Scan::global): Likewise.
3835 (Target_x86_64::Relocate::relocate): Likewise.
3836
3837 2010-11-08 Doug Kwan <dougkwan@google.com>
3838 Cary Coutant <ccoutant@google.com>
3839
3840 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3841 (Arm_exidx_merge_section::section_contents_): New data member.
3842 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3843 (Arm_input_section::~Arm_input_section): De-allocate memory.
3844 (Arm_input_section::original_contents_): New data member.
3845 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3846 in parameters instead of calling Object::section_contents without
3847 locking.
3848 (Arm_output_section::group_section): New parameter TASK. Pass it
3849 to callees that need locking objects.
3850 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3851 to lock EXIDX input sections. Fix a formatting issue. Call
3852 Arm_exidx_merged_section::build_contents to create merged section
3853 contents.
3854 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3855 to lock object of stub table owner.
3856 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3857 TEXT_SIZE to initialize data member TEXT_SIZE_.
3858 (Arm_exidx_input_section::addralign): Fix typo in comment.
3859 (Arm_exidx_input_section::text_size): New method.
3860 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3861 that require locking objects. Lock objects before scanning for stubs
3862 and updating local symbols.
3863 (Arm_input_section<big_endian>::init): Copy contents of original
3864 input section.
3865 (Arm_input_section<big_endian>::do_write): Use saved contents of
3866 original input section instead of calling Object::section_contents
3867 without locking.
3868 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3869 size without calling Object::section_size().
3870 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3871 for size. Allocate a buffer for merged EXIDX entries.
3872 (Arm_exidx_merged_section::build_contents): New method.
3873 (Arm_exidx_merged_section::do_write): Move merge section contents
3874 building code to Arm_exidx_merged_section::build_contetns. Write
3875 out contetns in buffer instead of building it on the fly.
3876 (Arm_relobj::make_exidx_input_section): Also pass text section size
3877 to Arm_exidx_input_section constructor.
3878 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3879 (Arm_dynobj::do_read_symbols): Fix memory leak.
3880 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3881 * target.h: (class Task): Add forward declaration.
3882 (Target::relax): Add new parameter TASK and pass it to
3883 Target::do_relax().
3884 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3885
3886 2010-11-05 Cary Coutant <ccoutant@google.com>
3887
3888 PR gold/10708
3889 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3890 object when reading from the file.
3891 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3892 second layout pass.
3893 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3894 when reading section contents.
3895 (get_section_contents): Likewise.
3896 (icf::find_identical_sections): Likewise.
3897 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3898 object when reading from the file.
3899 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3900 the object when doing deferred section layout.
3901
3902 2010-11-03 Nick Clifton <nickc@redhat.com>
3903
3904 PR gold/12001
3905 * script.h (class Symbol_assignment: name): New member. Returns
3906 the name of the symbol.
3907 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3908 Returns true if the given symbol name is on the list of
3909 assignments wating to be processed.
3910 * archive.cc (should_incldue_member): If the symbol is undefined,
3911 check to see if it is on the list of symbols pending assignment.
3912
3913 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3914
3915 * script-sections.cc (Script_sections::find_memory_region): Check
3916 for a NULL output section pointer.
3917
3918 2010-10-29 Doug Kwan <dougkwan@google.com>
3919
3920 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3921 Output_section::add_relaxed_input_section.
3922 * output.cc (Output_section::add_relaxed_input_section): Add new
3923 arguments LAYOUT and NAME. Set section order index.
3924 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3925 Copy section order index.
3926 * output.h (Output_section::add_relaxed_input_section): Add new
3927 arguments LAYOUT and NAME.
3928
3929 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3930
3931 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3932 NATIVE_OR_CROSS_LINKER.
3933 * testsuite/Makefile.in: Regenerate.
3934
3935 2010-10-20 Doug Kwan <dougkwan@google.com>
3936
3937 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3938 without SHF_LINK_ORDER flags.
3939 * layout.cc (Layout::choose_output_section): Do not filter
3940 SHF_LINK_ORDER flag in a relocatable link.
3941
3942 2010-10-17 Cary Coutant <ccoutant@google.com>
3943
3944 * output.h (Output_segment::set_section_addresses): Change function
3945 signature. Update all callers.
3946 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3947 sections.
3948 (Output_segment::set_section_addresses): Align after last TLS
3949 section. Add padding before last relro section instead of after.
3950
3951 2010-10-17 Doug Kwan <dougkwan@google.com>
3952
3953 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3954 GOT output section to be writable.
3955
3956 2010-10-14 Cary Coutant <ccoutant@google.com>
3957
3958 * debug.h (DEBUG_INCREMENTAL): New flag.
3959 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3960 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3961 mode.
3962 * incremental.cc (report_command_line): Ignore all forms of
3963 --incremental.
3964 * layout.cc (Layout::Layout): Check parameters for incremental link
3965 mode.
3966 * options.cc (General_options::parse_incremental): New function.
3967 (General_options::parse_no_incremental): New function.
3968 (General_options::parse_incremental_full): New function.
3969 (General_options::parse_incremental_update): New function.
3970 (General_options::incremental_mode_): New data member.
3971 (General_options::finalize): Check incremental_mode_.
3972 * options.h (General_options): Update help text for --incremental.
3973 Add --no-incremental, --incremental-full, --incremental-update.
3974 (General_options::Incremental_mode): New enum type.
3975 (General_options::incremental_mode): New function.
3976 (General_options::incremental_mode_): New data member.
3977 * parameters.cc (Parameters::incremental_mode_): New data member.
3978 (Parameters::set_options): Set incremental_mode_.
3979 (Parameters::set_incremental_full): New function.
3980 (Parameters::incremental): New function.
3981 (Parameters::incremental_update): New function.
3982 (set_parameters_incremental_full): New function.
3983 * parameters.h (Parameters::set_incremental_full): New function.
3984 (Parameters::incremental): New function.
3985 (Parameters::incremental_update): New function.
3986 (Parameters::incremental_mode_): New data member.
3987 (set_parameters_incremental_full): New function.
3988 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3989 incremental link mode.
3990 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3991 (Sized_relobj::do_relocate_sections): Likewise.
3992 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3993 option.
3994 * testsuite/Makefile.in: Regenerate.
3995 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3996
3997 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3998
3999 * script-sections.h (class Script_sections): Make
4000 Sections_elements typedef public.
4001 * script-sections.cc (class Sort_output_sections): Add elements_
4002 field. Add constructor which sets it; change all callers.
4003 (Sort_output_sections::is_before): New function.
4004 (Sort_output_sections::operator()): Call is_before.
4005 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4006 conditional.
4007 * testsuite/script_test_10.sh: New test. Test script section
4008 order.
4009 * testsuite/script_test_10.t: Likewise.
4010 * testsuite/script_test_10.s: Likewise.
4011 * testsuite/Makefile.am: Wrap the cross linker tests and the
4012 common tests into NATIVE_OR_CROSS_LINKER.
4013 (check_SCRIPTS): Add script_test_10.sh.
4014 (check_DATA): Add script_test_10.stdout.
4015 (script_test_10.o, script_test_10): New targets.
4016 (script_test_10.stdout): New target.
4017 * configure, testsuite/Makefile.in: Regenerate.
4018
4019 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4020
4021 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4022 error for the deprecated relocations.
4023 (Target_arm::Scan::global): Likewise.
4024 (Target_arm::Relocate::relocate): Likewise.
4025
4026 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4027
4028 * fileread.cc (Input_file::find_file): Initialize *found_name
4029 and *namep when using the fallback search for case 4.
4030
4031 2010-10-11 Cary Coutant <ccoutant@google.com>
4032
4033 * options.h (class General_options): Redefine -z lazy as an alias for
4034 the negation of -z now.
4035
4036 2010-10-11 Ian Lance Taylor <iant@google.com>
4037
4038 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4039 binding.
4040
4041 2010-10-06 Nick Clifton <nickc@redhat.com>
4042
4043 * script-sections.cc(class Memory_region): Remove
4044 current_lma_offset_ field. Rename current_vma_offset_ to
4045 current_offset_. Add last_section_ field.
4046 (Memory_region::get_current_vma_address): Rename to
4047 get_current_address.
4048 (Memory_region::get_current_lma_address): Delete.
4049 (Memory_region::increment_vma_offset): Rename to
4050 increment_offset.
4051 (Memory_region::increment_lma_offset): Delete.
4052 (Memory_region::attributes_compatible): New method. Returns
4053 true if the provided section is compatible with the region.
4054 (Memory_region::get_last_section): New method. Returns the last
4055 section to use the region.
4056 (Memory_region::set_last_section): New method. Stores the last
4057 section to use the region.
4058 (Script_sections::block_in_region): New method. Returns true if
4059 a block of memory is contained within a region.
4060 (Script_sections::find_memory_region): New method. Locates a
4061 memory region to be used to set a VMA or LMA address.
4062 (Output_section_definition::set_section_addresses): Add code to
4063 check for addresses set by memory regions.
4064 (Output_segment::set_section_addresses): Remove memory region
4065 walking code.
4066 (Script_sections::create_segment): Add a warning if a header
4067 segment is created outside of any region.
4068 * script-sections.h (class Script_sections): Add prototypes for
4069 find_memory_region and block_in_region methods.
4070 * testsuite/memory_test.s: Use .long instead of .word.
4071 * testsuite/memory_test.t: Add some more output sections.
4072 * testsuite/memory_test.sh: Update expected output.
4073
4074 2010-10-02 Doug Kwan <dougkwan@google.com>
4075
4076 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4077 defintion to symtab.h
4078 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4079 declaration to defintion.
4080
4081 2010-10-01 Nick Clifton <nickc@redhat.com>
4082
4083 * expression.cc (eval): Replace dummy argument with NULL.
4084 (eval_maybe_dot): Check for a NULL result section pointer.
4085 (Symbol_expression::value): Likewise.
4086 (Dot_expression::value): Likewise.
4087 (BINARY_EXPRESSION): Likewise.
4088 (Max_expression::value): Likewise.
4089 (Min_expression::value): Likewise.
4090 (Absolute_expression::value): Likewise.
4091 (Addr_expression::value_from_output_section): Likewise.
4092 (Loaddddr_expression::value_from_output_section): Likewise.
4093 (Segment_start_expression::value): Likewise.
4094 * script-sections.cc
4095 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4096 argument with NULL.
4097 (Sections_elememt_dot_assignment::set_section_addresses):
4098 Likewise.
4099 (Output_data_expression::do_write_to_buffer): Likewise.
4100 (Output_section_definition::finalize_symbols): Likewise.
4101 (Output_section_definition::set_section_addresses): Likewise.
4102
4103 2010-09-30 Doug Kwan <dougkwan@google.com>
4104
4105 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4106
4107 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4108
4109 * target.h (Target::can_icf_inline_merge_sections): New virtual
4110 function.
4111 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4112 virtual function.
4113 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4114 virtual function.
4115 * icf.cc (get_section_contents): Inline merge sections only when
4116 target allows it.
4117
4118 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4119
4120 * configure: Regenerate.
4121
4122 2010-09-17 Ian Lance Taylor <iant@google.com>
4123
4124 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4125 * testsuite/Makefile.am (memory_test.o): New target.
4126 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4127 memory_test.t.
4128 * testsuite/Makefile.in: Rebuild.
4129
4130 2010-09-17 Doug Kwan <dougkwan@google.com>
4131
4132 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4133 defintion if relocation uses GOT entries of the symbol.
4134 * testsuite/icf_safe_test.sh: Fix test.
4135 * testsuite/icf_safe_so_test.sh: Fix test.
4136
4137 2010-09-16 Cary Coutant <ccoutant@google.com>
4138
4139 * script_sections.cc (class Memory_region): Remove "NULL" from
4140 vector initializations.
4141
4142 2010-09-15 Cary Coutant <ccoutant@google.com>
4143
4144 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4145 Resolve forwarding symbols.
4146
4147 2010-09-15 Doug Kwan <dougkwan@google.com>
4148
4149 * gold/testsuite/script_test_3.t: Add ARM special sections.
4150 * gold/testsuite/script_test_4.t: Same.
4151 * gold/testsuite/script_test_5.t: Same.
4152 * gold/testsuite/script_test_6.t: Same.
4153 * gold/testsuite/script_test_7.t: Same.
4154 * gold/testsuite/script_test_7.t: Same.
4155 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4156
4157 2010-09-14 Cary Coutant <ccoutant@google.com>
4158
4159 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4160 (Target_x86_64::Relocate::relocate_tls): Replace check for
4161 saw_tls_block_reloc_ with test for executable section.
4162
4163 2010-09-12 Cary Coutant <ccoutant@google.com>
4164
4165 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4166 position-independent executables to shared libraries need dynamic
4167 relocations.
4168 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4169 position-independent executables.
4170 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4171 * testsuite/Makefile.in: Regenerate.
4172
4173 2010-09-10 Nick Clifton <nickc@redhat.com>
4174
4175 PR gold/11997
4176 * testsuite/memory_test.t: Discard any sections that are not
4177 needed.
4178
4179 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4180
4181 PR gold/11996
4182 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4183 "This::" to work around a bug in gcc 4.2.
4184
4185 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4186
4187 2010-09-09 Rafael Espindola <espindola@google.com>
4188
4189 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4190 sections with different PF_X flags in the same segment.
4191 (Layout::find_first_load_seg): Search all segments to find the first
4192 one.
4193 * options.h (rosegment): New.
4194
4195 2010-09-08 Rafael Espindola <espindola@google.com>
4196
4197 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4198
4199 2010-09-08 Doug Kwan <dougkwan@google.com>
4200
4201 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4202 (Arm_relobj::do_relocate_sections): Add new parameter for output
4203 file to match the parent.
4204 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4205 of local symbols instead of input values. Update code to track
4206 changes in gold::relocate_section.
4207 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4208 (Sized_relobj::compute_final_local_value_internal): New methods.
4209 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4210 body into private version of Sized_relobj::compute_final_local_value.
4211 Call the inline method.
4212 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4213 merged symbol value if there is one.
4214 (Symbol_value::has_output_value): New method defintiion.
4215 (Sized_relobj::Compute_final_local_value_status): New enum type.
4216 (Sized_relobj::compute_final_local_value): New methods.
4217 (Sized_relobj::compute_final_local_value_internal): New methods.
4218 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4219 and arm_cortex_a8.sh.
4220 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4221 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4222 New tests.
4223 * Makefile.in: Regenerate.
4224 * testsuite/arm_bl_out_of_range.s: Update test.
4225 * testsuite/thumb_bl_out_of_range.s: Ditto.
4226 * testsuite/thumb_blx_out_of_range.s: Ditto.
4227 * testsuite/arm_branch_out_of_range.sh: New file.
4228 * testsuite/arm_cortex_a8.sh: Ditto.
4229 * testsuite/arm_cortex_a8_b.s: Ditto.
4230 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4231 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4232 * testsuite/arm_cortex_a8_bl.s: Ditto.
4233 * testsuite/arm_cortex_a8_blx.s: Ditto.
4234 * testsuite/arm_cortex_a8_local.s: Ditto.
4235 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4236 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4237
4238 2010-09-08 Rafael Espindola <espindola@google.com>
4239
4240 * Makefile.am (memory_test.stdout): Run readelf with -W.
4241 * Makefile.in: Regenerate.
4242 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4243 64 bit output.
4244
4245 2010-09-08 Rafael Espindola <espindola@google.com>
4246
4247 * script-sections.cc (Script_sections::add_memory_region): Convert
4248 field precision to int.
4249 * script.cc (script_set_section_region, script_set_section_region):
4250 Convert field precision to int.
4251
4252 2010-09-08 Rafael Espindola <espindola@google.com>
4253
4254 * arm.cc (do_finalize_sections): Create the __exidx_start and
4255 __exdix_end symbols even when the section is missing.
4256
4257 2010-09-08 Nick Clifton <nickc@redhat.com>
4258
4259 * README: Remove claim that MEMORY is not supported.
4260 * expression.cc (script_exp_function_origin)
4261 (script_exp_function_length): Move from here to ...
4262 * script.cc: ... here.
4263 (script_set_section_region, script_add_memory)
4264 (script_parse_memory_attr, script_include_directive): New
4265 functions.
4266 * script-sections.cc
4267 (class Memory_region): New class.
4268 (class Output_section_definition): Add set_memory_region,
4269 set_section_vma, set_section_lma and get_section_name methods.
4270 (class Script_Sections): Add add_memory_region,
4271 find_memory_region, find_memory_region_origin,
4272 find_memory_region_length and set_memory_region methods.
4273 Have set_section_addresses method walk the list of set memory
4274 regions.
4275 Extend the print methos to display memory regions.
4276 * script-sections.h: Add prototypes for new methods.
4277 Add enum for MEMORY region attributes.
4278 * yyscript.y: Add support for parsing MEMORY regions.
4279 * script-c.h: Add prototypes for new functions.
4280 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4281 * testsuite/Makefile.in: Regenerate.
4282 * testsuite/memory_test.sh: New script.
4283 * testsuite/memory_test.s: New assembler source file.
4284 * testsuite/memory_test.t: New linker script.
4285
4286 2010-08-27 Doug Kwan <dougkwan@google.com>
4287
4288 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4289 reference override an existing dynamic weak reference.
4290 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4291 * testsuite/Makefile.in: Regenerate.
4292 * testsuite/dyn_weak_ref.sh: New file.
4293 * testsuite/dyn_weak_ref_1.c: Ditto.
4294 * testsuite/dyn_weak_ref_2.c: Ditto.
4295
4296 2010-08-27 Ian Lance Taylor <iant@google.com>
4297
4298 * incremental.h (class Incremental_input_entry): Add virtual
4299 destructor.
4300
4301 2010-08-27 Ian Lance Taylor <iant@google.com>
4302
4303 * testsuite/start_lib_test_3.c: Mark t3 as used.
4304
4305 2010-08-27 Nick Clifton <nickc@redhat.com>
4306
4307 * options.cc (version_script): Fix small typo in previous
4308 whitespace tidyup.
4309
4310 2010-08-25 Nick Clifton <nickc@redhat.com>
4311
4312 * archive.cc: Formatting fixes: Remove whitespace between
4313 typename and following asterisk. Remove whitespace between
4314 function name and opening parenthesis.
4315 * archive.h: Likewise.
4316 * arm.cc: Likewise.
4317 * attributes.cc: Likewise.
4318 * attributes.h: Likewise.
4319 * common.cc: Likewise.
4320 * copy-relocs.cc: Likewise.
4321 * dirsearch.h: Likewise.
4322 * dynobj.cc: Likewise.
4323 * ehframe.cc: Likewise.
4324 * ehframe.h: Likewise.
4325 * expression.cc: Likewise.
4326 * fileread.cc: Likewise.
4327 * fileread.h: Likewise.
4328 * gc.h: Likewise.
4329 * gold-threads.cc: Likewise.
4330 * gold.cc: Likewise.
4331 * i386.cc: Likewise.
4332 * icf.h: Likewise.
4333 * incremental-dump.cc: Likewise.
4334 * incremental.cc: Likewise.
4335 * layout.cc: Likewise.
4336 * layout.h: Likewise.
4337 * main.cc: Likewise.
4338 * merge.cc: Likewise.
4339 * merge.h: Likewise.
4340 * object.cc: Likewise.
4341 * object.h: Likewise.
4342 * options.cc: Likewise.
4343 * options.h: Likewise.
4344 * output.cc: Likewise.
4345 * output.h: Likewise.
4346 * plugin.cc: Likewise.
4347 * plugin.h: Likewise.
4348 * powerpc.cc: Likewise.
4349 * reloc.cc: Likewise.
4350 * script-c.h: Likewise.
4351 * script-sections.cc: Likewise.
4352 * script.cc: Likewise.
4353 * stringpool.cc: Likewise.
4354 * symtab.cc: Likewise.
4355 * symtab.h: Likewise.
4356 * target.cc: Likewise.
4357 * timer.cc: Likewise.
4358 * timer.h: Likewise.
4359 * version.cc: Likewise.
4360 * x86_64.cc: Likewise.
4361
4362 2010-08-24 Nick Clifton <nickc@redhat.com>
4363
4364 PR 11899
4365 * layout.cc (segment_precedes): Sort segments by their physical
4366 addresses, if they have been set.
4367
4368 2010-08-23 Cary Coutant <ccoutant@google.com>
4369
4370 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4371 symbols data.
4372 (Lib_group::include_member): Unlock object after deleting its
4373 symbols data.
4374 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4375 the bug fixed here.
4376
4377 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4378 Cary Coutant <ccoutant@google.com>
4379
4380 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4381 constructor, and set_blocker.
4382 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4383 readsyms_blocker_.
4384 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4385 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4386 * testsuite/Makefile.am (start_lib_test): New test case.
4387 * testsuite/Makefile.in: Regenerate.
4388 * testsuite/start_lib_test_main.c: New file.
4389 * testsuite/start_lib_test_1.c: New file.
4390 * testsuite/start_lib_test_2.c: New file.
4391 * testsuite/start_lib_test_3.c: New file.
4392
4393 2010-08-19 Ian Lance Taylor <iant@google.com>
4394
4395 * Makefile.in: Rebuild with automake 1.11.1.
4396 * aclocal.m4: Likewise.
4397 * testsuite/Makefile.in: Likewise.
4398
4399 2010-08-19 Ian Lance Taylor <iant@google.com>
4400
4401 PR 10893
4402 * i386.cc (class Output_data_plt_i386): Update declarations.
4403 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4404 local_ifuncs_ fields.
4405 (Target_i386::do_plt_section_for_global): New function.
4406 (Target_i386::do_plt_section_for_local): New function.
4407 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4408 parameter; change all callers. Initialize global_ifuncs_ and
4409 local_ifuncs_. If doing a static link define __rel_iplt_start and
4410 __rel_iplt_end.
4411 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4412 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4413 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4414 symbols.
4415 (Target_i386::make_plt_section): New function, broken out of
4416 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4417 (Target_i386::make_plt_entry): Call make_plt_section.
4418 (Target_i386::make_local_ifunc_plt_entry): New function.
4419 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4420 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4421 R_386_IRELATIVE to switch.
4422 (Target_i386::Scan::global): Likewise.
4423 (Target_i386::Relocate::relocate): Likewise.
4424 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4425 switch.
4426 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4427 (Target_x86_64::do_plt_section_for_global): New function.
4428 (Target_x86_64::do_plt_section_for_local): New function.
4429 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4430 parameter; change all callers. If doing a static link define
4431 __rela_iplt_start and __rela_iplt_end.
4432 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4433 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4434 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4435 to point to .plt.
4436 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4437 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4438 switch.
4439 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4440 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4441 R_X86_64_IRELATIVE to switch.
4442 (Target_x86_64::Scan::global): Likewise.
4443 (Target_x86_64::Relocate::relocate): Likewise.
4444 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4445 switch.
4446 * target.h (class Target): Add plt_section_for_global and
4447 plt_section_for_local functions. Add do_plt_section_for_global
4448 and do_plt_section_for_local virtual functions.
4449 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4450 clarifying comments.
4451 (Symbol::use_plt_offset): Handle IFUNC symbol.
4452 * object.cc (Sized_relobj::Sized_relobj): Initialize
4453 local_plt_offsets_.
4454 (Sized_relobj::local_has_plt_offset): New function.
4455 (Sized_relobj::local_plt_offset): New function.
4456 (Sized_relobj::set_local_plt_offset): New function.
4457 (Sized_relobj::do_count): Handle IFUNC symbol.
4458 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4459 a bit away from input_shndx_ field. Add set_is_func_symbol and
4460 is_ifunc_symbol functions.
4461 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4462 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4463 local_plt_offsets_ field.
4464 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4465 * output.h (class Output_section_data): Add non-const
4466 output_section function.
4467 (class Output_data_got): Update declarations.
4468 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4469 Add use_plt_offset parameter to global and local constructors.
4470 Change all callers. Change local_sym_index_ field to 31 bits.
4471 Change GSYM_CODE and CONSTANT_CODE accordingly.
4472 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4473 doing a static link don't set sh_link field.
4474 (Output_data_got::Got_entry::write): Use PLT offset if
4475 appropriate.
4476 (Output_data_got::add_global_plt): New function.
4477 (Output_data_got::add_local_plt): New function.
4478 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4479 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4480 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4481 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4482 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4483 IFUNC conditional.
4484 * testsuite/ifunc-sel.h: New file.
4485 * testsuite/ifuncmain1.c: New file.
4486 * testsuite/ifuncmain1vis.c: New file.
4487 * testsuite/ifuncmod1.c: New file.
4488 * testsuite/ifuncdep2.c: New file.
4489 * testsuite/ifuncmain2.c: New file.
4490 * testsuite/ifuncmain3.c: New file.
4491 * testsuite/ifuncmod3.c: New file.
4492 * testsuite/ifuncmain4.c: New file.
4493 * testsuite/ifuncmain5.c: New file.
4494 * testsuite/ifuncmod5.c: New file.
4495 * testsuite/ifuncmain6pie.c: New file.
4496 * testsuite/ifuncmod6.c: New file.
4497 * testsuite/ifuncmain7.c: New file.
4498 * configure, testsuite/Makefile.in: Rebuild.
4499
4500 2010-08-18 Ian Lance Taylor <iant@google.com>
4501
4502 * incremental.cc
4503 (Output_section_incremental_inputs::write_input_files): Add cast
4504 to avoid signed/unsigned comparison warning.
4505 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4506
4507 2010-08-12 Cary Coutant <ccoutant@google.com>
4508
4509 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4510
4511 2010-08-13 Ian Lance Taylor <iant@google.com>
4512
4513 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4514
4515 2010-08-12 Cary Coutant <ccoutant@google.com>
4516 Doug Kwan <dougkwan@google.com>
4517
4518 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4519 defintion overrides non-weak undef, remember that the original undef
4520 is not weak.
4521 * symtab.cc (Symbol_table::sized_write_global): For undef without
4522 an original weak binding, set binding to global in output.
4523 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4524 * testsuite/Makefile.in: Regenerate.
4525 * testsuite/strong_ref_weak_def.sh: New file.
4526 * testsuite/strong_ref_weak_def_1.c: Ditto.
4527 * testsuite/strong_ref_weak_def_2.c: Ditto.
4528
4529 2010-08-12 Cary Coutant <ccoutant@google.com>
4530
4531 * testsuite/incremental_test.sh: Rewrite.
4532 * testsuite/incremental_test_1.c: Rewrite.
4533 * testsuite/incremental_test_2.c: Rewrite.
4534
4535 2010-08-12 Cary Coutant <ccoutant@google.com>
4536
4537 * arm.cc (Target_arm::got_size): Add const.
4538 (Target_arm::got_entry_count): New function.
4539 (Target_arm::plt_entry_count): New function.
4540 (Target_arm::first_plt_entry_offset): New function.
4541 (Target_arm::plt_entry_size): New function.
4542 (Output_data_plt_arm::entry_count): New function.
4543 (Output_data_plt_arm::first_plt_entry_offset): New function.
4544 (Output_data_plt_arm::get_plt_entry_size): New function.
4545 * i386.cc (Target_i386::got_size): Add const.
4546 (Target_i386::got_entry_count): New function.
4547 (Target_i386::plt_entry_count): New function.
4548 (Target_i386::first_plt_entry_offset): New function.
4549 (Target_i386::plt_entry_size): New function.
4550 (Output_data_plt_i386::entry_count): New function.
4551 (Output_data_plt_i386::first_plt_entry_offset): New function.
4552 (Output_data_plt_i386::get_plt_entry_size): New function.
4553 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4554 find_incremental_inputs_sections. Dump incremental_got_plt section.
4555 * incremental.cc: Include target.h.
4556 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4557 parameter. Adjust all callers. Find incremental_got_plt section.
4558 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4559 section.
4560 (Output_section_incremental_inputs::set_final_data_size): Calculate
4561 size of incremental_got_plt section.
4562 (Output_section_incremental_inputs::do_write): Write the
4563 incremental_got_plt section.
4564 (Got_plt_view_info): New struct.
4565 (Local_got_offset_visitor): New class.
4566 (Global_got_offset_visitor): New class.
4567 (Global_symbol_visitor_got_plt): New class.
4568 (Output_section_incremental_inputs::write_got_plt): New function.
4569 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4570 Add parameter. Adjust all callers.
4571 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4572 (Incremental_inputs::got_plt_section): New function.
4573 (Incremental_inputs::got_plt_section_): New data member.
4574 (Incremental_got_plt_reader): New class.
4575 * layout.cc (Layout::create_incremental_info_sections): Add the
4576 incremental_got_plt section.
4577 * object.h (Got_offset_list::get_list): New function.
4578 (Got offset_list::for_all_got_offsets): New function.
4579 (Sized_relobj::local_got_offset_list): New function.
4580 * powerpc.cc (Target_powerpc::got_size): Add const.
4581 (Target_powerpc::got_entry_count): New function.
4582 (Target_powerpc::plt_entry_count): New function.
4583 (Target_powerpc::first_plt_entry_offset): New function.
4584 (Target_powerpc::plt_entry_size): New function.
4585 (Output_data_plt_powerpc::entry_count): New function.
4586 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4587 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4588 * sparc.cc (Target_sparc::got_size): Add const.
4589 (Target_sparc::got_entry_count): New function.
4590 (Target_sparc::plt_entry_count): New function.
4591 (Target_sparc::first_plt_entry_offset): New function.
4592 (Target_sparc::plt_entry_size): New function.
4593 (Output_data_plt_sparc::entry_count): New function.
4594 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4595 (Output_data_plt_sparc::get_plt_entry_size): New function.
4596 * symtab.h (Symbol::got_offset_list): New function.
4597 (Symbol_table::for_all_symbols): New function.
4598 * target.h (Sized_target::got_entry_count): New function.
4599 (Sized_target::plt_entry_count): New function.
4600 (Sized_target::plt_entry_size): New function.
4601 * x86_64.cc (Target_x86_64::got_size): Add const.
4602 (Target_x86_64::got_entry_count): New function.
4603 (Target_x86_64::plt_entry_count): New function.
4604 (Target_x86_64::first_plt_entry_offset): New function.
4605 (Target_x86_64::plt_entry_size): New function.
4606 (Output_data_plt_x86_64::entry_count): New function.
4607 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4608 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4609
4610 2010-08-12 Cary Coutant <ccoutant@google.com>
4611
4612 * archive.cc: Include incremental.h.
4613 (Archive::Archive): Initialize incremental_info_.
4614 (Archive::include_member): Record archive members in incremental info.
4615 (Add_archive_symbols::run): Record begin and end of an archive in
4616 incremental info.
4617 (Lib_group::include_member): Record objects in incremental info.
4618 * archive.h (Incremental_archive_entry): Forward declaration.
4619 (Archive::set_incremental_info): New member function.
4620 (Archive::incremental_info): New member function.
4621 (Archive::Unused_symbol_iterator): New class.
4622 (Archive::unused_symbols_begin): New member function.
4623 (Archive::unused_symbols_end): New member function.
4624 (Archive::incremental_info_): New data member.
4625 * incremental-dump.cc (find_input_containing_global): New function.
4626 (dump_incremental_inputs): Dump new incremental info sections.
4627 * incremental.cc: Include symtab.h.
4628 (Output_section_incremental_inputs): New class.
4629 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4630 new incremental info sections.
4631 (Sized_incremental_binary::do_check_inputs): Likewise.
4632 (Incremental_inputs::report_archive): Remove.
4633 (Incremental_inputs::report_archive_begin): New function.
4634 (Incremental_inputs::report_archive_end): New function.
4635 (Incremental_inputs::report_object): New function.
4636 (Incremental_inputs::finalize_inputs): Remove.
4637 (Incremental_inputs::report_input_section): New function.
4638 (Incremental_inputs::report_script): Rewrite.
4639 (Incremental_inputs::finalize): Do nothing but finalize string table.
4640 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4641 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4642 (Incremental_inputs::create_data_sections): New function.
4643 (Incremental_inputs::relocs_entsize): New function.
4644 (Output_section_incremental_inputs::set_final_data_size): New function.
4645 (Output_section_incremental_inputs::do_write): New function.
4646 (Output_section_incremental_inputs::write_header): New function.
4647 (Output_section_incremental_inputs::write_input_files): New function.
4648 (Output_section_incremental_inputs::write_info_blocks): New function.
4649 (Output_section_incremental_inputs::write_symtab): New function.
4650 * incremental.h (Incremental_script_entry): Forward declaration.
4651 (Incremental_object_entry): Forward declaration.
4652 (Incremental_archive_entry): Forward declaration.
4653 (Incremental_inputs): Forward declaration.
4654 (Incremental_inputs_header_data): Remove.
4655 (Incremental_inputs_header): Remove.
4656 (Incremental_inputs_header_write): Remove.
4657 (Incremental_inputs_entry_data): Remove.
4658 (Incremental_inputs_entry): Remove.
4659 (Incremental_inputs_entry_write): Remove.
4660 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4661 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4662 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4663 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4664 Likewise.
4665 (Incremental_input_entry): New class.
4666 (Incremental_script_entry): New class.
4667 (Incremental_object_entry): New class.
4668 (Incremental_archive_entry): New class.
4669 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4670 (Incremental_inputs::report_inputs): Remove.
4671 (Incremental_inputs::report_archive): Remove.
4672 (Incremental_inputs::report_archive_begin): New function.
4673 (Incremental_inputs::report_archive_end): New function.
4674 (Incremental_inputs::report_object): Change prototype.
4675 (Incremental_inputs::report_input_section): New function.
4676 (Incremental_inputs::report_script): Change prototype.
4677 (Incremental_inputs::get_reloc_count): New function.
4678 (Incremental_inputs::set_reloc_count): New function.
4679 (Incremental_inputs::create_data_sections): New function.
4680 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4681 (Incremental_inputs::inputs_section): New function.
4682 (Incremental_inputs::symtab_section): New function.
4683 (Incremental_inputs::relocs_section): New function.
4684 (Incremental_inputs::get_stringpool): Add const.
4685 (Incremental_inputs::command_line): Add const.
4686 (Incremental_inputs::inputs): Remove.
4687 (Incremental_inputs::command_line_key): New function.
4688 (Incremental_inputs::input_file_count): New function.
4689 (Incremental_inputs::input_files): New function.
4690 (Incremental_inputs::relocs_entsize): New function.
4691 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4692 (Incremental_inputs::finalize_inputs): Remove.
4693 (Incremental_inputs::Input_info): Remove.
4694 (Incremental_inputs::lock_): Remove.
4695 (Incremental_inputs::inputs_): Change type.
4696 (Incremental_inputs::inputs_map_): Remove.
4697 (Incremental_inputs::current_object_entry_): New data member.
4698 (Incremental_inputs::inputs_section_): New data member.
4699 (Incremental_inputs::symtab_section_): New data member.
4700 (Incremental_inputs::relocs_section_): New data member.
4701 (Incremental_inputs::reloc_count_): New data member.
4702 (Incremental_inputs_reader): New class.
4703 (Incremental_symtab_reader): New class.
4704 (Incremental_relocs_reader): New class.
4705 * layout.cc (Layout::finalize): Move finalization of incremental info
4706 and creation of incremental info sections to follow finalization of
4707 symbol table. Set offsets for postprocessing sections.
4708 (Layout::create_incremental_info_sections): Call
4709 Incremental_inputs::create_data_sections. Add incremental symtab
4710 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4711 sections to layout after input sections.
4712 * layout.h (struct Timespec): Forward declaration.
4713 (Layout::incremental_inputs): Add const.
4714 (Layout::create_incremental_info_sections): Add parameter.
4715 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4716 * object.cc: Include incremental.h.
4717 (Relobj::finalize_incremental_relocs): New function.
4718 (Sized_relobj::do_layout): Record input sections in incremental info.
4719 * object.h (Object::output_section): New function.
4720 (Object::output_section_offset): Moved from Relobj.
4721 (Object::get_incremental_reloc_base): New function.
4722 (Object::get_incremental_reloc_count): New function.
4723 (Object::do_output_section): New function.
4724 (Object::do_output_section_offset): Moved from Relobj.
4725 (Object::do_get_incremental_reloc_base): New function.
4726 (Object::do_get_incremental_reloc_count): New function.
4727 (Object::Object): Initialize new data members.
4728 (Relobj::output_section): Renamed do_output_section and moved to
4729 protected.
4730 (Relobj::output_section_offset): Moved to Object.
4731 (Relobj::do_get_incremental_reloc_base): New function.
4732 (Relobj::do_get_incremental_reloc_count): New function.
4733 (Relobj::allocate_incremental_reloc_counts): New function.
4734 (Relobj::count_incremental_reloc): New function.
4735 (Relobj::finalize_incremental_relocs): New function.
4736 (Relobj::next_incremental_reloc_index): New function.
4737 (Relobj::reloc_counts_): New data member.
4738 (Relobj::reloc_bases_): New data member.
4739 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4740 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4741 (Sized_relobj::incremental_relocs_scan): New function.
4742 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4743 (Sized_relobj::incremental_relocs_write): New function.
4744 (Sized_relobj::incremental_relocs_write_reltype): New function.
4745 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4746 incremental link.
4747 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4748 archives and object files elsewhere.
4749 (Add_symbols::run): Report object files here.
4750 (Finish_group::run): Report end of archive at end of group.
4751 * reloc.cc: Include layout.h, incremental.h.
4752 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4753 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4754 (Sized_relobj::incremental_relocs_scan): New function.
4755 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4756 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4757 (Sized_relobj::incremental_relocs_write): New function.
4758 (Sized_relobj::incremental_relocs_write_reltype): New function.
4759 * script.cc (read_input_script): Rewrite test for incremental link.
4760 Change call to Incremental_inputs::report_script.
4761 * symtab.h (Symbol_table::first_global_index): New function.
4762 (Symbol_table::output_count): New function.
4763
4764 2010-08-12 Doug Kwan <dougkwan@google.com>
4765
4766 * arm.cc (Target_arm::merge_object_attributes): Check command line
4767 options --no-wchar-size-warning and --no-enum-size-warning.
4768 * options.h (General_options): Add ld-compatible options
4769 --no-enum-size-warning and --no-wchar-size-warning.
4770
4771 2010-08-04 Ian Lance Taylor <iant@google.com>
4772
4773 * x86_64.cc (Target_x86_64::Scan::local): Use
4774 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4775 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4776 (Target_x86_64::Scan::global): Likewise.
4777 (Target_x86_64::Relocate::relocate): Likewise.
4778 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4779 Likewise.
4780
4781 2010-08-03 Cary Coutant <ccoutant@google.com>
4782
4783 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4784 to reserve space in merged_strings vector. Keep total input size
4785 for stats.
4786 (Output_merge_string::do_print_merge_stats): Print total input size.
4787 * merge.h (Output_merge_string): Add input_size_ field.
4788 * stringpool.cc (Stringpool_template::string_length): Move
4789 implementations out of Stringpool_template class and place in
4790 stringpool.h.
4791 * stringpool.h (string_length): Move out of Stringpool_template.
4792
4793 2010-08-03 Ian Lance Taylor <iant@google.com>
4794
4795 PR 11712
4796 * layout.cc (relaxation_loop_body): If address of load segment is
4797 set, adjust address to include headers if possible.
4798
4799 2010-08-03 Ian Lance Taylor <iant@google.com>
4800
4801 * version.cc (version_string): Bump to 1.10.
4802
4803 2010-08-03 Ian Lance Taylor <iant@google.com>
4804
4805 PR 11805
4806 * layout.h (enum Output_section_order): Define.
4807 (class Layout): Update declarations.
4808 * layout.cc (Layout::get_output_section): Add order parameter.
4809 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4810 is_first_non_relro parameters. Change all callers.
4811 (Layout::choose_output_section): Likewise.
4812 (Layout::add_output_section_data): Likewise.
4813 (Layout::make_output_section): Likewise. Set order.
4814 (Layout::default_section_order): New function.
4815 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4816 * output.cc (Output_section::Output_section): Initialize order_.
4817 Don't initialize deleted fields.
4818 (Output_segment::Output_segment): Don't initialize deleted
4819 fields.
4820 (Output_segment::add_output_section_to_load): New function
4821 replacing add_output_section. Change all callers to call this or
4822 add_output_section_to_nonload.
4823 (Output_segment::add_output_section_to_nonload): New function.
4824 (Output_segment::remove_output_section): Rewrite.
4825 (Output_segment::add_initial_output_data): Likewise.
4826 (Output_segment::has_any_data_sections): Likewise.
4827 (Output_segment::is_first_section_relro): Likewise.
4828 (Output_segment::maximum_alignment): Likewise.
4829 (Output_segment::has_dynamic_reloc): New function replacing
4830 dynamic_reloc_count. Change all callers.
4831 (Output_segment::has_dynamic_reloc_list): New function replacing
4832 dynamic_reloc_count_list. Change all callers.
4833 (Output_segment::set_section_addresses): Rewrite.
4834 (Output_segment::set_offset): Rewrite.
4835 (Output_segment::find_first_and_last_list): Remove.
4836 (Output_segment::set_tls_offsets): Rewrite.
4837 (Output_segment::first_section_load_address): Likewise.
4838 (Output_segment::output_section_count): Likewise.
4839 (Output_segment::section_with_lowest_load_address): Likewise.
4840 (Output_segment::write_section_headers): Likewise.
4841 (Output_segment::print_sections_to_map): Likewise.
4842 * output.h (class Output_data): Remove dynamic_reloc_count_
4843 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4844 (Output_data::add_dynamic_reloc): Rewrite.
4845 (Output_data::has_dynamic_reloc): New function.
4846 (Output_data::dynamic_reloc_count): Remove.
4847 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4848 is_last_relro_, is_first_non_relro_, is_interp_,
4849 is_dynamic_linker_section_ fields. Add order and set_order
4850 functions. Remove is_relro_local, set_is_relro_local,
4851 is_last_relro, set_is_last_relro, is_first_non_relro,
4852 set_is_first_non_relro functions, is_interp, set_is_interp,
4853 is_dynamic_linker_section, and set_is_dynamic_linker_section
4854 functions.
4855 (class Output_segment): Change Output_data_list from std::list to
4856 std:;vector. Add output_lists_ field. Remove output_data_ and
4857 output_bss_ fields. Update declarations.
4858
4859 2010-08-02 Ian Lance Taylor <iant@google.com>
4860
4861 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4862 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4863 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4864
4865 2010-08-02 Ian Lance Taylor <iant@google.com>
4866
4867 PR 11855
4868 * script.cc (Script_options::Script_options): Initialize
4869 symbol_definitions_ and symbol_references_.
4870 (Script_options::add_symbol_assignment): Update
4871 symbol_definitions_ and symbol_references_.
4872 (Script_options::add_symbol_reference): New function.
4873 (script_symbol): New function.
4874 * script.h (class Script_options): Add symbol_definitions_ and
4875 symbol_references_ fields.
4876 (Script_options::referenced_const_iterator): New type.
4877 (Script_options::referenced_begin): New function.
4878 (Script_options::referenced_end): New function.
4879 (Script_options::is_referenced): New function.
4880 (Script_options::any_unreferenced): New function.
4881 * script-c.h (script_symbol): Declare.
4882 * yyscript.y (exp): Call script_symbol.
4883 * symtab.cc: Include "script.h".
4884 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4885 Change all callers. Check symbols referenced by scripts.
4886 (Symbol_table::add_undefined_symbols_from_command_line): Add
4887 layout parameter. Change all callers.
4888 (Symbol_table::do_add_undefined_symbols_from_command_line):
4889 Likewise. Break out loop body. Check symbols referenced by
4890 scripts.
4891 (Symbol_table::add_undefined_symbol_from_command_line): New
4892 function broken out of
4893 do_add_undefined_symbols_from_command_line.
4894 * symtab.h (class Symbol_table): Update declarations.
4895 * archive.cc: Include "layout.h".
4896 (Archive::should_include_member): Add layout parameter. Change
4897 all callers. Check for symbol mentioned in expression.
4898 * archive.h (class Archive): Update declaration.
4899 * object.cc (Sized_relobj::do_should_include_member): Add layout
4900 parameter.
4901 * object.h (Object::should_include_member): Add layout parameter.
4902 Change all callers.
4903 (Object::do_should_include_member): Add layout parameter.
4904 (class Sized_relobj): Update declaration.
4905 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4906 parameter.
4907 * dynobj.h (class Sized_dynobj): Update declaration.
4908 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4909 layout parameter.
4910 * plugin.h (class Sized_pluginobj): Update declaration.
4911
4912 2010-08-02 Ian Lance Taylor <iant@google.com>
4913
4914 PR 11866
4915 * output.cc (Output_segment::set_offset): Search for the first and
4916 last sections rather than assuming that the list is in order.
4917 (Output_segment::find_first_and_last_list): New function.
4918 * output.h (class Output_segment): Update declarations.
4919 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4920 (relro_strip_test_SOURCES): New variable.
4921 (relro_strip_test_DEPENDENCIES): New variable.
4922 (relro_strip_test_LDFLAGS): New variable.
4923 (relro_strip_test_LDADD): New variable.
4924 (relro_strip_test.so): New target.
4925
4926 2010-08-02 Ian Lance Taylor <iant@google.com>
4927
4928 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4929 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4930 (Target_i386::got_tlsdesc_section): New function.
4931 (Target_i386::got_section): Create space for GOT entries for
4932 TLSDESC relocations.
4933 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4934 R_386_TLS_GOTDESC.
4935 (Target_i386::Scan::global): Likewise.
4936 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4937 using TLSDESC GOT.
4938 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4939 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4940 (Target_x86_64::got_tlsdesc_section): New function.
4941 (Target_x86_64::got_section): Create space for GOT entries for
4942 TLSDESC relocations.
4943 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4944 R_386_TLS_GOTDESC.
4945 (Target_x86_64::Scan::global): Likewise.
4946 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4947 using TLSDESC GOT.
4948
4949 2010-08-02 Ian Lance Taylor <iant@google.com>
4950
4951 * testsuite/final_layout.sh: Use dc to convert from hex to
4952 decimal.
4953
4954 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4955
4956 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4957 paramter to the call to gold::gc_process_relocs.
4958 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4959 paramter to the call to gold::gc_process_relocs.
4960 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4961 parameter to the call to gold::gc_process_relocs.
4962 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4963 template parameter to the call to gold::gc_process_relocs.
4964 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4965 paramter to the call to gold::gc_process_relocs.
4966 * gc.h (get_embedded_addend_size): New function.
4967 (gc_process_relocs): Save the size of the reloc for use by ICF.
4968 * icf.cc (get_section_contents): Get the addend from the text section
4969 for SHT_REL relocation sections.
4970 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4971 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4972 * int_encoding.h (read_from_pointer): New overloaded function.
4973 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4974 * testsuite/icf_sht_rel_addend_test.sh: New file.
4975 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4976 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4977
4978 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4979
4980 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4981 * Makefile.in: Regenerate.
4982 * testsuite/Makefile.in: Regenerate.
4983
4984 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4985
4986 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4987 * gold/testsuite/debug_msg.cc: Likewise.
4988 * gold/testsuite/odr_violation1.cc
4989 * gold/testsuite/odr_violation2.cc
4990
4991 2010-07-21 Cary Coutant <ccoutant@google.com>
4992
4993 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4994 string, and length fields.
4995 (Output_merge_string::Merged_strings_list): New type.
4996 (Output_merge_string::Merged_strings_lists): New typedef.
4997 (Output_merge_string): Replace merged_strings_ with
4998 merged_strings_lists_.
4999 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5000 Merged_strings_list per input object and section. Don't store pointer
5001 to the string. Don't store length with each merged string entry.
5002 (Output_merge_string::finalize_merged_data): Loop over list of merged
5003 strings lists. Recompute length of each merged string.
5004
5005 2010-07-15 Cary Coutant <ccoutant@google.com>
5006
5007 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5008 here.
5009
5010 2010-07-14 Ian Lance Taylor <iant@google.com>
5011
5012 * descriptors.cc (Descriptors::open): Report correct name in error
5013 message.
5014
5015 2010-07-13 Doug Kwan <dougkwan@google.com>
5016
5017 * arm.cc (Arm_input_section::Arm_input_section): For a
5018 SHT_ARM_EXIDX section, always keeps the input sections.
5019 (Arm_input_section::set_exidx_section_link): New method.
5020 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5021 has_errors_ to false.
5022 (Arm_exidx_input_section::has_errors,
5023 Arm_exidx_input_section::set_has_errors): New methods.
5024 (Arm_exidx_input_section::has_errors_): New data member.
5025 (Arm_relobj::get_exidx_shndx_list): New method.
5026 (Arm_output_section::append_text_sections_to_list): Do not skip
5027 section without SHF_EXECINSTR.
5028 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5029 errors.
5030 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5031 section header. Make error messages more verbose. Check for
5032 a non-executable section linked to an EXIDX section.
5033 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5034 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5035 check that there is no deferred EXIDX section if we exit early.
5036 Instead of not making an EXIDX section in case of an error, make one
5037 and set the has_errors flag of it.
5038 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5039 in a relocatable link.
5040 (Target_arm::do_relax): Look for the EXIDX output section instead of
5041 assuming that it is called .ARM.exidx.
5042 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5043 section list. Do not check for SHF_EXECINSTR section flags but
5044 skip any input section with errors.
5045 * output.cc (Output_section::Output_section): Initialize
5046 always_keeps_input_sections_ to false.
5047 (Output_section::add_input_section): Check for
5048 always_keeps_input_sections_.
5049 * output.h (Output_section::always_keeps_input_sections,
5050 Output_section::set_always_keeps_input_sections): New methods.
5051 (Output_section::always_keeps_input_sections): New data member.
5052
5053 2010-07-13 Rafael Espindola <espindola@google.com>
5054
5055 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5056 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5057
5058 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5059 Ian Lance Taylor <iant@google.com>
5060
5061 * output.h (Output_section_lookup_maps::add_merge_section):
5062 Correct check of whether value was inserted.
5063 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5064 (Output_section_lookup_maps::add_relaxed_input_section):
5065 Likewise.
5066 * arm.cc (Target_arm::got_section): Remove used local os.
5067 * i386.cc (Target_i386::got_section): Likewise.
5068 * x86_64.cc (Target_x86_64::got_section): Likewise.
5069 * sparc.cc (Target_sparc::got_section): Likewise.
5070 (Target_sparc::relocate): Remove unused local have_got_offset.
5071 * powerpc.cc (Target_powerpc::relocate): Likewise.
5072
5073 2010-07-13 Ian Lance Taylor <iant@google.com>
5074
5075 * compressed_output.cc (zlib_decompress): Fix signature in
5076 !HAVE_ZLIB_H case.
5077
5078 * archive.cc (Archive::include_member): Unlock an external member
5079 of a thin archive. Don't bother to delete an object we know is
5080 NULL.
5081
5082 2010-07-12 Cary Coutant <ccoutant@google.com>
5083
5084 * compressed_output.cc (zlib_decompress): New function.
5085 (get_uncompressed_size): New function.
5086 (decompress_input_section): New function.
5087 * compressed_output.h (get_uncompressed_size): New function.
5088 (decompress_input_section): New function.
5089 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5090 Handle compressed debug sections.
5091 * layout.cc (is_compressed_debug_section): New function.
5092 (Layout::output_section_name): Map compressed section names to
5093 canonical names.
5094 * layout.h (is_compressed_debug_section): New function.
5095 (is_debug_info_section): Recognize compressed debug sections.
5096 * merge.cc: Include compressed_output.h.
5097 (Output_merge_data::do_add_input_section): Handle compressed
5098 debug sections.
5099 (Output_merge_string::do_add_input_section): Handle compressed
5100 debug sections.
5101 * object.cc: Include compressed_output.h.
5102 (Sized_relobj::Sized_relobj): Initialize new data members.
5103 (build_compressed_section_map): New function.
5104 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5105 * object.h (Object::section_is_compressed): New method.
5106 (Object::do_section_is_compressed): New method.
5107 (Sized_relobj::Compressed_section_map): New type.
5108 (Sized_relobj::do_section_is_compressed): New method.
5109 (Sized_relobj::compressed_sections_): New data member.
5110 * output.cc (Output_section::add_input_section): Handle compressed
5111 debug sections.
5112 * reloc.cc: Include compressed_output.h.
5113 (Sized_relobj::write_sections): Handle compressed debug sections.
5114
5115 2010-07-08 Cary Coutant <ccoutant@google.com>
5116
5117 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5118 weak when resolving to a dynamic def.
5119 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5120 for weak undef/dynamic def cases. Adjust callers.
5121 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5122 undef_binding_weak_.
5123 (Symbol_table::sized_write_globals): Adjust symbol binding.
5124 (Symbol_table::sized_write_symbol): Add binding parameter.
5125 * symtab.h (Symbol::set_undef_binding): New method.
5126 (Symbol::is_undef_binding_weak): New method.
5127 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5128 (Symbol_table::should_override): Add new parameter.
5129 (Symbol_table::sized_write_symbol): Add new parameter.
5130
5131 * testsuite/weak_undef_file1.cc: Add new test case.
5132 * testsuite/weak_undef_file2.cc: Fix header comment.
5133 * testsuite/weak_undef_test.cc: Add new test case.
5134
5135 2010-06-29 Doug Kwan <dougkwan@google.com>
5136
5137 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5138 Initialize USE_SYMBOL_.
5139 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5140 definition.
5141 (Arm_reloc_property::uses_symbol_): New data member declaration.
5142 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5143 uses symbol value and symbol is undefined but not weakly undefined.
5144
5145 2010-06-28 Rafael Espindola <espindola@google.com>
5146
5147 * plugin.cc (Plugin::load): Use dlerror.
5148
5149 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5150
5151 * symtab.cc (detect_odr_violations): When reporting an ODR
5152 violation, report an object where the symbol is defined.
5153
5154 2010-06-25 Doug Kwan <dougkwan@google.com>
5155
5156 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5157 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5158 definition.
5159 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5160 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5161 target hook to detect function points.
5162 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5163 * icf.h (Icf::check_section_for_function_pointers): Change type of
5164 parameter SECTION_NAME to const reference to std::string. Use
5165 target hook to determine if section may have unsafe pointers.
5166 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5167 method definition.
5168
5169 2010-06-21 Rafael Espindola <espindola@google.com>
5170
5171 * fileread.cc (Input_file::find_fie): New
5172 (Input_file::open): Use Input_file::find_fie.
5173 * fileread.h (Input_file::find_fie): New
5174 * plugin.cc (set_extra_library_path): New.
5175 (Plugin::load): Add set_extra_library_path to the transfer vector.
5176 (Plugin_manager::set_extra_library_path): New.
5177 (Plugin_manager::add_input_file): Use the extra search path if set.
5178 (set_extra_library_path(): New.
5179 * plugin.h (Plugin_manager): Add set_extra_library_path and
5180 extra_search_path_.
5181
5182 2010-06-19 Cary Coutant <ccoutant@google.com>
5183
5184 * layout.cc (gdb_sections): Add .debug_types.
5185 (lines_only_debug_sections): Likewise.
5186
5187 2010-06-18 Rafael Espindola <espindola@google.com>
5188
5189 * plugin.cc (add_input_file,add_input_library)
5190 (Plugin_manager::add_input_file): Make filename arguments const.
5191 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5192 const.
5193
5194 2010-06-16 Doug Kwan <dougkwan@google.com>
5195
5196 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5197 .ARM.attributes section if we have not merged any input
5198 attributes sections.
5199
5200 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5201
5202 * arm.cc: Allow combining objects with no EABI version
5203 information.
5204
5205 2010-06-15 Rafael Espindola <espindola@google.com>
5206
5207 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5208
5209 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5210
5211 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5212 (struct iovec): Correct !HAVE_READV definition.
5213
5214 2010-06-10 Cary Coutant <ccoutant@google.com>
5215
5216 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5217 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5218 reloc sections.
5219 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5220
5221 PR 11683
5222 * symtab.h (Symbol::is_placeholder): New member function.
5223 * target-reloc.h (relocate_section): Check for placeholder symbols.
5224
5225 * testsuite/Makefile.am (plugin_test_8): New test.
5226 (plugin_test_9): New test.
5227 * testsuite/Makefile.in: Regenerate.
5228
5229 2010-06-09 Nick Clifton <nickc@redhat.com>
5230
5231 * yyscript.y (input_list_element): Allow strings prefixed with
5232 the '-' character. Treat these as libraries.
5233 * script.cc (script_add_library): New function. Adds a library
5234 specified by "-l<name>" found in an input script.
5235 * script-c.h: Add prototype for script_add_library.
5236
5237 2010-06-07 Doug Kwan <dougkwan@google.com>
5238
5239 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5240 Restrict stub-group size to be within long conditional branch
5241 range when working around cortex-A8 erratum.
5242
5243 2010-06-07 Damien Diederen <dd@crosstwine.com>
5244
5245 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5246 #ifdef typo.
5247
5248 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5249
5250 PR gold/11658
5251 * output.cc
5252 (Output_section::Input_section_sort_entry::compare_section_ordering):
5253 Change to return non-zero correctly.
5254 (Output_section::Input_section_sort_section_order_index_compare
5255 ::operator()): Change to fix ambiguity in comparisons.
5256
5257 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5258
5259 * gold.h (is_wildcard_string): New function.
5260 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5261 (Layout::layout_eh_frame): Ditto.
5262 (Layout::find_section_order_index): New method.
5263 (Layout::read_layout_from_file): New method.
5264 * layout.h (Layout::find_section_order_index): New method.
5265 (Layout::read_layout_from_file): New method.
5266 (Layout::input_section_position_): New private member.
5267 (Layout::input_section_glob_): New private member.
5268 * main.cc (main): Call read_layout_from_file here.
5269 * options.h (--section-ordering-file): New option.
5270 * output.cc (Output_section::input_section_order_specified_): New
5271 member.
5272 (Output_section::Output_section): Initialize new member.
5273 (Output_section::add_input_section): Add new parameter.
5274 Keep input sections when --section-ordering-file is used.
5275 (Output_section::set_final_data_size): Sort input sections when
5276 section ordering file is specified.
5277 (Output_section::Input_section_sort_entry): Add new parameter.
5278 Check sorting type.
5279 (Output_section::Input_section_sort_entry::compare_section_ordering):
5280 New method.
5281 (Output_section::Input_section_sort_compare::operator()): Change to
5282 consider section_order_index.
5283 (Output_section::Input_section_sort_init_fini_compare::operator()):
5284 Change to consider section_order_index.
5285 (Output_section::Input_section_sort_section_order_index_compare
5286 ::operator()): New method.
5287 (Output_section::sort_attached_input_sections): Change to sort
5288 according to section order when specified.
5289 (Output_section::add_input_section<32, true>): Add new parameter.
5290 (Output_section::add_input_section<64, true>): Add new parameter.
5291 (Output_section::add_input_section<32, false>): Add new parameter.
5292 (Output_section::add_input_section<64, false>): Add new parameter.
5293 * output.h (Output_section::add_input_section): Add new parameter.
5294 (Output_section::input_section_order_specified): New
5295 method.
5296 (Output_section::set_input_section_order_specified): New method.
5297 (Input_section::Input_section): Initialize section_order_index_.
5298 (Input_section::section_order_index): New method.
5299 (Input_section::set_section_order_index): New method.
5300 (Input_section::section_order_index_): New member.
5301 (Input_section::Input_section_sort_section_order_index_compare): New
5302 struct.
5303 (Output_section::input_section_order_specified_): New member.
5304 * script-sections.cc (is_wildcard_string): Delete and move modified
5305 method to gold.h.
5306 (Output_section_element_input::Output_section_element_input): Modify
5307 call to is_wildcard_string.
5308 (Output_section_element_input::Input_section_pattern
5309 ::Input_section_pattern): Ditto.
5310 (Output_section_element_input::Output_section_element_input): Ditto.
5311 * testsuite/Makefile.am (final_layout): New test case.
5312 * testsuite/Makefile.in: Regenerate.
5313 * testsuite/final_layout.cc: New file.
5314 * testsuite/final_layout.sh: New file.
5315
5316 2010-06-01 Rafael Espindola <espindola@google.com>
5317
5318 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5319
5320 2010-06-01 Rafael Espindola <espindola@google.com>
5321
5322 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5323 visibility of symbols.
5324
5325 2010-05-27 Doug Kwan <dougkwan@google.com>
5326
5327 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5328 from start of output section instead of address for a local symbol
5329 in a merged or relaxed section when doing a relocatable link.
5330
5331 2010-05-26 Rafael Espindola <espindola@google.com>
5332
5333 PR 11604
5334 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5335 adding sections the garbage collector removed.
5336 * gold/testsuite/Makefile.am: Add test.
5337 * gold/testsuite/Makefile.in: Regenerate.
5338 * gold/testsuite/plugin_test_7.sh: New.
5339 * gold/testsuite/plugin_test_7_1.c: New.
5340 * gold/testsuite/plugin_test_7_2.c: New.
5341
5342 2010-05-26 Rafael Espindola <espindola@google.com>
5343
5344 * script-sections.cc (Output_section_definition::set_section_addresses):
5345 Check for --section-start.
5346
5347 2010-05-26 Doug Kwan <dougkwan@google.com>
5348
5349 * arm.cc (Arm_scan_relocatable_relocs): New class.
5350 (Target_arm::relocate_special_relocatable): New method.
5351 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5352 (Arm_relocate_functions::thumb_branch_common): Same.
5353 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5354 instead of Default_scan_relocatable_relocs.
5355 * target-reloc.h (relocate_for_relocatable): Let target handle
5356 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5357 * target.h (Sized_target::relocate_special_relocatable): New method.
5358
5359 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5360
5361 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5362
5363 2010-05-23 Doug Kwan <dougkwan@google.com>
5364
5365 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5366 instead of a cast.
5367 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5368 with a direct branch, not a conditional branch, to a stub.
5369 * merge.cc (Output_merge_base::record_input_section): New method
5370 defintion.
5371 (Output_merge_data::do_add_input_section): Record input section if
5372 keeps-input-sections flag is set.
5373 (Output_merge_string::do_add_input_section): Ditto.
5374 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5375 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5376 INPUT_SECTIONS_.
5377 (Output_merge_base::keeps_input_sections,
5378 Output_merge_base::set_keeps_input_sections,
5379 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5380 method definitions.
5381 (Output_merge_base::Input_sections): New type declaration.
5382 (Output_merge_base::input_sections_begin,
5383 Output_merge_base::input_sections_end,
5384 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5385 (Output_merge_base::bool keeps_input_sections_,
5386 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5387 Output_merge_base::input_sections_): New data members.
5388 (Output_merge_data::do_set_keeps_input_sections): New method
5389 defintion.
5390 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5391 * output.cc (Output_section::Input_section::relobj): Move method
5392 defintion from class declaration to here and handle merge sections.
5393 (Output_section::Input_section::shndx): Ditto.
5394 (Output_section::Output_section): Remove initializations of removed
5395 data members and initialize new data member LOOKUP_MAPS_.
5396 (Output_section::add_input_section): Set keeps-input-sections flag
5397 for a newly created merge output section as appropriate. Adjust code
5398 to use Output_section_lookup_maps class.
5399 (Output_section::add_relaxed_input_section): Adjst code for lookup
5400 maps code refactoring.
5401 (Output_section::add_merge_input_section): Add a new parameter
5402 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5403 class. If adding input section to a newly created merge output
5404 section fails, remove the new merge section.
5405 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5406 Adjust code for use of the Output_section_lookup_maps class.
5407 (Output_section::find_merge_section): Ditto.
5408 (Output_section::build_lookup_maps): New method defintion.
5409 (Output_section::find_relaxed_input_section): Adjust code to use
5410 Output_section_lookup_maps class.
5411 (Output_section::get_input_sections): Export merge sections. Adjust
5412 code to use Output_section_lookup_maps class.
5413 (Output_section:::add_script_input_section): Adjust code to use
5414 Output_section_lookup_maps class. Update lookup maps for merge
5415 sections also.
5416 (Output_section::discard_states): Use Output_section_lookup_maps.
5417 (Output_section::restore_states): Same.
5418 * output.h (Merge_section_properties): Move class defintion out of
5419 Output_section.
5420 (Output_section_lookup_maps): New class.
5421 (Output_section::Input_section::is_merge_section): New method
5422 defintion.
5423 (Output_section::Input_section::relobj): Move defintion out of class
5424 defintion. Declare method only.
5425 (Output_section::Input_section::shndx): Ditto.
5426 (Output_section::Input_section::output_merge_base): New method defintion.
5427 (Output_section::Input_section::u2_.pomb): New union field.
5428 (Output_section::Merge_section_by_properties_map,
5429 Output_section::Output_section_data_by_input_section_map,
5430 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5431 Remove types.
5432 (Output_section::add_merge_input_section): Add new parameter
5433 KEEPS_INPUT_SECTIONS.
5434 (Output_section::build_lookup_maps): New method declaration.
5435 (Output_section::merge_section_map_,
5436 Output_section::merge_section_by_properties_map_,
5437 Output_section::relaxed_input_section_map_,
5438 Output_section::is_relaxed_input_section_map_valid_): Remove data
5439 members.
5440 (Output_section::lookup_maps_): New data member.
5441
5442 2010-05-21 Doug Kwan <dougkwan@google.com>
5443
5444 PR gold/11619
5445 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5446 avoid a compilation error.
5447
5448 2010-05-19 Rafael Espindola <espindola@google.com>
5449
5450 * script-sections.cc (Output_section_definition::allocate_to_segment):
5451 Update the phdrs_list even when the output section is NULL.
5452 * testsuite/Makefile.am: Add test.
5453 * testsuite/Makefile.in: Regenerate.
5454 * testsuite/script_test_9.cc: New.
5455 * testsuite/script_test_9.sh: New.
5456 * testsuite/script_test_9.t: New.
5457
5458 2010-05-19 Doug Kwan <dougkwan@google.com>
5459
5460 * arm.cc (Arm_input_section::original_size): New method.
5461 (Arm_input_section::do_addralign): Add a cast.
5462 (Arm_input_section::do_output_offset): Remove static cast.
5463 (Arm_input_section::original_addralign,
5464 Arm_input_section::original_size_): Change type to uint32_t.
5465 (Arm_input_section::init): Add safe casts for section alignment
5466 and size.
5467 (Arm_input_section::set_final_data_size): Do not set address and
5468 offset of stub table.
5469 (Arm_output_section::fix_exidx_coverage): Change use of of
5470 Output_section::Simple_input_section to that of
5471 Output_section::Input_section.
5472 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5473 except for the first pass.
5474 * output.cc (Output_section::get_input_sections): Change type of
5475 input_sections to std::list<Input_section>.
5476 (Output_section::add_script_input_section): Rename from
5477 Output_section::add_simple_input_section. Change type of SIS
5478 parameter from Simple_input_section to Input_section.
5479 * output.h (Output_section::Simple_input_section): Remove class.
5480 (Output_section::Input_section): Change class visibility to public.
5481 (Output_section::Input_section::addralign): Use stored alignments
5482 for special input sections if set.
5483 (Output_section::Input_section::set_addralign): New method.
5484 (Output_section::get_input_sections): Change parameter type from
5485 list of Simple_input_section to list of Input_section.
5486 (Output_section::add_script_input_section): Rename from
5487 Output_section::add_simple_input_section. Change first parameter's
5488 type from Simple_input_section to Input_section and remove the
5489 second and third parameters.
5490 * script-sections.cc (Input_section::Input_section_list): Change
5491 type to list of Output_section::Input_section/
5492 (Input_section_info::Input_section_info): Change parameter type of
5493 INPUT_SECTION to Output_section::Input_section.
5494 (Input_section_info::input_section): Change return type.
5495 (Input_section_info::input_section_): Change type to
5496 Output_section::Input_section.
5497 (Output_section_element_input::set_section_addresses): Adjust code
5498 to use Output_section::Input_section instead of
5499 Output_section::Simple_input_section. Adjust code for renaming
5500 of Output_section::add_simple_input_section.
5501 (Orphan_output_section::set_section_addresses): Ditto.
5502
5503 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5504
5505 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5506 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5507
5508 2010-05-18 Rafael Espindola <espindola@google.com>
5509
5510 * options.cc (General_options::finalize): Handle -nostdlib.
5511 * options.h (nostdlib): New option.
5512 * script.cc (script_add_search_dir): Handle -nostdlib.
5513
5514 2010-05-12 Doug Kwan <dougkwan@google.com>
5515
5516 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5517 attributes section only if there no attributes section after merging.
5518 (Target_arm::merge_object_attributes): Move value of
5519 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5520 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5521 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5522 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5523 and arm_attr_merge_7.stdout.
5524 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5525 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5526 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5527 arm_attr_merge_7b.o): New rules.
5528 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5529 arm_attr_merge_7
5530 * testsuite/Makefile.in: Regenerate.
5531 * testsuite/arm_attr_merge.sh: New file.
5532 * testsuite/arm_attr_merge_[67][ab].s: Same.
5533
5534 2010-05-05 Nick Clifton <nickc@redhat.com>
5535
5536 * po/es.po: Updated Spanish translation.
5537
5538 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5539
5540 * Makefile.am (install-exec-local): Properly install gold as
5541 default cross linker.
5542 * Makefile.in: Regenerated.
5543
5544 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5545 Nick Clifton <nickc@redhat.com>
5546
5547 * configure.ac (install_as_default): Define and set to false
5548 unless --enable-gold or --enable-gold=both/gold has been
5549 specified.
5550 * configure: Regenerate.
5551
5552 * Makefile.am (install-exec-local): Install the executable as
5553 'ld.gold'. If install_as_default is true then also install it as
5554 'ld'.
5555 * Makefile.in: Regenerated.
5556
5557 2010-04-24 Ian Lance Taylor <iant@google.com>
5558
5559 * layout.cc (Layout::layout_reloc): In relocatable link don't
5560 combine reloc sections for grouped sections.
5561
5562 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5563
5564 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5565 sections that are not ordinary to icf.
5566 * icf.cc (get_section_contents): Handle relocation pointing to section
5567 with no object or shndx information.
5568 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5569 * testsuite/Makefile.in: Regenerate.
5570 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5571 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5572
5573 2010-04-22 Ian Lance Taylor <iant@google.com>
5574
5575 * expression.cc (Expression::Expression_eval_info): Add
5576 result_alignment_pointer field.
5577 (Expression::eval_with_dot): Add result_alignment_pointer
5578 parameter. Change all callers.
5579 (Expression::eval_maybe_dot): Likewise.
5580 (class Binary_expression): Add alignment_pointer parameter to
5581 left_value and right_value. Change all callers.
5582 (BINARY_EXPRESSION): Set result alignment.
5583 (class Trinary_expression): Add alignment_pointer parameter to
5584 arg2_value and arg3_value. Change all callers.
5585 (Trinary_cond::value): Set result alignment.
5586 (Max_expression::value, Min_expression::value): Likewise.
5587 (Align_expression::value): Likewise.
5588 * script-sections.cc (class Sections_element): Add dot_alignment
5589 parameter to set_section_addresses virtual function. Update
5590 instantiations.
5591 (class Output_section_element): Likewise.
5592 (Script_sections::create_segments): Add dot_alignment parameter.
5593 Change all callers.
5594 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5595 (Script_sections::set_phdrs_clause_addresses): Likewise.
5596 * script-sections.h: Update declarations.
5597 * script.h: Update declarations.
5598 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5599 min_p_align.
5600 * testsuite/script_test_3.t: Set large alignment.
5601 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5602 segment has expected alignment.
5603
5604 2010-04-22 Nick Clifton <nickc@redhat.com>
5605
5606 * po/gold.pot: Updated by the Translation project.
5607 * po/vi.po: Updated Vietnamese translation.
5608
5609 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5610
5611 * testsuite/Makefile.am (check_PROGRAMS): Add
5612 icf_virtual_function_folding_test.
5613 * testsuite/Makefile.in: Regenerated.
5614
5615 2010-04-15 Andrew Haley <aph@redhat.com>
5616
5617 * options.h (merge_exidx_entries): New option.
5618 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5619 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5620 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5621 (Target_arm::merge_exidx_entries): New function.
5622 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5623 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5624 to Arm_exidx_fixup constructor.
5625 Add new arg, merge_exidx_entries.
5626 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5627 Arm_output_section::fix_exidx_coverage.
5628
5629 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5630
5631 * icf.cc (get_section_contents): Check for preemptible functions.
5632 Ignore addend when appropriate.
5633 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5634 section folded.
5635 (add_from_relobj): Check for section folded.
5636 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5637 * symtab.h (should_add_dynsym_entry): Add new parameter.
5638 * target-reloc.h (scan_relocs): Check for section folded.
5639 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5640 Check reloc types for function pointers in shared objects.
5641 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5642 case.
5643 (icf_preemptible_functions_test): New test case.
5644 (icf_string_merge_test): New test case.
5645 * testsuite.Makefile.in: Regenerate.
5646 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5647 bar_glob. Refactor code.
5648 * testsuite/icf_preemptible_functions_test.cc: New file.
5649 * testsuite/icf_preemptible_functions_test.sh: New file.
5650 * testsuite/icf_string_merge_test.cc: New file.
5651 * testsuite/icf_string_merge_test.sh: New file.
5652 * testsuite/icf_virtual_function_folding_test.cc: New file.
5653 * testsuite/icf_virtual_function_folding_test.sh: New file.
5654
5655 2010-04-14 Doug Kwan <dougkwan@google.com>
5656
5657 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5658 for local symbol recounting if we remove a section due to ICF.
5659 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5660 there are no regular objects in input.
5661
5662 2010-04-13 Doug Kwan <dougkwan@google.com>
5663
5664 * arm.cc (Arm_input_section::set_final_data_size): Compute
5665 accurate final data size instead of using current data size.
5666
5667 2010-04-09 Doug Kwan <dougkwan@google.com>
5668
5669 * layout.cc (Layout::choose_output_section): Handle script section
5670 types.
5671 (Layout::make_output_section_for_script): Add section type parameter.
5672 Handle script section types.
5673 * layout.h (Layout::make_output_section_for_script): Add section
5674 type parameter.
5675 * output.cc (Output_section::Output_section): Initialize data member
5676 is_noload_.
5677 (Output_section::do_reset_address_and_file_offset): Do not set address
5678 to 0 if section is a NOLOAD section.
5679 * output.h (Output_section::is_noload): New method.
5680 (Output_section::set_is_noload): Ditto.
5681 (Output_section::is_noload_): New data member.
5682 * script-c.h (Script_section_type): New enum type.
5683 (struct Parser_output_section_header): Add new file section_type.
5684 * script-sections.cc (Sections_element::output_section_name): Add
5685 parameter for returning script section type.
5686 (Output_section_definition::output_section_name): Ditto.
5687 (Output_section_definition::section_type)P; New method.
5688 (Output_section_definiton::script_section_type_name): Ditto.
5689 (Output_section_definition::script_section_type_): New data member.
5690 (Output_section_definition::Output_section_definition): Initialize
5691 data member Output_section_definition::script_section_type_.
5692 (Output_section_definition::create_sections): Pass script section type
5693 to Layout::make_output_section_for_script.
5694 (Output_section_definition::output_section_name): Return script
5695 section type to caller.
5696 (Output_section_definition::set_section_address): Do not advance
5697 dot value and load address if section type is NOLOAD. Set address
5698 of NOLOAD sections regardless of section flags.
5699 (Output_section_definition::print): Print section type if it is
5700 not SCRIPT_SECTION_TYPE_NONE.
5701 (Output_section_definition::section_type): New method.
5702 (Output_section_definition::script_section_type_name): Ditto.
5703 (Script_sections::output_section_name): Add new parameter
5704 PSECTION_TYPE for returning script section type. Pass it to
5705 section elements. Handle discard sections.
5706 (Sort_output_sections::operator()): Handle NOLOAD sections.
5707 * script-sections.h (Script_sections::Section_type): New enum type.
5708 (Script_sections::output_section_name): Add a new parameter for
5709 returning script section type.
5710 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5711 INFO and NOLOAD.
5712 * yyscript.y (union): Add new field SECTION_TYPE.
5713 (COPY, DSECT, INFO, NOLOAD): New tokens.
5714 (opt_address_and_section_type): Change type to output_section_header.
5715 (section_type): New non-terminal
5716 (section_header): Handle section type.
5717 (opt_address_and_section_type): Return section type value.
5718
5719 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5720
5721 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5722 * testsuite/plugin_common_test_2.c (foo): Likewise.
5723
5724 2010-04-08 Doug Kwan <dougkwan@google.com>
5725
5726 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5727 Output_merge_data.
5728 * output.cc (Output_section::add_merge_input_section): Simplify
5729 code and return status of Output_merge_base::add_input_section.
5730 Update merge section map only if Output_merge_base::add_input_section
5731 returns true.
5732
5733 2010-04-07 Doug Kwan <dougkwan@google.com>
5734
5735 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5736 if section is marked as containing instructions but has no mapping
5737 symbols.
5738 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5739 correct section index.
5740 (Arm_relobj::find_linked_text_section): Ditto.
5741
5742 2010-04-07 Cary Coutant <ccoutant@google.com>
5743
5744 * archive.cc (include_member): Destroy Read_symbols_data object before
5745 releasing file.
5746 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5747 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5748 (Read_symbols_data::~Read_symbols_data) New destructor.
5749 (Section_relocs::Section_relocs) New constructor.
5750 (Section_relocs::~Section_relocs) New destructor.
5751 (Read_relocs_data::Read_relocs_data) New constructor.
5752 (Read_relocs_data::~Read_relocs_data) New destructor.
5753 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5754 pointers to NULL after deleting.
5755
5756 2010-04-07 Doug Kwan <dougkwan@google.com>
5757
5758 * arm.cc: Replace "endianity" with "endianness" in comments.
5759 (Arm_exidx_cantunwind): Ditto.
5760 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5761 (Arm_relobj::merge_flags_and_attributes): New method.
5762 (Arm_relobj::merge_flags_and_attributes_): New data member.
5763 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5764 (Arm_relobj::scan_sections_for_stubs): Ditto.
5765 (Arm_relobj::do_read_symbols): Check to see if we really want to
5766 merge processor-specific flags and attributes. Exit early if
5767 an object is empty except for section names and the undefined symbol.
5768 (Target_arm::do_finalize_sections): Move check for ELF format to
5769 Arm_relobj::do_read_symbols. Merge processor specific flags and
5770 attributes from a regular object only when we have determined that
5771 it is aapropriate. Do not create an .ARM.attributes section in
5772 output if there is no regular input object.
5773 (Target_arm::merge_processor_specific_flags): Check
5774 --warn-mismatch before printing any error.
5775 (Target_arm::merge_object_attributes): Ditto.
5776 * gold.cc (queue_middle_tasks): Handle the case in which there is
5777 no regular object in input.
5778 * options.cc (General_options::parse_EB): New method.
5779 (General_options::parse_EL): Same.
5780 (General_options::General_options): Initialize endianness_.
5781 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5782 New options.
5783 (General_options::Endianness): New enum.
5784 (General_options::endianness): New method.
5785 (General_options::endianness_): New data member.
5786 * parameters.cc (Parameters::set_options): Check target endianness.
5787 (Parameters::set_target_once): Ditto.
5788 (Parameters::check_target_endianness): New method.
5789 (parameters_force_valid_target): If either -EL or -EB is specified,
5790 use it to define endianness of default target.
5791 * parameters.h (Parameters::check_target_endianness): New method
5792 declaration.
5793 * target.h (class Target): Change "endianity" to "endianness"
5794 in comments.
5795
5796 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5797
5798 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5799 * configure: Regenerate.
5800 * Makefile.in: Regenerate.
5801 * testsuite/Makefile.in: Regenerate.
5802
5803 2010-04-06 Cary Coutant <ccoutant@google.com>
5804
5805 gcc PR lto/42757
5806 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5807 prevailing definitions of common symbols.
5808 * testsuite/plugin_test_6.sh: New test case.
5809 * testsuite/plugin_common_test_1.c: New test case.
5810 * testsuite/plugin_common_test_2.c: New test case.
5811 * testsuite/Makefile.am (plugin_test_6): New test case.
5812 * testsuite/Makefile.in: Regenerate.
5813
5814 2010-04-06 Nick Clifton <nickc@redhat.com>
5815
5816 * po/vi.po: New Vietnamese translation.
5817
5818 2010-03-30 Doug Kwan <dougkwan@google.com>
5819
5820 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5821
5822 2010-03-25 Doug Kwan <dougkwan@google.com>
5823
5824 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5825 to avoid a conversion warning on a 32-bit host.
5826
5827 2010-03-24 Ian Lance Taylor <iant@google.com>
5828
5829 * testsuite/script_test_3.t: Add a TLS segment.
5830 * testsuite/Makefile.am (check_PROGRAMS): Add
5831 tls_phdrs_script_test.
5832 (tls_phdrs_script_test_SOURCES): Define.
5833 (tls_phdrs_script_test_DEPENDENCIES): Define.
5834 (tls_phdrs_script_test_LDFLAGS): Define.
5835 (tls_phdrs_script_test_LDADD): Define.
5836 * testsuite/Makefile.in: Rebuild.
5837
5838 2010-03-23 Cary Coutant <ccoutant@google.com>
5839
5840 * fileread.cc (find_or_make_view): Fix comment.
5841
5842 2010-03-23 Ian Lance Taylor <iant@google.com>
5843
5844 * script-sections.cc (class Orphan_section_placement): Define
5845 PLACE_TLS and PLACE_TLS_BSS.
5846 (Orphan_section_placement::Orphan_section_placement): Initialize
5847 new places.
5848 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5849 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5850 (tls_script_test_SOURCES): Define.
5851 (tls_script_test_DEPENDENCIES): Define.
5852 (tls_script_test_LDFLAGS): Define.
5853 (tls_script_test_LDADD): Define.
5854 * testsuite/Makefile.in: Rebuild.
5855
5856 2010-03-22 Doug Kwan <dougkwan@google.com>
5857
5858 * arm.cc (Arm_relocate_functions::abs8,
5859 Arm_relocate_functions::abs16): Use correct check for overflow
5860 specified in the ARM ELF specs.
5861 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5862 target of a BLX instruction specially.
5863 (Reloc_stub::stub_type_for_reloc): Ditto.
5864 (Relocate::relocate): Use symbolic names instead of numeric relocation
5865 codes to report error.
5866 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5867 workaround.
5868 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5869 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5870 thumb2_blx_out_of_range.stdout
5871 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5872 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5873 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5874 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5875 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5876 thumb2_blx_in_range, thumb2_blx_in_range.o,
5877 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5878 thumb2_blx_out_of_range.o): New rules.
5879 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5880 thumb2_blx_in_range and thumb2_blx_out_of_range.
5881 * testsuite/Makefile.in: Regenerate.
5882 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5883 * testsuite/thumb_blx_in_range.s: New file.
5884 * testsuite/thumb_blx_out_of_range.s: New file.
5885
5886 2010-03-22 Rafael Espindola <espindola@google.com>
5887
5888 * archive.cc (Should_include): Move to archive.h.
5889 (should_include_member): Make it a member of Archive.
5890 (Lib_group): New.
5891 (Add_lib_group_symbols): New.
5892 * archive.h: Include options.h.
5893 (Archive_member): Moved from Archive.
5894 (Should_include): Moved from archive.cc.
5895 (Lib_group): New.
5896 (Add_lib_group_symbols): New.
5897 * dynobj.cc (do_should_include_member): New.
5898 * dynobj.h (do_should_include_member): New.
5899 * gold.cc (queue_initial_tasks): Update call to queue.
5900 * main.cc (main): Print lib group stats.
5901 * object.cc (do_should_include_member): New.
5902 * object.h: Include archive.h.
5903 (Object::should_include_member): New.
5904 (Object::do_should_include_member): New.
5905 (Sized_relobj::do_should_include_member): New.
5906 * options.cc (General_options::parse_start_lib): New.
5907 (General_options::parse_end_lib): New.
5908 (Input_arguments::add_file): Handle lib groups.
5909 (Input_arguments::start_group): Check we are not in a lib.
5910 (Input_arguments::start_lib): New.
5911 (Input_arguments::end_lib): New.
5912 * options.h (General_options): Add start_lib and end_lib.
5913 (Input_argument::lib_): New.
5914 (Input_argument::lib): New.
5915 (Input_argument::is_lib): New.
5916 (Input_file_lib): New.
5917 (Input_arguments::in_lib_): New.
5918 (Input_arguments::in_lib): New.
5919 (Input_arguments::start_lib): New.
5920 (Input_arguments::end_lib_): New.
5921 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5922 in unused members as preempted.
5923 (Sized_pluginobj::do_should_include_member): New.
5924 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5925 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5926 return the blocker.
5927 (Read_symbols::do_whole_lib_group): New.
5928 (Read_symbols::do_lib_group): New.
5929 (Read_symbols::do_read_symbols): Handle lib groups.
5930 (Read_symbols::get_name): Handle lib groups.
5931 * readsyms.h (Read_symbols): Add an archive member pointer.
5932 (Read_symbols::do_whole_lib_group): New.
5933 (Read_symbols::do_lib_group): New.
5934 (Read_symbols::member_): New.
5935 * script.cc (read_input_script): Update call to queue_soon.
5936
5937 2010-03-19 Doug Kwan <dougkwan@google.com>
5938
5939 * arm.cc (Stub_table::Stub_table): Initialize new data members
5940 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5941 (Stub_table::add_reloc_stub): Assign stub offset and update
5942 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5943 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5944 New data members.
5945 (Stub_table::update_data_size_and_addralign): Use
5946 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5947 instead of going over all reloc stubs.
5948 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5949 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5950 Stringpool_template::offset_ to size of Stringpool_char.
5951 (Stringpool_template::new_key_offset): Remove code to initialize
5952 Stringpool_template::offset_.
5953 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5954 Stringpool_template::offset_ to zero.
5955
5956 2010-03-15 Doug Kwan <dougkwan@google.com>
5957
5958 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5959 offset_.
5960 (Stringpool_template::new_key_offset): New method.
5961 (Stringpool_template::add_string): Assign offsets when adding new
5962 strings.
5963 (Stringpool_template::set_string_offsets): Do not set string offsets
5964 when not optimizing.
5965 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5966 member size_.
5967 (Chunked_vector::clear): Clear size_.
5968 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5969 (Chunked_vector::size): Return size_.
5970 (Chunked_vector::push_back): Use size_ to find insert position.
5971 (Chunked_vector::size_): New data member.
5972 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5973 (Stringpool_template::new_key_offset): New method declaration.
5974 (Stringpool_template::offset_): New data member.
5975
5976 2010-03-15 Rafael Espindola <espindola@google.com>
5977
5978 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5979 Add_symbols' constructor.
5980 * readsyms.h (Add_symbols): Remove the input_group member.
5981
5982 2010-03-10 Ian Lance Taylor <iant@google.com>
5983
5984 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5985 target to ask whether a reference to a symbol requires a stack
5986 split.
5987 * target.h (Target::is_call_to_non_split): New function.
5988 (Target::do_is_call_to_non_split): Declare virtual function.
5989 * target.cc: Include "symtab.h".
5990 (Target::do_is_call_to_non_split): New function.
5991 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5992
5993 2010-03-10 Cary Coutant <ccoutant@google.com>
5994
5995 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5996 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5997 (File_read::open[2]): Add whole_file_view_ to list of views.
5998 (File_read::make_view): Remove test of whole_file_view_.
5999 (File_read::find_or_make_view): Create whole_file_view_ if
6000 necessary.
6001 (File_read::clear_views): Replace bool parameter with enum;
6002 adjust all callers. Don't delete views with permanent data;
6003 do delete cached views and views from archives if
6004 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6005 if clearing the corresponding view.
6006 * fileread.h (File_read::Clear_views_mode): New enum.
6007 (File_read::View::is_permanent_view): New method.
6008 (File_read::clear_views): Replace bool parameter
6009 with enum; adjust all callers.
6010 * options.h (General_options): Change keep_files_mapped option;
6011 add map_whole_files.
6012 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6013 releasing the file.
6014 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6015 the file.
6016
6017 2010-03-10 David S. Miller <davem@davemloft.net>
6018
6019 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6020
6021 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6022
6023 * icf.cc (get_section_contents): Add '@' marker after processing the
6024 merge reloc.
6025
6026 2010-03-08 Doug Kwan <dougkwan@google.com>
6027
6028 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6029 due to a conversion warning.
6030 (Arm_relobj::update_output_local_symbol_count): Check for local
6031 symbol with unset output index.
6032
6033 2010-03-05 Ian Lance Taylor <iant@google.com>
6034
6035 * options.h (class General_options): Add --spare-dynamic-tags.
6036 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6037 --spare-dynamic-tags.
6038
6039 2010-03-05 Ian Lance Taylor <iant@google.com>
6040
6041 * incremental.cc: Include "libiberty.h".
6042
6043 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6044
6045 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6046 function, is_info_ member.
6047 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6048 (Versions::Versions): Update caller.
6049 (Versions::define_base_version): Likewise.
6050 (Versions::add_def): Likewise.
6051
6052 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6053
6054 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6055 (Scan::possible_function_pointer_reloc): New function.
6056 (Scan::local_reloc_may_be_function_pointer): Change to call
6057 possible_function_pointer_reloc.
6058 (Scan::global_reloc_may_be_function_pointer): Ditto.
6059 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6060 relocations in ".data.rel.ro._ZTV" section.
6061 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6062 * testsuite/icf_safe_so_test.cc: Ditto.
6063 * testsuite/icf_safe_test.cc: Ditto.
6064 * testsuite/icf_safe_test.sh: Ditto.
6065
6066 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6067 Ian Lance Taylor <iant@google.com>
6068
6069 * target-reloc.h (relocate_section): Check the symbol table index
6070 for -1U before setting the local symbol index.
6071 (scan_relocatable_relocs): If copying the relocation, record that
6072 the local symbol is required.
6073 * object.h (Symbol_value::is_output_symtab_index_set): New
6074 function.
6075 (Symbol_value::may_be_discarded_from_output_symtab): New
6076 function.
6077 (Symbol_value::has_output_symtab_entry): New function.
6078 (Symbol_value::needs_output_symtab_entry): Remove.
6079 (Symbol_value::output_symtab_index): Make sure the symbol index is
6080 set.
6081 (Symbol_value::set_output_symtab_index): Make sure the symbol
6082 index is not set. Make sure the new index is valid.
6083 (Symbol_value::set_must_have_output_symtab_entry): New function.
6084 (Symbol_value::has_output_dynsym_entry): New function.
6085 (Symbol_value::set_output_dynsym_index): Make sure the new index
6086 is valid.
6087 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6088 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6089 local symbol if permitted.
6090 (Sized_relobj::do_finalize_local_symbols): Call
6091 is_output_symtab_index_set rather than needs_output_symtab_entry.
6092 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6093 rather than needs_output_symtab_entry. Call
6094 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6095 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6096 is_output_symtab_index_set rather than needs_output_symtab_entry.
6097 * testsuite/discard_locals_relocatable_test.c: New file.
6098 * testsuite/discard_locals_test.sh: Test -r.
6099 * testsuite/Makefile.am (check_DATA): Add
6100 discard_locals_relocatable_test1.syms,
6101 discard_local_relocatable_test2.syms.
6102 (MOSTLYCLEANFILES): Likewise. Also add
6103 discard_locals_relocatable_test1.lout and
6104 discard_locals_relocatable_test2.out.
6105 (discard_locals_relocatable_test1.syms): New target.
6106 (discard_locals_relocatable_test.o): New target.
6107 (discard_locals_relocatable_test1.out): New target.
6108 (discard_locals_relocatable_test2.syms): New target.
6109 (discard_locals_relocatable_test2.out): New target.
6110 (various): Add missing ../ld-new dependencies.
6111 * testsuite/Makefile.in: Rebuild.
6112
6113 2010-03-03 Nick Clifton <nickc@redhat.com>
6114
6115 * po/fi.po: New Finnish translation.
6116
6117 2010-03-01 Doug Kwan <dougkwan@google.com>
6118
6119 * layout.cc (Layout::Layout): Force section types of .init_array*,
6120 .preinit_array* and .fini_array* sections.
6121 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6122 Fix check of return value of std::string::find.().
6123 (Output_section::Input_section_sort_compare::operator()): Remove
6124 comment about .init_array.
6125 (Output_section::Input_section_sort_init_fini_compare::operator()):
6126 New method.
6127 (Output_section::sort_attached_input_sections): Handle .init_array
6128 and .fini_array specially.
6129 * output.h (Output_section::Inut_section_sort_compare): Update
6130 comment.
6131 (Output_section::Input_section_sort_init_fini_compare): New struct.
6132
6133 2010-02-26 Doug Kwan <dougkwan@google.com>
6134
6135 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6136 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6137 * testsuite/debug_msg.sh: Avoid matching source line number for
6138 use of global variable undef_int.
6139
6140 2010-02-26 Doug Kwan <dougkwan@google.com>
6141
6142 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6143 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6144 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6145 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6146 * options.cc (General_options::General_options): Initialize member
6147 fix_v4bx_.
6148 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6149 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6150 and rm_no_fix_v4bx.stdout
6151 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6152 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6153 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6154 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6155 and arm_no_fix_v4bx.
6156 * Makefile.in: Regenerate.
6157 * testsuite/arm_fix_v4bx.s: New file.
6158 * testsuite/arm_fix_v4bx.sh: Ditto.
6159
6160 2010-02-24 Doug Kwan <dougkwan@google.com>
6161
6162 * arm.cc (Target_arm::got_section): Make the .got section the first
6163 non RELRO section in the data segment.
6164 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6165 suffixes of section names.
6166
6167 2010-02-24 Doug Kwan <dougkwan@google.com>
6168
6169 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6170 flags and attributes merging if an input file is a binary file.
6171 * fileread.cc (Input_file::open): Record format of original file.
6172 * fileread.h (Input_file::Format): New enum type.
6173 (Input_file::Input_file): Initialize data member format_.
6174 (Input_file::format): New method definition.
6175 (Input_file::format_):: New data member.
6176
6177 2010-02-24 Doug Kwan <dougkwan@google.com>
6178
6179 * arm.cc (Arm_output_data_got): New class.
6180 (ARM_TCB_SIZE): New constant
6181 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6182 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6183 If user uses a script with a SECTIONS clause, issue only a warning
6184 for a misplaced EXIDX input section. Otherwise, issue an error.
6185 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6186 garbage collection.
6187 (Target_arm::got_mode_index_entry): Handle static linking.
6188 (Target_arm::Scan::local): Ditto.
6189 (Target_arm::Scan::global): Ditto.
6190 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6191 all incorrectly implemented relocations.
6192 (Target_arm::fix_exidx_coverage): Pass layout to
6193 Arm_output_section::fix_exidx_coverage.
6194 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6195 from ".ARM.exidx." and ".ARM.extab.".
6196
6197 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6198
6199 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6200 section if it does not already exist.
6201 * attributes.cc (Attributes_section_data::Attributes_section_data):
6202 Don't crash if size is zero.
6203
6204 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6205 Ian Lance Taylor <iant@google.com>
6206
6207 * gold.cc (queue_middle_tasks): If no input files were opened,
6208 exit.
6209 * workqueue.h (Task_function::Task_function): Assert that there is
6210 a blocker.
6211
6212 2010-02-22 Doug Kwan <dougkwan@google.com>
6213
6214 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6215 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6216 types to avoid warnings due to different uint64_t implementations
6217 on different hosts.
6218
6219 2010-02-21 Doug Kwan <dougkwan@google.com>
6220
6221 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6222 handling of the maximum backward branch offset.
6223 (Arm_relocate_functions::thumb_branch_common): Ditto.
6224 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6225 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6226 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6227 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6228 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6229 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6230 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6231 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6232 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6233 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6234 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6235 thumb2_bl_out_of_range.o): New rules.
6236 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6237 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6238 thumb2_bl_out_of_range
6239 * testsuite/Makefile.in: Regenerate.
6240 * testsuite/arm_bl_in_range.s: New file.
6241 * testsuite/arm_bl_out_of_range.s: Ditto.
6242 * testsuite/arm_branch_in_range.sh: Ditto.
6243 * testsuite/arm_branch_range.t: Ditto.
6244 * testsuite/thumb2_branch_range.t: Ditto.
6245 * testsuite/thumb_bl_in_range.s: Ditto.
6246 * testsuite/thumb_bl_out_of_range.s: Ditto.
6247 * testsuite/thumb_branch_range.t: Ditto.
6248
6249 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6250
6251 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6252 Add reloc offset information.
6253 * icf.cc (get_section_contents): Change iterators to point to the new
6254 vectors. Add reloc offset information to the contents.
6255 * icf.h (Icf::Sections_reachable_info): New typedef.
6256 (Icf::Sections_reachable_list): New typedef.
6257 (Icf::Offset_info): New typedef.
6258 (Icf::Reloc_info): New struct typedef.
6259 (Icf::Reloc_info_list): New typedef.
6260 (Icf::symbol_reloc_list): Delete method.
6261 (Icf::addend_reloc_list): Delete method.
6262 (Icf::section_reloc_list): Delete method.
6263 (Icf::reloc_info_list): New method.
6264 (Icf::reloc_info_list_): New member.
6265
6266 2010-02-19 Doug Kwan <dougkwan@google.com>
6267
6268 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6269 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6270 * arm.cc (Arm_relocation_functions): New forward declaration.
6271 (Target_arm::Target_arm): Initialize new data members
6272 got_mod_index_offset_ and tls_base_symbol_defined_.
6273 (Target_arm::Relocate::relocate_tls): New method.
6274 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6275 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6276 New methods.
6277 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6278 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6279 (Target_arm::got_mod_index_offset_,
6280 Target_arm::tls_base_symbol_defined_): New data members.
6281 (Target_arm::Scan::local, Target::Scan::global,
6282 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6283 relocations.
6284
6285 2010-02-18 Doug Kwan <dougkwan@google.com>
6286
6287 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6288 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6289 text section as a parameter becuase some broken tools may not set
6290 the link in section header.
6291 (Target_arm::has_got_section): New method.
6292 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6293 without any mapping symbol as data only. Remove warning.
6294 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6295 link in its section header, try to discover the link by inspecting the
6296 REL31 relocation at the beginning of the section.
6297 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6298 in error message.
6299 (Target_arm::Scan::global): Treat any reference to the symbol
6300 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6301
6302 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6303
6304 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6305 (Scan::global_reloc_may_be_function_pointer): New function.
6306 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6307 (Scan::global_reloc_may_be_function_pointer): New function.
6308 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6309 (Scan::global_reloc_may_be_function_pointer): New function.
6310 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6311 (Scan::global_reloc_may_be_function_pointer): New function.
6312 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6313 (Scan::global_reloc_may_be_function_pointer): New function.
6314 (Scan::possible_function_pointer_reloc): New function.
6315 (Target_x86_64::can_check_for_function_pointers): New function.
6316 * gc.h (gc_process_relocs): Scan relocation types to determine if
6317 function pointers were taken for targets that support it.
6318 * icf.cc (Icf::find_identical_sections): Include functions for
6319 folding in safe ICF whose pointer is not taken.
6320 * icf.h (Secn_fptr_taken_set): New typedef.
6321 (fptr_section_id_): New member.
6322 (section_has_function_pointers): New function.
6323 (set_section_has_function_pointers): New function.
6324 (check_section_for_function_pointers): New function.
6325 * options.h: Fix comment for safe ICF option.
6326 * target.h (can_check_for_function_pointers): New function.
6327 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6328 Modify icf_safe_test for X86-64.
6329 * testsuite/Makefile.in: Regenerate.
6330 * testsuite/icf_safe_so_test.cc: New file.
6331 * testsuite/icf_safe_so_test.sh: New file.
6332 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6333 (main): Change to take pointer to function kept_func_3.
6334 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6335 folding is done correctly for X86-64.
6336
6337 2010-02-12 David S. Miller <davem@davemloft.net>
6338
6339 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6340 is_symbolless parameter.
6341 (Output_reloc<SHT_REL>::is_symbolless): New.
6342 (Output_reloc<SHT_REL>::is_symbolless_): New.
6343 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6344 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6345 (Output_reloc<SHT_RELA>::is_symbolless): New.
6346 (Output_data_reloc::add_global): Handle is_symbolless.
6347 (Output_data_reloc::add_global_relative): Likewise.
6348 (Output_data_reloc::add_local): Likewise.
6349 (Output_data_reloc::add_local_relative): Likewise.
6350 (Output_data_reloc::add_symbolless_global_addend): New.
6351 (Output_data_reloc::add_symbolless_local_addend): New.
6352 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6353 is_symbolless.
6354 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6355 instead of ->is_relative_
6356 (Output_reloc::write): Likewise.
6357 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6358 (Output_reloc::write_rel): Simplify.
6359
6360 * sparc.cc (Target_sparc::Scan::local): Use
6361 ->add_symbolless_local_addend as needed.
6362 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6363 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6364 based upon relocation offset.
6365
6366 2010-02-11 Doug Kwan <dougkwan@google.com>
6367
6368 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6369 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6370 beginning of function.
6371 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6372 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6373 parameter is_32bit in calls to should_apply_static_reloc.
6374 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6375 (check_DATA): Add arm_abs_global.stdout.
6376 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6377 arm_abs_global.stdout): New rules.
6378 (MOSTLLYCLEANFILES): Add arm_abs_global
6379 * Makefile.in: Regenerate.
6380 * testsuite/arm_abs_global.s: New file.
6381 * testsuite/arm_abs_global.sh: Ditto.
6382 * testsuite/arm_abs_lib.s: Ditto.
6383
6384 2010-02-11 Ian Lance Taylor <iant@google.com>
6385
6386 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6387 Read_relocs task.
6388 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6389 Allocate_commons_task first.
6390 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6391 task, rather than symtab_lock_.
6392 (Gc_process_relocs::~Gc_process_relocs): New function.
6393 (Gc_process_relocs::is_runnable): Check this_blocker_.
6394 (Gc_process_relocs::locks): Use next_blocker_ rather than
6395 blocker_.
6396 (Scan_relocs::~Scan_relocs): New function.
6397 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6398 symtab_lock_.
6399 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6400 next_blocker_.
6401 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6402 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6403 constructor accordingly.
6404 (class Gc_process_relocs): Likewise.
6405 (class Scan_relocs): Likewise.
6406 * common.h (class Allocate_commons_task): Remove symtab_lock_
6407 field, and corresponding constructor parameter.
6408 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6409 symtab_lock_.
6410 (Allocate_commons_task::locks): Likewise.
6411
6412 2010-02-11 Ian Lance Taylor <iant@google.com>
6413
6414 * gold-threads.h (class Once): Define.
6415 (class Initialize_lock): Rewrite as child of Once.
6416 * gold-threads.cc (class Once_initialize): Define.
6417 (once_pointer_control): New static variable.
6418 (once_pointer, once_arg): New static variables.
6419 (c_run_once): New static function.
6420 (Once::Once, Once::run_once, Once::internal_run): New functions.
6421 (class Initialize_lock_once): Remove.
6422 (initialize_lock_control): Remove.
6423 (initialize_lock_pointer): Remove.
6424 (initialize_lock_once): Remove.
6425 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6426 (Initialize_lock::initialize): Rewrite.
6427 (Initialize_lock::do_run_once): New function.
6428 * archive.cc (Archive::interpret_header): Only clear name if it is
6429 not already empty.
6430 * fileread.cc: Include "gold-threads.h"
6431 (file_counts_lock): New static variable.
6432 (file_counts_initialize_lock): Likewise.
6433 (File_read::release): Only increment counts when using --stats.
6434 Use a lock around the increment.
6435 * parameters.cc (class Set_parameters_target_once): Define.
6436 (set_parameters_target_once): New static variable.
6437 (Parameters::Parameters): Move here from parameters.h.
6438 (Parameters::set_target): Rewrite.
6439 (Parameters::set_target_once): New function.
6440 (Parameters::clear_target): Move here and rewrite.
6441 * parameters.h (class Parameters): Update declarations. Add
6442 set_parameters_target_once_ field.
6443 (Parameters::Parameters): Move to parameters.cc.
6444 (Parameters::clear_target): Likewise.
6445 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6446 task.
6447 (Start_group::~Start_group): New function.
6448 (Start_group::is_runnable): New function.
6449 (Start_group::locks, Start_group::run): New functions.
6450 (Finish_group::run): Change saw_undefined to size_t.
6451 * readsyms.h (class Start_group): Define.
6452 (class Finish_group): Change saw_undefined_ field to size_t.
6453 (Finish_group::Finish_group): Remove saw_undefined and
6454 this_blocker parameters. Change all callers.
6455 (Finish_group::set_saw_undefined): New function.
6456 (Finish_group::set_blocker): New function.
6457 * symtab.h (class Symbol_table): Change saw_undefined to return
6458 size_t. Change saw_undefined_ field to size_t.
6459 * target-select.cc (Set_target_once::do_run_once): New function.
6460 (Target_selector::Target_selector): Initialize set_target_once_
6461 field. Don't initialize lock_ and initialize_lock_ fields.
6462 (Target_selector::instantiate_target): Rewrite.
6463 (Target_selector::set_target): New function.
6464 * target-select.h (class Set_target_once): Define.
6465 (class Target_selector): Update declarations. Make
6466 Set_target_once a friend. Remove lock_ and initialize_lock_
6467 fields. Add set_target_once_ field.
6468
6469 2010-02-10 Ian Lance Taylor <iant@google.com>
6470
6471 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6472 queueing any tasks.
6473 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6474 (queue_middle_tasks): Add all blockers before queueing any tasks.
6475 (queue_final_tasks): Likewise.
6476 * token.h (Task_token::add_blockers): New function.
6477 * object.h (Input_objects::number_of_relobjs): New function.
6478
6479 2010-02-10 Ian Lance Taylor <iant@google.com>
6480
6481 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6482 shared, not if not position independent.
6483 * x86_64.cc (Relocate::relocate_tls): Likewise.
6484 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6485 (tls_pie_pic_test): New target.
6486 * testsuite/Makefile.in: Rebuild.
6487
6488 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6489 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6490 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6491 * testsuite/Makefile.in: Rebuild.
6492
6493 2010-02-09 David S. Miller <davem@davemloft.net>
6494
6495 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6496 R_SPARC_RELATIVE using ->add_local_relative().
6497 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6498
6499 * output.h (Output_data_dynamic::add_section_size): New method
6500 that takes two Output_data objects.
6501 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6502 entry param. Handle it in initializers.
6503 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6504 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6505 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6506 arg.
6507 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6508 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6509 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6510 for dynrel_includes_plt.
6511 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6512 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6513 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6514 before .rela.plt
6515 (Target_sparc::do_finalize_sections): Update to pass true for
6516 dynrel_includes_plt.
6517 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6518 output before .rela.plt
6519 (Target_powerpc::do_finalize_sections): Update to pass true for
6520 dynrel_includes_plt when 32-bit.
6521
6522 2010-02-08 Doug Kwan <dougkwan@google.com>
6523
6524 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6525 method.
6526 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6527 Arm_relobj::scan_section_for_cortex_a8_stubs,
6528 Arm_relobj::do_relocation_section): Instead of calling
6529 Output_section::output_address, use faster
6530 Arm_relobj::simple_input_section_output_address.
6531
6532 2010-02-08 David S. Miller <davem@davemloft.net>
6533
6534 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6535 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6536 relocation helper function.
6537
6538 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6539 just like R_SPARC_GOT{10,13,22}.
6540 (Target_sparc::Scan::local): Likewise.
6541 (Target_sparc::Relocate:relocate): Likewise.
6542
6543 2010-02-06 Ian Lance Taylor <iant@google.com>
6544
6545 * configure.ac: Rewrite targetobjs duplicate removal code to use
6546 only shell constructs.
6547 * configure: Rebuild.
6548
6549 2010-02-05 Doug Kwan <dougkwan@google.com>
6550
6551 PR 11247
6552 * arm.cc (Arm_relobj::section_is_scannable): New method.
6553 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6554 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6555
6556 2010-02-04 Doug Kwan <dougkwan@google.com>
6557
6558 PR 11247
6559 * arm-reloc-property.cc (cstdio): Include.
6560 * configure.ac (targetobjs): Remove duplicates.
6561 * configure: Regenerate.
6562 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6563 big and little endian version for a given address size.
6564
6565 2010-02-03 Doug Kwan <dougkwan@google.com>
6566
6567 * arm-reloc-property.cc
6568 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6569 definition.
6570 * arm-reloc-property.h
6571 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6572 New method definition.
6573 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6574 declaration.
6575 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6576 overflow to N.
6577 (GOT_PREL): Change implemented to Y.
6578 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6579 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6580 (Arm_relocate_functions::movw_abs_nc): Remove method.
6581 (Arm_relocate_functions::movt_abs): Ditto.
6582 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6583 (Arm_relocate_functions::thm_movt_abs): Ditto.
6584 (Arm_relocate_functions::movw_rel_nc): Ditto.
6585 (Arm_relocate_functions::movw_rel): Ditto.
6586 (Arm_relocate_functions::movt_rel): Ditto.
6587 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6588 (Arm_relocate_functions:thm_movw_rel): Ditto.
6589 (Arm_relocate_functions:thm_movt_rel): Ditto.
6590 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6591 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6592 New method definitions.
6593 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6594 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6595 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6596 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6597 (Target_arm::Relocate::relocate): Check for non-static or
6598 unimplemented relocation code and exit early. Change calls to
6599 Target_arm::reloc_uses_thumb_bit and
6600 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6601 instead. Refactor code to handle similar relocations to increase
6602 code sharing. Remove check for unsupported relocation code in switch
6603 statement.
6604 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6605 relocation property table to find out size. Change error message to
6606 print out the name of a relocation code instead of the numeric value.
6607 (Target_arm::scan_reloc_for_stub): Use relocation property table
6608 instead of calling Target_arm::reloc_uses_thumb_bit().
6609
6610 2010-02-02 Doug Kwan <dougkwan@google.com>
6611
6612 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6613 types of relaxed input section.
6614
6615 2010-02-02 Doug Kwan <dougkwan@google.com>
6616
6617 * Makefile.am (HFILES): Add arm-reloc-property.h.
6618 (DEFFILES): New.
6619 (TARGETSOURCES): Add arm-reloc-property.cc
6620 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6621 (libgold_a_SOURCES): $(DEFFILES)
6622 * Makefile.in: Regenerate.
6623 * arm-reloc-property.cc: New file.
6624 * arm-reloc-property.h: New file.
6625 * arm-reloc.def: New file.
6626 * arm.cc: Update comments.
6627 (arm-reloc-property.h): New included header.
6628 (arm_reloc_property_table): New global variable.
6629 (Target_arm::do_select_as_default_target): New method definition.
6630 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6631 arm-reloc-property to targ_extra_obj.
6632 * parameters.cc (set_parameters_target): Call
6633 Target::select_as_default_target().
6634 * target.h (Target::select_as_default_target): New method definition.
6635 (Target::do_select_as_default_target): Same.
6636
6637 2010-02-01 Doug Kwan <dougkwan@google.com>
6638
6639 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6640 first_output_text_section_.
6641 (Arm_exidx_fixup::first_output_text_section): New method definition.
6642 (Arm_exidx_fixup::first_output_text_section_): New data member.
6643 (Arm_exidx_fixup::process_exidx_section): Record the first text
6644 output section seen.
6645 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6646 and entsize in output section header.
6647
6648 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6649
6650 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6651 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6652 (Arm_relocate_functions::thm_alu11): New Method.
6653 (Arm_relocate_functions::thm_pc8): New Method.
6654 (Arm_relocate_functions::thm_pc12): New Method.
6655 (Target_arm::Scan::local): Handle the relocations.
6656 (Target_arm::Scan::global): Likewise.
6657 (Target_arm::Relocate::relocate): Likewise.
6658 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6659
6660 2010-01-29 Doug Kwan <dougkwan@google.com>
6661
6662 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6663 of relocation types as ld.
6664
6665 2010-01-29 Doug Kwan <dougkwan@google.com>
6666
6667 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6668 to public.
6669 (Arm_relocate_functions::thumb_branch_common): Ditto.
6670 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6671 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6672 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6673 Arm_relocate_functions::jump24): Remove.
6674 (Target_arm::Relocate::relocate): Adjust code to call
6675 Arm_relocation_functions::arm_branch_common and
6676 Arm_relocation_functions::thumb_branch_common instead of their removed
6677 wrappers. Merge switch-cases together to reduce source code size.
6678
6679 2010-01-29 Doug Kwan <dougkwan@google.com>
6680
6681 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6682 output_local_symbol_count_needs_update_.
6683 (Arm_relobj::output_local_symbol_count_needs_update,
6684 Arm_relobj::set_output_local_symbol_count_needs_update,
6685 Arm_relobj::update_output_local_symbol_count): New methods.
6686 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6687 member.
6688 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6689 of pointed function as in a R_ARM_PREL31 relocation.
6690 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6691 for output local symbol count updating.
6692 (Target_arm::do_relax): Update output local symbol counts in objects
6693 if necessary.
6694 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6695
6696 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6697
6698 * arm.cc: Added support for the ARM relocations:
6699 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6700 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6701 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6702 movw_prel_nc).
6703 (Arm_relocate_functions::movw_rel): New method.
6704 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6705 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6706 thm_movw_prel_nc).
6707 (Arm_relocate_functions::thm_movw_rel): New method.
6708 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6709 thm_movt_prel).
6710 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6711 relocations.
6712 (Target_arm::Scan::global): Likewise.
6713 (Target_arm::Relocate::relocate): Likewise.
6714 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6715 Likewise.
6716
6717 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6718
6719 * arm.cc: Added support for ARM group relocations.
6720 (Target_arm::reloc_needs_sym_origin): New method.
6721 (Arm_relocate_functions::calc_grp_kn): New method.
6722 (Arm_relocate_functions::calc_grp_residual): New method.
6723 (Arm_relocate_functions::calc_grp_gn): New method.
6724 (Arm_relocate_functions::arm_grp_alu): New Method.
6725 (Arm_relocate_functions::arm_grp_ldr): New Method.
6726 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6727 (Arm_relocate_functions::arm_grp_ldc): New Method.
6728 (Target_arm::Scan::local): Handle the ARM group relocations.
6729 (Target_arm::Scan::global): Likewise.
6730 (Target_arm::Relocate::relocate): Likewise.
6731 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6732 Likewise.
6733
6734 2010-01-26 Doug Kwan <dougkwan@google.com>
6735
6736 * arm.cc (set): Include.
6737 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6738 pointer type.
6739 (Arm_output_section::Text_section_list): New type.
6740 (Arm_output_section::append_text_sections_to_list): New method.
6741 (Arm_output_section::fix_exidx_coverage): Ditto.
6742 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6743 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6744 Relobj::set_section_offset() instead of
6745 Sized_relobj::invalidate_section_offset().
6746 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6747 parameter for section headers. Ignore relocation sections for
6748 unallocated sections and EXIDX sections.
6749 (Target_arm::fix_exidx_coverage): New method.
6750 (Target_arm::output_section_address_less_than): New type.
6751 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6752 linked text section instead of the EXIDX section.
6753 (Arm_output_section::create_stub_group): Add an assertion to check
6754 that this is not an EXIDX output section.
6755 (Arm_output_section::append_text_sections_to_list): New method.
6756 (Arm_output_section::fix_exidx_coverage): Ditto.
6757 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6758 Arm_relobj::section_needs_reloc_stub_scanning.
6759 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6760 first pass.
6761 (Target_arm::fix_exidx_coverage): New method.
6762 * object.h (Relobj::set_output_section): New method.
6763 (Sized_relobj::invalidate_section_offset): Remove method.
6764 (Sized_relobj::do_invalidate_section_offset): Remove method.
6765 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6766
6767 2010-01-25 Doug Kwan <dougkwan@google.com>
6768
6769 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6770 Fix warning due to signed and unsigned comparison on a 32-bit host.
6771
6772 2010-01-22 Doug Kwan <dougkwan@google.com>
6773
6774 * arm.cc (Target_arm::do_relax): Record an output section for section
6775 offset adjustment it contains any stub table that has changed.
6776 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6777 offsets in an output section if necessary.
6778 * output.cc (Output_section::Output_section): Initialize
6779 section_offsets_need_adjustments_.
6780 (Output_section::add_input_section_for_script): Renamed to
6781 Output_section::add_simple_input_section.
6782 (Output_section::save_states): Add a comment.
6783 (Output_section::discard_states): New method defintion.
6784 (Output_section::adjust_section_offsets): Same.
6785 * output.h (Output_section::add_input_section_for_script): Renamed to
6786 Output_section::add_simple_input_section.
6787 (Output_section::discard_states): New method declaration.
6788 (Output_section::adjust_section_offsets): Same.
6789 (Output_section::section_offsets_need_adjustment,
6790 Output_section::set_section_offsets_need_adjustment): New method
6791 definitions.
6792 (Output_section::section_offsets_need_adjustment_): New data member.
6793 * script-sections.cc
6794 (Output_section_element_input::set_section_address): Adjust code for
6795 renaming of Output_section::add_input_section_for_script.
6796 (Orphan_output_section::set_section_address): Same.
6797
6798 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6799
6800 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6801 Fix_v4bx enum values .
6802 * gold/options.h (General_options): New option definitions.
6803 (General_options::fix_v4bx): New method.
6804 (General_options::Fix_v4bx): New enum.
6805 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6806 (General_options::parse_fix_v4bx_interworking): New method.
6807
6808 2010-01-22 Doug Kwan <dougkwan@google.com>
6809
6810 * arm.cc (Arm_exidx_fixup): New class.
6811
6812 2010-01-21 Doug Kwan <dougkwan@google.com>
6813
6814 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6815 classes.
6816 (Arm_exidx_section_offset_map): New type.
6817
6818 2010-01-21 Doug Kwan <dougkwan@google.com>
6819
6820 * arm.cc (Arm_exidx_input_section): New class.
6821 (Arm_relobj::exidx_input_section_by_link,
6822 Arm_relobj::exidx_input_section_by_shndx,
6823 Arm_relobj::make_exidx_input_section): New methods.
6824 (read_arm_attributes_section): Remove.
6825 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6826 information about them.
6827 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6828 to here.
6829
6830 2010-01-20 Doug Kwan <dougkwan@google.com>
6831
6832 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6833 Input_section_specifier to Section_id.
6834 (Target_arm::new_arm_input_section: Adjust code for change of key
6835 type.
6836 (Target_arm::find_arm_input_section): Ditto.
6837 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6838 (Section_id): Remove.
6839 (Garbage_collection::Section_id_hash): Remove.
6840 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6841 (Section_id): Remove.
6842 (Icf::Section_id_hash): Remove.
6843 * object.h (Section_id, Const_section_id, Section_id_hash,
6844 Const_section_id_hash): New type definitions.
6845 * output.cc (Output_section::add_relaxed_input_section): Change to
6846 use Const_section_id instead of Input_section_specifier as key type.
6847 (Output_section::add_merge_input_section): Ditto.
6848 (Output_section::build_relaxation_map): Change to use Section_id
6849 instead of Input_section_specifier as key type.
6850 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6851 Ditto.
6852 (Output_section::convert_input_sections_to_relaxed_sections): Change
6853 to use Const_section_id instead of Input_section_specifier as key type.
6854 (Output_section::find_merge_section): Ditto.
6855 (Output_section::find_relaxed_input_section): Ditto.
6856 * output.h (Input_section_specifier): Remove class.
6857 (Output_section::Output_section_data_by_input_section_map): Change
6858 key type to Const_section_id.
6859 (Output_section::Output_relaxed_input_section_by_input_section_map):
6860 Ditto.
6861 (Output_section::Relaxation_map): Change key type to Section_id.
6862
6863 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6864
6865 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6866 (class Arm_v4bx_stub): New class.
6867 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6868 (Stub_factory::make_arm_v4bx_stub): New method.
6869 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6870 (Stub_table::empty): Handle v4bx stubs.
6871 (Stub_table::add_arm_v4bx_stub): New method.
6872 (Stub_table::find_arm_v4bx_stub): New method.
6873 (Arm_relocate_functions::v4bx): New method.
6874 (Target_arm::fix_v4bx): New method.
6875 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6876 (Stub_table::relocate_stubs): Likewise.
6877 (Stub_table::do_write): Likewise.
6878 (Stub_table::update_data_size_and_addralign): Likewise.
6879 (Stub_table::finalize_stubs): Likewise.
6880 (Target_arm::Scan::local): Likewise.
6881 (Target_arm::Scan::global): Likewise.
6882 (Target_arm::do_finalize_sections): Likewise.
6883 (Target_arm::Relocate::relocate): Likewise.
6884 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6885 Likewise.
6886 (Target_arm::scan_reloc_for_stub): Likewise.
6887 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6888
6889 2010-01-19 Ian Lance Taylor <iant@google.com>
6890
6891 * output.cc (Output_section_headers::do_sized_write): Write large
6892 segment count to sh_info field.
6893 (Output_file_header::do_sized_write): For large segment count,
6894 write PN_XNUM to e_phnum field.
6895
6896 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6897
6898 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6899 (Arm_relocate_functions::thm_jump8): New function.
6900 (Arm_relocate_functions::thm_jump11): New function.
6901 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6902 R_ARM_THM_JUMP11.
6903 (Target_arm::Scan::global): Likewise.
6904 (Target_arm::Relocate::relocate): Likewise.
6905 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6906 Likewise.
6907
6908 2010-01-14 Doug Kwan <dougkwan@google.com>
6909
6910 * arm.cc (map, utility): Include headers.
6911 (Target_arm::apply_cortex_a8_workaround): New method.
6912 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6913 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6914 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6915 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6916 the --[no-]fix-cortex-a8 command line options.
6917 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6918 (Target_arm::relocate_stub): Use addend in instruction template.
6919 * options.h (DEFINE_bool): Set the user-set flag.
6920 (General_options): Add --[no-]-fix-cortex options.
6921 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6922 : Update fast look-up map after conversion.
6923
6924 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6925
6926 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6927 in the first pass of do_layout.
6928
6929 2010-01-13 Doug Kwan <dougkwan@google.com>
6930
6931 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6932 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6933 apparent compiler problem of not folding static constant integral
6934 data members of elfcpp::Elf_sizes<32>.
6935
6936 2010-01-13 Doug Kwan <dougkwan@google.com>
6937
6938 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6939 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6940 Arm_relobj::scan_section_for_cortex_a8_erratum,
6941 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6942 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6943 sections to scan for relocation stubs into a new method
6944 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6945 relocation and Cortex-A8 stub scanning.
6946 (Target_arm::do_relax): Force stubs to be after stubbed sections
6947 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6948 the beginning of a new relaxation pass. Update a comment.
6949 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6950
6951 2010-01-12 Ian Lance Taylor <iant@google.com>
6952
6953 * target-reloc.h (visibility_error): New inline function.
6954 (relocate_section): Call visibility_error.
6955 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6956 (MOSTLYCLEANFILES): Likewise.
6957 (protected_4_pic.o, protected_3.err): New targets.
6958 * testsuite/protected_4.cc: New file.
6959
6960 2010-01-12 Doug Kwan <dougkwan@google.com>
6961
6962 * arm.cc (Cortex_a8_reloc): New class.
6963 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6964 and cortex_a8_relocs_info_.
6965 (Target_arm::fix_cortex_a8): New method definition.
6966 (Target_arm::Cortex_a8_relocs_info): New type.
6967 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6968 New data member declarations.
6969 (Target_arm::scan_reloc_for_stub): Record information about
6970 relocations for THUMB branches that might be exempted from the
6971 Cortex-A8 workaround.
6972 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6973 at the beginning of a relaxation pass.
6974
6975 2010-01-12 Doug Kwan <dougkwan@google.com>
6976
6977 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6978 (Arm_relobj::Mapping_symbol_position,
6979 Arm_reloj::Mapping_symbol_position_less,
6980 Arm_relobj::Mapping_symbols_info): New types.
6981 (Target_arm::is_mapping_symbol_name): New method definition.
6982 (Arm_relobj::do_count_local_symbols): Save information about mapping
6983 symbols.
6984
6985 2010-01-11 Doug Kwan <dougkwan@google.com>
6986
6987 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6988 Arm_relocate_functions::thumb32_branch_upper,
6989 Arm_relocate_functions::thumb32_branch_lower,
6990 Arm_relocate_functions::thumb32_cond_branch_offset,
6991 Arm_relocate_functions::thumb32_cond_branch_upper,
6992 Arm_relocate_functions::thumb32_cond_branch_lower,
6993 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6994 branch offset encoding.
6995 (Arm_relocate_functions::thumb_branch_common): Use new branch
6996 offset encoding methods to avoid code duplication.
6997 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6998 (Stub_addend_reader::operator()): Use new branch encoding method
6999 to avoid code duplication.
7000
7001 2010-01-11 Doug Kwan <dougkwan@google.com>
7002
7003 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7004 (Target_arm::do_finalize_sections): Define special EXIDX section
7005 symbols only if referenced.
7006 * gc.h (Garbage_collection::add_reference): New method.
7007 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7008 code duplication.
7009
7010 2010-01-11 Ian Lance Taylor <iant@google.com>
7011
7012 * script.cc (Version_script_info::build_expression_list_lookup):
7013 Change complaing about duplicate wildcard match from error to
7014 warning.
7015
7016 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7017 of 2009-12-30.
7018 (Version_script_info::Version_script_info): Initialize globs_,
7019 default_version_, default_is_global_, and exact_. Don't
7020 initialize globals_ or locals_.
7021 (Version_script_info::build_lookup_tables): Build local symbols
7022 first.
7023 (Version_script_info::unquote): New function.
7024 (Version_script_info::add_exact_match): New function.
7025 (Version_script_info::build_expression_list_lookup): Remove lookup
7026 parameter. Add is_global parameter. Change all callers. Handle
7027 wildcard pattern specially. Unquote pattern. Call
7028 add_exact_match.
7029 (Version_script_info::get_name_to_match): New function.
7030 (Version_script_info::get_symbol_version): New function.
7031 (Version_script_info::get_symbol_version_helper): Remove.
7032 (Version_script_info::check_unmatched_names): Call unquote.
7033 * script.h (class Version_script_info): Change get_symbol_version
7034 to be non-inline and add is_global parameter; change all callers.
7035 Rewrite symbol_is_local. Update declarations. Define struct
7036 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7037 Remove globals_ and locals_ members. Add exact_, globs_,
7038 default_version_, is_global_.
7039 (Version_script_info::Glob): Remove pattern, add expression and
7040 is_global. Update constructor. Change all callers.
7041 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7042 default version.
7043 (Versions::symbol_section_contents): If a symbol is undefined, or
7044 defined in a dynamic object, set the version index to
7045 VER_NDX_LOCAL.
7046 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7047 symbol_is_local.
7048 (Symbol_table::add_from_pluginobj): Likewise.
7049 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7050
7051 2010-01-11 Doug Kwan <dougkwan@google.com>
7052
7053 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7054 (incremental_dump_LDADD): Add linking option for libintl.
7055 * Makefile.in: Regenerate.
7056
7057 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7058
7059 PR gold/11144
7060 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7061 instead of -Ds.
7062 * testsuite/Makefile.in: Regenerated.
7063
7064 2010-01-10 Doug Kwan <dougkwan@google.com>
7065
7066 * options.h (DEFINE_var): Use parentheses around argument varname__
7067 in macro body to avoid any unintended subsequent substitutions.
7068
7069 2010-01-10 Ian Lance Taylor <iant@google.com>
7070
7071 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7072 candidates before doing symbol resolution.
7073
7074 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7075 ODR candidates if only one is weak.
7076
7077 2010-01-08 Ian Lance Taylor <iant@google.com>
7078
7079 * script.cc (Version_script_info::build_expression_list_lookup):
7080 Don't warn about ambiguous version, just record the ambiguity.
7081 (Version_script_info::get_symbol_version_helper): Give error if
7082 version is ambiguous.
7083
7084 2010-01-08 Doug Kwan <dougkwan@google.com>
7085
7086 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7087 prev_data_size_ and prev_addralign_. Remove initializer for
7088 deleted data member has_been_changed_.
7089 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7090 to determine if the table is empty.
7091 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7092 Remove.
7093 (Stub_table::add_reloc_stub): Define method in class definition
7094 instead of just declaring it there.
7095 (Stub_table::add_cortex_a8_stub): New method definition.
7096 (Stub_table::update_data_size_and_addralign): Ditto.
7097 (Stub_table::finalize_stubs): Ditto.
7098 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7099 (Stub_table::do_addralign_): Return address alignment in the
7100 (Stub_table::do_reset_address_and_file_offset): Define method in
7101 class definition instead of declaring it there. Set current data
7102 size to be the data size of the previous pass.
7103 (Stub_table::set_final_data_size): Use current data size as the
7104 final data size.
7105 (Stub_table::relocate_stub): Change parameter type of stub from
7106 Reloc_stub pointer to Stub pointer.
7107 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7108 (Stub_table::Cortex_a8_stub_list): New typedef.
7109 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7110 Stub_table::prev_addralign_): New data member.
7111 (Arm_relobj::Arm_relobj): Initialize data member
7112 section_has_cortex_a8_workaround_.
7113 (Arm_relobj::section_has_cortex_a8_workaround,
7114 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7115 definitions.
7116 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7117 declarations.
7118 (Target_arm::relocate_stub): Change parameter type of stub from
7119 Reloc_stub pointer to Stub pointer.
7120 (Insn_template::size, Insn_template::alignment): Handle
7121 THUMB16_SPECIAL_TYPE.
7122 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7123 Stub_table::update_data_size_and_addralign,
7124 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7125 definitions.
7126 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7127 (Stub_table::do_write): Ditto.
7128 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7129
7130 2010-01-08 Ian Lance Taylor <iant@google.com>
7131
7132 PR 11108
7133 * symtab.h (class Symbol): Remove fields is_target_special_ and
7134 has_plt_offset_. Add field is_defined_in_discarded_section_.
7135 (Symbol::is_defined_in_discarded_section): New function.
7136 (Symbol::set_is_defined_in_discarded_section): New function.
7137 (Symbol::has_plt_offset): Rewrite.
7138 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7139 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7140 Don't initialize is_target_special_ or has_plt_offset_.
7141 Initialize is_defined_in_discarded_section_.
7142 (Symbol_table::add_from_relobj): If appropriate, set
7143 is_defined_in_discarded_section.
7144 * resolve.cc (Symbol::override_base_with_special): Don't test
7145 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7146 * target-reloc.h (relocate_section): Do special handling for
7147 symbols defined in discarded sections for global symbols as well
7148 as local symbols.
7149
7150 2010-01-08 Ian Lance Taylor <iant@google.com>
7151
7152 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7153 the SHT_SYMTAB case.
7154
7155 2010-01-08 Ian Lance Taylor <iant@google.com>
7156
7157 * object.cc (Sized_relobj::do_layout): Don't get confused if
7158 layout_eh_frame returns NULL.
7159
7160 2010-01-08 Ian Lance Taylor <iant@google.com>
7161
7162 PR 11084
7163 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7164 dynamic symbol table, use the normal symbol table.
7165 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7166 symbol table.
7167
7168 2010-01-08 Ian Lance Taylor <iant@google.com>
7169
7170 PR 11072
7171 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7172 sections.
7173
7174 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7175
7176 * version.cc (print_version): Change to "Copyright 2010".
7177
7178 2010-01-08 Ian Lance Taylor <iant@google.com>
7179
7180 PR 10287
7181 PR 11063
7182 * i386.cc (class Target_i386): Change return type of plt_section
7183 to be non-const.
7184 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7185 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7186 tls_desc_rel_ field.
7187 (Output_data_plt_i386::rel_tls_desc): New function.
7188 (Target_i386::rel_tls_desc_section): New function.
7189 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7190 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7191 R_386_TLS_DESC reloc in rel_tls_desc_section.
7192 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7193 Define struct Tlsdesc_info.
7194 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7195 (Target_x86_64::do_reloc_symbol_index): New function.
7196 (Target_x86_64::add_tlsdesc_info): New function.
7197 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7198 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7199 tlsdesc_rel_ field.
7200 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7201 all callers.
7202 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7203 (Target_x86_64::rela_tlsdesc_section): New function.
7204 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7205 handling.
7206 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7207 (Target_x86_64::do_reloc_addend): New function.
7208 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7209 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7210 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7211 (Output_reloc::type): New function.
7212 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7213 (Output_reloc::is_target_specific): New function.
7214 (Output_reloc::target_arg): New function.
7215 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7216 absolute relocs and target specific relocs.
7217 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7218 add_target_specific.
7219 (class Output_data_reloc) [SHT_RELA]: Likewise.
7220 * output.cc (Output_reloc::Output_reloc): Add four new versions
7221 for absolute relocs and target specific relocs.
7222 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7223 (Output_reloc::get_symbol_index): Likewise.
7224 (Output_reloc::local_section_offset): Check that local_sym_index_
7225 is not TARGET_CODE or 0.
7226 (Output_reloc::symbol_value): Likewise.
7227 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7228 reloc.
7229 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7230 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7231 functions.
7232 * layout.cc (add_target_dynamic_tags): Use output section for
7233 DT_PLTRELSZ and DT_JMPREL.
7234
7235 2010-01-07 Ian Lance Taylor <iant@google.com>
7236
7237 PR 11061
7238 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7239 function.
7240 (class Output_data_reloc_generic): Define.
7241 (class Output_data_reloc_base): Change base class to
7242 Output_data_reloc_generic. Change add() method to call
7243 bump_relative_reloc_count for a relative reloc. Remove
7244 sort_relocs_ field.
7245 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7246 to sort_relocs().
7247 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7248 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7249 appropriate.
7250 * layout.h (class Layout): Update declaration.
7251
7252 2010-01-07 Ian Lance Taylor <iant@google.com>
7253
7254 * output.h (class Output_data): Add const version of
7255 output_section and do_output_section.
7256 (class Output_section_data): Add const version of
7257 do_output_section.
7258 (class Output_section): Likewise.
7259 * layout.cc (Layout::add_target_dynamic_tags): New function.
7260 * layout.h (class Layout): Update declarations.
7261 * arm.cc (Target_arm::do_finalize_sections): Use
7262 add_target_dynamic_tags.
7263 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7264 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7265 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7266 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7267
7268 2010-01-07 Ian Lance Taylor <iant@google.com>
7269
7270 PR 11042
7271 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7272 object as needed.
7273
7274 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7275 Ian Lance Taylor <iant@google.com>
7276
7277 PR 11019
7278 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7279 Xindex::read_symtab_xindex.
7280
7281 2010-01-07 Doug Kwan <dougkwan@google.com>
7282
7283 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7284 (Insn_template::thumb16_bcond_insn): New method declaration.
7285 (Insn_template): Fix spelling.
7286 (Stub::thumb16_special): New method declaration.
7287 (Stub::do_write): Define virtual method which was previously pure
7288 virtual.
7289 (Stub::do_thumb16_special): New method declaration.
7290 (Stub::do_fixed_endian_write): New template member.
7291 (Reloc_stub::do_write): Remove.
7292 (Reloc_stub::do_fixed_endian_write): Remove.
7293 (Cortex_a8_stub): New class definition.
7294 (Stub_factory::make_cortex_a8_stub): New method definition.
7295 (Stub_factory::Stub_factory): Add missing static storage class
7296 qualifier for elf32_arm_stub_a8_veneer_blx.
7297
7298 2010-01-07 Ian Lance Taylor <iant@google.com>
7299
7300 PR 10980
7301 * options.h (class General_options): Add --warn-unresolved-symbols
7302 and --error-unresolved-symbols.
7303 * errors.cc (Errors::undefined_symbol): Implement
7304 --warn-unresolved-symbols.
7305
7306 * options.h (class General_options): Add -z text and -z textoff.
7307 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7308
7309 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7310
7311 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7312 (Garbage_collection::cident_sections): New function.
7313 (Garbage_collection::add_cident_section): New function.
7314 (Garbage_collection::cident_sections_): New member.
7315 (gc_process_relocs): Add references to sections whose names are C
7316 identifiers.
7317 * gold.h (cident_section_start_prefix): New constant.
7318 (cident_section_stop_prefix): New constant.
7319 (is_cident): New function.
7320 * layout.cc (Layout::define_section_symbols): Replace string constants
7321 with the newly defined constants.
7322 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7323 C identifiers.
7324 * testsuite/Makefile.am: Add gc_orphan_section_test.
7325 * testsuite/Makefile.in: Regenerate.
7326 * testsuite/gc_orphan_section_test.cc: New file.
7327 * testsuite/gc_orphan_section_test.sh: New file.
7328
7329 2010-01-06 Ian Lance Taylor <iant@google.com>
7330
7331 PR 10980
7332 * options.h (class General_options): Add --warn-shared-textrel.
7333 * layout.cc (Layout::finish_dynamic_section): Implement
7334 --warn-shared-textrel.
7335
7336 PR 10980
7337 * options.h (class General_options): Add --warn-multiple-gp.
7338
7339 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7340
7341 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7342 $(THREADSLIB) and $(LIBDL).
7343 * Makefile.in: Rebuild.
7344
7345 2010-01-06 Ian Lance Taylor <iant@google.com>
7346
7347 PR 10980
7348 * options.cc (General_options::parse_section_start): New function.
7349 (General_options::section_start): New function.
7350 (General_options::General_options): Initialize all members.
7351 * options.h: Include <map>
7352 (class General_options): Add --section-start. Add section_starts_
7353 member.
7354 * layout.cc (Layout::attach_allocated_section_to_segment): If
7355 --section-start was used, set the address of the segment. Remove
7356 local sort_sections.
7357 (Layout::relaxation_loop_body): If the address of the load segment
7358 has been set by --section-start, don't use it.
7359 * output.h (Output_segment::update_flags_for_output_section): New
7360 function.
7361 * output.cc (Output_segment::add_output_section): Call
7362 update_flags_for_output_section.
7363
7364 2010-01-05 Ian Lance Taylor <iant@google.com>
7365
7366 PR 10980
7367 * options.h (class General_options): Add --undefined-version.
7368 * script.cc (struct Version_expression): Add was_matched_by_symbol
7369 field.
7370 (Version_script_info::matched_symbol): New function.
7371 (Version_script_info::get_symbol_version_helper): Call
7372 matched_symbol.
7373 (Version_script_info::check_unmatched_names): New function.
7374 * script.h (class Version_script_info): Update declarations.
7375 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7376
7377 * options.h (class General_options): Use DEFINE_bool_alias for
7378 allow_multiple_definition.
7379 * resolve.cc (Symbol_table::should_override): Don't test
7380 allow_multiple_definition.
7381
7382 PR 10980
7383 * options.h (class General_options): Add --cref.
7384 * main.cc (main): Print cref table if --cref. Don't close mapfile
7385 until after printing cref table.
7386 * cref.cc: Include "symtab.h".
7387 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7388 (Cref_table_compare::operator()): New function.
7389 (Cref_inputs::gather_cref): New function.
7390 (filecol): New static const.
7391 (Cref_inputs::print_cref): New function.
7392 (Cref::print_cref): New function.
7393 * cref.h: Include <cstdio>.
7394 (class Cref): Update declarations.
7395 * mapfile.h (Mapfile::file): New function.
7396 * object.h (class Object): Define Symbols. Declare virtual
7397 do_get_global_symbols.
7398 (Object::get_global_symbols): New function.
7399 * object.cc (Input_objects::add_object): Pass object to cref_ if
7400 --cref.
7401 (Input_objects::archive_start): Likewise.
7402 (Input_objects::archive_stop): Likewise.
7403 (Input_objects::print_cref): New function.
7404 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7405 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7406 --cref.
7407 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7408 function.
7409 * plugin.h (class Sized_pluginobj): Update declarations.
7410
7411 2010-01-05 Ian Lance Taylor <iant@google.com>
7412
7413 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7414 to is_default_version. Rename insdef to insdefault.
7415 (Symbol_table::add_from_relobj): Rename def to is_default_version
7416 and local to is_forced_local.
7417 (Symbol_table::add_from_pluginobj): Likewise.
7418 (Symbol_table::add_from_dynobj): Likewise.
7419 (Symbol_table::define_special_symbol): Rename insdef to
7420 insdefault.
7421
7422 2010-01-04 Ian Lance Taylor <iant@google.com>
7423
7424 PR 10980
7425 * options.h (class General_options): Add
7426 --allow-multiple-definition and -z muldefs.
7427 * resolve.cc (Symbol_table::should_override): Don't warn about a
7428 multiple symbol definition if --allow-multiple-definition or -z
7429 muldefs.
7430
7431 PR 10980
7432 * options.h (class General_options): Add --add-needed and
7433 --copy-dt-needed-entries. Tweak --as-needed help entry.
7434 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7435 error if --copy-dt-needed-entries aka --add-needed is used and
7436 would cause a change in behaviour.
7437
7438 PR 10980
7439 * options.h (class General_options): Add -G as a short version of
7440 --shared. Add no-op options -assert, -g, and -i.
7441
7442 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7443
7444 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7445 check for .text or .gnu.linkonce.t sections.
7446 * icf.cc (Icf::find_identical_sections): Ditto.
7447 Change the detection for mangled function name within the section
7448 name.
7449 * icf.h (is_section_foldable_candidate): New function.
7450
7451 2009-12-30 Ian Lance Taylor <iant@google.com>
7452
7453 PR 10980
7454 * options.h (class General_options): Permit two dashes with
7455 --retain-symbols-file.
7456
7457 2009-12-30 Ian Lance Taylor <iant@google.com>
7458
7459 PR 10979
7460 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7461 don't put the file header and segment headers in the text
7462 segment.
7463
7464 PR 10979
7465 * common.cc (Sort_commons::operator()): Stabilize sort when both
7466 entries are NULL.
7467 (Symbol_table::do_allocate_commons_list): When allocating common
7468 symbols, skip a symbol which is no longer common.
7469 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7470 an object before checking its type.
7471 * testsuite/common_test_2.c: New file.
7472 * testsuite/common_test_3.c: New file.
7473 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7474 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7475 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7476 (common_test_2_pic.o, common_test_2.so): New targets.
7477 (common_test_3_pic.o, common_test_3.so): New targets.
7478 * testsuite/Makefile.in: Rebuild.
7479
7480 PR 10979
7481 * script.cc (read_input_script): If we see a new SECTIONS clause,
7482 and we have added an input section, give an error.
7483 * layout.h (class Layout): Add have_added_input_section function.
7484 Add have_added_input_section_ field.
7485 * layout.cc (Layout::Layout): Initialize
7486 have_added_input_section_.
7487 (Layout::layout): Set have_added_input_section_.
7488 (Layout::layout_eh_frame): Likewise.
7489
7490 2009-12-30 Ian Lance Taylor <iant@google.com>
7491
7492 PR 10931
7493 * options.h (class General_options): Add --sort-common option.
7494 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7495 * common.cc (Sort_common): Add sort_order parameter to
7496 constructor. Add sort_order_ field.
7497 (Sort_commons::operator): Check sort_order_.
7498 (Symbol_table::allocate_commons): Determine the sort order.
7499 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7500 Change all callers.
7501 (Symbol_table::do_allocate_commons_list): Likewise.
7502
7503 2009-12-30 Ian Lance Taylor <iant@google.com>
7504
7505 PR 10916
7506 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7507 symbols from this object, don't change the visibility of an
7508 undefined symbol.
7509 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7510
7511 2009-12-30 Ian Lance Taylor <iant@google.com>
7512
7513 PR 10861
7514 * script.h (class Version_script_info): Define Language enum.
7515 Update declarations. Define Glob, Exact, and Lookup types. Add
7516 new fields globals_, locals_, and is_finalized_.
7517 * script.cc: Various formatting fixes.
7518 (class Parser_closure): Change language_stack_ from a vector of
7519 std::string to one of Version_script_info::Language. Adjust all
7520 uses accordingly.
7521 (class Lazy_demangler): Remove.
7522 (struct Version_expression): Change language from std::string to
7523 Version_script_info::Language.
7524 (Version_script_info::Version_script_info): New function.
7525 (Version_script_info::~Version_script_info): Don't call clear.
7526 (Version_script_info::finalize): New function.
7527 (Version_script_info::build_lookup_tables): New function.
7528 (Version_script_info::build_expression_list_lookup): New
7529 function.
7530 (Version_script_info::get_symbol_version_helper): Rewrite to use
7531 lookup tables.
7532 (Version_script_info::print_expression_list): Adjust to use
7533 Version_script_info::Language.
7534 (script_push_lex_into_version_mode): Check that the version script
7535 has not been finalized.
7536 (version_script_push_lang): Change language string to
7537 Version_script_info::Language.
7538 * options.cc (Command_line::version_script): New function.
7539 * options.h (class General_options): Add finalize_dynamic_list
7540 function. Change version_script from declaration to definition.
7541 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7542 * testsuite/version_script.map: Remove duplicate def of foo.
7543 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7544 version_script.map.
7545 * testsuite/Makefile.in: Rebuild.
7546
7547 2009-12-30 Ian Lance Taylor <iant@google.com>
7548
7549 PR 10843
7550 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7551 if the input symbol index is 0, make the output symbol index 0.
7552
7553 2009-12-30 Ian Lance Taylor <iant@google.com>
7554
7555 PR 10670
7556 * options.h (class General_options): Add -x/--discard-all.
7557 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7558 --discard-all. If the local symbol needs a dynamic entry, check
7559 that before handling --discard-locals.
7560
7561 2009-12-30 Ian Lance Taylor <iant@google.com>
7562
7563 PR 10450
7564 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7565 flags to PF_R.
7566 (Output_segment::add_output_section): Don't change the flags if
7567 the type is PT_TLS.
7568
7569 PR 10450
7570 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7571 GNU hash table if they need a dynamic value. Otherwise, don't add
7572 them if they are defined in a dynamic object or are forced local.
7573
7574 2009-12-29 Ian Lance Taylor <iant@google.com>
7575
7576 PR 10450
7577 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7578 .gnu.hash table for a 32-bit target.
7579
7580 PR 10450
7581 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7582 regular and a dynamic object only needs a dynamic symbol table
7583 entry if it is externally visible.
7584
7585 PR 10450
7586 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7587 constructor. Add global_offset_table_ field.
7588 (Target_i386::got_section): Set global_offset_table_.
7589 (Target_i386::do_finalize_sections): Set global_offset_table_
7590 size.
7591 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7592 in constructor. Add global_offset_table_ field.
7593 (Target_x86_64::got_section): Set global_offset_table_.
7594 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7595 size.
7596
7597 * layout.cc (Layout::Layout): Initialize increase_relro_.
7598 (Layout::get_output_section): Add is_relro, is_last_relro, and
7599 is_first_non_relro parameters. Change all callers.
7600 (Layout::choose_output_section): Likewise.
7601 (Layout::add_output_section_data): Likewise.
7602 (Layout::make_output_section): Likewise.
7603 (Layout::set_segment_offsets): Clear increase_relro when using a
7604 linker script.
7605 * layout.h (class Layout): Add increase_relro method. Add
7606 increase_relro_ field. Update declarations.
7607 * output.cc (Output_section::Output_section): Initialize
7608 is_last_relro_ and is_first_non_relro_.
7609 (Output_segment::add_output_section): Group relro sections is
7610 do_sort is true. Handle is_last_relro and is_first_non_relro.
7611 (Output_segment::maximum_alignment): Remove relro handling.
7612 (Output_segment::set_section_addresses): Add increase_relro
7613 parameter. Change all callers. Add initial alignment to align
7614 relro sections on separate page. Remove old relro handling.
7615 (Output_segment::set_section_list_addresses): Remove in_relro
7616 parameter. Change all callers.
7617 (Output_segment::set_offset): Add increase parameter. Change all
7618 callers. Remove old relro handling.
7619 * output.h (class Output_section): Add new methods: is_last_relro,
7620 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7621 Add is_last_relro_ and is_first_non_relro_ fields.
7622 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7623 Create separate .got.plt section. Call increase_relro.
7624 * x86_64.cc (Target_x86_64::got_section): Likewise.
7625 * testsuite/relro_script_test.t: Add .got.plt.
7626
7627 PR 10450
7628 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7629 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7630 (Layout::finalize): Call set_dynamic_symbol_size.
7631 (Layout::set_dynamic_symbol_size): New function.
7632 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7633 set_dynamic_symbol_size.
7634
7635 PR 10450
7636 * output.h (class Output_section): Add is_entsize_zero_ field.
7637 * output.cc (Output_section::Output_section): Initialize
7638 is_entsize_zero_.
7639 (Output_section::set_entsize): If two different entsizes are
7640 requested, force it to zero.
7641 (Output_section::add_input_section): Set flags for .debug_str
7642 before updating section flags. Set entsize.
7643 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7644 and SHF_STRING if all input sections have those flags.
7645
7646 2009-12-29 Rafael Espindola <espindola@google.com>
7647
7648 * main.cc (main): Fix the sys time reporting.
7649 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7650 reporting.
7651
7652 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7653
7654 * options.cc (General_options::parse_version): Allow -v to exit
7655 without an error if there is nothing to link.
7656
7657 2009-12-29 Ian Lance Taylor <iant@google.com>
7658
7659 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7660 using a version of gcc before 4.1.
7661 * configure: Rebuild.
7662
7663 2009-12-28 Chris Demetriou <cgd@google.com>
7664
7665 * attributes.cc (Output_attributes_section_data::do_write): Use
7666 std::vector::front rather than std::vector::data.
7667
7668 2009-12-28 Ian Lance Taylor <iant@google.com>
7669
7670 * symtab.h (class Symbol_table): Add enum Defined.
7671 * resolve.cc (Symbol_table::should_override): Add defined
7672 parameter. Change all callers. Test whether object is NULL
7673 before calling a method on it.
7674 (Symbol_table::report_resolve_problem): Add defined parameter.
7675 Change all callers.
7676 (Symbol_table::should_override_with_special): Likewise.
7677 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7678 parameter. Change all callers.
7679 (Symbol_table::do_define_in_output_data): Likewise.
7680 (Symbol_table::define_in_output_segment): Likewise.
7681 (Symbol_table::do_define_in_output_segment): Likewise.
7682 (Symbol_table::define_as_constant): Likewise.
7683 (Symbol_table::do_define_as_constant): Likewise.
7684 * script.h (class Symbol_assignment): Add is_defsym parameter to
7685 constructor; change all callers.
7686 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7687 parameter. Change all callers. Add is_defsym_ field.
7688 (class Parser_closure): Add parsing_defsym parameter to
7689 constructor; change all callers. Add parsing_defsym accessor
7690 function. Add parsing_defsym_ field.
7691
7692 2009-12-28 Ian Lance Taylor <iant@google.com>
7693
7694 * gold.cc (queue_middle_tasks): Fix formatting.
7695 * object.cc (Relobj::is_section_name_included): Likewise.
7696
7697 2009-12-23 Ian Lance Taylor <iant@google.com>
7698
7699 * i386.cc (Target_i386::do_calls_non_split): Recognize
7700 -fsplit-stack prologue for a function with a static chain.
7701 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7702 -fsplit-stack prologue when using %r11.
7703
7704 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7705
7706 * options.cc (General_options::parse_version): Make -v continue and do
7707 the link like GNU ld does.
7708
7709 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7710
7711 * Makefile.am (CCFILES): Add timer.cc.
7712 (HFILES): Add timer.h.
7713 * configure.ac: Check for sysconf and times.
7714 * main.cc: include timer.h.
7715 (main): Use Timer instead of get_run_time.
7716 * timer.cc: New.
7717 * timer.h: New.
7718 * workqueue.cc: include timer.h.
7719 (Workqueue::find_and_run_task):
7720 Report user, sys and wall time.
7721 * Makefile.in: Regenerate.
7722 * config.in: Regenerate.
7723 * configure: Regenerate.
7724
7725 2009-12-16 Doug Kwan <dougkwan@google.com>
7726
7727 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7728 sections.
7729 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7730 relaxed input sections.
7731 * output.cc (Output_section::find_relaxed_input_section): Change
7732 return type to Output_relaxed_input_section pointer. Adjust code
7733 for new type of relaxed_input_section_map_.
7734 * output.h (Output_section::find_relaxed_input_section): Change
7735 return type to Output_relaxed_input_section pointer.
7736 (Output_section::Output_relaxed_input_section_by_input_section_map):
7737 New type.
7738 (Output_section::relaxed_input_section_map_): Change type to
7739 Output_section::Output_relaxed_input_section_by_input_section_map.
7740 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7741 input section.
7742
7743 2009-12-15 Ian Lance Taylor <iant@google.com>
7744
7745 * layout.cc (Layout::create_shstrtab): Only write out after input
7746 sections if we are compressing debug sections.
7747
7748 2009-12-15 Ian Lance Taylor <iant@google.com>
7749
7750 * archive.cc (Archive::add_symbols): Only look up a symbol without
7751 a version if there is, in fact, a version.
7752
7753 2009-12-14 Ian Lance Taylor <iant@google.com>
7754
7755 Revert -Wshadow changes, all changes from:
7756 2009-12-11 Doug Kwan <dougkwan@google.com>
7757 2009-12-11 Nick Clifton <nickc@redhat.com>
7758 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7759
7760 2009-12-11 Doug Kwan <dougkwan@google.com>
7761
7762 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7763 due to -Wshadow.
7764 * attributes.cc (Object_attribute::size): Ditto.
7765 (Attributes_section_data::size): Ditto.
7766 (Attributes_section_data::Attributes_section_data): Ditto.
7767 (Output_attributes_section_data::do_write): Ditto.
7768 * attributes.h (Object_attribute::set_type): Ditto.
7769 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7770
7771 2009-12-11 Nick Clifton <nickc@redhat.com>
7772
7773 * archive.cc: Fix shadowed variable warnings.
7774 * arm.cc: Likewise.
7775 * compressed_output.cc: Likewise.
7776 * compressed_output.h: Likewise.
7777 * configure: Likewise.
7778 * dwarf_reader.cc: Likewise.
7779 * dynobj.cc: Likewise.
7780 * dynobj.h: Likewise.
7781 * ehframe.cc: Likewise.
7782 * ehframe.h: Likewise.
7783 * errors.cc: Likewise.
7784 * expression.cc: Likewise.
7785 * fileread.cc: Likewise.
7786 * fileread.h: Likewise.
7787 * freebsd.h: Likewise.
7788 * i386.cc: Likewise.
7789 * icf.cc: Likewise.
7790 * incremental.h: Likewise.
7791 * layout.cc: Likewise.
7792 * layout.h: Likewise.
7793 * mapfile.cc: Likewise.
7794 * merge.cc: Likewise.
7795 * merge.h: Likewise.
7796 * object.cc: Likewise.
7797 * object.h: Likewise.
7798 * options.h: Likewise.
7799 * output.cc: Likewise.
7800 * output.h: Likewise.
7801 * parameters.cc: Likewise.
7802 * plugin.cc: Likewise.
7803 * powerpc.cc: Likewise.
7804 * reduced_debug_output.cc: Likewise.
7805 * reduced_debug_output.h: Likewise.
7806 * reloc.cc: Likewise.
7807 * reloc.h: Likewise.
7808 * resolve.cc: Likewise.
7809 * script-sections.cc: Likewise.
7810 * script.cc: Likewise.
7811 * script.h: Likewise.
7812 * sparc.cc: Likewise.
7813 * symtab.cc: Likewise.
7814 * symtab.h: Likewise.
7815 * target-select.cc: Likewise.
7816 * target-select.h: Likewise.
7817 * token.h: Likewise.
7818 * workqueue.cc: Likewise.
7819 * workqueue.h: Likewise.
7820 * x86_64.cc: Likewise.
7821
7822 2009-12-10 Doug Kwan <dougkwan@google.com>
7823
7824 * arm.cc (attributes.h): New include.
7825 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7826 (Arm_relobj::~Arm_relobj): Delete object pointed by
7827 attributes_section_data_.
7828 (Arm_relobj::attributes_section_data): New method definition.
7829 (Arm_relobj::attributes_section_data_): New data member declaration.
7830 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7831 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7832 attributes_section_data_.
7833 (Arm_dynobj::attributes_section_data): New method definition.
7834 (Arm_dynobj::attributes_section_data_): New data member declaration.
7835 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7836 initialization value of may_use_blx_ to false.
7837 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7838 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7839 object attributes to compute results instead of hard-coding.
7840 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7841 Target_arm::get_secondary_compatible_arch,
7842 Target_arm::set_secondary_compatible_arch
7843 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7844 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7845 New method declarations.
7846 (Target_arm::get_aeabi_object_attribute): New method definition.
7847 (Target_arm::attributes_section_data_): New data member declaration.
7848 (read_arm_attributes_section): New template definition.
7849 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7850 (Arm_dynobj::do_read_symbols): Ditto.
7851 (Target_arm::do_finalize_sections): Merge attributes sections from
7852 input. Check for BLX use after attributes section merging.
7853 Fix __exidx_start and __exidx_end visibility. Create an
7854 .ARM.attributes section if necessary.
7855 (Target_arm::get_secondary_compatible_arch,
7856 Target_arm::set_secondary_compatible_arch,
7857 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7858 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7859 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7860 New method definitions.
7861
7862 2009-12-09 Ian Lance Taylor <iant@google.com>
7863
7864 * plugin.cc (Plugin::load): Don't cast from void* to a function
7865 pointer.
7866
7867 2009-12-09 Ian Lance Taylor <iant@google.com>
7868
7869 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7870 information fields.
7871
7872 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7873
7874 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7875 Replace two_file_shared_1.so with two_file_shared_2.so.
7876 * testsuite/Makefile.in: Regenerated.
7877
7878 2009-12-08 Doug Kwan <dougkwan@google.com>
7879
7880 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7881 (HFILES): Add attributes.h and int_encoding.h.
7882 * Makefile.in: Regenerate.
7883 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7884 function definitions to int_encoding.cc
7885 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7886 prototypes to int_encoding.h
7887 * reduced_debug_output.cc (int_encoding.h): New include.
7888 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7889 function definitions to int_encoding.cc
7890 (insert_into_vector, read_from_pointer): Move template definitions to
7891 int_encoding.h
7892 * attributes.cc: New file.
7893 * attributes.h: New file.
7894 * int_encoding.cc: New file.
7895 * int_encoding.h: New file.
7896
7897 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7898
7899 PR gold/11055
7900 * incremental-dump.cc (dump_incremental_inputs): New.
7901 (main): Use dump_incremental_inputs.
7902
7903 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7904
7905 PR gold/10893
7906 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7907 checking elfcpp::STT_FUNC.
7908 (Target_i386::Relocate::relocate): Likewise.
7909 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7910
7911 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7912 symbols from shared libraries into normal FUNC symbols.
7913
7914 * symtab.h (Symbol): Add is_func and use it.
7915
7916 2009-12-05 Doug Kwan <dougkwan@google.com>
7917
7918 * arm.cc (Target_arm::arm_info): Initialize new fields
7919 attributes_section and attributes_vendor.
7920 * i386.cc (Target_i386::i386_info): Same.
7921 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7922 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7923 fields attributes_section and attributes_vendor.
7924 * sparc.cc (Target_sparc::sparc_info): Same.
7925 * target.h (Target::attributes_section, Target::attributes_vendor,
7926 Target::is_attributes_section, Target::attribute_arg_type,
7927 Target::attributes_order): New method definitions.
7928 (Target::Target_info::attributes_section,
7929 Target::Target_info::attributes_vendor): New fields.
7930 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7931 virtual method definitions.
7932 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7933 attributes_section and attributes_vendor.
7934 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7935
7936 2009-12-05 Doug Kwan <dougkwan@google.com>
7937
7938 * arm.cc: Update comments about interworking and stub generation.
7939 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7940 considered as non-PIC.
7941 (Arm_relocate_functions::base_abs): Fix formatting.
7942 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7943 of function to use GOT entry address instead of offset.
7944 (Target_arm::Scan::global): Issue an error if a symbol would need a
7945 PLT does not get one because it is untyped. Remove code to create
7946 dynamic symbols for relative branches.
7947 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7948 takes unsigned integer instead of boolean.
7949
7950 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7951
7952 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7953 (two_file_test_LDADD): Likewise.
7954 (common_test_1_LDADD): Likewise.
7955 (exception_test_LDADD) Likewise.
7956 (weak_test_LDADD): Likewise.
7957 (many_sections_test_LDADD): Likewise.
7958 (initpri1_LDADD): Likewise.
7959 (script_test_1_LDADD): Likewise.
7960 (script_test_2_LDADD): Likewise.
7961 (justsyms_LDADD): Likewise.
7962 (binary_test_LDADD): Likewise.
7963 (large_LDADD): Likewise.
7964 * testsuite/Makefile.in: Regenerated.
7965
7966 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7967
7968 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7969 (Symbol_table::override_with_special): Likewise.
7970 (Symbol_table::add_from_object): Likewise.
7971
7972 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7973
7974 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7975 Don't set the data_offset twice.
7976
7977 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7978
7979 * testsuite/Makefile.in: Regenerate.
7980
7981 2009-12-03 Doug Kwan <dougkwan@google.com>
7982
7983 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7984 (Target_arm::do_finalize_sections): Add parameter for symbol table
7985 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7986 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7987 parameter for symbol table pointer.
7988 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7989 an additional parameter for a pointer to symbol table.
7990 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7991 parameter for a symbol table pointer.
7992 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7993 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7994 Ditto.
7995 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7996 parameter for a symbol table pointer.
7997
7998 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7999
8000 * incremental.cc (Incremental_inputs_header)
8001 (Incremental_inputs_header_write, Incremental_inputs_entry)
8002 (Incremental_inputs_entry_write): Move ...
8003 * incremental.h (Incremental_inputs_header)
8004 (Incremental_inputs_header_write, Incremental_inputs_entry)
8005 (Incremental_inputs_entry_write): here.
8006
8007 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8008
8009 * incremental.cc (make_sized_incremental_binary): Set the target.
8010 Error if it is incompatible.
8011 * output.h (Output_file): Add filename method.
8012
8013 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8014
8015 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8016 from the get_* methods.
8017
8018 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8019
8020 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8021 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8022 Write 0 for the data_offset of scripts.
8023
8024 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8025
8026 * testsuite/Makefile.am: Add the incremental_test.sh test.
8027 * testsuite/incremental_test.sh: New.
8028 * testsuite/incremental_test_1.c: New.
8029 * testsuite/incremental_test_2.c: New.
8030
8031 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8032
8033 * incremental-dump.cc (main): Fix typos.
8034
8035 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8036
8037 PR gold/11025
8038 * incremental-dump.cc (main): Use llu to print 64 bit values.
8039
8040 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8041 H.J. Lu <hongjiu.lu@intel.com>
8042
8043 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8044 $(LIBDL).
8045 (incremental_dump_LDADD): Likewise.
8046 * Makefile.in: Regenerated.
8047
8048 2009-11-25 Doug Kwan <dougkwan@google.com>
8049
8050 Revert:
8051
8052 2009-11-25 Doug Kwan <dougkwan@google.com>
8053
8054 * arm.cc (Target_arm::Target_arm): Move method definition
8055 outside of class definition. Add code to handle
8056 --target1-rel, --target1-abs and --target2= options.
8057 (Target_arm::get_reloc_reloc_type): Change method to be
8058 non-static and const.
8059 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8060 New data member declaration.
8061 (Target_arm::Scan::local, Target_arm::Scan::global,
8062 Target_arm::Relocate::relocate,
8063 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8064 Adjust call to Target_arm::get_real_reloc_type.
8065 (Target_arm::get_real_reloc_type): Use command line options
8066 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8067 * options.h (--target1-rel, --target1-abs, --target2): New
8068 ARM-only options.
8069
8070 2009-11-25 Doug Kwan <dougkwan@google.com>
8071
8072 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8073 class definition. Add code to handle --target1-rel, --target1-abs
8074 and --target2= options.
8075 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8076 and const.
8077 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8078 member declaration.
8079 (Target_arm::Scan::local, Target_arm::Scan::global,
8080 Target_arm::Relocate::relocate,
8081 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8082 call to Target_arm::get_real_reloc_type.
8083 (Target_arm::get_real_reloc_type): Use command line options to
8084 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8085 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8086 options.
8087
8088 2009-11-25 Doug Kwan <dougkwan@google.com>
8089
8090 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8091 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8092 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8093 formatting.
8094 (Arm_relocate_functions::thm_call): Replace body with a call to
8095 Arm_relocate_functions::thumb_branch_common.
8096 (Arm_relocate_functions::thm_jump24,
8097 Arm_relocate_functions::thm_xpc22): New method definitions.
8098 (Arm_relocate_functions::thumb_branch_common): New method definition.
8099 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8100 operator.
8101 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8102 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8103
8104 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8105
8106 * Makefile.am: Build incremental-dump
8107 * Makefile.in: Regenerate.
8108 * incremental-dump.cc: New.
8109 * incremental.cc (Incremental_inputs_header_data,
8110 Incremental_inputs_entry_data): Move to incremental.h
8111 * incremental.h: (Incremental_inputs_header_data,
8112 Incremental_inputs_entry_data): Move from incremental.cc
8113
8114 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8115
8116 * incremental.cc (Incremental_inputs_header,
8117 Incremental_inputs_header_write, Incremental_inputs_entry,
8118 Incremental_inputs_entry_write): Add a typedef with the data type.
8119
8120 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8121
8122 * incremental.cc (Incremental_inputs_header,
8123 Incremental_inputs_header_write, Incremental_inputs_entry,
8124 Incremental_inputs_entry_write): Update comment about which
8125 type has the filed descriptions.
8126
8127 2009-11-15 Doug Kwan <dougkwan@google.com>
8128
8129 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8130 (Arm_relocate_functions::arm_branch_common): Change method defintion
8131 in class definition to a method declaration and update list of formal
8132 parameters.
8133 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8134 Arm_relocation_functions::jump24): Adjust call to
8135 Arm_relocate_functions::arm_branch_common. Update list of formal
8136 parameters.
8137 (Arm_relocate_functions::xpc25): New method definition.
8138 (Arm_relocate_functions::arm_branch_common): Move method defintion
8139 out from class definition. Use stubs for mode-switching and extending
8140 branch ranges.
8141 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8142 specially. Change code to enable use of stubs in ARM branches.
8143
8144 2009-11-10 Doug Kwan <dougkwan@google.com>
8145
8146 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8147 in method declaration.
8148 (Target_arm::relocate_stub): New method declaration.
8149 (Target_arm::default_target): Change to return a pointer instead of
8150 a const reference.
8151 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8152 Target_arm::default_target.
8153 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8154 method definition.
8155 (Target_arm::relocate_section): Adjust view.
8156 (Target_arm::relocate_stub): New method definition.
8157
8158 2009-11-10 Doug Kwan <dougkwan@google.com>
8159
8160 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8161 a format warning.
8162 * incremental.cc (open_incremental_binary): Initialized local
8163 variables to avoid warnings.
8164 * object.cc (make_elf_object): Ditto.
8165 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8166 a format warning.
8167
8168 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8169
8170 PR gold/10930
8171 * testsuite/plugin_test.c: Include "config.h".
8172
8173 2009-11-09 Doug Kwan <dougkwan@google.com>
8174
8175 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8176 (arm_symbol_value): Remove.
8177 (Arm_relocate_functions::arm_branch_common,
8178 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8179 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8180 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8181 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8182 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8183 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8184 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8185 Arm_relocate_functions::thm_mobw_abs_nc,
8186 Arm_relocate_functions::thm_mov_abs,
8187 Arm_relocate_functions::movw_prel_nc,
8188 Arm_relocate_functions::thm_movt_abs,
8189 Arm_relocate_functions::movt_prel,
8190 Arm_relocate_functions::thm_movw_prel_nc,
8191 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8192 (Target_arm::Relocate::relocate): Only decompose address into two
8193 parts if relocation type uses the thumb-bit and pass the actual
8194 bit instead of a flag indicating that the thumb-bit is used. Adjust
8195 calls to methods in Arm_relocate_functions for this change.
8196
8197 2009-11-08 Ian Lance Taylor <iant@google.com>
8198
8199 PR 10925
8200 * reloc.cc: Instantiate
8201 Sized_relobj::initialize_input_to_output_maps and
8202 Sized_relobj:free_input_to_output_maps.
8203
8204 2009-11-06 Ian Lance Taylor <iant@google.com>
8205
8206 PR 10876
8207 * defstd.cc (in_segment): Set only_if_ref true for "end".
8208
8209 2009-11-06 Doug Kwan <dougkwan@google.com>
8210
8211 * arm.cc (class Reloc_stub): Correct a comment.
8212 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8213 (Target_arm::scan_section_for_stubs): New method declaration.
8214 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8215 Change methods from private to protected.
8216 (Target_arm::do_may_relax): New method definition.
8217 (Target_arm::do_relax, Target_arm::group_sections,
8218 Target_arm::scan_reloc_for_stub,
8219 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8220 (Target_arm::arm_input_section_map_): New data member declaration.
8221 (Target_arm::scan_reloc_for_stub,
8222 Target_arm::scan_reloc_section_for_stubs,
8223 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8224 Target_arm::do_relax): New method definitions.
8225
8226 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8227
8228 * configure.ac: Check for (struct stat)::st_mtim
8229 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8230 * config.in: Regenerate.
8231 * configure: Regenerate.
8232
8233 2009-11-05 Ian Lance Taylor <iant@google.com>
8234
8235 PR 10910
8236 * output.cc (Output_segment::add_output_section): Add missing
8237 return statement.
8238
8239 2009-11-04 Ian Lance Taylor <iant@google.com>
8240
8241 PR 10880
8242 * object.h (class Object): Add is_needed and set_is_needed
8243 methods. Add is_needed_ field. Make bool fields into bitfields.
8244 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8245 defined in a dynamic object and referenced by a regular object,
8246 set is_needed for the dynamic object.
8247 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8248 if the file is marked with as_needed and it is not needed.
8249
8250 2009-11-04 Ian Lance Taylor <iant@google.com>
8251
8252 PR 10887
8253 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8254 tags if data is discarded by linker script.
8255 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8256 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8257 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8258 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8259
8260 2009-11-04 Ian Lance Taylor <iant@google.com>
8261
8262 * layout.cc (Layout::get_output_section): Add is_interp and
8263 is_dynamic_linker_section parameters. Change all callers.
8264 (Layout::choose_output_section): Likewise.
8265 (Layout::make_output_section): Likewise.
8266 (Layout::add_output_section_data): Add is_dynamic_linker_section
8267 parameter. Change all callers.
8268 * layout.h (class Layout): Update declarations.
8269 * output.h (class Output_section): Add is_interp, set_is_interp,
8270 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8271 Add is_interp_, is_dynamic_linker_section_ fields. Change
8272 generate_code_fills_at_write_ to a bitfield.
8273 * output.cc (Output_section::Output_sections): Initialize new
8274 fields.
8275 (Output_segment::add_output_section): Add do_sort parameter.
8276 Change all callers.
8277
8278 2009-11-03 Ian Lance Taylor <iant@google.com>
8279
8280 PR 10860
8281 * options.h (class General_options): Add --warn-common.
8282 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8283 merging two common symbols.
8284 (Symbol_table::should_override): Handle --warn-common when merging
8285 a common symbol with a defined symbol. Use report_resolve_problem
8286 for multiple definitions.
8287 (Symbol_table::report_resolve_problem): New function.
8288 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8289
8290 2009-11-03 Doug Kwan <dougkwan@google.com>
8291
8292 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8293 stub_factory_.
8294 (Target_arm::stub_factory): New method definition.
8295 (Target_arm::new_arm_input_section,
8296 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8297 Target_arm::reloc_uses_thumb_bit): New method declarations.
8298 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8299 New type definitions.
8300 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8301 member declarations.
8302 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8303 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8304 New method definitions.
8305
8306 2009-11-03 Ian Lance Taylor <iant@google.com>
8307
8308 * options.h (class General_options): Add --warn_constructors.
8309
8310 2009-11-03 Ian Lance Taylor <iant@google.com>
8311
8312 PR 10893
8313 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8314 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8315
8316 2009-11-03 Ian Lance Taylor <iant@google.com>
8317
8318 PR 10895
8319 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8320 --msgid-bugs-address.
8321 (install-pdf): New target.
8322 (install-data_yes): Look up one directory to find mkinstalldirs.
8323
8324 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8325
8326 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8327 tree.
8328
8329 2009-10-30 Doug Kwan <dougkwan@google.com>
8330
8331 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8332
8333 2009-10-30 Doug Kwan <dougkwan@google.com>
8334
8335 * arm.cc (Stub_addend_reader): New struct template definition
8336 and partial specializations.
8337 (Stub_addend_reader::operator()): New method definition for a
8338 partially specialized template.
8339
8340 2009-10-30 Doug Kwan <dougkwan@google.com>
8341
8342 * arm.cc (Arm_relobj::processor_specific_flags): New method
8343 definition.
8344 (Arm_relobj::do_read_symbols): New method declaration.
8345 (Arm_relobj::processor_specific_flags_): New data member declaration.
8346 (Arm_dynobj): New class definition.
8347 (Target_arm::do_finalize_sections): Add input_objects parameter.
8348 (Target_arm::do_adjust_elf_header): New method declaration.
8349 (Target_arm::are_eabi_versions_compatible,
8350 (Target_arm::merge_processor_specific_flags): New method declaration.
8351 (Target_arm::do_make_elf_object): New overloaded method definitions
8352 and declaration.
8353 (Arm_relobj::do_read_symbols): New method definition.
8354 (Arm_dynobj::do_read_symbols): Ditto.
8355 (Target_arm::do_finalize_sections): Add input_objects parameters.
8356 Merge processor-specific flags from all input objects.
8357 (Target_arm::are_eabi_versions_compatible,
8358 Target_arm::merge_processor_specific_flags,
8359 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8360 New method definitions.
8361 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8362 Input_objects pointer type parameter.
8363 * layout.cc (Layout::finalize): Pass input objects to target's.
8364 finalize_sections function.
8365 * output.cc (Output_file_header::do_sized_write): Set ELF file
8366 header's processor-specific flags.
8367 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8368 Input_objects pointer type parameter.
8369 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8370 * target.h (Input_objects): New forward class declaration.
8371 (Target::processor_specific_flags,
8372 Target::are_processor_specific_flags_sect): New method definitions.
8373 (Target::finalize_sections): Add input_objects parameter.
8374 (Target::Target): Initialize processor_specific_flags_ and
8375 are_processor_specific_flags_set_.
8376 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8377 parameter.
8378 (Target::set_processor_specific_flags): New method definition.
8379 (Target::processor_specific_flags_,
8380 Target::are_processor_specific_flags_set_): New data member
8381 declarations.
8382 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8383 Input_objects pointer type parameter.
8384
8385 2009-10-30 Doug Kwan <dougkwan@google.com>
8386
8387 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8388
8389 2009-10-28 Ian Lance Taylor <iant@google.com>
8390
8391 * object.h (class Relobj): Drop options parameter from
8392 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8393 do_scan_relocs, do_relocate. Change all callers.
8394 (class Sized_relobj): Drop options parameters from
8395 do_gc_process_relocs, do_scan_relocs, do_relocate,
8396 do_relocate_sections, relocate_sections, emit_relocs_scan,
8397 emit_relocs_scan_reltype. Change all callers.
8398 (struct Relocate_info): Remove options field and all references to
8399 it.
8400 * reloc.h (class Read_relocs): Remove options constructor
8401 parameter and options_ field. Change all callers.
8402 (class Gc_process_relocs, class Scan_relocs): Likewise.
8403 (class Relocate_task): Likewise.
8404 * target-reloc.h (scan_relocs): Remove options parameter. Change
8405 all callers.
8406 (scan_relocatable_relocs): Likewise.
8407 * target.h (class Sized_target): Remove options parameter from
8408 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8409 all callers.
8410 * gc.h (gc_process_relocs): Remove options parameter. Change all
8411 callers.
8412 * arm.cc: Update functions to remove options parameters.
8413 * i386.cc: Likewise.
8414 * powerpc.cc: Likewise.
8415 * sparc.cc: Likewise.
8416 * x86_64.cc: Likewise.
8417 * testsuite/testfile.cc: Likewise.
8418
8419 2009-10-28 Doug Kwan <dougkwan@google.com>
8420
8421 * arm.cc (Arm_relobj): New class definition.
8422 (Arm_relobj::scan_sections_for_stubs,
8423 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8424 New method definitions.
8425
8426 2009-10-28 Cary Coutant <ccoutant@google.com>
8427
8428 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8429 (Plugin::cleanup_done_): New member.
8430 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8431 (Plugin_manager::cleanup_done_): Remove.
8432 (Plugin_manager::add_input_file): Edit error message.
8433 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8434 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8435
8436 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8437
8438 * fileread.cc: (File_read::View::~View): Use the new
8439 data_ownership_ filed.
8440 (File_read::~File_read): Dispose the new whole_file_view_.
8441 (File_read::open): Mmap the whole file if needed.
8442 (File_read::open): Use whole_file_view_ instead of contents_.
8443 (File_read::find_view): Use whole_file_view_ if applicable.
8444 (File_read::do_read): Use whole_file_view_ instead of contents_.
8445 (File_read::make_view): Use whole_file_view_ instead of contents_,
8446 update File_read::View::View call.
8447 (File_read::find_or_make_view): Update File_read::View::View
8448 call.
8449 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8450 remove contents_
8451 (File_read::View::Data_ownership): New enum.
8452 (File_read::View::View): Replace bool mapped_ with Data_ownership
8453 argument.
8454 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8455 (File_read::View::data_ownership_): New field.
8456 (File_read::contents_): Remove (replaced by whole_file_view_).
8457 (File_read::whole_file_view_): New field.
8458 * options.h (class General_options): Add --keep-files-mapped.
8459
8460 2009-10-27 Cary Coutant <ccoutant@google.com>
8461
8462 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8463 * testsuite/Makefile.am (plugin_test_5): New test case.
8464 * testsuite/Makefile.in: Regenerate.
8465
8466 2009-10-25 Doug Kwan <dougkwan@google.com>
8467
8468 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8469 from private to protected to allow access by child class.
8470 (Sized_relobj::do_relocate_sections): New method declaration.
8471 (Sized_relobj::relocate_sections): Virtualize.
8472 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8473 Sized_relobj::relocate_sections. Instantiate template explicitly
8474 for different target sizes and endianity.
8475
8476 2009-10-24 Doug Kwan <dougkwan@google.com>
8477
8478 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8479 (Arm_input_section::as_arm_input_section): New method.
8480 (Arm_output_section): New class definition.
8481 (Arm_output_section::create_stub_group,
8482 Arm_output_section::group_sections): New method definitions.
8483
8484 2009-10-22 Doug Kwan <dougkwan@google.com>
8485
8486 * arm.cc (Arm_input_section): New class definition.
8487 (Arm_input_section::init, Arm_input_section:do_write,
8488 Arm_input_section::set_final_data_size,
8489 Arm_input_section::do_reset_address_and_file_offset): New method
8490 definitions.
8491
8492 2009-10-21 Doug Kwan <dougkwan@google.com>
8493
8494 * arm.cc (Stub_table, Arm_input_section): New forward class
8495 declarations.
8496 (Stub_table): New class defintion.
8497 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8498 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8499 New method definition.
8500
8501 2009-10-21 Doug Kwan <dougkwan@google.com>
8502
8503 * arm.cc: Update copyright comments.
8504 (Target_arm): New forward class template declaration.
8505 (Arm_address): New type.
8506 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8507 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8508 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8509 constants.
8510 (Insn_template): Same.
8511 (DEF_STUBS): New macro.
8512 (Stub_type): New enum type.
8513 (Stub_template): New class definition.
8514 (Stub): Same.
8515 (Reloc_stub): Same.
8516 (Stub_factory): Same.
8517 (Target_arm::Target_arm): Initialize may_use_blx_ and
8518 should_force_pic_veneer_.
8519 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8520 Target_arm::should_force_pic_veneer,
8521 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8522 Target_arm::using_thumb_only, Target_arm:;default_target): New
8523 method defintions.
8524 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8525 New data member declarations.
8526 (Insn_template::size, Insn_template::alignment): New method defintions.
8527 (Stub_template::Stub_template): New method definition.
8528 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8529 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8530 (Stub_factory::Stub_factory): New method definition.
8531 * gold.h (string_hash): New template.
8532 * output.h (Input_section_specifier::hash_value): Use
8533 gold::string_hash.
8534 (Input_section_specifier::string_hash): Remove.
8535 * stringpool.cc (Stringpool_template::string_hash): Use
8536 gold::string_hash.
8537
8538 2009-10-20 Doug Kwan <dougkwan@google.com>
8539
8540 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8541 symbols of relaxed input sections.
8542 * output.h (Output_section::find_relaxed_input_section): Make
8543 method public.
8544
8545 2009-10-16 Doug Kwan <dougkwan@google.com>
8546
8547 * dynobj.cc (Versions::Versions): Initialize version_script_.
8548 Only insert base version symbol definition for a shared object
8549 if version script defines any version versions.
8550 (Versions::define_base_version): New method definition.
8551 (Versions::add_def): Check that base version is not needed.
8552 (Versions::add_need): Define base version lazily.
8553 * dynobj.h (Versions::define_base_version): New method declaration.
8554 (Versions::needs_base_version_): New data member declaration.
8555 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8556 (check_DATA): Add no_version_test.stdout.
8557 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8558 New make rules.
8559 * testsuite/Makefile.in: Regenerate.
8560 * testsuite/no_version_test.c: New file.
8561 * testsuite/no_version_test.sh: Ditto.
8562
8563 2009-10-16 Doug Kwan <dougkwan@google.com>
8564
8565 * expression.cc (class Segment_start_expression): New class definition.
8566 (Segment_start_expression::value): New method definition.
8567 (script_exp_function_segment_start): Return a new
8568 Segment_start_expression.
8569 * gold/script-c.h (script_saw_segment_start_expression): New function
8570 prototype.
8571 * script-sections.cc (Script_sections::Script_sections): Initialize
8572 SAW_SEGMENT_START_EXPRESSION_ to false.
8573 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8574 and -Tbbs options to specify section addresses if given in
8575 command line and no SEGMENT_START expression is seen in a script.
8576 * script-sections.h (Script_sections::saw_segment_start_expression,
8577 Script_sections::set_saw_segment_start_expression): New method
8578 definition.
8579 (Script_sections::saw_segment_start_expression_): New data member
8580 declaration.
8581 * script.cc (script_saw_segment_start_expression): New function.
8582 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8583 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8584 script_test_7.sh and script_test_8.sh.
8585 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8586 script_test_8.stdout.
8587 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8588 (script_test_6, script_test_6.stdout, script_test_7,
8589 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8590 * Makefile.in: Regenerate.
8591 * testsuite/script_test_6.sh: New file.
8592 * testsuite/script_test_6.t: Same.
8593 * testsuite/script_test_7.sh: Same.
8594 * testsuite/script_test_7.t: Same.
8595 * testsuite/script_test_8.sh: Same.
8596
8597 2009-10-16 Doug Kwan <dougkwan@google.com>
8598
8599 * output.cc (Output_segment::set_section_list_address): Cast
8600 expressions to unsigned long long type to avoid format warnings.
8601
8602 2009-10-15 Ian Lance Taylor <iant@google.com>
8603
8604 * script.cc (Script_options::add_symbol_assignment): Always add a
8605 dot assignment to script_sections_.
8606 * script-sections.cc (Script_sections::add_dot_assignment):
8607 Initialize if necessary.
8608
8609 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8610 program headers with no load segment if there is a linker script.
8611
8612 * layout.cc (Layout::set_segment_offsets): Align the file offset
8613 to the segment aligment for -N or -n with no load segment.
8614 * output.cc (Output_segment::add_output_section): Don't crash if
8615 the first section is a TLS section.
8616 (Output_segment::set_section_list_addresses): Print an error
8617 message if the address moves backward in a linker script.
8618 * script-sections.cc
8619 (Output_section_element_input::set_section_addresses): Don't
8620 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8621 (Orphan_output_section::set_section_addresses): Likewise.
8622
8623 2009-10-15 Doug Kwan <dougkwan@google.com>
8624
8625 * layout.cc (Layout::finish_dynamic_section): Generate tags
8626 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8627 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8628 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8629
8630 2009-10-14 Ian Lance Taylor <iant@google.com>
8631
8632 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8633 fields.
8634 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8635 data_shdr fields of relinfo.
8636 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8637 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8638 R_386_TLS_LDO_32, adjust based on section flags.
8639 (Target_i386::Relocate::fix_up_ldo): Remove.
8640
8641 2009-10-13 Ian Lance Taylor <iant@google.com>
8642
8643 Add support for -pie.
8644 * options.h (class General_options): Add -pie and
8645 --pic-executable.
8646 (General_options::output_is_position_independent): Test -pie.
8647 (General_options::output_is_executable): Return true if not shared
8648 and not relocatable.
8649 (General_options::output_is_pie): Remove.
8650 * options.cc (General_options::finalize): Reject incompatible uses
8651 of -pie.
8652 * gold.cc (queue_middle_tasks): A -pie link is not static.
8653 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8654 * symtab.cc (Symbol::final_value_is_known): Return false if
8655 output_is_position_independent.
8656 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8657 output_is_position_independent.
8658 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8659 output_is_position_independent.
8660 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8661 output_is_position_independent.
8662 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8663 two_file_pie_test.
8664 (basic_pie_test.o, basic_pie_test): New targets.
8665 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8666 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8667 (two_file_pie_test): New target.
8668 * testsuite/Makefile.in: Rebuild.
8669 * README: Remove note saying that -pie is not supported.
8670
8671 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8672
8673 * options.h (class General_options): Add -init and -fini.
8674 * layout.cc (Layout::finish_dynamic_section): Emit
8675 given init and fini functions.
8676
8677 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8678
8679 * gc.h (gc_process_relocs): Check if icf is enabled using new
8680 function.
8681 * gold.cc (queue_initial_tasks): Likewise.
8682 (queue_middle_tasks): Likewise.
8683 * object.cc (do_layout): Likewise.
8684 * symtab.cc (is_section_folded): Likewise.
8685 * main.cc (main): Likewise.
8686 * reloc.cc (Read_relocs::run): Likewise.
8687 (Sized_relobj::do_scan_relocs): Likewise.
8688 * icf.cc (is_function_ctor_or_dtor): New function.
8689 (Icf::find_identical_sections): Check if function is ctor or dtor when
8690 safe icf is chosen.
8691 * options.h (General_options::icf): Change option to be an enum.
8692 (Icf_status): New enum.
8693 (icf_enabled): New method.
8694 (icf_safe_folding): New method.
8695 (set_icf_status): New method.
8696 (icf_status_): New variable.
8697 * (options.cc) (General_options::finalize): Set icf_status_.
8698 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8699 icf_test and icf_keep_unique_test to use the --icf enum flag.
8700 * testsuite/icf_safe_test.sh: New file.
8701 * testsuite/icf_safe_test.cc: New file.
8702
8703 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8704
8705 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8706 includes to gc.h and icf.h.
8707 * arm.cc: Include gc.h.
8708 * gold.cc: Likewise.
8709 * i386.cc: Likewise.
8710 * powerpc.cc: Likewise.
8711 * sparc.cc: Likewise.
8712 * x86_64.cc: Likewise.
8713 * gc.h: Include icf.h.
8714
8715 2009-10-11 Ian Lance Taylor <iant@google.com>
8716
8717 * plugin.cc: Include "gold.h" before other header files.
8718
8719 2009-10-10 Chris Demetriou <cgd@google.com>
8720
8721 * options.h (Input_file_argument::Input_file_type): New enum.
8722 (Input_file_argument::is_lib_): Replace with...
8723 (Input_file_argument::type_): New member.
8724 (Input_file_argument::Input_file_argument): Take Input_file_type
8725 'type' rather than boolean 'is_lib' as second argument.
8726 (Input_file_argument::is_lib): Use type_.
8727 (Input_file_argument::is_searched_file): New function.
8728 (Input_file_argument::may_need_search): Handle is_searched_file.
8729 * options.cc (General_options::parse_library): Support -l:filename.
8730 (General_options::parse_just_symbols): Update for Input_file_argument
8731 changes.
8732 (Command_line::process): Likewise.
8733 * archive.cc (Archive::get_file_and_offset): Likewise.
8734 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8735 * script.cc (read_script_file, script_add_file): Likewise.
8736 * fileread.cc (Input_file::Input_file): Likewise.
8737 (Input_file::will_search_for): Handle is_searched_file.
8738 (Input_file::open): Likewise.
8739 * readsyms.cc (Read_symbols::get_name): Likewise.
8740 * testsuite/Makefile.am (searched_file_test): New test.
8741 * testsuite/Makefile.in: Regenerate.
8742 * testsuite/searched_file_test.cc: New file.
8743 * testsuite/searched_file_test_lib.cc: New file.
8744
8745 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8746 Ian Lance Taylor <iant@google.com>
8747
8748 * descriptor.cc: Include <cstdio> and "binary-io.h".
8749 (Descriptors::open): Open the files in binary mode always.
8750 * script.cc (Lex::get_token): Treat \r as whitespace.
8751
8752 2009-10-09 Ian Lance Taylor <iant@google.com>
8753
8754 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8755
8756 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8757 Ian Lance Taylor <iant@google.com>
8758
8759 * configure.ac: Check for readv function also.
8760 * fileread.cc (readv): Define if not HAVE_READV.
8761 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8762 does not exist.
8763 * config.in: Regenerate.
8764 * configure: Regenerate.
8765
8766 2009-10-09 Doug Kwan <dougkwan@google.com>
8767
8768 * layout.cc (Layout::make_output_section): Call target hook to make
8769 ordinary output section.
8770 (Layout::finalize): Adjust parameter list of call the
8771 Target::may_relax().
8772 * layout.h (class Layout::section_list): New method.
8773 * merge.h (Output_merge_base::entsize): Change visibility to public.
8774 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8775 New methods.
8776 (Output_merge_string::do_is_string): New method.
8777 * object.cc (Sized_relobj::do_setup): renamed from
8778 Sized_relobj::set_up.
8779 * object.h (Sized_relobj::adjust_shndx,
8780 Sized_relobj::initializ_input_to_output_maps,
8781 Sized_relobj::free_input_to_output_maps): Change visibilities to
8782 protected.
8783 (Sized_relobj::setup): Virtualize.
8784 (Sized_relobj::do_setup): New method declaration.
8785 (Sized_relobj::invalidate_section_offset,
8786 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8787 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8788 * options.cc (parse_int): New function.
8789 * options.h (parse_int): New declaration.
8790 (DEFINE_int): New macro.
8791 (stub_group_size): New option.
8792 * output.cc (Output_section::Output_section): Initialize memebers
8793 merge_section_map_, merge_section_by_properties_map_,
8794 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8795 (Output_section::add_input_section): Handled deferred code-fill
8796 generation and remove an old comment.
8797 (Output_section::add_relaxed_input_section): New method definition.
8798 (Output_section::add_merge_input_section): Use merge section by
8799 properties map to speed to search. Update merge section maps
8800 as appropriate.
8801 (Output_section::build_relaxation_map): New method definition.
8802 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8803 Same.
8804 (Output_section::relax_input_section): Renamed to
8805 Output_section::convert_input_sections_to_relaxed_sections and change
8806 interface to take a vector of pointers to relaxed sections.
8807 (Output_section::find_merge_section,
8808 Output_section::find_relaxed_input_section): New method definitions.
8809 (Output_section::is_input_address_mapped,
8810 Output_section::output_offset, Output_section::output_address):
8811 Use output section data maps to speed up searching.
8812 (Output_section::find_starting_output_address): Add comments.
8813 (Output_section::do_write,
8814 Output_section::write_to_postprocessing_buffer): Do code-fill
8815 generation as appropriate.
8816 (Output_section::get_input_sections): Invalidate relaxed input section
8817 map.
8818 (Output_section::restore_states): Adjust type of checkpoint .
8819 Invalidate relaxed input section map.
8820 * output.h (Output_merge_base): New class declaration.
8821 (Input_section_specifier): New class defintion.
8822 (class Output_relaxed_input_section) Change base class to
8823 Output_section_data_build.
8824 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8825 base class initializer.
8826 (Output_section::add_relaxed_input_section): New method declaration.
8827 (Output_section::Input_section): Change visibility to protected.
8828 (Output_section::Input_section::relobj,
8829 Output_section::Input_section::shndx): Handle relaxed input sections.
8830 Output_section::input_sections) Change visibility to protected. Also
8831 define overload to return a non-const pointer.
8832 (Output_section::Merge_section_properties): New class defintion.
8833 (Output_section::Merge_section_by_properties_map,
8834 Output_section::Output_section_data_by_input_section_map,
8835 Output_section::Relaxation_map): New types.
8836 (Output_section::relax_input_section): Rename method to
8837 Output_section::convert_input_sections_to_relaxed_sections and change
8838 interface to take a vector of relaxed section pointers.
8839 (Output_section::find_merge_section,
8840 Output_section::find_relaxed_input_section,
8841 Output_section::build_relaxation_map,
8842 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8843 New method declarations.
8844 (Output_section::merge_section_map_
8845 Output_section::merge_section_by_properties_map_,
8846 Output_section::relaxed_input_section_map_,
8847 Output_section::is_relaxed_input_section_map_valid_,
8848 Output_section::generate_code_fills_at_write_): New data members.
8849 * script-sections.cc
8850 (Output_section_element_input::set_section_addresses): Call
8851 current_data_size and addralign methods of relaxed input sections.
8852 (Orphan_output_section::set_section_addresses): Call current_data_size
8853 and addralign methods of relaxed input sections.
8854 * symtab.cc (Symbol_table::compute_final_value): Extract template
8855 from the body of Symbol_table::sized_finalize_symbol.
8856 (Symbol_table::sized_finalized_symbol): Call
8857 Symbol_table::compute_final_value.
8858 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8859 (Symbol_table::compute_final_value): New templated method declaration.
8860 * target.cc (Target::do_make_output_section): New method defintion.
8861 * target.h (Target::make_output_section): New method declaration.
8862 (Target::relax): Add more parameters for input objects, symbol table
8863 and layout. Adjust call to do_relax.
8864 (Target::do_make_output_section): New method declaration.
8865 (Target::do_relax): Add parameters for input objects, symbol table
8866 and layout.
8867
8868 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8869
8870 * pread.c: Include stdio.h.
8871
8872 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8873
8874 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8875 defined.
8876
8877 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8878
8879 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8880 Change read_shndx type to unsigned int.
8881 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8882 int.
8883 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8884 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8885 Change read_shndx type to unsigned int.
8886 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8887 int.
8888 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8889 * layout.cc (Layout::create_symtab_sections): Cast the result of
8890 local_symcount * symsize to off_t in the gold_assert.
8891
8892 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8893
8894 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8895 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8896 R_ARM_BASE_ABS.
8897 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8898 (Arm_relocate_functions::thm_abs5): New function.
8899 (Arm_relocate_functions::abs12): New function.
8900 (Arm_relocate_functions::abs16): New function.
8901 (Arm_relocate_functions::base_abs): New function.
8902 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8903 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8904 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8905 R_ARM_BASE_ABS.
8906 (Scan::global): Likewise.
8907 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8908 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8909 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8910 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8911 R_ARM_BASE_ABS.
8912
8913 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8914
8915 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8916 (Arm_relocate_functions::movt_prel): New function.
8917 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8918 (Arm_relocate_functions::thm_movt_prel): New function.
8919 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8920 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8921 (Scan::global, Relocate::relocate): Likewise.
8922 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8923
8924 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8925
8926 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8927 Incremental_checker.
8928 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8929 unsigned int.
8930 (class Incremental_inputs_header): New class.
8931 (Incremental_inputs_header_writer): Edit comment.
8932 (Incremental_inputs_entry): New class.
8933 (Incremental_inputs_entry_writer): Edit comment.
8934 (Sized_incremental_binary::do_find_incremental_inputs_section):
8935 Add *strtab_shndx parameter, fill it.
8936 (Sized_incremental_binary::do_check_inputs): New method.
8937 (Incremental_checker::can_incrementally_link_output_file): Use
8938 Sized_incremental_binary::check_inputs.
8939 (Incremental_inputs::report_command_line): Save command line in
8940 command_line_.
8941 * incremental.h:
8942 (Incremental_binary::find_incremental_inputs_section): New
8943 method.
8944 (Incremental_binary::do_find_incremental_inputs_section): Add
8945 strtab_shndx parameter.
8946 (Incremental_binary::do_check_inputs): New pure virtual method.
8947 (Sized_incremental_binary::do_check_inputs): Declare.
8948 (Incremental_checker::Incremental_checker): Add incremental_inputs
8949 parameter, use it to initialize incremental_inputs_.
8950 (Incremental_checker::incremental_inputs_): New field.
8951 (Incremental_checker::command_line): New method.
8952 (Incremental_checker::inputs): New method.
8953 (Incremental_checker::command_line_): New field.
8954
8955 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8956
8957 * incremental.cc: Include <cstdarg> and "target-select.h".
8958 (vexplain_no_incremental): New function.
8959 (explain_no_incremental): New function.
8960 (Incremental_binary::error): New method.
8961 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8962 method.
8963 (make_sized_incremental_binary): New function.
8964 (open_incremental_binary): New function.
8965 (can_incrementally_link_file): Add checks if output is ELF and has
8966 inputs section.
8967 * incremental.h: Include "elfcpp_file.h" and "output.h".
8968 (Incremental_binary): New class.
8969 (Sized_incremental_binary): New class.
8970 (open_incremental_binary): Declare.
8971 * object.cc (is_elf_object): Use
8972 elfcpp::Elf_recognizer::is_elf_file.
8973 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8974 * output.h (Output_file::filesize): New method.
8975
8976 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8977
8978 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8979 New function.
8980 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8981 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8982 function.
8983 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8984 function.
8985 (Arm_relocate_functions::movw_abs_nc): New function.
8986 (Arm_relocate_functions::movt_abs): New function.
8987 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8988 (Arm_relocate_functions::thm_movt_abs): New function.
8989 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8990 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8991 (Scan::global): Likewise.
8992 (Relocate::relocate): Likewise.
8993 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8994
8995 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8996
8997 * arm.cc (Arm_relocate_functions::got_prel) New function.
8998 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8999 (Relocate::relocate): Likewise.
9000 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9001
9002 2009-10-06 Ian Lance Taylor <iant@google.com>
9003
9004 * options.h (class General_options): Define
9005 split_stack_adjust_size parameter.
9006 * object.h (class Object): Add uses_split_stack_ and
9007 has_no_split_stack_ fields. Add uses_split_stack and
9008 has_no_split_stack accessor functions. Declare
9009 handle_split_stack_section.
9010 (class Reloc_symbol_changes): Define.
9011 (class Sized_relobj): Define Function_offsets. Declare
9012 split_stack_adjust, split_stack_adjust_reltype, and
9013 find_functions.
9014 * object.cc (Object::handle_split_stack_section): New function.
9015 (Sized_relobj::do_layout): Call handle_split_stack_section.
9016 * dynobj.cc (Sized_dynobj::do_layout): Call
9017 handle_split_stack_section.
9018 * reloc.cc (Sized_relobj::relocate_sections): Call
9019 split_stack_adjust for executable sections in split_stack
9020 objects. Pass reloc_map to relocate_section.
9021 (Sized_relobj::split_stack_adjust): New function.
9022 (Sized_relobj::split_stack_adjust_reltype): New function.
9023 (Sized_relobj::find_functions): New function.
9024 * target-reloc.h: Include "object.h".
9025 (relocate_section): Add reloc_symbol_changes parameter. Change
9026 all callers.
9027 * target.h (class Target): Add calls_non_split method. Declare
9028 do_calls_non_split virtual method. Declare match_view and
9029 set_view_to_nop.
9030 * target.cc: Include "elfcpp.h".
9031 (Target::do_calls_non_split): New function.
9032 (Target::match_view): New function.
9033 (Target::set_view_to_nop): New function.
9034 * gold.cc (queue_middle_tasks): Give an error if mixing
9035 split-stack and non-split-stack objects with -r.
9036 * i386.cc (Target_i386::relocate_section): Add
9037 reloc_symbol_changes parameter.
9038 (Target_i386::do_calls_non_split): New function.
9039 * x86_64.cc (Target_x86_64::relocate_section): Add
9040 reloc_symbol_changes parameter.
9041 (Target_x86_64::do_calls_non_split): New function.
9042 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9043 parameter.
9044 * powerpc.cc (Target_powerpc::relocate_section): Add
9045 reloc_symbol_changes parameter.
9046 * sparc.cc (Target_sparc::relocate_section): Add
9047 reloc_symbol_changes parameter.
9048 * configure.ac: Call AM_CONDITIONAL for the default target.
9049 * configure: Rebuild.
9050 * testsuite/Makefile.am (TEST_AS): New variable.
9051 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9052 (check_DATA): Add split_i386 and split_x86_64 files.
9053 (SPLIT_DEFSYMS): Define.
9054 (split_i386_[1234n].o): New targets.
9055 (split_i386_[124]): New targets.
9056 (split_i386_[1234r].stdout): New targets.
9057 (split_x86_64_[1234n].o): New targets.
9058 (split_x86_64_[124]): New targets.
9059 (split_x86_64_[1234r].stdout): New targets.
9060 (MOSTLYCLEANFILES): Add new executables.
9061 * testsuite/split_i386.sh: New file.
9062 * testsuite/split_x86_64.sh: New file.
9063 * testsuite/split_i386_1.s: New file.
9064 * testsuite/split_i386_2.s: New file.
9065 * testsuite/split_i386_3.s: New file.
9066 * testsuite/split_i386_4.s: New file.
9067 * testsuite/split_i386_n.s: New file.
9068 * testsuite/split_x86_64_1.s: New file.
9069 * testsuite/split_x86_64_2.s: New file.
9070 * testsuite/split_x86_64_3.s: New file.
9071 * testsuite/split_x86_64_4.s: New file.
9072 * testsuite/split_x86_64_n.s: New file.
9073 * testsuite/testfile.cc (Target_test): Update relocation_section
9074 function.
9075 * testsuite/Makefile.in: Rebuild.
9076
9077 2009-10-06 Ian Lance Taylor <iant@google.com>
9078
9079 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9080 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9081 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9082 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9083 the address on ldo_addrs_.
9084 (Target_i386::Relocate::fix_up_ldo): New function.
9085
9086 2009-10-06 Rafael Espindola <espindola@google.com>
9087
9088 * plugin.cc (add_input_library): New.
9089 (Plugin::load): Add add_input_library to tv.
9090 (Plugin_manager::add_input_file): Add the is_lib argument.
9091 (add_input_file): Update call to Plugin_manager::add_input_file.
9092 (add_input_library): New.
9093 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9094
9095 2009-09-30 Doug Kwan <dougkwan@google.com>
9096
9097 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9098 symbol and call Symbol::may_need_copy_reloc to determine if
9099 a copy reloc is needed.
9100 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9101 nocopyreloc is given in command line.
9102 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9103 given in command line.
9104 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9105 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9106 of the removed Target_i386::may_need_copy_reloc.
9107 * options.h (copyreloc): New option with default value false.
9108 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9109 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9110 instead of the removed Target_powerpc::may_need_copy_reloc.
9111 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9112 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9113 instead of the removed Target_sparc::may_need_copy_reloc.
9114 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9115 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9116 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9117 instead of the removed Target_x86_64::may_need_copy_reloc.
9118
9119 2009-09-30 Ian Lance Taylor <iant@google.com>
9120
9121 * object.h (class Object): Remove target_ field, and target,
9122 sized_target, and set_target methods.
9123 (Object::sized_target): Remove.
9124 (class Sized_relobj): Update declarations. Remove sized_target.
9125 * object.cc (Sized_relobj::setup): Remove target parameter.
9126 Change all callers.
9127 (Input_objects::add_object): Don't do anything with the target.
9128 (make_elf_sized_object): Add punconfigured parameter. Change all
9129 callers. Set or test parameter target.
9130 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9131 Change all callers.
9132 * parameters.cc (Parameters::set_target): Change parameter type to
9133 be non-const.
9134 (Parameters::default_target): Remove.
9135 (set_parameters_target): Change parameter type to be non-const.
9136 (parameters_force_valid_target): New function.
9137 (parameters_clear_target): New function.
9138 * parameters.h (class Parameters): Update declarations. Remove
9139 default_target method. Add sized_target and clear_target
9140 methods. Change target_ to be non-const.
9141 (set_parameters_target): Update declaration.
9142 (parameters_force_valid_target): Declare.
9143 (parameters_clear_target): Declare.
9144 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9145 as NULL if we aren't searching.
9146 (Add_symbols::run): Don't check for compatible target.
9147 * fileread.cc (Input_file::open_binary): Call
9148 parameters_force_valid_target.
9149 * gold.cc (queue_middle_tasks): Likewise.
9150 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9151 set_target on object.
9152 * dynobj.h (class Sized_dynobj): Update declarations.
9153 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9154 make_elf_object returns NULL.
9155 (Archive::include_member): Don't check whether object target is
9156 compatible.
9157 * output.cc (Output_section::add_input_section): Get target from
9158 parameters.
9159 (Output_section::relax_input_section): Likewise.
9160 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9161 parameters.
9162 (Sized_relobj::do_scan_relocs): Likewise.
9163 (Sized_relobj::relocate_sections): Likewise.
9164 * resolve.cc (Symbol_table::resolve): Likewise.
9165 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9166 parameter. Change all callers.
9167 (Symbol_table::add_from_object): Get target from parameters.
9168 (Symbol_table::add_from_relobj): Don't check object target.
9169 (Symbol_table::add_from_dynobj): Likewise.
9170 (Symbol_table::define_special_symbol): Get target from
9171 parameters.
9172 * symtab.h (class Symbol_table): Update declaration.
9173 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9174 parameter. Change all callers. Clear parameter target.
9175 (Binary_test): Test target here.
9176 * testsuite/object_unittest.cc (gold_testsuite): Remove
9177 target_test_pointer parameter. Change all callers.
9178 (Object_test): Test target here.
9179
9180 2009-09-26 Ian Lance Taylor <iant@google.com>
9181
9182 * testsuite/initpri1.c: Don't try to use constructor priorities if
9183 compiling with gcc before 4.3.
9184
9185 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9186
9187 * testsuite/retain_symbols_file_test.sh (check_present): Change
9188 output file name to retain_symbols_file_test.stdout.
9189 (check_absent): Likewise.
9190
9191 2009-09-18 Craig Silverstein <csilvers@google.com>
9192
9193 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9194 * options.cc: Include <cerrno> and <fstream>.
9195 (General_options::finalize): Parse -retain-symbols-file tag.
9196 * options.h: New flag.
9197 (General_options): New method should_retain_symbol, new
9198 variable symbols_to_retain.
9199 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9200 should_retain_symbol map.
9201 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9202 * testsuite/Makefile.in: Regenerate.
9203 * testsuite/retain_symbols_file_test.sh: New file.
9204
9205 2009-09-18 Nick Clifton <nickc@redhat.com>
9206
9207 * po/es.po: Updated Spanish translation.
9208
9209 2009-09-17 Doug Kwan <dougkwan@google.com>
9210
9211 * debug.h (DEBUG_RELAXATION): New constant.
9212 (DEBUG_ALL): Add DEBUG_RELAXATION.
9213 (debug_string_to_enum): Add relaxation debug option.
9214 * layout.cc
9215 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9216 Layout::Relaxation_debug_check::read_sections,
9217 Layout::Relaxation_debug_check::read_sections): New method definitions.
9218 (Layout::Layout): Initialize data members
9219 record_output_section_data_from_scrips_,
9220 script_output_section_data_list_ and relaxation_debug_check_.
9221 (Layout::save_segments, Layout::restore_segments,
9222 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9223 Layout::relaxation_loop_body): New method definitions.
9224 (Layout::finalize): Support relaxation. Move section layout code to
9225 Layout::relaxation_loop_body.
9226 (Layout::set_asection_address_from_script): Move code for orphan
9227 section placement out.
9228 (Layout::place_orphan_sections_in_script): New method definition.
9229 * layout.h (Output_segment_headers, Output_file_header):
9230 New forward class declarations.
9231 (Layout::~Layout): Define.
9232 (Layout::new_output_section_data_from_script): New method definition.
9233 (Layout::place_orphan_sections_in_script): New method declaration.
9234 (Layout::Segment_states): New type declaration.
9235 (Layout::save_segments, Layout::restore_segments,
9236 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9237 Layout::relaxation_loop_body): New method declarations.
9238 (Layout::Output_section_data_list): New type declaration.
9239 (Layout::Relaxation_debug_check): New class definition.
9240 (Layout::record_output_section_data_from_script_,
9241 Layout::script_output_section_data_list_, Layout::segment_states_,
9242 Layout::relaxation_debug_check_): New data members.
9243 * output.cc: (Output_section_headers::do_size): New method definition.
9244 (Output_section_headers::Output_section_headers): Move size
9245 computation to Output_section_headers::do_size.
9246 (Output_segment_headers::do_size): New method definition.
9247 (Output_file_header::Output_file_header): Move size computation to
9248 Output_file_header::do_size and call it.
9249 (Output_file_header::do_size): New method definition.
9250 (Output_data_group::Output_data_group): Adjust call to
9251 Output_section_data.
9252 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9253 (Output_symtab_xindex::do_write): Add array bound check.
9254 (Output_section::Input_section::print_to_mapfile): Handle
9255 RELAXED_INPUT_SECTION_CODE.
9256 (Output_section::Output_section): Initialize data member checkpoint_.
9257 (Output_section::~Output_section): Delete checkpoint object pointed
9258 by checkpoint_.
9259 (Output_section::add_input_section): Always add an Input_section if
9260 relaxing.
9261 (Output_section::add_merge_input_section): Add assert.
9262 (Output_section::relax_input_section): New method definition.
9263 (Output_section::set_final_data_size): Set load address to zero for
9264 an unallocated section.
9265 (Output_section::do_address_and_file_offset_have_reset_values):
9266 New method definition.
9267 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9268 Handle relaxed input section.
9269 (Output_section::sort_attached_input_sections): Checkpoint input
9270 section list lazily.
9271 (Output_section::get_input_sections): Change type of input_sections to
9272 list of Simple_input_section pointers. Checkpoint input section list
9273 lazily. Also handle relaxed input sections.
9274 (Output_section::add_input_section_for_script): Take a reference to
9275 a Simple_input_section object instead of Relobj pointer and section
9276 index as parameter. Handle relaxed input sections.
9277 (Output_section::save_states, Output_section::restore_states): New
9278 method definitions.
9279 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9280 (Output_data::is_data_size_fixed): New method definition.
9281 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9282 if it is fixed.
9283 (Output_data::address_and_file_offset_have_reset_values): New method
9284 definition.
9285 (Output_data::do_address_and_file_offset_have_reset_values): New method
9286 definition.
9287 (Output_data::set_data_size): Check that data size is not fixed.
9288 (Output_data::fix_data_size): New method definition.
9289 (Output_data::is_data_size_fixed_): New data member.
9290 (Output_section_headers::set_final_data_size): New method definition.
9291 (Output_section_headers::do_size): New method declaration.
9292 (Output_segment_headers::set_final_data_size): New method definition.
9293 (Output_segment_headers::do_size): New method declaration.
9294 (Output_file_header::set_final_data_size)::New method definition.
9295 (Output_file_header::do_size)::New method declaration.
9296 (Output_section_data::Output_section_data): Add new parameter
9297 is_data_size_fixed and use it to fix data size.
9298 (Output_data_const::Output_data_const): Adjust call to base class
9299 constructor and fix data size.
9300 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9301 base class constructor and fix data size.
9302 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9303 base class constructor and fix data size.
9304 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9305 class constructor and fix data size.
9306 (Output_data_group::set_final_data_size): New method definition.
9307 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9308 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9309 class constructor and fix data size.
9310 (Output_relaxed_input_section): New class definition.
9311 (Output_section::Simple_input_section): New class definition.
9312 (Output_section::get_input_sections): Adjust parameter list.
9313 (Output_section::add_input_section_for_script): Same.
9314 (Output_section::save_states, Output_section::restore_states,
9315 Output_section::do_address_and_file_offset_have_reset_values,
9316 (Output_section::Input_section::Input_section): Handle
9317 RELAXED_INPUT_SECTION_CODE. Add new overload for
9318 Output_relaxed_input_section.
9319 (Output_section::Input_section::is_input_section,
9320 Output_section::Input_section::set_output_section): Handle relaxed
9321 input section.
9322 (Output_section::Input_section::is_relaxed_input_section,
9323 Output_section::Input_section::output_section_data,
9324 Output_section::Input_section::relaxed_input_section): New method
9325 definitions.
9326 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9327 value.
9328 (Output_section::Input_section::u1_): Update comments.
9329 (Output_section::Input_section::u2_): Add new union member poris.
9330 (Output_section::Checkpoint_output_section): New classs definition.
9331 (Output_section::relax_input_section): New method declaration.
9332 (Output_section::checkpoint_): New data member.
9333 (Output_segment): Update comments.
9334 (Output_segment::Output_segment): Un-privatize copy constructor.
9335 (Output_segment::operator=): Un-privatize.
9336 * script-sections.cc (Output_section_element::Input_section_list):
9337 Change element type to Output_section::Simple_input_section.
9338 (Output_section_element_dot_assignment::set_section_addresses):
9339 Register output section data for relaxation clean up.
9340 (Output_data_exression::Output_data_expression): Adjust call to base
9341 constructor to fix data size.
9342 (Output_section_element_data::set_section_addresses): Register
9343 Output_data_expression object for relaxation clean up.
9344 (struct Input_section_info): Replace Relobj pointer and section index
9345 pair with Output_section::Simple_input_section and Convert struct to a
9346 class.
9347 (Input_section_sorter::operator()): Adjust access to
9348 Input_section_info data member to use accessors.
9349 (Output_section_element_input::set_section_addresses): Use layout
9350 parameter. Adjust code to use Output_section::Simple_input_section
9351 and Input_secction_info classes. Register filler for relaxation
9352 clean up.
9353 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9354 and section index pair with Output_section::Simple_input_section
9355 class. Adjust code accordingly.
9356 (Phdrs_element::release_segment): New method definition.
9357 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9358 segment list.
9359 (Script_sections::release_segments): New method definition.
9360 * gold/script-sections.h (Script_sections::release_segments): New
9361 method declaration.
9362 * gold/target.h (Target::may_relax, Target::relax,
9363 Target::do_may_relax, Target::do_relax): New method definitions.
9364
9365 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9366
9367 * arm.cc (has_signed_unsigned_overflow): New function.
9368 (Arm_relocate_functions::abs8): New function.
9369 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9370 (Target_arm::Scan::global): Likewise.
9371 (Target_arm::relocate::relocate): Likewise.
9372 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9373 Likewise.
9374
9375 2009-09-16 Cary Coutant <ccoutant@google.com>
9376
9377 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9378 * testsuite/Makefile.in: Regenerate.
9379
9380 2009-09-11 Nick Clifton <nickc@redhat.com>
9381
9382 * po/gold.pot: Updated by the Translation project.
9383
9384 2009-09-08 Cary Coutant <ccoutant@google.com>
9385
9386 * output.cc (Output_file::open): Add execute permission to empty file.
9387 * testsuite/Makefile.am (permission_test): New test.
9388 * testsuite/Makefile.in: Regenerate.
9389
9390 2009-09-02 Ian Lance Taylor <iant@google.com>
9391
9392 * output.cc (Output_file::resize): Call map_no_anonymous rather
9393 than map.
9394
9395 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9396
9397 * gold.cc: Include "incremental.h".
9398 (queue_initial_tasks): Call Incremental_checker methods.
9399 * incremental.cc: Include "output.h".
9400 (Incremental_checker::can_incrementally_link_output_file): New
9401 method.
9402 * incremental.h (Incremental_checker): New class.
9403
9404 * output.cc (Output_file::open_for_modification): New method.
9405 (Output_file::map_anonymous): Changed return type to bool. Record
9406 map in base_ field.
9407 (Output_file::map_no_anonymous): New method, broken out of map.
9408 (Output_file::map): Use map_no_anonymous and map_anonymous.
9409 * output.h (class Output_file): Update declarations.
9410
9411 2009-08-24 Cary Coutant <ccoutant@google.com>
9412
9413 * options.h (Command_line::Pre_options): New class.
9414 (Command_line::pre_options): New member.
9415 * options.cc (gold::options::ready_to_register): New variable.
9416 (One_option::register_option): Do nothing if not registering options.
9417 Assert if same short option registered twice.
9418 (General_options::General_options): Turn off option registration when
9419 done constructing.
9420 (Command_line::Pre_options::Pre_options): New constructor.
9421
9422 2009-08-24 Cary Coutant <ccoutant@google.com>
9423
9424 * options.h (General_options::no_keep_memory): Remove incorrect
9425 short option.
9426
9427 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9428
9429 * Makefile.am (am__skiplex, am__skipyacc): New.
9430 * Makefile.in: Regenerate.
9431
9432 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9433
9434 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9435 (INCLUDES): ... this.
9436 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9437 (AM_CPPFLAGS): Renamed from ...
9438 (INCLUDE): ... this.
9439 * Makefile.in, testsuite/Makefile.in: Regenerate.
9440
9441 * Makefile.in: Regenerate.
9442 * aclocal.m4: Likewise.
9443 * config.in: Likewise.
9444 * configure: Likewise.
9445 * testsuite/Makefile.in: Likewise.
9446
9447 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9448 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9449 * Makefile.in: Regenerate.
9450 * testsuite/Makefile.in: Regenerate.
9451
9452 2009-08-19 Cary Coutant <ccoutant@google.com>
9453
9454 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9455 symbols in shared libraries overridden by hidden or internal symbols
9456 in the main program.
9457
9458 2009-08-19 Chris Demetriou <cgd@google.com>
9459
9460 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9461 checking source file names in error messages.
9462
9463 2009-08-18 Doug Kwan <dougkwan@google.com>
9464
9465 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9466 an elcpp::Ehdr as parameter. Adjust call to set_target.
9467 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9468 an elfcpp::Ehdr as parameter.
9469 * object.cc (Object::set_target): Remove the version that looks up
9470 a target and sets it.
9471 (Sized_relobj::setup): Take a Target object instead of
9472 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9473 (make_elf_sized_object): Find target and ask target to
9474 make an ELF object.
9475 * object.h: (Object::set_target): Remove the version that looks up
9476 a target and sets it.
9477 (Sized_relobj::setup): Take a Target object instead of
9478 an elfcpp:Ehdr as parameter.
9479 * target.cc: Include dynobj.h.
9480 (Target::do_make_elf_object_implementation): New.
9481 (Target::do_make_elf_object): New.
9482 * target.h (Target::make_elf_object): New template declaration.
9483 (Target::do_make_elf_object): New method declarations.
9484 (Target::do_make_elf_object_implementation): New template declaration.
9485
9486 2009-08-14 Ian Lance Taylor <iant@google.com>
9487
9488 * gold.h (FUNCTION_NAME): Define.
9489 (gold_unreachable): Use FUNCTION_NAME.
9490
9491 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9492
9493 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9494 symbol in the --keep-unique list is not found.
9495
9496 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9497
9498 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9499 been maked as --keep-unique.
9500 (Icf::unfold_section): New function.
9501 * icf.h (Icf::unfold_section): New function.
9502 * options.h (General_options::keep_unique): New option.
9503 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9504 * testsuite/Makefile.in: Regenerate.
9505 * testsuite/icf_keep_unique_test.sh: New file.
9506 * testsuite/icf_keep_unique_test.cc: New file.
9507
9508 2009-08-12 Cary Coutant <ccoutant@google.com>
9509
9510 PR 10471
9511 * resolve.cc (Symbol_table::resolve): Check for references from
9512 dynamic objects to hidden and internal symbols.
9513 * testsuite/Makefile.am (hidden_test.sh): New test.
9514 * testsuite/Makefile.in: Regenerate.
9515 * testsuite/hidden_test.sh: New script.
9516 * testsuite/hidden_test_1.c: New test source.
9517 * testsuite/hidden_test_main.c: New test source.
9518
9519 2009-08-11 Doug Kwan <dougkwan@google.com>
9520
9521 * arm.cc: Update comments.
9522 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9523 segment to locate the .ARM.exidx section if present.
9524
9525 2009-08-09 Doug Kwan <dougkwan@google.com>
9526
9527 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9528 patch.
9529
9530 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9531 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9532 compiler warnings.
9533
9534 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9535
9536 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9537 valid tls_segment only for non-debug-section relocations.
9538 * testsuite/Makefile.am: Add gc_tls_test.
9539 * testsuite/Makefile.in: Regenerate.
9540 * testsuite/gc_tls_test.cc: New file.
9541 * testsuite/gc_tls_test.sh: New file.
9542
9543 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9544
9545 * icf.cc: New file.
9546 * icf.h: New file.
9547 * Makefile.am (CCFILES): Add icf.cc.
9548 (HFILES): Add icf.h
9549 * Makefile.in: Regenerate.
9550 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9551 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9552 section, symbol and addend information for the relocs.
9553 * gold.cc (queue_middle_tasks): Call identical code folding.
9554 * gold.h: Add defines for multimap.
9555 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9556 to the call of finalize_local_symbols.
9557 * main.cc (main): Create object of class Icf.
9558 * object.cc (Sized_relobj::do_layout): Allow this function to be
9559 called twice during icf.
9560 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9561 to sections marked as identical by icf.
9562 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9563 when available.
9564 (Sized_relobj::do_section_entsize): New function.
9565 * object.h (Object::section_entsize): New function.
9566 (Object::do_section_entsize): New pure virtual function.
9567 (Relobj::finalize_local_symbols): Add new parameter.
9568 (Relobj::do_section_entsize): New function.
9569 * options.h (General_options::icf): New option.
9570 (General_options::icf_iterations): New option.
9571 (General_options::print_icf_sections): New option.
9572 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9573 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9574 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9575 icf.
9576 * symtab.cc (Symbol_table::is_section_folded): New function.
9577 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9578 to sections marked as identical by icf.
9579 * symtab.h (Symbol_table::set_icf): New function.
9580 (Symbol_table::icf): New function.
9581 (Symbol_table::is_section_folded): New function.
9582 (Symbol_table::icf_): New data member.
9583 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9584 * testsuite/Makefile.am: Add commands to build icf_test.
9585 * testsuite/Makefile.in: Regenerate.
9586 * testsuite/icf_test.sh: New file.
9587 * testsuite/icf_test.cc: New file.
9588
9589 2009-07-24 Chris Demetriou <cgd@google.com>
9590
9591 * layout.cc (is_compressible_debug_section): Fix incorrect
9592 comment about compressed section names.
9593
9594 2009-07-20 Ian Lance Taylor <ian@airs.com>
9595
9596 PR 10419
9597 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9598
9599 2009-07-16 Ian Lance Taylor <iant@google.com>
9600
9601 PR 10400
9602 * layout.h: #include <map>.
9603 (class Kept_section): Change from struct to class. Add accessors
9604 and setters. Add section size to Comdat_group mapping. Change
9605 Comdat_group to std::map. Add is_comdat_ field. Add
9606 linkonce_size field in union.
9607 (class Layout): Update declaration of find_or_add_kept_section.
9608 Don't declare find_kept_object.
9609 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9610 parameter. Add object, shndx, is_comdat, and is_group_name
9611 parameters. Change all callers. Adjust for new Kept_section.
9612 (Layout::find_kept_object): Remove.
9613 * object.cc (Sized_relobj::include_section_group): Update use of
9614 Kept_section. Rename secnum to shndx. Only record
9615 Kept_comdat_section if sections are the same size.
9616 (Sized_relobj::include_linkonce_section): Update use of
9617 Kept_section. Only record Kept_comdat_section if sections are the
9618 same size. Set size of linkonce section.
9619 (Sized_relobj::map_to_kept_section): Update call to
9620 get_kept_comdat_section.
9621 * object.h (class Sized_relobj): Rename fields in
9622 Kept_comdat_section to drop trailing underscores; change object
9623 field to Relobj*. Change Kept_comdat_section_table to store
9624 struct rather than pointer.
9625 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9626 Add kept_object and kept_shndx parameters. Change all callers.
9627 (Sized_relobj::get_kept_comdat_section): Change return type to
9628 bool. Add kept_object and kept_shndx parameters. Change all
9629 callers.
9630 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9631 Layout::find_or_add_kept_section.
9632
9633 2009-07-09 Ian Lance Taylor <iant@google.com>
9634
9635 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9636 Reserve space in the hash table.
9637
9638 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9639
9640 * fileread.cc (File_read::get_mtime): New method.
9641 * fileread.h (Timespec): New structure.
9642 (File_read::get_mtime): New method.
9643 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9644 Renamed from timestamp_nsec.
9645 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9646 Elf_Xword.
9647 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9648 timestamp_nsec.
9649 (Incremental_inputs::report_archive): Save mtime; style fix.
9650 (Incremental_inputs::report_obejct): Save mtime; style fix.
9651 (Incremental_inputs::report_script): Save mtime; style fix.
9652 (Incremental_inputs::finalize_inputs): Style fix.
9653 (Incremental_inputs::finalize): Style fix.
9654 (Incremental_inputs::create_input_section_data): Store inputs
9655 mtime.
9656 * incremental.h (Incremental_inputs::report_script): Add mtime
9657 argument.
9658 (Incremental_inputs::Input_info::Input_info): Intialize only one
9659 union member.
9660 (Incremental_inputs::Input_info::archive): Move to nameless
9661 union.
9662 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9663 (Incremental_inputs::Input_info::script): Move to nameless union.
9664 (Incremental_inputs::mtime): New field.
9665 * script.cc (read_input_script): Pass file mtime to
9666 Incremental_input.
9667 * script.h (Script_info::inputs): Style fix.
9668
9669 2009-07-01 Ian Lance Taylor <ian@airs.com>
9670
9671 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9672 instead of 32.
9673
9674 2009-06-24 Ian Lance Taylor <iant@google.com>
9675
9676 PR 10156
9677 * layout.cc (Layout::choose_output_section): If we find an
9678 existing section, update the flags.
9679 (Layout::create_notes): New function, broken out of
9680 Layout::finalize.
9681 (Layout::finalize): Don't create note sections.
9682 (Layout::create_note): Don't crash if linker script discards
9683 section.
9684 (Layout::create_gold_note): Likewise.
9685 (Layout::create_build_id): Likewise. Don't set
9686 after_input_sections on the section.
9687 (Layout::create_executable_stack_info): Remove target parameter.
9688 Change caller.
9689 * layout.h (class Layout): Declare create_notes. Update
9690 declaration of create_executable_stack_info.
9691 * gold.cc (queue_middle_tasks): Call create_notes.
9692 * output.cc (Output_section::update_flags_for_input_section): Move
9693 here from output.h. If SHF_ALLOC flag is newly set, mark address
9694 invalid.
9695 * output.h (Output_data::mark_address_invalid): New function.
9696 (class Output_section): Only declare, not define,
9697 update_flags_for_input_section. Remove set_flags.
9698
9699 2009-06-24 Ian Lance Taylor <iant@google.com>
9700
9701 * script-sections.cc (Output_section_definition::
9702 set_section_addresses): Rename shadowing local load_address to
9703 laddr.
9704
9705 2009-06-24 Ian Lance Taylor <iant@google.com>
9706
9707 PR 10244
9708 * reloc.cc (relocate_sections): Skip empty relocation sections.
9709
9710 2009-06-23 Ian Lance Taylor <iant@google.com>
9711
9712 PR 10156
9713 * layout.cc (Layout::create_note): Use choose_output_section
9714 rather than make_output_section.
9715
9716 2009-06-23 Ian Lance Taylor <iant@google.com>
9717
9718 PR 10237
9719 * options.cc (General_options::parse_V): Set printed_version_.
9720 (General_options::General_options): Initialize printed_version_.
9721 * options.h (class General_options): Add printed_version_ field.
9722 * gold.cc (queue_initial_tasks): If there are no input files,
9723 don't give a fatal error if we printed the version information.
9724 (queue_middle_tasks): If using -r with a shared object, give a
9725 fatal error rather than an ordinary error.
9726
9727 2009-06-23 Ian Lance Taylor <iant@google.com>
9728
9729 PR 10219
9730 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9731 (Layout::make_output_section): Set have_stabstr_section_ if we see
9732 a .stab*str section.
9733 (Layout::finalize): Call link_stabs_sections.
9734 (Layout::link_stabs_sections): New file.
9735 * layout.h (class Layout): Add have_stabstr_section_ field.
9736 Declare link_stabs_sections.
9737
9738 2009-06-23 Doug Kwan <dougkwan@google.com>
9739
9740 * Makefile.am (libgold_a_LIBADD): New.
9741 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9742 * Makefile.in: Regenerate.
9743 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9744 * configure: Regenerate.
9745 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9746 * fileread.cc: Include sys/state.h
9747 * gold.h: Declare memmem and strndup if found missing.
9748 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9749
9750 2009-06-23 Ian Lance Taylor <iant@google.com>
9751
9752 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9753 * configure: Rebuild.
9754
9755 2009-06-23 Ian Lance Taylor <iant@google.com>
9756
9757 PR 10147
9758 * object.cc (Object::section_contents): Don't try to get a view if
9759 the section has length zero.
9760 (Object::handle_gnu_warning_section): If the section is empty, use
9761 the name of the section as the warning.
9762
9763 2009-06-23 Ian Lance Taylor <iant@google.com>
9764
9765 PR 10133
9766 * stringpool.h (class Stringpool_template): Add optimize_ field.
9767 (Stringpool_template::set_optimize): New function.
9768 * stringpool.cc (Stringpool_template::Stringpool_template):
9769 Initialize optimize_ field.
9770 (Stringpool_template::set_string_offsets): Test local optimize
9771 fild rather than parameter.
9772 * layout.cc (Layout::Layout): Call set_optimize on the section
9773 name stringpool.
9774
9775 2009-06-22 Ian Lance Taylor <iant@google.com>
9776
9777 PR 10030
9778 * yyscript.y: Parse TARGET.
9779 * script.cc (script_set_target): New function.
9780 * script-c.h (script_set_target): Declare.
9781 * options.cc (General_options::string_to_object_format): Rename
9782 from string_to_object_format in anonymous namespace. Change
9783 callers.
9784 * options.h (class General_options): Declare
9785 string_to_object_format.
9786
9787 2009-06-22 Ian Lance Taylor <iant@google.com>
9788
9789 * script-sections.cc (Script_sections::create_segments): Don't put
9790 program headers in a PT_LOAD segment if -n or -N.
9791
9792 2009-06-22 Ian Lance Taylor <iant@google.com>
9793
9794 PR 10141
9795 * options.h (class General_options): Add -z lazy and -z now. Sort
9796 -z options into alphabetical order.
9797 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9798
9799 2009-06-21 Ian Lance Taylor <iant@google.com>
9800
9801 * layout.cc (Layout::make_output_section): Call
9802 Target::new_output_section.
9803 (Layout::attach_allocated_section_to_segment): Put large section
9804 sections in a separate load segment with the large segment flag
9805 set.
9806 (Layout::segment_precedes): Sort large data segments after other
9807 load segments.
9808 (align_file_offset): New static function.
9809 (Layout::set_segment_offsets): Use align_file_offset.
9810 * output.h (class Output_section): Add is_small_section_ and
9811 is_large_section_ fields.
9812 (Output_section::is_small_section): New function.
9813 (Output_section::set_is_small_section): New function.
9814 (Output_section::is_large_section): New function.
9815 (Output_section::set_is_large_section): New function.
9816 (Output_section::is_large_data_section): New function.
9817 (class Output_segment): Add is_large_data_segment_ field.
9818 (Output_segment::is_large_data_segment): New function.
9819 (Output_segment::set_is_large_data_segment): New function.
9820 * output.cc (Output_section::Output_section): Initialize new
9821 fields.
9822 (Output_segment::Output_segment): Likewise.
9823 (Output_segment::add_output_section): Add assertion that large
9824 data sections always go in large data segments. Force small data
9825 sections to the end of the list of data sections. Force small BSS
9826 sections to the start of the list of BSS sections. For large BSS
9827 sections to the end of the list of BSS sections.
9828 * symtab.h (class Symbol): Declare is_common_shndx.
9829 (Symbol::is_defined): Check Symbol::is_common_shndx.
9830 (Symbol::is_common): Likewise.
9831 (class Symbol_table): Define enum Commons_section_type. Update
9832 declarations. Add small_commons_ and large_commons_ fields.
9833 * symtab.cc (Symbol::is_common_shndx): New function.
9834 (Symbol_table::Symbol_table): Initialize new fields.
9835 (Symbol_table::add_from_object): Put small and large common
9836 symbols in the right list.
9837 (Symbol_table::sized_finalized_symbol): Check
9838 Symbol::is_common_shndx.
9839 (Symbol_table::sized_write_globals): Likewise.
9840 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9841 common symbol lists. Don't call do_allocate_commons_list if the
9842 list is empty.
9843 (Symbol_table::do_allocate_commons_list): Remove is_tls
9844 parameter. Add comons_section_type parameter. Change all
9845 callers. Handle small and large common symbols.
9846 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9847 Symbol::is_common_shndx.
9848 * resolve.cc (symbol_to_bits): Likewise.
9849 * target.h (Target::small_common_shndx): New function.
9850 (Target::small_common_section_flags): New function.
9851 (Target::large_common_shndx): New function.
9852 (Target::large_common_section_flags): New function.
9853 (Target::new_output_section): New function.
9854 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9855 small_common_section_flags, and large_common_section_flags
9856 fields.
9857 (Target::do_new_output_section): New virtual function.
9858 * arm.cc (Target_arm::arm_info): Initialize new fields.
9859 * i386.cc (Target_i386::i386_info): Likewise.
9860 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9861 Likewise.
9862 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9863 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9864 (Target_x86_64::do_new_output_section): New function.
9865 * configure.ac: Define conditional MCMODEL_MEDIUM.
9866 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9867 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9868 (large_LDFLAGS): Define.
9869 * testsuite/large.c: New file.
9870 * testsuite/testfile.cc (Target_test::test_target_info):
9871 Initialize new fields.
9872 * configure, testsuite/Makefile.in: Rebuild.
9873
9874 2009-06-05 Doug Kwan <dougkwan@google.com>
9875
9876 * Makefile.am (CCFILES): Add target.cc.
9877 * Makefile.in: Regenerate.
9878 * i386.cc (class Target_i386): Define new virtual method to
9879 override do_is_local_label_name in parent.
9880 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9881 local symbols if --discard-locals or -X is given.
9882 * options.h (class General_options): Declare new options
9883 '--discard-locals' and '-X' for discarding locals.
9884 * target.h (class Target): Define new methods is_local_label_name.
9885 Declare new virtual method do_is_local_label_name.
9886 * target.cc: New file.
9887 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9888 (check_SCRIPTS): Add discard_locals_test.sh.
9889 (check_DATA): Add discard_local_tests.syms.
9890 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9891 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9892 * testsuite/Makefile.in: Regenerate.
9893 * testsuite/discard_locals_test.c: New file.
9894 * testsuite/discard_locals_test.sh: Same.
9895
9896 2009-06-05 Doug Kwan <dougkwan@google.com>
9897
9898 * object.cc (Sized_relobj::Sized_relobj): Initialize
9899 discarded_eh_frame_shndx_ to -1U.
9900 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9901 section.
9902 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9903 a discarded .eh_frame section.
9904 (Sized_relobj::do_finalize_local_symbols): Ditto.
9905 * object.h (class Sized_relobj): Declare new member
9906 discarded_eh_frame_shndx_.
9907 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9908 (local_labels_test.o, local_labels_test): New rules.
9909 * testsuite/Makefile.in: Regenerate.
9910
9911 2009-06-04 Doug Kwan <dougkwan@google.com>
9912
9913 * layout.cc (Layout::section_name_mapping): Add mapping for
9914 special ARM sections.
9915
9916 2009-06-03 Doug Kwan <dougkwan@google.com>
9917
9918 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9919 (utils::has_overflow): Same.
9920
9921 2009-06-03 Ian Lance Taylor <iant@google.com>
9922
9923 * layout.cc (Layout::section_name_mapping): New array, replacing
9924 Layout::linkonce_mapping.
9925 (Layout::section_name_mapping_count): New variable, replacing
9926 Layout::linkonce_mapping_count.
9927 (Layout::linkonce_output_name): Remove.
9928 (Layout::output_section_name): Rewrite.
9929 * layout.h (class Layout): Rename Linkonce_mapping to
9930 Section_name_mapping, linkonce_mapping to section_name_mapping,
9931 linkonce_mapping_count to section_name_mapping_count. Don't
9932 declare linkonce_output_name.
9933
9934 2009-06-03 Doug Kwan <dougkwan@google.com>
9935
9936 * gold/arm.cc (namespace utils): New.
9937 (Target_arm::reloc_is_non_pic): Define new method.
9938 (class Arm_relocate_functions): New.
9939 (Target_arm::Relocate::relocate): Handle relocation types used by
9940 Android.
9941
9942 2009-06-03 Ian Lance Taylor <iant@google.com>
9943
9944 * arm.cc (Target_arm::scan::global): Use || instead of |.
9945
9946 2009-06-02 Doug Kwan <dougkwan@google.com>
9947
9948 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9949 issued_non_pic_error_.
9950 (class Target_arm::Scan): Declare new method check_non_pic.
9951 Define new method symbol_needs_plt_entry.
9952 Declare new data member issued_non_pic_error_.
9953 (class Target_arm::Relocate): Declare new method
9954 should_apply_static_reloc.
9955 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9956 (Target_arm::Scan::check_non_pic): Define new method.
9957 (Target_arm::Scan::local): Handle a small subset of reloc types used
9958 by Android.
9959 (Target_arm::Scan::local): Same.
9960 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9961
9962 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9963
9964 * incremental.cc (Incremental_inputs::report_command_line): Filter
9965 out --incremental-* options.
9966
9967 2009-05-29 Doug Kwan <dougkwan@google.com>
9968
9969 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9970 template class.
9971 (class Target_arm): Update comment.
9972 (Target_arm::Target_arm): Initialize new data members GOT_,
9973 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9974 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9975 and Target_arm::rel_dyn_section.
9976 Declare new_enum Target_arm::Got_type.
9977 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9978 and DYNBSS_.
9979 Update commments for member do_dynsym_value.
9980 (Target_arm::got_size, Target_arm::plt_section,
9981 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9982 new methods inside class defintion.
9983 (Target_arm::got_section): Define new method.
9984 (Target_arm::rel_dyn_section): Same.
9985 (Output_data_plt_arm): New template class.
9986 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9987 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9988 (Output_data_plt_arm::add_entry): Same.
9989 (Output_data_plt_arm::first_plt_entry): Define new
9990 static data member for PLT instruction template.
9991 (Output_data_plt_arm::plt_entry): Same.
9992 (Output_data_plt_arm::do_write): Define new method.
9993 (Target_arm::make_plt_entry): Same.
9994 (Target_arm::do_finalize_sections): Same.
9995 (Target_arm::do_dynsym_value): Same.
9996
9997 2009-05-28 Doug Kwan <dougkwan@google.com>
9998
9999 * Makefile.am (TARGETSOURCES): Add arm.cc.
10000 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10001 * Makefile.in: Regenerate.
10002 * arm.cc: New file.
10003 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10004
10005 2009-05-26 Doug Kwan <dougkwan@google.com>
10006
10007 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10008 (General_options::check_excluded_libs): Strip off directories in
10009 archive name before matching like GNU ld does.
10010 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10011 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10012 (exclude_libs_test_LDFLAGS): Add linker option
10013 -Wl,--exclude-libs,libexclude_libs_test_3
10014 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10015 an explicit archive without using -l.
10016 (alt/libexclude_libs_test_3.a): New make rule.
10017 * testsuite/Makefile.in: Regenerate.
10018 * testsuite/exclude_libs_test.c : Declare lib3_default().
10019 (main): Call it.
10020 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10021 * exclude_libs_test_3.c: New file.
10022
10023 2009-05-26 Nick Clifton <nickc@redhat.com>
10024
10025 * po/id.po: New Indonesian translation.
10026 * po/gold.pot: Updated template file.
10027
10028 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10029
10030 * testsuite/Makefile.am: Add -ffunction-sections to compile
10031 gc_comdat_test files. Add -Wl,--gc-sections to build
10032 gc_comdat_test.
10033 * testsuite/Makefile.in: Regenerate.
10034 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10035
10036 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10037
10038 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10039 kept comdat section was garbage collected.
10040 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10041 * testsuite/Makefile.in: Regenerate.
10042 * testsuite/gc_comdat_test.sh: New file.
10043 * testsuite/gc_comdat_test_1.cc: New file.
10044 * testsuite/gc_comdat_test_2.cc: New file.
10045
10046 2009-05-19 Doug Kwan <dougkwan@google.com>
10047
10048 * archive.cc (Archive::Archive): Move constructor from archive.h
10049 to here. Initialize no_export_.
10050 (Archive::get_elf_object_for_member): Set no_export flag of object.
10051 * archive.h (Archive::Archive): Move constructor body to
10052 archive.cc.
10053 (Archive::no_export): New method.
10054 (Archive::no_export_): New field.
10055 * object.h (Object::Object): Initialize no_export_ to false.
10056 (Object::no_export, Object::set_no_export): New methods.
10057 (Object::no_export_): New field.
10058 * options.cc (General_options::parse_exclude_libs): New method.
10059 (General_options::check_excluded_libs) Same.
10060 * options.h (exclude_libs): New option.
10061 (General_options::check_excluded_libs): New method declaration.
10062 (General_options::excluded_libs_): New field.
10063 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10064 default or protected visibility if an object has no-export flag set.
10065 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10066 (check_SCRIPTS): Add exclude_libs_test.sh.
10067 (check_DATA): Add exclude_libs_test.syms.
10068 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10069 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10070 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10071 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10072 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10073 libexclude_libs_test_2.a): New rules.
10074 * testsuite/Makefile.in: Regenerate.
10075 * testsuite/exclude_libs_test.c: New file.
10076 * testsuite/exclude_libs_test.sh: Ditto.
10077 * testsuite/exclude_libs_test_1.c: Ditto.
10078 * testsuite/exclude_libs_test_2.c: Ditto.
10079
10080 2009-05-15 Ian Lance Taylor <iant@google.com>
10081
10082 * configure.ac: Check for declarations for cases where libiberty.h
10083 checks HAVE_DECL_xxx.
10084 * configure, config.in: Rebuild.
10085
10086 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10087
10088 * gold.h (Incremental_argument_list): Remove (invalid) forward
10089 declaration.
10090 * incremental.cc (Incremental_inputs::report_achive): New method.
10091 (Incremental_inputs::report_object): New method.
10092 (Incremental_inputs::report_script): New method.
10093 (Incremental_inputs::finalize_inputs): New method.
10094 (Incremental_inputs::finalize): Call finalize_inputs().
10095 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10096 Create inputs entries.
10097 * incremental.h (Incremental_input_type): New enum.
10098 (Incremental_inputs::Incremental_input): Initialize new fields.
10099 (Incremental_inputs::report_inputs): New method.
10100 (Incremental_inputs::report_achive): New method.
10101 (Incremental_inputs::report_object): New method.
10102 (Incremental_inputs::report_script): New method.
10103 (Incremental_inputs::finalize_inputs): New method.
10104 (Incremental_inputs::Input_info): New struct.
10105 (Incremental_inputs::Input_info_map): New typedef.
10106 (Incremental_inputs::lock_): New field.
10107 (Incremental_inputs::Inputs_): New field.
10108 (Incremental_inputs::Inputs_map): New field.
10109 * main.cc (main): Call Incremental_input::report_inputs.
10110 * options.h (Input_argument_list): Typedef moved from
10111 Input_arguments.
10112 (Input_file_group::Files): Remove, use ::Input_argument_list.
10113 (Input_file_group::Input_argument_list): Remove, use
10114 ::Input_argument_list.
10115 * plugin.cc (Plugin_manager::add_input_file): Add error in
10116 incremental build.
10117 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10118 functions.
10119 * script.cc (read_input_script): Call
10120 Incremental_input::report_script.
10121 * script.h (Script_info): New class.
10122
10123 2009-04-27 Ian Lance Taylor <iant@google.com>
10124
10125 * x86_64.cc (do_adjust_output_section): Set entsize to
10126 plt_entry_size.
10127
10128 2009-04-23 Elliott Hughes <enh@google.com>
10129
10130 * output.cc (Output_file::close): After short writes, continue
10131 writing from the correct offset in the buffer being written.
10132
10133 2009-04-23 Chris Demetriou <cgd@google.com>
10134
10135 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10136 * configure: Regenerate.
10137 * config.in: Regenerate.
10138 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10139 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10140
10141 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10142
10143 * incremental.cc (Incremental_inputs_header_data): Renamed from
10144 Incremental_input_header_data.
10145 (Incremental_inputs_header_data::data_size): New field.
10146 (Incremental_inputs_header_data::put_input_file_count): Renamed
10147 from input_file_count.
10148 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10149 from command_line_offset.
10150 (Incremental_inputs_header_data::put_reserved): Renamed from
10151 put_reserved.
10152 (Incremental_inputs_entry_data): Renamed from
10153 Incremental_input_entry_data.
10154 (Incremental_inputs_entry_data::data_size): New field.
10155 (Incremental_inputs::report_command_line): New method.
10156 (Incremental_inputs::finalize): New method.
10157 (Incremental_inputs::create_incremental_inputs_data): New method.
10158 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10159 * incremental.h: New file.
10160 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10161 (Layout::finalize): Create incremental inputs section in
10162 incremental builds.
10163 (Layout::create_incremental_info_sections): New method.
10164 * layout.h (Layout::incremental_inputs): New method.
10165 (Layout::create_incremental_info_sections): New method.
10166 (Layout::incremental_inputs_): New field.
10167 * main.cc (main): Notify Incremental_input of the command line.
10168
10169 2009-04-01 Ian Lance Taylor <iant@google.com>
10170 Mikolaj Zalewski <mikolajz@google.com>
10171
10172 * gold.h (reserve_unordered_map): Define, three versions, one for
10173 each version of Unordered_map.
10174 * layout.cc (Layout::Layout): Remove options parameter. Add
10175 number_of_input_files parameter. Don't initialize options_.
10176 Initialize number_of_input_files_ and resized_signatures_. Move
10177 sections_are_attached_.
10178 (Layout::layout_group): Reserve space for group_signatures_.
10179 (Layout::find_or_add_kept_section): Change name parameter to be a
10180 reference. Resize signatures_ map when it gets large enough.
10181 (Layout::layout_eh_frame): Use parameters->options() instead of
10182 this->options_.
10183 (Layout::make_output_section): Likewise.
10184 (Layout::attach_allocated_section_to_segment): Likewise.
10185 (Layout::finalize, Layout::create_executable_stack): Likewise.
10186 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10187 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10188 * layout.h (class Layout): Update declarations. Remove options_
10189 field. Add number_of_input_files_ and resized_signatures_
10190 fields. Move sections_are_attached_ field.
10191 * main.cc (main): Pass number of input files to Layout
10192 constructor. Don't pass options.
10193
10194 2009-03-30 Ian Lance Taylor <iant@google.com>
10195
10196 * ffsll.c (ffsll): Correct implementation.
10197
10198 2009-03-27 Ian Lance Taylor <iant@google.com>
10199
10200 * ffsll.c: New file.
10201 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10202 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10203 * ftruncate.c (ftruncate): Declare before definition.
10204 * mremap.c (mremap): Likewise.
10205 * pread.c (pread): Likewise.
10206 * configure, Makefile.in, config.in: Rebuild.
10207
10208 * mremap.c: New file.
10209 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10210 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10211 (mremap): Declare if HAVE_MREMAP is not defined.
10212 * configure, Makefile.in, config.in: Rebuild.
10213
10214 2009-03-27 Cary Coutant <ccoutant@google.com>
10215
10216 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10217 position independent.
10218 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10219 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10220
10221 2009-03-24 Cary Coutant <ccoutant@google.com>
10222
10223 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10224 an executable.
10225 (needs_dynamic_reloc): Likewise.
10226
10227 2009-03-24 Ian Lance Taylor <iant@google.com>
10228
10229 * yyscript.y (file_cmd): Recognize EXTERN.
10230 (extern_name_list, extern_name_list_body): New nonterminals.
10231 * script.cc (script_add_extern): Define.
10232 * script-c.h (script_add_extern): Declare.
10233
10234 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10235
10236 * object.cc (is_elf_object): Define.
10237 * object.h (is_elf_object): Declare.
10238 * archive.cc (Archive::get_elf_object_for_member): Call
10239 is_elf_object.
10240 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10241
10242 2009-03-24 Elliott Hughes <enh@google.com>
10243
10244 * output.cc (Output_file::map_anonymous): Define.
10245 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10246 try an anonymous one. Report the size if the mmap fails.
10247 * output.h (class Output_file): Declare map_anonymous.
10248
10249 2009-03-24 Ian Lance Taylor <iant@google.com>
10250
10251 * target-select.cc (instantiate_target): Don't acquire the lock if
10252 the instantiated_target_ field has already been set.
10253
10254 2009-03-23 Ian Lance Taylor <iant@google.com>
10255
10256 * gold-threads.h (class Initialize_lock): Define.
10257 * gold-threads.cc (class Initialize_lock_once): Define.
10258 (initialize_lock_control): New static variable.
10259 (initialize_lock_pointer): New static variable.
10260 (initialize_lock_once): New static function.
10261 (Initialize_lock::Initialize_lock): Define.
10262 (Initialize_lock::initialize): Define.
10263 * target-select.h: Include "gold-threads.h".
10264 (class Target_selector): Add lock_ and initialize_lock_ fields.
10265 Don't define instantiate_target, just declare it.
10266 * target-select.cc (Target_selector::Target_selector): Initialize
10267 new fields.
10268 (Target_selector::instantiate_target): Define.
10269 * descriptors.h: Include "gold-threads.h".
10270 (class Descriptors): Add initialize_lock_ field.
10271 * descriptors.cc (Descriptors::Descriptors): Initialize new
10272 field.
10273 (Descriptors::open): Use initialize_lock_ field
10274 * errors.h (class Errors): Add initialize_lock_ field.
10275 * errors.cc (Errors::Errors): Initialize new field.
10276 (Errors::initialize_lock): Use initialize_lock_ field.
10277 * powerpc.cc (class Target_selector_powerpc): Remove
10278 instantiated_target_ field. In do_recognize call
10279 instantiate_target rather than do_instantiate_target. In
10280 do_instantiate_target just allocate a new target.
10281 * sparc.cc (class Target_selector_sparc): Likewise.
10282
10283 * freebsd.h: New file.
10284 * i386.cc: Include "freebsd.h".
10285 (Target_i386): Derive from Target_freebsd rather than
10286 Sized_target.
10287 (Target_selector_i386): Derive from Target_selector_freebsd rather
10288 than Target_selector.
10289 * x86_64.cc: Include "freebsd.h".
10290 (Target_x86_64): Derive from Target_freebsd rather than
10291 Sized_target.
10292 (Target_selector_x86_64): Derive from Target_selector_freebsd
10293 rather than Target_selector.
10294 * target.h (class Target): Add adjust_elf_header and
10295 do_adjust_elf_header.
10296 * output.cc (Output_file_header:: do_sized_write): Call target
10297 adjust_elf_header routine.
10298 * configure.tgt: Set targ_osabi.
10299 * configure.ac: Define GOLD_DEFAULT_OSABI.
10300 * parameters.cc (Parameters::default_target): Pass
10301 GOLD_DEFAULT_OSABI to select_target.
10302 * target-select.h (class Target_selector): Make instantiate_target
10303 protected rather than private.
10304 * Makefile.am (HFILES): Add freebsd.h.
10305 * configure, Makefile.in, config.in: Rebuild.
10306
10307 * merge.cc (do_add_input_section): Correct pend value. Change
10308 message about last entry not being null terminated from error to
10309 warning.
10310
10311 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10312
10313 * incremental.cc: New file.
10314 * Makefile.am (CCFILES): Add incremental.cc.
10315 * Makefile.in: Rebuild.
10316
10317 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10318
10319 * layout.cc (Layout::output_section_name): Preserve names
10320 of '.note.' sections.
10321
10322 2009-03-19 Ian Lance Taylor <iant@google.com>
10323
10324 * descriptors.cc (Descriptors::open): Check that the options are
10325 valid before using them.
10326
10327 2009-03-18 Ian Lance Taylor <iant@google.com>
10328
10329 * script-sections.h: Include <list>.
10330 (class Script_sections): Change Sections_elements from std::vector
10331 to std::list. Typedef public Elements_iterator. Add
10332 orphan_section_placement_, data_segment_align_start_, and
10333 saw_data_segment_align_ fields. Remove data_segment_align_index_
10334 field.
10335 * script-sections.cc (class Orphan_section_placement): New class.
10336 (class Sections_element): Add virtual functions is_relro and
10337 orphan_section_init. Remove virtual function place_orphan_here.
10338 (class Output_section_definition): Add is_relro and
10339 orphan_section_init. Remove place_orphan_here.
10340 (class Orphan_output_section): Likewise.
10341 (Script_sections::Script_sections): Update for field changes.
10342 (Script_sections::data_segment_align): Set saw_data_segment_align_
10343 and data_segment_align_start_, not data_segment_align_index.
10344 (Script_sections::data_segment_relro_end): Check
10345 saw_data_segment_align_. Use data_segment_align_start_ rather
10346 than data_segment_align_index_.
10347 (Script_sections::place_orphan): Rewrite to use
10348 Orphan_section_placement.
10349
10350 2009-03-17 Ian Lance Taylor <iant@google.com>
10351
10352 * archive.cc (Archive::add_symbols): Check for a version attached
10353 to the symbol name in the archive map.
10354 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10355 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10356 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10357 (ver_test_11.a): New target.
10358 * testsuite/Makefile.in: Rebuild.
10359
10360 * configure.ac: Check for chsize and posix_fallocate. Replace
10361 ftruncate.
10362 * ftruncate.c: New file, from gnulib.
10363 * output.cc (posix_fallocate): Define dummy version if not
10364 HAVE_POSIX_FALLOCATE.
10365 (Output_file::map): Call posix_fallocate rather than lseek and
10366 write.
10367 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10368 * configure, Makefile.in, config.in: Rebuild.
10369
10370 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10371
10372 * layout.h (Layout::create_note): Add section_name parameter.
10373 * layout.cc (Layout::create_note): Likewise.
10374 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10375
10376 2009-03-17 Ian Lance Taylor <iant@google.com>
10377
10378 * descriptors.cc: Include "options.h".
10379 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10380 (Descriptors::open): Always use O_CLOEXEC when opening a new
10381 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10382 then set FD_CLOEXEC.
10383
10384 * sparc.cc (class Target_sparc): Add has_got_section.
10385 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10386 make sure we have a GOT section.
10387
10388 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10389 (Target_sparc::Scan::local): Likewise.
10390 (Target_sparc::Scan::global): Likewise.
10391 (Target_sparc::Relocate::relocate): Likewise.
10392 (Target_sparc::Relocate::relocate_tls): Likewise.
10393
10394 * symtab.cc (Symbol_table::define_default_version): New function,
10395 broken out of add_from_object.
10396 (Symbol_table::add_from_object): Call define_default_version.
10397 (Symbol_table::define_special_symbol): Add resolve_oldsym
10398 parameter. Change all callers. If the version for a symbol comes
10399 from a version script, resolve it with the symbol with the same
10400 name with no version. Also add the symbol without a version if
10401 appropriate.
10402 (do_define_in_output_data): If resolving with oldsym, don't delete
10403 sym.
10404 (do_define_in_output_segment): Likewise.
10405 (do_define_as_constant): Likewise.
10406 * symtab.h (class Symbol_table): Update declarations.
10407
10408 2009-03-13 Ian Lance Taylor <iant@google.com>
10409
10410 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10411 (Read_symbols::requeue): New function.
10412 (Read_symbols::do_read_symbols): If make_elf_object fails because
10413 the target type is not configured, and the file was searched for,
10414 issue a warning and retry with the next directory.
10415 (Add_symbols::run): If the file has an incompatible format, and
10416 it was searched for, requeue the Read_symbols task. On error,
10417 release the object.
10418 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10419 dirindex parameter to constructor. Change all callers. Declare
10420 incompatible_warning and requeue.
10421 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10422 input_argument_ and input_group_ fields. Add them to
10423 constructor. Change all callers.
10424 (class Read_script): Add dirindex_ field. Add it to constructor.
10425 Change all callers.
10426 * archive.cc (Archive::setup): Remove input_objects parameter.
10427 Change all callers.
10428 (Archive::get_file_and_offset): Likewise.
10429 (Archive::read_all_symbols): Likewise.
10430 (Archive::read_symbols): Likewise.
10431 (Archive::get_elf_object_for_member): Remove input_objects
10432 parameter. Add punconfigured parameter. Change all callers.
10433 (Archive::add_symbols): Change return type to bool. Check return
10434 value of include_member.
10435 (Archive::include_all_members): Likewise.
10436 (Archive::include_member): Change return type to bool. Return
10437 false if first included object has incompatible target. Set
10438 included_member_ field.
10439 (Add_archive_symbols::run): If add_symbols returns false, requeue
10440 Read_symbols task.
10441 * archive.h (class Archive): Add included_member_ field.
10442 Initialize it in constructor. Add input_file and searched_for
10443 methods. Update declarations.
10444 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10445 input_argument_ fields. Add them to constructor. Change all
10446 callers.
10447 * script.cc: Include "target-select.h".
10448 (class Parser_closure): Add skip_on_incompatible_target_ and
10449 found_incompatible_target_ fields. Add
10450 skip_on_incompatible_target parameter to constructor. Change all
10451 callers. Add methods skip_on_incompatible_target,
10452 clear_skip_on_incompatible_target, found_incompatible_target, and
10453 set_found_incompatible_target.
10454 (read_input_script): Add dirindex parameter. Change all callers.
10455 If parser finds an incompatible target, requeue Read_symbols
10456 task.
10457 (script_set_symbol): Clear skip_on_incompatible_target in
10458 closure.
10459 (script_add_assertion, script_parse_option): Likewise.
10460 (script_start_sections, script_add_phdr): Likewise.
10461 (script_check_output_format): New function.
10462 * script.h (read_input_script): Update declaration.
10463 * script-c.h (script_check_output_format): Declare.
10464 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10465 (ignore_cmd): Remove OUTPUT_FORMAT.
10466 * fileread.cc (Input_file::Input_file): Add explicit this.
10467 (Input_file::will_search_for): New function.
10468 (Input_file::open): Add pindex parameter. Change all callers.
10469 * fileread.h (class Input_file): Add input_file_argument method.
10470 Declare will_search_for. Update declarations.
10471 * object.cc (make_elf_object): Add punconfigured parameter.
10472 Change all callers.
10473 * object.h (class Object): Make input_file public. Add
10474 searched_for method.
10475 (make_elf_object): Update declaration.
10476 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10477 restart search.
10478 * dirsearch.h (class Dirsearch): Update declaration.
10479 * options.h (class General_options): Add --warn-search-mismatch.
10480 * parameters.cc (Parameters::is_compatible_target): New function.
10481 * parameters.h (class Parameters): Declare is_compatible_target.
10482 * workqueue.cc (Workqueue::add_blocker): New function.
10483 * workqueue.h (class Workqueue): Declare add_blocker.
10484
10485 * fileread.cc (Input_file::open): Remove options parameter.
10486 Change all callers.
10487 (Input_file::open_binary): Likewise.
10488 * script.cc (read_input_script): Likewise.
10489 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10490 options parameter from constructor. Change all callers.
10491 (class Read_script): Likewise.
10492 * fileread.h (class Input_file): Update declarations.
10493 * script.h (read_input_script): Update declaration.
10494
10495 2009-03-10 Nick Clifton <nickc@redhat.com>
10496
10497 * po/es.po: New Spanish translation.
10498
10499 2009-03-06 Cary Coutant <ccoutant@google.com>
10500
10501 * options.cc (parse_short_option): Keep dash_z from registering itself.
10502
10503 2009-03-03 Ian Lance Taylor <iant@google.com>
10504
10505 PR 9918
10506 * target-reloc.h (relocate_section): Pass output_section to
10507 relocate.
10508 * i386.cc (Target_i386::should_apply_static_reloc): Add
10509 output_section parameter. Change all callers.
10510 (Target_i386::Relocate::relocate): Add output_section parameter.
10511 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10512 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10513 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10514 * testsuite/two_file_shared.sh: New script.
10515 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10516 (check_DATA): Add two_file_shared.dbg.
10517 (two_file_shared.dbg): New target.
10518 * testsuite/Makefile.in: Rebuild.
10519
10520 2009-03-01 Ian Lance Taylor <iant@google.com>
10521
10522 * configure.ac: Check for byteswap.h.
10523 * configure: Rebuild.
10524 * config.in: Rebuild.
10525
10526 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10527
10528 * layout.cc (Layout::find_or_add_kept_section): New function.
10529 (Layout::add_comdat): Removed.
10530 * layout.h (struct Kept_section): Move out of class Layout.
10531 Remove trailing underscores from field names. Add group_sections
10532 field. Rename group_ field to is_group. Change all uses.
10533 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10534 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10535 comdat_groups_ field.
10536 (Sized_relobj::include_section_group): Use
10537 find_or_add_kept_section and Kept_section::group_sections.
10538 (Sized_relobj::include_linkonce_section): Likewise.
10539 * object.cc (class Sized_relobj): Don't define Comdat_group or
10540 Comdat_group_table. Remove find_comdat_group and
10541 add_comdat_group. Remove comdat_groups_ field.
10542 * plugin.cc (include_comdat_group): Use
10543 Layout::find_or_add_kept_section.
10544
10545 2009-02-28 Ian Lance Taylor <iant@google.com>
10546
10547 * README: --gc-sections and map files are now supported. Document
10548 some build requirements.
10549
10550 PR 6992
10551 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10552 relocatable link set the value of the section symbol to zero.
10553 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10554 relocatable link don't include the section address in the local
10555 symbol value.
10556
10557 2009-02-27 Ian Lance Taylor <iant@google.com>
10558
10559 PR 6811
10560 * options.h (class Search_directory): Add is_system_directory.
10561 (class General_options): Declare is_in_system_directory.
10562 * options.cc (get_relative_sysroot): Make static.
10563 (get_default_sysroot): Make static.
10564 (General_optoins::is_in_system_directory): New function.
10565 * fileread.cc (Input_file::is_in_system_directory): New function.
10566 * fileread.h (class Input_file): Declare is_in_system_directory.
10567 * object.h (class Object): Add is_in_system_directory.
10568 (class Input_objects): Remove system_library_directory_ field.
10569 * object.cc (Input_objects::add_object): Don't set
10570 system_library_directory_.
10571 (input_objects::found_in_system_library_directory): Remove.
10572 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10573 parameter. Change all callers.
10574 (Symbol_table::sized_write_globals): Likewise.
10575 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10576 Call Object::is_in_system_directory.
10577 * symtab.h (class Symbol_table): Update declarations.
10578
10579 PR 5990
10580 * descriptors.h (Open_descriptor): Add is_on_stack field.
10581 * descriptors.cc (Descriptors::open): If the descriptor is on the
10582 top of the stack, remove it. Initialize is_on_stack field.
10583 (Descriptors::release): Only add pod to stack if it is not on the
10584 stack already.
10585 (Descriptors::close_some_descriptor): Clear stack_next and
10586 is_on_stack fields.
10587
10588 PR 7091
10589 * output.cc (Output_section::find_starting_output_address): Rename
10590 from starting_output_address; add PADDR parameter; change return
10591 type.
10592 * output.h (class Output_section): Declare
10593 find_starting_output_address instead of starting_output_address.
10594 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10595 section symbol for which we can't find a merge section.
10596
10597 PR 9836
10598 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10599 hidden or internal, force the symbol to be local.
10600 * resolve.cc (Symbol::override_visibility): Define.
10601 (Symbol::override_base): Use override_visibility.
10602 (Symbol_table::resolve): Likewise.
10603 (Symbol::override_base_with_special): Likewise.
10604 (Symbol_table::override_with_special): If the visibility is hidden
10605 or internal, force the symbol to be local.
10606 * symtab.h (class Symbol): Add set_visibility and
10607 override_visibility.
10608 * testsuite/ver_test_1.sh: New file.
10609 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10610 (check_DATA): Add ver_test_1.syms.
10611 (ver_test_1.syms): New target.
10612 * testsuite/Makefile.in: Rebuild.
10613
10614 2009-02-25 Cary Coutant <ccoutant@google.com>
10615
10616 * layout.cc (Layout::choose_output_section): Don't rename sections
10617 when using a linker script that has a SECTIONS clause.
10618 * Makefile.in: Regenerate.
10619
10620 * testsuite/Makefile.am (script_test_5.sh): New test case.
10621 * testsuite/Makefile.in: Regenerate.
10622 * testsuite/script_test_5.cc: New file.
10623 * testsuite/script_test_5.sh: New file.
10624 * testsuite/script_test_5.t: New file.
10625
10626 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10627
10628 * archive.cc (Archive::include_member): Update calls to add_symbols.
10629 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10630 the Layout argument.
10631 * dynobj.h (do_add_symbols): Add the Layout argument.
10632 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10633 Layout argument.
10634 * object.h (Object::add_symbols): Add the Layout argument.
10635 (Object::do_add_symbols): Add the Layout argument.
10636 (Sized_relobj::do_add_symbols): Add the Layout argument.
10637 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10638 Unify the two versions.
10639 (Add_plugin_symbols): Remove.
10640 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10641 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10642 (Add_plugin_symbols): Remove.
10643 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10644 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10645 (Add_symbols::run): Make it work with Pulginobj.
10646
10647 2009-02-06 Ian Lance Taylor <iant@google.com>
10648
10649 * object.cc (Sized_relobj::do_layout): Make info message start
10650 with lower case letter.
10651
10652 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10653
10654 * binary.cc: Fix file comment.
10655
10656 * options.h (enum Incremental_disposition): Define.
10657 (class General_options): Add new options: --incremental,
10658 --incremental_changed, --incremental_unchanged,
10659 --incremental_unknown. Add incremental_disposition_ and
10660 implicit_incremental_ fields.
10661 (General_options::incremental_disposition): New function.
10662 (class Position_dependent_options): Add incremental_disposition
10663 option.
10664 (Position_dependent_options::copy_from_options): Set incremental
10665 dispositions.
10666 * options.cc (General_options::parse_incremental_changed): New
10667 function.
10668 (General_options::parse_incremental_unchanged): New function.
10669 (General_options::parse_incremental_unknown): New function.
10670 (General_options::General_options): Initialize new fields
10671 incremental_disposition_ and implicit_incremental_.
10672 (General_options::finalize): Check for uasge of --incremental-*
10673 without --incremental.
10674
10675 2009-02-06 Chris Demetriou <cgd@google.com>
10676
10677 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10678 pointer and to report location as the file name associated with
10679 the symbol.
10680 (gold_undefined_symbol_at_location): New function to replace the
10681 old gold_undefined_symbol functionality.
10682 * target-reloc.h (relocate_section): Update to use
10683 gold_undefined_symbol_at_location.
10684 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10685 Call gold_undefined_symbol function rather than gold_error.
10686 * errors.h (Errors::undefined_symbol): Take location as a
10687 string, rather than calculating it from a relocation.
10688 * errors.cc (Errors::fatal): Print "fatal error:" before the
10689 formatted message.
10690 (Errors::error, Errors::error_at_location): Print "error: "
10691 before the formatted message.
10692 (Errors::undefined_symbol): Take location as a string, rather
10693 than calculating it from a relocation.
10694 (gold_undefined_symbol_at_location): New function akin to
10695 old gold_undefined_symbol, calculates location from relocation.
10696 (gold_undefined_symbol): Change to take only a Symbol pointer
10697 and to report location as the file name associated with the symbol.
10698 * testsuite/debug_msg.sh: Update for changed error messages.
10699 * testsuite/undef_symbol.sh: Likewise.
10700
10701 2009-02-04 Duncan Sands <baldrick@free.fr>
10702
10703 PR 9812
10704 * reduced_debug_output.h
10705 (Output_reduced_debug_abbrev_section::failed): Use format for
10706 gold_warning.
10707 (Output_reduced_debug_info_section::faild): Likewise.
10708
10709 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10710
10711 * script.cc (Lazy_demangler): New class.
10712 (Version_script_info::get_symbol_version_helper): Demangle a
10713 symbol only once.
10714
10715 2009-01-29 Cary Coutant <ccoutant@google.com>
10716
10717 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10718 to __tls_get_addr.
10719 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10720
10721 2009-01-28 Ian Lance Taylor <iant@google.com>
10722
10723 * version.cc (version_string): Bump to 1.9.
10724
10725 * gold.h: Include <cstring> and <stdint.h>.
10726 * version.cc: Include <cstdio>.
10727 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10728 warning.
10729 * reduced_debug_output.cc (insert_into_vector): Rename from
10730 Insert_into_vector; change all callers. Use Swap_unaligned to
10731 avoid aliasing issue; remove union since it is unnecessary.
10732
10733 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10734
10735 * Makefile.am (CCFILES): Add gc.cc.
10736 (HFILES): Add gc.h.
10737 * Makefile.in: Regenerate.
10738 * gold.cc (Gc_runner): New class.
10739 (queue_initial_tasks): Call garbage collection related tasks
10740 when corresponding options are invoked.
10741 (queue_middle_gc_tasks): New function.
10742 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10743 processed early before laying out sections during garbage collection.
10744 * gold.h (queue_middle_gc_tasks): New function.
10745 (is_prefix_of): Move from "layout.cc".
10746 * i386.cc (Target_i386::gc_process_relocs): New function.
10747 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10748 * main.cc (main): Create object of class "Garbage_collection".
10749 * object.cc (Relobj::copy_symbols_data): New function.
10750 (Relobj::is_section_name_included): New function.
10751 (Sized_relobj::do_layout): Allow this function to be called twice
10752 during garbage collection and defer layout of section during the
10753 first call.
10754 * object.h (Relobj::get_symbols_data): New function.
10755 (Relobj::is_section_name_included): New function.
10756 (Relobj::copy_symbols_data): New function.
10757 (Relobj::set_symbols_data): New function.
10758 (Relobj::get_relocs_data): New function.
10759 (Relobj::set_relocs_data): New function.
10760 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10761 (Relobj::gc_process_relocs): New function.
10762 (Relobj::do_gc_process_relocs): New pure virtual function.
10763 (Relobj::sd_): New data member.
10764 (Sized_relobj::is_output_section_offset_invalid): New function.
10765 (Sized_relobj::do_gc_process_relocs): New function.
10766 * options.h (General_options::gc_sections): Modify to not be a no-op.
10767 (General_options::print_gc_sections): New option.
10768 * plugin.cc (Plugin_finish::run): Remove function call to
10769 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10770 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10771 * reloc.cc (Read_relocs::run): Add task to process relocs and
10772 determine unreferenced sections when doing garbage collection.
10773 (Gc_process_relocs): New class.
10774 (Sized_relobj::do_gc_process_relocs): New function.
10775 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10776 sections that are garbage collected.
10777 * reloc.h (Gc_process_relocs): New class.
10778 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10779 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10780 symbols whose corresponding sections are garbage collected.
10781 (Symbol_table::Symbol_table): Add new parameter for the garbage
10782 collection object.
10783 (Symbol_table::gc_mark_undef_symbols): New function.
10784 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10785 (Symbol_table::gc_mark_dyn_syms): New function.
10786 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10787 as garbage.
10788 (Symbol_table::add_from_object): Likewise.
10789 (Symbol_table::add_from_relobj): When building shared objects, do not
10790 treat externally visible symbols as garbage.
10791 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10792 table information for static and relocatable links.
10793 * symtab.h (Symbol_table::set_gc): New function.
10794 (Symbol_table::gc): New function.
10795 (Symbol_table::gc_mark_undef_symbols): New function.
10796 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10797 (Symbol_table::gc_mark_dyn_syms): New function.
10798 (Symbol_table::gc_): New data member.
10799 * target.h (Sized_target::gc_process_relocs): New pure virtual
10800 function.
10801 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10802 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10803
10804 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10805
10806 * options.h (General_options::gc_sections): Define as a no-op for now.
10807 (General_options::no_keep_memory): Ditto.
10808 (General_options::Bshareable): Define.
10809 * options.cc (General_options::finalize): Honor -Bshareable.
10810
10811 2009-01-20 Andreas Schwab <schwab@suse.de>
10812
10813 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10814 read the value in the contents, since we don't use it. Use the
10815 template endianness when writing.
10816 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10817
10818 2009-01-19 Andreas Schwab <schwab@suse.de>
10819
10820 * configure.tgt (powerpc64-*): Fix targ_obj.
10821
10822 2009-01-15 Ian Lance Taylor <iant@google.com>
10823
10824 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10825 local symbols when stripping all symbols.
10826
10827 2009-01-14 Cary Coutant <ccoutant@google.com>
10828
10829 * output.cc (Output_reloc): Add explicit instantiations.
10830
10831 2009-01-14 Cary Coutant <ccoutant@google.com>
10832
10833 * archive.cc (Archive::get_elf_object_for_member): Remove call
10834 to File_read::claim_for_plugin.
10835 * descriptors.cc (Descriptors::open): Remove reference to
10836 is_claimed.
10837 (Descriptors::claim_for_plugin): Remove.
10838 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10839 (Descriptors::is_claimed): Remove.
10840 (claim_descriptor_for_plugin): Remove.
10841 * fileread.cc (File_read::claim_for_plugin): Remove.
10842 * fileread.h (File_read::claim_for_plugin): Remove.
10843 (File_read::descriptor): Reopen descriptor if necessary.
10844 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10845 (Plugin_manager::all_symbols_read): Add task parameter. Change
10846 all callers.
10847 (Plugin_manager::get_input_file): New function.
10848 (Plugin_manager::release_input_file): New function.
10849 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10850 corresponding data member.
10851 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10852 and pass to base constructor. Change all callers.
10853 (get_input_file, release_input_file): New functions.
10854 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10855 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10856 (Plugin_manager::all_symbols_read): Add task parameter.
10857 (Plugin_manager::get_input_file): New function.
10858 (Plugin_manager::release_input_file): New function.
10859 (Plugin_manager::task_): New data member.
10860 (Pluginobj::Pluginobj): Add filesize parameter.
10861 (Pluginobj::filename): New function.
10862 (Pluginobj::descriptor): New function.
10863 (Pluginobj::filesize): New function.
10864 (Pluginobj::filesize_): New data member.
10865 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10866 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10867 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10868
10869 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10870 with archive libraries.
10871 * testsuite/Makefile.in: Regenerate.
10872 * testsuite/plugin_test.c (struct sym_info): New type.
10873 (get_input_file, release_input_file): New static variables.
10874 (onload): Capture new transfer vector entries.
10875 (claim_file_hook): Stop reading at end of file according to filesize.
10876 Factor out parsing of readelf output into separate function.
10877 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10878 APIs and get the source file name from the symbol table. Convert
10879 source file name to corresponding object file name. Print info
10880 message when adding new input files.
10881 (parse_readelf_line): New function.
10882 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10883 * testsuite/plugin_test_2.sh: Likewise.
10884 * testsuite/plugin_test_3.sh: Likewise.
10885 * testsuite/plugin_test_4.sh: New test case.
10886
10887 2009-01-07 Ian Lance Taylor <iant@google.com>
10888
10889 * version.cc (version_string): Bump to 1.8.
10890
10891 2008-12-23 Cary Coutant <ccoutant@google.com>
10892
10893 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10894 * plugin.cc (Plugin_manager::finish): Rename as
10895 layout_deferred_objects. Move cleanup to separate function.
10896 (Plugin_manager::cleanup): New function.
10897 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10898 separately.
10899 * plugin.h (Plugin_manager::finish): Rename as
10900 layout_deferred_objects.
10901 (Plugin_manager::cleanup): New function.
10902 (Plugin_manager::cleanup_done): New field.
10903
10904 2008-12-23 Cary Coutant <ccoutant@google.com>
10905
10906 * plugin.cc (is_visible_from_outside): New function.
10907 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10908 so we don't return "IR only" status for exported symbols or -r links.
10909
10910 * testsuite/Makefile.am (plugin_test_3): New test case.
10911 * testsuite/Makefile.in: Regenerate.
10912 * testsuite/plugin_test_3.sh: New file.
10913
10914 2008-12-22 Cary Coutant <ccoutant@google.com>
10915
10916 * object.cc (Sized_relobj::layout_section): New function.
10917 (Sized_relobj::do_layout): Defer layout of input sections until after
10918 plugin has provided replacement files.
10919 (Sized_relobj::do_layout_deferred_sections): New function.
10920 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10921 (Relobj::layout_deferred_sections): New function.
10922 (Relobj::do_layout_deferred_sections): New function.
10923 (Sized_relobj::do_layout_deferred_sections): New function.
10924 (Sized_relobj::layout_section): New function.
10925 (Sized_relobj::Deferred_layout): New structure.
10926 (Sized_relobj::deferred_layout_): New field.
10927 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10928 Change all callers. Layout deferred sections.
10929 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10930 references.
10931 (Plugin_hook::run): Move code from do_plugin_hook inline.
10932 (Plugin_hook::do_plugin_hook): Remove.
10933 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10934 (Plugin_manager::finish): Renamed, was cleanup.
10935 (Plugin_manager::should_defer_layout): New function.
10936 (Plugin_manager::add_deferred_layout_object): New function.
10937 (Plugin_manager::Deferred_layout_list): New type.
10938 (Plugin_manager::deferred_layout_objects_): New field.
10939 (Plugin_hook::do_plugin_hook): Remove.
10940
10941 2008-12-17 Ian Lance Taylor <iant@google.com>
10942
10943 * options.h (class General_options): Add --no case for
10944 --export-dynamic.
10945
10946 2008-12-16 Cary Coutant <ccoutant@google.com>
10947
10948 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10949 vector.
10950 (Plugin_manager::claim_file): Create plugin object even if
10951 plugin did not call the add_symbols callback.
10952 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10953 asking for more symbols than were added.
10954 * testsuite/Makefile.am (plugin_test_1): Add test case with
10955 no global symbols.
10956 (empty.syms): New target.
10957 * testsuite/Makefile.in: Regenerate.
10958 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10959 message. Don't call add_symbols if no globals.
10960 (all_symbols_read_hook): Don't provide replacement for empty
10961 claimed file.
10962
10963 2008-12-12 Ian Lance Taylor <iant@google.com>
10964
10965 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10966 r_type == 0 for a local symbol with r_sym == 0.
10967 (scan_relocatable_relocs): Pass r_sym to
10968 local_non_section_strategy.
10969 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10970 r_sym parameter.
10971
10972 * configure.ac: Update test for TLS descriptors: they are
10973 supported as of glibc 2.9.
10974 * configure: Rebuild.
10975
10976 2008-12-11 Ian Lance Taylor <iant@google.com>
10977
10978 PR 7091
10979 * target-reloc.h (Default_scan_relocatable_relocs): For each
10980 function, map r_type == 0 to RELOC_DISCARD.
10981
10982 2008-12-10 Cary Coutant <ccoutant@google.com>
10983
10984 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10985 object to override a kept COMDAT group from a plugin object.
10986
10987 2008-12-09 Ian Lance Taylor <iant@google.com>
10988
10989 PR 7088
10990 * yyscript.y (file_cmd): Handle INPUT.
10991
10992 * testsuite/initpri1.c: Change all declarations to be full
10993 prototypes by adding void, to avoid compiler warnings.
10994
10995 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10996
10997 * options.cc (General_options::parse_plugin_opt): New.
10998 (General_options::add_plugin): The argument now is just the filename.
10999 (General_options::add_plugin_option): New.
11000 * options.h (plugin_opt): New.
11001 (add_plugin): Change argument name.
11002 (add_plugin_option): New.
11003 * plugin.cc (Plugin::load): Don't parse the plugin option.
11004 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11005 (Plugin::add_option): New.
11006 (Plugin::args_): Change type.
11007 (Plugin::filename_): New.
11008 (Plugin_manager::add_plugin_option): New.
11009 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11010 * testsuite/Makefile.in: Regenerate.
11011
11012 2008-12-05 Cary Coutant <ccoutant@google.com>
11013
11014 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11015 Handle --strip-lto-sections option.
11016 * options.h (strip_lto_sections): New option.
11017
11018 2008-12-01 Cary Coutant <ccoutant@google.com>
11019
11020 * plugin.cc (ld_plugin_message): Change format parameter to const.
11021 Fix mismatch between new[] and delete.
11022
11023 2008-11-14 Cary Coutant <ccoutant@google.com>
11024
11025 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11026 instead of -1U.
11027
11028 2008-11-05 Craig Silverstein <csilvers@google.com>
11029
11030 * options.cc (General_options::parse_dynamic_list): New function.
11031 * options.h (General_options): New flags dynamic_list,
11032 dynamic_list_data, dynamic_list_cpp_new, and
11033 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11034 (General_options::in_dynamic_list): New function.
11035 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11036 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11037 (Lex::can_continue_name): Likewise.
11038 (yylex): Likewise.
11039 (read_script_file): New parameter script_options.
11040 (read_dynamic_list): New function.
11041 (Script_options::define_dynamic_list): New function.
11042 (dynamic_list_keyword_parsecodes): New variable.
11043 (dynamic_list_keywords): New variable.
11044 * script.h (Script_options::define_dynamic_list): New function
11045 prototype.
11046 (read_dynamic_list): New function prototype.
11047 * symtab.cc (strprefix): New macro.
11048 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11049 dynamic_list_data, dynamic_list_cpp_new, and
11050 dynamic_list_cpp_typeinfo.
11051 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11052 (dynamic_list_expr): New rule.
11053 (dynamic_list_nodes): Likewise.
11054 (dynamic_list_node): Likewise.
11055 * testsuite/Makefile.am (dynamic_list): New test.
11056 * testsuite/Makefile.in: Regenerated.
11057 * testsuite/dynamic_list.t: New file.
11058 * testsuite/dynamic_list.sh: New file.
11059
11060 2008-11-05 Craig Silverstein <csilvers@google.com>
11061
11062 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11063 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11064 (t11_last): Likewise.
11065 * testsuite/ver_test_6.c (main): Likewise.
11066
11067 2008-10-07 Cary Coutant <ccoutant@google.com>
11068
11069 * options.c (General_options::finalize): Add check for -static and
11070 -shared.
11071 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11072 is not empty.
11073
11074 2008-10-02 Cary Coutant <ccoutant@google.com>
11075
11076 * plugin.cc (make_sized_plugin_object): Fix conditional
11077 compilation to work when not all targets are enabled.
11078
11079 2008-09-29 Cary Coutant <ccoutant@google.com>
11080
11081 * archive.cc (Archive::get_file_and_offset): Use filename instead
11082 of name to get library path.
11083 (Archive::include_member): Unlock external member of a thin archive.
11084
11085 * testsuite/Makefile.am (TEST_AR): New variable.
11086 (thin_archive_test_1): New test.
11087 (thin_archive_test_2): New test.
11088 * testsuite/Makefile.in: Regenerate.
11089 * testsuite/thin_archive_main.cc: New file.
11090 * testsuite/thin_archive_test_1.cc: New file.
11091 * testsuite/thin_archive_test_2.cc: New file.
11092 * testsuite/thin_archive_test_3.cc: New file.
11093 * testsuite/thin_archive_test_4.cc: New file.
11094
11095 2008-09-29 Cary Coutant <ccoutant@google.com>
11096
11097 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11098 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11099 instead of -1U.
11100 (Sized_relobj::do_finalize_local_symbols): Likewise.
11101 (Sized_relobj::map_to_kept_section): Likewise.
11102 * object.h (Sized_relobj::invalid_address): New constant.
11103 (Sized_relobj::do_output_section_offset): Check for invalid_address
11104 and return -1ULL.
11105 * output.cc (Output_reloc::local_section_offset): Use constant
11106 invalid_address instead of -1U.
11107 (Output_reloc::get_address): Likewise.
11108 (Output_section::output_address): Change -1U to -1ULL.
11109 * output.h (Output_reloc::invalid_address): New constant.
11110 * reloc.cc (Sized_relobj::write_sections): Use constant
11111 invalid_address instead of -1U.
11112 (Sized_relobj::relocate_sections): Likewise.
11113 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11114 values for merge sections.
11115 * target-reloc.h (relocate_for_relocatable): Use constant
11116 invalid_address instead of -1U.
11117
11118 2008-09-19 Cary Coutant <ccoutant@google.com>
11119
11120 Add plugin functionality for link-time optimization (LTO).
11121 * configure.ac (plugins): Add --enable-plugins option.
11122 * configure: Regenerate.
11123 * config.in: Regenerate.
11124 * Makefile.am (LIBDL): New variable.
11125 (CCFILES): Add plugin.cc.
11126 (HFILES): Add plugin.h.
11127 (ldadd_var): Add LIBDL.
11128 * Makefile.in: Regenerate.
11129
11130 * archive.cc: Include "plugin.h".
11131 (Archive::setup): Don't preread archive symbols when using a plugin.
11132 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11133 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11134 files.
11135 (Archive::include_member): Add symbols from plugin objects.
11136 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11137 * descriptors.cc (Descriptors::open): Check for file descriptors
11138 abandoned by plugins.
11139 (Descriptors::claim_for_plugin): New function.
11140 * descriptors.h (Descriptors::claim_for_plugin): New function.
11141 (Open_descriptor::is_claimed): New field.
11142 (claim_descriptor_for_plugin): New function.
11143 * fileread.cc (File_read::claim_for_plugin): New function.
11144 * fileread.h (File_read::claim_for_plugin): New function.
11145 (File_read::descriptor): New function.
11146 * gold.cc: Include "plugin.h".
11147 (queue_initial_tasks): Add task to call plugin hooks for generating
11148 new object files.
11149 * main.cc: Include "plugin.h".
11150 (main): Load plugin libraries.
11151 * object.h (Pluginobj): Declare.
11152 (Object::pluginobj): New function.
11153 (Object::do_pluginobj): New function.
11154 (Object::set_target): New function.
11155 * options.cc: Include "plugin.h".
11156 (General_options::parse_plugin): New function.
11157 (General_options::General_options): Initialize plugins_ field.
11158 (General_options::add_plugin): New function.
11159 * options.h (Plugin_manager): Declare.
11160 (General_options): Add --plugin option.
11161 (General_options::has_plugins): New function.
11162 (General_options::plugins): New function.
11163 (General_options::add_plugin): New function.
11164 (General_options::plugins_): New field.
11165 * plugin.cc: New file.
11166 * plugin.h: New file.
11167 * readsyms.cc: Include "plugin.h".
11168 (Read_symbols::do_read_symbols): Check for archive before checking
11169 for ELF file. Call plugin hooks to claim files.
11170 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11171 from a real object file; force override when processing replacement
11172 files.
11173 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11174 (Symbol::init_base_object): Likewise.
11175 (Symbol::init_base_output_data): Likewise.
11176 (Symbol::init_base_output_segment): Likewise.
11177 (Symbol::init_base_constant): Likewise.
11178 (Symbol::init_base_undefined): Likewise.
11179 (Symbol::output_section): Assert that object is not a plugin.
11180 (Symbol_table::add_from_pluginobj): New function.
11181 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11182 undefined.
11183 (Symbol_table::sized_write_globals): Likewise.
11184 (Symbol_table::add_from_pluginobj): Instantiate template.
11185 * symtab.h (Sized_pluginobj): Declare.
11186 (Symbol::in_real_elf): New function.
11187 (Symbol::set_in_real_elf): New function.
11188 (Symbol::in_real_elf_): New field.
11189 (Symbol_table::add_from_pluginobj): New function.
11190
11191 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11192 (LIBDL): New variable.
11193 (LDADD): Add LIBDL.
11194 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11195 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11196 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11197 (MOSTLYCLEANFILES): Likewise.
11198 * testsuite/Makefile.in: Regenerate.
11199 * testsuite/plugin_test.c: New file.
11200 * testsuite/plugin_test_1.sh: New file.
11201 * testsuite/plugin_test_2.sh: New file.
11202
11203 2008-09-16 Ian Lance Taylor <iant@google.com>
11204
11205 * target-reloc.h (relocate_section): Check whether a symbol is
11206 defined by the ABI before reporting an undefined symbol error.
11207 * target.h (Target::is_defined_by_abi): Make parameter const.
11208 (Target::do_is_defined_by_abi): Likewise.
11209 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11210 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11211 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11212 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11213 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11214 * testsuite/Makefile.in: Rebuild.
11215
11216 * fileread.cc (make_view): Add casts to avoid warning.
11217
11218 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11219
11220 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11221 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11222
11223 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11224
11225 * options.h (General_options::output_is_executable): New.
11226 (General_options::output_is_pie): New.
11227 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11228 for shared libraries.
11229 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11230
11231 2008-09-11 Chris Demetriou <cgd@google.com>
11232
11233 * options.h (origin): New -z option.
11234 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11235 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11236 in DT_FLAGS_1.
11237
11238 2008-09-05 Cary Coutant <ccoutant@google.com>
11239
11240 * fileread.cc (File_read::make_view): Add check for attempt to map
11241 beyond end of file.
11242
11243 2008-09-05 Cary Coutant <ccoutant@google.com>
11244
11245 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11246 explicit instantiations.
11247
11248 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11249
11250 PR gold/6858
11251 * options.cc (General_options::finalize): Allow undefined symbols
11252 in shlibs if linking -shared.
11253
11254 PR gold/6859
11255 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11256 symbols as not needing a dynsym entry.
11257
11258 2008-08-20 Craig Silverstein <csilvers@google.com>
11259
11260 * fileread.cc (File_read::open): Do not lock the file unless it
11261 was successfully opened.
11262
11263 2008-08-14 Cary Coutant <ccoutant@google.com>
11264
11265 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11266 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11267 * testsuite/tls_test.cc (struct int128): 128-bit struct
11268 for testing TLS relocs with non-zero addend.
11269 (v12): New TLS variable.
11270 (t12): New test.
11271 (t_last): Add check for v12.
11272 * testsuite/tls_test.h (t12): New function.
11273 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11274
11275 2008-08-13 Ian Lance Taylor <iant@google.com>
11276
11277 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11278 set tls_segment_ or relro_segment_.
11279 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11280 when appropriate.
11281 * output.h (Output_section::clear_is_relro): New function.
11282 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11283 sections specially even when output_data_ is empty.
11284 (Output_segment::maximum_alignment): When first section is relro,
11285 only force alignment for PT_LOAD segments.
11286 * script.cc (script_data_segment_align): New function.
11287 (script_data_segment_relro_end): New function.
11288 * script-c.h (script_data_segment_align): Declare.
11289 (script_data_segment_relro_end): Declare.
11290 * script-sections.h (class Script_sections): Declare
11291 data_segment_align and data_segment_relro_end. Add fields
11292 segment_align_index_ and saw_relro_end_.
11293 * script-sections.cc (class Sections_element): Add set_is_relro
11294 virtual function. Add new bool* parameter to place_orphan_here.
11295 Add get_output_section virtual function.
11296 (class Output_section_definition): Add set_is_relro. Add new
11297 bool* parameter to place_orphan_here. Add get_output_section.
11298 Add is_relro_ field.
11299 (Output_section_definition::Output_section_definition): Initialize
11300 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11301 and is_relro_ fields.
11302 (Output_section_definition::place_orphan_here): Add is_relro
11303 parameter.
11304 (Output_section_definition::set_section_addresses): Set relro for
11305 output section.
11306 (Output_section_definition::alternate_constraint): Likewise.
11307 (class Orphan_output_section): Add new bool* parameter to
11308 place_orphan_here. Add get_output_section.
11309 (Orphan_output_section::place_orphan_here): Add is_relro
11310 parameter.
11311 (Script_sections::Script_sections): Initialize
11312 data_segment_align_index_ and saw_relro_end_.
11313 (Script_sections::data_segment_align): New function.
11314 (Script_sections::data_segment_relro_end): New function.
11315 (Script_sections::place_orphan): Set or clear is_relro.
11316 (Script_sections::set_section_addresses): Force alignment of first
11317 TLS section.
11318 * yyscript.y (exp): Call script_data_segment_align and
11319 script_data_segment_relro_end.
11320 * testsuite/relro_script_test.t: New file.
11321 * testsuite/relro_test.cc (using_script): Declare.
11322 (t1, t2): Test using_script.
11323 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11324 (relro_script_test_SOURCES): Define.
11325 (relro_script_test_DEPENDENCIES): Define.
11326 (relro_script_test_LDFLAGS): Define.
11327 (relro_script_test_LDADD): Define.
11328 (relro_script_test.so): New target.
11329 * testsuite/Makefile.in: Rebuild.
11330
11331 2008-08-06 Cary Coutant <ccoutant@google.com>
11332
11333 * archive.cc (Archive::total_archives, Archive::total_members)
11334 (Archive::total_members_loaded): New variables.
11335 (Archive::setup): Add parameter. Add option to preread
11336 archive symbols.
11337 (Archive::read_armap): Add counter.
11338 (Archive::get_file_and_offset): New function.
11339 (Archive::get_elf_object_for_member): New function.
11340 (Archive::read_all_symbols): New function.
11341 (Archive::read_symbols): New function.
11342 (Archive::add_symbols): Add counters.
11343 (Archive::include_all_members): Use armap to find members if it's
11344 already built.
11345 (Archive::include_member): Skip reading symbols if already read.
11346 Factored code into Archive::get_file_and_offset and
11347 Archive::get_elf_object_for_member. Changed call to
11348 Mapfile::report_include_archive_member.
11349 (Archive::print_stats): New function.
11350 * archive.h: Declare Object and Read_symbols_data classes.
11351 (Archive::Archive): Add initializers for new members.
11352 (Archive::setup): Add parameter.
11353 (Archive::print_stats): New function.
11354 (Archive::total_archives, Archive::total_members)
11355 (Archive::total_members_loaded): New variables.
11356 (Archive::get_file_and_offset): New function.
11357 (Archive::get_elf_object_for_member): New function.
11358 (Archive::read_all_symbols): New function.
11359 (Archive::read_symbols): New function.
11360 (Archive::Archive_member): New class.
11361 (Archive::members_): New member.
11362 (Archive::num_members_): New member.
11363 * main.cc: Include archive.h.
11364 (main): Call Archive::print_stats.
11365 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11366 archive parameter; member_name is now the fully-decorated name.
11367 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11368 * options.h: (General_options): Add --preread-archive-symbols option.
11369 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11370 Archive::setup.
11371
11372 2008-08-04 Ian Lance Taylor <iant@google.com>
11373
11374 * symtab.h (Symbol::use_plt_offset): New function.
11375 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11376 * powerpc.cc (Relocate::relocate): Likewise.
11377 * sparc.cc (Relocate::relocate): Likewise.
11378 * x86_64.cc (Relocate::relocate): Likewise.
11379 * testsuite/weak_plt.sh: New test.
11380 * testsuite/weak_plt_main.cc: New test.
11381 * testsuite/weak_plt_shared.cc: New test.
11382 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11383 (check_PROGRAMS): Add weak_plt.
11384 (check_DATA): Add weak_plt_shared.so.
11385 (weak_plt_main_pic.o, weak_plt): New targets.
11386 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11387 * testsuite/Makefile.in: Rebuild.
11388
11389 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11390 gcctestdir/ld.
11391 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11392 * testsuite/Makefile.in: Rebuild.
11393
11394 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11395
11396 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11397 * Makefile.in: Regenerate.
11398 * po/POTFILES.in: Regenerate.
11399
11400 2008-07-29 Ian Lance Taylor <iant@google.com>
11401
11402 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11403 symbols before other symbols.
11404 * testsuite/script_test_2.cc (test_addr): Declare.
11405 (test_addr_alias): Declare.
11406 (main): Check that test_addr and test_addr_alias have the right
11407 values.
11408 * testsuite/script_test_2.t: Define test_addr_alias and
11409 test_addr.
11410
11411 2008-07-24 Ian Lance Taylor <iant@google.com>
11412
11413 PR 5990
11414 * descriptors.cc: New file.
11415 * descriptors.h: New file.
11416 * gold-threads.h (class Hold_optional_lock): New class.
11417 * fileread.cc: Include "descriptors.h".
11418 (File_read::~File_read): Release descriptor rather than closing
11419 it.
11420 (File_read::open) [file]: Call open_descriptor rather than open.
11421 Set is_descriptor_opened_.
11422 (File_read::open) [memory]: Assert that descriptor is not open.
11423 (File_read::reopen_descriptor): New function.
11424 (File_read::release): Release descriptor.
11425 (File_read::do_read): Make non-const. Reopen descriptor.
11426 (File_read::read): Make non-const.
11427 (File_read::make_view): Reopen descriptor.
11428 (File_read::do_readv): Likewise.
11429 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11430 Update declarations.
11431 * layout.cc: Include "descriptors.h".
11432 (Layout::create_build_id): Use open_descriptor rather than open.
11433 * output.cc: Include "descriptors.h".
11434 (Output_file::open): Use open_descriptor rather than open.
11435 * archive.cc (Archive::const_iterator): Change Archive to be
11436 non-const.
11437 (Archive::begin, Archive::end): Make non-const.
11438 (Archive::count_members): Likewise.
11439 * archive.h (class Archive): Update declarations.
11440 * object.h (Object::read): Make non-const.
11441 * Makefile.am (CCFILES): Add descriptors.cc.
11442 (HFILES): Add descriptors.h.
11443 * Makefile.in: Rebuild.
11444
11445 PR 6716
11446 * gold.h: Always include <clocale>. Add Solaris workarounds
11447 following code in binutils/sysdep.h.
11448
11449 PR 6048
11450 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11451 this->eh_frame_hdr_ is NULL before using it.
11452
11453 * dynobj.cc (Versions::Versions): Update comment.
11454
11455 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11456 the base version name.
11457
11458 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11459 array size plus one.
11460 (Stringpool_template::set_string_offsets): Subtract one from key
11461 before using it as an array index.
11462 (Stringpool_template::get_offset_with_length): Likewise.
11463 (Stringpool_template::write_to_buffer): Likewise.
11464 * stringpool.h (Stringpool_template::get_offset_from_key):
11465 Likewise.
11466
11467 2008-07-23 Ian Lance Taylor <iant@google.com>
11468
11469 PR 6658
11470 * object.h (Merged_symbol_value::value): Do our best to handle a
11471 negative addend.
11472
11473 PR 6647
11474 * script.cc (Version_script_info::get_versions): Don't add empty
11475 version tag to return value.
11476 (Version_script_info::get_symbol_version_helper): Change return
11477 type to bool. Add pversion parameter. Change all callers.
11478 (script_register_vers_node): Don't require a non-NULL tag.
11479 * script.h (class Version_script_info): Update declarations.
11480 (Version_script_info::get_symbol_version): Change return type to
11481 bool. Add version parameter. Change all callers.
11482 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11483 handling. Handle an empty version from a version script.
11484 (Symbol_table::define_special_symbol): Likewise.
11485 * testsuite/ver_test_10.script: New file.
11486 * testsuite/ver_test_10.sh: New file.
11487 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11488 (check_DATA): Add ver_test_10.syms.
11489 (ver_test_10.syms, ver_test_10.so): New target.
11490 * testsuite/Makefile.in: Rebuild.
11491
11492 2008-07-23 Simon Baldwin <simonb@google.com>
11493
11494 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11495 to zero for undefined symbols from dynamic libraries.
11496
11497 2008-07-23 Ian Lance Taylor <iant@google.com>
11498
11499 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11500 Change all callers.
11501 * symtab.h (class Symbol_table): Update declaration.
11502 * testsuite/ver_test_9.cc: New file.
11503 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11504 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11505 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11506 (ver_test_9.so, ver_test_9.o): New targets.
11507 * testsuite/Makefile.in: Rebuild.
11508
11509 2008-07-22 Ian Lance Taylor <iant@google.com>
11510
11511 * options.h (class General_options): Define --check-sections.
11512 * layout.cc (Layout::set_segment_offsets): Handle
11513 --check-sections.
11514
11515 * options.h (class General_options): Define -n/--nmagic and
11516 -N/--omagic.
11517 * options.cc (General_options::finalize): For -n/--nmagic or
11518 -N/--omagic, set -static.
11519 * layout.cc (Layout::attach_allocated_section_to_segment): If
11520 -N/--omagic, don't put read-only and read-write sections in
11521 different segments.
11522 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11523 finding a read-only segment.
11524 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11525 don't set the minimum segment alignment to the common page size,
11526 and don't set the file offset to the address modulo the page size.
11527 * script-sections.cc (Script_sections::create_segments): If
11528 -n/--omagic, don't put read-only and read-write sections in
11529 different segments.
11530
11531 * cref.cc: New file.
11532 * cref.h: New file.
11533 * options.h (class General_options): Add --print-symbol-counts.
11534 * main.cc (main): Issue defined symbol report if requested.
11535 * archive.cc (Archive::interpret_header): Make into a const member
11536 function.
11537 (Archive::add_symbols): Call Input_objects::archive_start and
11538 archive_stop.
11539 (Archive::const_iterator): Define new class.
11540 (Archive::begin, Archive::end): New functions.
11541 (Archive::include_all_members): Rewrite to use iterator.
11542 (Archive::count_members): New function.
11543 * archive.h (class Archive): Update declarations.
11544 (Archive::filename): New function.
11545 * object.cc: Include "cref.h".
11546 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11547 (Sized_relobj::do_get_global_symbol_counts): New function.
11548 (Input_objects::add_object): Add object to cross-referencer.
11549 (Input_objects::archive_start): New function.
11550 (Input_objects::archive_stop): New function.
11551 (Input_objects::print_symbol_counts): New function.
11552 * object.h: Declare Cref and Archive.
11553 (Object::get_global_symbol_counts): New function.
11554 (Object::do_get_global_symbol_counts): New pure virtual function.
11555 (class Sized_relobj): Add defined_count_ field. Update
11556 declarations.
11557 (class Input_objects): Add cref_ field. Update constructor.
11558 Update declarations.
11559 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11560 defined_count_.
11561 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11562 symbol counts.
11563 (Sized_dynobj::do_get_global_symbol_counts): New function.
11564 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11565 defined_count_. Update declarations. Define Symbols typedef.
11566 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11567 parameter. Change all callers.
11568 (Symbol_table::add_from_dynobj): Add sympointers and defined
11569 parameters. Change all callers.
11570 * symtab.h (class Symbol_table): Update declarations.
11571 * Makefile.am (CCFILES): Add cref.cc.
11572 (HFILES): Add cref.h.
11573 * Makefile.in: Rebuild.
11574
11575 2008-07-22 Simon Baldwin <simonb@google.com>
11576
11577 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11578 to zero when writing undefined symbols.
11579
11580 2008-07-22 Ian Lance Taylor <iant@google.com>
11581
11582 * output.cc (Output_section::add_input_section): Don't try to
11583 merge empty merge sections.
11584
11585 2008-07-21 Craig Silverstein <csilvers@google.com>
11586
11587 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11588 Include symbol version in error message.
11589
11590 2008-07-20 Chris Demetriou <cgd@google.com>
11591
11592 * configure.ac (gold_cv_c_random_seed): New configured variable.
11593 (RANDOM_SEED_CFLAGS): New substituted variable.
11594 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11595 * configure: Rebuild.
11596 * Makefile.in: Likewise.
11597 * testsuite/Makefile.in: Likewise.
11598
11599 2008-07-18 Ian Lance Taylor <iant@google.com>
11600
11601 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11602 where we see NAME/NULL and NAME/VERSION as separate symbols.
11603 * testsuite/ver_test_main.cc (main): Call t4.
11604 (t4, t4_2a): Define.
11605 * testsuite/ver_test_2.cc (t4_2): Define.
11606 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11607 * testsuite/ver_test_4.cc (t4_2a): Define.
11608 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11609 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11610
11611 2008-07-17 Ian Lance Taylor <iant@google.com>
11612
11613 * dynobj.cc (Versions::add_def): If we give an error about a
11614 missing version, go ahead and create the version anyhow.
11615
11616 2008-07-10 Ian Lance Taylor <iant@google.com>
11617
11618 Handle output sections with more than 0x7fffffff bytes.
11619 * object.h (class Relobj): Change map_to_output_ to
11620 output_sections_, and just keep a section pointer. Change all
11621 uses. Move comdat group support to Sized_relobj.
11622 (Relobj::is_section_specially_mapped): Remove.
11623 (Relobj::output_section): Remove poff parameter. Change all
11624 callers.
11625 (Relobj::output_section_offset): New function.
11626 (Relobj::set_section_offset): Rewrite.
11627 (Relobj::map_to_output): Remove.
11628 (Relobj::output_sections): New function.
11629 (Relobj::do_output_section_offset): New pure virtual function.
11630 (Relobj::do_set_section_offset): Likewise.
11631 (class Sized_relobj): Add section_offsets_ field. Add comdat
11632 group support from Relobj. Update declarations.
11633 (Sized_relobj::get_output_section_offset): New function.
11634 (Sized_relobj::do_output_section_offset): New function.
11635 (Sized_relobj::do_set_section_offset): New function.
11636 * object.cc (Relobj::output_section_address): Remove.
11637 (Sized_relobj::Sized_relobj): Initialize new fields.
11638 (Sized_relobj::include_section_group): Cast find_kept_object to
11639 Sized_relobj.
11640 (Sized_relobj::include_linkonce_section): Likewise.
11641 (Sized_relobj::do_layout): Use separate arrays for output section
11642 and output offset.
11643 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11644 output_sections.
11645 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11646 output_sections and section_offsets.
11647 (Sized_relobj::write_local_symbols): Likewise.
11648 (map_to_kept_section): Compute output address directly.
11649 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11650 output_sections and section_offsets.
11651 (Sized_relobj::write_sections): Likewise.
11652 (Sized_relobj::relocate_sections): Likewise.
11653 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11654 * output.h (class Output_reloc): Update declarations. Change
11655 u2_.relobj to Sized_relobj*.
11656 (class Output_data_reloc): Change add functions to use
11657 Sized_relobj*.
11658 * output.cc (Output_reloc::Output_reloc): Change relobj to
11659 Sized_relobj*.
11660 (Output_reloc::local_section_offset): Change return type to
11661 Elf_Addr. Use get_output_section_offset.
11662 (Output_reloc::get_address): Likewise.
11663 (Output_section::is_input_address_mapped): Don't call
11664 is_section_specially_mapped.
11665 (Output_section::output_offset): Likewise.
11666 (Output_section::output_address): Likewise.
11667 (Output_section::starting_output_address): Likewise.
11668 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11669 parameter to Sized_relobj*.
11670 (Copy_relocs::need_copy_reloc): Likewise.
11671 (Copy_relocs::save): Likewise.
11672 * copy-relocs.h (class Copy_relocs): Update declarations.
11673 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11674 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11675 * target-reloc.h (relocate_for_relocatable): Change
11676 offset_in_output_section type to Elf_Addr. Change code that uses
11677 it as well.
11678 * layout.cc (Layout::layout): Always set *off.
11679 * mapfile.cc (Mapfile::print_input_section): Use
11680 output_section_offset.
11681 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11682 Sized_relobj*.
11683 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11684 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11685 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11686
11687 2008-07-03 Ian Lance Taylor <iant@google.com>
11688
11689 * layout.cc (Layout::include_section): Do not discard unrecognized
11690 SHT_STRTAB sections.
11691
11692 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11693
11694 * script.cc (Lex::can_continue_name): Make '?' allowable in
11695 version-script names.
11696 * testsuite/version_script.map: Change glob pattern to use '?'
11697
11698 2008-06-30 Manish Singh <yosh@gimp.org>
11699
11700 PR 6585
11701 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11702 Correct typo.
11703
11704 2008-06-30 Ian Lance Taylor <iant@google.com>
11705
11706 PR 6660
11707 PR 6682
11708 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11709 versions]: Don't try to read the value in the contents, since we
11710 don't use it. Use the template endianness when writing.
11711
11712 2008-06-25 Cary Coutant <ccoutant@google.com>
11713
11714 * fileread.cc (File_read::make_view): Assert on zero-length view.
11715 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11716 symbol table when there are no symbols to read.
11717
11718 2008-06-23 Craig Silverstein <csilvers@google.com>
11719
11720 * version.cc (version_string): Bump to 1.7
11721
11722 2008-06-18 Craig Silverstein <csilvers@google.com>
11723
11724 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11725 constant 0xFFFF to type Valtype.
11726 (Powerpc_relocate_functions::rel16_ha): Likewise.
11727
11728 2008-06-17 Ian Lance Taylor <iant@google.com>
11729
11730 * output.h (Output_section::Input_section): Initialize p2align_ to
11731 zero for Output_section_data constructors.
11732 (Output_section::Input_section::addralign): If not an input
11733 section, return the alignment of the Output_section_data.
11734 * testsuite/copy_test.cc: New file.
11735 * testsuite/copy_test_1.cc: New file.
11736 * testsuite/copy_test_2.cc: New file.
11737 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11738 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11739 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11740 (copy_test_1_pic.o, copy_test_1.so): New targets.
11741 (copy_test_2_pic.o, copy_test_2.so): New targets.
11742 * testsuite/Makefile.in: Rebuild.
11743
11744 * script-sections.cc (Script_sections::place_orphan): Initialize
11745 local variable exact.
11746
11747 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11748
11749 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11750
11751 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11752 David S. Miller <davem@davemloft.net>
11753
11754 * powerpc.cc: New file.
11755 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11756 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11757 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11758 * Makefile.in: Rebuild.
11759
11760 2008-06-09 Ian Lance Taylor <iant@google.com>
11761
11762 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11763 <exception>.
11764 (throwing, orig_terminate): New static variables.
11765 (terminate_handler): New static function.
11766 (t2): Set terminate handler.
11767
11768 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11769
11770 PR 6584
11771 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11772 alignment.
11773
11774 2008-05-30 Cary Coutant <ccoutant@google.com>
11775
11776 * archive.cc (Archive::include_all_members) Correct to step
11777 over symbol table and extended name table in thin archives.
11778
11779 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11780
11781 PR 6407
11782 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11783 calculation.
11784
11785 2008-05-28 Caleb Howe <cshowe@google.com>
11786
11787 * reduced_debug_output.cc: New file.
11788 * reduced_debug_output.h: New file.
11789 * options.h (class General_options): Add --strip-debug-non-line.
11790 * options.cc (General_options::finalize): Add strip_debug_non_line
11791 to the strip heirarchy.
11792 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11793 fields.
11794 * layout.cc: Include "reduced_debug_output.h".
11795 (Layout::Layout): Initialize new fields.
11796 (line_only_debug_sections): New static array.
11797 (is_lines_only_debug_sections): New static inline function.
11798 (Layout::include_section): Handle --strip-debug-non-line.
11799 (Layout::make_output_section): If --strip-debug-non-line, build
11800 new output sections for .debug_abbrev and .debug_info.
11801 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11802 gold. Warn about possible overflow.
11803 (read_signed_LEB_128): Likewise.
11804 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11805 (read_signed_LEB_128): Declare.
11806 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11807 (HFILES): Add reduced_debug_output.h.
11808 * Makefile.in: Rebuild.
11809
11810 2008-05-21 Ian Lance Taylor <iant@google.com>
11811
11812 * mapfile.cc: New file.
11813 * mapfile.h: New file.
11814 * options.h (class General_options): Add -M/--print-map and -Map.
11815 * options.cc (General_options::finalize): Make -M equivalent to
11816 -Map -.
11817 * main.cc: Include <cstdio> and "mapfile.h".
11818 (main): Open mapfile if requested.
11819 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11820 constructor. Change caller.
11821 (queue_initial_tasks): Add mapfile parameter. Change caller.
11822 (queue_middle_tasks): Likewise.
11823 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11824 declarations.
11825 * archive.cc: Include "mapfile.h".
11826 (Archive::add_symbols): Add mapfile parameter. Change all
11827 callers. Pass mapfile, symbol, and reason to include_member.
11828 (Archive::include_all_members): Add mapfile parameter. Change all
11829 callers.
11830 (Archive::include_member): Add mapfile, sym, and why parameters.
11831 Change all callers. Report inclusion to map file.
11832 * archive.h: Include "fileread.h".
11833 (class Archive): Update declarations.
11834 (Archive::file): New const method.
11835 (class Add_archive_symbols): Add mapfile_ field. Update
11836 constructor. Change all callers.
11837 * readsyms.h (class Read_symbols): Likewise.
11838 (class Finish_group): Likewise.
11839 (class Read_script): Likewise.
11840 * common.cc: Include "mapfile.h".
11841 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11842 all callers.
11843 (Symbol_table::do_allocate_commons): Likewise.
11844 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11845 symbol allocation to mapfile.
11846 * common.h (class Allocate_commons_task): Add mapfile_ field.
11847 Update constructor. Change all callers.
11848 * symtab.h (class Symbol_table): Update declarations.
11849 * layout.cc: Include "mapfile.h".
11850 (Layout_task_runner::run): Print information to mapfile.
11851 (Layout::create_gold_note): Change Output_data_fixed_space to
11852 Output_data_zero_fill.
11853 (Layout::create_build_id): Likewise.
11854 (Layout::print_to_mapfile): New function.
11855 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11856 constructor. Change caller.
11857 (class Layout): Declare print_to_mapfile.
11858 * output.cc (Output_section::Input_section::print_to_mapfile): New
11859 function.
11860 (Output_section::add_input_section): If producing a map, always
11861 add to input_sections_ list.
11862 (Output_section::do_print_to_mapfile): New function.
11863 (Output_segment::print_sections_to_mapfile): New function.
11864 (Output_segment::print_section_list_to_mapfile): New function.
11865 * output.h: Include "mapfile.h".
11866 (Output_data::print_to_mapfile): New function.
11867 (Output_data::do_print_to_mapfile): New virtual function.
11868 (Output_segment_headers::do_print_to_mapfile): New function.
11869 (Output_file_header::do_print_to_mapfile): New function.
11870 (Output_data_const::do_print_to_mapfile): New function.
11871 (class Output_data_const_buffer): Add map_name_ field. Update
11872 constructor. Change all callers. Add do_print_to_mapfile
11873 function.
11874 (class Output_data_fixed_space): Likewise.
11875 (class Output_data_space): Likewise.
11876 (class Output_data_zero_fill): New class.
11877 (Output_data_strtab::do_print_to_mapfile): New function.
11878 (Output_data_reloc_base::do_print_to_mapfile): New function.
11879 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11880 (Output_data_group::do_print_to_mapfile): New function.
11881 (Output_data_got::do_print_to_mapfile): New function.
11882 (Output_data_dynamic::do_print_to_mapfile): New function.
11883 (Output_symtab_xindex::do_print_to_mapfile): New function.
11884 (class Output_section): Declare do_print_to_mapflie. Declare
11885 print_to_mapfile in Input_section.
11886 (class Output_segment): Declare new functions.
11887 * object.h (Sized_relobj::symbol_count): New function.
11888 * script-sections.cc
11889 (Output_section_element_dot_assignment::set_section_addresses):
11890 Change Output_data_fixed_space to Output_data_zero_fill.
11891 (Output_data_expression::do_print_to_mapfile): New function.
11892 * script.cc (read_input_script): Add mapfile parameter. Change
11893 all callers.
11894 * script.h (read_input_script): Update declaration.
11895 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11896 (Eh_frame::do_print_to_mapfile): New function.
11897 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11898 (Output_merge_string::do_print_to_mapfile): New function.
11899 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11900 function.
11901 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11902 function.
11903 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11904 function.
11905 * Makefile.am (CCFILES): Add mapfile.cc.
11906 (HFILES): Add mapfile.h.
11907 * Makefile.in: Rebuild.
11908
11909 2008-05-19 Ian Lance Taylor <iant@google.com>
11910
11911 * options.h (class General_options): Add -z relro.
11912 * layout.cc (Layout::Layout): Initialize relro_segment_.
11913 (Layout::add_output_section_data): Return the output section.
11914 (Layout::make_output_section): Rcognize relro sections and mark
11915 them appropriately.
11916 (Layout::attach_allocated_section_to_segment): Put relro sections
11917 in a PT_GNU_RELRO segment.
11918 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11919 section as relro.
11920 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11921 PT_TLS segments.
11922 (Layout::linkonce_mapping): Map d.rel.ro.local to
11923 .data.rel.ro.local.
11924 (Layout::output_section_name): Us .data.rel.ro.local for any
11925 section which begins with that.
11926 * layout.h (class Layout): Update add_output_section_data
11927 declaration. Add relro_segment_ field.
11928 * output.cc (Output_section::Output_section): Initialize is_relro_
11929 and is_relro_local_ fields.
11930 (Output_segment::add_output_section): Group relro sections.
11931 (Output_segment::is_first_section_relro): New function.
11932 (Output_segment::maximum_alignment): If there is a relro section,
11933 align the segment to the common page size.
11934 (Output_segment::set_section_addresses): Track whether we are
11935 looking at relro sections. If the last section is a relro
11936 section, align to the common page size.
11937 (Output_segment::set_section_list_addresses): Add in_relro
11938 parameter. Change all callers. Align to the page size when
11939 moving from relro to non-relro section.
11940 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11941 segment.
11942 * output.h (class Output_section): Add is_relro_ and
11943 is_relro_local_ fields.
11944 (Output_section::is_relro): New function.
11945 (Output_section::set_is_relro): New function.
11946 (Output_section::is_relro_local): New function.
11947 (Output_section::set_is_relro_local): New function.
11948 (class Output_segment): Update declarations.
11949 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11950 * sparc.cc (Target_sparc::got_section): Likewise.
11951 * x86_64.cc (Target_x86_64::got_section): Likewise.
11952 * testsuite/relro_test_main.cc: New file.
11953 * testsuite/relro_test.cc: New file.
11954 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11955 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11956 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11957 (relro_test.so, relro_test_pic.o): New targets.
11958 * testsuite/Makefile.in: Rebuild.
11959
11960 2008-05-16 Ian Lance Taylor <iant@google.com>
11961
11962 * output.cc (Output_segment::add_output_section): Remove front
11963 parameter.
11964 * output.h (class Output_segment): Remove
11965 add_initial_output_section and overloaded add_output_section.
11966 Update declaration of remaining add_output_section.
11967 * layout.cc (Layout::create_interp): Call add_output_section
11968 rather than add_initial_output_section.
11969 (Layout::finish_dynamic_section): Likewise.
11970
11971 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11972 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11973 know the dynamic type.
11974 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11975 field. Initialize it in constructor.
11976 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11977 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11978 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11979 reloc.
11980
11981 * output.cc (Output_reloc::get_address): Change return type to
11982 Elf_Addr.
11983 * output.h (class Output_reloc): Update get_address declaration.
11984 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11985 for section addresses.
11986
11987 2008-05-09 Ian Lance Taylor <iant@google.com>
11988
11989 PR 6493
11990 * gold.cc (gold_nomem): Use return value of write.
11991
11992 2008-05-08 Ian Lance Taylor <iant@google.com>
11993
11994 * symtab.c (Symbol::init_base_output_data): Add version
11995 parameter. Change all callers.
11996 (Symbol::init_base_output_segment): Likewise.
11997 (Symbol::init_base_constant): Likewise.
11998 (Symbol::init_base_undefined): Likewise.
11999 (Sized_symbol::init_output_data): Likewise.
12000 (Sized_symbol::init_output_segment): Likewise.
12001 (Sized_symbol::init_constant): Likewise.
12002 (Sized_symbol::init_undefined): Likewise.
12003 (Symbol_table::do_define_in_output_data): If the new symbol has a
12004 version, mark it as the default.
12005 (Symbol_table::do_define_in_output_segment): Likewise.
12006 (Symbol_table::do_define_as_constant): Likewise.
12007 * symtab.h (class Symbol): Update declarations.
12008 (class Sized_symbol): Likewise.
12009 * resolve.cc (Symbol::override_version): New function.
12010 (Symbol::override_base): Call override_version.
12011 (Symbol::override_base_with_special): Likewise.
12012 * testsuite/ver_script_8.script: New file.
12013 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12014 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12015 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12016 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12017
12018 2008-05-06 Ian Lance Taylor <iant@google.com>
12019
12020 PR 6049
12021 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12022 functions.
12023 (class General_options): Remove existing --undefined, and add
12024 --no-undefined instead. Add new --undefined as synonym for -u.
12025 * archive.cc (Archive::add_symbols): Check whether symbol was
12026 named with -u.
12027 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12028 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12029 all uses. Add IS_UNDEFINED. Update declarations to split
12030 different versions of init_base. Declare init_base_undefined.
12031 (Symbol::is_defined): Handle IS_UNDEFINED.
12032 (Symbol::is_undefined): Likewise.
12033 (Symbol::is_weak_undefined): Call is_undefined.
12034 (Symbol::is_absolute): Handle IS_CONSTANT.
12035 (class Sized_symbol): Update declarations to split different
12036 versions of init. Declare init_undefined.
12037 (class Symbol_table): Declare new functions.
12038 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12039 Change all callers.
12040 (Symbol::init_base_output_data): Likewise.
12041 (Symbol::init_base_output_segment): Likewise.
12042 (Symbol::init_base_constant): Likewise.
12043 (Symbol::init_base_undefined): New function.
12044 (Sized_symbol::init_object): Rename from init. Change all
12045 callers.
12046 (Sized_symbol::init_output_data): Likewise.
12047 (Sized_symbol::init_output_segment): Likewise.
12048 (Sized_symbol::init_constant): Likewise.
12049 (Sized_symbol::init_undefined): New function.
12050 (Symbol_table::add_undefined_symbols_from_command_line): New
12051 function.
12052 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12053 function.
12054 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12055 (Symbol::output_section): Likewise.
12056 (Symbol::set_output_section): Likewise.
12057 (Symbol_table::sized_finalize_symbol): Likewise.
12058 (Symbol_table::sized_write_globals): Likewise.
12059 * resolve.cc (Symbol_table::should_override): Likewise.
12060 (Symbol::override_base_with_special): Likewise.
12061
12062 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12063 symbol, change it to have default visibility.
12064 * testsuite/protected_1.cc: New file.
12065 * testsuite/protected_2.cc: New file.
12066 * testsuite/protected_3.cc: New file.
12067 * testsuite/protected_main_1.cc: New file.
12068 * testsuite/protected_main_2.cc: New file.
12069 * testsuite/protected_main_3.cc: New file.
12070 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12071 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12072 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12073 (protected_1.so): New target.
12074 (protected_1_pic.o, protected_2_pic.o): New targets.
12075 (protected_3_pic.o): New target.
12076 (check_PROGRAMS): Add protected_2.
12077 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12078 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12079 * testsuite/Makefile.in: Rebuild.
12080
12081 * options.h (DEFINE_var): Add set_user_set_##varname__.
12082 (DEFINE_bool_alias): New macro.
12083 (class General_options): Define -Bstatic using DEFINE_bool_alias
12084 rather than DEFINE_special. Add --undefined as an alias for -z
12085 defs.
12086 * options.cc (General_options::parse_Bstatic): Remove.
12087
12088 * options.h (class General_options): Add --fatal-warnings.
12089 * main.cc (main): Implement --fatal-warnings.
12090 * errors.h (Errors::warning_count): New function.
12091
12092 * options.h (class General_options): Add -Bsymbolic-functions.
12093 * symtab.h (Symbol::is_preemptible): Check for
12094 -Bsymbolic-functions.
12095
12096 2008-05-05 Ian Lance Taylor <iant@google.com>
12097
12098 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12099 as noVARNAME rather than no-VARNAME.
12100 (class General_options): Add option -z combreloc.
12101 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12102 get_address.
12103 (Output_reloc::sort_before) [SHT_REL]: New function.
12104 (Output_reloc::sort_before) [SHT_RELA]: New function.
12105 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12106 Sort_relocs_comparison.
12107 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12108 parameter. Change all callers.
12109 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12110 sort_relocs parameter. Change all callers.
12111 * output.cc (Output_reloc::get_address): New function, broken out
12112 of write_rel.
12113 (Output_reloc::write_rel): Call it.
12114 (Output_reloc::compare): New function.
12115 (Output_data_reloc_base::do_write): Optionally sort relocs.
12116
12117 * configure.ac: If targ_extra_obj is set, link it in.
12118 * configure.tgt: Initialize all variables.
12119 (x86_64*): Set targ_extra_obj and targ_extra_size.
12120 * configure: Rebuild.
12121
12122 * object.cc (Sized_relobj::include_section_group): Adjust section
12123 indexes read from group data. Build vector to pass to
12124 layout_group.
12125 * layout.cc (Layout::layout_group): Add flags and shndxes
12126 parameters. Remove contents parameter. Change caller. Update
12127 explicit instantiations.
12128 * layout.h (class Layout): Update layout_group declaration.
12129 * output.cc (Output_data_group::Output_data_group): Add flags and
12130 input_shndxes parameters. Remove contents parameter. Change
12131 caller.
12132 (Output_data_group::do_write): Change input_sections_ to
12133 input_shndxes_.
12134 * output.h (class Output_data_group): Update constructor
12135 declaration. Rename input_sections_ to input_shndxes_.
12136 * testsuite/many_sections_test.cc: Add template.
12137
12138 2008-04-30 Cary Coutant <ccoutant@google.com>
12139
12140 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12141
12142 * layout.cc (Layout::include_section): Refactored check for debug
12143 info section.
12144 (Layout::add_comdat): Add new parameters. Change type
12145 of signature parameter. Add object and shndx to signatures table.
12146 (Layout::find_kept_object): New function.
12147 * layout.h: Include <cstring>.
12148 (Layout::is_debug_info_section): New function.
12149 (Layout::add_comdat): Add new parameters.
12150 (Layout::find_kept_object): New function.
12151 (Layout::Kept_section): New struct.
12152 (Layout::Signatures): Change type of map range.
12153 * object.cc (Relobj::output_section_address): New function.
12154 (Sized_relobj::include_section_group): Add new parameters. Change
12155 calls to Layout::add_comdat. Change to build table of kept comdat
12156 groups and table mapping discarded sections to kept sections.
12157 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12158 (Sized_relobj::do_layout): Change calls to include_section_group and
12159 include_linkonce_section.
12160 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12161 value to zero when section is discarded.
12162 (Sized_relobj::map_to_kept_section): New function.
12163 * object.h (Relobj::output_section_address): New function.
12164 (Relobj::Comdat_group): New type.
12165 (Relobj::find_comdat_group): New function.
12166 (Relobj::Comdat_group_table): New type.
12167 (Relobj::Kept_comdat_section): New type.
12168 (Relobj::Kept_comdat_section_table): New type.
12169 (Relobj::add_comdat_group): New function.
12170 (Relobj::set_kept_comdat_section): New function.
12171 (Relobj::get_kept_comdat_section): New function.
12172 (Relobj::comdat_groups_): New field.
12173 (Relobj::kept_comdat_sections_): New field.
12174 (Symbol_value::input_value): Update comment.
12175 (Sized_relobj::map_to_kept_section) New function.
12176 (Sized_relobj::include_linkonce_section): Add new parameter.
12177 * target-reloc.h (Comdat_behavior): New type.
12178 (get_comdat_behavior): New function.
12179 (relocate_section): Add code to map a discarded section to the
12180 corresponding kept section when applying a relocation.
12181
12182 2008-04-30 Craig Silverstein <csilvers@google.com>
12183
12184 * dwarf_reader.cc (next_generation_count): New static var.
12185 (Addr2line_cache_entry): New struct.
12186 (addr2line_cache): New static var.
12187 (Dwarf_line_info::one_addr2line): Added caching.
12188 (Dwarf_line_info::clear_addr2line_cache): New function.
12189 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12190 cache-size parameter.
12191 (Dwarf_line_info::one_addr2line_cache): New function.
12192 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12193 new cache-size argument to one_addr2line(), and clear cache.
12194
12195 2008-04-28 Cary Coutant <ccoutant@google.com>
12196
12197 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12198 R_386_PC8 relocations.
12199
12200 2008-04-23 Ian Lance Taylor <iant@google.com>
12201
12202 * object.cc (Sized_relobj::include_section_group): Check for
12203 invalid section group.
12204
12205 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12206 header size.
12207
12208 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12209 than read for file header.
12210 * archive.cc (Archive::include_member): Likewise.
12211
12212 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12213
12214 * aclocal.m4: Regenerate.
12215 * configure: Regenerate.
12216
12217 2008-04-19 Ian Lance Taylor <iant@google.com>
12218
12219 * version.cc (version_string): Bump to 1.6.
12220
12221 * testsuite/Makefile.am (many_sections_r_test): New target.
12222 (many_sections_r_test_SOURCES): Remove.
12223 (many_sections_r_test_DEPENDENCIES): Remove.
12224 (many_sections_r_test_LDFLAGS): Remove.
12225 (many_sections_r_test_LDADD): Remove.
12226
12227 * object.cc (Sized_relobj::do_add_symbols): Always pass
12228 local_symbol_count_ to add_from_relobj.
12229
12230 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12231 every thousand variables.
12232 * testsuite/Makefile.in: Rebuild.
12233
12234 * object.cc (Xindex::initialize_symtab_xindex): New function.
12235 (Xindex::read_symtab_xindex): New function.
12236 (Xindex::sym_xindex_to_shndx): New function.
12237 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12238 available.
12239 (Sized_relobj::do_initialize_xindex): New function.
12240 (Sized_relobj::do_read_symbols): Adjust section links.
12241 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12242 parameter. Change all callers.
12243 (Sized_relobj::include_section_group): Adjust section links and
12244 symbol section indexes.
12245 (Sized_relobj::do_layout): Adjust section links.
12246 (Sized_relobj::do_count_local_symbols): Adjust section links and
12247 symbol section indexes.
12248 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12249 ordinary and special symbols.
12250 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12251 dynsym_xindex parameters. Change all callers. Adjust section
12252 links. Use SHN_XINDEX when needed.
12253 (Sized_relobj::get_symbol_location_info): Adjust section links.
12254 Don't get fooled by special symbols.
12255 * object.h (class Xindex): Define.
12256 (class Object): Add xindex_ parameter. Declare virtual functoin
12257 do_initialize_xindex.
12258 (Object::adjust_sym_shndx): New function.
12259 (Object::set_xindex): New protected function.
12260 (class Symbol_value): Add is_ordinary_shndx_ field.
12261 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12262 (Symbol_value::value): Assert ordinary section.
12263 (Symbol_value::initialize_input_to_output_map): Likewise.
12264 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12265 Change all callers.
12266 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12267 all callers.
12268 (class Sized_relobj): Update declarations.
12269 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12270 parameter. Change all callers.
12271 (Sized_relobj::adjust_shndx): New function.
12272 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12273 field.
12274 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12275 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12276 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12277 (Sized_dynobj::read_dynsym_section): Adjust section links.
12278 (Sized_dynobj::read_dynamic): Likewise.
12279 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12280 section links.
12281 (Sized_dynobj::do_initialize_xindex): New function.
12282 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12283 do_initialize_xindex.
12284 (Sized_dynobj::adjust_shndx): New function.
12285 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12286 dynsym_xindex_ fields.
12287 (Layout::finalize): Add a call to set_section_indexes before
12288 creating the symtab sections.
12289 (Layout::set_section_indexes): Don't do anything if the section
12290 already has a section index.
12291 (Layout::create_symtab_sections): Add shnum parameter. Change
12292 caller. Create .symtab_shndx section if needed.
12293 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12294 caller.
12295 (Layout::allocated_output_section_count): New function.
12296 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12297 needed.
12298 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12299 fields. Update declarations.
12300 (Layout::symtab_xindex): New function.
12301 (Layout::dynsym_xindex): New function.
12302 (class Write_symbols_task): Add layout_ field.
12303 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12304 Change caller.
12305 * output.cc (Output_section_headers::Output_section_headers): Add
12306 shstrtab_section parameter. Change all callers.
12307 (Output_section_headers::do_sized_write): Store overflow values
12308 for section count and section string table section index in
12309 section header zero.
12310 (Output_file_header::do_sized_write): Check for overflow of
12311 section count and section string table section index.
12312 (Output_symtab_xindex::do_write): New function.
12313 (Output_symtab_xindex::endian_do_write): New function.
12314 * output.h (class Output_section_headers): Add shstrtab_section_.
12315 Update declarations.
12316 (class Output_symtab_xindex): Define.
12317 (Output_section::has_out_shndx): New function.
12318 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12319 field.
12320 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12321 Change all callers.
12322 (Sized_symbol::init): Likewise.
12323 (Symbol::output_section): Check for ordinary symbol.
12324 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12325 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12326 callers.
12327 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12328 Change all callers. Simplify handling of symbols from sections
12329 not included in the link.
12330 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12331 distinction.
12332 (Weak_alias_sorter::operator()): Assert that symbols are
12333 ordinary.
12334 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12335 distinction.
12336 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12337 parameters. Change all callers.
12338 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12339 symbol distinction. Use SHN_XINDEX when needed.
12340 (Symbol_table::write_section_symbol): Add symtab_xindex
12341 parameter. Change all callers.
12342 (Symbol_table::sized_write_section_symbol): Likewise. Use
12343 SHN_XINDEX when needed.
12344 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12345 declarations.
12346 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12347 (Symbol::is_defined): Check is_ordinary.
12348 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12349 (Symbol::is_absolute, Symbol::is_common): Likewise.
12350 (class Sized_symbol): Update declarations.
12351 (class Symbol_table): Update declarations.
12352 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12353 parameters. Change all callers.
12354 (Sized_symbol::override): Likewise.
12355 (Symbol_table::override): Likewise.
12356 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12357 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12358 is_ordinary, and orig_st_shndx parameters. Change all callers.
12359 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12360 to be in an ordinary section.
12361 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12362 object and is_ordinary parameters. Change all callers.
12363 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12364 Change all callers. Don't add undefined or non-ordinary symbols
12365 to reloc_map_.
12366 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12367 Change all callers.
12368 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12369 declarations.
12370 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12371 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12372 (Sized_relobj::relocate_sections): Likewise.
12373 * target-reloc.h (scan_relocs): Adjust section symbol index.
12374 (scan_relocatable_relocs): Likewise.
12375 * i386.cc (Scan::local): Check for ordinary symbols.
12376 * sparc.cc (Scan::local): Likewise.
12377 * x86_64.cc (Scan::local): Likewise.
12378 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12379 to symbol_section_and_value.
12380 * testsuite/many_sections_test.cc: New file.
12381 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12382 (check_PROGRAMS): Add many_sections_test.
12383 (many_sections_test_SOURCES): Define.
12384 (many_sections_test_DEPENDENCIES): Define.
12385 (many_sections_test_LDFLAGS): Define.
12386 (BUILT_SOURCES): Add many_sections_define.h.
12387 (many_sections_define.h): New target.
12388 (BUILT_SOURCES): Add many_sections_check.h.
12389 (many_sections_check.h): New target.
12390 (check_PROGRAMS): Add many_sections_r_test.
12391 (many_sections_r_test_SOURCES): Define.
12392 (many_sections_r_test_DEPENDENCIES): Define.
12393 (many_sections_r_test_LDFLAGS): Define.
12394 (many_sections_r_test_LDADD): Define.
12395 (many_sections_r_test.o): New target.
12396 * testsuite/Makefile.in: Rebuild.
12397
12398 2008-04-17 Cary Coutant <ccoutant@google.com>
12399
12400 * errors.cc (Errors::info): New function.
12401 (gold_info): New function.
12402 * errors.h (Errors::info): New function.
12403 * gold.h (gold_info): New function.
12404 * object.cc (Input_objects::add_object): Print trace output.
12405 * options.cc (options::parse_set): New function.
12406 (General_options::parse_wrap): Deleted.
12407 (General_options::General_options): Deleted initializer.
12408 * options.h (options::String_set): New typedef.
12409 (options::parse_set): New function.
12410 (DEFINE_set): New macro.
12411 (General_options::wrap): Changed to use DEFINE_set. Changed
12412 callers of any_wrap_symbols and is_wrap_symbol.
12413 (General_options::trace, General_options::trace_symbol):
12414 New options.
12415 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12416 (General_options::wrap_symbols_): Deleted.
12417 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12418
12419 2008-04-17 David S. Miller <davem@davemloft.net>
12420
12421 * options.cc (General_options::parse_V): New function.
12422 * options.h: Add entries for -V and -Qy.
12423
12424 2008-04-17 Ian Lance Taylor <iant@google.com>
12425
12426 * common.cc (Symbol_table::allocate_commons): Remove options
12427 parameter. Change caller.
12428 (Symbol_table::do_allocate_commons): Remove options parameter.
12429 Change caller. Just call do_allocate_commons_list twice.
12430 (Symbol_table::do_allocate_commons_list): New function, broken out
12431 of do_allocate_commons.
12432 * common.h (class Allocate_commons_task): Remove options_ field.
12433 Update constructor.
12434 * symtab.cc (Symbol_table::Symbol_table): Initialize
12435 tls_commons_.
12436 (Symbol_table::add_from_object): Put TLS common symbols on
12437 tls_commons_ list.
12438 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12439 which are IN_OUTPUT_DATA.
12440 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12441 allocate_commons and do_allocate_commons declarations. Declare
12442 do_allocate_commons_list.
12443 * gold.cc (queue_middle_tasks): Update creation of
12444 Allocate_commons_task to not pass options.
12445 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12446 (TLS_TEST_C_FLAGS): New variable.
12447 (tls_test_c_pic.o): New target.
12448 (tls_test_shared.so): Link in tls_test_c_pic.o.
12449 (tls_test_c_pic_ie.o): New target.
12450 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12451 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12452 (tls_test_c.o): New target.
12453 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12454 (tls_pic_test_LDADD): Likewise.
12455 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12456 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12457 (tls_test_c_gnu2.o): New target.
12458 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12459 tls_test_c_gnu2.o.
12460 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12461 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12462 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12463 * testsuite/tls_test.cc: Include "config.h".
12464 (t_last): Call t11_last.
12465 * testsuite/tls_test.h (t11, t11_last): Declare.
12466 * testsuite/tls_test_c.c: New file.
12467 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12468 * configure.ac: Check for OpenMP support.
12469 * configure, config.in, Makefile.in: Rebuild.
12470 * testsuite/Makefile.in: Rebuild.
12471
12472 2008-04-16 Cary Coutant <ccoutant@google.com>
12473
12474 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12475 (Target_i386::tls_base_symbol_defined_): New field.
12476 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12477 (Target_i386::Scan::global): Likewise.
12478 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12479 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12480 (Target_x86_64::tls_base_symbol_defined_): New field.
12481 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12482 (Target_x86_64::Scan::global): Likewise.
12483
12484 2008-04-16 Cary Coutant <ccoutant@google.com>
12485
12486 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12487 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12488 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12489 building shared libraries.
12490 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12491 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12492 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12493 * testsuite/Makefile.in: Rebuild.
12494 * testsuite/weak_undef.h: New file.
12495 * testsuite/weak_undef_file1.cc: Add extra test cases.
12496 * testsuite/weak_undef_file2.cc: Likewise.
12497 * testsuite/weak_undef_test.cc: Likewise.
12498
12499 2008-04-16 David S. Miller <davem@davemloft.net>
12500
12501 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12502 Add issued_non_pic_error_ field. Declare check_non_pic.
12503 (Target_sparc::Scan::check_non_pic): New function.
12504 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12505 (Target_sparc::Scan::global): Likewise.
12506
12507 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12508 * configure: Rebuild.
12509
12510 * options.h (DEFINE_enable): New macro.
12511 (new_dtags): New enable option.
12512 (initfirst, interpose, loadfltr, nodefaultlib,
12513 nodelete, nodlopen, nodump): New -z options.
12514 * layout.cc (Layout:finish_dynamic_section): If new
12515 dtags enabled, emit DT_RUNPATH. Also, emit a
12516 DT_FLAGS_1 containing any specified -z flags.
12517
12518 2008-04-16 Ian Lance Taylor <iant@google.com>
12519
12520 * copy-relocs.cc: New file.
12521 * copy-relocs.h: New file.
12522 * reloc.cc: Remove Copy_relocs code.
12523 * reloc.h: Likewise.
12524 * reloc-types.h (struct Reloc_types) [both versions]: Add
12525 get_reloc_addend_noerror.
12526 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12527 variants of add_global which take an addend which must be zero.
12528 * i386.cc: Include "copy-relocs.h".
12529 (class Target_i386): Change type of copy_relocs_ to variable,
12530 update initializer.
12531 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12532 Change all callers.
12533 (Target_i386::do_finalize_sections): Change handling of
12534 copy_relocs_.
12535 * sparc.cc: Include "copy-relocs.h".
12536 (class Target_sparc): Change type of copy_relocs_ to variable,
12537 update initializer.
12538 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12539 Change all callers.
12540 (Target_sparc::do_finalize_sections): Change handling of
12541 copy_relocs_.
12542 * x86_64.cc: Include "copy-relocs.h".
12543 (class Target_x86_64): Change type of copy_relocs_ to variable,
12544 update initializer.
12545 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12546 class. Change all callers.
12547 (Target_x86_64::do_finalize_sections): Change handling of
12548 copy_relocs_.
12549 * Makefile.am (CCFILES): Add copy-relocs.cc.
12550 (HFILES): Add copy-relocs.h.
12551
12552 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12553
12554 * testsuite/script_test_4.sh: Permit leading zeroes.
12555
12556 2008-04-15 Ian Lance Taylor <iant@google.com>
12557
12558 * script-sections.cc (Script_sections::create_segments): Use
12559 header_size_adjustment even when there is enough room for the
12560 headers.
12561 * testsuite/script_test_4.sh: New file.
12562 * testsuite/script_test_4.t: New file.
12563 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12564 (check_DATA): Add script_test_4.stdout.
12565 (MOSTLYCLEANFILES): Likewise.
12566 (script_test_4): New target.
12567 (script_test_4.stdout): New target.
12568 * testsuite/Makefile.in: Rebuild.
12569
12570 * sparc.cc: Add definitions for Output_data_plt_sparc class
12571 constants.
12572
12573 2008-04-14 David S. Miller <davem@davemloft.net>
12574
12575 * sparc.cc: New file.
12576 * Makefile.am (TARGETSOURCES): Add sparc.cc
12577 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12578 * configure.tgt: Document targ_extra_size and
12579 targ_extra_big_endian. Add entries for sparc-* and
12580 sparc64-*.
12581 * configure.ac: Handle targ_extra_size and
12582 targ_extra_big_endian.
12583 * Makefile.in: Rebuild.
12584 * configure: Likewise.
12585 * po/POTFILES.in: Likewise.
12586 * po/gold.pot: Likewise.
12587
12588 2008-04-14 Ian Lance Taylor <iant@google.com>
12589
12590 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12591 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12592 in the name/type/flags to section mapping. Don't call
12593 allocate_output_section.
12594 (Layout::choose_output_section): Change parameter from adjust_name
12595 to is_input_section. Don't permit input sections after sections
12596 are attached to segments. Don't call allocate_output_section.
12597 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12598 not write_enable_output_section.
12599 (Layout::make_output_section): Don't push to
12600 unattached_section_list_ nor call attach_to_segment. Call
12601 attach_section_to_segment if sections are attached.
12602 (Layout::attach_sections_to_segments): New function.
12603 (Layout::attach_section_to_segment): New function.
12604 (Layout::attach_allocated_section_to_segment): Rename from
12605 attach_to_segment. Remove flags parameter.
12606 (Layout::allocate_output_section): Remove function.
12607 (Layout::write_enable_output_section): Remove function.
12608 * layout.h (class Layout): Update for above changes. Add new
12609 field sections_are_attached_.
12610 * output.h (Output_section::update_flags_for_input_section): New
12611 function.
12612 * output.cc (Output_section::add_input_section): Call
12613 update_flags_for_input_section.
12614 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12615
12616 2008-04-11 Cary Coutant <ccoutant@google.com>
12617
12618 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12619 thought unnecessary.
12620 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12621
12622 2008-04-11 Ian Lance Taylor <iant@google.com>
12623
12624 * output.h (class Output_section_data): Remove inline definition
12625 of set_addralign.
12626 * output.cc (Output_section_data::set_addralign): New function.
12627
12628 2008-04-11 Cary Coutant <ccoutant@google.com>
12629
12630 Add support for TLS descriptors for i386 and x86_64.
12631 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12632 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12633 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12634 GOT_TYPE_TLS_DESC.
12635 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12636 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12637 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12638 relocations.
12639 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12640 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12641 Fix problem with initial-exec relocations.
12642 (Target_i386::Relocate::relocate_tls): Likewise.
12643 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12644 relaxation.
12645 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12646 support for section-plus-offset dynamic table entries.
12647 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12648 (Output_data_dynamic::Dynamic_entry): Add support for
12649 section-plus-offset dynamic table entries.
12650 (Output_data_dynamic::Classification): Likewise.
12651 (Output_data_dynamic::classification_): Renamed offset_.
12652 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12653 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12654 (Target_x86_64::make_plt_section): New function.
12655 (Target_x86_64::reserve_tlsdesc_entries): New function.
12656 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12657 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12658 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12659 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12660 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12661 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12662 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12663 add extra PLT entry for TLS descriptors.
12664 (Output_data_plt_x86_64::got_): New field.
12665 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12666 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12667 fields.
12668 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12669 descriptors.
12670 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12671 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12672 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12673 R_386_TLS_DESC_CALL relocations.
12674 (Target_x86_64::Scan::global): Likewise.
12675 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12676 for TLS descriptors.
12677 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12678 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12679 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12680 GD-to-IE relaxation.
12681 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12682 and TLS_DESCRIPTORS.
12683 * Makefile.in: Rebuild.
12684 * configure: Rebuild.
12685 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12686 (tls_test_shared2.so): New target.
12687 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12688 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12689 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12690 (tls_shared_gd_to_ie_test_LDADD): New variable.
12691 (tls_shared_gnu2_gd_to_ie_test): New target.
12692 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12693 New targets.
12694 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12695 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12696 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12697 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12698 (tls_shared_gnu2_test): New target.
12699 (tls_test_gnu2_shared.so): New target.
12700 (tls_shared_gnu2_test_SOURCES): New variable.
12701 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12702 (tls_shared_gnu2_test_LDFLAGS): New variable.
12703 (tls_shared_gnu2_test_LDADD): New variable.
12704 * testsuite/Makefile.in: Rebuild.
12705 * testsuite/Makefile.
12706
12707 2008-04-11 Ian Lance Taylor <iant@google.com>
12708
12709 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12710 justsyms.t.
12711 * testsuite/Makefile.in: Rebuild.
12712
12713 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12714 long.
12715 * testsuite/script_test_2.cc (main): Adjust test.
12716
12717 2008-04-11 David S. Miller <davem@davemloft.net>
12718 Ian Lance Taylor <iant@google.com>
12719
12720 * options.h (General_options): Add entries for '-Y' and
12721 '-relax'.
12722 * options.cc (General_options:finalize): If -Y was used, add those
12723 entries to the library path instead of the default "/lib" and
12724 "/usr/lib".
12725
12726 2008-04-11 David S. Miller <davem@davemloft.net>
12727
12728 * testsuite/justsyms.t: Start at 0x100.
12729 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12730 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12731 long.
12732 * testsuite/script_test_2.cc: Adjust string and section length
12733 checks.
12734
12735 2008-04-09 Ian Lance Taylor <iant@google.com>
12736
12737 PR gold/5996
12738 * script-sections.cc (Sections_element::allocate_to_segment): Add
12739 orphan parameter.
12740 (Output_section_definition::allocate_to_segment): Likewise.
12741 (Orphan_output_section::allocate_to_segment): Likewise.
12742 (Script_sections::attach_sections_using_phdrs_clause): Don't
12743 propagate non-PT_LOAD segments to orphan sections.
12744 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12745 readelf rather than objdump.
12746 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12747 .interp section and PT_INTERP segment are the same size.
12748 * testsuite/Makefile.in: Rebuild.
12749
12750 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12751 aliases for symbols defined in the same object.
12752 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12753 (weak_alias_test_SOURCES): New variable.
12754 (weak_alias_test_DEPENDENCIES): New variable.
12755 (weak_alias_test_LDFLAGS): New variable.
12756 (weak_alias_test_LDADD): New variable.
12757 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12758 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12759 (weak_alias_test_3.o): New target.
12760 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12761 * testsuite/weak_alias_test_main.cc: New file.
12762 * testsuite/weak_alias_test_1.cc: New file.
12763 * testsuite/weak_alias_test_2.cc: New file.
12764 * testsuite/weak_alias_test_3.cc: New file.
12765
12766 2008-04-08 Ian Lance Taylor <iant@google.com>
12767
12768 * options.h (class General_options): Add --noinhibit-exec option.
12769 * main.cc (main): Check --noinhibit-exec.
12770
12771 * options.h (class General_options): Define --wrap as a special
12772 option. Add wrap_symbols_ field.
12773 (General_options::any_wrap_symbols): New function.
12774 (General_options::is_wrap_symbol): New function.
12775 * options.cc (General_options::parse_wrap): New function.
12776 (General_options::General_options): Initialize wrap_symbols_.
12777 * symtab.cc (Symbol_table::wrap_symbol): New function.
12778 (Symbol_table::add_from_object): Handle --wrap.
12779 * symtab.h (class Symbol_table): Declare wrap_symbol.
12780 * target.h (Target::wrap_char): New function.
12781 (Target::Target_info): Add wrap_char field.
12782 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12783 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12784 * testsuite/testfile.cc (Target_test::test_target_info):
12785 Likewise.
12786
12787 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12788 there is one.
12789
12790 * layout.h (class Layout): Add added_eh_frame_data_ field.
12791 * layout.cc (Layout::Layout): Initialize new field.
12792 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12793 output section until we find a section we merged successfully.
12794 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12795 that the size be non-zero.
12796
12797 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12798 qualifier.
12799
12800 2008-04-08 Craig Silverstein <csilvers@google.com>
12801
12802 * configure.ac: Export new conditional variable HAVE_ZLIB.
12803 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12804 on HAVE_ZLIB.
12805 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12806 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12807
12808 2008-04-07 Ian Lance Taylor <iant@google.com>
12809
12810 * version.cc (version_string): Set to "1.5".
12811
12812 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12813 Add issued_non_pic_error_ field. Declare check_non_pic.
12814 (Target_x86_64::Scan::check_non_pic): New function.
12815 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12816 (Target_x86_64::Scan::global): Likewise.
12817
12818 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12819 addend parameter. Change caller. Handle merge sections.
12820 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12821 Address to Addend. Don't add in the result of
12822 local_section_offset, pass down the addend and use the returned
12823 value.
12824 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12825 Update declarations of local_section_offset and symbol_value.
12826 * testsuite/two_file_test_1.cc (t18): New function.
12827 * testsuite/two_file_test_2.cc (f18): New function.
12828 * testsuite/two_file_test_main.cc (main): Call t18.
12829 * testsuite/two_file_test.h (t18, f18): Declare.
12830
12831 * configure.ac: Don't test for objdump, c++filt, or readelf.
12832 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12833 conditionals.
12834 (TEST_READELF): New variable.
12835 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12836 (check_PROGRAMS): Add two_file_strip_test.
12837 (two_file_strip_test): New target.
12838 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12839 (two_file_same_shared_strip_test_SOURCES): New variable.
12840 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12841 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12842 (two_file_same_shared_strip_test_LDADD): New variable.
12843 (two_file_shared_strip.so): New target.
12844 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12845 (ver_test_5.syms, ver_test_7.syms): Likewise.
12846 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12847 (strip_test_3.stdout): Use TEST_OBJDUMP.
12848 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12849
12850 2008-04-04 Cary Coutant <ccoutant@google.com>
12851
12852 * symtab.h (Symbol::is_weak_undefined): New function.
12853 (Symbol::is_strong_undefined): New function.
12854 (Symbol::is_absolute): New function.
12855 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12856 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12857 absolute symbols.
12858 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12859 (weak_undef_test): New target.
12860 * testsuite/Makefile.in: Rebuild.
12861 * testsuite/weak_undef_file1.cc: New file.
12862 * testsuite/weak_undef_file2.cc: New file.
12863 * testsuite/weak_undef_test.cc: New file.
12864
12865 2008-04-03 Craig Silverstein <csilvers@google.com>
12866
12867 * compressed_output.h (class Output_compressed_section): Use
12868 unsigned buffer.
12869 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12870 add zlib header.
12871 (zlib_compressed_suffix): Removed.
12872 (Output_compressed_section::set_final_data_size): Use unsigned
12873 buffers.
12874 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12875 Fix linker invocation.
12876 (flagstest_o_specialfile_and_compress_debug_sections):
12877 Likewise.
12878 * testsuite/Makefile.in: Regenerated.
12879
12880 2008-04-02 David S. Miller <davem@davemloft.net>
12881
12882 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12883 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12884
12885 2008-04-02 Craig Silverstein <csilvers@google.com>
12886
12887 * TODO: New file.
12888
12889 2008-04-02 Ian Lance Taylor <iant@google.com>
12890
12891 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12892 parameters. Update for new key type to views_. Change all
12893 callers.
12894 (File_read::read): Adjust for byteshift in returned view.
12895 (File_read::add_view): New function, broken out of
12896 find_and_make_view.
12897 (File_read::make_view): New function, broken out of
12898 find_and_make_view.
12899 (File_read::find_or_make_view): Add offset and aligned
12900 parameters. Rewrite accordingly. Change all callers.
12901 (File_read::get_view): Add offset and aligned parameters. Adjust
12902 for byteshift in return value.
12903 (File_read::get_lasting_view): Likewise.
12904 * fileread.h (class File_read): Update declarations.
12905 (class File_read::View): Add byteshift_ field. Add byteshift to
12906 constructor. Add byteshift method.
12907 * archive.h (Archive::clear_uncached_views): New function.
12908 (Archive::get_view): Add aligned parameter. Change all callers.
12909 * object.h (Object::get_view): Add aligned parameter. Change all
12910 callers.
12911 (Object::get_lasting_view): Likewise.
12912
12913 * fileread.cc (File_read::release): Don't call clear_views if
12914 there are multiple objects.
12915 * fileread.h (File_read::clear_uncached_views): New function.
12916 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12917 on the archive.
12918
12919 2008-03-31 Cary Coutant <ccoutant@google.com>
12920
12921 Add thin archive support.
12922 * archive.cc (Archive::armagt): New const.
12923 (Archive::setup): Remove task parameter and calls to unlock.
12924 (Archive::unlock_nested_archives): New function.
12925 (Archive::read_header): Add nested_off parameter. Change
12926 all callers.
12927 (Archive::interpret_header): Likewise.
12928 (Archive::include_all_members): Change to handle thin
12929 archives.
12930 (Archive::include_member): Likewise.
12931 * archive.h (Archive::Archive): Add new parameters and
12932 initializers.
12933 (Archive::armagt): New const.
12934 (Archive::setup): Remove task parameter.
12935 (Archive::unlock_nested_archives): New function.
12936 (Archive::read_header): Add nested_off parameter.
12937 (Archive::interpret_header): Likewise.
12938 (Archive::Nested_archive_table): New typedef.
12939 (Archive::is_thin_archive_): New field.
12940 (Archive::nested_archives_): New field.
12941 (Archive::options_): New field.
12942 (Archive::dirpath_): New field.
12943 (Archive::task_): New field.
12944 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12945 for thin archives. Pass additional parameters to
12946 Archive::Archive. Unlock the archive file after calling
12947 Archive::setup.
12948
12949 2008-03-29 Ian Lance Taylor <iant@google.com>
12950
12951 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12952 version symbol to be local.
12953 * testsuite/ver_test_4.sh: New file.
12954 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12955 (check_DATA): Add ver_test_4.syms.
12956 (ver_test_4.syms): New target.
12957 * testsuite/Makefile.in: Rebuild.
12958
12959 * output.cc
12960 (Output_section::Input_section_sort_entry::has_priority): New
12961 function.
12962 (Output_section::Input_section_sort_entry::match_file_name): New
12963 function.
12964 (Output_section::Input_section_sort_entry::match_section_name):
12965 Remove.
12966 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12967 Remove.
12968 (Output_section::Input_section_sort_entry::match_section_file):
12969 Remove.
12970 (Output_section::Input_section_sort_compare::operator()): Rewrite
12971 using new Input_section_sort_entry functions. Sort crtbegin and
12972 crtend first. Sort sections with no priority before sections with
12973 a priority.
12974 * testsuite/initpri1.c (d3): Check j != 4.
12975 (cd5): New constructor/destructor function.
12976 (main): Check j != 2.
12977
12978 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12979 new symbol when resolving, don't call set_is_default.
12980 * testsuite/ver_test_7.cc: New file.
12981 * testsuite/ver_test_7.sh: New file.
12982 * testsuite/Makefile.am (ver_test_7.so): New target.
12983 (ver_test_7.o): New target.
12984 (check_SCRIPTS): Add ver_test_7.sh.
12985 (check_DATA): Add ver_test_7.syms.
12986 (ver_test_7.syms): New target.
12987
12988 2008-03-28 Ian Lance Taylor <iant@google.com>
12989
12990 * layout.cc (Layout::layout): If we see an input section with a
12991 name that needs sorting, set the must_sort flag for the output
12992 section.
12993 (Layout::make_output_section): If the name of the output section
12994 indicates that it might require sorting, set the may_sort flag.
12995 * output.h (Output_section::may_sort_attached_input_sections): New
12996 function.
12997 (Output_section::set_may_sort_attached_input_sections): New
12998 function.
12999 (Output_section::must_sort_attached_input_sections): New
13000 function.
13001 (Output_section::set_must_sort_attached_input_sections): New
13002 function.
13003 (class Output_section): Declare Input_section_sort_entry. Define
13004 Input_section_sort_compare. Declare
13005 sort_attached_input_sections. Add new fields:
13006 may_sort_attached_input_sections_,
13007 must_sort_attached_input_sections_,
13008 attached_input_sections_are_sorted_.
13009 * output.cc (Output_section::Output_section): Initialize new
13010 fields.
13011 (Output_section::add_input_section): Add an entry to
13012 input_sections_ if may_sort or must_sort are true.
13013 (Output_section::set_final_data_size): Call
13014 sort_attached_input_sections if necessary.
13015 (Output_section::Input_section_sort_entry): Define new class.
13016 (Output_section::Input_section_sort_compare::operator()): New
13017 function.
13018 (Output_section::sort_attached_input_sections): New function.
13019 * configure.ac: Check whether the compiler supports constructor
13020 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13021 * testsuite/initpri1.c: New file.
13022 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13023 CONSTRUCTOR_PRIORITY.
13024 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13025 (initpri1_LDFLAGS): New variable.
13026 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13027
13028 2008-03-27 Ian Lance Taylor <iant@google.com>
13029
13030 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13031 * testsuite/common_test_1.c: New file.
13032 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13033 (common_test_1_SOURCES): New variable.
13034 (common_test_1_DEPENDENCIES): New variable.
13035 (common_test_1_LDFLAGS): New variable.
13036
13037 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13038 and commons_ correctly when NAME/VERSION does not override
13039 NAME/NULL.
13040 * testsuite/ver_test_6.c: New file.
13041 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13042 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13043 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13044
13045 2008-03-26 Ian Lance Taylor <iant@google.com>
13046
13047 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13048 of an undefined symbol from a version script.
13049 * testsuite/Makefile.am (ver_test_5.so): New target.
13050 (ver_test_5.o): New target.
13051 (check_SCRIPTS): Add ver_test_5.sh.
13052 (check_DATA): Add ver_test_5.syms.
13053 (ver_test_5.syms): New target.
13054 * testsuite/ver_test_5.cc: New file.
13055 * testsuite/ver_test_5.script: New file.
13056 * testsuite/ver_test_5.sh: New file.
13057 * Makefile.in, testsuite/Makefile.in: Rebuild.
13058
13059 PR gold/5986
13060 Fix problems building gold with gcc 4.3.0.
13061 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13062 (gold_error_at_location, gold_warning_at_location): Use it.
13063 * configure.ac: Check whether we can compile and use a template
13064 function with a printf attribute.
13065 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13066 when jumping over bytes.
13067 * object.cc: Instantiate Object::read_section_data.
13068 * debug.h: Include <cstring>
13069 * dwarf_reader.cc: Include <algorithm>
13070 * main.cc: Include <cstring>.
13071 * options.cc: Include <cstring>.
13072 * output.cc: Include <cstring>.
13073 * script.cc: Include <cstring>.
13074 * script.h: Include <string>.
13075 * symtab.cc: Include <cstring> and <algorithm>.
13076 * target-select.cc: Include <cstring>.
13077 * version.cc: Include <string>.
13078 * testsuite/testmain.cc: Include <cstdlib>.
13079 * configure, config.in: Rebuild.
13080
13081 2008-03-25 Ian Lance Taylor <iant@google.com>
13082
13083 * options.cc: Include "../bfd/bfdver.h".
13084 (options::help): Print bug reporting address.
13085
13086 * version.cc (print_version): Adjust output for current value of
13087 BFD_VERSION_STRING.
13088
13089 * NEWS: New file.
13090
13091 * options.cc (options::help): Print list of supported targets.
13092 * target-select.h: Include <vector>.
13093 (class Target_selector): Make machine_, size_, and is_big_endian_
13094 fields const. Add bfd_name_ and instantiated_target_ fields.
13095 (Target_selector::Target_selector): Add bfd_name parameter.
13096 (Target_selector::recognize): Make non-virtual, call
13097 do_recognize.
13098 (Target_selector::recognize_by_name): Make non-virtual, call
13099 do_recognize_by_name.
13100 (Target_selector::supported_names): New function.
13101 (Target_selector::bfd_name): New function.
13102 (Target_selector::do_instantiate_target): New pure virtual
13103 function.
13104 (Target_selector::do_recognize): New virtual function.
13105 (Target_selector::do_recognize_by_name): New virtual function.
13106 (Target_selector::instantiate_target): New private function.
13107 (supported_target_names): Declare.
13108 * target-select.cc (Target_selector::Target_selector): Update for
13109 new parameter and fields.
13110 (select_target_by_name): Check that the name matches before
13111 calling recognize_by_name.
13112 (supported_target_names): New function.
13113 * i386.cc (class Target_selector_i386): Update Target_selector
13114 constructor call. Remove recognize and recognize_by_name. Add
13115 do_instantiate_target.
13116 * x86_64.cc (class Target_selector_x86_64): Likewise.
13117 * testsuite/testfile.cc (class Target_selector_test): Update for
13118 changes to Target_selector.
13119
13120 * README: Rewrite, with some notes on unsupported features.
13121
13122 2008-03-24 Cary Coutant <ccoutant@google.com>
13123
13124 * i386.cc (Target_i386::Got_type): New enum declaration.
13125 (Target_i386::Scan::local): Updated callers of Output_data_got
13126 member functions.
13127 (Target_i386::Scan::global): Likewise.
13128 (Target_i386::Relocate::relocate): Likewise.
13129 (Target_i386::Relocate::relocate_tls): Likewise.
13130 * object.h (Got_offset_list): New class.
13131 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13132 (Sized_relobj::local_got_offset): Likewise.
13133 (Sized_relobj::set_local_got_offset): Likewise.
13134 (Sized_relobj::local_has_tls_got_offset): Removed.
13135 (Sized_relobj::local_tls_got_offset): Removed.
13136 (Sized_relobj::set_local_tls_got_offset): Removed.
13137 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13138 * output.cc (Output_data_got::add_global): Added got_type parameter.
13139 (Output_data_got::add_global_with_rel): Likewise.
13140 (Output_data_got::add_global_with_rela): Likewise.
13141 (Output_data_got::add_global_pair_with_rel): New function.
13142 (Output_data_got::add_global_pair_with_rela): New function.
13143 (Output_data_got::add_local): Added got_type parameter.
13144 (Output_data_got::add_local_with_rel): Likewise.
13145 (Output_data_got::add_local_with_rela): Likewise.
13146 (Output_data_got::add_local_pair_with_rel): New function.
13147 (Output_data_got::add_local_pair_with_rela): New function.
13148 (Output_data_got::add_global_tls): Removed.
13149 (Output_data_got::add_global_tls_with_rel): Removed.
13150 (Output_data_got::add_global_tls_with_rela): Removed.
13151 (Output_data_got::add_local_tls): Removed.
13152 (Output_data_got::add_local_tls_with_rel): Removed.
13153 (Output_data_got::add_local_tls_with_rela): Removed.
13154 * output.h (Output_data_got::add_global): Added got_type parameter.
13155 (Output_data_got::add_global_with_rel): Likewise.
13156 (Output_data_got::add_global_with_rela): Likewise.
13157 (Output_data_got::add_global_pair_with_rel): New function.
13158 (Output_data_got::add_global_pair_with_rela): New function.
13159 (Output_data_got::add_local): Added got_type parameter.
13160 (Output_data_got::add_local_with_rel): Likewise.
13161 (Output_data_got::add_local_with_rela): Likewise.
13162 (Output_data_got::add_local_pair_with_rel): New function.
13163 (Output_data_got::add_local_pair_with_rela): New function.
13164 (Output_data_got::add_global_tls): Removed.
13165 (Output_data_got::add_global_tls_with_rel): Removed.
13166 (Output_data_got::add_global_tls_with_rela): Removed.
13167 (Output_data_got::add_local_tls): Removed.
13168 (Output_data_got::add_local_tls_with_rel): Removed.
13169 (Output_data_got::add_local_tls_with_rela): Removed.
13170 * resolve.cc (Symbol::override_base_with_special): Removed
13171 reference to has_got_offset_ field.
13172 * symtab.cc (Symbol::init_fields): Replaced initialization
13173 of got_offset_ with got_offsets_. Removed initialization
13174 of has_got_offset_
13175 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13176 (Symbol::got_offset): Likewise.
13177 (Symbol::set_got_offset): Likewise.
13178 (Symbol::has_tls_got_offset): Removed.
13179 (Symbol::tls_got_offset): Removed.
13180 (Symbol::set_tls_got_offset): Removed.
13181 (Symbol::got_offset_): Removed.
13182 (Symbol::tls_mod_got_offset_): Removed.
13183 (Symbol::tls_pair_got_offset_): Removed.
13184 (Symbol::got_offsets_): New field.
13185 (Symbol::has_got_offset): Removed.
13186 (Symbol::has_tls_mod_got_offset): Removed.
13187 (Symbol::has_tls_pair_got_offset): Removed.
13188 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13189 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13190 member functions.
13191 (Target_x86_64::Scan::global): Likewise.
13192 (Target_x86_64::Relocate::relocate): Likewise.
13193 (Target_x86_64::Relocate::relocate_tls): Likewise.
13194
13195 2008-03-25 Ben Elliston <bje@au.ibm.com>
13196
13197 * yyscript.y: Fix spelling error in comment.
13198
13199 2008-03-24 Ian Lance Taylor <iant@google.com>
13200
13201 * options.h (class General_options): Define build_id option.
13202 * layout.h (class Layout): Declare write_build_id, create_note,
13203 create_build_id. Add build_id_note_ member.
13204 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13205 "libiberty.h", "md5.h", "sha1.h".
13206 (Layout::Layout): Initialize eh_frame_data_,
13207 eh_frame_hdr_section_, and build_id_note_.
13208 (Layout::finalize): Call create_build_id.
13209 (Layout::create_note): New function, broken out of
13210 Layout::create_gold_note.
13211 (Layout::create_gold_note): Call create_note.
13212 (Layout::create_build_id): New function.
13213 (Layout::write_build_id): New function.
13214 (Close_task_runner::run): Call write_build_id.
13215
13216 * x86_64.cc: Correct license to GPLv3.
13217
13218 2008-03-23 Ian Lance Taylor <iant@google.com>
13219
13220 * options.cc: Include "demangle.h".
13221 (parse_optional_string): New function.
13222 (parse_long_option): Handle takes_optional_argument.
13223 (parse_short_option): Update dash_z initializer. Handle
13224 takes_optional_argument.
13225 (General_options::General_options): Initialize do_demangle_.
13226 (General_options::finalize): Set do_demangle_. Handle demangling
13227 style.
13228 * options.h (parse_optional_string): Declare.
13229 (struct One_option): Add optional_arg field. Update constructor.
13230 Update call constructor calls. Add takes_optional_argument
13231 function.
13232 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13233 (DEFINE_optional_string): Define.
13234 (General_options::demangle): Change from DEFINE_bool to
13235 DEFINE_optional_string.
13236 (General_options::no_demangle): New function.
13237 (General_options::do_demangle): New function.
13238 (General_options::set_do_demangle): New function.
13239 (General_options::execstack_status_): Move definition to end of
13240 class definition.
13241 (General_options::static_): Likewise.
13242 (General_options::do_demangle_): New field.
13243 * object.cc (big_endian>::get_symbol_location_info): Call
13244 Options::do_demangle, not Options::demangle.
13245 * symtab.cc (demangle): Likewise.
13246
13247 2008-03-22 Ian Lance Taylor <iant@google.com>
13248
13249 * gold.h: Include <cstddef> and <sys/types.h>
13250 * options.h: Include <cstring>.
13251
13252 2008-03-21 Ian Lance Taylor <iant@google.com>
13253
13254 * Added source code to GNU binutils.
This page took 0.290254 seconds and 5 git commands to generate.