1 2012-05-14 Cary Coutant <ccoutant@google.com>
3 * layout.cc (Layout::make_output_section): Mark .tdata section
5 * testsuite/relro_test.cc: Add a TLS variable.
7 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
10 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
11 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
14 2012-05-08 Cary Coutant <ccoutant@google.com>
16 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
17 (lines_only_debug_sections): Likewise.
19 2012-05-02 Roland McGrath <mcgrathr@google.com>
23 * Makefile.am (CCFILES, HFILES): Add them.
24 * Makefile.in: Regenerate.
25 * i386.cc (Output_data_plt_i386_nacl): New class.
26 (Output_data_plt_i386_nacl_exec): New class.
27 (Output_data_plt_i386_nacl_dyn): New class.
28 (Target_i386_nacl): New class.
29 (Target_selector_i386_nacl): New class.
30 (target_selector_i386): Use it instead of Target_selector_i386.
31 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
32 (Target_x86_64_nacl): New class.
33 (Target_selector_x86_64_nacl): New class.
34 (target_selector_x86_64, target_selector_x32): Use it instead of
35 Target_selector_x86_64.
36 * arm.cc (Output_data_plt_arm_nacl): New class.
37 (Target_arm_nacl): New class.
38 (Target_selector_arm_nacl): New class.
39 (target_selector_arm, target_selector_armbe): Use it instead of
42 * target-select.cc (select_target): Take new Input_file* and off_t
43 arguments, pass them on to recognize method of selector.
44 * object.cc (make_elf_sized_object): Update caller.
45 * parameters.cc (parameters_force_valid_target): Likewise.
46 * incremental.cc (make_sized_incremental_binary): Likewise.
47 * target-select.h: Update decl.
48 (Target_selector::recognize): Take new Input_file* argument,
49 pass it on to do_recognize.
50 (Target_selector::do_recognize): Take new Input_file* argument.
51 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
52 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
53 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
54 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
56 * target.h (Target::Target_info): New members isolate_execinstr
58 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
59 * arm.cc (Target_arm::arm_info): Update initializer.
60 * i386.cc (Target_i386::i386_info): Likewise.
61 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
62 * sparc.cc (Target_sparc::sparc_info): Likewise.
63 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
64 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
65 * layout.cc (Layout::attach_allocated_section_to_segment):
66 Take new const Target* argument. If target->isolate_execinstr(), act
68 (Layout::find_first_load_seg): Take new const Target* argument;
69 if target->isolate_execinstr(), reject PF_X segments.
70 (Layout::relaxation_loop_body): Update caller.
71 (Layout::set_segment_offsets): If target->isolate_execinstr(),
72 reset file offset to zero when we hit LOAD_SEG, and then do a second
73 loop over the segments before LOAD_SEG to reassign offsets after
74 addresses have been determined. Handle target->rosegment_gap().
75 (Layout::attach_section_to_segment): Take new const Target* argument;
76 pass it to attach_allocated_section_to_segment.
77 (Layout::make_output_section): Update caller.
78 (Layout::attach_sections_to_segments): Take new const Target* argument;
79 pass it to attach_section_to_segment.
80 * gold.cc (queue_middle_tasks): Update caller.
81 * layout.h (Layout): Update method decls with new arguments.
83 * arm.cc (Target_arm::Target_arm): Take optional argument for the
84 Target_info pointer to use.
85 (Target_arm::do_make_data_plt): New virtual method.
86 (Target_arm::make_data_plt): New method that calls it.
87 (Target_arm::make_plt_entry): Use it.
88 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
89 for the section alignment.
90 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
92 (Output_data_plt_arm::first_plt_entry_offset): Call it.
93 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
95 (Output_data_plt_arm::get_plt_entry_size): Call it.
96 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
97 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
98 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
100 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
101 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
102 method instead of sizeof(plt_entry).
103 (Output_data_plt_arm::add_entry): Likewise.
104 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
105 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
107 (Target_arm::plt_entry_size): Likewise.
108 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
110 (Output_data_plt_arm_standard): ... here, new class.
111 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
112 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
113 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
115 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
116 Take additional argument for the PLT entry size.
117 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
118 Use get_plt_entry_size method rather than plt_entry_size variable.
119 (Output_data_plt_x86_64::reserve_slot): Likewise.
120 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
121 (Output_data_plt_x86_64::add_entry): Likewise.
122 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
123 (Output_data_plt_x86_64::address_for_global): Likewise.
124 (Output_data_plt_x86_64::address_for_local): Likewise.
125 (Output_data_plt_x86_64::set_final_data_size): Likewise.
126 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
127 Make method non-static.
128 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
130 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
131 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
132 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
133 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
135 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
136 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
138 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
139 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
141 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
142 (Output_data_plt_x86_64::plt_entry_size)
143 (Output_data_plt_x86_64::first_plt_entry)
144 (Output_data_plt_x86_64::plt_entry)
145 (Output_data_plt_x86_64::tlsdesc_plt_entry)
146 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
147 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
148 (Output_data_plt_x86_64_standard): ... here, new class.
149 (Target_x86_64::Target_x86_64): Take optional argument for the
150 Target_info pointer to use.
151 (Target_x86_64::do_make_data_plt): New virtual method.
152 (Target_x86_64::make_data_plt): New method to call it.
153 (Target_x86_64::init_got_plt_for_update): Use that.
154 Call this->plt_->add_eh_frame method here.
155 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
156 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
157 rather than static method.
158 (Target_x86_64::plt_entry_size): Likewise.
159 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
160 rather than plt_entry_size variable. Move guts of PLT filling to...
161 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
162 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
163 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
165 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
166 additional argument for the section alignment.
167 Don't do add_eh_frame_for_plt here.
168 (Output_data_plt_i386::first_plt_entry_offset): Make the method
169 non-static. Use get_plt_entry_size method rather than plt_entry_size
171 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
173 (Output_data_plt_i386::get_plt_entry_size): Call it.
174 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
175 (Output_data_plt_i386::add_eh_frame): New method to call it.
176 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
178 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
179 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
181 (Output_data_plt_i386::fill_plt_entry): New method to call it.
182 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
183 method instead of plt_entry_size.
184 (Output_data_plt_i386::plt_entry_size)
185 (Output_data_plt_i386::plt_eh_frame_fde_size)
186 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
187 (Output_data_plt_i386_standard): ... here, new class.
188 (Output_data_plt_i386_exec): New class.
189 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
190 (Output_data_plt_i386_exec::first_plt_entry): ... here.
191 (Output_data_plt_i386::exec_plt_entry): Move to ...
192 (Output_data_plt_i386_exec::plt_entry): ... here.
193 (Output_data_plt_i386_dyn): New class.
194 (Output_data_plt_i386::first_plt_entry): Move to ...
195 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
196 (Output_data_plt_i386::dyn_plt_entry): Move to ...
197 (Output_data_plt_i386_dyn::plt_entry): ... here.
198 (Target_i386::Target_i386): Take optional argument for the Target_info
200 (Target_i386::do_make_data_plt): New virtual method.
201 (Target_i386::make_data_plt): New method to call it.
202 (Target_i386::make_plt_section): Use that.
203 Call this->plt_->add_eh_frame method here.
204 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
205 rather than plt_entry_size variable.
206 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
207 (Output_data_plt_i386::address_for_local): Likewise.
208 (Output_data_plt_i386::do_write): Likewise.
209 Move guts of PLT filling to...
210 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
211 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
212 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
213 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
215 2012-05-01 Cary Coutant <ccoutant@google.com>
217 * dwarf_reader.cc (Dwarf_die::read_attributes)
218 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
219 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
220 * reduced_debug_output.cc
221 (Output_reduced_debug_info_section::get_die_end): Remove
222 DW_FORM_GNU_ref_index. Add default case.
224 2012-04-26 Mark Wielaard <mjw@redhat.com>
226 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
227 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
228 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
229 DW_AT_high_pc as offset from DW_AT_low_pc.
231 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
232 * testsuite/Makefile.in: Regenerate.
233 * testsuite/gdb_index_test_3.c: New test source file.
234 * testsuite/gdb_index_test_3.sh: New test source file.
236 2012-04-25 Ian Lance Taylor <iant@google.com>
238 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
240 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
241 as a class, not a struct.
242 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
243 (Target_arm::apply_cortex_a8_workaround): Likewise.
244 * gc.h: Declare Reloc_types as a struct, not a class.
245 * object.h: Declare Symbols_data as a struct.
246 * reloc.h: Declare Read_relocs_data as a struct.
247 * target.h: Declare Relocate_info as a struct.
249 2012-04-24 David S. Miller <davem@davemloft.net>
251 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
252 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
255 2012-04-24 Cary Coutant <ccoutant@google.com>
257 * incremental-dump.cc (find_input_containing_global): Replace
258 magic number with symbolic constant.
259 (dump_incremental_inputs): Update version number.
260 * incremental.cc (Output_section_incremental_inputs): Update version
261 number; import symbolic constants from Incremental_inputs_reader.
262 (Incremental_inputs::create_data_sections): Align relocations
263 section correctly for 64-bit targets.
264 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
265 constants; add padding.
266 (Output_section_incremental_inputs::write_header): Add assert for
268 (Output_section_incremental_inputs::write_input_files): Add assert
269 for input_entry_size.
270 (Output_section_incremental_inputs::write_info_blocks): Add padding;
271 add assert for object_info_size, input_section_entry_size,
272 global_sym_entry_size.
273 * incremental.h (Incremental_inputs_reader): Add symbolic constants
274 for data structure sizes; use them.
275 (Incremental_input_entry_reader): Import symbolic constants from
276 Incremental_inputs_reader; use them.
278 2012-04-23 David S. Miller <davem@davemloft.net>
280 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
282 (Target_sparc::Target_sparc): Initialize new fields.
283 (Target_sparc::do_make_elf_object): New function.
284 (Target_sparc::do_adjust_elf_header): New function.
286 2012-04-23 Cary Coutant <ccoutant@google.com>
288 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
289 CU range table of gdb index.
291 2012-04-20 David S. Miller <davem@davemloft.net>
293 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
296 2012-04-16 David S. Miller <davem@davemloft.net>
298 * sparc.cc (Target_sparc::got_address): New function.
299 (Sparc_relocate_functions::gdop_hix22): New function.
300 (Sparc_relocate_functions::gdop_lox10): New function.
301 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
303 (Target_sparc::Scan::local): Likewise if the global symbol is not
304 preemptible and is not IFUNC.
305 (Target_sparc::Relocate::relocate): Perform GOTDATA code
306 transformations for local and non-preemptible non-IFUNC global
309 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
310 writing out 64-bit part of ranges.
312 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
313 -fpic and -fpie respectively.
314 * Makefile.in: Regenerate.
316 * sparc.cc (class Target_sparc): Add rela_ifunc_.
317 (Target_sparc::Target_sparc): Initialize new field.
318 (Target_sparc::do_plt_section_for_global): New function.
319 (Target_sparc::do_plt_section_for_local): New function.
320 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
321 (Target_sparc::make_plt_section): New function, broken out of
322 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
323 (Target_sparc::make_plt_entry): Call make_plt_section.
324 (Target_sparc::make_local_ifunc_plt_entry): New function.
325 (Target_sparc::rela_ifunc_section): New function.
326 (Target_sparc::plt_section): Remove const.
327 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
328 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
329 and ifunc_count_ fields.
330 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
331 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
332 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
333 (Output_data_plt_sparc::rela_ifunc): New function.
334 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
335 (Output_data_plt_sparc::has_ifunc_section): New function.
336 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
337 (Output_data_plt_sparc::address_for_global): New function.
338 (Output_data_plt_sparc::address_for_local): New function.
339 (Output_data_plt_sparc::plt_index_to_offset): New function.
340 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
342 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
344 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
345 R_SPARC_JMP_IREL to switch.
346 (Target_sparc::Scan::check_non_pic): Likewise.
347 (Target_sparc::Scan::local): Handle IFUNC symbols.
348 (Target_sparc::Scan::local): Likewise.
349 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
350 and plt_address_for_local.
351 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
352 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
354 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
355 (class Output_data_reloc): Adjust calls to Output_reloc_type.
356 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
357 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
359 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
360 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
362 * sparc.cc (Target_sparc::Scan::global): Likewise.
363 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
365 2012-04-16 Cary Coutant <ccoutant@google.com>
367 * archive.cc (Library_base::should_include_member): Check for
368 --export-dynamic-symbol.
369 * options.h (class General_options): Add --export-dynamic-symbol.
370 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
371 --export-dynamic-symbol.
372 (Symbol_table::gc_mark_undef_symbols): Likewise.
373 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
375 2012-04-12 David S. Miller <davem@davemloft.net>
377 * sparc.cc (Reloc::wdisp10): New relocation method.
378 (Reloc::h34): Likewise.
379 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
380 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
382 (Target_sparc::Scan::local): Likewise.
383 (Target_sparc::Scan::global): Likewise.
384 (Target_sparc::Relocate::relocate): Likewise.
386 2012-04-09 Cary Coutant <ccoutant@google.com>
388 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
391 2012-04-06 Ian Lance Taylor <iant@google.com>
393 * timer.cc: #include <unistd.h>.
395 2012-04-06 Roland McGrath <mcgrathr@google.com>
397 * configure.in (AC_CHECK_HEADERS): Add locale.h.
398 * config.in: Regenerate.
399 * configure: Regenerate.
401 2012-04-05 Nick Clifton <nickc@redhat.com>
403 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
404 (AM_LC_MESSAGES): Add.
405 * aclocal.m4: Regenerate.
406 * config.in: Regenerate.
407 * configure: Regenerate.
409 2012-03-21 Cary Coutant <ccoutant@google.com>
411 * Makefile.am: Add gdb-index.cc, gdb-index.h.
412 * Makefile.in: Regenerate.
413 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
414 (Sized_elf_reloc_mapper::symbol_section): New function.
415 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
416 (make_elf_reloc_mapper): New function.
417 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
418 (Dwarf_abbrev_table::do_read_abbrevs): New function.
419 (Dwarf_abbrev_table::do_get_abbrev): New function.
420 (Dwarf_ranges_table::read_ranges_table): New function.
421 (Dwarf_ranges_table::read_range_list): New function.
422 (Dwarf_pubnames_table::read_section): New function.
423 (Dwarf_pubnames_table::read_header): New function.
424 (Dwarf_pubnames_table::next_name): New function.
425 (Dwarf_die::Dwarf_die): New function.
426 (Dwarf_die::read_attributes): New function.
427 (Dwarf_die::skip_attributes): New function.
428 (Dwarf_die::set_name): New function.
429 (Dwarf_die::set_linkage_name): New function.
430 (Dwarf_die::attribute): New function.
431 (Dwarf_die::string_attribute): New function.
432 (Dwarf_die::int_attribute): New function.
433 (Dwarf_die::uint_attribute): New function.
434 (Dwarf_die::ref_attribute): New function.
435 (Dwarf_die::child_offset): New function.
436 (Dwarf_die::sibling_offset): New function.
437 (Dwarf_info_reader::check_buffer): New function.
438 (Dwarf_info_reader::parse): New function.
439 (Dwarf_info_reader::do_parse): New function.
440 (Dwarf_info_reader::do_read_string_table): New function.
441 (Dwarf_info_reader::lookup_reloc): New function.
442 (Dwarf_info_reader::get_string): New function.
443 (Dwarf_info_reader::visit_compilation_unit): New function.
444 (Dwarf_info_reader::visit_type_unit): New function.
445 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
446 Sized_elf_reloc_mapper.
447 (Sized_dwarf_line_info::symbol_section): Remove function.
448 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
449 (Sized_dwarf_line_info::read_line_mappings): Remove object
450 parameter, adjust callers.
451 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
452 * dwarf_reader.h: Include <sys/types.h>.
453 (class Track_relocs): Remove forward declaration.
454 (class Elf_reloc_mapper): New class.
455 (class Sized_elf_reloc_mapper): New class.
456 (class Dwarf_abbrev_table): New class.
457 (class Dwarf_range_list): New class.
458 (class Dwarf_ranges_table): New class.
459 (class Dwarf_pubnames_table): New class.
460 (class Dwarf_die): New class.
461 (class Dwarf_info_reader): New class.
462 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
463 (Sized_dwarf_line_info::symbol_section): Remove member function.
464 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
466 * gdb-index.cc: New source file.
467 * gdb-index.h: New source file.
468 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
469 and .debug_types sections, call Layout::add_to_gdb_index.
470 (Sized_relobj_incr::do_section_name): Implement.
471 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
472 return type; Implement.
473 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
475 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
476 parameter list and return type.
477 (Sized_incr_dynobj::do_section_contents): Likewise.
478 * layout.cc: Include gdb-index.h.
479 (Layout::Layout): Initialize gdb_index_data_.
480 (Layout::init_fixed_output_section): Check for .gdb_index section.
481 (Layout::add_to_gdb_index): New function. Instantiate.
482 * layout.h: Add forward declaration for class Gdb_index.
483 (Layout::add_to_gdb_index): New member function.
484 (Layout::gdb_index_data_): New data member.
485 * main.cc: Include gdb-index.h.
486 (main): Print statistics for gdb index.
487 * object.cc (Object::section_contents): Move code into
489 (need_decompressed_section): Check for sections needed when building
491 (build_compressed_section_map): Likewise.
492 (Sized_relobj_file::do_read_symbols): Need local symbols when building
494 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
495 sections; call Layout::add_to_gdb_index.
496 (Sized_relobj_file::do_decompressed_section_contents): Call
497 do_section_contents directly.
498 * object.h (Object::do_section_contents): Adjust parameter list and
500 (Object::do_decompressed_section_contents): Call do_section_contents
502 (Sized_relobj_file::do_section_contents): Adjust parameter list and
504 * options.h (class General_options): Add --gdb-index option.
505 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
506 list and return type.
507 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
508 * reloc.h (Track_relocs::checkpoint): New function.
509 (Track_relocs::reset): New function.
511 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
513 * testsuite/Makefile.in: Regenerate.
514 * testsuite/gdb_index_test.cc: New test source file.
515 * testsuite/gdb_index_test_1.sh: New test source file.
516 * testsuite/gdb_index_test_2.sh: New test source file.
518 2012-03-19 Doug Kwan <dougkwan@google.com>
520 * arm.cc (Target_arm::do_define_standard_symbols): New method.
521 (Target_arm::do_finalize_sections): Remove code which defines
522 __exidx_start and __exidx_end. Make symbol table parameter
523 anonymous as it is not used.
524 * gold.cc (queue_middle_tasks): Call target hook to define any
525 target-specific symbols.
526 * target.h (Target::define_standard_symbols): New method.
527 (Target::do_define_standard_symbols): Same.
528 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
529 * testsuite/Makefile.in: Regenerate.
530 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
532 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
533 relocations are generated for __exidx_start and __exidx_end.
535 2012-03-16 Doug Kwan <dougkwan@google.com>
537 * testsuite/Makefile.am: Disable test initpri3b.
538 * testsuite/Makefile.in: Regenerate.
540 2012-03-15 Doug Kwan <dougkwan@google.com>
542 * arm.cc (Target_arm::got_section): Make .got section read-only
545 2012-03-15 Ian Lance Taylor <iant@google.com>
548 * layout.cc (Layout::make_output_section): Correctly mark
549 SHT_INIT_ARRAY, et. al., as relro.
551 2012-03-14 Doug Kwan <dougkwan@google.com>
553 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
554 dynamic relocations for protected symbols in shared objects.
556 2012-03-13 Ian Lance Taylor <iant@google.com>
558 * resolve.cc (Symbol_table::resolve): When merging common symbols,
559 keep the larger alignment.
561 2012-03-12 Cary Coutant <ccoutant@google.com>
563 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
564 handling of DW_LNE_define_file.
566 2012-03-12 Cary Coutant <ccoutant@google.com>
568 * reduced_debug_output.cc
569 (Output_reduced_debug_info_section::get_die_end): Add new FORM
572 2012-02-29 Cary Coutant <ccoutant@google.com>
574 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
576 2012-02-29 Cary Coutant <ccoutant@google.com>
578 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
579 Call Object::decompressed_section_contents.
580 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
582 (Sized_dwarf_line_info::buffer_start_): New data member.
583 * merge.cc (Output_merge_data::do_add_input_section): Call
584 Object::decompressed_section_contents.
585 (Output_merge_string::do_add_input_section): Likewise.
586 * object.cc (need_decompressed_section): New function.
587 (build_compressed_section_map): Decompress sections needed later.
588 (Sized_relobj_file::do_decompressed_section_contents): New function.
589 (Sized_relobj_file::do_discard_decompressed_sections): New function.
590 * object.h (Object::decompressed_section_contents): New function.
591 (Object::discard_decompressed_sections): New function.
592 (Object::do_decompressed_section_contents): New function.
593 (Object::do_discard_decompressed_sections): New function.
594 (Compressed_section_info): New type.
595 (Compressed_section_map): Include decompressed section contents.
596 (Sized_relobj_file::do_decompressed_section_contents): New function.
597 (Sized_relobj_file::do_discard_decompressed_sections): New function.
599 2012-02-16 Cary Coutant <ccoutant@google.com>
601 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
602 * testsuite/Makefile.in: Regenerate.
604 2012-02-14 Cary Coutant <ccoutant@google.com>
606 * options.cc (General_options::finalize): Disallow -pie and -static.
608 2012-02-03 Doug Kwan <dougkwan@google.com>
610 * arm.cc (Arm_relocate_functions::abs8,
611 Arm_relocate_functions::abs16): Use
612 Bits::has_signed_unsigned_overflow32.
613 (Arm_relocate_functions::thm_abs8): Correct range of
615 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
618 2012-02-02 Doug Kwan <dougkwan@google.com>
620 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
621 position independent outputs, not just shared objects.
623 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
625 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
626 * configure: Regenerated.
628 2012-01-27 Ian Lance Taylor <iant@google.com>
630 * reloc.h (Bits): New class with static functions, copied from
631 namespace utils in arm.cc.
632 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
635 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
637 * incremental.cc (write_info_blocks): Correct relocation offset.
639 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
641 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
642 (Relocate::tls_gd_to_le): Likewise.
644 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
646 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
648 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
650 * configure.ac: Check if -mcmodel=medium works.
651 * configure: Regenerated.
653 2012-01-24 Cary Coutant <ccoutant@google.com>
655 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
657 (read_unsigned_LEB_128_x): ... this new function.
658 (read_signed_LEB_128): Replaced with inline definition and ...
659 (read_signed_LEB_128_x): ... this new function.
660 * int_encoding.h (read_unsigned_LEB_128_x): New function.
661 (read_unsigned_LEB_128): Add inline definition.
662 (read_signed_LEB_128_x): New function.
663 (read_signed_LEB_128): Add inline definition.
664 * testsuite/Makefile.am (leb128_unittest): New unit test.
665 * testsuite/Makefile.in: Regenerate.
666 * testsuite/leb128_unittest.cc: New unit test.
668 2012-01-23 Ian Lance Taylor <iant@google.com>
671 * i386.cc (Target_i386::do_code_fill): When using a jmp
672 instruction, pad with nop instructions.
673 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
675 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
677 * x86_64.cc (gc_process_relocs): Add typename on types used in
679 (scan_relocs): Likewise.
680 (relocate_section): Likewise.
681 (apply_relocation): Likewise.
683 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
685 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
686 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
689 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
691 * x86_64.cc: Initial support for x32.
693 2012-01-03 Cary Coutant <ccoutant@google.com>
695 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
696 Use abstract base class for GOT.
697 * gold/output.h (class Output_data_got_base): New abstract base class.
698 (class Output_data_got): Derive from new base class, adjust ctors.
699 (Output_data_got::reserve_slot): Make virtual; rename to
700 do_reserve_slot; Adjust callers.
701 * gold/target.h (Sized_target::init_got_plt_for_update): Return
702 pointer to abstract base class.
703 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
705 2011-12-18 Ian Lance Taylor <iant@google.com>
707 * object.h (Relobj::local_symbol_value): New function.
708 (Relobj::local_plt_offset): New function.
709 (Relobj::local_has_got_offset): New function.
710 (Relobj::local_got_offset): New function.
711 (Relobj::set_local_got_offset): New function.
712 (Relobj::do_local_symbol_value): New pure virtual function.
713 (Relobj::do_local_plt_offset): Likewise.
714 (Relobj::do_local_has_got_offset): Likewise.
715 (Relobj::do_local_got_offset): Likewise.
716 (Relobj::do_set_local_got_offset): Likewise.
717 (Sized_relobj::do_local_has_got_offset): Rename from
718 local_has_got_offset.
719 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
720 (Sized_relobj::do_set_local_got_offset): Rename from
721 set_local_got_offset.
722 (Sized_relobj_file::do_local_plt_offset): Rename from
724 (Sized_relobj_file::do_local_symbol_value): New function.
725 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
727 * output.cc (Output_data_got::Got_entry::write): Change object to
728 Relobj. Use local_symbol_value.
729 (Output_data_got::add_global_with_rel): Change rel_dyn to
730 Output_data_reloc_generic*. Use add_global_generic.
731 (Output_data_got::add_global_with_rela): Remove. Change all
732 callers to use add_global_with_rel.
733 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
734 Output_data_reloc_generic*. Use add_global_generic.
735 (Output_data_got::add_global_pair_with_rela): Remove. Change all
736 callers to use add_global_pair_with_rel.
737 (Output_data_got::add_local): Change object to Relobj*.
738 (Output_data_got::add_local_plt): Likewise.
739 (Output_data_got::add_local_with_rel): Change object to Relobj*,
740 change rel_dyn to Output_data_reloc_generic*. Use
742 (Output_data_got::add_local_with_rela): Remove. Change all
743 callers to use all_local_with_rel.
744 (Output_data_got::add_local_pair_with_rel): Change object to
745 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
746 add_output_section_generic.
747 (Output_data_got::add_local_pair_with_rela): Remove. Change all
748 callers to use add_local_pair_with_rel.
749 (Output_data_got::reserve_local): Change object to Relobj*.
750 * output.h: (class Output_data_reloc_generic): Add pure virtual
751 declarations for add_global_generic, add_local_generic,
752 add_output_section_generic.
753 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
754 functions for Output_data_reloc_generic. Update declarations for
755 changes listed in output.cc.
756 (class Output_data_got): Change template parameter to got_size.
757 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
758 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
760 (Sized_relobj_incr::do_local_plt_offset): New function.
761 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
764 2011-12-17 Cary Coutant <ccoutant@google.com>
766 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
767 * resolve.cc (Symbol_table::resolve): Likewise.
768 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
770 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
772 2011-12-16 Ian Lance Taylor <iant@google.com>
774 * output.h (Output_data_reloc_generic::add): Only call
775 add_dynamic_reloc if this is a dynamic reloc section.
777 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
780 * target-reloc.h (apply_relocation): Replace <64, false> with
783 2011-11-25 Nick Clifton <nickc@redhat.com>
785 * po/it.po: New Italian translation.
787 2011-11-17 Sterling Augustine <saugustine@google.com>
789 * script.cc (script_include_directive): Implement.
790 (read_script_file): New local variables name and search_path. Update
791 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
792 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
793 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
795 2011-11-11 Sterling Augustine <saugustine@google.com>
797 * yyscript.y (section_cmd): Add support for INCLUDE directive.
798 (file_or_sections_cmd): Likewise.
800 2011-11-11 Doug Kwan <dougkwan@google.com>
802 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
803 if --just-symbols is given.
805 2011-11-10 Doug Kwan <dougkwan@google.com>
808 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
809 when processing data relocs.
810 * reloc.h (Relocate_functions::rel_unaligned): New method.
811 (Relocate_functions::pcrel_unaligned): Ditto.
812 (Relocate_functions::rel32_unaligned): Ditto.
813 (Relocate_functions::pcrel32_unaligned): Ditto.
815 2011-11-09 Doug Kwan <dougkwan@google.com>
818 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
819 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
820 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
821 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
822 (Relocate_functions::rel_unaligned): New.
823 (Relocate_functions::rel32_unaligned): New.
824 * target-reloc.h (relocate_for_relocatable): Add code to handle
825 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
826 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
827 arm_unaligned_reloc_r): New targets.
828 * testsuite/Makefile.in: Regenerate.
829 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
832 2011-11-02 Ian Lance Taylor <iant@google.com>
834 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
836 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
837 * options.cc (General_options::finalize): Use library search path
838 from configure script if specified. If not native and no sysroot,
839 only search TOOLLIBDIR.
840 * options.h (Search_directory::Search_directory): Change name to
842 (General_options::add_to_library_path_with_sysroot): Change arg to
844 * configure, Makefile.in, config.in: Rebuild.
846 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
848 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
849 we are working around the ARM1176 Erratum.
850 * options.h (General_options::fix_arm1176): Add option.
851 * testsuite/Makefile.am: Add testcases, and keep current ones
853 * testsuite/Makefile.in: Regenerate.
854 * testsuite/arm_fix_1176.s: New file.
855 * testsuite/arm_fix_1176.sh: Likewise.
857 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
859 * arm.cc (Target_arm::Target_arm): Remove initialisation of
861 (Target_arm::may_use_blx): Remove method.
862 (Target_arm::set_may_use_blx): Likewise.
863 (Target_arm::may_use_v4t_interworking): New method.
864 (Target_arm::may_use_v5t_interworking): Likewise.
865 (Target_arm::may_use_blx_): Remove member variable.
866 (Arm_relocate_functions::arm_branch_common): Check for v5T
868 (Arm_relocate_functions::thumb_branch_common): Likewise.
869 (Reloc_stub::stub_type_for_reloc): Likewise.
870 (Target_arm::do_finalize_sections): Correct interworking checks.
871 * testsuite/Makefile.am: Add new tests.
872 * testsuite/Makefile.in: Regenerate.
873 * testsuite/arm_farcall_arm_arm.s: New test.
874 * testsuite/arm_farcall_arm_arm.sh: Likewise.
875 * testsuite/arm_farcall_arm_thumb.s: Likewise.
876 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
877 * testsuite/arm_farcall_thumb_arm.s: Likewise.
878 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
879 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
880 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
882 2011-10-31 Cary Coutant <ccoutant@google.com>
885 * expression.cc (Expression::eval_with_dot): Add
886 is_section_dot_assignment parameter.
887 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
888 absolute and assigning to dot within a section.
890 (Output_section_element_assignment::set_section_addresses): Pass
891 dot_section to set_if_absolute.
892 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
893 as is_section_dot_assignment flag to eval_with_dot.
894 (Output_section_element_dot_assignment::set_section_addresses):
896 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
897 parameter. Also set value if relative to dot_section; set the
898 symbol's output_section.
899 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
900 parameter. Adjust all callers.
901 (Expression::eval_maybe_dot): Likewise.
902 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
904 * testsuite/script_test_2.t: Test assignment of an absolute value
905 to dot within an output section element.
907 2011-10-31 Cary Coutant <ccoutant@google.com>
909 * options.h (class General_options): Add --[no-]gnu-unique options.
910 * symtab.cc (Symbol_table::sized_write_globals): Convert
911 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
913 2011-10-31 Cary Coutant <ccoutant@google.com>
916 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
917 unnecessary assertion.
918 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
920 2011-10-31 Sriraman Tallam <tmsriram@google.com>
922 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
924 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
926 Change to just keep the section associated with symbol.
927 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
928 they are externally visible and --export-dynamic is turned on.
929 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
931 2011-10-19 Ian Lance Taylor <iant@google.com>
935 (Output_section_element_dot_assignment::needs_output_section): New
938 2011-10-19 Ian Lance Taylor <iant@google.com>
941 * layout.cc (Layout::segment_precedes): Don't assert failure if a
942 --section-start option was seen.
943 * options.h (General_options::any_section_start): New function.
945 2011-10-18 David S. Miller <davem@davemloft.net>
948 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
949 member to track relocation locations that have moved during TLS
951 (Target_sparc::Relocate::Relocate): Initialize to NULL.
952 (Target_sparc::Relocate::relocate): Adjust view down by 4
953 bytes if it matches reloc_adjust_addr_.
954 (Target_sparc::Relocate::relocate_tls): Always move the
955 __tls_get_addr call delay slot instruction forward 4 bytes when
956 performing relaxation.
958 2011-10-18 Cary Coutant <ccoutant@google.com>
960 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
961 (Output_file::map_no_anonymous): Check for non-zero
962 return code from posix_fallocate.
964 2011-10-17 Cary Coutant <ccoutant@google.com>
967 * plugin.cc (is_visible_from_outside): Check for symbols
968 referenced from dynamic objects.
969 * resolve.cc (Symbol_table::resolve): Don't count references
970 from dynamic objects as references from real ELF files.
971 * testsuite/plugin_test_2.sh: Adjust expected result.
973 2011-10-17 Cary Coutant <ccoutant@google.com>
975 * gold.cc: Include timer.h.
976 (queue_middle_tasks): Stamp time.
977 (queue_final_tasks): Likewise.
978 * main.cc (main): Store timer in parameters. Print timers
980 * parameters.cc (Parameters::Parameters): Initialize timer_.
981 (Parameters::set_timer): New function.
982 (set_parameters_timer): New function.
983 * parameters.h (Parameters::set_timer): New function.
984 (Parameters::timer): New function.
985 (Parameters::timer_): New data member.
986 (set_parameters_timer): New function.
987 * timer.cc (Timer::stamp): New function.
988 (Timer::get_pass_time): New function.
989 * timer.h (Timer::stamp): New function.
990 (Timer::get_pass_time): New function.
991 (Timer::pass_times_): New data member.
993 2011-10-17 Cary Coutant <ccoutant@google.com>
995 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
996 task for members of lib groups.
998 2011-10-17 Cary Coutant <ccoutant@google.com>
1001 * fileread.cc (File_read::find_view): Add assert.
1002 (File_read::make_view): Move bounds check (replace with assert)...
1003 (File_read::find_or_make_view): ... to here.
1005 2011-10-12 Cary Coutant <ccoutant@google.com>
1007 * output.cc (Output_file::open_base_file): Handle case where
1008 ::read returns less than requested size.
1010 2011-10-10 Cary Coutant <ccoutant@google.com>
1012 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1013 Initialize defined_count_.
1014 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1015 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1016 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1017 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1018 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1019 * incremental.h (Sized_relobj_incr::defined_count_): New data
1021 (Sized_incr_dynobj::defined_count_): New data member.
1022 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1023 Return zeroes instead of internal error.
1025 2011-10-10 Cary Coutant <ccoutant@google.com>
1028 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1029 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1030 * output.h (class Output_reloc): Add use_plt_offset flag.
1031 (Output_reloc::type_): Adjust size of bit field.
1032 (Output_reloc::use_plt_offset_): New bit field.
1033 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1034 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1035 flag. Adjust all callers.
1036 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1037 creating RELATIVE relocations.
1039 2011-10-10 Nick Clifton <nickc@redhat.com>
1041 * po/es.po: Updated Spanish translation.
1042 * po/fi.po: Updated Finnish translation.
1044 2011-10-03 Diego Novillo <dnovillo@google.com>
1046 * options.cc (parse_uint): Fix dereference of RETVAL.
1048 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1050 * layout.h (section_order_map_): New member.
1051 (get_section_order_map): New member function.
1052 * output.cc (Output_section::add_input_section): Check for patterns
1053 only when --section-ordering-file is specified.
1054 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1055 output_sections have been formed.
1056 * layout.cc (Layout_Layout): Initialize section_order_map_.
1057 * plugin.cc (update_section_order): Store order in order_map. Do not
1059 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1060 * testsuite/Makefile.in: Regenerate.
1061 * testsuite/plugin_section_order.c: New file.
1062 * testsuite/plugin_final_layout.cc: New file.
1063 * testsuite/plugin_final_layout.sh: New file.
1065 2011-09-29 Cary Coutant <ccoutant@google.com>
1067 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1069 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1070 symbols during incremental update.
1071 (Symbol_table::add_from_dynobj): Likewise.
1073 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1074 Ian Lance Taylor <iant@google.com>
1076 * symtab.cc (Symbol_table::define_special_symbol): Always
1077 canonicalize version string.
1079 2011-09-26 Cary Coutant <ccoutant@google.com>
1081 * gold.cc (queue_initial_tasks): Move option checks ...
1082 * options.cc (General_options::finalize): ... to here. Disable
1083 some options; make others fatal.
1085 2011-09-26 Cary Coutant <ccoutant@google.com>
1088 * plugin.cc (get_symbols_v2): New function.
1089 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1090 (is_referenced_from_outside): New function.
1091 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1092 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1093 (get_symbols): Pass version parameter.
1094 (get_symbols_v2): New function.
1095 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1097 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1098 (onload): Add LDPT_GET_SYMBOLS_V2.
1099 (all_symbols_read_hook): Use get_symbols_v2; check for
1100 LDPR_PREVAILING_DEF_IRONLY_EXP.
1101 * testsuite/plugin_test_3.sh: Update expected results.
1103 2011-09-23 Simon Baldwin <simonb@google.com>
1105 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1106 configuration options.
1107 * configure: Regenerate.
1108 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1109 * Makefile.in: Regenerate.
1110 * testsuite/Makefile.in: Regenerate.
1112 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1114 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1116 2011-09-19 Cary Coutant <ccoutant@google.com>
1118 * incremental.cc (can_incremental_update): Fix typo in comment.
1119 * incremental.h (can_incremental_update): Likewise.
1121 2011-09-18 Cary Coutant <ccoutant@google.com>
1123 * incremental.cc (can_incremental_update): New function.
1124 * incremental.h (can_incremental_update): New function.
1125 * layout.cc (Layout::init_fixed_output_section): Call it.
1126 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1127 * object.cc (Sized_relobj_file::do_layout): Call
1128 can_incremental_update.
1130 2011-09-13 Cary Coutant <ccoutant@google.com>
1132 * configure.ac: Check for glibc support for gnu_indirect_function
1133 support with static linking, setting automake conditional
1135 * Makefile.in: Regenerate.
1136 * configure: Regenerate.
1138 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1139 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1141 * testsuite/Makefile.in: Regenerate.
1143 2011-09-13 Cary Coutant <ccoutant@google.com>
1145 * incremental.cc (Sized_relobj_incr::do_layout): Call
1146 report_comdat_group for kept comdat sections.
1147 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1148 * testsuite/Makefile.in: Regenerate.
1149 * testsuite/incr_comdat_test_1.cc: New source file.
1150 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1151 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1152 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1154 2011-09-13 Ian Lance Taylor <iant@google.com>
1156 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1157 variable external_symbols_offset.
1159 2011-09-12 Ian Lance Taylor <iant@google.com>
1161 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1162 triggered if object has no symbols.
1164 2011-09-09 David S. Miller <davem@davemloft.net>
1166 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1167 (Output_fill_debug_line::do_write): Likewise.
1169 2011-08-29 Cary Coutant <ccoutant@google.com>
1171 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1172 casts to match formatting specs.
1173 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1175 2011-08-26 Cary Coutant <ccoutant@google.com>
1177 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1178 remaining hole size when allocating.
1179 (Layout::make_output_section): Set fill methods for debug sections.
1180 * layout.h (Free_list::Free_list_node): Move from private to
1182 (Free_list::set_min_hole_size): New function.
1183 (Free_list::begin, Free_list::end): New functions.
1184 (Free_list::min_hole_): New data member.
1185 * output.cc: Include dwarf.h.
1186 (Output_fill_debug_info::do_minimum_hole_size): New function.
1187 (Output_fill_debug_info::do_write): New function.
1188 (Output_fill_debug_line::do_minimum_hole_size): New function.
1189 (Output_fill_debug_line::do_write): New function.
1190 (Output_section::Output_section): Initialize new data member.
1191 (Output_section::set_final_data_size): Ensure patch space is larger
1192 than minimum hole size.
1193 (Output_section::do_write): Fill holes in debug sections.
1194 * output.h (Output_fill): New class.
1195 (Output_fill_debug_info): New class.
1196 (Output_fill_debug_line): New class.
1197 (Output_section::set_free_space_fill): New function.
1198 (Output_section::free_space_fill_): New data member.
1199 * testsuite/Makefile.am (incremental_test_3): Add
1200 --incremental-patch option.
1201 (incremental_test_4): Likewise.
1202 (incremental_test_5): Likewise.
1203 (incremental_test_6): Likewise.
1204 (incremental_copy_test): Likewise.
1205 (incremental_common_test_1): Likewise.
1206 * testsuite/Makefile.in: Regenerate.
1208 2011-08-26 Nick Clifton <nickc@redhat.com>
1210 * po/es.po: Updated Spanish translation.
1212 2011-08-01 Cary Coutant <ccoutant@google.com>
1214 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1215 * gold/testsuite/Makefile.in: Regenerate.
1216 * gold/testsuite/justsyms_exec.c: New source file.
1217 * gold/testsuite/justsyms_lib.c: New source file.
1219 2011-08-01 Cary Coutant <ccoutant@google.com>
1221 * layout.cc (Layout::set_segment_offsets): Don't realign text
1222 segment if -Ttext was specified.
1223 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1225 * object.h (Sized_relobj_file::e_type): New function.
1226 (Sized_relobj_file::e_type_): New data member.
1227 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1228 base address for ET_EXEC files.
1229 * target.cc (Target::do_make_elf_object_implementation): Allow
1230 ET_EXEC files with --just-symbols option.
1232 2011-07-28 Cary Coutant <ccoutant@google.com>
1234 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1235 Add thread_number parameter.
1236 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1237 * workqueue-threads.cc
1238 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1239 current thread if its thread number is greater than desired thread
1241 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1242 Add thread_number parameter.
1243 (Workqueue::should_cancel_thread): Likewise.
1244 (Workqueue::find_runnable_or_wait): Pass thread_number to
1245 should_cancel_thread.
1246 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1249 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1251 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1252 only after checking if it cannot be forced local.
1253 * symtab.h (is_externally_visible): Check if the symbol is not forced
1256 2011-07-15 Ian Lance Taylor <iant@google.com>
1258 * options.h (class General_options): Add --print-output-format.
1259 Move -EL next to -EB, for better --help output.
1260 * target-select.cc: Include <cstdio>, "options.h", and
1262 (Target_selector::do_target_bfd_name): New function.
1263 (print_output_format): New function.
1264 * target-select.h (class Target_selector): Update declarations.
1265 (Target_selector::target_bfd_name): New function.
1266 (print_output_format): Declare.
1267 * main.cc: Include "target-select.h".
1268 (main): Handle --print-output-format.
1269 * gold.cc: Include "target-select.h".
1270 (queue_initial_tasks): Handle --print-output-format when there are
1272 * parameters.cc (parameters_force_valid_target): Give a better
1273 error message if -EB/-EL does not match target.
1274 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1277 2011-07-15 Ian Lance Taylor <iant@google.com>
1279 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1280 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1281 (Output_data_plt_i386::do_write): Write address of .dynamic
1282 section to first entry in .got.plt section.
1283 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1284 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1286 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1287 section to first entry in .got.plt section.
1288 * layout.h (Layout::dynamic_section): New function.
1290 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1292 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1294 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1295 input_section_position_, and input_section_glob_.
1296 (read_layout_from_file): Call function section_ordering_specified.
1297 * layout.h (is_section_ordering_specified): New function.
1298 (section_ordering_specified): New function.
1299 (section_ordering_specified_): New boolean member.
1300 * main.cc(main): Call load_plugins after layout object is defined.
1301 * output.cc (Output_section::add_input_section): Use
1302 function section_ordering_specified to check if section ordering is
1304 * output.cc (Output_section::add_relaxed_input_section): Use
1305 function section_ordering_specified to check if section ordering is
1307 (Output_section::update_section_layout): New function.
1308 (Output_section::sort_attached_input_sections): Check if input section
1310 * output.h (Output_section::update_section_layout): New function.
1311 * plugin.cc (get_section_count): New function.
1312 (get_section_type): New function.
1313 (get_section_name): New function.
1314 (get_section_contents): New function.
1315 (update_section_order): New function.
1316 (allow_section_ordering): New function.
1317 (Plugin::load): Add the new interfaces to the transfer vector.
1318 (Plugin_manager::load_plugins): New parameter.
1319 (Plugin_manager::all_symbols_read): New parameter.
1320 (Plugin_manager::claim_file): New parameter. Save the elf object for
1322 (Plugin_manager::get_elf_object): New function.
1323 (Plugin_manager::get_view): Change to directly use the bool to check
1324 if get_view is called from claim_file_hook.
1325 * plugin.h (input_objects): New function
1326 (Plugin__manager::load_plugins): New parameter.
1327 (Plugin_manager::claim_file): New parameter.
1328 (Plugin_manager::get_elf_object): New function.
1329 (Plugin_manager::in_claim_file_handler): New function.
1330 (Plugin_manager::in_claim_file_handler_): New member.
1331 (layout): New function.
1332 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1333 handler with an extra parameter. Make the elf object before calling
1335 * testsuite/plugin_test.c (get_section_count): New function pointer.
1336 (get_section_type): New function pointer.
1337 (get_section_name): New function pointer.
1338 (get_section_contents): New function pointer.
1339 (update_section_order): New function pointer.
1340 (allow_section_ordering): New function pointer.
1341 (onload): Check if the new interfaces exist.
1343 2011-07-13 Ian Lance Taylor <iant@google.com>
1345 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1347 * x86_64.cc (Target_x86_64::got_section): Likewise.
1348 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1349 (relro_now_test_SOURCES): New variable.
1350 (relro_now_test_DEPENDENCIES): New variable.
1351 (relro_now_test_LDFLAGS): New variable.
1352 (relro_now_test_LDADD): New variable.
1353 (relro_now_test.so): New target.
1354 * testsuite/Makefile.in: Rebuild.
1356 2011-07-12 Ian Lance Taylor <iant@google.com>
1359 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1360 GLOB_DAT relocation rather than a RELATIVE relocation for a
1361 protected symbol when creating a shared library.
1362 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1363 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1364 * testsuite/protected_main_1.cc (main): Test that protected
1365 function has same address.
1367 2011-07-11 Ian Lance Taylor <iant@google.com>
1370 * options.h (class General_options): Add -Bgroup.
1371 * options.cc (General_options::finalize): If -Bgroup is set,
1372 default to --unresolved-symbols=report-all.
1373 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1374 * target-reloc.h (issue_undefined_symbol_error): Handle
1375 --unresolved-symbols=report-all.
1377 2011-07-08 Ian Lance Taylor <iant@google.com>
1380 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1381 if linker script discards key sections.
1382 (Layout::create_dynamic_symtab): Likewise.
1383 (Layout::assign_local_dynsym_offsets): Likewise.
1384 (Layout::sized_create_version_sections): Likewise.
1385 (Layout::create_interp): Likewise.
1386 (Layout::finish_dynamic_section): Likewise.
1387 (Layout::set_dynamic_symbol_size): Likewise.
1389 2011-07-08 Ian Lance Taylor <iant@google.com>
1392 * options.h (class General_options): Add --unresolved-symbols.
1393 * target-reloc.h (issue_undefined_symbol_error): Check
1394 --unresolved-symbols. Add comments.
1396 2011-07-08 Ian Lance Taylor <iant@google.com>
1398 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1399 expression more complex.
1401 2011-07-08 Ian Lance Taylor <iant@google.com>
1404 * target-reloc.h (issue_undefined_symbol_error): New inline
1405 function, broken out of relocate_section.
1406 (relocate_section): Call issue_undefined_symbol_error.
1407 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1408 there is no TLS segment if we are about to issue an undefined
1410 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1412 2011-07-08 Ian Lance Taylor <iant@google.com>
1415 * resolve.cc (Symbol_table::should_override): Add fromtype
1416 parameter. Change all callers. Give error when linking together
1417 TLS and non-TLS symbol.
1418 (Symbol_table::should_override_with_special): Add fromtype
1419 parameter. Change all callers.
1420 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1421 there is no TLS segment if we have reported some errors.
1422 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1424 2011-07-08 Ian Lance Taylor <iant@google.com>
1427 * target.h (Target::plt_address_for_global): New function.
1428 (Target::plt_address_for_local): New function.
1429 (Target::plt_section_for_global): Remove.
1430 (Target::plt_section_for_local): Remove.
1431 (Target::do_plt_address_for_global): New virtual function.
1432 (Target::do_plt_address_for_local): New virtual function.
1433 (Target::do_plt_section_for_global): Remove.
1434 (Target::do_plt_section_for_local): Remove.
1435 (Target::register_global_plt_entry): Add Symbol_table and Layout
1437 * output.cc (Output_data_got::Got_entry::write): Use
1438 plt_address_for_global and plt_address_for_local.
1439 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1440 address of output section.
1441 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1442 got_irelative_, and irelative_count_ fields. Update
1444 (Output_data_plt_i386::has_irelative_section): New function.
1445 (Output_data_plt_i386::entry_count): Add irelative_count_.
1446 (Output_data_plt_i386::set_final_data_size): Likewise.
1447 (class Target_i386): Add got_irelative_ and rel_irelative_
1448 fields. Update declarations.
1449 (Target_i386::Target_i386): Initialize new fields.
1450 (Target_i386::do_plt_address_for_global): New function replacing
1451 do_plt_section_for_global.
1452 (Target_i386::do_plt_address_for_local): New function replacing
1453 do_plt_section_for_local.
1454 (Target_i386::got_section): Create got_irelative_.
1455 (Target_i386::rel_irelative_section): New function.
1456 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1457 fields. Don't define __rel_iplt_{start,end}.
1458 (Output_data_plt_i386::add_entry): Add symtab and layout
1459 parameters. Change all callers. Use different PLT and GOT for
1461 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1462 layout parameters. Change all callers. Use different PLT and
1464 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1465 (Output_data_plt_i386::rel_irelative): New function.
1466 (Output_data_plt_i386::address_for_global): New function.
1467 (Output_data_plt_i386::address_for_local): New function.
1468 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1469 IRELATIVE GOT when changing IFUNC GOT entries.
1470 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1472 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1473 if we didn't create an IRELATIVE GOT.
1474 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1475 plt_address_for_local.
1476 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1477 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1478 got_irelative_, and irelative_count_ fields. Update
1480 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1481 Initialize new fields. Remove symtab parameter. Change all
1483 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1485 (Output_data_plt_x86_64::has_irelative_section): New function.
1486 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1487 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1488 fields. Update declarations.
1489 (Target_x86_64::Target_x86_64): Initialize new fields.
1490 (Target_x86_64::do_plt_address_for_global): New function replacing
1491 do_plt_section_for_global.
1492 (Target_x86_64::do_plt_address_for_local): New function replacing
1493 do_plt_section_for_local.
1494 (Target_x86_64::got_section): Create got_irelative_.
1495 (Target_x86_64::rela_irelative_section): New function.
1496 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1497 all callers. Don't create __rel_iplt_{start,end}.
1498 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1499 parameters. Change all callers. Use different PLT and GOT for
1501 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1502 layout parameters. Change all callers. Use different PLT and
1504 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1505 parameters. Change all callers. Use different PLT and GOT for
1507 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1508 (Output_data_plt_x86_64::rela_irelative): New function.
1509 (Output_data_plt_x86_64::address_for_global): New function.
1510 (Output_data_plt_x86_64::address_for_local): New function.
1511 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1512 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1513 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1514 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1516 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1518 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1519 symbols if we didn't create an IRELATIVE GOT.
1520 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1521 plt_address_for_local.
1522 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1523 * testsuite/ifuncvar1.c: New test file.
1524 * testsuite/ifuncvar2.c: New test file.
1525 * testsuite/ifuncvar3.c: New test file.
1526 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1527 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1528 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1529 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1530 * testsuite/Makefile.in: Rebuild.
1532 2011-07-07 Cary Coutant <ccoutant@google.com>
1534 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1535 (two_file_test_1_ndebug.o): Likewise.
1536 (two_file_test_1b_ndebug.o): Likewise.
1537 (two_file_test_2_ndebug.o): Likewise.
1538 (two_file_test_main_ndebug.o): Likewise.
1539 (incremental_test_2): Link with no-debug versions.
1541 2011-07-06 Cary Coutant <ccoutant@google.com>
1543 * gold/incremental.cc
1544 (Output_section_incremental_inputs::write_info_blocks): Check for
1545 hidden and internal symbols.
1547 2011-07-06 Cary Coutant <ccoutant@google.com>
1549 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1550 Check disposition for startup file.
1551 (Incremental_inputs::report_command_line): Ignore
1552 --incremental-startup-unchanged option.
1553 * options.cc (General_options::parse_incremental_startup_unchanged):
1555 (General_options::General_options): Initialize new data member.
1556 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1557 (General_options): Add --incremental-startup-unchanged option.
1558 (General_options::incremental_startup_disposition): New function.
1559 (General_options::incremental_startup_disposition_): New data member.
1561 2011-07-06 Cary Coutant <ccoutant@google.com>
1563 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1564 input file index to Script_info ctor.
1565 (Sized_incremental_binary::do_file_has_changed): Find the
1566 command-line argument for files named in scripts.
1567 * incremental.h (Script_info::Script_info): New ctor
1568 with input file index.
1569 (Script_info::input_file_index): New function.
1570 (Script_info::input_file_index_): New data member.
1571 (Incremental_binary::get_library): Add const.
1572 (Incremental_binary::get_script_info): Add const.
1573 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1574 * testsuite/Makefile.am (incremental_test_5): New test case.
1575 (incremental_test_6): New test case.
1576 * testsuite/Makefile.in: Regenerate.
1578 2011-07-06 Cary Coutant <ccoutant@google.com>
1580 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1581 debug output when command lines differ.
1583 2011-07-06 Cary Coutant <ccoutant@google.com>
1585 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1586 --incremental-patch option.
1587 * layout.cc (Free_list::allocate): Extend allocation beyond original
1589 (Layout::make_output_section): Mark sections that should get
1591 * options.cc (parse_percent): New function.
1592 * options.h (parse_percent): New function.
1593 (DEFINE_percent): New macro.
1594 (General_options): Add --incremental-patch option.
1595 * output.cc (Output_section::Output_section): Initialize new data
1597 (Output_section::add_input_section): Print section name when out
1599 (Output_section::add_output_section_data): Likewise.
1600 (Output_section::set_final_data_size): Add patch space when
1601 doing --incremental-full.
1602 (Output_section::do_reset_address_and_file_offset): Remove patch
1604 (Output_segment::set_section_list_addresses): Print debug output
1605 only if --incremental-update.
1606 * output.h (Output_section::set_is_patch_space_allowed): New function.
1607 (Output_section::is_patch_space_allowed_): New data member.
1608 (Output_section::patch_space_): New data member.
1609 * parameters.cc (Parameters::incremental_full): New function.
1610 * parameters.h (Parameters::incremental_full): New function
1611 * testsuite/Makefile.am (incremental_test_2): Add test for
1612 --incremental-patch option.
1613 * testsuite/Makefile.in: Regenerate.
1614 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1615 (t18): Remove function body.
1617 2011-07-05 Doug Kwan <dougkwan@google.com>
1620 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1621 Arm_Address type for relocation result.
1622 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1624 (Arm_relocate_functions::abs32): Use unaligned access.
1625 (Arm_relocate_functions::rel32): Ditto.
1626 (Arm_relocate_functions::prel31): Ditto.
1627 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1628 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1629 static data relocations.
1630 * testsuite/Makefile.in: Regnerate.
1631 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1633 2011-07-05 Ian Lance Taylor <iant@google.com>
1636 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1637 symbols if necessary.
1638 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1640 2011-07-05 Ian Lance Taylor <iant@google.com>
1643 * resolve.cc (Symbol::override_base_with_special): Simply override
1644 version with special symbol version, ignoring previous version.
1646 2011-07-05 Ian Lance Taylor <iant@google.com>
1648 * object.cc (Sized_relobj_file::include_section_group): Add
1649 information to comment about signature location.
1651 2011-07-02 Ian Lance Taylor <iant@google.com>
1654 * options.h (class General_options): Add -f and -F.
1655 * options.cc (General_options::finalize): Fatal error if -f/-F
1656 are used without -shared.
1657 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1659 2011-07-02 Ian Lance Taylor <iant@google.com>
1661 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1663 2011-07-01 Ian Lance Taylor <iant@google.com>
1667 * resolve.cc (Symbol::override_base_with_special): Don't override
1668 the version if the overriding symbol has a different name.
1669 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1670 all callers. If we give an error about an undefined version,
1671 define the base version if necessary.
1672 * dynobj.h (class Versions): Update declaration.
1673 * testsuite/weak_alias_test_5.cc: New file.
1674 * testsuite/weak_alias_test.script: New file.
1675 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1676 and versioned_alias have the right value, and call t2.
1677 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1678 weak_alias_test_5.so.
1679 (weak_alias_test_LDADD): Likewise.
1680 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1681 * testsuite/Makefile.in: Rebuild.
1683 2011-07-01 Ian Lance Taylor <iant@google.com>
1686 * options.h (class General_options): Support -z notext.
1687 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1689 (two_file_shared_nonpic.so): Likewise.
1690 (two_file_shared_mixed.so): Likewise.
1691 (two_file_shared_mixed_1.so): Likewise.
1692 (weak_undef_lib_nonpic.so): Likewise.
1693 (alt/weak_undef_lib_nonpic.so): Likewise.
1694 (tls_test_shared_nonpic.so): Likewise.
1695 * testsuite/Makefile.in: Rebuild.
1697 2011-07-01 Ian Lance Taylor <iant@google.com>
1700 * configure.ac: Test whether static linking works, setting
1701 the automake conditional HAVE_STATIC.
1702 * testsuite/Makefile.am: Disable tests using -static if
1703 HAVE_STATIC is not true.
1704 * configure, testsuite/Makefile.in: Rebuild.
1706 2011-07-01 Ian Lance Taylor <iant@google.com>
1709 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1710 Assert if we see DW_EH_PE_indirect.
1711 * target.h (Target::ehframe_datarel_base): New function.
1712 (Target::do_ehframe_datarel_base): New target function.
1713 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1714 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1717 2011-07-01 Ian Lance Taylor <iant@google.com>
1720 * options.h (class General_options): Add
1721 --ld-generated-unwind-info.
1722 * ehframe.cc (Fde::write): Add address parameter. Change all
1723 callers. If associated with PLT, fill in address and size.
1724 (Cie::set_output_offset): Only add merge mapping if there is an
1726 (Cie::write): Add address parameter. Change all callers.
1727 (Eh_frame::add_ehframe_for_plt): New function.
1728 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1729 input_offset_ fields into union u_, with new plt field.
1730 (Fde::Fde): Adjust for new union field.
1731 (Fde::Fde) [Output_data version]: New constructor.
1732 (Fde::add_mapping): Only add merge mapping if there is an object.
1733 (class Cie): Update declarations.
1734 (class Eh_frame): Declare add_ehframe_for_plt.
1735 * layout.cc (Layout::layout_eh_frame): Break out code into
1736 make_eh_frame_section, and call it.
1737 (Layout::make_eh_frame_section): New function.
1738 (Layout::add_eh_frame_for_plt): New function.
1739 * layout.h (class Layout): Update declarations.
1740 * merge.cc (Merge_map::add_mapping): Add assertion.
1741 * i386.cc: Include "dwarf.h".
1742 (class Output_data_plt_i386): Make first_plt_entry,
1743 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1744 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1745 and plt_eh_frame_fde.
1746 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1747 boundary. Call add_eh_frame_for_plt if appropriate.
1748 * x86_64.cc: Include "dwarf.h".
1749 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1750 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1751 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1752 and plt_eh_frame_fde.
1753 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1756 2011-06-29 Ian Lance Taylor <iant@google.com>
1759 * object.cc (Sized_relobj_file::layout_section): Change shdr
1760 parameter to be const.
1761 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1763 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1764 appropriate. Call layout_eh_frame_section.
1765 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1767 * object.h (class Sized_relobj_file): Update declarations.
1769 2011-06-29 Ian Lance Taylor <iant@google.com>
1772 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1774 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1776 2011-06-29 Ian Lance Taylor <iant@google.com>
1779 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1781 * layout.cc (Layout::layout_eh_frame): Likewise.
1783 2011-06-29 Ian Lance Taylor <iant@google.com>
1786 * layout.cc (Layout::symtab_section_shndx): New function.
1787 * layout.h (class Layout): Declare symtab_section_shndx.
1788 * output.cc (Output_section::write_header): Call it.
1790 2011-06-29 Ian Lance Taylor <iant@google.com>
1793 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1794 symbols which are not used in a relocation.
1796 2011-06-28 Ian Lance Taylor <iant@google.com>
1799 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1800 script create indistinguishable segments.
1801 (Layout::set_segment_offsets): Use stable_sort when sorting
1802 segments. Pass this to Compare_segments constructor.
1803 * layout.h (class Layout): Make segment_precedes non-static.
1804 (class Compare_segments): Change from struct to class. Add
1805 layout_ field. Add constructor.
1806 * script-sections.cc
1807 (Script_sections::attach_sections_using_phdrs_clause): Rename
1808 local orphan to is_orphan. Don't report failure to put empty
1809 section in segment. On attachment failure, report name of
1810 section, and attach to first PT_LOAD segment.
1812 2011-06-28 Ian Lance Taylor <iant@google.com>
1815 * target-select.cc (Target_selector::Target_selector): Add
1816 emulation parameter. Change all callers.
1817 (select_target_by_bfd_name): Rename from select_target_by_name.
1819 (select_target_by_emulation): New function.
1820 (supported_emulation_names): New function.
1821 * target-select.h (class Target_selector): Add emulation_ field.
1822 Update declarations.
1823 (Target_selector::recognize_by_bfd_name): Rename from
1824 recognize_by_name. Change all callers.
1825 (Target_selector::supported_bfd_names): Rename from
1826 supported_names. Change all callers.
1827 (Target_selector::recognize_by_emulation): New function.
1828 (Target_selector::supported_emulations): New function.
1829 (Target_selector::emulation): New function.
1830 (Target_selector::do_recognize_by_bfd_name): Rename from
1831 do_recognize_by_name. Change all callers.
1832 (Target_selector::do_supported_bfd_names): Rename from
1833 do_supported_names. Change all callers.
1834 (Target_selector::do_recognize_by_emulation): New function.
1835 (Target_selector::do_supported_emulations): New function.
1836 (select_target_by_bfd_name): Change name in declaration.
1837 (select_target_by_emulation): Declare.
1838 (supported_emulation_names): Declare.
1839 * parameters.cc (parameters_force_valid_target): Try to find
1840 target based on emulation from -m option.
1841 * options.h (class General_options): Change doc string for -m.
1842 * options.cc (help): Print emulations.
1843 (General_options::parse_V): Likewise.
1844 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1845 Add emulation parameter. Change all callers.
1847 2011-06-28 Ian Lance Taylor <iant@google.com>
1849 * target.h (class Target): Add osabi_ field.
1850 (Target::osabi): New function.
1851 (Target::set_osabi): New function.
1852 (Target::Target): Initialize osabi_.
1853 (Target::do_adjust_elf_header): Make pure virtual.
1854 (Sized_target::do_adjust_elf_header): Declare.
1855 * target.cc (Sized_target::do_adjust_elf_header): New function.
1856 (class Sized_target): Instantiate all versions.
1857 * freebsd.h (class Target_freebsd): Remove.
1858 (Target_selector_freebsd::do_recognize): Call set_osabi on
1860 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1861 (Target_selector_freebsd::set_osabi): Remove.
1862 * i386.cc (class Target_i386): Inherit from Sized_target rather
1863 than Target_freebsd.
1864 * x86_64.cc (class Target_x86_64): Likewise.
1866 2011-06-28 Ian Lance Taylor <iant@google.com>
1868 * target.h (Target::can_check_for_function_pointers): Rewrite.
1870 (Target::can_icf_inline_merge_sections): Likewise.
1871 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1872 (Target::Target_info): Add can_icf_inline_merge_sections field.
1873 (Target::do_can_check_for_function_pointers): New virtual
1875 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1876 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1877 from can_check_for_function_pointers, move in file.
1878 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1879 section_may_have_icf_unsafe_poineters, move in file.
1880 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1881 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1882 Rename from can_check_for_function_pointers, move in file.
1883 (Target_i386::can_icf_inline_merge_sections): Remove.
1884 (Target_i386::i386_info): Initialize
1885 can_icf_inline_merge_sections.
1886 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1887 Initialize can_icf_inline_merge_sections.
1888 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1889 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1890 Rename from can_check_for_function_pointers, move in file.
1891 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1892 (Target_x86_64::x86_64_info): Initialize
1893 can_icf_inline_merge_sections.
1894 * testsuite/testfile.cc (Target_test::test_target_info):
1896 * icf.cc (get_section_contents): Correct formatting.
1898 2011-06-27 Ian Lance Taylor <iant@google.com>
1900 * symtab.cc (Symbol::versioned_name): New function.
1901 (Symbol_table::add_to_final_symtab): Use versioned_name when
1903 (Symbol_table::sized_write_symbol): Likewise.
1904 * symtab.h (class Symbol): Declare versioned_name.
1905 * stringpool.h (class Stringpool_template): Add variant of add
1906 which takes a std::basic_string.
1907 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1908 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1909 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1910 (ver_test_12.o): New target.
1911 * testsuite/Makefile.in: Rebuild.
1913 2011-06-27 Doug Kwan <dougkwan@google.com>
1915 * arm.cc (Arm_relocate_functions::thm_jump8,
1916 Arm_relocate_functions::thm_jump11): Use a wider signed
1917 type to compute offset.
1918 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1920 * testsuite/Makefile.in: Regenerate.
1921 * testsuite/arm_branch_in_range.sh: Check test results of
1922 arm_thm_jump11 and arm_thm_jump8.
1923 * testsuite/arm_thm_jump11.s: New test source file.
1924 * testsuite/arm_thm_jump11.t: New linker script.
1925 * testsuite/arm_thm_jump8.s: New test source file.
1926 * testsuite/arm_thm_jump8.t: New linker script.
1928 2011-06-24 Ian Lance Taylor <iant@google.com>
1930 * layout.cc: Include "object.h".
1931 (ctors_sections_in_init_array): New static variable.
1932 (Layout::is_ctors_in_init_array): New function.
1933 (Layout::layout): Add entry to ctors_sections_in_init_array if
1935 * layout.h (class Layout): Declare is_ctors_in_init_array.
1936 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1937 is_ctors_reverse_view is set.
1938 (Sized_relobj_file::write_sections): Add layout parameter. Change
1939 all callers. Set is_ctors_reverse_view field of View_size.
1940 (Sized_relobj_file::reverse_words): New function.
1941 * object.h (Sized_relobj_file::View_size): Add
1942 is_ctors_reverse_view field.
1943 (class Sized_relobj_file): Update declarations.
1944 * testsuite/initpri3.c: New test.
1945 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1947 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1948 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1949 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1950 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1951 * testsuite/Makefile.in: Rebuild.
1953 2011-06-24 Cary Coutant <ccoutant@google.com>
1955 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1956 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1957 (debug_msg_cdebug.err): New targets.
1958 * testsuite/Makefile.in: Regenerate.
1959 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1960 Fix checks for link with shared library.
1962 2011-06-24 Doug Kwan <dougkwan@google.com>
1964 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1965 skip empty text sections.
1966 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1968 2011-06-22 Ian Lance Taylor <iant@google.com>
1971 * options.h (class General_options): Add --ctors-in-init-array.
1972 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1973 friends as SHT_PROGBITS for merging sections.
1974 (Layout::layout): Remove special handling of .init_array and
1975 friends. Don't sort if doing relocatable link. Sort for .ctors
1976 and .dtors if ctors_in_init_array.
1977 (Layout::make_output_section): Force correct section types for
1978 .init_array and friends. Don't sort if doing relocatable link,
1979 Don't sort .ctors and .dtors if ctors_in_init_array.
1980 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1981 (Layout::output_section_name): Add relobj parameter. Change all
1982 callers. Handle .ctors. and .dtors. in code rather than table.
1983 Handle .ctors and .dtors if ctors_in_init_array.
1984 (Layout::match_file_name): New function, moved from output.cc.
1985 * layout.h (class Layout): Update declarations.
1986 * output.cc: Include "layout.h".
1987 (Input_section_sort_entry::get_priority): New function.
1988 (Input_section_sort_entry::match_file_name): Just call
1989 Layout::match_file_name.
1990 (Output_section::Input_section_sort_init_fini_compare::operator()):
1991 Handle .ctors and .dtors. Sort by explicit priority rather than
1993 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1994 * testsuite/initpri2.c: New test.
1995 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1996 (check_PROGRAMS): Add initpri2.
1997 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1998 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1999 * configure, testsuite/Makefile.in: Rebuild.
2001 2011-06-19 Ian Lance Taylor <iant@google.com>
2004 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2005 .interp section to a PT_INTERP segment even if we have seen a
2006 --dynamic-linker option. Don't do it if we have seen a PHDRS
2007 clause in a linker script.
2008 (Layout::finalize): Don't create a .interp section if we've
2009 already create a PT_INTERP segment.
2010 (Layout::create_interp): Always call choose_output_section (revert
2011 patch of 2011-06-17). Don't create PT_INTERP segment.
2012 * script-sections.cc
2013 (Script_sections::create_note_and_tls_segments): Add a .interp
2014 section to a PT_INTERP segment even if we have seen a
2015 --dynamic-linker option.
2017 2011-06-18 Ian Lance Taylor <iant@google.com>
2019 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2020 merely because a non-PT_LOAD segment has a dynamic reloc.
2022 2011-06-18 Ian Lance Taylor <iant@google.com>
2024 * layout.cc (Layout::finish_dynamic_section): Don't create
2025 DT_FLAGS entry if not needed.
2027 2011-06-18 Ian Lance Taylor <iant@google.com>
2030 * layout.cc (Layout::layout_eh_frame): Correct handling of
2031 writable .eh_frame section.
2033 2011-06-17 Ian Lance Taylor <iant@google.com>
2036 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2037 symbol is redefined with the exact same object and value.
2039 2011-06-17 Ian Lance Taylor <iant@google.com>
2042 * layout.h (class Layout): Add interp_segment_ field.
2043 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2044 (Layout::attach_allocated_section_to_segment): If making shared
2045 library, put .interp section in PT_INTERP segment.
2046 (Layout::finalize): Also call create_interp if -dynamic-linker
2048 (Layout::create_interp): Assert that there is no PT_INTERP
2049 segment. If not using a SECTIONS clause, use make_output_section.
2050 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2051 * script-sections.cc
2052 (Script_sections::create_note_and_tls_segments): If making shared
2053 library, put .interp section in PT_INTERP segment.
2055 2011-06-17 Ian Lance Taylor <iant@google.com>
2057 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2058 when making a shared library.
2060 2011-06-17 Ian Lance Taylor <iant@google.com>
2062 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2063 parameter. Change all callers. Don't issue warning about PC32
2064 against locally defined symbol.
2066 2011-06-16 Ian Lance Taylor <iant@google.com>
2068 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2069 occurs in same object.
2071 2011-06-14 Alan Modra <amodra@gmail.com>
2073 * po/POTFILES.in: Regenerate.
2075 2011-06-09 Ian Lance Taylor <iant@google.com>
2077 * script-sections.cc
2078 (Orphan_output_section::set_section_addresses): For a relocatable
2079 link set address to 0.
2081 2011-06-09 Cary Coutant <ccoutant@google.com>
2084 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2085 used with --compress-debug-sections.
2086 * gold/object.cc (Sized_relobj_file::do_layout): Report
2087 uncompressed size of compressed input sections.
2089 2011-06-08 Cary Coutant <ccoutant@google.com>
2092 * testsuite/two_file_test_2_v1.cc: Change initialization of
2093 v2 to keep it in .data.
2095 2011-06-07 Cary Coutant <ccoutant@google.com>
2097 * common.cc (Symbol_table::do_allocate_commons_list): Call
2099 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2100 (Errors::fallback): New function.
2101 (gold_fallback): New function.
2102 * errors.h (Errors::fallback): New function.
2103 * gold.cc (gold_exit): Change status parameter to enum; adjust
2105 (queue_initial_tasks): Call gold_fallback.
2106 * gold.h: Include cstdlib.
2107 (Exit_status): New enum type.
2108 (gold_exit): Change status parameter to enum.
2109 (gold_fallback): New function.
2110 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2111 (Layout::create_symtab_sections): Likewise.
2112 (Layout::create_shdrs): Likewise.
2113 * main.cc (main): Adjust call to gold_exit.
2114 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2115 (Output_data_got::add_got_entry_pair): Likewise.
2116 (Output_section::add_input_section): Likewise.
2117 (Output_section::add_output_section_data): Likewise.
2118 (Output_segment::set_section_list_addresses): Likewise.
2119 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2121 2011-06-07 Cary Coutant <ccoutant@google.com>
2123 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2124 for incremental links.
2125 * output.cc (Output_segment::set_section_list_addresses): Remove
2126 FIXME and test for TLS or BSS.
2128 2011-06-07 Cary Coutant <ccoutant@google.com>
2130 * testsuite/Makefile.am: Add incremental_copy_test,
2131 incremental_common_test_1.
2132 * testsuite/Makefile.in: Regenerate.
2133 * testsuite/common_test_1_v1.c: New source file.
2134 * testsuite/common_test_1_v2.c: New source file.
2135 * testsuite/copy_test_v1.cc: New source file.
2137 2011-06-07 Cary Coutant <ccoutant@google.com>
2139 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2140 update, allocate common from bss section's free list.
2141 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2142 linker-defined symbols.
2143 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2144 Skip GOT and PLT entries that are no longer referenced.
2145 (Output_section_incremental_inputs::write_info_blocks): Mark
2146 linker-defined symbols.
2147 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2148 * output.cc (Output_section::allocate): New function.
2149 * output.h (Output_section::allocate): New function.
2150 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2151 linker-defined symbols.
2152 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2153 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2154 (Symbol::init_base_output_data): Likewise.
2155 (Symbol::init_base_output_segment): Likewise.
2156 (Symbol::init_base_constant): Likewise.
2157 (Sized_symbol::init_output_data): Likewise.
2158 (Sized_symbol::init_output_segment): Likewise.
2159 (Sized_symbol::init_constant): Likewise.
2160 (Symbol_table::do_define_in_output_data): Likewise.
2161 (Symbol_table::do_define_in_output_segment): Likewise.
2162 (Symbol_table::do_define_as_constant): Likewise.
2163 * symtab.h (Symbol::is_predefined): New function.
2164 (Symbol::init_base_output_data): Add is_predefined parameter.
2165 (Symbol::init_base_output_segment): Likewise.
2166 (Symbol::init_base_constant): Likewise.
2167 (Symbol::is_predefined_): New data member.
2168 (Sized_symbol::init_output_data): Add is_predefined parameter.
2169 (Sized_symbol::init_output_segment): Likewise.
2170 (Sized_symbol::init_constant): Likewise.
2171 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2173 2011-06-07 Cary Coutant <ccoutant@google.com>
2175 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2176 instead of emit_copy_reloc.
2177 (Copy_relocs::emit_copy_reloc): Refactor.
2178 (Copy_relocs::make_copy_reloc): New function.
2179 (Copy_relocs::add_copy_reloc): Remove.
2180 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2182 (Copy_relocs::make_copy_reloc): New function.
2183 (Copy_relocs::add_copy_reloc): Remove.
2184 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2185 unchanged input files.
2186 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2187 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2188 Reserve BSS space for COPY relocations.
2189 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2190 (Output_section_incremental_inputs::write_info_blocks): Record
2191 whether a symbol is copied from a shared object.
2192 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2193 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2194 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2195 (Incremental_input_entry_reader::get_output_symbol_index): Add
2197 (Incremental_binary::emit_copy_relocs): New function.
2198 (Incremental_binary::do_emit_copy_relocs): New function.
2199 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2201 (Sized_incremental_binary::add_copy_reloc): New function.
2202 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2203 (Sized_incremental_binary::Copy_reloc): New struct.
2204 (Sized_incremental_binary::Copy_relocs): New typedef.
2205 (Sized_incremental_binary::copy_relocs_): New data member.
2206 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2207 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2208 * target.h (Sized_target::emit_copy_reloc): New function.
2209 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2211 2011-06-02 Cary Coutant <ccoutant@google.com>
2214 * gold/archive.cc (Archive::Archive): Initialize new data member.
2215 (Archive::include_all_members): Return if archive has already been
2217 * gold/archive.h (Archive::include_all_members_): New data member.
2219 2011-06-02 Nick Clifton <nickc@redhat.com>
2221 * dynobj.h: Fix spelling mistake in comment.
2222 * output.cc: Likewise.
2224 2011-05-31 Doug Kwan <dougkwan@google.com>
2228 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2229 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2230 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2231 redundant arm_exidx_test.so.
2232 * testsuite/Makefile.in: Regenerate.
2233 (check_SCRIPTS): Add pr12826.sh
2234 (check_DATA): Add pr12826.stdout
2235 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2236 * testsuite/pr12826.sh: New file.
2237 * testsuite/pr12826_1.s: Ditto.
2238 * testsuite/pr12826_1.s: Ditto.
2240 2011-05-30 Ian Lance Taylor <iant@google.com>
2242 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2245 2011-05-29 Ian Lance Taylor <iant@google.com>
2248 * testsuite/Makefile.am: Use different file name for two_file_test
2249 temporary file for each incremental test.
2250 * testsuite/Makefile.in: Rebuild.
2252 2011-05-29 Ian Lance Taylor <iant@google.com>
2254 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2255 binary input file is empty.
2257 2011-05-27 Ian Lance Taylor <iant@google.com>
2259 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2260 (ver_test_9.so): Likewise.
2261 * testsuite/Makefile.in: Rebuild.
2263 2011-05-26 Cary Coutant <ccoutant@google.com>
2265 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2266 * incremental.cc (Incremental_inputs::report_input_section): Fix
2267 comment, indentation.
2268 (Incremental_inputs::report_comdat_group): New function.
2269 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2270 of data for incremental input file entry.
2271 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2272 group count, COMDAT group signatures.
2273 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2274 an unchanged input file.
2275 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2276 Initialize new data member.
2277 (Incremental_object_entry::add_comdat_group): New function.
2278 (Incremental_object_entry::get_comdat_group_count): New function.
2279 (Incremental_object_entry::get_comdat_signature_key): New function.
2280 (Incremental_object_entry::groups_): New data member.
2281 (Incremental_inputs::report_comdat_group): New function.
2282 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2283 data for incremental input file entry.
2284 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2285 (Incremental_input_entry_reader::get_input_section): Adjust size of
2286 data for incremental input file entry.
2287 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2288 (Incremental_input_entry_reader::get_comdat_group_signature): New
2290 * object.cc (Sized_relobj::include_section_group): Report kept
2291 COMDAT groups for incremental links.
2293 2011-05-24 David Meyer <pdox@google.com>
2295 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2296 with name parameter. Add found_name parameter.
2297 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2298 * dirsearch.h (class Dirsearch): Update declaration.
2300 2011-05-24 Ian Lance Taylor <iant@google.com>
2302 * archive.cc (Library_base::should_include_member): Pull in object
2303 from archive if it defines the entry symbol.
2304 * parameters.cc (Parameters::entry): New function.
2305 * parameters.h (class Parameters): Declare entry.
2306 * output.h (class Output_file_header): Remove entry_ field.
2307 * output.cc (Output_file_header::Output_file_header): Remove entry
2308 parameter. Change all callers.
2309 (Output_file_header::entry): Use parameters->entry.
2310 * gold.cc (queue_middle_tasks): Likewise.
2311 * plugin.cc (Plugin_hook::run): Likewise.
2313 2011-05-24 Cary Coutant <ccoutant@google.com>
2315 * gold.cc (queue_initial_tasks): Pass incremental base filename
2316 to Output_file::open_base_file; don't print error message.
2317 * incremental-dump.cc (main): Adjust call to
2318 Output_file::open_for_modification.
2319 * incremental-dump.cc (main): Likewise.
2320 * incremental.cc (Incremental_inputs::report_command_line):
2321 Ignore --incremental-base option when comparing command lines.
2322 Ignore parameter when given as separate argument.
2323 * options.h (class General_options): Add --incremental-base.
2324 * output.cc (Output_file::Output_file):
2325 (Output_file::open_base_file): Add base_name and writable parameters;
2326 read base file into new file; print error message here.
2327 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2329 * output.h (Output_file::open_for_modification): Rename to...
2330 (Output_file::open_base_file): ...this; add base_name and
2331 writable parameters; adjust all callers.
2332 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2334 * testsuite/Makefile.am (incremental_test_4): Test
2336 * testsuite/Makefile.in: Regenerate.
2338 2011-05-24 Cary Coutant <ccoutant@google.com>
2340 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2342 * testsuite/Makefile.in: Regenerate.
2343 * testsuite/two_file_test_1_v1.cc: New test source file.
2344 * testsuite/two_file_test_1b_v1.cc: New test source file.
2345 * testsuite/two_file_test_2_v1.cc: New test source file.
2347 2011-05-24 Cary Coutant <ccoutant@google.com>
2349 * dynobj.h (Dynobj::do_dynobj): New function.
2350 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2351 flag and soname for shared objects.
2352 * incremental.cc (Incremental_inputs::report_object): Make
2353 either Incremental_object_entry or Incremental_dynobj_entry; add
2354 soname to string table.
2355 (Incremental_inputs::report_input_section): Add assertion.
2356 (Output_section_incremental_inputs::set_final_data_size): Adjust
2357 type of input file entry for shared libraries; adjust size of
2358 shared library info entry.
2359 (Output_section_incremental_inputs::write_input_files): Write
2360 as_needed flag for shared libraries.
2361 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2362 of input file entry for shared libraries; write soname.
2363 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2364 soname from incremental info.
2365 * incremental.h (enum Incremental_input_flags): Add
2366 INCREMENTAL_INPUT_AS_NEEDED.
2367 (Incremental_input_entry::Incremental_input_entry): Initialize new
2369 (Incremental_input_entry::set_as_needed): New function.
2370 (Incremental_input_entry::as_needed): New function.
2371 (Incremental_input_entry::do_dynobj_entry): New function.
2372 (Incremental_input_entry::as_needed_): New data member.
2373 (Incremental_object_entry::Incremental_object_entry): Don't check
2375 (Incremental_object_entry::do_type): Likewise.
2376 (class Incremental_dynobj_entry): New class.
2377 (Incremental_input_entry_reader::as_needed): New function.
2378 (Incremental_input_entry_reader::get_soname): New function.
2379 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2380 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2381 size of shared library info entry.
2382 * layout.cc (Layout::finish_dynamic_section): Don't test for
2383 incremental link when adding DT_NEEDED entries.
2384 * object.h (Object::Object): Initialize new data member.
2385 (Object::dynobj): New function.
2386 (Object::set_as_needed): New function.
2387 (Object::as_needed): New function.
2388 (Object::do_dynobj): New function.
2389 (Object::as_needed_): New data member.
2391 2011-05-24 Cary Coutant <ccoutant@google.com>
2393 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2394 info; adjust display of GOT entries.
2395 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2396 vector of input objects; remove file_status_.
2397 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2398 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2399 got_plt reader; call target hooks to reserve GOT entries.
2400 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2401 of input file info header and GOT info entry.
2402 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2404 (Got_plt_view_info::got_descriptor): Remove.
2405 (Got_plt_view_info::sym_index): New data member.
2406 (Got_plt_view_info::input_index): New data member.
2407 (Local_got_offset_visitor::visit): Write input file index.
2408 (Global_got_offset_visitor::visit): Write 0 for input file index.
2409 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2410 with sym_index and input_index.
2411 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2412 incremental info GOT entry; replace got_descriptor with input_index.
2413 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2414 map from input file index to object.
2415 (Sized_relobj_incr::do_layout): Replace direct data member reference
2416 with accessor function.
2417 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2418 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2419 Adjust size of input file info header.
2420 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2421 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2422 (Incremental_input_entry_reader::get_input_section): Adjust size of
2423 input file info header.
2424 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2425 of incremental info GOT entry.
2426 (Incremental_got_plt_reader::get_got_desc): Remove.
2427 (Incremental_got_plt_reader::get_got_symndx): New function.
2428 (Incremental_got_plt_reader::get_got_input_index): New function.
2429 (Sized_incremental_binary::Sized_incremental_binary): Remove
2430 file_status_; add input_objects_.
2431 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2432 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2433 (Sized_incremental_binary::file_is_unchanged): Remove.
2434 (Sized_incremental_binary::set_input_object): New function.
2435 (Sized_incremental_binary::input_object): New function.
2436 (Sized_incremental_binary::file_status_): Remove.
2437 (Sized_incremental_binary::input_objects_): New data member.
2438 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2440 (Sized_relobj_incr::invalid_address): Move to base class.
2441 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2443 (Sized_relobj_incr::do_output_section_offset): Likewise.
2444 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2445 (Sized_relobj_incr::section_offsets_): Likewise.
2446 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2448 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2449 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2450 with accessor function.
2451 (Sized_relobj_file::do_layout): Likewise.
2452 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2453 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2454 (Sized_relobj_file::compute_final_local_value): Replace refs to
2455 section_offsets_ with accessor function.
2456 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2457 * object.h (Relobj::Relobj): Initialize new data members.
2458 (Relobj::add_dyn_reloc): New function.
2459 (Relobj::first_dyn_reloc): New function.
2460 (Relobj::dyn_reloc_count): New function.
2461 (Relobj::first_dyn_reloc_): New data member.
2462 (Relobj::dyn_reloc_count_): New data member.
2463 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2465 (Sized_relobj::Address): New typedef.
2466 (Sized_relobj::invalid_address): Move here from child class.
2467 (Sized_relobj::Sized_relobj): Initialize new data members.
2468 (Sized_relobj::sized_relobj): New function.
2469 (Sized_relobj::is_output_section_offset_invalid): Move here from
2471 (Sized_relobj::get_output_section_offset): Likewise.
2472 (Sized_relobj::local_has_got_offset): Likewise.
2473 (Sized_relobj::local_got_offset): Likewise.
2474 (Sized_relobj::set_local_got_offset): Likewise.
2475 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2476 (Sized_relobj::clear_got_offsets): New function.
2477 (Sized_relobj::section_offsets): Move here from child class.
2478 (Sized_relobj::do_output_section_offset): Likewise.
2479 (Sized_relobj::do_set_section_offset): Likewise.
2480 (Sized_relobj::Local_got_offsets): Likewise.
2481 (Sized_relobj::local_got_offsets_): Likewise.
2482 (Sized_relobj::section_offsets_): Likewise.
2483 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2485 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2487 (Sized_relobj_file::sized_relobj): New function
2488 (Sized_relobj_file::local_has_got_offset): Move to base class.
2489 (Sized_relobj_file::local_got_offset): Likewise.
2490 (Sized_relobj_file::set_local_got_offset): Likewise.
2491 (Sized_relobj_file::get_output_section_offset): Likewise.
2492 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2493 (Sized_relobj_file::do_output_section_offset): Likewise.
2494 (Sized_relobj_file::do_set_section_offset): Likewise.
2495 (Sized_relobj_file::Local_got_offsets): Likewise.
2496 (Sized_relobj_file::local_got_offsets_): Likewise.
2497 (Sized_relobj_file::section_offsets_): Likewise.
2498 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2500 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2501 (Output_reloc::get_symbol_index): Likewise.
2502 (Output_reloc::local_section_offset): Likewise.
2503 (Output_reloc::get_address): Likewise.
2504 (Output_reloc::symbol_value): Likewise.
2505 (Output_data_got::reserve_slot): Move to class definition.
2506 (Output_data_got::reserve_local): New function.
2507 (Output_data_got::reserve_slot_for_global): Remove.
2508 (Output_data_got::reserve_global): New function.
2509 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2510 (all constructors, two instantiations).
2511 (Output_reloc::get_relobj): New function (two instantiations).
2512 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2513 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2514 (Output_data_reloc::add_global): Adjust type of relobj.
2515 (Output_data_reloc::add_global_relative): Likewise.
2516 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2517 (Output_data_reloc::add_local): Likewise.
2518 (Output_data_reloc::add_local_relative): Likewise.
2519 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2520 (Output_data_reloc::add_local_section): Likewise.
2521 (Output_data_reloc::add_output_section): Likewise.
2522 (Output_data_reloc::add_absolute): Likewise.
2523 (Output_data_reloc::add_target_specific): Likewise.
2524 (Output_data_got::reserve_slot): Move definition here.
2525 (Output_data_got::reserve_local): New function.
2526 (Output_data_got::reserve_global): New function.
2527 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2528 section_offsets_ with accessor function.
2529 (Sized_relobj_file::write_sections): Likewise.
2530 (Sized_relobj_file::do_relocate_sections): Likewise.
2531 * target.h (Sized_target::reserve_local_got_entry): New function.
2532 (Sized_target::reserve_global_got_entry): New function.
2533 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2534 (Target_x86_64::reserve_global_got_entry): New function.
2535 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2537 2011-05-23 Cary Coutant <ccoutant@google.com>
2539 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2540 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2541 bit when checking got_type.
2542 * incremental.cc (Sized_incremental_binary::setup_readers):
2543 Store symbol table and string table locations; initialize bit vector
2544 of file status flags.
2545 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2547 (Sized_incremental_binary::do_process_got_plt): New function.
2548 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2549 (Output_section_incremental_inputs::set_final_data_size): Record
2550 file index for each input file.
2551 (Output_section_incremental_inputs::write_got_plt): Store file index
2552 instead of input entry offset for each GOT entry.
2554 (Incremental_input_entry::Incremental_input_entry): Initialize new
2556 (Incremental_input_entry::set_offset): Store file index.
2557 (Incremental_input_entry::get_file_index): New function.
2558 (Incremental_input_entry::file_index_): New data member.
2559 (Incremental_binary::process_got_plt): New function.
2560 (Incremental_binary::do_process_got_plt): New function.
2561 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2563 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2564 (Sized_incremental_binary::set_file_is_unchanged): New function.
2565 (Sized_incremental_binary::file_is_unchanged): New function.
2566 (Sized_incremental_binary::do_process_got_plt): New function.
2567 (Sized_incremental_binary::file_status_): New data member.
2568 (Sized_incremental_binary::main_symtab_loc_): New data member.
2569 (Sized_incremental_binary::main_strtab_loc_): New data member.
2570 * output.cc (Output_data_got::Got_entry::write): Add case
2572 (Output_data_got::add_global): Call add_got_entry.
2573 (Output_data_got::add_global_plt): Likewise.
2574 (Output_data_got::add_global_with_rel): Likewise.
2575 (Output_data_got::add_global_with_rela): Likewise.
2576 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2577 (Output_data_got::add_global_pair_with_rela): Likewise.
2578 (Output_data_got::add_local): Call add_got_entry.
2579 (Output_data_got::add_local_plt): Likewise.
2580 (Output_data_got::add_local_with_rel): Likewise.
2581 (Output_data_got::add_local_with_rela): Likewise.
2582 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2583 (Output_data_got::add_local_pair_with_rela): Likewise.
2584 (Output_data_got::reserve_slot): New function.
2585 (Output_data_got::reserve_slot_for_global): New function.
2586 (Output_data_got::add_got_entry): New function.
2587 (Output_data_got::add_got_entry_pair): New function.
2588 (Output_section::add_output_section_data): Edit FIXME.
2590 (Output_section_data_build::Output_section_data_build): New
2591 constructor with size parameter.
2592 (Output_data_space::Output_data_space): Likewise.
2593 (Output_data_got::Output_data_got): Initialize new data member; new
2594 constructor with size parameter.
2595 (Output_data_got::add_constant): Call add_got_entry.
2596 (Output_data_got::reserve_slot): New function.
2597 (Output_data_got::reserve_slot_for_global): New function.
2598 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2599 (Output_data_got::add_got_entry): New function.
2600 (Output_data_got::add_got_entry_pair): New function.
2601 (Output_data_got::free_list_): New data member.
2602 * target.h (Sized_target::init_got_plt_for_update): New function.
2603 (Sized_target::register_global_plt_entry): New function.
2604 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2605 Initialize new data member; call init; add constructor with PLT count.
2606 (Output_data_plt_x86_64::init): New function.
2607 (Output_data_plt_x86_64::add_relocation): New function.
2608 (Output_data_plt_x86_64::reserve_slot): New function.
2609 (Output_data_plt_x86_64::free_list_): New data member.
2610 (Target_x86_64::init_got_plt_for_update): New function.
2611 (Target_x86_64::register_global_plt_entry): New function.
2612 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2613 incremental updates.
2614 (Output_data_plt_x86_64::add_relocation): New function.
2615 * testsuite/object_unittest.cc (Object_test): Set default options.
2617 2011-05-16 Ian Lance Taylor <iant@google.com>
2619 * options.h (class General_options): Make -i a synonym for -r.
2621 2011-05-16 Ian Lance Taylor <iant@google.com>
2623 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2625 2011-05-10 Cary Coutant <ccoutant@google.com>
2627 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2630 2011-05-06 Ian Lance Taylor <iant@google.com>
2632 * layout.cc (Layout::layout): If the output section flags change,
2633 update the ordering.
2635 2011-04-25 Cary Coutant <ccoutant@google.com>
2637 * incremental-dump.cc (dump_incremental_inputs): Print local
2638 symbol info for each input file.
2640 (Output_section_incremental_inputs::set_final_data_size): Add local
2641 symbol info to input file entries in incremental info.
2642 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2643 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2644 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2645 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2647 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2648 (Sized_incr_relobj::do_relocate): Write the local symbols.
2649 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2650 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2651 Adjust size of input file header.
2652 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2653 (Incremental_inputs_reader::get_local_symbol_count): New function.
2654 (Incremental_inputs_reader::get_input_section): Adjust size of input
2656 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2657 (Sized_incr_relobj::This): New typedef.
2658 (Sized_incr_relobj::sym_size): New const data member.
2659 (Sized_incr_relobj::Local_symbol): New struct.
2660 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2661 (Sized_incr_relobj::do_local_symbol_offset): New function.
2662 (Sized_incr_relobj::local_symbol_count_): New data member.
2663 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2664 (Sized_incr_relobj::local_symbol_index_): New data member.
2665 (Sized_incr_relobj::local_symbol_offset_): New data member.
2666 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2667 (Sized_incr_relobj::local_symbols_): New data member.
2668 * object.h (Relobj::output_local_symbol_count): New function.
2669 (Relobj::local_symbol_offset): New function.
2670 (Relobj::do_output_local_symbol_count): New function.
2671 (Relobj::do_local_symbol_offset): New function.
2672 (Sized_relobj::do_output_local_symbol_count): New function.
2673 (Sized_relobj::do_local_symbol_offset): New function.
2675 2011-04-22 Vladimir Simonov <sv@sw.ru>
2677 * descriptors.cc (set_close_on_exec): New function.
2678 (Descriptors::open): Use set_close_on_exec.
2679 * output.cc (S_ISLNK): Define if not defined.
2681 2011-04-22 Cary Coutant <ccoutant@google.com>
2683 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2685 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2686 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2687 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2689 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2690 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2691 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2693 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2695 (Incremental_binary::apply_incremental_relocs): New function.
2696 (Incremental_binary::do_apply_incremental_relocs): New function.
2697 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2699 (Sized_incremental_binary::add_global_symbol): New function.
2700 (Sized_incremental_binary::global_symbol): New function.
2701 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2702 (Sized_incremental_binary::symbol_map_): New data member.
2703 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2704 * target.h (Sized_target::apply_relocation): New function.
2705 * target-reloc.h (apply_relocation): New function.
2706 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2708 2011-04-22 Doug Kwan <dougkwan@google.com>
2710 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2711 flag of a SHT_ARM_EXIDX section.
2712 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2713 * testsuite/Makefile.in: Regenerate.
2714 * testsuite/arm_exidx_test.s: New file.
2715 * testsuite/arm_exidx_test.sh: Same.
2717 2011-04-20 Cary Coutant <ccoutant@google.com>
2720 * archive.h (Incremental_archive_entry::Archive_member):
2721 Initialize arg_serial_ (second constructor).
2723 2011-04-17 Ian Lance Taylor <iant@google.com>
2725 * object.cc (Relocate_info::location): Simplify location string.
2726 * errors.cc (Errors::error_at_location): Don't print program
2728 (Errors::warning_at_location): Likewise.
2729 (Errors::undefined_symbol): Likewise.
2730 * testsuite/debug_msg.sh: Update accordingly.
2732 2011-04-14 Cary Coutant <ccoutant@google.com>
2734 * gold/layout.cc (Layout::symtab_section_offset): New function.
2735 * gold/layout.h (Layout::symtab_section_offset): New function.
2736 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2738 2011-04-12 Ian Lance Taylor <iant@google.com>
2740 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2741 with MREMAP_MAYMOVE.
2742 * output.h (class Output_file): Add map_is_allocated_ field.
2743 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2744 not available, provide stubs. If mremap is not available, #define
2746 (MREMAP_MAYMOVE): Define if not defined.
2747 (Output_file::Output_file): Initialize map_is_allocated_.
2748 (Output_file::resize): Check map_is_allocated_.
2749 (Output_file::map_anonymous): If mmap fails, use malloc.
2750 (Output_file::unmap): Don't do anything for an anonymous map.
2751 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2752 is not available, provide stubs.
2753 (File_read::View::~View): Use free rather than delete[].
2754 (File_read::make_view): Use malloc rather than new[]. If mmap
2756 (File_read::find_or_make_view): Use malloc rather than new[].
2757 * gold.h: Remove HAVE_REMAP code.
2758 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2759 exists. Rename mremap to gold_mremap. If mmap is not available
2761 * configure, config.in: Rebuild.
2763 2011-04-11 Ian Lance Taylor <iant@google.com>
2765 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2766 initialize local variable v.
2768 2011-04-11 Cary Coutant <ccoutant@google.com>
2770 * archive.cc (Archive::include_member): Adjust call to
2772 (Add_archive_symbols::run): Track argument serial numbers.
2773 (Lib_group::include_member): Likewise.
2774 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2775 * archive.h (Incremental_archive_entry::Archive_member):
2776 Initialize arg_serial_.
2777 (Archive_member::arg_serial_): New data member.
2778 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2779 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2781 (Sized_dynobj::do_for_all_local_got_entries): New function.
2782 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2784 * fileread.cc (get_mtime): New function.
2785 * fileread.h (get_mtime): New function.
2786 * gold.cc (queue_initial_tasks): Check for incremental update.
2787 (process_incremental_input): New function.
2788 (queue_middle_tasks): Don't force valid target for incremental
2790 * incremental-dump.cc (find_input_containing_global): Adjust
2791 size of symbol info entry.
2792 (dump_incremental_inputs): Dump argument serial number and
2793 in_system_directory flag; bias shndx by 1; print symbol names
2794 when dumping per-file symbol lists; use new symbol info readers.
2796 (Output_section_incremental_inputs:update_data_size): New function.
2797 (Sized_incremental_binary::setup_readers): Setup input readers
2798 for each input file; build maps for files added from libraries
2800 (Sized_incremental_binary::check_input_args): New function.
2801 (Sized_incremental_binary::do_check_inputs): Build map of argument
2802 serial numbers to input arguments.
2803 (Sized_incremental_binary::do_file_has_changed): Rename
2804 do_file_is_unchanged to this; compare file modification times.
2805 (Sized_incremental_binary::do_init_layout): New function.
2806 (Sized_incremental_binary::do_reserve_layout): New function.
2807 (Sized_incremental_binary::do_get_input_reader): Remove.
2808 (Sized_incremental_binary::get_symtab_view): New function.
2809 (Incremental_checker::can_incrementally_link_output_file): Remove.
2810 (Incremental_inputs::report_command_line): Exclude --debug options.
2811 (Incremental_inputs::report_archive_begin): Add parameter; track
2812 argument serial numbers; don't put input file entry for archive
2813 before archive members.
2814 (Incremental_inputs::report_archive_end): Put input file entry
2815 for archive after archive members.
2816 (Incremental_inputs::report_object): Add parameter; track argument
2817 serial numbers and in_system_directory flag.
2818 (Incremental_inputs::report_script): Add parameter; track argument
2820 (Output_section_incremental_inputs::set_final_data_size): Adjust
2821 size of symbol info entry; check for forwarding symbols.
2822 (Output_section_incremental_inputs::write_input_files): Write
2823 in_system_directory flag and argument serial number.
2824 (Output_section_incremental_inputs::write_info_blocks): Map section
2825 indices between incremental info and original input file; store
2826 input section index for each symbol.
2827 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2828 change operator() to visit().
2829 (class Global_got_offset_visitor): Likewise.
2830 (class Global_symbol_visitor_got_plt):
2831 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2833 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2834 (Sized_incr_relobj::do_read_symbols): New function.
2835 (Sized_incr_relobj::do_layout): New function.
2836 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2837 (Sized_incr_relobj::do_add_symbols): New function.
2838 (Sized_incr_relobj::do_should_include_member): New function.
2839 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2840 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2841 (Sized_incr_relobj::do_section_size): New function.
2842 (Sized_incr_relobj::do_section_name): New function.
2843 (Sized_incr_relobj::do_section_contents): New function.
2844 (Sized_incr_relobj::do_section_flags): New function.
2845 (Sized_incr_relobj::do_section_entsize): New function.
2846 (Sized_incr_relobj::do_section_address): New function.
2847 (Sized_incr_relobj::do_section_type): New function.
2848 (Sized_incr_relobj::do_section_link): New function.
2849 (Sized_incr_relobj::do_section_info): New function.
2850 (Sized_incr_relobj::do_section_addralign): New function.
2851 (Sized_incr_relobj::do_initialize_xindex): New function.
2852 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2853 (Sized_incr_relobj::do_read_relocs): New function.
2854 (Sized_incr_relobj::do_gc_process_relocs): New function.
2855 (Sized_incr_relobj::do_scan_relocs): New function.
2856 (Sized_incr_relobj::do_count_local_symbols): New function.
2857 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2858 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2859 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2860 (Sized_incr_relobj::do_relocate): New function.
2861 (Sized_incr_relobj::do_set_section_offset): New function.
2862 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2863 (Sized_incr_dynobj::do_read_symbols): New function.
2864 (Sized_incr_dynobj::do_layout): New function.
2865 (Sized_incr_dynobj::do_add_symbols): New function.
2866 (Sized_incr_dynobj::do_should_include_member): New function.
2867 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2868 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2869 (Sized_incr_dynobj::do_section_size): New function.
2870 (Sized_incr_dynobj::do_section_name): New function.
2871 (Sized_incr_dynobj::do_section_contents): New function.
2872 (Sized_incr_dynobj::do_section_flags): New function.
2873 (Sized_incr_dynobj::do_section_entsize): New function.
2874 (Sized_incr_dynobj::do_section_address): New function.
2875 (Sized_incr_dynobj::do_section_type): New function.
2876 (Sized_incr_dynobj::do_section_link): New function.
2877 (Sized_incr_dynobj::do_section_info): New function.
2878 (Sized_incr_dynobj::do_section_addralign): New function.
2879 (Sized_incr_dynobj::do_initialize_xindex): New function.
2880 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2881 (make_sized_incremental_object): New function.
2882 (Incremental_library::copy_unused_symbols): New function.
2883 (Incremental_library::do_for_all_unused_symbols): New function.
2884 * incremental.h (enum Incremental_input_flags): New type.
2885 (class Incremental_checker): Remove.
2886 (Incremental_input_entry::Incremental_input_entry): Add argument
2888 (Incremental_input_entry::arg_serial): New function.
2889 (Incremental_input_entry::set_is_in_system_directory): New function.
2890 (Incremental_input_entry::is_in_system_directory): New function.
2891 (Incremental_input_entry::arg_serial_): New data member.
2892 (Incremental_input_entry::is_in_system_directory_): New data member.
2893 (class Script_info): Move here from script.h.
2894 (Script_info::Script_info): Add filename parameter.
2895 (Script_info::filename): New function.
2896 (Script_info::filename_): New data member.
2897 (Incremental_script_entry::Incremental_script_entry): Add argument
2899 (Incremental_object_entry::Incremental_object_entry): Likewise.
2900 (Incremental_object_entry::add_input_section): Build list of input
2901 sections with map to original shndx.
2902 (Incremental_object_entry::get_input_section_index): New function.
2903 (Incremental_object_entry::shndx_): New data member.
2904 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2905 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2906 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2908 (Incremental_inputs::report_archive_begin): Likewise.
2909 (Incremental_inputs::report_object): Likewise.
2910 (Incremental_inputs::report_script): Likewise.
2911 (class Incremental_global_symbol_reader): New class.
2912 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2913 and store flags and input file type.
2914 (Incremental_input_entry_reader::arg_serial): New function.
2915 (Incremental_input_entry_reader::type): Extract type from flags.
2916 (Incremental_input_entry_reader::is_in_system_directory): New function.
2917 (Incremental_input_entry_reader::get_input_section_count): Call
2918 accessor function for type.
2919 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2920 function for type; adjust size of global symbol entry.
2921 (Incremental_input_entry_reader::get_global_symbol_count): Call
2922 accessor function for type.
2923 (Incremental_input_entry_reader::get_object_count): Likewise.
2924 (Incremental_input_entry_reader::get_object_offset): Likewise.
2925 (Incremental_input_entry_reader::get_member_count): Likewise.
2926 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2927 (Incremental_input_entry_reader::get_member_offset): Likewise.
2928 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2929 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2930 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2931 (Incremental_input_entry_reader::get_global_symbol_reader): New
2933 (Incremental_input_entry_reader::get_output_symbol_index): New
2935 (Incremental_input_entry_reader::type_): Remove.
2936 (Incremental_input_entry_reader::flags_): New data member.
2937 (Incremental_inputs_reader::input_file_offset): New function.
2938 (Incremental_inputs_reader::input_file_index): New function.
2939 (Incremental_inputs_reader::input_file): Call input_file_offset.
2940 (Incremental_inputs_reader::input_file_at_offset): New function.
2941 (Incremental_relocs_reader::get_r_type): Reformat.
2942 (Incremental_relocs_reader::get_r_shndx): Reformat.
2943 (Incremental_relocs_reader::get_r_offset): Reformat.
2944 (Incremental_relocs_reader::data): New function.
2945 (Incremental_binary::Incremental_binary): Initialize new data members.
2946 (Incremental_binary::check_inputs): Add cmdline parameter.
2947 (Incremental_binary::file_is_unchanged): Remove.
2948 (Input_reader::arg_serial): New function.
2949 (Input_reader::get_unused_symbol_count): New function.
2950 (Input_reader::get_unused_symbol): New function.
2951 (Input_reader::do_arg_serial): New function.
2952 (Input_reader::do_get_unused_symbol_count): New function.
2953 (Input_reader::do_get_unused_symbol): New function.
2954 (Incremental_binary::input_file_count): New function.
2955 (Incremental_binary::get_input_reader): Change signature to use
2956 index instead of filename.
2957 (Incremental_binary::file_has_changed): New function.
2958 (Incremental_binary::get_input_argument): New function.
2959 (Incremental_binary::get_library): New function.
2960 (Incremental_binary::get_script_info): New function.
2961 (Incremental_binary::init_layout): New function.
2962 (Incremental_binary::reserve_layout): New function.
2963 (Incremental_binary::output_file): New function.
2964 (Incremental_binary::do_check_inputs): New function.
2965 (Incremental_binary::do_file_is_unchanged): Remove.
2966 (Incremental_binary::do_file_has_changed): New function.
2967 (Incremental_binary::do_init_layout): New function.
2968 (Incremental_binary::do_reserve_layout): New function.
2969 (Incremental_binary::do_input_file_count): New function.
2970 (Incremental_binary::do_get_input_reader): Change signature.
2971 (Incremental_binary::input_args_map_): New data member.
2972 (Incremental_binary::library_map_): New data member.
2973 (Incremental_binary::script_map_): New data member.
2974 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2976 (Sized_incremental_binary::output_section): New function.
2977 (Sized_incremental_binary::inputs_reader): Add const.
2978 (Sized_incremental_binary::symtab_reader): Add const.
2979 (Sized_incremental_binary::relocs_reader): Add const.
2980 (Sized_incremental_binary::got_plt_reader): Add const.
2981 (Sized_incremental_binary::get_symtab_view): New function.
2982 (Sized_incremental_binary::Inputs_reader): New typedef.
2983 (Sized_incremental_binary::Input_entry_reader): New typedef.
2984 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2985 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2986 (Sized_incremental_binary::do_file_has_changed): New function.
2987 (Sized_incremental_binary::do_init_layout): New function.
2988 (Sized_incremental_binary::do_reserve_layout): New function.
2989 (Sized_input_reader::Inputs_reader): Remove.
2990 (Sized_input_reader::Input_entry_reader): Remove.
2991 (Sized_input_reader::do_arg_serial): New function.
2992 (Sized_input_reader::do_get_unused_symbol_count): New function.
2993 (Sized_input_reader::do_get_unused_symbol): New function.
2994 (Sized_incremental_binary::do_input_file_count): New function.
2995 (Sized_incremental_binary::do_get_input_reader): Change signature;
2996 use index instead of filename.
2997 (Sized_incremental_binary::section_map_): New data member.
2998 (Sized_incremental_binary::input_entry_readers_): New data member.
2999 (class Sized_incr_relobj): New class.
3000 (class Sized_incr_dynobj): New class.
3001 (make_sized_incremental_object): New function.
3002 (class Incremental_library): New class.
3003 * layout.cc (Free_list::num_lists): New static data member.
3004 (Free_list::num_nodes): New static data member.
3005 (Free_list::num_removes): New static data member.
3006 (Free_list::num_remove_visits): New static data member.
3007 (Free_list::num_allocates): New static data member.
3008 (Free_list::num_allocate_visits): New static data member.
3009 (Free_list::init): New function.
3010 (Free_list::remove): New function.
3011 (Free_list::allocate): New function.
3012 (Free_list::dump): New function.
3013 (Free_list::print_stats): New function.
3014 (Layout_task_runner::run): Resize output file for incremental updates.
3015 (Layout::Layout): Initialize new data members.
3016 (Layout::set_incremental_base): New function.
3017 (Layout::init_fixed_output_section): New function.
3018 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3019 incremental updates.
3020 (Layout::create_gold_note): Do not create gold note section for
3021 incremental updates.
3022 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3023 for incremental updates.
3024 (Layout::set_section_offsets): For incremental updates, allocate space
3026 (Layout::create_symtab_sections): Layout with offsets relative to
3027 start of section; for incremental updates, allocate space from free
3029 (Layout::create_shdrs): For incremental updates, allocate space from
3031 (Layout::finish_dynamic_section): For incremental updates, do not
3032 check --as-needed (fixed in subsequent patch).
3033 * layout.h (class Free_list): New class.
3034 (Layout::set_incremental_base): New function.
3035 (Layout::incremental_base): New function.
3036 (Layout::init_fixed_output_section): New function.
3037 (Layout::allocate): New function.
3038 (Layout::incremental_base_): New data member.
3039 (Layout::free_list_): New data member.
3040 * main.cc (main): Print Free_list statistics.
3041 * object.cc (Relobj::finalize_incremental_relocs): Add
3042 clear_counts parameter; clear counts only when clear_counts is set.
3043 (Sized_relobj::Sized_relobj): Initialize new base class.
3044 (Sized_relobj::do_layout): Don't report special sections.
3045 (Sized_relobj::do_for_all_local_got_entries): New function.
3046 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3047 symtab_off to all symbol table offsets.
3048 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3049 * object.h (class Got_offset_list): Move to top of file.
3050 (Object::Object): Allow case where input_file == NULL.
3051 (Object::~Object): Likewise.
3052 (Object::input_file): Assert that input_file != NULL.
3053 (Object::lock): Allow case where input_file == NULL.
3054 (Object::unlock): Likewise.
3055 (Object::is_locked): Likewise.
3056 (Object::token): Likewise.
3057 (Object::release): Likewise.
3058 (Object::is_incremental): New function.
3059 (Object::get_mtime): New function.
3060 (Object::for_all_local_got_entries): New function.
3061 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3062 (Object::set_is_in_system_directory): New function.
3063 (Object::is_in_system_directory): New function.
3064 (Object::do_is_incremental): New function.
3065 (Object::do_get_mtime): New function.
3066 (Object::do_for_all_local_got_entries): New function.
3067 (Object::is_in_system_directory_): New data member.
3068 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3069 (class Sized_relobj_base): New class.
3070 (class Sized_relobj): Derive from Sized_relobj_base.
3071 (class Sized_relobj::Symbols): Redeclare from base class.
3072 (class Sized_relobj::local_got_offset_list): Remove.
3073 (class Sized_relobj::Output_sections): Redeclare from base class.
3074 (class Sized_relobj::do_for_all_local_got_entries): New function.
3075 (class Sized_relobj::write_local_symbols): Add offset parameter.
3076 (class Sized_relobj::local_symbol_offset_): Update comment.
3077 (class Sized_relobj::local_dynsym_offset_): Update comment.
3078 * options.cc (Input_arguments::add_file): Remove const.
3079 * options.h (Input_file_argument::Input_file_argument):
3080 Initialize arg_serial_ (all constructors).
3081 (Input_file_argument::set_arg_serial): New function.
3082 (Input_file_argument::arg_serial): New function.
3083 (Input_file_argument::arg_serial_): New data member.
3084 (Input_arguments::Input_arguments): Initialize file_count_.
3085 (Input_arguments::add_file): Remove const.
3086 (Input_arguments::number_of_input_files): New function.
3087 (Input_arguments::file_count_): New data member.
3088 (Command_line::number_of_input_files): Call
3089 Input_arguments::number_of_input_files.
3090 * output.cc (Output_segment_headers::Output_segment_headers):
3092 (Output_section::Input_section::current_data_size): New function.
3093 (Output_section::Output_section): Initialize new data members.
3094 (Output_section::add_input_section): Don't do merge sections for
3095 an incremental link; allocate space from free list for an
3097 (Output_section::add_output_section_data): Allocate space from
3098 free list for an incremental update.
3099 (Output_section::update_data_size): New function.
3100 (Output_section::set_fixed_layout): New function.
3101 (Output_section::reserve): New function.
3102 (Output_segment::set_section_addresses): Remove const.
3103 (Output_segment::set_section_list_addresses): Remove const; allocate
3104 space from free list for an incremental update.
3105 (Output_segment::set_offset): Adjust size of RELRO segment for an
3107 * output.h (Output_data::current_data_size): Move here from
3109 (Output_data::pre_finalize_data_size): New function.
3110 (Output_data::update_data_size): New function.
3111 (Output_section_headers::update_data_size): new function.
3112 (Output_section_data_build::current_data_size): Move to Output_data.
3113 (Output_data_strtab::update_data_size): New function.
3114 (Output_section::current_data_size): Move to Output_data.
3115 (Output_section::set_fixed_layout): New function.
3116 (Output_section::has_fixed_layout): New function.
3117 (Output_section::reserve): New function.
3118 (Output_section::update_data_size): New function.
3119 (Output_section::has_fixed_layout_): New data member.
3120 (Output_section::free_list_): New data member.
3121 (Output_segment::set_section_addresses): Remove const.
3122 (Output_segment::set_section_list_addresses): Remove const.
3123 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3125 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3127 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3128 parameter when calling Add_symbols constructor; store argument
3129 serial number for members of a lib group.
3130 (Add_symbols::locks): Allow case where token == NULL.
3131 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3132 (Read_member::~Read_member): New function.
3133 (Read_member::is_runnable): New function.
3134 (Read_member::locks): New function.
3135 (Read_member::run): New function.
3136 (Check_script::~Check_script): New function.
3137 (Check_script::is_runnable): New function.
3138 (Check_script::locks): New function.
3139 (Check_script::run): New function.
3140 (Check_library::~Check_library): New function.
3141 (Check_library::is_runnable): New function.
3142 (Check_library::locks): New function.
3143 (Check_library::run): New function.
3144 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3145 (Add_symbols::library_): New data member.
3146 (class Read_member): New class.
3147 (class Check_script): New class.
3148 (class Check_library): New class.
3149 * reloc.cc (Read_relocs::is_runnable): Allow case where
3151 (Read_relocs::locks): Likewise.
3152 (Scan_relocs::locks): Likewise.
3153 (Relocate_task::locks): Likewise.
3154 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3156 (Sized_relobj::incremental_relocs_scan): Fix comment.
3157 (Sized_relobj::do_relocate): Pass output file offset to
3158 write_local_symbols.
3159 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3160 from class declaration.
3161 * script.cc (read_input_script): Allocate Script_info; pass
3162 argument serial number to report_script.
3163 * script.h (class Script_info): Move to incremental.h.
3164 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3165 * symtab.h (Symbol_table::add_from_incrobj): New function.
3166 (Symbol_table::set_file_offset): New function.
3168 2011-04-05 Cary Coutant <ccoutant@google.com>
3170 * incremental-dump.cc (dump_incremental_inputs): Change signature
3171 to take a Sized_incremental_binary; change caller. Use readers
3172 in Sized_incremental_binary.
3174 (Sized_incremental_binary::find_incremental_inputs_sections):
3175 Rename do_find_incremental_inputs_sections to this.
3176 (Sized_incremental_binary::setup_readers): New function.
3177 (Sized_incremental_binary::do_check_inputs): Check
3178 has_incremental_info_ flag; move setup code to setup_readers;
3180 (Sized_incremental_binary::do_file_is_unchanged): New function.
3181 (Sized_incremental_binary::do_get_input_reader): New function.
3182 * incremental.h (class Incremental_binary): Move to end of file.
3183 (Incremental_binary::file_is_unchanged): New function.
3184 (Incremental_binary::do_file_is_unchanged): New function.
3185 (Incremental_binary::Input_reader): New class.
3186 (Incremental_binary::get_input_reader): New function.
3187 (class Sized_incremental_binary): Move to end of file.
3188 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3189 input section reader classes.
3190 (Sized_incremental_binary::has_incremental_info): New function.
3191 (Sized_incremental_binary::inputs_reader): New function.
3192 (Sized_incremental_binary::symtab_reader): New function.
3193 (Sized_incremental_binary::relocs_reader): New function.
3194 (Sized_incremental_binary::got_plt_reader): New function.
3195 (Sized_incremental_binary::do_file_is_unchanged): New function.
3196 (Sized_incremental_binary::Sized_input_reader): New class.
3197 (Sized_incremental_binary::get_input_reader): New function.
3198 (Sized_incremental_binary::find_incremental_inputs_sections):
3199 Rename do_find_incremental_inputs_sections to this.
3200 (Sized_incremental_binary::setup_readers): New function.
3201 (Sized_incremental_binary::has_incremental_info_): New data member.
3202 (Sized_incremental_binary::inputs_reader_): New data member.
3203 (Sized_incremental_binary::symtab_reader_): New data member.
3204 (Sized_incremental_binary::relocs_reader_): New data member.
3205 (Sized_incremental_binary::got_plt_reader_): New data member.
3206 (Sized_incremental_binary::current_input_file_): New data member.
3208 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3211 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3214 2011-03-30 Cary Coutant <ccoutant@google.com>
3216 * archive.cc (Archive::include_member): Adjust call to report_object.
3217 (Add_archive_symbols::run): Add script_info to call to
3218 report_archive_begin.
3219 (Lib_group::include_member): Adjust call to report_object.
3220 (Add_lib_group_symbols::run): Adjust call to report_object.
3221 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3222 blocks. Add object count for script input files.
3223 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3224 script_info parameter; change all callers.
3225 (Incremental_inputs::report_object): Add script_info parameter;
3227 (Incremental_inputs::report_script): Store backpointer to
3228 incremental info entry.
3229 (Output_section_incremental_inputs::set_final_data_size): Record
3230 additional information for scripts.
3231 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3232 * incremental.h (Incremental_script_entry::add_object): New function.
3233 (Incremental_script_entry::get_object_count): New function.
3234 (Incremental_script_entry::get_object): New function.
3235 (Incremental_script_entry::objects_): New data member; adjust
3237 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3238 (Incremental_inputs::report_object): Add script_info parameter.
3239 (Incremental_inputs_reader::get_object_count): New function.
3240 (Incremental_inputs_reader::get_object_offset): New function.
3241 * options.cc (Input_arguments::add_file): Return reference to
3243 * options.h (Input_argument::set_script_info): New function.
3244 (Input_argument::script_info): New function.
3245 (Input_argument::script_info_): New data member; adjust all
3247 (Input_file_group::add_file): Return reference to new input argument.
3248 (Input_file_lib::add_file): Likewise.
3249 (Input_arguments::add_file): Likewise.
3250 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3251 * script.cc (Parser_closure::Parser_closure): Add script_info
3252 parameter; adjust all callers.
3253 (Parser_closure::script_info): New function.
3254 (Parser_closure::script_info_): New data member.
3255 (read_input_script): Report scripts earlier to incremental info.
3256 (script_add_file): Set script_info in Input_argument.
3257 (script_add_library): Likewise.
3258 * script.h (Script_options::Script_info): Rewrite class.
3260 2011-03-29 Cary Coutant <ccoutant@google.com>
3262 * archive.cc (Library_base::should_include_member): Move
3263 method here from class Archive.
3264 (Archive::Archive): Initialize base class.
3265 (Archive::should_include_member): Move to base class.
3266 (Archive::do_for_all_unused_symbols): New function.
3267 (Add_archive_symbols::run): Remove redundant access to
3269 (Lib_group::Lib_group): Initialize base class.
3270 (Lib_group::do_filename): New function.
3271 (Lib_group::include_member): Pass pointer to Lib_group to
3273 (Lib_group::do_for_all_unused_symbols): New function.
3274 (Add_lib_group_symbols::run): Report archive information for
3276 * archive.h (class Library_base): New base class.
3277 (class Archive): Derive from Library_base.
3278 (Archive::filename): Move to base class.
3279 (Archive::set_incremental_info): Likewise.
3280 (Archive::incremental_info): Likewise.
3281 (Archive::Should_include): Likewise.
3282 (Archive::should_include_member): Likewise.
3283 (Archive::Armap_entry): Remove.
3284 (Archive::Unused_symbol_iterator): Remove.
3285 (Archive::unused_symbols_begin): Remove.
3286 (Archive::unused_symbols_end): Remove.
3287 (Archive::do_filename): New function.
3288 (Archive::do_get_mtime): New function.
3289 (Archive::do_for_all_unused_symbols): New function.
3290 (Archive::task_): Move to base class.
3291 (Archive::incremental_info_): Likewise.
3292 (class Lib_group): Derive from Library_base.
3293 (Lib_group::do_filename): New function.
3294 (Lib_group::do_get_mtime): New function.
3295 (Lib_group::do_for_all_unused_symbols): New function.
3296 (Lib_group::task_): Move to base class.
3297 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3299 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3301 * incremental.cc (Incremental_inputs::report_archive_begin):
3302 Use Library_base; call library's get_mtime; add incremental inputs
3303 entry before members.
3304 (class Unused_symbol_visitor): New class.
3305 (Incremental_inputs::report_archive_end): Use Library_base; use
3306 visitor class to record unused symbols; don't add incremental inputs
3307 entry after members.
3308 (Incremental_inputs::report_object): Use Library_base.
3310 (Incremental_archive_entry::Incremental_archive_entry): Remove
3311 unused Archive parameter.
3312 (Incremental_inputs::report_archive_begin): Use Library_base.
3313 (Incremental_inputs::report_archive_end): Likewise.
3314 (Incremental_inputs::report_object): Likewise.
3315 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3317 * object.h (Object::for_all_global_symbols): New function.
3318 (Object::do_for_all_global_symbols): New function.
3319 (Sized_relobj::do_for_all_global_symbols): New function.
3320 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3322 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3325 2011-03-27 Ian Lance Taylor <iant@google.com>
3327 * archive.cc (Archive::interpret_header): Return -1 if something
3328 goes wrong. Change callers accordingly.
3330 2011-03-25 Cary Coutant <ccoutant@google.com>
3332 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3333 * testsuite/Makefile.in: Regenerate.
3335 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3337 * plugin.cc (get_view): New.
3338 (Plugin::load): Pass get_view to the plugin.
3339 (Plugin_manager::get_view): New.
3341 2011-03-21 Ian Lance Taylor <iant@google.com>
3343 * testsuite/final_layout.sh: Rewrite to not use dc.
3344 * testsuite/relro_test.sh: Fail if dc is not present.
3346 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3348 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3350 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3351 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3353 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3354 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3356 2011-03-14 Ian Lance Taylor <iant@google.com>
3358 * script-sections.cc (Sort_output_sections::script_compare):
3359 Rename from is_before, change return type.
3360 (Sort_output_sections::operator()): Adjust accordingly.
3362 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3365 * testsuite/odr_violation2.cc: Add comment to make all error line
3366 numbers double digits.
3367 * testsuite/debug_msg.sh: Adjust expected errors.
3369 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3371 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3372 but mark earlier ones as non-canonical
3373 (offset_to_iterator): Update search target and example
3374 (do_addr2line): Return extra lines in a vector*
3375 (format_file_lineno): Extract from do_addr2line
3376 (one_addr2line): Add vector* out-param
3377 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3378 when a lineno entry appeared last for its instruction
3379 (Dwarf_line_info): Add vector* out-param
3380 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3381 * symtab.cc (Odr_violation_compare): Include the lineno in the
3383 (linenos_from_loc): New. Combine the canonical line for an
3384 address with its other lines.
3385 (True_if_intersect): New. Helper functor to make
3386 std::set_intersection a query.
3387 (detect_odr_violations): Compare sets of lines instead of just
3388 one line for each function. This became less deterministic, but
3389 has fewer false positives.
3390 * symtab.h: Declarations.
3391 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3392 mix an optimized and non-optimized object in the same binary
3393 (odr_violation2.so): Same.
3394 * testsuite/Makefile.in: Regenerate from Makefile.am.
3395 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3396 * testsuite/debug_msg.sh: Update line numbers and add
3398 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3399 non-optimized context.
3400 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3401 isn't inlined, and use OdrDerived in an optimized context.
3402 * testsuite/odr_header1.h: Defines OdrDerived, where
3403 optimization will change the
3404 first-instruction-in-the-destructor's file and line number.
3405 * testsuite/odr_header2.h: Defines OdrBase.
3407 2011-03-09 Ian Lance Taylor <iant@google.com>
3409 * fileread.cc (File_read::clear_views): Don't delete the whole
3412 2011-03-08 Ian Lance Taylor <iant@google.com>
3415 * fileread.cc: #include <climits>.
3416 (GOLD_IOV_MAX): Define.
3417 (File_read::read_multiple): Limit number of entries by iov_max.
3418 * fileread.h (class File_read): Always set max_readv_entries to
3421 2011-03-07 Ian Lance Taylor <iant@google.com>
3424 * options.h (class General_options): Add -dy and -dn.
3426 2011-03-02 Cary Coutant <ccoutant@google.com>
3428 * testsuite/script_test_9.t: Add TLS segment.
3430 2011-03-02 Simon Baldwin <simonb@google.com>
3432 * configure.ac: Add check for gnu_indirect_function support in
3433 the toolchain building binutils.
3434 * configure: Rebuild.
3436 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3438 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3439 plugin only symbols.
3440 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3441 in plugin files as not needed in the symbol table.
3443 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3445 * output.cc (Output_section::add_input_section): Delay fill
3446 generation for section ordering.
3448 2011-02-09 Ian Lance Taylor <iant@google.com>
3451 * object.h (class Sized_relobj): Remove clear_local_symbols.
3452 * reloc.cc (Sized_relobj::do_relocate): Don't call
3453 clear_local_symbols.
3455 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3457 * plugin.cc (is_visible_from_outside): Return true for symbols
3460 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3462 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3465 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3467 * icf.h (is_section_foldable_candidate): Change type of parameter
3469 * icf.cc (Icf::find_identical_sections): Change type of local variable
3470 section_name to be std::string.
3471 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3473 2011-01-25 Ian Lance Taylor <iant@google.com>
3475 * script.cc (script_add_extern): Rewrite to use
3476 add_symbol_reference.
3478 2011-01-25 Doug Kwan <dougkwan@google.com>
3480 * icf.cc (get_section_contents): Always lock section's object.
3482 2011-01-24 Ian Lance Taylor <iant@google.com>
3484 * options.h (class General_options): Accept
3485 --no-detect-odr-violations.
3487 2011-01-24 Ian Lance Taylor <iant@google.com>
3489 * version.cc (version_string): Bump to 1.11.
3491 2011-01-24 Ian Lance Taylor <iant@google.com>
3493 * plugin.cc (class Plugin_rescan): Define new class.
3494 (Plugin_manager::claim_file): Set any_claimed_.
3495 (Plugin_manager::save_archive): New function.
3496 (Plugin_manager::save_input_group): New function.
3497 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3499 (Plugin_manager::new_undefined_symbol): New function.
3500 (Plugin_manager::rescan): New function.
3501 (Plugin_manager::rescannable_defines): New function.
3502 (Plugin_manager::add_input_file): Set any_added_.
3503 * plugin.h (class Plugin_manager): define new fields rescannable_,
3504 undefined_symbols_, any_claimed_, and any_added_. Declare
3505 Plugin_rescan as friend. Declare new functions.
3506 (Plugin_manager::Rescannable): Define type.
3507 (Plugin_manager::Rescannable_list): Define type.
3508 (Plugin_manager::Undefined_symbol_list): Define type.
3509 (Plugin_manager::Plugin_manager): Initialize new fields.
3510 * archive.cc (Archive::defines_symbol): New function.
3511 (Add_archive_symbols::run): Pass archive to plugins if any.
3512 * archive.h (class Archive): Declare defines_symbol.
3513 * readsyms.cc (Input_group::~Input_group): New function.
3514 (Finish_group::run): Pass input_group to plugins if any.
3515 * readsyms.h (class Input_group): Declare destructor.
3516 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3519 2011-01-10 Ian Lance Taylor <iant@google.com>
3521 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3523 (Layout::set_segment_offsets): Reset increase_relro before calling
3524 set_section_addresses a second time.
3526 2011-01-04 Cary Coutant <ccoutant@google.com>
3528 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3529 sections before NOBITS sections.
3531 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3533 * version.cc (print_version): Update copyright to 2011.
3535 2010-12-23 Cary Coutant <ccoutant@google.com>
3537 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3538 of OS to this->add. Add OD parameter to second form of the function.
3540 2010-12-20 Ian Lance Taylor <iant@google.com>
3542 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3543 second of two consecutive entries with same offset.
3545 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3547 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3548 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3549 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3550 to avoid unneeded links against $(LDADD).
3551 * testsuite/Makefile.in: Regenerate.
3553 2010-12-15 Ian Lance Taylor <iant@google.com>
3556 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3557 for R_X86_64_32 and R_X86_64_PC32.
3558 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3559 ver_matching_def_pic.o.
3560 (ver_matching_def_pic.o): New target.
3562 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3564 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3565 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3566 Move definition before File_read::View member definitions.
3567 (File_read::View::~View): Initialize and hold lock before
3568 updating current_mapped_bytes.
3570 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3572 * dwarf_reader.cc: Remove outdated comment.
3573 * gold-threads.cc: Fix typo in error message.
3574 * archive.cc: Fix typos in comments.
3575 * archive.h: Likewise.
3576 * arm-reloc-property.cc: Likewise.
3577 * arm-reloc-property.h: Likewise.
3578 * arm-reloc.def: Likewise.
3580 * attributes.h: Likewise.
3581 * cref.cc: Likewise.
3582 * ehframe.cc: Likewise.
3583 * fileread.h: Likewise.
3585 * i386.cc: Likewise.
3587 * incremental.h: Likewise.
3588 * int_encoding.cc: Likewise.
3589 * layout.h: Likewise.
3590 * main.cc: Likewise.
3591 * merge.h: Likewise.
3592 * object.cc: Likewise.
3593 * object.h: Likewise.
3594 * options.cc: Likewise.
3595 * readsyms.cc: Likewise.
3596 * reduced_debug_output.cc: Likewise.
3597 * reloc.cc: Likewise.
3598 * script-sections.cc: Likewise.
3599 * sparc.cc: Likewise.
3600 * symtab.h: Likewise.
3601 * target-reloc.h: Likewise.
3602 * target.cc: Likewise.
3603 * target.h: Likewise.
3604 * timer.cc: Likewise.
3605 * timer.h: Likewise.
3606 * x86_64.cc: Likewise.
3608 2010-12-09 Cary Coutant <ccoutant@google.com>
3610 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3612 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3613 parameter; change all callers.
3614 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3615 * options.h (warn_execstack): New option.
3617 2010-12-07 Doug Kwan <dougkwan@google.com>
3619 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3620 like function call relocations.
3622 2010-12-07 Ian Lance Taylor <iant@google.com>
3624 * archive.cc (Archive::get_elf_object_for_member): Permit
3625 punconfigured to be NULL.
3626 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3627 (Archive::include_member): Pass NULL to get_elf_object_for_member
3628 if we searched for the archive and this is the first included
3631 2010-12-01 Ian Lance Taylor <iant@google.com>
3633 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3634 track_relocs_type_ field.
3635 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3636 Set track_relocs_type_.
3637 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3638 contents when using RELA relocs.
3639 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3641 * reloc.cc (Track_relocs::next_addend): New function.
3642 * reloc.h (class Track_relocs): Declare next_addend.
3644 2010-12-01 Ian Lance Taylor <iant@google.com>
3646 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3649 2010-12-01 Ian Lance Taylor <iant@google.com>
3651 * README: Update compilers known to work and fail.
3653 2010-11-23 Matthias Klose <doko@ubuntu.com>
3655 * configure.in: For --enable-gold, handle value `default' instead of
3656 `both*'. Always install ld as ld.bfd, install as ld if gold is
3658 * configure: Regenerate.
3660 2010-11-18 Doug Kwan <dougkwan@google.com>
3662 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3663 and right_alignment to be zero. Store result alignment only if it is
3664 greater than existing alignment.
3666 2010-11-16 Cary Coutant <ccoutant@google.com>
3669 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3670 Check for ".zdebug_line".
3672 2010-11-16 Doug Kwan <dougkwan@google.com>
3673 Cary Coutant <ccoutant@google.com>
3675 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3676 by reference; adjust all callers.
3677 * output.cc (Output_segment::set_section_addresses): Adjust references
3678 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3680 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3681 end at page boundary.
3683 2010-11-16 Cary Coutant <ccoutant@google.com>
3686 * layout.cc (Layout::choose_output_section): Transform names of
3687 compressed sections even when using a script with a SECTIONS clause.
3688 (Layout::output_section_name): Remove code to transform
3689 compressed debug section names.
3690 * output.cc (Output_section::add_input_section): Use uncompressed
3691 section size when tracking input sections.
3693 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3695 * symtab.h (Symbol::NON_PIC_REF): Remove.
3696 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3697 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3698 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3699 (Symbol::use_plt_offset): Take a flags argument and pass it
3700 directly to needs_dynamic_reloc. Restrict check for undefined
3701 weak symbols to function calls.
3702 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3703 (Target_arm::Scan::global): Use it.
3704 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3705 (Target_arm::Relocate::relocate): Likewise.
3706 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3707 parameter with an r_type parameter. Use get_reference_flags
3709 (Target_arm::Relocate::relocate): Update accordingly.
3710 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3711 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3712 (Target_i386::Scan::global): Likewise.
3713 (Target_i386::Relocate::relocate): Likewise.
3714 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3715 parameter with an r_type parameter. Use get_reference_flags
3717 (Target_i386::Relocate::relocate): Update accordingly.
3718 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3719 (Target_powerpc::Scan::global): Use it.
3720 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3721 (Target_powerpc::Relocate::relocate): Likewise.
3722 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3723 (Target_sparc::Scan::global): Use it.
3724 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3725 (Target_sparc::Relocate::relocate): Likewise.
3726 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3727 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3728 (Target_x86_64::Scan::global): Likewise.
3729 (Target_x86_64::Relocate::relocate): Likewise.
3731 2010-11-08 Doug Kwan <dougkwan@google.com>
3732 Cary Coutant <ccoutant@google.com>
3734 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3735 (Arm_exidx_merge_section::section_contents_): New data member.
3736 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3737 (Arm_input_section::~Arm_input_section): De-allocate memory.
3738 (Arm_input_section::original_contents_): New data member.
3739 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3740 in parameters instead of calling Object::section_contents without
3742 (Arm_output_section::group_section): New parameter TASK. Pass it
3743 to callees that need locking objects.
3744 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3745 to lock EXIDX input sections. Fix a formatting issue. Call
3746 Arm_exidx_merged_section::build_contents to create merged section
3748 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3749 to lock object of stub table owner.
3750 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3751 TEXT_SIZE to initialize data member TEXT_SIZE_.
3752 (Arm_exidx_input_section::addralign): Fix typo in comment.
3753 (Arm_exidx_input_section::text_size): New method.
3754 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3755 that require locking objects. Lock objects before scanning for stubs
3756 and updating local symbols.
3757 (Arm_input_section<big_endian>::init): Copy contents of original
3759 (Arm_input_section<big_endian>::do_write): Use saved contents of
3760 original input section instead of calling Object::section_contents
3762 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3763 size without calling Object::section_size().
3764 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3765 for size. Allocate a buffer for merged EXIDX entries.
3766 (Arm_exidx_merged_section::build_contents): New method.
3767 (Arm_exidx_merged_section::do_write): Move merge section contents
3768 building code to Arm_exidx_merged_section::build_contetns. Write
3769 out contetns in buffer instead of building it on the fly.
3770 (Arm_relobj::make_exidx_input_section): Also pass text section size
3771 to Arm_exidx_input_section constructor.
3772 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3773 (Arm_dynobj::do_read_symbols): Fix memory leak.
3774 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3775 * target.h: (class Task): Add forward declaration.
3776 (Target::relax): Add new parameter TASK and pass it to
3778 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3780 2010-11-05 Cary Coutant <ccoutant@google.com>
3783 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3784 object when reading from the file.
3785 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3787 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3788 when reading section contents.
3789 (get_section_contents): Likewise.
3790 (icf::find_identical_sections): Likewise.
3791 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3792 object when reading from the file.
3793 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3794 the object when doing deferred section layout.
3796 2010-11-03 Nick Clifton <nickc@redhat.com>
3799 * script.h (class Symbol_assignment: name): New member. Returns
3800 the name of the symbol.
3801 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3802 Returns true if the given symbol name is on the list of
3803 assignments wating to be processed.
3804 * archive.cc (should_incldue_member): If the symbol is undefined,
3805 check to see if it is on the list of symbols pending assignment.
3807 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3809 * script-sections.cc (Script_sections::find_memory_region): Check
3810 for a NULL output section pointer.
3812 2010-10-29 Doug Kwan <dougkwan@google.com>
3814 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3815 Output_section::add_relaxed_input_section.
3816 * output.cc (Output_section::add_relaxed_input_section): Add new
3817 arguments LAYOUT and NAME. Set section order index.
3818 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3819 Copy section order index.
3820 * output.h (Output_section::add_relaxed_input_section): Add new
3821 arguments LAYOUT and NAME.
3823 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3825 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3826 NATIVE_OR_CROSS_LINKER.
3827 * testsuite/Makefile.in: Regenerate.
3829 2010-10-20 Doug Kwan <dougkwan@google.com>
3831 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3832 without SHF_LINK_ORDER flags.
3833 * layout.cc (Layout::choose_output_section): Do not filter
3834 SHF_LINK_ORDER flag in a relocatable link.
3836 2010-10-17 Cary Coutant <ccoutant@google.com>
3838 * output.h (Output_segment::set_section_addresses): Change function
3839 signature. Update all callers.
3840 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3842 (Output_segment::set_section_addresses): Align after last TLS
3843 section. Add padding before last relro section instead of after.
3845 2010-10-17 Doug Kwan <dougkwan@google.com>
3847 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3848 GOT output section to be writable.
3850 2010-10-14 Cary Coutant <ccoutant@google.com>
3852 * debug.h (DEBUG_INCREMENTAL): New flag.
3853 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3854 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3856 * incremental.cc (report_command_line): Ignore all forms of
3858 * layout.cc (Layout::Layout): Check parameters for incremental link
3860 * options.cc (General_options::parse_incremental): New function.
3861 (General_options::parse_no_incremental): New function.
3862 (General_options::parse_incremental_full): New function.
3863 (General_options::parse_incremental_update): New function.
3864 (General_options::incremental_mode_): New data member.
3865 (General_options::finalize): Check incremental_mode_.
3866 * options.h (General_options): Update help text for --incremental.
3867 Add --no-incremental, --incremental-full, --incremental-update.
3868 (General_options::Incremental_mode): New enum type.
3869 (General_options::incremental_mode): New function.
3870 (General_options::incremental_mode_): New data member.
3871 * parameters.cc (Parameters::incremental_mode_): New data member.
3872 (Parameters::set_options): Set incremental_mode_.
3873 (Parameters::set_incremental_full): New function.
3874 (Parameters::incremental): New function.
3875 (Parameters::incremental_update): New function.
3876 (set_parameters_incremental_full): New function.
3877 * parameters.h (Parameters::set_incremental_full): New function.
3878 (Parameters::incremental): New function.
3879 (Parameters::incremental_update): New function.
3880 (Parameters::incremental_mode_): New data member.
3881 (set_parameters_incremental_full): New function.
3882 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3883 incremental link mode.
3884 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3885 (Sized_relobj::do_relocate_sections): Likewise.
3886 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3888 * testsuite/Makefile.in: Regenerate.
3889 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3891 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3893 * script-sections.h (class Script_sections): Make
3894 Sections_elements typedef public.
3895 * script-sections.cc (class Sort_output_sections): Add elements_
3896 field. Add constructor which sets it; change all callers.
3897 (Sort_output_sections::is_before): New function.
3898 (Sort_output_sections::operator()): Call is_before.
3899 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3901 * testsuite/script_test_10.sh: New test. Test script section
3903 * testsuite/script_test_10.t: Likewise.
3904 * testsuite/script_test_10.s: Likewise.
3905 * testsuite/Makefile.am: Wrap the cross linker tests and the
3906 common tests into NATIVE_OR_CROSS_LINKER.
3907 (check_SCRIPTS): Add script_test_10.sh.
3908 (check_DATA): Add script_test_10.stdout.
3909 (script_test_10.o, script_test_10): New targets.
3910 (script_test_10.stdout): New target.
3911 * configure, testsuite/Makefile.in: Regenerate.
3913 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3915 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3916 error for the deprecated relocations.
3917 (Target_arm::Scan::global): Likewise.
3918 (Target_arm::Relocate::relocate): Likewise.
3920 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3922 * fileread.cc (Input_file::find_file): Initialize *found_name
3923 and *namep when using the fallback search for case 4.
3925 2010-10-11 Cary Coutant <ccoutant@google.com>
3927 * options.h (class General_options): Redefine -z lazy as an alias for
3928 the negation of -z now.
3930 2010-10-11 Ian Lance Taylor <iant@google.com>
3932 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3935 2010-10-06 Nick Clifton <nickc@redhat.com>
3937 * script-sections.cc(class Memory_region): Remove
3938 current_lma_offset_ field. Rename current_vma_offset_ to
3939 current_offset_. Add last_section_ field.
3940 (Memory_region::get_current_vma_address): Rename to
3941 get_current_address.
3942 (Memory_region::get_current_lma_address): Delete.
3943 (Memory_region::increment_vma_offset): Rename to
3945 (Memory_region::increment_lma_offset): Delete.
3946 (Memory_region::attributes_compatible): New method. Returns
3947 true if the provided section is compatible with the region.
3948 (Memory_region::get_last_section): New method. Returns the last
3949 section to use the region.
3950 (Memory_region::set_last_section): New method. Stores the last
3951 section to use the region.
3952 (Script_sections::block_in_region): New method. Returns true if
3953 a block of memory is contained within a region.
3954 (Script_sections::find_memory_region): New method. Locates a
3955 memory region to be used to set a VMA or LMA address.
3956 (Output_section_definition::set_section_addresses): Add code to
3957 check for addresses set by memory regions.
3958 (Output_segment::set_section_addresses): Remove memory region
3960 (Script_sections::create_segment): Add a warning if a header
3961 segment is created outside of any region.
3962 * script-sections.h (class Script_sections): Add prototypes for
3963 find_memory_region and block_in_region methods.
3964 * testsuite/memory_test.s: Use .long instead of .word.
3965 * testsuite/memory_test.t: Add some more output sections.
3966 * testsuite/memory_test.sh: Update expected output.
3968 2010-10-02 Doug Kwan <dougkwan@google.com>
3970 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3971 defintion to symtab.h
3972 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3973 declaration to defintion.
3975 2010-10-01 Nick Clifton <nickc@redhat.com>
3977 * expression.cc (eval): Replace dummy argument with NULL.
3978 (eval_maybe_dot): Check for a NULL result section pointer.
3979 (Symbol_expression::value): Likewise.
3980 (Dot_expression::value): Likewise.
3981 (BINARY_EXPRESSION): Likewise.
3982 (Max_expression::value): Likewise.
3983 (Min_expression::value): Likewise.
3984 (Absolute_expression::value): Likewise.
3985 (Addr_expression::value_from_output_section): Likewise.
3986 (Loaddddr_expression::value_from_output_section): Likewise.
3987 (Segment_start_expression::value): Likewise.
3988 * script-sections.cc
3989 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3991 (Sections_elememt_dot_assignment::set_section_addresses):
3993 (Output_data_expression::do_write_to_buffer): Likewise.
3994 (Output_section_definition::finalize_symbols): Likewise.
3995 (Output_section_definition::set_section_addresses): Likewise.
3997 2010-09-30 Doug Kwan <dougkwan@google.com>
3999 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4001 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4003 * target.h (Target::can_icf_inline_merge_sections): New virtual
4005 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4007 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4009 * icf.cc (get_section_contents): Inline merge sections only when
4012 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4014 * configure: Regenerate.
4016 2010-09-17 Ian Lance Taylor <iant@google.com>
4018 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4019 * testsuite/Makefile.am (memory_test.o): New target.
4020 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4022 * testsuite/Makefile.in: Rebuild.
4024 2010-09-17 Doug Kwan <dougkwan@google.com>
4026 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4027 defintion if relocation uses GOT entries of the symbol.
4028 * testsuite/icf_safe_test.sh: Fix test.
4029 * testsuite/icf_safe_so_test.sh: Fix test.
4031 2010-09-16 Cary Coutant <ccoutant@google.com>
4033 * script_sections.cc (class Memory_region): Remove "NULL" from
4034 vector initializations.
4036 2010-09-15 Cary Coutant <ccoutant@google.com>
4038 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4039 Resolve forwarding symbols.
4041 2010-09-15 Doug Kwan <dougkwan@google.com>
4043 * gold/testsuite/script_test_3.t: Add ARM special sections.
4044 * gold/testsuite/script_test_4.t: Same.
4045 * gold/testsuite/script_test_5.t: Same.
4046 * gold/testsuite/script_test_6.t: Same.
4047 * gold/testsuite/script_test_7.t: Same.
4048 * gold/testsuite/script_test_7.t: Same.
4049 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4051 2010-09-14 Cary Coutant <ccoutant@google.com>
4053 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4054 (Target_x86_64::Relocate::relocate_tls): Replace check for
4055 saw_tls_block_reloc_ with test for executable section.
4057 2010-09-12 Cary Coutant <ccoutant@google.com>
4059 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4060 position-independent executables to shared libraries need dynamic
4062 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4063 position-independent executables.
4064 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4065 * testsuite/Makefile.in: Regenerate.
4067 2010-09-10 Nick Clifton <nickc@redhat.com>
4070 * testsuite/memory_test.t: Discard any sections that are not
4073 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4076 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4077 "This::" to work around a bug in gcc 4.2.
4079 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4081 2010-09-09 Rafael Espindola <espindola@google.com>
4083 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4084 sections with different PF_X flags in the same segment.
4085 (Layout::find_first_load_seg): Search all segments to find the first
4087 * options.h (rosegment): New.
4089 2010-09-08 Rafael Espindola <espindola@google.com>
4091 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4093 2010-09-08 Doug Kwan <dougkwan@google.com>
4095 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4096 (Arm_relobj::do_relocate_sections): Add new parameter for output
4097 file to match the parent.
4098 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4099 of local symbols instead of input values. Update code to track
4100 changes in gold::relocate_section.
4101 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4102 (Sized_relobj::compute_final_local_value_internal): New methods.
4103 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4104 body into private version of Sized_relobj::compute_final_local_value.
4105 Call the inline method.
4106 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4107 merged symbol value if there is one.
4108 (Symbol_value::has_output_value): New method defintiion.
4109 (Sized_relobj::Compute_final_local_value_status): New enum type.
4110 (Sized_relobj::compute_final_local_value): New methods.
4111 (Sized_relobj::compute_final_local_value_internal): New methods.
4112 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4113 and arm_cortex_a8.sh.
4114 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4115 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4117 * Makefile.in: Regenerate.
4118 * testsuite/arm_bl_out_of_range.s: Update test.
4119 * testsuite/thumb_bl_out_of_range.s: Ditto.
4120 * testsuite/thumb_blx_out_of_range.s: Ditto.
4121 * testsuite/arm_branch_out_of_range.sh: New file.
4122 * testsuite/arm_cortex_a8.sh: Ditto.
4123 * testsuite/arm_cortex_a8_b.s: Ditto.
4124 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4125 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4126 * testsuite/arm_cortex_a8_bl.s: Ditto.
4127 * testsuite/arm_cortex_a8_blx.s: Ditto.
4128 * testsuite/arm_cortex_a8_local.s: Ditto.
4129 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4130 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4132 2010-09-08 Rafael Espindola <espindola@google.com>
4134 * Makefile.am (memory_test.stdout): Run readelf with -W.
4135 * Makefile.in: Regenerate.
4136 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4139 2010-09-08 Rafael Espindola <espindola@google.com>
4141 * script-sections.cc (Script_sections::add_memory_region): Convert
4142 field precision to int.
4143 * script.cc (script_set_section_region, script_set_section_region):
4144 Convert field precision to int.
4146 2010-09-08 Rafael Espindola <espindola@google.com>
4148 * arm.cc (do_finalize_sections): Create the __exidx_start and
4149 __exdix_end symbols even when the section is missing.
4151 2010-09-08 Nick Clifton <nickc@redhat.com>
4153 * README: Remove claim that MEMORY is not supported.
4154 * expression.cc (script_exp_function_origin)
4155 (script_exp_function_length): Move from here to ...
4156 * script.cc: ... here.
4157 (script_set_section_region, script_add_memory)
4158 (script_parse_memory_attr, script_include_directive): New
4160 * script-sections.cc
4161 (class Memory_region): New class.
4162 (class Output_section_definition): Add set_memory_region,
4163 set_section_vma, set_section_lma and get_section_name methods.
4164 (class Script_Sections): Add add_memory_region,
4165 find_memory_region, find_memory_region_origin,
4166 find_memory_region_length and set_memory_region methods.
4167 Have set_section_addresses method walk the list of set memory
4169 Extend the print methos to display memory regions.
4170 * script-sections.h: Add prototypes for new methods.
4171 Add enum for MEMORY region attributes.
4172 * yyscript.y: Add support for parsing MEMORY regions.
4173 * script-c.h: Add prototypes for new functions.
4174 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4175 * testsuite/Makefile.in: Regenerate.
4176 * testsuite/memory_test.sh: New script.
4177 * testsuite/memory_test.s: New assembler source file.
4178 * testsuite/memory_test.t: New linker script.
4180 2010-08-27 Doug Kwan <dougkwan@google.com>
4182 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4183 reference override an existing dynamic weak reference.
4184 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4185 * testsuite/Makefile.in: Regenerate.
4186 * testsuite/dyn_weak_ref.sh: New file.
4187 * testsuite/dyn_weak_ref_1.c: Ditto.
4188 * testsuite/dyn_weak_ref_2.c: Ditto.
4190 2010-08-27 Ian Lance Taylor <iant@google.com>
4192 * incremental.h (class Incremental_input_entry): Add virtual
4195 2010-08-27 Ian Lance Taylor <iant@google.com>
4197 * testsuite/start_lib_test_3.c: Mark t3 as used.
4199 2010-08-27 Nick Clifton <nickc@redhat.com>
4201 * options.cc (version_script): Fix small typo in previous
4204 2010-08-25 Nick Clifton <nickc@redhat.com>
4206 * archive.cc: Formatting fixes: Remove whitespace between
4207 typename and following asterisk. Remove whitespace between
4208 function name and opening parenthesis.
4209 * archive.h: Likewise.
4211 * attributes.cc: Likewise.
4212 * attributes.h: Likewise.
4213 * common.cc: Likewise.
4214 * copy-relocs.cc: Likewise.
4215 * dirsearch.h: Likewise.
4216 * dynobj.cc: Likewise.
4217 * ehframe.cc: Likewise.
4218 * ehframe.h: Likewise.
4219 * expression.cc: Likewise.
4220 * fileread.cc: Likewise.
4221 * fileread.h: Likewise.
4223 * gold-threads.cc: Likewise.
4224 * gold.cc: Likewise.
4225 * i386.cc: Likewise.
4227 * incremental-dump.cc: Likewise.
4228 * incremental.cc: Likewise.
4229 * layout.cc: Likewise.
4230 * layout.h: Likewise.
4231 * main.cc: Likewise.
4232 * merge.cc: Likewise.
4233 * merge.h: Likewise.
4234 * object.cc: Likewise.
4235 * object.h: Likewise.
4236 * options.cc: Likewise.
4237 * options.h: Likewise.
4238 * output.cc: Likewise.
4239 * output.h: Likewise.
4240 * plugin.cc: Likewise.
4241 * plugin.h: Likewise.
4242 * powerpc.cc: Likewise.
4243 * reloc.cc: Likewise.
4244 * script-c.h: Likewise.
4245 * script-sections.cc: Likewise.
4246 * script.cc: Likewise.
4247 * stringpool.cc: Likewise.
4248 * symtab.cc: Likewise.
4249 * symtab.h: Likewise.
4250 * target.cc: Likewise.
4251 * timer.cc: Likewise.
4252 * timer.h: Likewise.
4253 * version.cc: Likewise.
4254 * x86_64.cc: Likewise.
4256 2010-08-24 Nick Clifton <nickc@redhat.com>
4259 * layout.cc (segment_precedes): Sort segments by their physical
4260 addresses, if they have been set.
4262 2010-08-23 Cary Coutant <ccoutant@google.com>
4264 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4266 (Lib_group::include_member): Unlock object after deleting its
4268 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4271 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4272 Cary Coutant <ccoutant@google.com>
4274 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4275 constructor, and set_blocker.
4276 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4278 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4279 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4280 * testsuite/Makefile.am (start_lib_test): New test case.
4281 * testsuite/Makefile.in: Regenerate.
4282 * testsuite/start_lib_test_main.c: New file.
4283 * testsuite/start_lib_test_1.c: New file.
4284 * testsuite/start_lib_test_2.c: New file.
4285 * testsuite/start_lib_test_3.c: New file.
4287 2010-08-19 Ian Lance Taylor <iant@google.com>
4289 * Makefile.in: Rebuild with automake 1.11.1.
4290 * aclocal.m4: Likewise.
4291 * testsuite/Makefile.in: Likewise.
4293 2010-08-19 Ian Lance Taylor <iant@google.com>
4296 * i386.cc (class Output_data_plt_i386): Update declarations.
4297 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4298 local_ifuncs_ fields.
4299 (Target_i386::do_plt_section_for_global): New function.
4300 (Target_i386::do_plt_section_for_local): New function.
4301 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4302 parameter; change all callers. Initialize global_ifuncs_ and
4303 local_ifuncs_. If doing a static link define __rel_iplt_start and
4305 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4306 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4307 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4309 (Target_i386::make_plt_section): New function, broken out of
4310 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4311 (Target_i386::make_plt_entry): Call make_plt_section.
4312 (Target_i386::make_local_ifunc_plt_entry): New function.
4313 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4314 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4315 R_386_IRELATIVE to switch.
4316 (Target_i386::Scan::global): Likewise.
4317 (Target_i386::Relocate::relocate): Likewise.
4318 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4320 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4321 (Target_x86_64::do_plt_section_for_global): New function.
4322 (Target_x86_64::do_plt_section_for_local): New function.
4323 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4324 parameter; change all callers. If doing a static link define
4325 __rela_iplt_start and __rela_iplt_end.
4326 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4327 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4328 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4330 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4331 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4333 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4334 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4335 R_X86_64_IRELATIVE to switch.
4336 (Target_x86_64::Scan::global): Likewise.
4337 (Target_x86_64::Relocate::relocate): Likewise.
4338 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4340 * target.h (class Target): Add plt_section_for_global and
4341 plt_section_for_local functions. Add do_plt_section_for_global
4342 and do_plt_section_for_local virtual functions.
4343 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4344 clarifying comments.
4345 (Symbol::use_plt_offset): Handle IFUNC symbol.
4346 * object.cc (Sized_relobj::Sized_relobj): Initialize
4348 (Sized_relobj::local_has_plt_offset): New function.
4349 (Sized_relobj::local_plt_offset): New function.
4350 (Sized_relobj::set_local_plt_offset): New function.
4351 (Sized_relobj::do_count): Handle IFUNC symbol.
4352 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4353 a bit away from input_shndx_ field. Add set_is_func_symbol and
4354 is_ifunc_symbol functions.
4355 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4356 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4357 local_plt_offsets_ field.
4358 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4359 * output.h (class Output_section_data): Add non-const
4360 output_section function.
4361 (class Output_data_got): Update declarations.
4362 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4363 Add use_plt_offset parameter to global and local constructors.
4364 Change all callers. Change local_sym_index_ field to 31 bits.
4365 Change GSYM_CODE and CONSTANT_CODE accordingly.
4366 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4367 doing a static link don't set sh_link field.
4368 (Output_data_got::Got_entry::write): Use PLT offset if
4370 (Output_data_got::add_global_plt): New function.
4371 (Output_data_got::add_local_plt): New function.
4372 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4373 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4374 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4375 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4376 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4378 * testsuite/ifunc-sel.h: New file.
4379 * testsuite/ifuncmain1.c: New file.
4380 * testsuite/ifuncmain1vis.c: New file.
4381 * testsuite/ifuncmod1.c: New file.
4382 * testsuite/ifuncdep2.c: New file.
4383 * testsuite/ifuncmain2.c: New file.
4384 * testsuite/ifuncmain3.c: New file.
4385 * testsuite/ifuncmod3.c: New file.
4386 * testsuite/ifuncmain4.c: New file.
4387 * testsuite/ifuncmain5.c: New file.
4388 * testsuite/ifuncmod5.c: New file.
4389 * testsuite/ifuncmain6pie.c: New file.
4390 * testsuite/ifuncmod6.c: New file.
4391 * testsuite/ifuncmain7.c: New file.
4392 * configure, testsuite/Makefile.in: Rebuild.
4394 2010-08-18 Ian Lance Taylor <iant@google.com>
4397 (Output_section_incremental_inputs::write_input_files): Add cast
4398 to avoid signed/unsigned comparison warning.
4399 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4401 2010-08-12 Cary Coutant <ccoutant@google.com>
4403 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4405 2010-08-13 Ian Lance Taylor <iant@google.com>
4407 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4409 2010-08-12 Cary Coutant <ccoutant@google.com>
4410 Doug Kwan <dougkwan@google.com>
4412 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4413 defintion overrides non-weak undef, remember that the original undef
4415 * symtab.cc (Symbol_table::sized_write_global): For undef without
4416 an original weak binding, set binding to global in output.
4417 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4418 * testsuite/Makefile.in: Regenerate.
4419 * testsuite/strong_ref_weak_def.sh: New file.
4420 * testsuite/strong_ref_weak_def_1.c: Ditto.
4421 * testsuite/strong_ref_weak_def_2.c: Ditto.
4423 2010-08-12 Cary Coutant <ccoutant@google.com>
4425 * testsuite/incremental_test.sh: Rewrite.
4426 * testsuite/incremental_test_1.c: Rewrite.
4427 * testsuite/incremental_test_2.c: Rewrite.
4429 2010-08-12 Cary Coutant <ccoutant@google.com>
4431 * arm.cc (Target_arm::got_size): Add const.
4432 (Target_arm::got_entry_count): New function.
4433 (Target_arm::plt_entry_count): New function.
4434 (Target_arm::first_plt_entry_offset): New function.
4435 (Target_arm::plt_entry_size): New function.
4436 (Output_data_plt_arm::entry_count): New function.
4437 (Output_data_plt_arm::first_plt_entry_offset): New function.
4438 (Output_data_plt_arm::get_plt_entry_size): New function.
4439 * i386.cc (Target_i386::got_size): Add const.
4440 (Target_i386::got_entry_count): New function.
4441 (Target_i386::plt_entry_count): New function.
4442 (Target_i386::first_plt_entry_offset): New function.
4443 (Target_i386::plt_entry_size): New function.
4444 (Output_data_plt_i386::entry_count): New function.
4445 (Output_data_plt_i386::first_plt_entry_offset): New function.
4446 (Output_data_plt_i386::get_plt_entry_size): New function.
4447 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4448 find_incremental_inputs_sections. Dump incremental_got_plt section.
4449 * incremental.cc: Include target.h.
4450 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4451 parameter. Adjust all callers. Find incremental_got_plt section.
4452 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4454 (Output_section_incremental_inputs::set_final_data_size): Calculate
4455 size of incremental_got_plt section.
4456 (Output_section_incremental_inputs::do_write): Write the
4457 incremental_got_plt section.
4458 (Got_plt_view_info): New struct.
4459 (Local_got_offset_visitor): New class.
4460 (Global_got_offset_visitor): New class.
4461 (Global_symbol_visitor_got_plt): New class.
4462 (Output_section_incremental_inputs::write_got_plt): New function.
4463 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4464 Add parameter. Adjust all callers.
4465 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4466 (Incremental_inputs::got_plt_section): New function.
4467 (Incremental_inputs::got_plt_section_): New data member.
4468 (Incremental_got_plt_reader): New class.
4469 * layout.cc (Layout::create_incremental_info_sections): Add the
4470 incremental_got_plt section.
4471 * object.h (Got_offset_list::get_list): New function.
4472 (Got offset_list::for_all_got_offsets): New function.
4473 (Sized_relobj::local_got_offset_list): New function.
4474 * powerpc.cc (Target_powerpc::got_size): Add const.
4475 (Target_powerpc::got_entry_count): New function.
4476 (Target_powerpc::plt_entry_count): New function.
4477 (Target_powerpc::first_plt_entry_offset): New function.
4478 (Target_powerpc::plt_entry_size): New function.
4479 (Output_data_plt_powerpc::entry_count): New function.
4480 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4481 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4482 * sparc.cc (Target_sparc::got_size): Add const.
4483 (Target_sparc::got_entry_count): New function.
4484 (Target_sparc::plt_entry_count): New function.
4485 (Target_sparc::first_plt_entry_offset): New function.
4486 (Target_sparc::plt_entry_size): New function.
4487 (Output_data_plt_sparc::entry_count): New function.
4488 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4489 (Output_data_plt_sparc::get_plt_entry_size): New function.
4490 * symtab.h (Symbol::got_offset_list): New function.
4491 (Symbol_table::for_all_symbols): New function.
4492 * target.h (Sized_target::got_entry_count): New function.
4493 (Sized_target::plt_entry_count): New function.
4494 (Sized_target::plt_entry_size): New function.
4495 * x86_64.cc (Target_x86_64::got_size): Add const.
4496 (Target_x86_64::got_entry_count): New function.
4497 (Target_x86_64::plt_entry_count): New function.
4498 (Target_x86_64::first_plt_entry_offset): New function.
4499 (Target_x86_64::plt_entry_size): New function.
4500 (Output_data_plt_x86_64::entry_count): New function.
4501 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4502 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4504 2010-08-12 Cary Coutant <ccoutant@google.com>
4506 * archive.cc: Include incremental.h.
4507 (Archive::Archive): Initialize incremental_info_.
4508 (Archive::include_member): Record archive members in incremental info.
4509 (Add_archive_symbols::run): Record begin and end of an archive in
4511 (Lib_group::include_member): Record objects in incremental info.
4512 * archive.h (Incremental_archive_entry): Forward declaration.
4513 (Archive::set_incremental_info): New member function.
4514 (Archive::incremental_info): New member function.
4515 (Archive::Unused_symbol_iterator): New class.
4516 (Archive::unused_symbols_begin): New member function.
4517 (Archive::unused_symbols_end): New member function.
4518 (Archive::incremental_info_): New data member.
4519 * incremental-dump.cc (find_input_containing_global): New function.
4520 (dump_incremental_inputs): Dump new incremental info sections.
4521 * incremental.cc: Include symtab.h.
4522 (Output_section_incremental_inputs): New class.
4523 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4524 new incremental info sections.
4525 (Sized_incremental_binary::do_check_inputs): Likewise.
4526 (Incremental_inputs::report_archive): Remove.
4527 (Incremental_inputs::report_archive_begin): New function.
4528 (Incremental_inputs::report_archive_end): New function.
4529 (Incremental_inputs::report_object): New function.
4530 (Incremental_inputs::finalize_inputs): Remove.
4531 (Incremental_inputs::report_input_section): New function.
4532 (Incremental_inputs::report_script): Rewrite.
4533 (Incremental_inputs::finalize): Do nothing but finalize string table.
4534 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4535 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4536 (Incremental_inputs::create_data_sections): New function.
4537 (Incremental_inputs::relocs_entsize): New function.
4538 (Output_section_incremental_inputs::set_final_data_size): New function.
4539 (Output_section_incremental_inputs::do_write): New function.
4540 (Output_section_incremental_inputs::write_header): New function.
4541 (Output_section_incremental_inputs::write_input_files): New function.
4542 (Output_section_incremental_inputs::write_info_blocks): New function.
4543 (Output_section_incremental_inputs::write_symtab): New function.
4544 * incremental.h (Incremental_script_entry): Forward declaration.
4545 (Incremental_object_entry): Forward declaration.
4546 (Incremental_archive_entry): Forward declaration.
4547 (Incremental_inputs): Forward declaration.
4548 (Incremental_inputs_header_data): Remove.
4549 (Incremental_inputs_header): Remove.
4550 (Incremental_inputs_header_write): Remove.
4551 (Incremental_inputs_entry_data): Remove.
4552 (Incremental_inputs_entry): Remove.
4553 (Incremental_inputs_entry_write): Remove.
4554 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4555 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4556 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4557 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4559 (Incremental_input_entry): New class.
4560 (Incremental_script_entry): New class.
4561 (Incremental_object_entry): New class.
4562 (Incremental_archive_entry): New class.
4563 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4564 (Incremental_inputs::report_inputs): Remove.
4565 (Incremental_inputs::report_archive): Remove.
4566 (Incremental_inputs::report_archive_begin): New function.
4567 (Incremental_inputs::report_archive_end): New function.
4568 (Incremental_inputs::report_object): Change prototype.
4569 (Incremental_inputs::report_input_section): New function.
4570 (Incremental_inputs::report_script): Change prototype.
4571 (Incremental_inputs::get_reloc_count): New function.
4572 (Incremental_inputs::set_reloc_count): New function.
4573 (Incremental_inputs::create_data_sections): New function.
4574 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4575 (Incremental_inputs::inputs_section): New function.
4576 (Incremental_inputs::symtab_section): New function.
4577 (Incremental_inputs::relocs_section): New function.
4578 (Incremental_inputs::get_stringpool): Add const.
4579 (Incremental_inputs::command_line): Add const.
4580 (Incremental_inputs::inputs): Remove.
4581 (Incremental_inputs::command_line_key): New function.
4582 (Incremental_inputs::input_file_count): New function.
4583 (Incremental_inputs::input_files): New function.
4584 (Incremental_inputs::relocs_entsize): New function.
4585 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4586 (Incremental_inputs::finalize_inputs): Remove.
4587 (Incremental_inputs::Input_info): Remove.
4588 (Incremental_inputs::lock_): Remove.
4589 (Incremental_inputs::inputs_): Change type.
4590 (Incremental_inputs::inputs_map_): Remove.
4591 (Incremental_inputs::current_object_entry_): New data member.
4592 (Incremental_inputs::inputs_section_): New data member.
4593 (Incremental_inputs::symtab_section_): New data member.
4594 (Incremental_inputs::relocs_section_): New data member.
4595 (Incremental_inputs::reloc_count_): New data member.
4596 (Incremental_inputs_reader): New class.
4597 (Incremental_symtab_reader): New class.
4598 (Incremental_relocs_reader): New class.
4599 * layout.cc (Layout::finalize): Move finalization of incremental info
4600 and creation of incremental info sections to follow finalization of
4601 symbol table. Set offsets for postprocessing sections.
4602 (Layout::create_incremental_info_sections): Call
4603 Incremental_inputs::create_data_sections. Add incremental symtab
4604 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4605 sections to layout after input sections.
4606 * layout.h (struct Timespec): Forward declaration.
4607 (Layout::incremental_inputs): Add const.
4608 (Layout::create_incremental_info_sections): Add parameter.
4609 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4610 * object.cc: Include incremental.h.
4611 (Relobj::finalize_incremental_relocs): New function.
4612 (Sized_relobj::do_layout): Record input sections in incremental info.
4613 * object.h (Object::output_section): New function.
4614 (Object::output_section_offset): Moved from Relobj.
4615 (Object::get_incremental_reloc_base): New function.
4616 (Object::get_incremental_reloc_count): New function.
4617 (Object::do_output_section): New function.
4618 (Object::do_output_section_offset): Moved from Relobj.
4619 (Object::do_get_incremental_reloc_base): New function.
4620 (Object::do_get_incremental_reloc_count): New function.
4621 (Object::Object): Initialize new data members.
4622 (Relobj::output_section): Renamed do_output_section and moved to
4624 (Relobj::output_section_offset): Moved to Object.
4625 (Relobj::do_get_incremental_reloc_base): New function.
4626 (Relobj::do_get_incremental_reloc_count): New function.
4627 (Relobj::allocate_incremental_reloc_counts): New function.
4628 (Relobj::count_incremental_reloc): New function.
4629 (Relobj::finalize_incremental_relocs): New function.
4630 (Relobj::next_incremental_reloc_index): New function.
4631 (Relobj::reloc_counts_): New data member.
4632 (Relobj::reloc_bases_): New data member.
4633 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4634 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4635 (Sized_relobj::incremental_relocs_scan): New function.
4636 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4637 (Sized_relobj::incremental_relocs_write): New function.
4638 (Sized_relobj::incremental_relocs_write_reltype): New function.
4639 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4641 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4642 archives and object files elsewhere.
4643 (Add_symbols::run): Report object files here.
4644 (Finish_group::run): Report end of archive at end of group.
4645 * reloc.cc: Include layout.h, incremental.h.
4646 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4647 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4648 (Sized_relobj::incremental_relocs_scan): New function.
4649 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4650 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4651 (Sized_relobj::incremental_relocs_write): New function.
4652 (Sized_relobj::incremental_relocs_write_reltype): New function.
4653 * script.cc (read_input_script): Rewrite test for incremental link.
4654 Change call to Incremental_inputs::report_script.
4655 * symtab.h (Symbol_table::first_global_index): New function.
4656 (Symbol_table::output_count): New function.
4658 2010-08-12 Doug Kwan <dougkwan@google.com>
4660 * arm.cc (Target_arm::merge_object_attributes): Check command line
4661 options --no-wchar-size-warning and --no-enum-size-warning.
4662 * options.h (General_options): Add ld-compatible options
4663 --no-enum-size-warning and --no-wchar-size-warning.
4665 2010-08-04 Ian Lance Taylor <iant@google.com>
4667 * x86_64.cc (Target_x86_64::Scan::local): Use
4668 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4669 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4670 (Target_x86_64::Scan::global): Likewise.
4671 (Target_x86_64::Relocate::relocate): Likewise.
4672 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4675 2010-08-03 Cary Coutant <ccoutant@google.com>
4677 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4678 to reserve space in merged_strings vector. Keep total input size
4680 (Output_merge_string::do_print_merge_stats): Print total input size.
4681 * merge.h (Output_merge_string): Add input_size_ field.
4682 * stringpool.cc (Stringpool_template::string_length): Move
4683 implementations out of Stringpool_template class and place in
4685 * stringpool.h (string_length): Move out of Stringpool_template.
4687 2010-08-03 Ian Lance Taylor <iant@google.com>
4690 * layout.cc (relaxation_loop_body): If address of load segment is
4691 set, adjust address to include headers if possible.
4693 2010-08-03 Ian Lance Taylor <iant@google.com>
4695 * version.cc (version_string): Bump to 1.10.
4697 2010-08-03 Ian Lance Taylor <iant@google.com>
4700 * layout.h (enum Output_section_order): Define.
4701 (class Layout): Update declarations.
4702 * layout.cc (Layout::get_output_section): Add order parameter.
4703 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4704 is_first_non_relro parameters. Change all callers.
4705 (Layout::choose_output_section): Likewise.
4706 (Layout::add_output_section_data): Likewise.
4707 (Layout::make_output_section): Likewise. Set order.
4708 (Layout::default_section_order): New function.
4709 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4710 * output.cc (Output_section::Output_section): Initialize order_.
4711 Don't initialize deleted fields.
4712 (Output_segment::Output_segment): Don't initialize deleted
4714 (Output_segment::add_output_section_to_load): New function
4715 replacing add_output_section. Change all callers to call this or
4716 add_output_section_to_nonload.
4717 (Output_segment::add_output_section_to_nonload): New function.
4718 (Output_segment::remove_output_section): Rewrite.
4719 (Output_segment::add_initial_output_data): Likewise.
4720 (Output_segment::has_any_data_sections): Likewise.
4721 (Output_segment::is_first_section_relro): Likewise.
4722 (Output_segment::maximum_alignment): Likewise.
4723 (Output_segment::has_dynamic_reloc): New function replacing
4724 dynamic_reloc_count. Change all callers.
4725 (Output_segment::has_dynamic_reloc_list): New function replacing
4726 dynamic_reloc_count_list. Change all callers.
4727 (Output_segment::set_section_addresses): Rewrite.
4728 (Output_segment::set_offset): Rewrite.
4729 (Output_segment::find_first_and_last_list): Remove.
4730 (Output_segment::set_tls_offsets): Rewrite.
4731 (Output_segment::first_section_load_address): Likewise.
4732 (Output_segment::output_section_count): Likewise.
4733 (Output_segment::section_with_lowest_load_address): Likewise.
4734 (Output_segment::write_section_headers): Likewise.
4735 (Output_segment::print_sections_to_map): Likewise.
4736 * output.h (class Output_data): Remove dynamic_reloc_count_
4737 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4738 (Output_data::add_dynamic_reloc): Rewrite.
4739 (Output_data::has_dynamic_reloc): New function.
4740 (Output_data::dynamic_reloc_count): Remove.
4741 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4742 is_last_relro_, is_first_non_relro_, is_interp_,
4743 is_dynamic_linker_section_ fields. Add order and set_order
4744 functions. Remove is_relro_local, set_is_relro_local,
4745 is_last_relro, set_is_last_relro, is_first_non_relro,
4746 set_is_first_non_relro functions, is_interp, set_is_interp,
4747 is_dynamic_linker_section, and set_is_dynamic_linker_section
4749 (class Output_segment): Change Output_data_list from std::list to
4750 std:;vector. Add output_lists_ field. Remove output_data_ and
4751 output_bss_ fields. Update declarations.
4753 2010-08-02 Ian Lance Taylor <iant@google.com>
4755 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4756 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4757 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4759 2010-08-02 Ian Lance Taylor <iant@google.com>
4762 * script.cc (Script_options::Script_options): Initialize
4763 symbol_definitions_ and symbol_references_.
4764 (Script_options::add_symbol_assignment): Update
4765 symbol_definitions_ and symbol_references_.
4766 (Script_options::add_symbol_reference): New function.
4767 (script_symbol): New function.
4768 * script.h (class Script_options): Add symbol_definitions_ and
4769 symbol_references_ fields.
4770 (Script_options::referenced_const_iterator): New type.
4771 (Script_options::referenced_begin): New function.
4772 (Script_options::referenced_end): New function.
4773 (Script_options::is_referenced): New function.
4774 (Script_options::any_unreferenced): New function.
4775 * script-c.h (script_symbol): Declare.
4776 * yyscript.y (exp): Call script_symbol.
4777 * symtab.cc: Include "script.h".
4778 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4779 Change all callers. Check symbols referenced by scripts.
4780 (Symbol_table::add_undefined_symbols_from_command_line): Add
4781 layout parameter. Change all callers.
4782 (Symbol_table::do_add_undefined_symbols_from_command_line):
4783 Likewise. Break out loop body. Check symbols referenced by
4785 (Symbol_table::add_undefined_symbol_from_command_line): New
4786 function broken out of
4787 do_add_undefined_symbols_from_command_line.
4788 * symtab.h (class Symbol_table): Update declarations.
4789 * archive.cc: Include "layout.h".
4790 (Archive::should_include_member): Add layout parameter. Change
4791 all callers. Check for symbol mentioned in expression.
4792 * archive.h (class Archive): Update declaration.
4793 * object.cc (Sized_relobj::do_should_include_member): Add layout
4795 * object.h (Object::should_include_member): Add layout parameter.
4797 (Object::do_should_include_member): Add layout parameter.
4798 (class Sized_relobj): Update declaration.
4799 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4801 * dynobj.h (class Sized_dynobj): Update declaration.
4802 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4804 * plugin.h (class Sized_pluginobj): Update declaration.
4806 2010-08-02 Ian Lance Taylor <iant@google.com>
4809 * output.cc (Output_segment::set_offset): Search for the first and
4810 last sections rather than assuming that the list is in order.
4811 (Output_segment::find_first_and_last_list): New function.
4812 * output.h (class Output_segment): Update declarations.
4813 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4814 (relro_strip_test_SOURCES): New variable.
4815 (relro_strip_test_DEPENDENCIES): New variable.
4816 (relro_strip_test_LDFLAGS): New variable.
4817 (relro_strip_test_LDADD): New variable.
4818 (relro_strip_test.so): New target.
4820 2010-08-02 Ian Lance Taylor <iant@google.com>
4822 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4823 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4824 (Target_i386::got_tlsdesc_section): New function.
4825 (Target_i386::got_section): Create space for GOT entries for
4826 TLSDESC relocations.
4827 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4829 (Target_i386::Scan::global): Likewise.
4830 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4832 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4833 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4834 (Target_x86_64::got_tlsdesc_section): New function.
4835 (Target_x86_64::got_section): Create space for GOT entries for
4836 TLSDESC relocations.
4837 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4839 (Target_x86_64::Scan::global): Likewise.
4840 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4843 2010-08-02 Ian Lance Taylor <iant@google.com>
4845 * testsuite/final_layout.sh: Use dc to convert from hex to
4848 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4850 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4851 paramter to the call to gold::gc_process_relocs.
4852 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4853 paramter to the call to gold::gc_process_relocs.
4854 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4855 parameter to the call to gold::gc_process_relocs.
4856 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4857 template parameter to the call to gold::gc_process_relocs.
4858 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4859 paramter to the call to gold::gc_process_relocs.
4860 * gc.h (get_embedded_addend_size): New function.
4861 (gc_process_relocs): Save the size of the reloc for use by ICF.
4862 * icf.cc (get_section_contents): Get the addend from the text section
4863 for SHT_REL relocation sections.
4864 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4865 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4866 * int_encoding.h (read_from_pointer): New overloaded function.
4867 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4868 * testsuite/icf_sht_rel_addend_test.sh: New file.
4869 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4870 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4872 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4874 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4875 * Makefile.in: Regenerate.
4876 * testsuite/Makefile.in: Regenerate.
4878 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4880 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4881 * gold/testsuite/debug_msg.cc: Likewise.
4882 * gold/testsuite/odr_violation1.cc
4883 * gold/testsuite/odr_violation2.cc
4885 2010-07-21 Cary Coutant <ccoutant@google.com>
4887 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4888 string, and length fields.
4889 (Output_merge_string::Merged_strings_list): New type.
4890 (Output_merge_string::Merged_strings_lists): New typedef.
4891 (Output_merge_string): Replace merged_strings_ with
4892 merged_strings_lists_.
4893 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4894 Merged_strings_list per input object and section. Don't store pointer
4895 to the string. Don't store length with each merged string entry.
4896 (Output_merge_string::finalize_merged_data): Loop over list of merged
4897 strings lists. Recompute length of each merged string.
4899 2010-07-15 Cary Coutant <ccoutant@google.com>
4901 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4904 2010-07-14 Ian Lance Taylor <iant@google.com>
4906 * descriptors.cc (Descriptors::open): Report correct name in error
4909 2010-07-13 Doug Kwan <dougkwan@google.com>
4911 * arm.cc (Arm_input_section::Arm_input_section): For a
4912 SHT_ARM_EXIDX section, always keeps the input sections.
4913 (Arm_input_section::set_exidx_section_link): New method.
4914 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4915 has_errors_ to false.
4916 (Arm_exidx_input_section::has_errors,
4917 Arm_exidx_input_section::set_has_errors): New methods.
4918 (Arm_exidx_input_section::has_errors_): New data member.
4919 (Arm_relobj::get_exidx_shndx_list): New method.
4920 (Arm_output_section::append_text_sections_to_list): Do not skip
4921 section without SHF_EXECINSTR.
4922 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4924 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4925 section header. Make error messages more verbose. Check for
4926 a non-executable section linked to an EXIDX section.
4927 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4928 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4929 check that there is no deferred EXIDX section if we exit early.
4930 Instead of not making an EXIDX section in case of an error, make one
4931 and set the has_errors flag of it.
4932 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4933 in a relocatable link.
4934 (Target_arm::do_relax): Look for the EXIDX output section instead of
4935 assuming that it is called .ARM.exidx.
4936 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4937 section list. Do not check for SHF_EXECINSTR section flags but
4938 skip any input section with errors.
4939 * output.cc (Output_section::Output_section): Initialize
4940 always_keeps_input_sections_ to false.
4941 (Output_section::add_input_section): Check for
4942 always_keeps_input_sections_.
4943 * output.h (Output_section::always_keeps_input_sections,
4944 Output_section::set_always_keeps_input_sections): New methods.
4945 (Output_section::always_keeps_input_sections): New data member.
4947 2010-07-13 Rafael Espindola <espindola@google.com>
4949 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4950 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4952 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4953 Ian Lance Taylor <iant@google.com>
4955 * output.h (Output_section_lookup_maps::add_merge_section):
4956 Correct check of whether value was inserted.
4957 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4958 (Output_section_lookup_maps::add_relaxed_input_section):
4960 * arm.cc (Target_arm::got_section): Remove used local os.
4961 * i386.cc (Target_i386::got_section): Likewise.
4962 * x86_64.cc (Target_x86_64::got_section): Likewise.
4963 * sparc.cc (Target_sparc::got_section): Likewise.
4964 (Target_sparc::relocate): Remove unused local have_got_offset.
4965 * powerpc.cc (Target_powerpc::relocate): Likewise.
4967 2010-07-13 Ian Lance Taylor <iant@google.com>
4969 * compressed_output.cc (zlib_decompress): Fix signature in
4972 * archive.cc (Archive::include_member): Unlock an external member
4973 of a thin archive. Don't bother to delete an object we know is
4976 2010-07-12 Cary Coutant <ccoutant@google.com>
4978 * compressed_output.cc (zlib_decompress): New function.
4979 (get_uncompressed_size): New function.
4980 (decompress_input_section): New function.
4981 * compressed_output.h (get_uncompressed_size): New function.
4982 (decompress_input_section): New function.
4983 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4984 Handle compressed debug sections.
4985 * layout.cc (is_compressed_debug_section): New function.
4986 (Layout::output_section_name): Map compressed section names to
4988 * layout.h (is_compressed_debug_section): New function.
4989 (is_debug_info_section): Recognize compressed debug sections.
4990 * merge.cc: Include compressed_output.h.
4991 (Output_merge_data::do_add_input_section): Handle compressed
4993 (Output_merge_string::do_add_input_section): Handle compressed
4995 * object.cc: Include compressed_output.h.
4996 (Sized_relobj::Sized_relobj): Initialize new data members.
4997 (build_compressed_section_map): New function.
4998 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4999 * object.h (Object::section_is_compressed): New method.
5000 (Object::do_section_is_compressed): New method.
5001 (Sized_relobj::Compressed_section_map): New type.
5002 (Sized_relobj::do_section_is_compressed): New method.
5003 (Sized_relobj::compressed_sections_): New data member.
5004 * output.cc (Output_section::add_input_section): Handle compressed
5006 * reloc.cc: Include compressed_output.h.
5007 (Sized_relobj::write_sections): Handle compressed debug sections.
5009 2010-07-08 Cary Coutant <ccoutant@google.com>
5011 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5012 weak when resolving to a dynamic def.
5013 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5014 for weak undef/dynamic def cases. Adjust callers.
5015 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5016 undef_binding_weak_.
5017 (Symbol_table::sized_write_globals): Adjust symbol binding.
5018 (Symbol_table::sized_write_symbol): Add binding parameter.
5019 * symtab.h (Symbol::set_undef_binding): New method.
5020 (Symbol::is_undef_binding_weak): New method.
5021 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5022 (Symbol_table::should_override): Add new parameter.
5023 (Symbol_table::sized_write_symbol): Add new parameter.
5025 * testsuite/weak_undef_file1.cc: Add new test case.
5026 * testsuite/weak_undef_file2.cc: Fix header comment.
5027 * testsuite/weak_undef_test.cc: Add new test case.
5029 2010-06-29 Doug Kwan <dougkwan@google.com>
5031 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5032 Initialize USE_SYMBOL_.
5033 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5035 (Arm_reloc_property::uses_symbol_): New data member declaration.
5036 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5037 uses symbol value and symbol is undefined but not weakly undefined.
5039 2010-06-28 Rafael Espindola <espindola@google.com>
5041 * plugin.cc (Plugin::load): Use dlerror.
5043 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5045 * symtab.cc (detect_odr_violations): When reporting an ODR
5046 violation, report an object where the symbol is defined.
5048 2010-06-25 Doug Kwan <dougkwan@google.com>
5050 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5051 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5053 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5054 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5055 target hook to detect function points.
5056 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5057 * icf.h (Icf::check_section_for_function_pointers): Change type of
5058 parameter SECTION_NAME to const reference to std::string. Use
5059 target hook to determine if section may have unsafe pointers.
5060 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5063 2010-06-21 Rafael Espindola <espindola@google.com>
5065 * fileread.cc (Input_file::find_fie): New
5066 (Input_file::open): Use Input_file::find_fie.
5067 * fileread.h (Input_file::find_fie): New
5068 * plugin.cc (set_extra_library_path): New.
5069 (Plugin::load): Add set_extra_library_path to the transfer vector.
5070 (Plugin_manager::set_extra_library_path): New.
5071 (Plugin_manager::add_input_file): Use the extra search path if set.
5072 (set_extra_library_path(): New.
5073 * plugin.h (Plugin_manager): Add set_extra_library_path and
5076 2010-06-19 Cary Coutant <ccoutant@google.com>
5078 * layout.cc (gdb_sections): Add .debug_types.
5079 (lines_only_debug_sections): Likewise.
5081 2010-06-18 Rafael Espindola <espindola@google.com>
5083 * plugin.cc (add_input_file,add_input_library)
5084 (Plugin_manager::add_input_file): Make filename arguments const.
5085 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5088 2010-06-16 Doug Kwan <dougkwan@google.com>
5090 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5091 .ARM.attributes section if we have not merged any input
5092 attributes sections.
5094 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5096 * arm.cc: Allow combining objects with no EABI version
5099 2010-06-15 Rafael Espindola <espindola@google.com>
5101 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5103 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5105 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5106 (struct iovec): Correct !HAVE_READV definition.
5108 2010-06-10 Cary Coutant <ccoutant@google.com>
5110 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5111 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5113 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5116 * symtab.h (Symbol::is_placeholder): New member function.
5117 * target-reloc.h (relocate_section): Check for placeholder symbols.
5119 * testsuite/Makefile.am (plugin_test_8): New test.
5120 (plugin_test_9): New test.
5121 * testsuite/Makefile.in: Regenerate.
5123 2010-06-09 Nick Clifton <nickc@redhat.com>
5125 * yyscript.y (input_list_element): Allow strings prefixed with
5126 the '-' character. Treat these as libraries.
5127 * script.cc (script_add_library): New function. Adds a library
5128 specified by "-l<name>" found in an input script.
5129 * script-c.h: Add prototype for script_add_library.
5131 2010-06-07 Doug Kwan <dougkwan@google.com>
5133 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5134 Restrict stub-group size to be within long conditional branch
5135 range when working around cortex-A8 erratum.
5137 2010-06-07 Damien Diederen <dd@crosstwine.com>
5139 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5142 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5146 (Output_section::Input_section_sort_entry::compare_section_ordering):
5147 Change to return non-zero correctly.
5148 (Output_section::Input_section_sort_section_order_index_compare
5149 ::operator()): Change to fix ambiguity in comparisons.
5151 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5153 * gold.h (is_wildcard_string): New function.
5154 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5155 (Layout::layout_eh_frame): Ditto.
5156 (Layout::find_section_order_index): New method.
5157 (Layout::read_layout_from_file): New method.
5158 * layout.h (Layout::find_section_order_index): New method.
5159 (Layout::read_layout_from_file): New method.
5160 (Layout::input_section_position_): New private member.
5161 (Layout::input_section_glob_): New private member.
5162 * main.cc (main): Call read_layout_from_file here.
5163 * options.h (--section-ordering-file): New option.
5164 * output.cc (Output_section::input_section_order_specified_): New
5166 (Output_section::Output_section): Initialize new member.
5167 (Output_section::add_input_section): Add new parameter.
5168 Keep input sections when --section-ordering-file is used.
5169 (Output_section::set_final_data_size): Sort input sections when
5170 section ordering file is specified.
5171 (Output_section::Input_section_sort_entry): Add new parameter.
5173 (Output_section::Input_section_sort_entry::compare_section_ordering):
5175 (Output_section::Input_section_sort_compare::operator()): Change to
5176 consider section_order_index.
5177 (Output_section::Input_section_sort_init_fini_compare::operator()):
5178 Change to consider section_order_index.
5179 (Output_section::Input_section_sort_section_order_index_compare
5180 ::operator()): New method.
5181 (Output_section::sort_attached_input_sections): Change to sort
5182 according to section order when specified.
5183 (Output_section::add_input_section<32, true>): Add new parameter.
5184 (Output_section::add_input_section<64, true>): Add new parameter.
5185 (Output_section::add_input_section<32, false>): Add new parameter.
5186 (Output_section::add_input_section<64, false>): Add new parameter.
5187 * output.h (Output_section::add_input_section): Add new parameter.
5188 (Output_section::input_section_order_specified): New
5190 (Output_section::set_input_section_order_specified): New method.
5191 (Input_section::Input_section): Initialize section_order_index_.
5192 (Input_section::section_order_index): New method.
5193 (Input_section::set_section_order_index): New method.
5194 (Input_section::section_order_index_): New member.
5195 (Input_section::Input_section_sort_section_order_index_compare): New
5197 (Output_section::input_section_order_specified_): New member.
5198 * script-sections.cc (is_wildcard_string): Delete and move modified
5200 (Output_section_element_input::Output_section_element_input): Modify
5201 call to is_wildcard_string.
5202 (Output_section_element_input::Input_section_pattern
5203 ::Input_section_pattern): Ditto.
5204 (Output_section_element_input::Output_section_element_input): Ditto.
5205 * testsuite/Makefile.am (final_layout): New test case.
5206 * testsuite/Makefile.in: Regenerate.
5207 * testsuite/final_layout.cc: New file.
5208 * testsuite/final_layout.sh: New file.
5210 2010-06-01 Rafael Espindola <espindola@google.com>
5212 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5214 2010-06-01 Rafael Espindola <espindola@google.com>
5216 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5217 visibility of symbols.
5219 2010-05-27 Doug Kwan <dougkwan@google.com>
5221 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5222 from start of output section instead of address for a local symbol
5223 in a merged or relaxed section when doing a relocatable link.
5225 2010-05-26 Rafael Espindola <espindola@google.com>
5228 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5229 adding sections the garbage collector removed.
5230 * gold/testsuite/Makefile.am: Add test.
5231 * gold/testsuite/Makefile.in: Regenerate.
5232 * gold/testsuite/plugin_test_7.sh: New.
5233 * gold/testsuite/plugin_test_7_1.c: New.
5234 * gold/testsuite/plugin_test_7_2.c: New.
5236 2010-05-26 Rafael Espindola <espindola@google.com>
5238 * script-sections.cc (Output_section_definition::set_section_addresses):
5239 Check for --section-start.
5241 2010-05-26 Doug Kwan <dougkwan@google.com>
5243 * arm.cc (Arm_scan_relocatable_relocs): New class.
5244 (Target_arm::relocate_special_relocatable): New method.
5245 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5246 (Arm_relocate_functions::thumb_branch_common): Same.
5247 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5248 instead of Default_scan_relocatable_relocs.
5249 * target-reloc.h (relocate_for_relocatable): Let target handle
5250 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5251 * target.h (Sized_target::relocate_special_relocatable): New method.
5253 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5255 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5257 2010-05-23 Doug Kwan <dougkwan@google.com>
5259 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5261 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5262 with a direct branch, not a conditional branch, to a stub.
5263 * merge.cc (Output_merge_base::record_input_section): New method
5265 (Output_merge_data::do_add_input_section): Record input section if
5266 keeps-input-sections flag is set.
5267 (Output_merge_string::do_add_input_section): Ditto.
5268 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5269 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5271 (Output_merge_base::keeps_input_sections,
5272 Output_merge_base::set_keeps_input_sections,
5273 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5275 (Output_merge_base::Input_sections): New type declaration.
5276 (Output_merge_base::input_sections_begin,
5277 Output_merge_base::input_sections_end,
5278 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5279 (Output_merge_base::bool keeps_input_sections_,
5280 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5281 Output_merge_base::input_sections_): New data members.
5282 (Output_merge_data::do_set_keeps_input_sections): New method
5284 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5285 * output.cc (Output_section::Input_section::relobj): Move method
5286 defintion from class declaration to here and handle merge sections.
5287 (Output_section::Input_section::shndx): Ditto.
5288 (Output_section::Output_section): Remove initializations of removed
5289 data members and initialize new data member LOOKUP_MAPS_.
5290 (Output_section::add_input_section): Set keeps-input-sections flag
5291 for a newly created merge output section as appropriate. Adjust code
5292 to use Output_section_lookup_maps class.
5293 (Output_section::add_relaxed_input_section): Adjst code for lookup
5294 maps code refactoring.
5295 (Output_section::add_merge_input_section): Add a new parameter
5296 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5297 class. If adding input section to a newly created merge output
5298 section fails, remove the new merge section.
5299 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5300 Adjust code for use of the Output_section_lookup_maps class.
5301 (Output_section::find_merge_section): Ditto.
5302 (Output_section::build_lookup_maps): New method defintion.
5303 (Output_section::find_relaxed_input_section): Adjust code to use
5304 Output_section_lookup_maps class.
5305 (Output_section::get_input_sections): Export merge sections. Adjust
5306 code to use Output_section_lookup_maps class.
5307 (Output_section:::add_script_input_section): Adjust code to use
5308 Output_section_lookup_maps class. Update lookup maps for merge
5310 (Output_section::discard_states): Use Output_section_lookup_maps.
5311 (Output_section::restore_states): Same.
5312 * output.h (Merge_section_properties): Move class defintion out of
5314 (Output_section_lookup_maps): New class.
5315 (Output_section::Input_section::is_merge_section): New method
5317 (Output_section::Input_section::relobj): Move defintion out of class
5318 defintion. Declare method only.
5319 (Output_section::Input_section::shndx): Ditto.
5320 (Output_section::Input_section::output_merge_base): New method defintion.
5321 (Output_section::Input_section::u2_.pomb): New union field.
5322 (Output_section::Merge_section_by_properties_map,
5323 Output_section::Output_section_data_by_input_section_map,
5324 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5326 (Output_section::add_merge_input_section): Add new parameter
5327 KEEPS_INPUT_SECTIONS.
5328 (Output_section::build_lookup_maps): New method declaration.
5329 (Output_section::merge_section_map_,
5330 Output_section::merge_section_by_properties_map_,
5331 Output_section::relaxed_input_section_map_,
5332 Output_section::is_relaxed_input_section_map_valid_): Remove data
5334 (Output_section::lookup_maps_): New data member.
5336 2010-05-21 Doug Kwan <dougkwan@google.com>
5339 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5340 avoid a compilation error.
5342 2010-05-19 Rafael Espindola <espindola@google.com>
5344 * script-sections.cc (Output_section_definition::allocate_to_segment):
5345 Update the phdrs_list even when the output section is NULL.
5346 * testsuite/Makefile.am: Add test.
5347 * testsuite/Makefile.in: Regenerate.
5348 * testsuite/script_test_9.cc: New.
5349 * testsuite/script_test_9.sh: New.
5350 * testsuite/script_test_9.t: New.
5352 2010-05-19 Doug Kwan <dougkwan@google.com>
5354 * arm.cc (Arm_input_section::original_size): New method.
5355 (Arm_input_section::do_addralign): Add a cast.
5356 (Arm_input_section::do_output_offset): Remove static cast.
5357 (Arm_input_section::original_addralign,
5358 Arm_input_section::original_size_): Change type to uint32_t.
5359 (Arm_input_section::init): Add safe casts for section alignment
5361 (Arm_input_section::set_final_data_size): Do not set address and
5362 offset of stub table.
5363 (Arm_output_section::fix_exidx_coverage): Change use of of
5364 Output_section::Simple_input_section to that of
5365 Output_section::Input_section.
5366 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5367 except for the first pass.
5368 * output.cc (Output_section::get_input_sections): Change type of
5369 input_sections to std::list<Input_section>.
5370 (Output_section::add_script_input_section): Rename from
5371 Output_section::add_simple_input_section. Change type of SIS
5372 parameter from Simple_input_section to Input_section.
5373 * output.h (Output_section::Simple_input_section): Remove class.
5374 (Output_section::Input_section): Change class visibility to public.
5375 (Output_section::Input_section::addralign): Use stored alignments
5376 for special input sections if set.
5377 (Output_section::Input_section::set_addralign): New method.
5378 (Output_section::get_input_sections): Change parameter type from
5379 list of Simple_input_section to list of Input_section.
5380 (Output_section::add_script_input_section): Rename from
5381 Output_section::add_simple_input_section. Change first parameter's
5382 type from Simple_input_section to Input_section and remove the
5383 second and third parameters.
5384 * script-sections.cc (Input_section::Input_section_list): Change
5385 type to list of Output_section::Input_section/
5386 (Input_section_info::Input_section_info): Change parameter type of
5387 INPUT_SECTION to Output_section::Input_section.
5388 (Input_section_info::input_section): Change return type.
5389 (Input_section_info::input_section_): Change type to
5390 Output_section::Input_section.
5391 (Output_section_element_input::set_section_addresses): Adjust code
5392 to use Output_section::Input_section instead of
5393 Output_section::Simple_input_section. Adjust code for renaming
5394 of Output_section::add_simple_input_section.
5395 (Orphan_output_section::set_section_addresses): Ditto.
5397 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5399 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5400 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5402 2010-05-18 Rafael Espindola <espindola@google.com>
5404 * options.cc (General_options::finalize): Handle -nostdlib.
5405 * options.h (nostdlib): New option.
5406 * script.cc (script_add_search_dir): Handle -nostdlib.
5408 2010-05-12 Doug Kwan <dougkwan@google.com>
5410 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5411 attributes section only if there no attributes section after merging.
5412 (Target_arm::merge_object_attributes): Move value of
5413 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5414 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5415 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5416 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5417 and arm_attr_merge_7.stdout.
5418 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5419 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5420 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5421 arm_attr_merge_7b.o): New rules.
5422 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5424 * testsuite/Makefile.in: Regenerate.
5425 * testsuite/arm_attr_merge.sh: New file.
5426 * testsuite/arm_attr_merge_[67][ab].s: Same.
5428 2010-05-05 Nick Clifton <nickc@redhat.com>
5430 * po/es.po: Updated Spanish translation.
5432 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5434 * Makefile.am (install-exec-local): Properly install gold as
5435 default cross linker.
5436 * Makefile.in: Regenerated.
5438 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5439 Nick Clifton <nickc@redhat.com>
5441 * configure.ac (install_as_default): Define and set to false
5442 unless --enable-gold or --enable-gold=both/gold has been
5444 * configure: Regenerate.
5446 * Makefile.am (install-exec-local): Install the executable as
5447 'ld.gold'. If install_as_default is true then also install it as
5449 * Makefile.in: Regenerated.
5451 2010-04-24 Ian Lance Taylor <iant@google.com>
5453 * layout.cc (Layout::layout_reloc): In relocatable link don't
5454 combine reloc sections for grouped sections.
5456 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5458 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5459 sections that are not ordinary to icf.
5460 * icf.cc (get_section_contents): Handle relocation pointing to section
5461 with no object or shndx information.
5462 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5463 * testsuite/Makefile.in: Regenerate.
5464 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5465 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5467 2010-04-22 Ian Lance Taylor <iant@google.com>
5469 * expression.cc (Expression::Expression_eval_info): Add
5470 result_alignment_pointer field.
5471 (Expression::eval_with_dot): Add result_alignment_pointer
5472 parameter. Change all callers.
5473 (Expression::eval_maybe_dot): Likewise.
5474 (class Binary_expression): Add alignment_pointer parameter to
5475 left_value and right_value. Change all callers.
5476 (BINARY_EXPRESSION): Set result alignment.
5477 (class Trinary_expression): Add alignment_pointer parameter to
5478 arg2_value and arg3_value. Change all callers.
5479 (Trinary_cond::value): Set result alignment.
5480 (Max_expression::value, Min_expression::value): Likewise.
5481 (Align_expression::value): Likewise.
5482 * script-sections.cc (class Sections_element): Add dot_alignment
5483 parameter to set_section_addresses virtual function. Update
5485 (class Output_section_element): Likewise.
5486 (Script_sections::create_segments): Add dot_alignment parameter.
5488 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5489 (Script_sections::set_phdrs_clause_addresses): Likewise.
5490 * script-sections.h: Update declarations.
5491 * script.h: Update declarations.
5492 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5494 * testsuite/script_test_3.t: Set large alignment.
5495 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5496 segment has expected alignment.
5498 2010-04-22 Nick Clifton <nickc@redhat.com>
5500 * po/gold.pot: Updated by the Translation project.
5501 * po/vi.po: Updated Vietnamese translation.
5503 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5505 * testsuite/Makefile.am (check_PROGRAMS): Add
5506 icf_virtual_function_folding_test.
5507 * testsuite/Makefile.in: Regenerated.
5509 2010-04-15 Andrew Haley <aph@redhat.com>
5511 * options.h (merge_exidx_entries): New option.
5512 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5513 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5514 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5515 (Target_arm::merge_exidx_entries): New function.
5516 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5517 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5518 to Arm_exidx_fixup constructor.
5519 Add new arg, merge_exidx_entries.
5520 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5521 Arm_output_section::fix_exidx_coverage.
5523 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5525 * icf.cc (get_section_contents): Check for preemptible functions.
5526 Ignore addend when appropriate.
5527 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5529 (add_from_relobj): Check for section folded.
5530 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5531 * symtab.h (should_add_dynsym_entry): Add new parameter.
5532 * target-reloc.h (scan_relocs): Check for section folded.
5533 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5534 Check reloc types for function pointers in shared objects.
5535 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5537 (icf_preemptible_functions_test): New test case.
5538 (icf_string_merge_test): New test case.
5539 * testsuite.Makefile.in: Regenerate.
5540 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5541 bar_glob. Refactor code.
5542 * testsuite/icf_preemptible_functions_test.cc: New file.
5543 * testsuite/icf_preemptible_functions_test.sh: New file.
5544 * testsuite/icf_string_merge_test.cc: New file.
5545 * testsuite/icf_string_merge_test.sh: New file.
5546 * testsuite/icf_virtual_function_folding_test.cc: New file.
5547 * testsuite/icf_virtual_function_folding_test.sh: New file.
5549 2010-04-14 Doug Kwan <dougkwan@google.com>
5551 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5552 for local symbol recounting if we remove a section due to ICF.
5553 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5554 there are no regular objects in input.
5556 2010-04-13 Doug Kwan <dougkwan@google.com>
5558 * arm.cc (Arm_input_section::set_final_data_size): Compute
5559 accurate final data size instead of using current data size.
5561 2010-04-09 Doug Kwan <dougkwan@google.com>
5563 * layout.cc (Layout::choose_output_section): Handle script section
5565 (Layout::make_output_section_for_script): Add section type parameter.
5566 Handle script section types.
5567 * layout.h (Layout::make_output_section_for_script): Add section
5569 * output.cc (Output_section::Output_section): Initialize data member
5571 (Output_section::do_reset_address_and_file_offset): Do not set address
5572 to 0 if section is a NOLOAD section.
5573 * output.h (Output_section::is_noload): New method.
5574 (Output_section::set_is_noload): Ditto.
5575 (Output_section::is_noload_): New data member.
5576 * script-c.h (Script_section_type): New enum type.
5577 (struct Parser_output_section_header): Add new file section_type.
5578 * script-sections.cc (Sections_element::output_section_name): Add
5579 parameter for returning script section type.
5580 (Output_section_definition::output_section_name): Ditto.
5581 (Output_section_definition::section_type)P; New method.
5582 (Output_section_definiton::script_section_type_name): Ditto.
5583 (Output_section_definition::script_section_type_): New data member.
5584 (Output_section_definition::Output_section_definition): Initialize
5585 data member Output_section_definition::script_section_type_.
5586 (Output_section_definition::create_sections): Pass script section type
5587 to Layout::make_output_section_for_script.
5588 (Output_section_definition::output_section_name): Return script
5589 section type to caller.
5590 (Output_section_definition::set_section_address): Do not advance
5591 dot value and load address if section type is NOLOAD. Set address
5592 of NOLOAD sections regardless of section flags.
5593 (Output_section_definition::print): Print section type if it is
5594 not SCRIPT_SECTION_TYPE_NONE.
5595 (Output_section_definition::section_type): New method.
5596 (Output_section_definition::script_section_type_name): Ditto.
5597 (Script_sections::output_section_name): Add new parameter
5598 PSECTION_TYPE for returning script section type. Pass it to
5599 section elements. Handle discard sections.
5600 (Sort_output_sections::operator()): Handle NOLOAD sections.
5601 * script-sections.h (Script_sections::Section_type): New enum type.
5602 (Script_sections::output_section_name): Add a new parameter for
5603 returning script section type.
5604 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5606 * yyscript.y (union): Add new field SECTION_TYPE.
5607 (COPY, DSECT, INFO, NOLOAD): New tokens.
5608 (opt_address_and_section_type): Change type to output_section_header.
5609 (section_type): New non-terminal
5610 (section_header): Handle section type.
5611 (opt_address_and_section_type): Return section type value.
5613 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5615 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5616 * testsuite/plugin_common_test_2.c (foo): Likewise.
5618 2010-04-08 Doug Kwan <dougkwan@google.com>
5620 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5622 * output.cc (Output_section::add_merge_input_section): Simplify
5623 code and return status of Output_merge_base::add_input_section.
5624 Update merge section map only if Output_merge_base::add_input_section
5627 2010-04-07 Doug Kwan <dougkwan@google.com>
5629 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5630 if section is marked as containing instructions but has no mapping
5632 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5633 correct section index.
5634 (Arm_relobj::find_linked_text_section): Ditto.
5636 2010-04-07 Cary Coutant <ccoutant@google.com>
5638 * archive.cc (include_member): Destroy Read_symbols_data object before
5640 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5641 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5642 (Read_symbols_data::~Read_symbols_data) New destructor.
5643 (Section_relocs::Section_relocs) New constructor.
5644 (Section_relocs::~Section_relocs) New destructor.
5645 (Read_relocs_data::Read_relocs_data) New constructor.
5646 (Read_relocs_data::~Read_relocs_data) New destructor.
5647 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5648 pointers to NULL after deleting.
5650 2010-04-07 Doug Kwan <dougkwan@google.com>
5652 * arm.cc: Replace "endianity" with "endianness" in comments.
5653 (Arm_exidx_cantunwind): Ditto.
5654 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5655 (Arm_relobj::merge_flags_and_attributes): New method.
5656 (Arm_relobj::merge_flags_and_attributes_): New data member.
5657 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5658 (Arm_relobj::scan_sections_for_stubs): Ditto.
5659 (Arm_relobj::do_read_symbols): Check to see if we really want to
5660 merge processor-specific flags and attributes. Exit early if
5661 an object is empty except for section names and the undefined symbol.
5662 (Target_arm::do_finalize_sections): Move check for ELF format to
5663 Arm_relobj::do_read_symbols. Merge processor specific flags and
5664 attributes from a regular object only when we have determined that
5665 it is aapropriate. Do not create an .ARM.attributes section in
5666 output if there is no regular input object.
5667 (Target_arm::merge_processor_specific_flags): Check
5668 --warn-mismatch before printing any error.
5669 (Target_arm::merge_object_attributes): Ditto.
5670 * gold.cc (queue_middle_tasks): Handle the case in which there is
5671 no regular object in input.
5672 * options.cc (General_options::parse_EB): New method.
5673 (General_options::parse_EL): Same.
5674 (General_options::General_options): Initialize endianness_.
5675 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5677 (General_options::Endianness): New enum.
5678 (General_options::endianness): New method.
5679 (General_options::endianness_): New data member.
5680 * parameters.cc (Parameters::set_options): Check target endianness.
5681 (Parameters::set_target_once): Ditto.
5682 (Parameters::check_target_endianness): New method.
5683 (parameters_force_valid_target): If either -EL or -EB is specified,
5684 use it to define endianness of default target.
5685 * parameters.h (Parameters::check_target_endianness): New method
5687 * target.h (class Target): Change "endianity" to "endianness"
5690 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5692 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5693 * configure: Regenerate.
5694 * Makefile.in: Regenerate.
5695 * testsuite/Makefile.in: Regenerate.
5697 2010-04-06 Cary Coutant <ccoutant@google.com>
5700 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5701 prevailing definitions of common symbols.
5702 * testsuite/plugin_test_6.sh: New test case.
5703 * testsuite/plugin_common_test_1.c: New test case.
5704 * testsuite/plugin_common_test_2.c: New test case.
5705 * testsuite/Makefile.am (plugin_test_6): New test case.
5706 * testsuite/Makefile.in: Regenerate.
5708 2010-04-06 Nick Clifton <nickc@redhat.com>
5710 * po/vi.po: New Vietnamese translation.
5712 2010-03-30 Doug Kwan <dougkwan@google.com>
5714 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5716 2010-03-25 Doug Kwan <dougkwan@google.com>
5718 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5719 to avoid a conversion warning on a 32-bit host.
5721 2010-03-24 Ian Lance Taylor <iant@google.com>
5723 * testsuite/script_test_3.t: Add a TLS segment.
5724 * testsuite/Makefile.am (check_PROGRAMS): Add
5725 tls_phdrs_script_test.
5726 (tls_phdrs_script_test_SOURCES): Define.
5727 (tls_phdrs_script_test_DEPENDENCIES): Define.
5728 (tls_phdrs_script_test_LDFLAGS): Define.
5729 (tls_phdrs_script_test_LDADD): Define.
5730 * testsuite/Makefile.in: Rebuild.
5732 2010-03-23 Cary Coutant <ccoutant@google.com>
5734 * fileread.cc (find_or_make_view): Fix comment.
5736 2010-03-23 Ian Lance Taylor <iant@google.com>
5738 * script-sections.cc (class Orphan_section_placement): Define
5739 PLACE_TLS and PLACE_TLS_BSS.
5740 (Orphan_section_placement::Orphan_section_placement): Initialize
5742 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5743 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5744 (tls_script_test_SOURCES): Define.
5745 (tls_script_test_DEPENDENCIES): Define.
5746 (tls_script_test_LDFLAGS): Define.
5747 (tls_script_test_LDADD): Define.
5748 * testsuite/Makefile.in: Rebuild.
5750 2010-03-22 Doug Kwan <dougkwan@google.com>
5752 * arm.cc (Arm_relocate_functions::abs8,
5753 Arm_relocate_functions::abs16): Use correct check for overflow
5754 specified in the ARM ELF specs.
5755 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5756 target of a BLX instruction specially.
5757 (Reloc_stub::stub_type_for_reloc): Ditto.
5758 (Relocate::relocate): Use symbolic names instead of numeric relocation
5759 codes to report error.
5760 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5762 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5763 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5764 thumb2_blx_out_of_range.stdout
5765 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5766 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5767 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5768 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5769 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5770 thumb2_blx_in_range, thumb2_blx_in_range.o,
5771 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5772 thumb2_blx_out_of_range.o): New rules.
5773 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5774 thumb2_blx_in_range and thumb2_blx_out_of_range.
5775 * testsuite/Makefile.in: Regenerate.
5776 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5777 * testsuite/thumb_blx_in_range.s: New file.
5778 * testsuite/thumb_blx_out_of_range.s: New file.
5780 2010-03-22 Rafael Espindola <espindola@google.com>
5782 * archive.cc (Should_include): Move to archive.h.
5783 (should_include_member): Make it a member of Archive.
5785 (Add_lib_group_symbols): New.
5786 * archive.h: Include options.h.
5787 (Archive_member): Moved from Archive.
5788 (Should_include): Moved from archive.cc.
5790 (Add_lib_group_symbols): New.
5791 * dynobj.cc (do_should_include_member): New.
5792 * dynobj.h (do_should_include_member): New.
5793 * gold.cc (queue_initial_tasks): Update call to queue.
5794 * main.cc (main): Print lib group stats.
5795 * object.cc (do_should_include_member): New.
5796 * object.h: Include archive.h.
5797 (Object::should_include_member): New.
5798 (Object::do_should_include_member): New.
5799 (Sized_relobj::do_should_include_member): New.
5800 * options.cc (General_options::parse_start_lib): New.
5801 (General_options::parse_end_lib): New.
5802 (Input_arguments::add_file): Handle lib groups.
5803 (Input_arguments::start_group): Check we are not in a lib.
5804 (Input_arguments::start_lib): New.
5805 (Input_arguments::end_lib): New.
5806 * options.h (General_options): Add start_lib and end_lib.
5807 (Input_argument::lib_): New.
5808 (Input_argument::lib): New.
5809 (Input_argument::is_lib): New.
5810 (Input_file_lib): New.
5811 (Input_arguments::in_lib_): New.
5812 (Input_arguments::in_lib): New.
5813 (Input_arguments::start_lib): New.
5814 (Input_arguments::end_lib_): New.
5815 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5816 in unused members as preempted.
5817 (Sized_pluginobj::do_should_include_member): New.
5818 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5819 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5821 (Read_symbols::do_whole_lib_group): New.
5822 (Read_symbols::do_lib_group): New.
5823 (Read_symbols::do_read_symbols): Handle lib groups.
5824 (Read_symbols::get_name): Handle lib groups.
5825 * readsyms.h (Read_symbols): Add an archive member pointer.
5826 (Read_symbols::do_whole_lib_group): New.
5827 (Read_symbols::do_lib_group): New.
5828 (Read_symbols::member_): New.
5829 * script.cc (read_input_script): Update call to queue_soon.
5831 2010-03-19 Doug Kwan <dougkwan@google.com>
5833 * arm.cc (Stub_table::Stub_table): Initialize new data members
5834 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5835 (Stub_table::add_reloc_stub): Assign stub offset and update
5836 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5837 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5839 (Stub_table::update_data_size_and_addralign): Use
5840 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5841 instead of going over all reloc stubs.
5842 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5843 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5844 Stringpool_template::offset_ to size of Stringpool_char.
5845 (Stringpool_template::new_key_offset): Remove code to initialize
5846 Stringpool_template::offset_.
5847 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5848 Stringpool_template::offset_ to zero.
5850 2010-03-15 Doug Kwan <dougkwan@google.com>
5852 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5854 (Stringpool_template::new_key_offset): New method.
5855 (Stringpool_template::add_string): Assign offsets when adding new
5857 (Stringpool_template::set_string_offsets): Do not set string offsets
5858 when not optimizing.
5859 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5861 (Chunked_vector::clear): Clear size_.
5862 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5863 (Chunked_vector::size): Return size_.
5864 (Chunked_vector::push_back): Use size_ to find insert position.
5865 (Chunked_vector::size_): New data member.
5866 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5867 (Stringpool_template::new_key_offset): New method declaration.
5868 (Stringpool_template::offset_): New data member.
5870 2010-03-15 Rafael Espindola <espindola@google.com>
5872 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5873 Add_symbols' constructor.
5874 * readsyms.h (Add_symbols): Remove the input_group member.
5876 2010-03-10 Ian Lance Taylor <iant@google.com>
5878 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5879 target to ask whether a reference to a symbol requires a stack
5881 * target.h (Target::is_call_to_non_split): New function.
5882 (Target::do_is_call_to_non_split): Declare virtual function.
5883 * target.cc: Include "symtab.h".
5884 (Target::do_is_call_to_non_split): New function.
5885 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5887 2010-03-10 Cary Coutant <ccoutant@google.com>
5889 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5890 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5891 (File_read::open[2]): Add whole_file_view_ to list of views.
5892 (File_read::make_view): Remove test of whole_file_view_.
5893 (File_read::find_or_make_view): Create whole_file_view_ if
5895 (File_read::clear_views): Replace bool parameter with enum;
5896 adjust all callers. Don't delete views with permanent data;
5897 do delete cached views and views from archives if
5898 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5899 if clearing the corresponding view.
5900 * fileread.h (File_read::Clear_views_mode): New enum.
5901 (File_read::View::is_permanent_view): New method.
5902 (File_read::clear_views): Replace bool parameter
5903 with enum; adjust all callers.
5904 * options.h (General_options): Change keep_files_mapped option;
5905 add map_whole_files.
5906 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5908 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5911 2010-03-10 David S. Miller <davem@davemloft.net>
5913 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5915 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5917 * icf.cc (get_section_contents): Add '@' marker after processing the
5920 2010-03-08 Doug Kwan <dougkwan@google.com>
5922 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5923 due to a conversion warning.
5924 (Arm_relobj::update_output_local_symbol_count): Check for local
5925 symbol with unset output index.
5927 2010-03-05 Ian Lance Taylor <iant@google.com>
5929 * options.h (class General_options): Add --spare-dynamic-tags.
5930 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5931 --spare-dynamic-tags.
5933 2010-03-05 Ian Lance Taylor <iant@google.com>
5935 * incremental.cc: Include "libiberty.h".
5937 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5939 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5940 function, is_info_ member.
5941 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5942 (Versions::Versions): Update caller.
5943 (Versions::define_base_version): Likewise.
5944 (Versions::add_def): Likewise.
5946 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5948 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5949 (Scan::possible_function_pointer_reloc): New function.
5950 (Scan::local_reloc_may_be_function_pointer): Change to call
5951 possible_function_pointer_reloc.
5952 (Scan::global_reloc_may_be_function_pointer): Ditto.
5953 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5954 relocations in ".data.rel.ro._ZTV" section.
5955 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5956 * testsuite/icf_safe_so_test.cc: Ditto.
5957 * testsuite/icf_safe_test.cc: Ditto.
5958 * testsuite/icf_safe_test.sh: Ditto.
5960 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5961 Ian Lance Taylor <iant@google.com>
5963 * target-reloc.h (relocate_section): Check the symbol table index
5964 for -1U before setting the local symbol index.
5965 (scan_relocatable_relocs): If copying the relocation, record that
5966 the local symbol is required.
5967 * object.h (Symbol_value::is_output_symtab_index_set): New
5969 (Symbol_value::may_be_discarded_from_output_symtab): New
5971 (Symbol_value::has_output_symtab_entry): New function.
5972 (Symbol_value::needs_output_symtab_entry): Remove.
5973 (Symbol_value::output_symtab_index): Make sure the symbol index is
5975 (Symbol_value::set_output_symtab_index): Make sure the symbol
5976 index is not set. Make sure the new index is valid.
5977 (Symbol_value::set_must_have_output_symtab_entry): New function.
5978 (Symbol_value::has_output_dynsym_entry): New function.
5979 (Symbol_value::set_output_dynsym_index): Make sure the new index
5981 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5982 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5983 local symbol if permitted.
5984 (Sized_relobj::do_finalize_local_symbols): Call
5985 is_output_symtab_index_set rather than needs_output_symtab_entry.
5986 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5987 rather than needs_output_symtab_entry. Call
5988 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5989 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5990 is_output_symtab_index_set rather than needs_output_symtab_entry.
5991 * testsuite/discard_locals_relocatable_test.c: New file.
5992 * testsuite/discard_locals_test.sh: Test -r.
5993 * testsuite/Makefile.am (check_DATA): Add
5994 discard_locals_relocatable_test1.syms,
5995 discard_local_relocatable_test2.syms.
5996 (MOSTLYCLEANFILES): Likewise. Also add
5997 discard_locals_relocatable_test1.lout and
5998 discard_locals_relocatable_test2.out.
5999 (discard_locals_relocatable_test1.syms): New target.
6000 (discard_locals_relocatable_test.o): New target.
6001 (discard_locals_relocatable_test1.out): New target.
6002 (discard_locals_relocatable_test2.syms): New target.
6003 (discard_locals_relocatable_test2.out): New target.
6004 (various): Add missing ../ld-new dependencies.
6005 * testsuite/Makefile.in: Rebuild.
6007 2010-03-03 Nick Clifton <nickc@redhat.com>
6009 * po/fi.po: New Finnish translation.
6011 2010-03-01 Doug Kwan <dougkwan@google.com>
6013 * layout.cc (Layout::Layout): Force section types of .init_array*,
6014 .preinit_array* and .fini_array* sections.
6015 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6016 Fix check of return value of std::string::find.().
6017 (Output_section::Input_section_sort_compare::operator()): Remove
6018 comment about .init_array.
6019 (Output_section::Input_section_sort_init_fini_compare::operator()):
6021 (Output_section::sort_attached_input_sections): Handle .init_array
6022 and .fini_array specially.
6023 * output.h (Output_section::Inut_section_sort_compare): Update
6025 (Output_section::Input_section_sort_init_fini_compare): New struct.
6027 2010-02-26 Doug Kwan <dougkwan@google.com>
6029 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6030 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6031 * testsuite/debug_msg.sh: Avoid matching source line number for
6032 use of global variable undef_int.
6034 2010-02-26 Doug Kwan <dougkwan@google.com>
6036 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6037 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6038 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6039 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6040 * options.cc (General_options::General_options): Initialize member
6042 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6043 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6044 and rm_no_fix_v4bx.stdout
6045 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6046 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6047 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6048 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6049 and arm_no_fix_v4bx.
6050 * Makefile.in: Regenerate.
6051 * testsuite/arm_fix_v4bx.s: New file.
6052 * testsuite/arm_fix_v4bx.sh: Ditto.
6054 2010-02-24 Doug Kwan <dougkwan@google.com>
6056 * arm.cc (Target_arm::got_section): Make the .got section the first
6057 non RELRO section in the data segment.
6058 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6059 suffixes of section names.
6061 2010-02-24 Doug Kwan <dougkwan@google.com>
6063 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6064 flags and attributes merging if an input file is a binary file.
6065 * fileread.cc (Input_file::open): Record format of original file.
6066 * fileread.h (Input_file::Format): New enum type.
6067 (Input_file::Input_file): Initialize data member format_.
6068 (Input_file::format): New method definition.
6069 (Input_file::format_):: New data member.
6071 2010-02-24 Doug Kwan <dougkwan@google.com>
6073 * arm.cc (Arm_output_data_got): New class.
6074 (ARM_TCB_SIZE): New constant
6075 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6076 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6077 If user uses a script with a SECTIONS clause, issue only a warning
6078 for a misplaced EXIDX input section. Otherwise, issue an error.
6079 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6081 (Target_arm::got_mode_index_entry): Handle static linking.
6082 (Target_arm::Scan::local): Ditto.
6083 (Target_arm::Scan::global): Ditto.
6084 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6085 all incorrectly implemented relocations.
6086 (Target_arm::fix_exidx_coverage): Pass layout to
6087 Arm_output_section::fix_exidx_coverage.
6088 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6089 from ".ARM.exidx." and ".ARM.extab.".
6091 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6093 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6094 section if it does not already exist.
6095 * attributes.cc (Attributes_section_data::Attributes_section_data):
6096 Don't crash if size is zero.
6098 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6099 Ian Lance Taylor <iant@google.com>
6101 * gold.cc (queue_middle_tasks): If no input files were opened,
6103 * workqueue.h (Task_function::Task_function): Assert that there is
6106 2010-02-22 Doug Kwan <dougkwan@google.com>
6108 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6109 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6110 types to avoid warnings due to different uint64_t implementations
6113 2010-02-21 Doug Kwan <dougkwan@google.com>
6115 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6116 handling of the maximum backward branch offset.
6117 (Arm_relocate_functions::thumb_branch_common): Ditto.
6118 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6119 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6120 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6121 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6122 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6123 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6124 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6125 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6126 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6127 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6128 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6129 thumb2_bl_out_of_range.o): New rules.
6130 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6131 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6132 thumb2_bl_out_of_range
6133 * testsuite/Makefile.in: Regenerate.
6134 * testsuite/arm_bl_in_range.s: New file.
6135 * testsuite/arm_bl_out_of_range.s: Ditto.
6136 * testsuite/arm_branch_in_range.sh: Ditto.
6137 * testsuite/arm_branch_range.t: Ditto.
6138 * testsuite/thumb2_branch_range.t: Ditto.
6139 * testsuite/thumb_bl_in_range.s: Ditto.
6140 * testsuite/thumb_bl_out_of_range.s: Ditto.
6141 * testsuite/thumb_branch_range.t: Ditto.
6143 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6145 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6146 Add reloc offset information.
6147 * icf.cc (get_section_contents): Change iterators to point to the new
6148 vectors. Add reloc offset information to the contents.
6149 * icf.h (Icf::Sections_reachable_info): New typedef.
6150 (Icf::Sections_reachable_list): New typedef.
6151 (Icf::Offset_info): New typedef.
6152 (Icf::Reloc_info): New struct typedef.
6153 (Icf::Reloc_info_list): New typedef.
6154 (Icf::symbol_reloc_list): Delete method.
6155 (Icf::addend_reloc_list): Delete method.
6156 (Icf::section_reloc_list): Delete method.
6157 (Icf::reloc_info_list): New method.
6158 (Icf::reloc_info_list_): New member.
6160 2010-02-19 Doug Kwan <dougkwan@google.com>
6162 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6163 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6164 * arm.cc (Arm_relocation_functions): New forward declaration.
6165 (Target_arm::Target_arm): Initialize new data members
6166 got_mod_index_offset_ and tls_base_symbol_defined_.
6167 (Target_arm::Relocate::relocate_tls): New method.
6168 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6169 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6171 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6172 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6173 (Target_arm::got_mod_index_offset_,
6174 Target_arm::tls_base_symbol_defined_): New data members.
6175 (Target_arm::Scan::local, Target::Scan::global,
6176 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6179 2010-02-18 Doug Kwan <dougkwan@google.com>
6181 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6182 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6183 text section as a parameter becuase some broken tools may not set
6184 the link in section header.
6185 (Target_arm::has_got_section): New method.
6186 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6187 without any mapping symbol as data only. Remove warning.
6188 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6189 link in its section header, try to discover the link by inspecting the
6190 REL31 relocation at the beginning of the section.
6191 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6193 (Target_arm::Scan::global): Treat any reference to the symbol
6194 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6196 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6198 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6199 (Scan::global_reloc_may_be_function_pointer): New function.
6200 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6201 (Scan::global_reloc_may_be_function_pointer): New function.
6202 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6203 (Scan::global_reloc_may_be_function_pointer): New function.
6204 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6205 (Scan::global_reloc_may_be_function_pointer): New function.
6206 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6207 (Scan::global_reloc_may_be_function_pointer): New function.
6208 (Scan::possible_function_pointer_reloc): New function.
6209 (Target_x86_64::can_check_for_function_pointers): New function.
6210 * gc.h (gc_process_relocs): Scan relocation types to determine if
6211 function pointers were taken for targets that support it.
6212 * icf.cc (Icf::find_identical_sections): Include functions for
6213 folding in safe ICF whose pointer is not taken.
6214 * icf.h (Secn_fptr_taken_set): New typedef.
6215 (fptr_section_id_): New member.
6216 (section_has_function_pointers): New function.
6217 (set_section_has_function_pointers): New function.
6218 (check_section_for_function_pointers): New function.
6219 * options.h: Fix comment for safe ICF option.
6220 * target.h (can_check_for_function_pointers): New function.
6221 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6222 Modify icf_safe_test for X86-64.
6223 * testsuite/Makefile.in: Regenerate.
6224 * testsuite/icf_safe_so_test.cc: New file.
6225 * testsuite/icf_safe_so_test.sh: New file.
6226 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6227 (main): Change to take pointer to function kept_func_3.
6228 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6229 folding is done correctly for X86-64.
6231 2010-02-12 David S. Miller <davem@davemloft.net>
6233 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6234 is_symbolless parameter.
6235 (Output_reloc<SHT_REL>::is_symbolless): New.
6236 (Output_reloc<SHT_REL>::is_symbolless_): New.
6237 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6238 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6239 (Output_reloc<SHT_RELA>::is_symbolless): New.
6240 (Output_data_reloc::add_global): Handle is_symbolless.
6241 (Output_data_reloc::add_global_relative): Likewise.
6242 (Output_data_reloc::add_local): Likewise.
6243 (Output_data_reloc::add_local_relative): Likewise.
6244 (Output_data_reloc::add_symbolless_global_addend): New.
6245 (Output_data_reloc::add_symbolless_local_addend): New.
6246 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6248 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6249 instead of ->is_relative_
6250 (Output_reloc::write): Likewise.
6251 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6252 (Output_reloc::write_rel): Simplify.
6254 * sparc.cc (Target_sparc::Scan::local): Use
6255 ->add_symbolless_local_addend as needed.
6256 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6257 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6258 based upon relocation offset.
6260 2010-02-11 Doug Kwan <dougkwan@google.com>
6262 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6263 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6264 beginning of function.
6265 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6266 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6267 parameter is_32bit in calls to should_apply_static_reloc.
6268 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6269 (check_DATA): Add arm_abs_global.stdout.
6270 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6271 arm_abs_global.stdout): New rules.
6272 (MOSTLLYCLEANFILES): Add arm_abs_global
6273 * Makefile.in: Regenerate.
6274 * testsuite/arm_abs_global.s: New file.
6275 * testsuite/arm_abs_global.sh: Ditto.
6276 * testsuite/arm_abs_lib.s: Ditto.
6278 2010-02-11 Ian Lance Taylor <iant@google.com>
6280 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6282 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6283 Allocate_commons_task first.
6284 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6285 task, rather than symtab_lock_.
6286 (Gc_process_relocs::~Gc_process_relocs): New function.
6287 (Gc_process_relocs::is_runnable): Check this_blocker_.
6288 (Gc_process_relocs::locks): Use next_blocker_ rather than
6290 (Scan_relocs::~Scan_relocs): New function.
6291 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6293 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6295 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6296 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6297 constructor accordingly.
6298 (class Gc_process_relocs): Likewise.
6299 (class Scan_relocs): Likewise.
6300 * common.h (class Allocate_commons_task): Remove symtab_lock_
6301 field, and corresponding constructor parameter.
6302 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6304 (Allocate_commons_task::locks): Likewise.
6306 2010-02-11 Ian Lance Taylor <iant@google.com>
6308 * gold-threads.h (class Once): Define.
6309 (class Initialize_lock): Rewrite as child of Once.
6310 * gold-threads.cc (class Once_initialize): Define.
6311 (once_pointer_control): New static variable.
6312 (once_pointer, once_arg): New static variables.
6313 (c_run_once): New static function.
6314 (Once::Once, Once::run_once, Once::internal_run): New functions.
6315 (class Initialize_lock_once): Remove.
6316 (initialize_lock_control): Remove.
6317 (initialize_lock_pointer): Remove.
6318 (initialize_lock_once): Remove.
6319 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6320 (Initialize_lock::initialize): Rewrite.
6321 (Initialize_lock::do_run_once): New function.
6322 * archive.cc (Archive::interpret_header): Only clear name if it is
6324 * fileread.cc: Include "gold-threads.h"
6325 (file_counts_lock): New static variable.
6326 (file_counts_initialize_lock): Likewise.
6327 (File_read::release): Only increment counts when using --stats.
6328 Use a lock around the increment.
6329 * parameters.cc (class Set_parameters_target_once): Define.
6330 (set_parameters_target_once): New static variable.
6331 (Parameters::Parameters): Move here from parameters.h.
6332 (Parameters::set_target): Rewrite.
6333 (Parameters::set_target_once): New function.
6334 (Parameters::clear_target): Move here and rewrite.
6335 * parameters.h (class Parameters): Update declarations. Add
6336 set_parameters_target_once_ field.
6337 (Parameters::Parameters): Move to parameters.cc.
6338 (Parameters::clear_target): Likewise.
6339 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6341 (Start_group::~Start_group): New function.
6342 (Start_group::is_runnable): New function.
6343 (Start_group::locks, Start_group::run): New functions.
6344 (Finish_group::run): Change saw_undefined to size_t.
6345 * readsyms.h (class Start_group): Define.
6346 (class Finish_group): Change saw_undefined_ field to size_t.
6347 (Finish_group::Finish_group): Remove saw_undefined and
6348 this_blocker parameters. Change all callers.
6349 (Finish_group::set_saw_undefined): New function.
6350 (Finish_group::set_blocker): New function.
6351 * symtab.h (class Symbol_table): Change saw_undefined to return
6352 size_t. Change saw_undefined_ field to size_t.
6353 * target-select.cc (Set_target_once::do_run_once): New function.
6354 (Target_selector::Target_selector): Initialize set_target_once_
6355 field. Don't initialize lock_ and initialize_lock_ fields.
6356 (Target_selector::instantiate_target): Rewrite.
6357 (Target_selector::set_target): New function.
6358 * target-select.h (class Set_target_once): Define.
6359 (class Target_selector): Update declarations. Make
6360 Set_target_once a friend. Remove lock_ and initialize_lock_
6361 fields. Add set_target_once_ field.
6363 2010-02-10 Ian Lance Taylor <iant@google.com>
6365 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6367 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6368 (queue_middle_tasks): Add all blockers before queueing any tasks.
6369 (queue_final_tasks): Likewise.
6370 * token.h (Task_token::add_blockers): New function.
6371 * object.h (Input_objects::number_of_relobjs): New function.
6373 2010-02-10 Ian Lance Taylor <iant@google.com>
6375 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6376 shared, not if not position independent.
6377 * x86_64.cc (Relocate::relocate_tls): Likewise.
6378 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6379 (tls_pie_pic_test): New target.
6380 * testsuite/Makefile.in: Rebuild.
6382 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6383 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6384 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6385 * testsuite/Makefile.in: Rebuild.
6387 2010-02-09 David S. Miller <davem@davemloft.net>
6389 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6390 R_SPARC_RELATIVE using ->add_local_relative().
6391 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6393 * output.h (Output_data_dynamic::add_section_size): New method
6394 that takes two Output_data objects.
6395 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6396 entry param. Handle it in initializers.
6397 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6398 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6399 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6401 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6402 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6403 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6404 for dynrel_includes_plt.
6405 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6406 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6407 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6409 (Target_sparc::do_finalize_sections): Update to pass true for
6410 dynrel_includes_plt.
6411 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6412 output before .rela.plt
6413 (Target_powerpc::do_finalize_sections): Update to pass true for
6414 dynrel_includes_plt when 32-bit.
6416 2010-02-08 Doug Kwan <dougkwan@google.com>
6418 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6420 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6421 Arm_relobj::scan_section_for_cortex_a8_stubs,
6422 Arm_relobj::do_relocation_section): Instead of calling
6423 Output_section::output_address, use faster
6424 Arm_relobj::simple_input_section_output_address.
6426 2010-02-08 David S. Miller <davem@davemloft.net>
6428 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6429 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6430 relocation helper function.
6432 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6433 just like R_SPARC_GOT{10,13,22}.
6434 (Target_sparc::Scan::local): Likewise.
6435 (Target_sparc::Relocate:relocate): Likewise.
6437 2010-02-06 Ian Lance Taylor <iant@google.com>
6439 * configure.ac: Rewrite targetobjs duplicate removal code to use
6440 only shell constructs.
6441 * configure: Rebuild.
6443 2010-02-05 Doug Kwan <dougkwan@google.com>
6446 * arm.cc (Arm_relobj::section_is_scannable): New method.
6447 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6448 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6450 2010-02-04 Doug Kwan <dougkwan@google.com>
6453 * arm-reloc-property.cc (cstdio): Include.
6454 * configure.ac (targetobjs): Remove duplicates.
6455 * configure: Regenerate.
6456 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6457 big and little endian version for a given address size.
6459 2010-02-03 Doug Kwan <dougkwan@google.com>
6461 * arm-reloc-property.cc
6462 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6464 * arm-reloc-property.h
6465 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6466 New method definition.
6467 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6469 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6471 (GOT_PREL): Change implemented to Y.
6472 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6473 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6474 (Arm_relocate_functions::movw_abs_nc): Remove method.
6475 (Arm_relocate_functions::movt_abs): Ditto.
6476 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6477 (Arm_relocate_functions::thm_movt_abs): Ditto.
6478 (Arm_relocate_functions::movw_rel_nc): Ditto.
6479 (Arm_relocate_functions::movw_rel): Ditto.
6480 (Arm_relocate_functions::movt_rel): Ditto.
6481 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6482 (Arm_relocate_functions:thm_movw_rel): Ditto.
6483 (Arm_relocate_functions:thm_movt_rel): Ditto.
6484 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6485 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6486 New method definitions.
6487 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6488 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6489 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6490 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6491 (Target_arm::Relocate::relocate): Check for non-static or
6492 unimplemented relocation code and exit early. Change calls to
6493 Target_arm::reloc_uses_thumb_bit and
6494 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6495 instead. Refactor code to handle similar relocations to increase
6496 code sharing. Remove check for unsupported relocation code in switch
6498 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6499 relocation property table to find out size. Change error message to
6500 print out the name of a relocation code instead of the numeric value.
6501 (Target_arm::scan_reloc_for_stub): Use relocation property table
6502 instead of calling Target_arm::reloc_uses_thumb_bit().
6504 2010-02-02 Doug Kwan <dougkwan@google.com>
6506 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6507 types of relaxed input section.
6509 2010-02-02 Doug Kwan <dougkwan@google.com>
6511 * Makefile.am (HFILES): Add arm-reloc-property.h.
6513 (TARGETSOURCES): Add arm-reloc-property.cc
6514 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6515 (libgold_a_SOURCES): $(DEFFILES)
6516 * Makefile.in: Regenerate.
6517 * arm-reloc-property.cc: New file.
6518 * arm-reloc-property.h: New file.
6519 * arm-reloc.def: New file.
6520 * arm.cc: Update comments.
6521 (arm-reloc-property.h): New included header.
6522 (arm_reloc_property_table): New global variable.
6523 (Target_arm::do_select_as_default_target): New method definition.
6524 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6525 arm-reloc-property to targ_extra_obj.
6526 * parameters.cc (set_parameters_target): Call
6527 Target::select_as_default_target().
6528 * target.h (Target::select_as_default_target): New method definition.
6529 (Target::do_select_as_default_target): Same.
6531 2010-02-01 Doug Kwan <dougkwan@google.com>
6533 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6534 first_output_text_section_.
6535 (Arm_exidx_fixup::first_output_text_section): New method definition.
6536 (Arm_exidx_fixup::first_output_text_section_): New data member.
6537 (Arm_exidx_fixup::process_exidx_section): Record the first text
6538 output section seen.
6539 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6540 and entsize in output section header.
6542 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6544 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6545 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6546 (Arm_relocate_functions::thm_alu11): New Method.
6547 (Arm_relocate_functions::thm_pc8): New Method.
6548 (Arm_relocate_functions::thm_pc12): New Method.
6549 (Target_arm::Scan::local): Handle the relocations.
6550 (Target_arm::Scan::global): Likewise.
6551 (Target_arm::Relocate::relocate): Likewise.
6552 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6554 2010-01-29 Doug Kwan <dougkwan@google.com>
6556 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6557 of relocation types as ld.
6559 2010-01-29 Doug Kwan <dougkwan@google.com>
6561 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6563 (Arm_relocate_functions::thumb_branch_common): Ditto.
6564 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6565 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6566 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6567 Arm_relocate_functions::jump24): Remove.
6568 (Target_arm::Relocate::relocate): Adjust code to call
6569 Arm_relocation_functions::arm_branch_common and
6570 Arm_relocation_functions::thumb_branch_common instead of their removed
6571 wrappers. Merge switch-cases together to reduce source code size.
6573 2010-01-29 Doug Kwan <dougkwan@google.com>
6575 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6576 output_local_symbol_count_needs_update_.
6577 (Arm_relobj::output_local_symbol_count_needs_update,
6578 Arm_relobj::set_output_local_symbol_count_needs_update,
6579 Arm_relobj::update_output_local_symbol_count): New methods.
6580 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6582 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6583 of pointed function as in a R_ARM_PREL31 relocation.
6584 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6585 for output local symbol count updating.
6586 (Target_arm::do_relax): Update output local symbol counts in objects
6588 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6590 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6592 * arm.cc: Added support for the ARM relocations:
6593 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6594 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6595 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6597 (Arm_relocate_functions::movw_rel): New method.
6598 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6599 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6601 (Arm_relocate_functions::thm_movw_rel): New method.
6602 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6604 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6606 (Target_arm::Scan::global): Likewise.
6607 (Target_arm::Relocate::relocate): Likewise.
6608 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6611 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6613 * arm.cc: Added support for ARM group relocations.
6614 (Target_arm::reloc_needs_sym_origin): New method.
6615 (Arm_relocate_functions::calc_grp_kn): New method.
6616 (Arm_relocate_functions::calc_grp_residual): New method.
6617 (Arm_relocate_functions::calc_grp_gn): New method.
6618 (Arm_relocate_functions::arm_grp_alu): New Method.
6619 (Arm_relocate_functions::arm_grp_ldr): New Method.
6620 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6621 (Arm_relocate_functions::arm_grp_ldc): New Method.
6622 (Target_arm::Scan::local): Handle the ARM group relocations.
6623 (Target_arm::Scan::global): Likewise.
6624 (Target_arm::Relocate::relocate): Likewise.
6625 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6628 2010-01-26 Doug Kwan <dougkwan@google.com>
6630 * arm.cc (set): Include.
6631 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6633 (Arm_output_section::Text_section_list): New type.
6634 (Arm_output_section::append_text_sections_to_list): New method.
6635 (Arm_output_section::fix_exidx_coverage): Ditto.
6636 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6637 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6638 Relobj::set_section_offset() instead of
6639 Sized_relobj::invalidate_section_offset().
6640 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6641 parameter for section headers. Ignore relocation sections for
6642 unallocated sections and EXIDX sections.
6643 (Target_arm::fix_exidx_coverage): New method.
6644 (Target_arm::output_section_address_less_than): New type.
6645 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6646 linked text section instead of the EXIDX section.
6647 (Arm_output_section::create_stub_group): Add an assertion to check
6648 that this is not an EXIDX output section.
6649 (Arm_output_section::append_text_sections_to_list): New method.
6650 (Arm_output_section::fix_exidx_coverage): Ditto.
6651 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6652 Arm_relobj::section_needs_reloc_stub_scanning.
6653 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6655 (Target_arm::fix_exidx_coverage): New method.
6656 * object.h (Relobj::set_output_section): New method.
6657 (Sized_relobj::invalidate_section_offset): Remove method.
6658 (Sized_relobj::do_invalidate_section_offset): Remove method.
6659 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6661 2010-01-25 Doug Kwan <dougkwan@google.com>
6663 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6664 Fix warning due to signed and unsigned comparison on a 32-bit host.
6666 2010-01-22 Doug Kwan <dougkwan@google.com>
6668 * arm.cc (Target_arm::do_relax): Record an output section for section
6669 offset adjustment it contains any stub table that has changed.
6670 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6671 offsets in an output section if necessary.
6672 * output.cc (Output_section::Output_section): Initialize
6673 section_offsets_need_adjustments_.
6674 (Output_section::add_input_section_for_script): Renamed to
6675 Output_section::add_simple_input_section.
6676 (Output_section::save_states): Add a comment.
6677 (Output_section::discard_states): New method defintion.
6678 (Output_section::adjust_section_offsets): Same.
6679 * output.h (Output_section::add_input_section_for_script): Renamed to
6680 Output_section::add_simple_input_section.
6681 (Output_section::discard_states): New method declaration.
6682 (Output_section::adjust_section_offsets): Same.
6683 (Output_section::section_offsets_need_adjustment,
6684 Output_section::set_section_offsets_need_adjustment): New method
6686 (Output_section::section_offsets_need_adjustment_): New data member.
6687 * script-sections.cc
6688 (Output_section_element_input::set_section_address): Adjust code for
6689 renaming of Output_section::add_input_section_for_script.
6690 (Orphan_output_section::set_section_address): Same.
6692 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6694 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6695 Fix_v4bx enum values .
6696 * gold/options.h (General_options): New option definitions.
6697 (General_options::fix_v4bx): New method.
6698 (General_options::Fix_v4bx): New enum.
6699 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6700 (General_options::parse_fix_v4bx_interworking): New method.
6702 2010-01-22 Doug Kwan <dougkwan@google.com>
6704 * arm.cc (Arm_exidx_fixup): New class.
6706 2010-01-21 Doug Kwan <dougkwan@google.com>
6708 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6710 (Arm_exidx_section_offset_map): New type.
6712 2010-01-21 Doug Kwan <dougkwan@google.com>
6714 * arm.cc (Arm_exidx_input_section): New class.
6715 (Arm_relobj::exidx_input_section_by_link,
6716 Arm_relobj::exidx_input_section_by_shndx,
6717 Arm_relobj::make_exidx_input_section): New methods.
6718 (read_arm_attributes_section): Remove.
6719 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6720 information about them.
6721 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6724 2010-01-20 Doug Kwan <dougkwan@google.com>
6726 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6727 Input_section_specifier to Section_id.
6728 (Target_arm::new_arm_input_section: Adjust code for change of key
6730 (Target_arm::find_arm_input_section): Ditto.
6731 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6732 (Section_id): Remove.
6733 (Garbage_collection::Section_id_hash): Remove.
6734 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6735 (Section_id): Remove.
6736 (Icf::Section_id_hash): Remove.
6737 * object.h (Section_id, Const_section_id, Section_id_hash,
6738 Const_section_id_hash): New type definitions.
6739 * output.cc (Output_section::add_relaxed_input_section): Change to
6740 use Const_section_id instead of Input_section_specifier as key type.
6741 (Output_section::add_merge_input_section): Ditto.
6742 (Output_section::build_relaxation_map): Change to use Section_id
6743 instead of Input_section_specifier as key type.
6744 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6746 (Output_section::convert_input_sections_to_relaxed_sections): Change
6747 to use Const_section_id instead of Input_section_specifier as key type.
6748 (Output_section::find_merge_section): Ditto.
6749 (Output_section::find_relaxed_input_section): Ditto.
6750 * output.h (Input_section_specifier): Remove class.
6751 (Output_section::Output_section_data_by_input_section_map): Change
6752 key type to Const_section_id.
6753 (Output_section::Output_relaxed_input_section_by_input_section_map):
6755 (Output_section::Relaxation_map): Change key type to Section_id.
6757 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6759 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6760 (class Arm_v4bx_stub): New class.
6761 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6762 (Stub_factory::make_arm_v4bx_stub): New method.
6763 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6764 (Stub_table::empty): Handle v4bx stubs.
6765 (Stub_table::add_arm_v4bx_stub): New method.
6766 (Stub_table::find_arm_v4bx_stub): New method.
6767 (Arm_relocate_functions::v4bx): New method.
6768 (Target_arm::fix_v4bx): New method.
6769 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6770 (Stub_table::relocate_stubs): Likewise.
6771 (Stub_table::do_write): Likewise.
6772 (Stub_table::update_data_size_and_addralign): Likewise.
6773 (Stub_table::finalize_stubs): Likewise.
6774 (Target_arm::Scan::local): Likewise.
6775 (Target_arm::Scan::global): Likewise.
6776 (Target_arm::do_finalize_sections): Likewise.
6777 (Target_arm::Relocate::relocate): Likewise.
6778 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6780 (Target_arm::scan_reloc_for_stub): Likewise.
6781 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6783 2010-01-19 Ian Lance Taylor <iant@google.com>
6785 * output.cc (Output_section_headers::do_sized_write): Write large
6786 segment count to sh_info field.
6787 (Output_file_header::do_sized_write): For large segment count,
6788 write PN_XNUM to e_phnum field.
6790 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6792 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6793 (Arm_relocate_functions::thm_jump8): New function.
6794 (Arm_relocate_functions::thm_jump11): New function.
6795 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6797 (Target_arm::Scan::global): Likewise.
6798 (Target_arm::Relocate::relocate): Likewise.
6799 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6802 2010-01-14 Doug Kwan <dougkwan@google.com>
6804 * arm.cc (map, utility): Include headers.
6805 (Target_arm::apply_cortex_a8_workaround): New method.
6806 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6807 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6808 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6809 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6810 the --[no-]fix-cortex-a8 command line options.
6811 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6812 (Target_arm::relocate_stub): Use addend in instruction template.
6813 * options.h (DEFINE_bool): Set the user-set flag.
6814 (General_options): Add --[no-]-fix-cortex options.
6815 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6816 : Update fast look-up map after conversion.
6818 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6820 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6821 in the first pass of do_layout.
6823 2010-01-13 Doug Kwan <dougkwan@google.com>
6825 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6826 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6827 apparent compiler problem of not folding static constant integral
6828 data members of elfcpp::Elf_sizes<32>.
6830 2010-01-13 Doug Kwan <dougkwan@google.com>
6832 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6833 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6834 Arm_relobj::scan_section_for_cortex_a8_erratum,
6835 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6836 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6837 sections to scan for relocation stubs into a new method
6838 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6839 relocation and Cortex-A8 stub scanning.
6840 (Target_arm::do_relax): Force stubs to be after stubbed sections
6841 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6842 the beginning of a new relaxation pass. Update a comment.
6843 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6845 2010-01-12 Ian Lance Taylor <iant@google.com>
6847 * target-reloc.h (visibility_error): New inline function.
6848 (relocate_section): Call visibility_error.
6849 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6850 (MOSTLYCLEANFILES): Likewise.
6851 (protected_4_pic.o, protected_3.err): New targets.
6852 * testsuite/protected_4.cc: New file.
6854 2010-01-12 Doug Kwan <dougkwan@google.com>
6856 * arm.cc (Cortex_a8_reloc): New class.
6857 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6858 and cortex_a8_relocs_info_.
6859 (Target_arm::fix_cortex_a8): New method definition.
6860 (Target_arm::Cortex_a8_relocs_info): New type.
6861 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6862 New data member declarations.
6863 (Target_arm::scan_reloc_for_stub): Record information about
6864 relocations for THUMB branches that might be exempted from the
6865 Cortex-A8 workaround.
6866 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6867 at the beginning of a relaxation pass.
6869 2010-01-12 Doug Kwan <dougkwan@google.com>
6871 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6872 (Arm_relobj::Mapping_symbol_position,
6873 Arm_reloj::Mapping_symbol_position_less,
6874 Arm_relobj::Mapping_symbols_info): New types.
6875 (Target_arm::is_mapping_symbol_name): New method definition.
6876 (Arm_relobj::do_count_local_symbols): Save information about mapping
6879 2010-01-11 Doug Kwan <dougkwan@google.com>
6881 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6882 Arm_relocate_functions::thumb32_branch_upper,
6883 Arm_relocate_functions::thumb32_branch_lower,
6884 Arm_relocate_functions::thumb32_cond_branch_offset,
6885 Arm_relocate_functions::thumb32_cond_branch_upper,
6886 Arm_relocate_functions::thumb32_cond_branch_lower,
6887 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6888 branch offset encoding.
6889 (Arm_relocate_functions::thumb_branch_common): Use new branch
6890 offset encoding methods to avoid code duplication.
6891 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6892 (Stub_addend_reader::operator()): Use new branch encoding method
6893 to avoid code duplication.
6895 2010-01-11 Doug Kwan <dougkwan@google.com>
6897 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6898 (Target_arm::do_finalize_sections): Define special EXIDX section
6899 symbols only if referenced.
6900 * gc.h (Garbage_collection::add_reference): New method.
6901 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6904 2010-01-11 Ian Lance Taylor <iant@google.com>
6906 * script.cc (Version_script_info::build_expression_list_lookup):
6907 Change complaing about duplicate wildcard match from error to
6910 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6912 (Version_script_info::Version_script_info): Initialize globs_,
6913 default_version_, default_is_global_, and exact_. Don't
6914 initialize globals_ or locals_.
6915 (Version_script_info::build_lookup_tables): Build local symbols
6917 (Version_script_info::unquote): New function.
6918 (Version_script_info::add_exact_match): New function.
6919 (Version_script_info::build_expression_list_lookup): Remove lookup
6920 parameter. Add is_global parameter. Change all callers. Handle
6921 wildcard pattern specially. Unquote pattern. Call
6923 (Version_script_info::get_name_to_match): New function.
6924 (Version_script_info::get_symbol_version): New function.
6925 (Version_script_info::get_symbol_version_helper): Remove.
6926 (Version_script_info::check_unmatched_names): Call unquote.
6927 * script.h (class Version_script_info): Change get_symbol_version
6928 to be non-inline and add is_global parameter; change all callers.
6929 Rewrite symbol_is_local. Update declarations. Define struct
6930 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6931 Remove globals_ and locals_ members. Add exact_, globs_,
6932 default_version_, is_global_.
6933 (Version_script_info::Glob): Remove pattern, add expression and
6934 is_global. Update constructor. Change all callers.
6935 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6937 (Versions::symbol_section_contents): If a symbol is undefined, or
6938 defined in a dynamic object, set the version index to
6940 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6942 (Symbol_table::add_from_pluginobj): Likewise.
6943 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6945 2010-01-11 Doug Kwan <dougkwan@google.com>
6947 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6948 (incremental_dump_LDADD): Add linking option for libintl.
6949 * Makefile.in: Regenerate.
6951 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6954 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6956 * testsuite/Makefile.in: Regenerated.
6958 2010-01-10 Doug Kwan <dougkwan@google.com>
6960 * options.h (DEFINE_var): Use parentheses around argument varname__
6961 in macro body to avoid any unintended subsequent substitutions.
6963 2010-01-10 Ian Lance Taylor <iant@google.com>
6965 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6966 candidates before doing symbol resolution.
6968 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6969 ODR candidates if only one is weak.
6971 2010-01-08 Ian Lance Taylor <iant@google.com>
6973 * script.cc (Version_script_info::build_expression_list_lookup):
6974 Don't warn about ambiguous version, just record the ambiguity.
6975 (Version_script_info::get_symbol_version_helper): Give error if
6976 version is ambiguous.
6978 2010-01-08 Doug Kwan <dougkwan@google.com>
6980 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6981 prev_data_size_ and prev_addralign_. Remove initializer for
6982 deleted data member has_been_changed_.
6983 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6984 to determine if the table is empty.
6985 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6987 (Stub_table::add_reloc_stub): Define method in class definition
6988 instead of just declaring it there.
6989 (Stub_table::add_cortex_a8_stub): New method definition.
6990 (Stub_table::update_data_size_and_addralign): Ditto.
6991 (Stub_table::finalize_stubs): Ditto.
6992 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6993 (Stub_table::do_addralign_): Return address alignment in the
6994 (Stub_table::do_reset_address_and_file_offset): Define method in
6995 class definition instead of declaring it there. Set current data
6996 size to be the data size of the previous pass.
6997 (Stub_table::set_final_data_size): Use current data size as the
6999 (Stub_table::relocate_stub): Change parameter type of stub from
7000 Reloc_stub pointer to Stub pointer.
7001 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7002 (Stub_table::Cortex_a8_stub_list): New typedef.
7003 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7004 Stub_table::prev_addralign_): New data member.
7005 (Arm_relobj::Arm_relobj): Initialize data member
7006 section_has_cortex_a8_workaround_.
7007 (Arm_relobj::section_has_cortex_a8_workaround,
7008 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7010 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7012 (Target_arm::relocate_stub): Change parameter type of stub from
7013 Reloc_stub pointer to Stub pointer.
7014 (Insn_template::size, Insn_template::alignment): Handle
7015 THUMB16_SPECIAL_TYPE.
7016 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7017 Stub_table::update_data_size_and_addralign,
7018 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7020 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7021 (Stub_table::do_write): Ditto.
7022 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7024 2010-01-08 Ian Lance Taylor <iant@google.com>
7027 * symtab.h (class Symbol): Remove fields is_target_special_ and
7028 has_plt_offset_. Add field is_defined_in_discarded_section_.
7029 (Symbol::is_defined_in_discarded_section): New function.
7030 (Symbol::set_is_defined_in_discarded_section): New function.
7031 (Symbol::has_plt_offset): Rewrite.
7032 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7033 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7034 Don't initialize is_target_special_ or has_plt_offset_.
7035 Initialize is_defined_in_discarded_section_.
7036 (Symbol_table::add_from_relobj): If appropriate, set
7037 is_defined_in_discarded_section.
7038 * resolve.cc (Symbol::override_base_with_special): Don't test
7039 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7040 * target-reloc.h (relocate_section): Do special handling for
7041 symbols defined in discarded sections for global symbols as well
7044 2010-01-08 Ian Lance Taylor <iant@google.com>
7046 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7047 the SHT_SYMTAB case.
7049 2010-01-08 Ian Lance Taylor <iant@google.com>
7051 * object.cc (Sized_relobj::do_layout): Don't get confused if
7052 layout_eh_frame returns NULL.
7054 2010-01-08 Ian Lance Taylor <iant@google.com>
7057 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7058 dynamic symbol table, use the normal symbol table.
7059 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7062 2010-01-08 Ian Lance Taylor <iant@google.com>
7065 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7068 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7070 * version.cc (print_version): Change to "Copyright 2010".
7072 2010-01-08 Ian Lance Taylor <iant@google.com>
7076 * i386.cc (class Target_i386): Change return type of plt_section
7078 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7079 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7080 tls_desc_rel_ field.
7081 (Output_data_plt_i386::rel_tls_desc): New function.
7082 (Target_i386::rel_tls_desc_section): New function.
7083 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7084 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7085 R_386_TLS_DESC reloc in rel_tls_desc_section.
7086 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7087 Define struct Tlsdesc_info.
7088 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7089 (Target_x86_64::do_reloc_symbol_index): New function.
7090 (Target_x86_64::add_tlsdesc_info): New function.
7091 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7092 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7094 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7096 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7097 (Target_x86_64::rela_tlsdesc_section): New function.
7098 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7100 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7101 (Target_x86_64::do_reloc_addend): New function.
7102 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7103 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7104 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7105 (Output_reloc::type): New function.
7106 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7107 (Output_reloc::is_target_specific): New function.
7108 (Output_reloc::target_arg): New function.
7109 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7110 absolute relocs and target specific relocs.
7111 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7112 add_target_specific.
7113 (class Output_data_reloc) [SHT_RELA]: Likewise.
7114 * output.cc (Output_reloc::Output_reloc): Add four new versions
7115 for absolute relocs and target specific relocs.
7116 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7117 (Output_reloc::get_symbol_index): Likewise.
7118 (Output_reloc::local_section_offset): Check that local_sym_index_
7119 is not TARGET_CODE or 0.
7120 (Output_reloc::symbol_value): Likewise.
7121 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7123 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7124 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7126 * layout.cc (add_target_dynamic_tags): Use output section for
7127 DT_PLTRELSZ and DT_JMPREL.
7129 2010-01-07 Ian Lance Taylor <iant@google.com>
7132 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7134 (class Output_data_reloc_generic): Define.
7135 (class Output_data_reloc_base): Change base class to
7136 Output_data_reloc_generic. Change add() method to call
7137 bump_relative_reloc_count for a relative reloc. Remove
7139 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7141 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7142 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7144 * layout.h (class Layout): Update declaration.
7146 2010-01-07 Ian Lance Taylor <iant@google.com>
7148 * output.h (class Output_data): Add const version of
7149 output_section and do_output_section.
7150 (class Output_section_data): Add const version of
7152 (class Output_section): Likewise.
7153 * layout.cc (Layout::add_target_dynamic_tags): New function.
7154 * layout.h (class Layout): Update declarations.
7155 * arm.cc (Target_arm::do_finalize_sections): Use
7156 add_target_dynamic_tags.
7157 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7158 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7159 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7160 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7162 2010-01-07 Ian Lance Taylor <iant@google.com>
7165 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7168 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7169 Ian Lance Taylor <iant@google.com>
7172 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7173 Xindex::read_symtab_xindex.
7175 2010-01-07 Doug Kwan <dougkwan@google.com>
7177 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7178 (Insn_template::thumb16_bcond_insn): New method declaration.
7179 (Insn_template): Fix spelling.
7180 (Stub::thumb16_special): New method declaration.
7181 (Stub::do_write): Define virtual method which was previously pure
7183 (Stub::do_thumb16_special): New method declaration.
7184 (Stub::do_fixed_endian_write): New template member.
7185 (Reloc_stub::do_write): Remove.
7186 (Reloc_stub::do_fixed_endian_write): Remove.
7187 (Cortex_a8_stub): New class definition.
7188 (Stub_factory::make_cortex_a8_stub): New method definition.
7189 (Stub_factory::Stub_factory): Add missing static storage class
7190 qualifier for elf32_arm_stub_a8_veneer_blx.
7192 2010-01-07 Ian Lance Taylor <iant@google.com>
7195 * options.h (class General_options): Add --warn-unresolved-symbols
7196 and --error-unresolved-symbols.
7197 * errors.cc (Errors::undefined_symbol): Implement
7198 --warn-unresolved-symbols.
7200 * options.h (class General_options): Add -z text and -z textoff.
7201 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7203 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7205 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7206 (Garbage_collection::cident_sections): New function.
7207 (Garbage_collection::add_cident_section): New function.
7208 (Garbage_collection::cident_sections_): New member.
7209 (gc_process_relocs): Add references to sections whose names are C
7211 * gold.h (cident_section_start_prefix): New constant.
7212 (cident_section_stop_prefix): New constant.
7213 (is_cident): New function.
7214 * layout.cc (Layout::define_section_symbols): Replace string constants
7215 with the newly defined constants.
7216 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7218 * testsuite/Makefile.am: Add gc_orphan_section_test.
7219 * testsuite/Makefile.in: Regenerate.
7220 * testsuite/gc_orphan_section_test.cc: New file.
7221 * testsuite/gc_orphan_section_test.sh: New file.
7223 2010-01-06 Ian Lance Taylor <iant@google.com>
7226 * options.h (class General_options): Add --warn-shared-textrel.
7227 * layout.cc (Layout::finish_dynamic_section): Implement
7228 --warn-shared-textrel.
7231 * options.h (class General_options): Add --warn-multiple-gp.
7233 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7235 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7236 $(THREADSLIB) and $(LIBDL).
7237 * Makefile.in: Rebuild.
7239 2010-01-06 Ian Lance Taylor <iant@google.com>
7242 * options.cc (General_options::parse_section_start): New function.
7243 (General_options::section_start): New function.
7244 (General_options::General_options): Initialize all members.
7245 * options.h: Include <map>
7246 (class General_options): Add --section-start. Add section_starts_
7248 * layout.cc (Layout::attach_allocated_section_to_segment): If
7249 --section-start was used, set the address of the segment. Remove
7250 local sort_sections.
7251 (Layout::relaxation_loop_body): If the address of the load segment
7252 has been set by --section-start, don't use it.
7253 * output.h (Output_segment::update_flags_for_output_section): New
7255 * output.cc (Output_segment::add_output_section): Call
7256 update_flags_for_output_section.
7258 2010-01-05 Ian Lance Taylor <iant@google.com>
7261 * options.h (class General_options): Add --undefined-version.
7262 * script.cc (struct Version_expression): Add was_matched_by_symbol
7264 (Version_script_info::matched_symbol): New function.
7265 (Version_script_info::get_symbol_version_helper): Call
7267 (Version_script_info::check_unmatched_names): New function.
7268 * script.h (class Version_script_info): Update declarations.
7269 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7271 * options.h (class General_options): Use DEFINE_bool_alias for
7272 allow_multiple_definition.
7273 * resolve.cc (Symbol_table::should_override): Don't test
7274 allow_multiple_definition.
7277 * options.h (class General_options): Add --cref.
7278 * main.cc (main): Print cref table if --cref. Don't close mapfile
7279 until after printing cref table.
7280 * cref.cc: Include "symtab.h".
7281 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7282 (Cref_table_compare::operator()): New function.
7283 (Cref_inputs::gather_cref): New function.
7284 (filecol): New static const.
7285 (Cref_inputs::print_cref): New function.
7286 (Cref::print_cref): New function.
7287 * cref.h: Include <cstdio>.
7288 (class Cref): Update declarations.
7289 * mapfile.h (Mapfile::file): New function.
7290 * object.h (class Object): Define Symbols. Declare virtual
7291 do_get_global_symbols.
7292 (Object::get_global_symbols): New function.
7293 * object.cc (Input_objects::add_object): Pass object to cref_ if
7295 (Input_objects::archive_start): Likewise.
7296 (Input_objects::archive_stop): Likewise.
7297 (Input_objects::print_cref): New function.
7298 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7299 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7301 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7303 * plugin.h (class Sized_pluginobj): Update declarations.
7305 2010-01-05 Ian Lance Taylor <iant@google.com>
7307 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7308 to is_default_version. Rename insdef to insdefault.
7309 (Symbol_table::add_from_relobj): Rename def to is_default_version
7310 and local to is_forced_local.
7311 (Symbol_table::add_from_pluginobj): Likewise.
7312 (Symbol_table::add_from_dynobj): Likewise.
7313 (Symbol_table::define_special_symbol): Rename insdef to
7316 2010-01-04 Ian Lance Taylor <iant@google.com>
7319 * options.h (class General_options): Add
7320 --allow-multiple-definition and -z muldefs.
7321 * resolve.cc (Symbol_table::should_override): Don't warn about a
7322 multiple symbol definition if --allow-multiple-definition or -z
7326 * options.h (class General_options): Add --add-needed and
7327 --copy-dt-needed-entries. Tweak --as-needed help entry.
7328 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7329 error if --copy-dt-needed-entries aka --add-needed is used and
7330 would cause a change in behaviour.
7333 * options.h (class General_options): Add -G as a short version of
7334 --shared. Add no-op options -assert, -g, and -i.
7336 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7338 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7339 check for .text or .gnu.linkonce.t sections.
7340 * icf.cc (Icf::find_identical_sections): Ditto.
7341 Change the detection for mangled function name within the section
7343 * icf.h (is_section_foldable_candidate): New function.
7345 2009-12-30 Ian Lance Taylor <iant@google.com>
7348 * options.h (class General_options): Permit two dashes with
7349 --retain-symbols-file.
7351 2009-12-30 Ian Lance Taylor <iant@google.com>
7354 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7355 don't put the file header and segment headers in the text
7359 * common.cc (Sort_commons::operator()): Stabilize sort when both
7361 (Symbol_table::do_allocate_commons_list): When allocating common
7362 symbols, skip a symbol which is no longer common.
7363 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7364 an object before checking its type.
7365 * testsuite/common_test_2.c: New file.
7366 * testsuite/common_test_3.c: New file.
7367 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7368 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7369 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7370 (common_test_2_pic.o, common_test_2.so): New targets.
7371 (common_test_3_pic.o, common_test_3.so): New targets.
7372 * testsuite/Makefile.in: Rebuild.
7375 * script.cc (read_input_script): If we see a new SECTIONS clause,
7376 and we have added an input section, give an error.
7377 * layout.h (class Layout): Add have_added_input_section function.
7378 Add have_added_input_section_ field.
7379 * layout.cc (Layout::Layout): Initialize
7380 have_added_input_section_.
7381 (Layout::layout): Set have_added_input_section_.
7382 (Layout::layout_eh_frame): Likewise.
7384 2009-12-30 Ian Lance Taylor <iant@google.com>
7387 * options.h (class General_options): Add --sort-common option.
7388 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7389 * common.cc (Sort_common): Add sort_order parameter to
7390 constructor. Add sort_order_ field.
7391 (Sort_commons::operator): Check sort_order_.
7392 (Symbol_table::allocate_commons): Determine the sort order.
7393 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7395 (Symbol_table::do_allocate_commons_list): Likewise.
7397 2009-12-30 Ian Lance Taylor <iant@google.com>
7400 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7401 symbols from this object, don't change the visibility of an
7403 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7405 2009-12-30 Ian Lance Taylor <iant@google.com>
7408 * script.h (class Version_script_info): Define Language enum.
7409 Update declarations. Define Glob, Exact, and Lookup types. Add
7410 new fields globals_, locals_, and is_finalized_.
7411 * script.cc: Various formatting fixes.
7412 (class Parser_closure): Change language_stack_ from a vector of
7413 std::string to one of Version_script_info::Language. Adjust all
7415 (class Lazy_demangler): Remove.
7416 (struct Version_expression): Change language from std::string to
7417 Version_script_info::Language.
7418 (Version_script_info::Version_script_info): New function.
7419 (Version_script_info::~Version_script_info): Don't call clear.
7420 (Version_script_info::finalize): New function.
7421 (Version_script_info::build_lookup_tables): New function.
7422 (Version_script_info::build_expression_list_lookup): New
7424 (Version_script_info::get_symbol_version_helper): Rewrite to use
7426 (Version_script_info::print_expression_list): Adjust to use
7427 Version_script_info::Language.
7428 (script_push_lex_into_version_mode): Check that the version script
7429 has not been finalized.
7430 (version_script_push_lang): Change language string to
7431 Version_script_info::Language.
7432 * options.cc (Command_line::version_script): New function.
7433 * options.h (class General_options): Add finalize_dynamic_list
7434 function. Change version_script from declaration to definition.
7435 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7436 * testsuite/version_script.map: Remove duplicate def of foo.
7437 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7439 * testsuite/Makefile.in: Rebuild.
7441 2009-12-30 Ian Lance Taylor <iant@google.com>
7444 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7445 if the input symbol index is 0, make the output symbol index 0.
7447 2009-12-30 Ian Lance Taylor <iant@google.com>
7450 * options.h (class General_options): Add -x/--discard-all.
7451 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7452 --discard-all. If the local symbol needs a dynamic entry, check
7453 that before handling --discard-locals.
7455 2009-12-30 Ian Lance Taylor <iant@google.com>
7458 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7460 (Output_segment::add_output_section): Don't change the flags if
7464 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7465 GNU hash table if they need a dynamic value. Otherwise, don't add
7466 them if they are defined in a dynamic object or are forced local.
7468 2009-12-29 Ian Lance Taylor <iant@google.com>
7471 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7472 .gnu.hash table for a 32-bit target.
7475 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7476 regular and a dynamic object only needs a dynamic symbol table
7477 entry if it is externally visible.
7480 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7481 constructor. Add global_offset_table_ field.
7482 (Target_i386::got_section): Set global_offset_table_.
7483 (Target_i386::do_finalize_sections): Set global_offset_table_
7485 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7486 in constructor. Add global_offset_table_ field.
7487 (Target_x86_64::got_section): Set global_offset_table_.
7488 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7491 * layout.cc (Layout::Layout): Initialize increase_relro_.
7492 (Layout::get_output_section): Add is_relro, is_last_relro, and
7493 is_first_non_relro parameters. Change all callers.
7494 (Layout::choose_output_section): Likewise.
7495 (Layout::add_output_section_data): Likewise.
7496 (Layout::make_output_section): Likewise.
7497 (Layout::set_segment_offsets): Clear increase_relro when using a
7499 * layout.h (class Layout): Add increase_relro method. Add
7500 increase_relro_ field. Update declarations.
7501 * output.cc (Output_section::Output_section): Initialize
7502 is_last_relro_ and is_first_non_relro_.
7503 (Output_segment::add_output_section): Group relro sections is
7504 do_sort is true. Handle is_last_relro and is_first_non_relro.
7505 (Output_segment::maximum_alignment): Remove relro handling.
7506 (Output_segment::set_section_addresses): Add increase_relro
7507 parameter. Change all callers. Add initial alignment to align
7508 relro sections on separate page. Remove old relro handling.
7509 (Output_segment::set_section_list_addresses): Remove in_relro
7510 parameter. Change all callers.
7511 (Output_segment::set_offset): Add increase parameter. Change all
7512 callers. Remove old relro handling.
7513 * output.h (class Output_section): Add new methods: is_last_relro,
7514 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7515 Add is_last_relro_ and is_first_non_relro_ fields.
7516 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7517 Create separate .got.plt section. Call increase_relro.
7518 * x86_64.cc (Target_x86_64::got_section): Likewise.
7519 * testsuite/relro_script_test.t: Add .got.plt.
7522 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7523 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7524 (Layout::finalize): Call set_dynamic_symbol_size.
7525 (Layout::set_dynamic_symbol_size): New function.
7526 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7527 set_dynamic_symbol_size.
7530 * output.h (class Output_section): Add is_entsize_zero_ field.
7531 * output.cc (Output_section::Output_section): Initialize
7533 (Output_section::set_entsize): If two different entsizes are
7534 requested, force it to zero.
7535 (Output_section::add_input_section): Set flags for .debug_str
7536 before updating section flags. Set entsize.
7537 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7538 and SHF_STRING if all input sections have those flags.
7540 2009-12-29 Rafael Espindola <espindola@google.com>
7542 * main.cc (main): Fix the sys time reporting.
7543 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7546 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7548 * options.cc (General_options::parse_version): Allow -v to exit
7549 without an error if there is nothing to link.
7551 2009-12-29 Ian Lance Taylor <iant@google.com>
7553 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7554 using a version of gcc before 4.1.
7555 * configure: Rebuild.
7557 2009-12-28 Chris Demetriou <cgd@google.com>
7559 * attributes.cc (Output_attributes_section_data::do_write): Use
7560 std::vector::front rather than std::vector::data.
7562 2009-12-28 Ian Lance Taylor <iant@google.com>
7564 * symtab.h (class Symbol_table): Add enum Defined.
7565 * resolve.cc (Symbol_table::should_override): Add defined
7566 parameter. Change all callers. Test whether object is NULL
7567 before calling a method on it.
7568 (Symbol_table::report_resolve_problem): Add defined parameter.
7570 (Symbol_table::should_override_with_special): Likewise.
7571 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7572 parameter. Change all callers.
7573 (Symbol_table::do_define_in_output_data): Likewise.
7574 (Symbol_table::define_in_output_segment): Likewise.
7575 (Symbol_table::do_define_in_output_segment): Likewise.
7576 (Symbol_table::define_as_constant): Likewise.
7577 (Symbol_table::do_define_as_constant): Likewise.
7578 * script.h (class Symbol_assignment): Add is_defsym parameter to
7579 constructor; change all callers.
7580 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7581 parameter. Change all callers. Add is_defsym_ field.
7582 (class Parser_closure): Add parsing_defsym parameter to
7583 constructor; change all callers. Add parsing_defsym accessor
7584 function. Add parsing_defsym_ field.
7586 2009-12-28 Ian Lance Taylor <iant@google.com>
7588 * gold.cc (queue_middle_tasks): Fix formatting.
7589 * object.cc (Relobj::is_section_name_included): Likewise.
7591 2009-12-23 Ian Lance Taylor <iant@google.com>
7593 * i386.cc (Target_i386::do_calls_non_split): Recognize
7594 -fsplit-stack prologue for a function with a static chain.
7595 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7596 -fsplit-stack prologue when using %r11.
7598 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7600 * options.cc (General_options::parse_version): Make -v continue and do
7601 the link like GNU ld does.
7603 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7605 * Makefile.am (CCFILES): Add timer.cc.
7606 (HFILES): Add timer.h.
7607 * configure.ac: Check for sysconf and times.
7608 * main.cc: include timer.h.
7609 (main): Use Timer instead of get_run_time.
7612 * workqueue.cc: include timer.h.
7613 (Workqueue::find_and_run_task):
7614 Report user, sys and wall time.
7615 * Makefile.in: Regenerate.
7616 * config.in: Regenerate.
7617 * configure: Regenerate.
7619 2009-12-16 Doug Kwan <dougkwan@google.com>
7621 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7623 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7624 relaxed input sections.
7625 * output.cc (Output_section::find_relaxed_input_section): Change
7626 return type to Output_relaxed_input_section pointer. Adjust code
7627 for new type of relaxed_input_section_map_.
7628 * output.h (Output_section::find_relaxed_input_section): Change
7629 return type to Output_relaxed_input_section pointer.
7630 (Output_section::Output_relaxed_input_section_by_input_section_map):
7632 (Output_section::relaxed_input_section_map_): Change type to
7633 Output_section::Output_relaxed_input_section_by_input_section_map.
7634 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7637 2009-12-15 Ian Lance Taylor <iant@google.com>
7639 * layout.cc (Layout::create_shstrtab): Only write out after input
7640 sections if we are compressing debug sections.
7642 2009-12-15 Ian Lance Taylor <iant@google.com>
7644 * archive.cc (Archive::add_symbols): Only look up a symbol without
7645 a version if there is, in fact, a version.
7647 2009-12-14 Ian Lance Taylor <iant@google.com>
7649 Revert -Wshadow changes, all changes from:
7650 2009-12-11 Doug Kwan <dougkwan@google.com>
7651 2009-12-11 Nick Clifton <nickc@redhat.com>
7652 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7654 2009-12-11 Doug Kwan <dougkwan@google.com>
7656 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7658 * attributes.cc (Object_attribute::size): Ditto.
7659 (Attributes_section_data::size): Ditto.
7660 (Attributes_section_data::Attributes_section_data): Ditto.
7661 (Output_attributes_section_data::do_write): Ditto.
7662 * attributes.h (Object_attribute::set_type): Ditto.
7663 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7665 2009-12-11 Nick Clifton <nickc@redhat.com>
7667 * archive.cc: Fix shadowed variable warnings.
7669 * compressed_output.cc: Likewise.
7670 * compressed_output.h: Likewise.
7671 * configure: Likewise.
7672 * dwarf_reader.cc: Likewise.
7673 * dynobj.cc: Likewise.
7674 * dynobj.h: Likewise.
7675 * ehframe.cc: Likewise.
7676 * ehframe.h: Likewise.
7677 * errors.cc: Likewise.
7678 * expression.cc: Likewise.
7679 * fileread.cc: Likewise.
7680 * fileread.h: Likewise.
7681 * freebsd.h: Likewise.
7682 * i386.cc: Likewise.
7684 * incremental.h: Likewise.
7685 * layout.cc: Likewise.
7686 * layout.h: Likewise.
7687 * mapfile.cc: Likewise.
7688 * merge.cc: Likewise.
7689 * merge.h: Likewise.
7690 * object.cc: Likewise.
7691 * object.h: Likewise.
7692 * options.h: Likewise.
7693 * output.cc: Likewise.
7694 * output.h: Likewise.
7695 * parameters.cc: Likewise.
7696 * plugin.cc: Likewise.
7697 * powerpc.cc: Likewise.
7698 * reduced_debug_output.cc: Likewise.
7699 * reduced_debug_output.h: Likewise.
7700 * reloc.cc: Likewise.
7701 * reloc.h: Likewise.
7702 * resolve.cc: Likewise.
7703 * script-sections.cc: Likewise.
7704 * script.cc: Likewise.
7705 * script.h: Likewise.
7706 * sparc.cc: Likewise.
7707 * symtab.cc: Likewise.
7708 * symtab.h: Likewise.
7709 * target-select.cc: Likewise.
7710 * target-select.h: Likewise.
7711 * token.h: Likewise.
7712 * workqueue.cc: Likewise.
7713 * workqueue.h: Likewise.
7714 * x86_64.cc: Likewise.
7716 2009-12-10 Doug Kwan <dougkwan@google.com>
7718 * arm.cc (attributes.h): New include.
7719 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7720 (Arm_relobj::~Arm_relobj): Delete object pointed by
7721 attributes_section_data_.
7722 (Arm_relobj::attributes_section_data): New method definition.
7723 (Arm_relobj::attributes_section_data_): New data member declaration.
7724 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7725 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7726 attributes_section_data_.
7727 (Arm_dynobj::attributes_section_data): New method definition.
7728 (Arm_dynobj::attributes_section_data_): New data member declaration.
7729 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7730 initialization value of may_use_blx_ to false.
7731 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7732 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7733 object attributes to compute results instead of hard-coding.
7734 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7735 Target_arm::get_secondary_compatible_arch,
7736 Target_arm::set_secondary_compatible_arch
7737 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7738 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7739 New method declarations.
7740 (Target_arm::get_aeabi_object_attribute): New method definition.
7741 (Target_arm::attributes_section_data_): New data member declaration.
7742 (read_arm_attributes_section): New template definition.
7743 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7744 (Arm_dynobj::do_read_symbols): Ditto.
7745 (Target_arm::do_finalize_sections): Merge attributes sections from
7746 input. Check for BLX use after attributes section merging.
7747 Fix __exidx_start and __exidx_end visibility. Create an
7748 .ARM.attributes section if necessary.
7749 (Target_arm::get_secondary_compatible_arch,
7750 Target_arm::set_secondary_compatible_arch,
7751 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7752 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7753 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7754 New method definitions.
7756 2009-12-09 Ian Lance Taylor <iant@google.com>
7758 * plugin.cc (Plugin::load): Don't cast from void* to a function
7761 2009-12-09 Ian Lance Taylor <iant@google.com>
7763 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7766 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7768 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7769 Replace two_file_shared_1.so with two_file_shared_2.so.
7770 * testsuite/Makefile.in: Regenerated.
7772 2009-12-08 Doug Kwan <dougkwan@google.com>
7774 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7775 (HFILES): Add attributes.h and int_encoding.h.
7776 * Makefile.in: Regenerate.
7777 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7778 function definitions to int_encoding.cc
7779 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7780 prototypes to int_encoding.h
7781 * reduced_debug_output.cc (int_encoding.h): New include.
7782 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7783 function definitions to int_encoding.cc
7784 (insert_into_vector, read_from_pointer): Move template definitions to
7786 * attributes.cc: New file.
7787 * attributes.h: New file.
7788 * int_encoding.cc: New file.
7789 * int_encoding.h: New file.
7791 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7794 * incremental-dump.cc (dump_incremental_inputs): New.
7795 (main): Use dump_incremental_inputs.
7797 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7800 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7801 checking elfcpp::STT_FUNC.
7802 (Target_i386::Relocate::relocate): Likewise.
7803 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7805 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7806 symbols from shared libraries into normal FUNC symbols.
7808 * symtab.h (Symbol): Add is_func and use it.
7810 2009-12-05 Doug Kwan <dougkwan@google.com>
7812 * arm.cc (Target_arm::arm_info): Initialize new fields
7813 attributes_section and attributes_vendor.
7814 * i386.cc (Target_i386::i386_info): Same.
7815 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7816 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7817 fields attributes_section and attributes_vendor.
7818 * sparc.cc (Target_sparc::sparc_info): Same.
7819 * target.h (Target::attributes_section, Target::attributes_vendor,
7820 Target::is_attributes_section, Target::attribute_arg_type,
7821 Target::attributes_order): New method definitions.
7822 (Target::Target_info::attributes_section,
7823 Target::Target_info::attributes_vendor): New fields.
7824 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7825 virtual method definitions.
7826 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7827 attributes_section and attributes_vendor.
7828 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7830 2009-12-05 Doug Kwan <dougkwan@google.com>
7832 * arm.cc: Update comments about interworking and stub generation.
7833 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7834 considered as non-PIC.
7835 (Arm_relocate_functions::base_abs): Fix formatting.
7836 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7837 of function to use GOT entry address instead of offset.
7838 (Target_arm::Scan::global): Issue an error if a symbol would need a
7839 PLT does not get one because it is untyped. Remove code to create
7840 dynamic symbols for relative branches.
7841 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7842 takes unsigned integer instead of boolean.
7844 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7846 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7847 (two_file_test_LDADD): Likewise.
7848 (common_test_1_LDADD): Likewise.
7849 (exception_test_LDADD) Likewise.
7850 (weak_test_LDADD): Likewise.
7851 (many_sections_test_LDADD): Likewise.
7852 (initpri1_LDADD): Likewise.
7853 (script_test_1_LDADD): Likewise.
7854 (script_test_2_LDADD): Likewise.
7855 (justsyms_LDADD): Likewise.
7856 (binary_test_LDADD): Likewise.
7857 (large_LDADD): Likewise.
7858 * testsuite/Makefile.in: Regenerated.
7860 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7862 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7863 (Symbol_table::override_with_special): Likewise.
7864 (Symbol_table::add_from_object): Likewise.
7866 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7868 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7869 Don't set the data_offset twice.
7871 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7873 * testsuite/Makefile.in: Regenerate.
7875 2009-12-03 Doug Kwan <dougkwan@google.com>
7877 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7878 (Target_arm::do_finalize_sections): Add parameter for symbol table
7879 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7880 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7881 parameter for symbol table pointer.
7882 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7883 an additional parameter for a pointer to symbol table.
7884 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7885 parameter for a symbol table pointer.
7886 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7887 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7889 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7890 parameter for a symbol table pointer.
7892 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7894 * incremental.cc (Incremental_inputs_header)
7895 (Incremental_inputs_header_write, Incremental_inputs_entry)
7896 (Incremental_inputs_entry_write): Move ...
7897 * incremental.h (Incremental_inputs_header)
7898 (Incremental_inputs_header_write, Incremental_inputs_entry)
7899 (Incremental_inputs_entry_write): here.
7901 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7903 * incremental.cc (make_sized_incremental_binary): Set the target.
7904 Error if it is incompatible.
7905 * output.h (Output_file): Add filename method.
7907 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7909 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7910 from the get_* methods.
7912 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7914 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7915 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7916 Write 0 for the data_offset of scripts.
7918 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7920 * testsuite/Makefile.am: Add the incremental_test.sh test.
7921 * testsuite/incremental_test.sh: New.
7922 * testsuite/incremental_test_1.c: New.
7923 * testsuite/incremental_test_2.c: New.
7925 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7927 * incremental-dump.cc (main): Fix typos.
7929 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7932 * incremental-dump.cc (main): Use llu to print 64 bit values.
7934 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7935 H.J. Lu <hongjiu.lu@intel.com>
7937 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7939 (incremental_dump_LDADD): Likewise.
7940 * Makefile.in: Regenerated.
7942 2009-11-25 Doug Kwan <dougkwan@google.com>
7946 2009-11-25 Doug Kwan <dougkwan@google.com>
7948 * arm.cc (Target_arm::Target_arm): Move method definition
7949 outside of class definition. Add code to handle
7950 --target1-rel, --target1-abs and --target2= options.
7951 (Target_arm::get_reloc_reloc_type): Change method to be
7952 non-static and const.
7953 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7954 New data member declaration.
7955 (Target_arm::Scan::local, Target_arm::Scan::global,
7956 Target_arm::Relocate::relocate,
7957 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7958 Adjust call to Target_arm::get_real_reloc_type.
7959 (Target_arm::get_real_reloc_type): Use command line options
7960 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7961 * options.h (--target1-rel, --target1-abs, --target2): New
7964 2009-11-25 Doug Kwan <dougkwan@google.com>
7966 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7967 class definition. Add code to handle --target1-rel, --target1-abs
7968 and --target2= options.
7969 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7971 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7973 (Target_arm::Scan::local, Target_arm::Scan::global,
7974 Target_arm::Relocate::relocate,
7975 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7976 call to Target_arm::get_real_reloc_type.
7977 (Target_arm::get_real_reloc_type): Use command line options to
7978 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7979 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7982 2009-11-25 Doug Kwan <dougkwan@google.com>
7984 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7985 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7986 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7988 (Arm_relocate_functions::thm_call): Replace body with a call to
7989 Arm_relocate_functions::thumb_branch_common.
7990 (Arm_relocate_functions::thm_jump24,
7991 Arm_relocate_functions::thm_xpc22): New method definitions.
7992 (Arm_relocate_functions::thumb_branch_common): New method definition.
7993 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7995 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7996 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7998 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8000 * Makefile.am: Build incremental-dump
8001 * Makefile.in: Regenerate.
8002 * incremental-dump.cc: New.
8003 * incremental.cc (Incremental_inputs_header_data,
8004 Incremental_inputs_entry_data): Move to incremental.h
8005 * incremental.h: (Incremental_inputs_header_data,
8006 Incremental_inputs_entry_data): Move from incremental.cc
8008 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8010 * incremental.cc (Incremental_inputs_header,
8011 Incremental_inputs_header_write, Incremental_inputs_entry,
8012 Incremental_inputs_entry_write): Add a typedef with the data type.
8014 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8016 * incremental.cc (Incremental_inputs_header,
8017 Incremental_inputs_header_write, Incremental_inputs_entry,
8018 Incremental_inputs_entry_write): Update comment about which
8019 type has the filed descriptions.
8021 2009-11-15 Doug Kwan <dougkwan@google.com>
8023 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8024 (Arm_relocate_functions::arm_branch_common): Change method defintion
8025 in class definition to a method declaration and update list of formal
8027 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8028 Arm_relocation_functions::jump24): Adjust call to
8029 Arm_relocate_functions::arm_branch_common. Update list of formal
8031 (Arm_relocate_functions::xpc25): New method definition.
8032 (Arm_relocate_functions::arm_branch_common): Move method defintion
8033 out from class definition. Use stubs for mode-switching and extending
8035 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8036 specially. Change code to enable use of stubs in ARM branches.
8038 2009-11-10 Doug Kwan <dougkwan@google.com>
8040 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8041 in method declaration.
8042 (Target_arm::relocate_stub): New method declaration.
8043 (Target_arm::default_target): Change to return a pointer instead of
8045 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8046 Target_arm::default_target.
8047 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8049 (Target_arm::relocate_section): Adjust view.
8050 (Target_arm::relocate_stub): New method definition.
8052 2009-11-10 Doug Kwan <dougkwan@google.com>
8054 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8056 * incremental.cc (open_incremental_binary): Initialized local
8057 variables to avoid warnings.
8058 * object.cc (make_elf_object): Ditto.
8059 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8062 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8065 * testsuite/plugin_test.c: Include "config.h".
8067 2009-11-09 Doug Kwan <dougkwan@google.com>
8069 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8070 (arm_symbol_value): Remove.
8071 (Arm_relocate_functions::arm_branch_common,
8072 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8073 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8074 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8075 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8076 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8077 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8078 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8079 Arm_relocate_functions::thm_mobw_abs_nc,
8080 Arm_relocate_functions::thm_mov_abs,
8081 Arm_relocate_functions::movw_prel_nc,
8082 Arm_relocate_functions::thm_movt_abs,
8083 Arm_relocate_functions::movt_prel,
8084 Arm_relocate_functions::thm_movw_prel_nc,
8085 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8086 (Target_arm::Relocate::relocate): Only decompose address into two
8087 parts if relocation type uses the thumb-bit and pass the actual
8088 bit instead of a flag indicating that the thumb-bit is used. Adjust
8089 calls to methods in Arm_relocate_functions for this change.
8091 2009-11-08 Ian Lance Taylor <iant@google.com>
8094 * reloc.cc: Instantiate
8095 Sized_relobj::initialize_input_to_output_maps and
8096 Sized_relobj:free_input_to_output_maps.
8098 2009-11-06 Ian Lance Taylor <iant@google.com>
8101 * defstd.cc (in_segment): Set only_if_ref true for "end".
8103 2009-11-06 Doug Kwan <dougkwan@google.com>
8105 * arm.cc (class Reloc_stub): Correct a comment.
8106 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8107 (Target_arm::scan_section_for_stubs): New method declaration.
8108 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8109 Change methods from private to protected.
8110 (Target_arm::do_may_relax): New method definition.
8111 (Target_arm::do_relax, Target_arm::group_sections,
8112 Target_arm::scan_reloc_for_stub,
8113 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8114 (Target_arm::arm_input_section_map_): New data member declaration.
8115 (Target_arm::scan_reloc_for_stub,
8116 Target_arm::scan_reloc_section_for_stubs,
8117 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8118 Target_arm::do_relax): New method definitions.
8120 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8122 * configure.ac: Check for (struct stat)::st_mtim
8123 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8124 * config.in: Regenerate.
8125 * configure: Regenerate.
8127 2009-11-05 Ian Lance Taylor <iant@google.com>
8130 * output.cc (Output_segment::add_output_section): Add missing
8133 2009-11-04 Ian Lance Taylor <iant@google.com>
8136 * object.h (class Object): Add is_needed and set_is_needed
8137 methods. Add is_needed_ field. Make bool fields into bitfields.
8138 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8139 defined in a dynamic object and referenced by a regular object,
8140 set is_needed for the dynamic object.
8141 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8142 if the file is marked with as_needed and it is not needed.
8144 2009-11-04 Ian Lance Taylor <iant@google.com>
8147 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8148 tags if data is discarded by linker script.
8149 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8150 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8151 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8152 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8154 2009-11-04 Ian Lance Taylor <iant@google.com>
8156 * layout.cc (Layout::get_output_section): Add is_interp and
8157 is_dynamic_linker_section parameters. Change all callers.
8158 (Layout::choose_output_section): Likewise.
8159 (Layout::make_output_section): Likewise.
8160 (Layout::add_output_section_data): Add is_dynamic_linker_section
8161 parameter. Change all callers.
8162 * layout.h (class Layout): Update declarations.
8163 * output.h (class Output_section): Add is_interp, set_is_interp,
8164 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8165 Add is_interp_, is_dynamic_linker_section_ fields. Change
8166 generate_code_fills_at_write_ to a bitfield.
8167 * output.cc (Output_section::Output_sections): Initialize new
8169 (Output_segment::add_output_section): Add do_sort parameter.
8172 2009-11-03 Ian Lance Taylor <iant@google.com>
8175 * options.h (class General_options): Add --warn-common.
8176 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8177 merging two common symbols.
8178 (Symbol_table::should_override): Handle --warn-common when merging
8179 a common symbol with a defined symbol. Use report_resolve_problem
8180 for multiple definitions.
8181 (Symbol_table::report_resolve_problem): New function.
8182 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8184 2009-11-03 Doug Kwan <dougkwan@google.com>
8186 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8188 (Target_arm::stub_factory): New method definition.
8189 (Target_arm::new_arm_input_section,
8190 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8191 Target_arm::reloc_uses_thumb_bit): New method declarations.
8192 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8193 New type definitions.
8194 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8195 member declarations.
8196 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8197 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8198 New method definitions.
8200 2009-11-03 Ian Lance Taylor <iant@google.com>
8202 * options.h (class General_options): Add --warn_constructors.
8204 2009-11-03 Ian Lance Taylor <iant@google.com>
8207 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8208 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8210 2009-11-03 Ian Lance Taylor <iant@google.com>
8213 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8214 --msgid-bugs-address.
8215 (install-pdf): New target.
8216 (install-data_yes): Look up one directory to find mkinstalldirs.
8218 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8220 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8223 2009-10-30 Doug Kwan <dougkwan@google.com>
8225 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8227 2009-10-30 Doug Kwan <dougkwan@google.com>
8229 * arm.cc (Stub_addend_reader): New struct template definition
8230 and partial specializations.
8231 (Stub_addend_reader::operator()): New method definition for a
8232 partially specialized template.
8234 2009-10-30 Doug Kwan <dougkwan@google.com>
8236 * arm.cc (Arm_relobj::processor_specific_flags): New method
8238 (Arm_relobj::do_read_symbols): New method declaration.
8239 (Arm_relobj::processor_specific_flags_): New data member declaration.
8240 (Arm_dynobj): New class definition.
8241 (Target_arm::do_finalize_sections): Add input_objects parameter.
8242 (Target_arm::do_adjust_elf_header): New method declaration.
8243 (Target_arm::are_eabi_versions_compatible,
8244 (Target_arm::merge_processor_specific_flags): New method declaration.
8245 (Target_arm::do_make_elf_object): New overloaded method definitions
8247 (Arm_relobj::do_read_symbols): New method definition.
8248 (Arm_dynobj::do_read_symbols): Ditto.
8249 (Target_arm::do_finalize_sections): Add input_objects parameters.
8250 Merge processor-specific flags from all input objects.
8251 (Target_arm::are_eabi_versions_compatible,
8252 Target_arm::merge_processor_specific_flags,
8253 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8254 New method definitions.
8255 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8256 Input_objects pointer type parameter.
8257 * layout.cc (Layout::finalize): Pass input objects to target's.
8258 finalize_sections function.
8259 * output.cc (Output_file_header::do_sized_write): Set ELF file
8260 header's processor-specific flags.
8261 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8262 Input_objects pointer type parameter.
8263 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8264 * target.h (Input_objects): New forward class declaration.
8265 (Target::processor_specific_flags,
8266 Target::are_processor_specific_flags_sect): New method definitions.
8267 (Target::finalize_sections): Add input_objects parameter.
8268 (Target::Target): Initialize processor_specific_flags_ and
8269 are_processor_specific_flags_set_.
8270 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8272 (Target::set_processor_specific_flags): New method definition.
8273 (Target::processor_specific_flags_,
8274 Target::are_processor_specific_flags_set_): New data member
8276 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8277 Input_objects pointer type parameter.
8279 2009-10-30 Doug Kwan <dougkwan@google.com>
8281 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8283 2009-10-28 Ian Lance Taylor <iant@google.com>
8285 * object.h (class Relobj): Drop options parameter from
8286 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8287 do_scan_relocs, do_relocate. Change all callers.
8288 (class Sized_relobj): Drop options parameters from
8289 do_gc_process_relocs, do_scan_relocs, do_relocate,
8290 do_relocate_sections, relocate_sections, emit_relocs_scan,
8291 emit_relocs_scan_reltype. Change all callers.
8292 (struct Relocate_info): Remove options field and all references to
8294 * reloc.h (class Read_relocs): Remove options constructor
8295 parameter and options_ field. Change all callers.
8296 (class Gc_process_relocs, class Scan_relocs): Likewise.
8297 (class Relocate_task): Likewise.
8298 * target-reloc.h (scan_relocs): Remove options parameter. Change
8300 (scan_relocatable_relocs): Likewise.
8301 * target.h (class Sized_target): Remove options parameter from
8302 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8304 * gc.h (gc_process_relocs): Remove options parameter. Change all
8306 * arm.cc: Update functions to remove options parameters.
8307 * i386.cc: Likewise.
8308 * powerpc.cc: Likewise.
8309 * sparc.cc: Likewise.
8310 * x86_64.cc: Likewise.
8311 * testsuite/testfile.cc: Likewise.
8313 2009-10-28 Doug Kwan <dougkwan@google.com>
8315 * arm.cc (Arm_relobj): New class definition.
8316 (Arm_relobj::scan_sections_for_stubs,
8317 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8318 New method definitions.
8320 2009-10-28 Cary Coutant <ccoutant@google.com>
8322 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8323 (Plugin::cleanup_done_): New member.
8324 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8325 (Plugin_manager::cleanup_done_): Remove.
8326 (Plugin_manager::add_input_file): Edit error message.
8327 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8328 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8330 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8332 * fileread.cc: (File_read::View::~View): Use the new
8333 data_ownership_ filed.
8334 (File_read::~File_read): Dispose the new whole_file_view_.
8335 (File_read::open): Mmap the whole file if needed.
8336 (File_read::open): Use whole_file_view_ instead of contents_.
8337 (File_read::find_view): Use whole_file_view_ if applicable.
8338 (File_read::do_read): Use whole_file_view_ instead of contents_.
8339 (File_read::make_view): Use whole_file_view_ instead of contents_,
8340 update File_read::View::View call.
8341 (File_read::find_or_make_view): Update File_read::View::View
8343 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8345 (File_read::View::Data_ownership): New enum.
8346 (File_read::View::View): Replace bool mapped_ with Data_ownership
8348 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8349 (File_read::View::data_ownership_): New field.
8350 (File_read::contents_): Remove (replaced by whole_file_view_).
8351 (File_read::whole_file_view_): New field.
8352 * options.h (class General_options): Add --keep-files-mapped.
8354 2009-10-27 Cary Coutant <ccoutant@google.com>
8356 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8357 * testsuite/Makefile.am (plugin_test_5): New test case.
8358 * testsuite/Makefile.in: Regenerate.
8360 2009-10-25 Doug Kwan <dougkwan@google.com>
8362 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8363 from private to protected to allow access by child class.
8364 (Sized_relobj::do_relocate_sections): New method declaration.
8365 (Sized_relobj::relocate_sections): Virtualize.
8366 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8367 Sized_relobj::relocate_sections. Instantiate template explicitly
8368 for different target sizes and endianity.
8370 2009-10-24 Doug Kwan <dougkwan@google.com>
8372 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8373 (Arm_input_section::as_arm_input_section): New method.
8374 (Arm_output_section): New class definition.
8375 (Arm_output_section::create_stub_group,
8376 Arm_output_section::group_sections): New method definitions.
8378 2009-10-22 Doug Kwan <dougkwan@google.com>
8380 * arm.cc (Arm_input_section): New class definition.
8381 (Arm_input_section::init, Arm_input_section:do_write,
8382 Arm_input_section::set_final_data_size,
8383 Arm_input_section::do_reset_address_and_file_offset): New method
8386 2009-10-21 Doug Kwan <dougkwan@google.com>
8388 * arm.cc (Stub_table, Arm_input_section): New forward class
8390 (Stub_table): New class defintion.
8391 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8392 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8393 New method definition.
8395 2009-10-21 Doug Kwan <dougkwan@google.com>
8397 * arm.cc: Update copyright comments.
8398 (Target_arm): New forward class template declaration.
8399 (Arm_address): New type.
8400 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8401 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8402 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8404 (Insn_template): Same.
8405 (DEF_STUBS): New macro.
8406 (Stub_type): New enum type.
8407 (Stub_template): New class definition.
8410 (Stub_factory): Same.
8411 (Target_arm::Target_arm): Initialize may_use_blx_ and
8412 should_force_pic_veneer_.
8413 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8414 Target_arm::should_force_pic_veneer,
8415 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8416 Target_arm::using_thumb_only, Target_arm:;default_target): New
8418 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8419 New data member declarations.
8420 (Insn_template::size, Insn_template::alignment): New method defintions.
8421 (Stub_template::Stub_template): New method definition.
8422 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8423 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8424 (Stub_factory::Stub_factory): New method definition.
8425 * gold.h (string_hash): New template.
8426 * output.h (Input_section_specifier::hash_value): Use
8428 (Input_section_specifier::string_hash): Remove.
8429 * stringpool.cc (Stringpool_template::string_hash): Use
8432 2009-10-20 Doug Kwan <dougkwan@google.com>
8434 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8435 symbols of relaxed input sections.
8436 * output.h (Output_section::find_relaxed_input_section): Make
8439 2009-10-16 Doug Kwan <dougkwan@google.com>
8441 * dynobj.cc (Versions::Versions): Initialize version_script_.
8442 Only insert base version symbol definition for a shared object
8443 if version script defines any version versions.
8444 (Versions::define_base_version): New method definition.
8445 (Versions::add_def): Check that base version is not needed.
8446 (Versions::add_need): Define base version lazily.
8447 * dynobj.h (Versions::define_base_version): New method declaration.
8448 (Versions::needs_base_version_): New data member declaration.
8449 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8450 (check_DATA): Add no_version_test.stdout.
8451 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8453 * testsuite/Makefile.in: Regenerate.
8454 * testsuite/no_version_test.c: New file.
8455 * testsuite/no_version_test.sh: Ditto.
8457 2009-10-16 Doug Kwan <dougkwan@google.com>
8459 * expression.cc (class Segment_start_expression): New class definition.
8460 (Segment_start_expression::value): New method definition.
8461 (script_exp_function_segment_start): Return a new
8462 Segment_start_expression.
8463 * gold/script-c.h (script_saw_segment_start_expression): New function
8465 * script-sections.cc (Script_sections::Script_sections): Initialize
8466 SAW_SEGMENT_START_EXPRESSION_ to false.
8467 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8468 and -Tbbs options to specify section addresses if given in
8469 command line and no SEGMENT_START expression is seen in a script.
8470 * script-sections.h (Script_sections::saw_segment_start_expression,
8471 Script_sections::set_saw_segment_start_expression): New method
8473 (Script_sections::saw_segment_start_expression_): New data member
8475 * script.cc (script_saw_segment_start_expression): New function.
8476 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8477 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8478 script_test_7.sh and script_test_8.sh.
8479 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8480 script_test_8.stdout.
8481 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8482 (script_test_6, script_test_6.stdout, script_test_7,
8483 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8484 * Makefile.in: Regenerate.
8485 * testsuite/script_test_6.sh: New file.
8486 * testsuite/script_test_6.t: Same.
8487 * testsuite/script_test_7.sh: Same.
8488 * testsuite/script_test_7.t: Same.
8489 * testsuite/script_test_8.sh: Same.
8491 2009-10-16 Doug Kwan <dougkwan@google.com>
8493 * output.cc (Output_segment::set_section_list_address): Cast
8494 expressions to unsigned long long type to avoid format warnings.
8496 2009-10-15 Ian Lance Taylor <iant@google.com>
8498 * script.cc (Script_options::add_symbol_assignment): Always add a
8499 dot assignment to script_sections_.
8500 * script-sections.cc (Script_sections::add_dot_assignment):
8501 Initialize if necessary.
8503 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8504 program headers with no load segment if there is a linker script.
8506 * layout.cc (Layout::set_segment_offsets): Align the file offset
8507 to the segment aligment for -N or -n with no load segment.
8508 * output.cc (Output_segment::add_output_section): Don't crash if
8509 the first section is a TLS section.
8510 (Output_segment::set_section_list_addresses): Print an error
8511 message if the address moves backward in a linker script.
8512 * script-sections.cc
8513 (Output_section_element_input::set_section_addresses): Don't
8514 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8515 (Orphan_output_section::set_section_addresses): Likewise.
8517 2009-10-15 Doug Kwan <dougkwan@google.com>
8519 * layout.cc (Layout::finish_dynamic_section): Generate tags
8520 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8521 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8522 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8524 2009-10-14 Ian Lance Taylor <iant@google.com>
8526 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8528 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8529 data_shdr fields of relinfo.
8530 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8531 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8532 R_386_TLS_LDO_32, adjust based on section flags.
8533 (Target_i386::Relocate::fix_up_ldo): Remove.
8535 2009-10-13 Ian Lance Taylor <iant@google.com>
8537 Add support for -pie.
8538 * options.h (class General_options): Add -pie and
8540 (General_options::output_is_position_independent): Test -pie.
8541 (General_options::output_is_executable): Return true if not shared
8542 and not relocatable.
8543 (General_options::output_is_pie): Remove.
8544 * options.cc (General_options::finalize): Reject incompatible uses
8546 * gold.cc (queue_middle_tasks): A -pie link is not static.
8547 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8548 * symtab.cc (Symbol::final_value_is_known): Return false if
8549 output_is_position_independent.
8550 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8551 output_is_position_independent.
8552 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8553 output_is_position_independent.
8554 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8555 output_is_position_independent.
8556 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8558 (basic_pie_test.o, basic_pie_test): New targets.
8559 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8560 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8561 (two_file_pie_test): New target.
8562 * testsuite/Makefile.in: Rebuild.
8563 * README: Remove note saying that -pie is not supported.
8565 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8567 * options.h (class General_options): Add -init and -fini.
8568 * layout.cc (Layout::finish_dynamic_section): Emit
8569 given init and fini functions.
8571 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8573 * gc.h (gc_process_relocs): Check if icf is enabled using new
8575 * gold.cc (queue_initial_tasks): Likewise.
8576 (queue_middle_tasks): Likewise.
8577 * object.cc (do_layout): Likewise.
8578 * symtab.cc (is_section_folded): Likewise.
8579 * main.cc (main): Likewise.
8580 * reloc.cc (Read_relocs::run): Likewise.
8581 (Sized_relobj::do_scan_relocs): Likewise.
8582 * icf.cc (is_function_ctor_or_dtor): New function.
8583 (Icf::find_identical_sections): Check if function is ctor or dtor when
8585 * options.h (General_options::icf): Change option to be an enum.
8586 (Icf_status): New enum.
8587 (icf_enabled): New method.
8588 (icf_safe_folding): New method.
8589 (set_icf_status): New method.
8590 (icf_status_): New variable.
8591 * (options.cc) (General_options::finalize): Set icf_status_.
8592 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8593 icf_test and icf_keep_unique_test to use the --icf enum flag.
8594 * testsuite/icf_safe_test.sh: New file.
8595 * testsuite/icf_safe_test.cc: New file.
8597 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8599 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8600 includes to gc.h and icf.h.
8601 * arm.cc: Include gc.h.
8602 * gold.cc: Likewise.
8603 * i386.cc: Likewise.
8604 * powerpc.cc: Likewise.
8605 * sparc.cc: Likewise.
8606 * x86_64.cc: Likewise.
8607 * gc.h: Include icf.h.
8609 2009-10-11 Ian Lance Taylor <iant@google.com>
8611 * plugin.cc: Include "gold.h" before other header files.
8613 2009-10-10 Chris Demetriou <cgd@google.com>
8615 * options.h (Input_file_argument::Input_file_type): New enum.
8616 (Input_file_argument::is_lib_): Replace with...
8617 (Input_file_argument::type_): New member.
8618 (Input_file_argument::Input_file_argument): Take Input_file_type
8619 'type' rather than boolean 'is_lib' as second argument.
8620 (Input_file_argument::is_lib): Use type_.
8621 (Input_file_argument::is_searched_file): New function.
8622 (Input_file_argument::may_need_search): Handle is_searched_file.
8623 * options.cc (General_options::parse_library): Support -l:filename.
8624 (General_options::parse_just_symbols): Update for Input_file_argument
8626 (Command_line::process): Likewise.
8627 * archive.cc (Archive::get_file_and_offset): Likewise.
8628 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8629 * script.cc (read_script_file, script_add_file): Likewise.
8630 * fileread.cc (Input_file::Input_file): Likewise.
8631 (Input_file::will_search_for): Handle is_searched_file.
8632 (Input_file::open): Likewise.
8633 * readsyms.cc (Read_symbols::get_name): Likewise.
8634 * testsuite/Makefile.am (searched_file_test): New test.
8635 * testsuite/Makefile.in: Regenerate.
8636 * testsuite/searched_file_test.cc: New file.
8637 * testsuite/searched_file_test_lib.cc: New file.
8639 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8640 Ian Lance Taylor <iant@google.com>
8642 * descriptor.cc: Include <cstdio> and "binary-io.h".
8643 (Descriptors::open): Open the files in binary mode always.
8644 * script.cc (Lex::get_token): Treat \r as whitespace.
8646 2009-10-09 Ian Lance Taylor <iant@google.com>
8648 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8650 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8651 Ian Lance Taylor <iant@google.com>
8653 * configure.ac: Check for readv function also.
8654 * fileread.cc (readv): Define if not HAVE_READV.
8655 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8657 * config.in: Regenerate.
8658 * configure: Regenerate.
8660 2009-10-09 Doug Kwan <dougkwan@google.com>
8662 * layout.cc (Layout::make_output_section): Call target hook to make
8663 ordinary output section.
8664 (Layout::finalize): Adjust parameter list of call the
8665 Target::may_relax().
8666 * layout.h (class Layout::section_list): New method.
8667 * merge.h (Output_merge_base::entsize): Change visibility to public.
8668 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8670 (Output_merge_string::do_is_string): New method.
8671 * object.cc (Sized_relobj::do_setup): renamed from
8672 Sized_relobj::set_up.
8673 * object.h (Sized_relobj::adjust_shndx,
8674 Sized_relobj::initializ_input_to_output_maps,
8675 Sized_relobj::free_input_to_output_maps): Change visibilities to
8677 (Sized_relobj::setup): Virtualize.
8678 (Sized_relobj::do_setup): New method declaration.
8679 (Sized_relobj::invalidate_section_offset,
8680 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8681 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8682 * options.cc (parse_int): New function.
8683 * options.h (parse_int): New declaration.
8684 (DEFINE_int): New macro.
8685 (stub_group_size): New option.
8686 * output.cc (Output_section::Output_section): Initialize memebers
8687 merge_section_map_, merge_section_by_properties_map_,
8688 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8689 (Output_section::add_input_section): Handled deferred code-fill
8690 generation and remove an old comment.
8691 (Output_section::add_relaxed_input_section): New method definition.
8692 (Output_section::add_merge_input_section): Use merge section by
8693 properties map to speed to search. Update merge section maps
8695 (Output_section::build_relaxation_map): New method definition.
8696 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8698 (Output_section::relax_input_section): Renamed to
8699 Output_section::convert_input_sections_to_relaxed_sections and change
8700 interface to take a vector of pointers to relaxed sections.
8701 (Output_section::find_merge_section,
8702 Output_section::find_relaxed_input_section): New method definitions.
8703 (Output_section::is_input_address_mapped,
8704 Output_section::output_offset, Output_section::output_address):
8705 Use output section data maps to speed up searching.
8706 (Output_section::find_starting_output_address): Add comments.
8707 (Output_section::do_write,
8708 Output_section::write_to_postprocessing_buffer): Do code-fill
8709 generation as appropriate.
8710 (Output_section::get_input_sections): Invalidate relaxed input section
8712 (Output_section::restore_states): Adjust type of checkpoint .
8713 Invalidate relaxed input section map.
8714 * output.h (Output_merge_base): New class declaration.
8715 (Input_section_specifier): New class defintion.
8716 (class Output_relaxed_input_section) Change base class to
8717 Output_section_data_build.
8718 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8719 base class initializer.
8720 (Output_section::add_relaxed_input_section): New method declaration.
8721 (Output_section::Input_section): Change visibility to protected.
8722 (Output_section::Input_section::relobj,
8723 Output_section::Input_section::shndx): Handle relaxed input sections.
8724 Output_section::input_sections) Change visibility to protected. Also
8725 define overload to return a non-const pointer.
8726 (Output_section::Merge_section_properties): New class defintion.
8727 (Output_section::Merge_section_by_properties_map,
8728 Output_section::Output_section_data_by_input_section_map,
8729 Output_section::Relaxation_map): New types.
8730 (Output_section::relax_input_section): Rename method to
8731 Output_section::convert_input_sections_to_relaxed_sections and change
8732 interface to take a vector of relaxed section pointers.
8733 (Output_section::find_merge_section,
8734 Output_section::find_relaxed_input_section,
8735 Output_section::build_relaxation_map,
8736 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8737 New method declarations.
8738 (Output_section::merge_section_map_
8739 Output_section::merge_section_by_properties_map_,
8740 Output_section::relaxed_input_section_map_,
8741 Output_section::is_relaxed_input_section_map_valid_,
8742 Output_section::generate_code_fills_at_write_): New data members.
8743 * script-sections.cc
8744 (Output_section_element_input::set_section_addresses): Call
8745 current_data_size and addralign methods of relaxed input sections.
8746 (Orphan_output_section::set_section_addresses): Call current_data_size
8747 and addralign methods of relaxed input sections.
8748 * symtab.cc (Symbol_table::compute_final_value): Extract template
8749 from the body of Symbol_table::sized_finalize_symbol.
8750 (Symbol_table::sized_finalized_symbol): Call
8751 Symbol_table::compute_final_value.
8752 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8753 (Symbol_table::compute_final_value): New templated method declaration.
8754 * target.cc (Target::do_make_output_section): New method defintion.
8755 * target.h (Target::make_output_section): New method declaration.
8756 (Target::relax): Add more parameters for input objects, symbol table
8757 and layout. Adjust call to do_relax.
8758 (Target::do_make_output_section): New method declaration.
8759 (Target::do_relax): Add parameters for input objects, symbol table
8762 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8764 * pread.c: Include stdio.h.
8766 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8768 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8771 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8773 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8774 Change read_shndx type to unsigned int.
8775 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8777 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8778 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8779 Change read_shndx type to unsigned int.
8780 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8782 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8783 * layout.cc (Layout::create_symtab_sections): Cast the result of
8784 local_symcount * symsize to off_t in the gold_assert.
8786 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8788 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8789 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8791 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8792 (Arm_relocate_functions::thm_abs5): New function.
8793 (Arm_relocate_functions::abs12): New function.
8794 (Arm_relocate_functions::abs16): New function.
8795 (Arm_relocate_functions::base_abs): New function.
8796 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8797 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8798 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8800 (Scan::global): Likewise.
8801 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8802 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8803 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8804 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8807 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8809 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8810 (Arm_relocate_functions::movt_prel): New function.
8811 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8812 (Arm_relocate_functions::thm_movt_prel): New function.
8813 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8814 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8815 (Scan::global, Relocate::relocate): Likewise.
8816 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8818 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8820 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8821 Incremental_checker.
8822 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8824 (class Incremental_inputs_header): New class.
8825 (Incremental_inputs_header_writer): Edit comment.
8826 (Incremental_inputs_entry): New class.
8827 (Incremental_inputs_entry_writer): Edit comment.
8828 (Sized_incremental_binary::do_find_incremental_inputs_section):
8829 Add *strtab_shndx parameter, fill it.
8830 (Sized_incremental_binary::do_check_inputs): New method.
8831 (Incremental_checker::can_incrementally_link_output_file): Use
8832 Sized_incremental_binary::check_inputs.
8833 (Incremental_inputs::report_command_line): Save command line in
8836 (Incremental_binary::find_incremental_inputs_section): New
8838 (Incremental_binary::do_find_incremental_inputs_section): Add
8839 strtab_shndx parameter.
8840 (Incremental_binary::do_check_inputs): New pure virtual method.
8841 (Sized_incremental_binary::do_check_inputs): Declare.
8842 (Incremental_checker::Incremental_checker): Add incremental_inputs
8843 parameter, use it to initialize incremental_inputs_.
8844 (Incremental_checker::incremental_inputs_): New field.
8845 (Incremental_checker::command_line): New method.
8846 (Incremental_checker::inputs): New method.
8847 (Incremental_checker::command_line_): New field.
8849 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8851 * incremental.cc: Include <cstdarg> and "target-select.h".
8852 (vexplain_no_incremental): New function.
8853 (explain_no_incremental): New function.
8854 (Incremental_binary::error): New method.
8855 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8857 (make_sized_incremental_binary): New function.
8858 (open_incremental_binary): New function.
8859 (can_incrementally_link_file): Add checks if output is ELF and has
8861 * incremental.h: Include "elfcpp_file.h" and "output.h".
8862 (Incremental_binary): New class.
8863 (Sized_incremental_binary): New class.
8864 (open_incremental_binary): Declare.
8865 * object.cc (is_elf_object): Use
8866 elfcpp::Elf_recognizer::is_elf_file.
8867 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8868 * output.h (Output_file::filesize): New method.
8870 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8872 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8874 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8875 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8877 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8879 (Arm_relocate_functions::movw_abs_nc): New function.
8880 (Arm_relocate_functions::movt_abs): New function.
8881 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8882 (Arm_relocate_functions::thm_movt_abs): New function.
8883 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8884 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8885 (Scan::global): Likewise.
8886 (Relocate::relocate): Likewise.
8887 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8889 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8891 * arm.cc (Arm_relocate_functions::got_prel) New function.
8892 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8893 (Relocate::relocate): Likewise.
8894 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8896 2009-10-06 Ian Lance Taylor <iant@google.com>
8898 * options.h (class General_options): Define
8899 split_stack_adjust_size parameter.
8900 * object.h (class Object): Add uses_split_stack_ and
8901 has_no_split_stack_ fields. Add uses_split_stack and
8902 has_no_split_stack accessor functions. Declare
8903 handle_split_stack_section.
8904 (class Reloc_symbol_changes): Define.
8905 (class Sized_relobj): Define Function_offsets. Declare
8906 split_stack_adjust, split_stack_adjust_reltype, and
8908 * object.cc (Object::handle_split_stack_section): New function.
8909 (Sized_relobj::do_layout): Call handle_split_stack_section.
8910 * dynobj.cc (Sized_dynobj::do_layout): Call
8911 handle_split_stack_section.
8912 * reloc.cc (Sized_relobj::relocate_sections): Call
8913 split_stack_adjust for executable sections in split_stack
8914 objects. Pass reloc_map to relocate_section.
8915 (Sized_relobj::split_stack_adjust): New function.
8916 (Sized_relobj::split_stack_adjust_reltype): New function.
8917 (Sized_relobj::find_functions): New function.
8918 * target-reloc.h: Include "object.h".
8919 (relocate_section): Add reloc_symbol_changes parameter. Change
8921 * target.h (class Target): Add calls_non_split method. Declare
8922 do_calls_non_split virtual method. Declare match_view and
8924 * target.cc: Include "elfcpp.h".
8925 (Target::do_calls_non_split): New function.
8926 (Target::match_view): New function.
8927 (Target::set_view_to_nop): New function.
8928 * gold.cc (queue_middle_tasks): Give an error if mixing
8929 split-stack and non-split-stack objects with -r.
8930 * i386.cc (Target_i386::relocate_section): Add
8931 reloc_symbol_changes parameter.
8932 (Target_i386::do_calls_non_split): New function.
8933 * x86_64.cc (Target_x86_64::relocate_section): Add
8934 reloc_symbol_changes parameter.
8935 (Target_x86_64::do_calls_non_split): New function.
8936 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8938 * powerpc.cc (Target_powerpc::relocate_section): Add
8939 reloc_symbol_changes parameter.
8940 * sparc.cc (Target_sparc::relocate_section): Add
8941 reloc_symbol_changes parameter.
8942 * configure.ac: Call AM_CONDITIONAL for the default target.
8943 * configure: Rebuild.
8944 * testsuite/Makefile.am (TEST_AS): New variable.
8945 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8946 (check_DATA): Add split_i386 and split_x86_64 files.
8947 (SPLIT_DEFSYMS): Define.
8948 (split_i386_[1234n].o): New targets.
8949 (split_i386_[124]): New targets.
8950 (split_i386_[1234r].stdout): New targets.
8951 (split_x86_64_[1234n].o): New targets.
8952 (split_x86_64_[124]): New targets.
8953 (split_x86_64_[1234r].stdout): New targets.
8954 (MOSTLYCLEANFILES): Add new executables.
8955 * testsuite/split_i386.sh: New file.
8956 * testsuite/split_x86_64.sh: New file.
8957 * testsuite/split_i386_1.s: New file.
8958 * testsuite/split_i386_2.s: New file.
8959 * testsuite/split_i386_3.s: New file.
8960 * testsuite/split_i386_4.s: New file.
8961 * testsuite/split_i386_n.s: New file.
8962 * testsuite/split_x86_64_1.s: New file.
8963 * testsuite/split_x86_64_2.s: New file.
8964 * testsuite/split_x86_64_3.s: New file.
8965 * testsuite/split_x86_64_4.s: New file.
8966 * testsuite/split_x86_64_n.s: New file.
8967 * testsuite/testfile.cc (Target_test): Update relocation_section
8969 * testsuite/Makefile.in: Rebuild.
8971 2009-10-06 Ian Lance Taylor <iant@google.com>
8973 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8974 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8975 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8976 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8977 the address on ldo_addrs_.
8978 (Target_i386::Relocate::fix_up_ldo): New function.
8980 2009-10-06 Rafael Espindola <espindola@google.com>
8982 * plugin.cc (add_input_library): New.
8983 (Plugin::load): Add add_input_library to tv.
8984 (Plugin_manager::add_input_file): Add the is_lib argument.
8985 (add_input_file): Update call to Plugin_manager::add_input_file.
8986 (add_input_library): New.
8987 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8989 2009-09-30 Doug Kwan <dougkwan@google.com>
8991 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8992 symbol and call Symbol::may_need_copy_reloc to determine if
8993 a copy reloc is needed.
8994 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8995 nocopyreloc is given in command line.
8996 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8997 given in command line.
8998 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8999 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9000 of the removed Target_i386::may_need_copy_reloc.
9001 * options.h (copyreloc): New option with default value false.
9002 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9003 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9004 instead of the removed Target_powerpc::may_need_copy_reloc.
9005 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9006 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9007 instead of the removed Target_sparc::may_need_copy_reloc.
9008 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9009 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9010 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9011 instead of the removed Target_x86_64::may_need_copy_reloc.
9013 2009-09-30 Ian Lance Taylor <iant@google.com>
9015 * object.h (class Object): Remove target_ field, and target,
9016 sized_target, and set_target methods.
9017 (Object::sized_target): Remove.
9018 (class Sized_relobj): Update declarations. Remove sized_target.
9019 * object.cc (Sized_relobj::setup): Remove target parameter.
9021 (Input_objects::add_object): Don't do anything with the target.
9022 (make_elf_sized_object): Add punconfigured parameter. Change all
9023 callers. Set or test parameter target.
9024 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9026 * parameters.cc (Parameters::set_target): Change parameter type to
9028 (Parameters::default_target): Remove.
9029 (set_parameters_target): Change parameter type to be non-const.
9030 (parameters_force_valid_target): New function.
9031 (parameters_clear_target): New function.
9032 * parameters.h (class Parameters): Update declarations. Remove
9033 default_target method. Add sized_target and clear_target
9034 methods. Change target_ to be non-const.
9035 (set_parameters_target): Update declaration.
9036 (parameters_force_valid_target): Declare.
9037 (parameters_clear_target): Declare.
9038 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9039 as NULL if we aren't searching.
9040 (Add_symbols::run): Don't check for compatible target.
9041 * fileread.cc (Input_file::open_binary): Call
9042 parameters_force_valid_target.
9043 * gold.cc (queue_middle_tasks): Likewise.
9044 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9045 set_target on object.
9046 * dynobj.h (class Sized_dynobj): Update declarations.
9047 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9048 make_elf_object returns NULL.
9049 (Archive::include_member): Don't check whether object target is
9051 * output.cc (Output_section::add_input_section): Get target from
9053 (Output_section::relax_input_section): Likewise.
9054 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9056 (Sized_relobj::do_scan_relocs): Likewise.
9057 (Sized_relobj::relocate_sections): Likewise.
9058 * resolve.cc (Symbol_table::resolve): Likewise.
9059 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9060 parameter. Change all callers.
9061 (Symbol_table::add_from_object): Get target from parameters.
9062 (Symbol_table::add_from_relobj): Don't check object target.
9063 (Symbol_table::add_from_dynobj): Likewise.
9064 (Symbol_table::define_special_symbol): Get target from
9066 * symtab.h (class Symbol_table): Update declaration.
9067 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9068 parameter. Change all callers. Clear parameter target.
9069 (Binary_test): Test target here.
9070 * testsuite/object_unittest.cc (gold_testsuite): Remove
9071 target_test_pointer parameter. Change all callers.
9072 (Object_test): Test target here.
9074 2009-09-26 Ian Lance Taylor <iant@google.com>
9076 * testsuite/initpri1.c: Don't try to use constructor priorities if
9077 compiling with gcc before 4.3.
9079 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9081 * testsuite/retain_symbols_file_test.sh (check_present): Change
9082 output file name to retain_symbols_file_test.stdout.
9083 (check_absent): Likewise.
9085 2009-09-18 Craig Silverstein <csilvers@google.com>
9087 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9088 * options.cc: Include <cerrno> and <fstream>.
9089 (General_options::finalize): Parse -retain-symbols-file tag.
9090 * options.h: New flag.
9091 (General_options): New method should_retain_symbol, new
9092 variable symbols_to_retain.
9093 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9094 should_retain_symbol map.
9095 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9096 * testsuite/Makefile.in: Regenerate.
9097 * testsuite/retain_symbols_file_test.sh: New file.
9099 2009-09-18 Nick Clifton <nickc@redhat.com>
9101 * po/es.po: Updated Spanish translation.
9103 2009-09-17 Doug Kwan <dougkwan@google.com>
9105 * debug.h (DEBUG_RELAXATION): New constant.
9106 (DEBUG_ALL): Add DEBUG_RELAXATION.
9107 (debug_string_to_enum): Add relaxation debug option.
9109 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9110 Layout::Relaxation_debug_check::read_sections,
9111 Layout::Relaxation_debug_check::read_sections): New method definitions.
9112 (Layout::Layout): Initialize data members
9113 record_output_section_data_from_scrips_,
9114 script_output_section_data_list_ and relaxation_debug_check_.
9115 (Layout::save_segments, Layout::restore_segments,
9116 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9117 Layout::relaxation_loop_body): New method definitions.
9118 (Layout::finalize): Support relaxation. Move section layout code to
9119 Layout::relaxation_loop_body.
9120 (Layout::set_asection_address_from_script): Move code for orphan
9121 section placement out.
9122 (Layout::place_orphan_sections_in_script): New method definition.
9123 * layout.h (Output_segment_headers, Output_file_header):
9124 New forward class declarations.
9125 (Layout::~Layout): Define.
9126 (Layout::new_output_section_data_from_script): New method definition.
9127 (Layout::place_orphan_sections_in_script): New method declaration.
9128 (Layout::Segment_states): New type declaration.
9129 (Layout::save_segments, Layout::restore_segments,
9130 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9131 Layout::relaxation_loop_body): New method declarations.
9132 (Layout::Output_section_data_list): New type declaration.
9133 (Layout::Relaxation_debug_check): New class definition.
9134 (Layout::record_output_section_data_from_script_,
9135 Layout::script_output_section_data_list_, Layout::segment_states_,
9136 Layout::relaxation_debug_check_): New data members.
9137 * output.cc: (Output_section_headers::do_size): New method definition.
9138 (Output_section_headers::Output_section_headers): Move size
9139 computation to Output_section_headers::do_size.
9140 (Output_segment_headers::do_size): New method definition.
9141 (Output_file_header::Output_file_header): Move size computation to
9142 Output_file_header::do_size and call it.
9143 (Output_file_header::do_size): New method definition.
9144 (Output_data_group::Output_data_group): Adjust call to
9145 Output_section_data.
9146 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9147 (Output_symtab_xindex::do_write): Add array bound check.
9148 (Output_section::Input_section::print_to_mapfile): Handle
9149 RELAXED_INPUT_SECTION_CODE.
9150 (Output_section::Output_section): Initialize data member checkpoint_.
9151 (Output_section::~Output_section): Delete checkpoint object pointed
9153 (Output_section::add_input_section): Always add an Input_section if
9155 (Output_section::add_merge_input_section): Add assert.
9156 (Output_section::relax_input_section): New method definition.
9157 (Output_section::set_final_data_size): Set load address to zero for
9158 an unallocated section.
9159 (Output_section::do_address_and_file_offset_have_reset_values):
9160 New method definition.
9161 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9162 Handle relaxed input section.
9163 (Output_section::sort_attached_input_sections): Checkpoint input
9164 section list lazily.
9165 (Output_section::get_input_sections): Change type of input_sections to
9166 list of Simple_input_section pointers. Checkpoint input section list
9167 lazily. Also handle relaxed input sections.
9168 (Output_section::add_input_section_for_script): Take a reference to
9169 a Simple_input_section object instead of Relobj pointer and section
9170 index as parameter. Handle relaxed input sections.
9171 (Output_section::save_states, Output_section::restore_states): New
9173 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9174 (Output_data::is_data_size_fixed): New method definition.
9175 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9177 (Output_data::address_and_file_offset_have_reset_values): New method
9179 (Output_data::do_address_and_file_offset_have_reset_values): New method
9181 (Output_data::set_data_size): Check that data size is not fixed.
9182 (Output_data::fix_data_size): New method definition.
9183 (Output_data::is_data_size_fixed_): New data member.
9184 (Output_section_headers::set_final_data_size): New method definition.
9185 (Output_section_headers::do_size): New method declaration.
9186 (Output_segment_headers::set_final_data_size): New method definition.
9187 (Output_segment_headers::do_size): New method declaration.
9188 (Output_file_header::set_final_data_size)::New method definition.
9189 (Output_file_header::do_size)::New method declaration.
9190 (Output_section_data::Output_section_data): Add new parameter
9191 is_data_size_fixed and use it to fix data size.
9192 (Output_data_const::Output_data_const): Adjust call to base class
9193 constructor and fix data size.
9194 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9195 base class constructor and fix data size.
9196 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9197 base class constructor and fix data size.
9198 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9199 class constructor and fix data size.
9200 (Output_data_group::set_final_data_size): New method definition.
9201 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9202 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9203 class constructor and fix data size.
9204 (Output_relaxed_input_section): New class definition.
9205 (Output_section::Simple_input_section): New class definition.
9206 (Output_section::get_input_sections): Adjust parameter list.
9207 (Output_section::add_input_section_for_script): Same.
9208 (Output_section::save_states, Output_section::restore_states,
9209 Output_section::do_address_and_file_offset_have_reset_values,
9210 (Output_section::Input_section::Input_section): Handle
9211 RELAXED_INPUT_SECTION_CODE. Add new overload for
9212 Output_relaxed_input_section.
9213 (Output_section::Input_section::is_input_section,
9214 Output_section::Input_section::set_output_section): Handle relaxed
9216 (Output_section::Input_section::is_relaxed_input_section,
9217 Output_section::Input_section::output_section_data,
9218 Output_section::Input_section::relaxed_input_section): New method
9220 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9222 (Output_section::Input_section::u1_): Update comments.
9223 (Output_section::Input_section::u2_): Add new union member poris.
9224 (Output_section::Checkpoint_output_section): New classs definition.
9225 (Output_section::relax_input_section): New method declaration.
9226 (Output_section::checkpoint_): New data member.
9227 (Output_segment): Update comments.
9228 (Output_segment::Output_segment): Un-privatize copy constructor.
9229 (Output_segment::operator=): Un-privatize.
9230 * script-sections.cc (Output_section_element::Input_section_list):
9231 Change element type to Output_section::Simple_input_section.
9232 (Output_section_element_dot_assignment::set_section_addresses):
9233 Register output section data for relaxation clean up.
9234 (Output_data_exression::Output_data_expression): Adjust call to base
9235 constructor to fix data size.
9236 (Output_section_element_data::set_section_addresses): Register
9237 Output_data_expression object for relaxation clean up.
9238 (struct Input_section_info): Replace Relobj pointer and section index
9239 pair with Output_section::Simple_input_section and Convert struct to a
9241 (Input_section_sorter::operator()): Adjust access to
9242 Input_section_info data member to use accessors.
9243 (Output_section_element_input::set_section_addresses): Use layout
9244 parameter. Adjust code to use Output_section::Simple_input_section
9245 and Input_secction_info classes. Register filler for relaxation
9247 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9248 and section index pair with Output_section::Simple_input_section
9249 class. Adjust code accordingly.
9250 (Phdrs_element::release_segment): New method definition.
9251 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9253 (Script_sections::release_segments): New method definition.
9254 * gold/script-sections.h (Script_sections::release_segments): New
9256 * gold/target.h (Target::may_relax, Target::relax,
9257 Target::do_may_relax, Target::do_relax): New method definitions.
9259 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9261 * arm.cc (has_signed_unsigned_overflow): New function.
9262 (Arm_relocate_functions::abs8): New function.
9263 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9264 (Target_arm::Scan::global): Likewise.
9265 (Target_arm::relocate::relocate): Likewise.
9266 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9269 2009-09-16 Cary Coutant <ccoutant@google.com>
9271 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9272 * testsuite/Makefile.in: Regenerate.
9274 2009-09-11 Nick Clifton <nickc@redhat.com>
9276 * po/gold.pot: Updated by the Translation project.
9278 2009-09-08 Cary Coutant <ccoutant@google.com>
9280 * output.cc (Output_file::open): Add execute permission to empty file.
9281 * testsuite/Makefile.am (permission_test): New test.
9282 * testsuite/Makefile.in: Regenerate.
9284 2009-09-02 Ian Lance Taylor <iant@google.com>
9286 * output.cc (Output_file::resize): Call map_no_anonymous rather
9289 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9291 * gold.cc: Include "incremental.h".
9292 (queue_initial_tasks): Call Incremental_checker methods.
9293 * incremental.cc: Include "output.h".
9294 (Incremental_checker::can_incrementally_link_output_file): New
9296 * incremental.h (Incremental_checker): New class.
9298 * output.cc (Output_file::open_for_modification): New method.
9299 (Output_file::map_anonymous): Changed return type to bool. Record
9301 (Output_file::map_no_anonymous): New method, broken out of map.
9302 (Output_file::map): Use map_no_anonymous and map_anonymous.
9303 * output.h (class Output_file): Update declarations.
9305 2009-08-24 Cary Coutant <ccoutant@google.com>
9307 * options.h (Command_line::Pre_options): New class.
9308 (Command_line::pre_options): New member.
9309 * options.cc (gold::options::ready_to_register): New variable.
9310 (One_option::register_option): Do nothing if not registering options.
9311 Assert if same short option registered twice.
9312 (General_options::General_options): Turn off option registration when
9314 (Command_line::Pre_options::Pre_options): New constructor.
9316 2009-08-24 Cary Coutant <ccoutant@google.com>
9318 * options.h (General_options::no_keep_memory): Remove incorrect
9321 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9323 * Makefile.am (am__skiplex, am__skipyacc): New.
9324 * Makefile.in: Regenerate.
9326 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9328 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9329 (INCLUDES): ... this.
9330 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9331 (AM_CPPFLAGS): Renamed from ...
9332 (INCLUDE): ... this.
9333 * Makefile.in, testsuite/Makefile.in: Regenerate.
9335 * Makefile.in: Regenerate.
9336 * aclocal.m4: Likewise.
9337 * config.in: Likewise.
9338 * configure: Likewise.
9339 * testsuite/Makefile.in: Likewise.
9341 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9342 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9343 * Makefile.in: Regenerate.
9344 * testsuite/Makefile.in: Regenerate.
9346 2009-08-19 Cary Coutant <ccoutant@google.com>
9348 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9349 symbols in shared libraries overridden by hidden or internal symbols
9350 in the main program.
9352 2009-08-19 Chris Demetriou <cgd@google.com>
9354 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9355 checking source file names in error messages.
9357 2009-08-18 Doug Kwan <dougkwan@google.com>
9359 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9360 an elcpp::Ehdr as parameter. Adjust call to set_target.
9361 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9362 an elfcpp::Ehdr as parameter.
9363 * object.cc (Object::set_target): Remove the version that looks up
9364 a target and sets it.
9365 (Sized_relobj::setup): Take a Target object instead of
9366 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9367 (make_elf_sized_object): Find target and ask target to
9369 * object.h: (Object::set_target): Remove the version that looks up
9370 a target and sets it.
9371 (Sized_relobj::setup): Take a Target object instead of
9372 an elfcpp:Ehdr as parameter.
9373 * target.cc: Include dynobj.h.
9374 (Target::do_make_elf_object_implementation): New.
9375 (Target::do_make_elf_object): New.
9376 * target.h (Target::make_elf_object): New template declaration.
9377 (Target::do_make_elf_object): New method declarations.
9378 (Target::do_make_elf_object_implementation): New template declaration.
9380 2009-08-14 Ian Lance Taylor <iant@google.com>
9382 * gold.h (FUNCTION_NAME): Define.
9383 (gold_unreachable): Use FUNCTION_NAME.
9385 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9387 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9388 symbol in the --keep-unique list is not found.
9390 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9392 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9393 been maked as --keep-unique.
9394 (Icf::unfold_section): New function.
9395 * icf.h (Icf::unfold_section): New function.
9396 * options.h (General_options::keep_unique): New option.
9397 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9398 * testsuite/Makefile.in: Regenerate.
9399 * testsuite/icf_keep_unique_test.sh: New file.
9400 * testsuite/icf_keep_unique_test.cc: New file.
9402 2009-08-12 Cary Coutant <ccoutant@google.com>
9405 * resolve.cc (Symbol_table::resolve): Check for references from
9406 dynamic objects to hidden and internal symbols.
9407 * testsuite/Makefile.am (hidden_test.sh): New test.
9408 * testsuite/Makefile.in: Regenerate.
9409 * testsuite/hidden_test.sh: New script.
9410 * testsuite/hidden_test_1.c: New test source.
9411 * testsuite/hidden_test_main.c: New test source.
9413 2009-08-11 Doug Kwan <dougkwan@google.com>
9415 * arm.cc: Update comments.
9416 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9417 segment to locate the .ARM.exidx section if present.
9419 2009-08-09 Doug Kwan <dougkwan@google.com>
9421 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9424 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9425 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9428 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9430 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9431 valid tls_segment only for non-debug-section relocations.
9432 * testsuite/Makefile.am: Add gc_tls_test.
9433 * testsuite/Makefile.in: Regenerate.
9434 * testsuite/gc_tls_test.cc: New file.
9435 * testsuite/gc_tls_test.sh: New file.
9437 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9441 * Makefile.am (CCFILES): Add icf.cc.
9443 * Makefile.in: Regenerate.
9444 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9445 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9446 section, symbol and addend information for the relocs.
9447 * gold.cc (queue_middle_tasks): Call identical code folding.
9448 * gold.h: Add defines for multimap.
9449 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9450 to the call of finalize_local_symbols.
9451 * main.cc (main): Create object of class Icf.
9452 * object.cc (Sized_relobj::do_layout): Allow this function to be
9453 called twice during icf.
9454 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9455 to sections marked as identical by icf.
9456 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9458 (Sized_relobj::do_section_entsize): New function.
9459 * object.h (Object::section_entsize): New function.
9460 (Object::do_section_entsize): New pure virtual function.
9461 (Relobj::finalize_local_symbols): Add new parameter.
9462 (Relobj::do_section_entsize): New function.
9463 * options.h (General_options::icf): New option.
9464 (General_options::icf_iterations): New option.
9465 (General_options::print_icf_sections): New option.
9466 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9467 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9468 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9470 * symtab.cc (Symbol_table::is_section_folded): New function.
9471 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9472 to sections marked as identical by icf.
9473 * symtab.h (Symbol_table::set_icf): New function.
9474 (Symbol_table::icf): New function.
9475 (Symbol_table::is_section_folded): New function.
9476 (Symbol_table::icf_): New data member.
9477 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9478 * testsuite/Makefile.am: Add commands to build icf_test.
9479 * testsuite/Makefile.in: Regenerate.
9480 * testsuite/icf_test.sh: New file.
9481 * testsuite/icf_test.cc: New file.
9483 2009-07-24 Chris Demetriou <cgd@google.com>
9485 * layout.cc (is_compressible_debug_section): Fix incorrect
9486 comment about compressed section names.
9488 2009-07-20 Ian Lance Taylor <ian@airs.com>
9491 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9493 2009-07-16 Ian Lance Taylor <iant@google.com>
9496 * layout.h: #include <map>.
9497 (class Kept_section): Change from struct to class. Add accessors
9498 and setters. Add section size to Comdat_group mapping. Change
9499 Comdat_group to std::map. Add is_comdat_ field. Add
9500 linkonce_size field in union.
9501 (class Layout): Update declaration of find_or_add_kept_section.
9502 Don't declare find_kept_object.
9503 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9504 parameter. Add object, shndx, is_comdat, and is_group_name
9505 parameters. Change all callers. Adjust for new Kept_section.
9506 (Layout::find_kept_object): Remove.
9507 * object.cc (Sized_relobj::include_section_group): Update use of
9508 Kept_section. Rename secnum to shndx. Only record
9509 Kept_comdat_section if sections are the same size.
9510 (Sized_relobj::include_linkonce_section): Update use of
9511 Kept_section. Only record Kept_comdat_section if sections are the
9512 same size. Set size of linkonce section.
9513 (Sized_relobj::map_to_kept_section): Update call to
9514 get_kept_comdat_section.
9515 * object.h (class Sized_relobj): Rename fields in
9516 Kept_comdat_section to drop trailing underscores; change object
9517 field to Relobj*. Change Kept_comdat_section_table to store
9518 struct rather than pointer.
9519 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9520 Add kept_object and kept_shndx parameters. Change all callers.
9521 (Sized_relobj::get_kept_comdat_section): Change return type to
9522 bool. Add kept_object and kept_shndx parameters. Change all
9524 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9525 Layout::find_or_add_kept_section.
9527 2009-07-09 Ian Lance Taylor <iant@google.com>
9529 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9530 Reserve space in the hash table.
9532 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9534 * fileread.cc (File_read::get_mtime): New method.
9535 * fileread.h (Timespec): New structure.
9536 (File_read::get_mtime): New method.
9537 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9538 Renamed from timestamp_nsec.
9539 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9541 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9543 (Incremental_inputs::report_archive): Save mtime; style fix.
9544 (Incremental_inputs::report_obejct): Save mtime; style fix.
9545 (Incremental_inputs::report_script): Save mtime; style fix.
9546 (Incremental_inputs::finalize_inputs): Style fix.
9547 (Incremental_inputs::finalize): Style fix.
9548 (Incremental_inputs::create_input_section_data): Store inputs
9550 * incremental.h (Incremental_inputs::report_script): Add mtime
9552 (Incremental_inputs::Input_info::Input_info): Intialize only one
9554 (Incremental_inputs::Input_info::archive): Move to nameless
9556 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9557 (Incremental_inputs::Input_info::script): Move to nameless union.
9558 (Incremental_inputs::mtime): New field.
9559 * script.cc (read_input_script): Pass file mtime to
9561 * script.h (Script_info::inputs): Style fix.
9563 2009-07-01 Ian Lance Taylor <ian@airs.com>
9565 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9568 2009-06-24 Ian Lance Taylor <iant@google.com>
9571 * layout.cc (Layout::choose_output_section): If we find an
9572 existing section, update the flags.
9573 (Layout::create_notes): New function, broken out of
9575 (Layout::finalize): Don't create note sections.
9576 (Layout::create_note): Don't crash if linker script discards
9578 (Layout::create_gold_note): Likewise.
9579 (Layout::create_build_id): Likewise. Don't set
9580 after_input_sections on the section.
9581 (Layout::create_executable_stack_info): Remove target parameter.
9583 * layout.h (class Layout): Declare create_notes. Update
9584 declaration of create_executable_stack_info.
9585 * gold.cc (queue_middle_tasks): Call create_notes.
9586 * output.cc (Output_section::update_flags_for_input_section): Move
9587 here from output.h. If SHF_ALLOC flag is newly set, mark address
9589 * output.h (Output_data::mark_address_invalid): New function.
9590 (class Output_section): Only declare, not define,
9591 update_flags_for_input_section. Remove set_flags.
9593 2009-06-24 Ian Lance Taylor <iant@google.com>
9595 * script-sections.cc (Output_section_definition::
9596 set_section_addresses): Rename shadowing local load_address to
9599 2009-06-24 Ian Lance Taylor <iant@google.com>
9602 * reloc.cc (relocate_sections): Skip empty relocation sections.
9604 2009-06-23 Ian Lance Taylor <iant@google.com>
9607 * layout.cc (Layout::create_note): Use choose_output_section
9608 rather than make_output_section.
9610 2009-06-23 Ian Lance Taylor <iant@google.com>
9613 * options.cc (General_options::parse_V): Set printed_version_.
9614 (General_options::General_options): Initialize printed_version_.
9615 * options.h (class General_options): Add printed_version_ field.
9616 * gold.cc (queue_initial_tasks): If there are no input files,
9617 don't give a fatal error if we printed the version information.
9618 (queue_middle_tasks): If using -r with a shared object, give a
9619 fatal error rather than an ordinary error.
9621 2009-06-23 Ian Lance Taylor <iant@google.com>
9624 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9625 (Layout::make_output_section): Set have_stabstr_section_ if we see
9626 a .stab*str section.
9627 (Layout::finalize): Call link_stabs_sections.
9628 (Layout::link_stabs_sections): New file.
9629 * layout.h (class Layout): Add have_stabstr_section_ field.
9630 Declare link_stabs_sections.
9632 2009-06-23 Doug Kwan <dougkwan@google.com>
9634 * Makefile.am (libgold_a_LIBADD): New.
9635 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9636 * Makefile.in: Regenerate.
9637 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9638 * configure: Regenerate.
9639 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9640 * fileread.cc: Include sys/state.h
9641 * gold.h: Declare memmem and strndup if found missing.
9642 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9644 2009-06-23 Ian Lance Taylor <iant@google.com>
9646 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9647 * configure: Rebuild.
9649 2009-06-23 Ian Lance Taylor <iant@google.com>
9652 * object.cc (Object::section_contents): Don't try to get a view if
9653 the section has length zero.
9654 (Object::handle_gnu_warning_section): If the section is empty, use
9655 the name of the section as the warning.
9657 2009-06-23 Ian Lance Taylor <iant@google.com>
9660 * stringpool.h (class Stringpool_template): Add optimize_ field.
9661 (Stringpool_template::set_optimize): New function.
9662 * stringpool.cc (Stringpool_template::Stringpool_template):
9663 Initialize optimize_ field.
9664 (Stringpool_template::set_string_offsets): Test local optimize
9665 fild rather than parameter.
9666 * layout.cc (Layout::Layout): Call set_optimize on the section
9669 2009-06-22 Ian Lance Taylor <iant@google.com>
9672 * yyscript.y: Parse TARGET.
9673 * script.cc (script_set_target): New function.
9674 * script-c.h (script_set_target): Declare.
9675 * options.cc (General_options::string_to_object_format): Rename
9676 from string_to_object_format in anonymous namespace. Change
9678 * options.h (class General_options): Declare
9679 string_to_object_format.
9681 2009-06-22 Ian Lance Taylor <iant@google.com>
9683 * script-sections.cc (Script_sections::create_segments): Don't put
9684 program headers in a PT_LOAD segment if -n or -N.
9686 2009-06-22 Ian Lance Taylor <iant@google.com>
9689 * options.h (class General_options): Add -z lazy and -z now. Sort
9690 -z options into alphabetical order.
9691 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9693 2009-06-21 Ian Lance Taylor <iant@google.com>
9695 * layout.cc (Layout::make_output_section): Call
9696 Target::new_output_section.
9697 (Layout::attach_allocated_section_to_segment): Put large section
9698 sections in a separate load segment with the large segment flag
9700 (Layout::segment_precedes): Sort large data segments after other
9702 (align_file_offset): New static function.
9703 (Layout::set_segment_offsets): Use align_file_offset.
9704 * output.h (class Output_section): Add is_small_section_ and
9705 is_large_section_ fields.
9706 (Output_section::is_small_section): New function.
9707 (Output_section::set_is_small_section): New function.
9708 (Output_section::is_large_section): New function.
9709 (Output_section::set_is_large_section): New function.
9710 (Output_section::is_large_data_section): New function.
9711 (class Output_segment): Add is_large_data_segment_ field.
9712 (Output_segment::is_large_data_segment): New function.
9713 (Output_segment::set_is_large_data_segment): New function.
9714 * output.cc (Output_section::Output_section): Initialize new
9716 (Output_segment::Output_segment): Likewise.
9717 (Output_segment::add_output_section): Add assertion that large
9718 data sections always go in large data segments. Force small data
9719 sections to the end of the list of data sections. Force small BSS
9720 sections to the start of the list of BSS sections. For large BSS
9721 sections to the end of the list of BSS sections.
9722 * symtab.h (class Symbol): Declare is_common_shndx.
9723 (Symbol::is_defined): Check Symbol::is_common_shndx.
9724 (Symbol::is_common): Likewise.
9725 (class Symbol_table): Define enum Commons_section_type. Update
9726 declarations. Add small_commons_ and large_commons_ fields.
9727 * symtab.cc (Symbol::is_common_shndx): New function.
9728 (Symbol_table::Symbol_table): Initialize new fields.
9729 (Symbol_table::add_from_object): Put small and large common
9730 symbols in the right list.
9731 (Symbol_table::sized_finalized_symbol): Check
9732 Symbol::is_common_shndx.
9733 (Symbol_table::sized_write_globals): Likewise.
9734 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9735 common symbol lists. Don't call do_allocate_commons_list if the
9737 (Symbol_table::do_allocate_commons_list): Remove is_tls
9738 parameter. Add comons_section_type parameter. Change all
9739 callers. Handle small and large common symbols.
9740 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9741 Symbol::is_common_shndx.
9742 * resolve.cc (symbol_to_bits): Likewise.
9743 * target.h (Target::small_common_shndx): New function.
9744 (Target::small_common_section_flags): New function.
9745 (Target::large_common_shndx): New function.
9746 (Target::large_common_section_flags): New function.
9747 (Target::new_output_section): New function.
9748 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9749 small_common_section_flags, and large_common_section_flags
9751 (Target::do_new_output_section): New virtual function.
9752 * arm.cc (Target_arm::arm_info): Initialize new fields.
9753 * i386.cc (Target_i386::i386_info): Likewise.
9754 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9756 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9757 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9758 (Target_x86_64::do_new_output_section): New function.
9759 * configure.ac: Define conditional MCMODEL_MEDIUM.
9760 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9761 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9762 (large_LDFLAGS): Define.
9763 * testsuite/large.c: New file.
9764 * testsuite/testfile.cc (Target_test::test_target_info):
9765 Initialize new fields.
9766 * configure, testsuite/Makefile.in: Rebuild.
9768 2009-06-05 Doug Kwan <dougkwan@google.com>
9770 * Makefile.am (CCFILES): Add target.cc.
9771 * Makefile.in: Regenerate.
9772 * i386.cc (class Target_i386): Define new virtual method to
9773 override do_is_local_label_name in parent.
9774 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9775 local symbols if --discard-locals or -X is given.
9776 * options.h (class General_options): Declare new options
9777 '--discard-locals' and '-X' for discarding locals.
9778 * target.h (class Target): Define new methods is_local_label_name.
9779 Declare new virtual method do_is_local_label_name.
9780 * target.cc: New file.
9781 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9782 (check_SCRIPTS): Add discard_locals_test.sh.
9783 (check_DATA): Add discard_local_tests.syms.
9784 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9785 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9786 * testsuite/Makefile.in: Regenerate.
9787 * testsuite/discard_locals_test.c: New file.
9788 * testsuite/discard_locals_test.sh: Same.
9790 2009-06-05 Doug Kwan <dougkwan@google.com>
9792 * object.cc (Sized_relobj::Sized_relobj): Initialize
9793 discarded_eh_frame_shndx_ to -1U.
9794 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9796 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9797 a discarded .eh_frame section.
9798 (Sized_relobj::do_finalize_local_symbols): Ditto.
9799 * object.h (class Sized_relobj): Declare new member
9800 discarded_eh_frame_shndx_.
9801 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9802 (local_labels_test.o, local_labels_test): New rules.
9803 * testsuite/Makefile.in: Regenerate.
9805 2009-06-04 Doug Kwan <dougkwan@google.com>
9807 * layout.cc (Layout::section_name_mapping): Add mapping for
9808 special ARM sections.
9810 2009-06-03 Doug Kwan <dougkwan@google.com>
9812 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9813 (utils::has_overflow): Same.
9815 2009-06-03 Ian Lance Taylor <iant@google.com>
9817 * layout.cc (Layout::section_name_mapping): New array, replacing
9818 Layout::linkonce_mapping.
9819 (Layout::section_name_mapping_count): New variable, replacing
9820 Layout::linkonce_mapping_count.
9821 (Layout::linkonce_output_name): Remove.
9822 (Layout::output_section_name): Rewrite.
9823 * layout.h (class Layout): Rename Linkonce_mapping to
9824 Section_name_mapping, linkonce_mapping to section_name_mapping,
9825 linkonce_mapping_count to section_name_mapping_count. Don't
9826 declare linkonce_output_name.
9828 2009-06-03 Doug Kwan <dougkwan@google.com>
9830 * gold/arm.cc (namespace utils): New.
9831 (Target_arm::reloc_is_non_pic): Define new method.
9832 (class Arm_relocate_functions): New.
9833 (Target_arm::Relocate::relocate): Handle relocation types used by
9836 2009-06-03 Ian Lance Taylor <iant@google.com>
9838 * arm.cc (Target_arm::scan::global): Use || instead of |.
9840 2009-06-02 Doug Kwan <dougkwan@google.com>
9842 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9843 issued_non_pic_error_.
9844 (class Target_arm::Scan): Declare new method check_non_pic.
9845 Define new method symbol_needs_plt_entry.
9846 Declare new data member issued_non_pic_error_.
9847 (class Target_arm::Relocate): Declare new method
9848 should_apply_static_reloc.
9849 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9850 (Target_arm::Scan::check_non_pic): Define new method.
9851 (Target_arm::Scan::local): Handle a small subset of reloc types used
9853 (Target_arm::Scan::local): Same.
9854 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9856 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9858 * incremental.cc (Incremental_inputs::report_command_line): Filter
9859 out --incremental-* options.
9861 2009-05-29 Doug Kwan <dougkwan@google.com>
9863 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9865 (class Target_arm): Update comment.
9866 (Target_arm::Target_arm): Initialize new data members GOT_,
9867 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9868 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9869 and Target_arm::rel_dyn_section.
9870 Declare new_enum Target_arm::Got_type.
9871 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9873 Update commments for member do_dynsym_value.
9874 (Target_arm::got_size, Target_arm::plt_section,
9875 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9876 new methods inside class defintion.
9877 (Target_arm::got_section): Define new method.
9878 (Target_arm::rel_dyn_section): Same.
9879 (Output_data_plt_arm): New template class.
9880 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9881 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9882 (Output_data_plt_arm::add_entry): Same.
9883 (Output_data_plt_arm::first_plt_entry): Define new
9884 static data member for PLT instruction template.
9885 (Output_data_plt_arm::plt_entry): Same.
9886 (Output_data_plt_arm::do_write): Define new method.
9887 (Target_arm::make_plt_entry): Same.
9888 (Target_arm::do_finalize_sections): Same.
9889 (Target_arm::do_dynsym_value): Same.
9891 2009-05-28 Doug Kwan <dougkwan@google.com>
9893 * Makefile.am (TARGETSOURCES): Add arm.cc.
9894 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9895 * Makefile.in: Regenerate.
9897 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9899 2009-05-26 Doug Kwan <dougkwan@google.com>
9901 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9902 (General_options::check_excluded_libs): Strip off directories in
9903 archive name before matching like GNU ld does.
9904 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9905 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9906 (exclude_libs_test_LDFLAGS): Add linker option
9907 -Wl,--exclude-libs,libexclude_libs_test_3
9908 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9909 an explicit archive without using -l.
9910 (alt/libexclude_libs_test_3.a): New make rule.
9911 * testsuite/Makefile.in: Regenerate.
9912 * testsuite/exclude_libs_test.c : Declare lib3_default().
9914 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9915 * exclude_libs_test_3.c: New file.
9917 2009-05-26 Nick Clifton <nickc@redhat.com>
9919 * po/id.po: New Indonesian translation.
9920 * po/gold.pot: Updated template file.
9922 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9924 * testsuite/Makefile.am: Add -ffunction-sections to compile
9925 gc_comdat_test files. Add -Wl,--gc-sections to build
9927 * testsuite/Makefile.in: Regenerate.
9928 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9930 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9932 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9933 kept comdat section was garbage collected.
9934 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9935 * testsuite/Makefile.in: Regenerate.
9936 * testsuite/gc_comdat_test.sh: New file.
9937 * testsuite/gc_comdat_test_1.cc: New file.
9938 * testsuite/gc_comdat_test_2.cc: New file.
9940 2009-05-19 Doug Kwan <dougkwan@google.com>
9942 * archive.cc (Archive::Archive): Move constructor from archive.h
9943 to here. Initialize no_export_.
9944 (Archive::get_elf_object_for_member): Set no_export flag of object.
9945 * archive.h (Archive::Archive): Move constructor body to
9947 (Archive::no_export): New method.
9948 (Archive::no_export_): New field.
9949 * object.h (Object::Object): Initialize no_export_ to false.
9950 (Object::no_export, Object::set_no_export): New methods.
9951 (Object::no_export_): New field.
9952 * options.cc (General_options::parse_exclude_libs): New method.
9953 (General_options::check_excluded_libs) Same.
9954 * options.h (exclude_libs): New option.
9955 (General_options::check_excluded_libs): New method declaration.
9956 (General_options::excluded_libs_): New field.
9957 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9958 default or protected visibility if an object has no-export flag set.
9959 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9960 (check_SCRIPTS): Add exclude_libs_test.sh.
9961 (check_DATA): Add exclude_libs_test.syms.
9962 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9963 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9964 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9965 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9966 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9967 libexclude_libs_test_2.a): New rules.
9968 * testsuite/Makefile.in: Regenerate.
9969 * testsuite/exclude_libs_test.c: New file.
9970 * testsuite/exclude_libs_test.sh: Ditto.
9971 * testsuite/exclude_libs_test_1.c: Ditto.
9972 * testsuite/exclude_libs_test_2.c: Ditto.
9974 2009-05-15 Ian Lance Taylor <iant@google.com>
9976 * configure.ac: Check for declarations for cases where libiberty.h
9977 checks HAVE_DECL_xxx.
9978 * configure, config.in: Rebuild.
9980 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9982 * gold.h (Incremental_argument_list): Remove (invalid) forward
9984 * incremental.cc (Incremental_inputs::report_achive): New method.
9985 (Incremental_inputs::report_object): New method.
9986 (Incremental_inputs::report_script): New method.
9987 (Incremental_inputs::finalize_inputs): New method.
9988 (Incremental_inputs::finalize): Call finalize_inputs().
9989 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9990 Create inputs entries.
9991 * incremental.h (Incremental_input_type): New enum.
9992 (Incremental_inputs::Incremental_input): Initialize new fields.
9993 (Incremental_inputs::report_inputs): New method.
9994 (Incremental_inputs::report_achive): New method.
9995 (Incremental_inputs::report_object): New method.
9996 (Incremental_inputs::report_script): New method.
9997 (Incremental_inputs::finalize_inputs): New method.
9998 (Incremental_inputs::Input_info): New struct.
9999 (Incremental_inputs::Input_info_map): New typedef.
10000 (Incremental_inputs::lock_): New field.
10001 (Incremental_inputs::Inputs_): New field.
10002 (Incremental_inputs::Inputs_map): New field.
10003 * main.cc (main): Call Incremental_input::report_inputs.
10004 * options.h (Input_argument_list): Typedef moved from
10006 (Input_file_group::Files): Remove, use ::Input_argument_list.
10007 (Input_file_group::Input_argument_list): Remove, use
10008 ::Input_argument_list.
10009 * plugin.cc (Plugin_manager::add_input_file): Add error in
10011 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10013 * script.cc (read_input_script): Call
10014 Incremental_input::report_script.
10015 * script.h (Script_info): New class.
10017 2009-04-27 Ian Lance Taylor <iant@google.com>
10019 * x86_64.cc (do_adjust_output_section): Set entsize to
10022 2009-04-23 Elliott Hughes <enh@google.com>
10024 * output.cc (Output_file::close): After short writes, continue
10025 writing from the correct offset in the buffer being written.
10027 2009-04-23 Chris Demetriou <cgd@google.com>
10029 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10030 * configure: Regenerate.
10031 * config.in: Regenerate.
10032 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10033 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10035 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10037 * incremental.cc (Incremental_inputs_header_data): Renamed from
10038 Incremental_input_header_data.
10039 (Incremental_inputs_header_data::data_size): New field.
10040 (Incremental_inputs_header_data::put_input_file_count): Renamed
10041 from input_file_count.
10042 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10043 from command_line_offset.
10044 (Incremental_inputs_header_data::put_reserved): Renamed from
10046 (Incremental_inputs_entry_data): Renamed from
10047 Incremental_input_entry_data.
10048 (Incremental_inputs_entry_data::data_size): New field.
10049 (Incremental_inputs::report_command_line): New method.
10050 (Incremental_inputs::finalize): New method.
10051 (Incremental_inputs::create_incremental_inputs_data): New method.
10052 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10053 * incremental.h: New file.
10054 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10055 (Layout::finalize): Create incremental inputs section in
10056 incremental builds.
10057 (Layout::create_incremental_info_sections): New method.
10058 * layout.h (Layout::incremental_inputs): New method.
10059 (Layout::create_incremental_info_sections): New method.
10060 (Layout::incremental_inputs_): New field.
10061 * main.cc (main): Notify Incremental_input of the command line.
10063 2009-04-01 Ian Lance Taylor <iant@google.com>
10064 Mikolaj Zalewski <mikolajz@google.com>
10066 * gold.h (reserve_unordered_map): Define, three versions, one for
10067 each version of Unordered_map.
10068 * layout.cc (Layout::Layout): Remove options parameter. Add
10069 number_of_input_files parameter. Don't initialize options_.
10070 Initialize number_of_input_files_ and resized_signatures_. Move
10071 sections_are_attached_.
10072 (Layout::layout_group): Reserve space for group_signatures_.
10073 (Layout::find_or_add_kept_section): Change name parameter to be a
10074 reference. Resize signatures_ map when it gets large enough.
10075 (Layout::layout_eh_frame): Use parameters->options() instead of
10077 (Layout::make_output_section): Likewise.
10078 (Layout::attach_allocated_section_to_segment): Likewise.
10079 (Layout::finalize, Layout::create_executable_stack): Likewise.
10080 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10081 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10082 * layout.h (class Layout): Update declarations. Remove options_
10083 field. Add number_of_input_files_ and resized_signatures_
10084 fields. Move sections_are_attached_ field.
10085 * main.cc (main): Pass number of input files to Layout
10086 constructor. Don't pass options.
10088 2009-03-30 Ian Lance Taylor <iant@google.com>
10090 * ffsll.c (ffsll): Correct implementation.
10092 2009-03-27 Ian Lance Taylor <iant@google.com>
10094 * ffsll.c: New file.
10095 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10096 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10097 * ftruncate.c (ftruncate): Declare before definition.
10098 * mremap.c (mremap): Likewise.
10099 * pread.c (pread): Likewise.
10100 * configure, Makefile.in, config.in: Rebuild.
10102 * mremap.c: New file.
10103 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10104 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10105 (mremap): Declare if HAVE_MREMAP is not defined.
10106 * configure, Makefile.in, config.in: Rebuild.
10108 2009-03-27 Cary Coutant <ccoutant@google.com>
10110 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10111 position independent.
10112 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10113 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10115 2009-03-24 Cary Coutant <ccoutant@google.com>
10117 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10119 (needs_dynamic_reloc): Likewise.
10121 2009-03-24 Ian Lance Taylor <iant@google.com>
10123 * yyscript.y (file_cmd): Recognize EXTERN.
10124 (extern_name_list, extern_name_list_body): New nonterminals.
10125 * script.cc (script_add_extern): Define.
10126 * script-c.h (script_add_extern): Declare.
10128 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10130 * object.cc (is_elf_object): Define.
10131 * object.h (is_elf_object): Declare.
10132 * archive.cc (Archive::get_elf_object_for_member): Call
10134 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10136 2009-03-24 Elliott Hughes <enh@google.com>
10138 * output.cc (Output_file::map_anonymous): Define.
10139 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10140 try an anonymous one. Report the size if the mmap fails.
10141 * output.h (class Output_file): Declare map_anonymous.
10143 2009-03-24 Ian Lance Taylor <iant@google.com>
10145 * target-select.cc (instantiate_target): Don't acquire the lock if
10146 the instantiated_target_ field has already been set.
10148 2009-03-23 Ian Lance Taylor <iant@google.com>
10150 * gold-threads.h (class Initialize_lock): Define.
10151 * gold-threads.cc (class Initialize_lock_once): Define.
10152 (initialize_lock_control): New static variable.
10153 (initialize_lock_pointer): New static variable.
10154 (initialize_lock_once): New static function.
10155 (Initialize_lock::Initialize_lock): Define.
10156 (Initialize_lock::initialize): Define.
10157 * target-select.h: Include "gold-threads.h".
10158 (class Target_selector): Add lock_ and initialize_lock_ fields.
10159 Don't define instantiate_target, just declare it.
10160 * target-select.cc (Target_selector::Target_selector): Initialize
10162 (Target_selector::instantiate_target): Define.
10163 * descriptors.h: Include "gold-threads.h".
10164 (class Descriptors): Add initialize_lock_ field.
10165 * descriptors.cc (Descriptors::Descriptors): Initialize new
10167 (Descriptors::open): Use initialize_lock_ field
10168 * errors.h (class Errors): Add initialize_lock_ field.
10169 * errors.cc (Errors::Errors): Initialize new field.
10170 (Errors::initialize_lock): Use initialize_lock_ field.
10171 * powerpc.cc (class Target_selector_powerpc): Remove
10172 instantiated_target_ field. In do_recognize call
10173 instantiate_target rather than do_instantiate_target. In
10174 do_instantiate_target just allocate a new target.
10175 * sparc.cc (class Target_selector_sparc): Likewise.
10177 * freebsd.h: New file.
10178 * i386.cc: Include "freebsd.h".
10179 (Target_i386): Derive from Target_freebsd rather than
10181 (Target_selector_i386): Derive from Target_selector_freebsd rather
10182 than Target_selector.
10183 * x86_64.cc: Include "freebsd.h".
10184 (Target_x86_64): Derive from Target_freebsd rather than
10186 (Target_selector_x86_64): Derive from Target_selector_freebsd
10187 rather than Target_selector.
10188 * target.h (class Target): Add adjust_elf_header and
10189 do_adjust_elf_header.
10190 * output.cc (Output_file_header:: do_sized_write): Call target
10191 adjust_elf_header routine.
10192 * configure.tgt: Set targ_osabi.
10193 * configure.ac: Define GOLD_DEFAULT_OSABI.
10194 * parameters.cc (Parameters::default_target): Pass
10195 GOLD_DEFAULT_OSABI to select_target.
10196 * target-select.h (class Target_selector): Make instantiate_target
10197 protected rather than private.
10198 * Makefile.am (HFILES): Add freebsd.h.
10199 * configure, Makefile.in, config.in: Rebuild.
10201 * merge.cc (do_add_input_section): Correct pend value. Change
10202 message about last entry not being null terminated from error to
10205 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10207 * incremental.cc: New file.
10208 * Makefile.am (CCFILES): Add incremental.cc.
10209 * Makefile.in: Rebuild.
10211 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10213 * layout.cc (Layout::output_section_name): Preserve names
10214 of '.note.' sections.
10216 2009-03-19 Ian Lance Taylor <iant@google.com>
10218 * descriptors.cc (Descriptors::open): Check that the options are
10219 valid before using them.
10221 2009-03-18 Ian Lance Taylor <iant@google.com>
10223 * script-sections.h: Include <list>.
10224 (class Script_sections): Change Sections_elements from std::vector
10225 to std::list. Typedef public Elements_iterator. Add
10226 orphan_section_placement_, data_segment_align_start_, and
10227 saw_data_segment_align_ fields. Remove data_segment_align_index_
10229 * script-sections.cc (class Orphan_section_placement): New class.
10230 (class Sections_element): Add virtual functions is_relro and
10231 orphan_section_init. Remove virtual function place_orphan_here.
10232 (class Output_section_definition): Add is_relro and
10233 orphan_section_init. Remove place_orphan_here.
10234 (class Orphan_output_section): Likewise.
10235 (Script_sections::Script_sections): Update for field changes.
10236 (Script_sections::data_segment_align): Set saw_data_segment_align_
10237 and data_segment_align_start_, not data_segment_align_index.
10238 (Script_sections::data_segment_relro_end): Check
10239 saw_data_segment_align_. Use data_segment_align_start_ rather
10240 than data_segment_align_index_.
10241 (Script_sections::place_orphan): Rewrite to use
10242 Orphan_section_placement.
10244 2009-03-17 Ian Lance Taylor <iant@google.com>
10246 * archive.cc (Archive::add_symbols): Check for a version attached
10247 to the symbol name in the archive map.
10248 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10249 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10250 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10251 (ver_test_11.a): New target.
10252 * testsuite/Makefile.in: Rebuild.
10254 * configure.ac: Check for chsize and posix_fallocate. Replace
10256 * ftruncate.c: New file, from gnulib.
10257 * output.cc (posix_fallocate): Define dummy version if not
10258 HAVE_POSIX_FALLOCATE.
10259 (Output_file::map): Call posix_fallocate rather than lseek and
10261 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10262 * configure, Makefile.in, config.in: Rebuild.
10264 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10266 * layout.h (Layout::create_note): Add section_name parameter.
10267 * layout.cc (Layout::create_note): Likewise.
10268 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10270 2009-03-17 Ian Lance Taylor <iant@google.com>
10272 * descriptors.cc: Include "options.h".
10273 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10274 (Descriptors::open): Always use O_CLOEXEC when opening a new
10275 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10276 then set FD_CLOEXEC.
10278 * sparc.cc (class Target_sparc): Add has_got_section.
10279 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10280 make sure we have a GOT section.
10282 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10283 (Target_sparc::Scan::local): Likewise.
10284 (Target_sparc::Scan::global): Likewise.
10285 (Target_sparc::Relocate::relocate): Likewise.
10286 (Target_sparc::Relocate::relocate_tls): Likewise.
10288 * symtab.cc (Symbol_table::define_default_version): New function,
10289 broken out of add_from_object.
10290 (Symbol_table::add_from_object): Call define_default_version.
10291 (Symbol_table::define_special_symbol): Add resolve_oldsym
10292 parameter. Change all callers. If the version for a symbol comes
10293 from a version script, resolve it with the symbol with the same
10294 name with no version. Also add the symbol without a version if
10296 (do_define_in_output_data): If resolving with oldsym, don't delete
10298 (do_define_in_output_segment): Likewise.
10299 (do_define_as_constant): Likewise.
10300 * symtab.h (class Symbol_table): Update declarations.
10302 2009-03-13 Ian Lance Taylor <iant@google.com>
10304 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10305 (Read_symbols::requeue): New function.
10306 (Read_symbols::do_read_symbols): If make_elf_object fails because
10307 the target type is not configured, and the file was searched for,
10308 issue a warning and retry with the next directory.
10309 (Add_symbols::run): If the file has an incompatible format, and
10310 it was searched for, requeue the Read_symbols task. On error,
10311 release the object.
10312 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10313 dirindex parameter to constructor. Change all callers. Declare
10314 incompatible_warning and requeue.
10315 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10316 input_argument_ and input_group_ fields. Add them to
10317 constructor. Change all callers.
10318 (class Read_script): Add dirindex_ field. Add it to constructor.
10319 Change all callers.
10320 * archive.cc (Archive::setup): Remove input_objects parameter.
10321 Change all callers.
10322 (Archive::get_file_and_offset): Likewise.
10323 (Archive::read_all_symbols): Likewise.
10324 (Archive::read_symbols): Likewise.
10325 (Archive::get_elf_object_for_member): Remove input_objects
10326 parameter. Add punconfigured parameter. Change all callers.
10327 (Archive::add_symbols): Change return type to bool. Check return
10328 value of include_member.
10329 (Archive::include_all_members): Likewise.
10330 (Archive::include_member): Change return type to bool. Return
10331 false if first included object has incompatible target. Set
10332 included_member_ field.
10333 (Add_archive_symbols::run): If add_symbols returns false, requeue
10335 * archive.h (class Archive): Add included_member_ field.
10336 Initialize it in constructor. Add input_file and searched_for
10337 methods. Update declarations.
10338 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10339 input_argument_ fields. Add them to constructor. Change all
10341 * script.cc: Include "target-select.h".
10342 (class Parser_closure): Add skip_on_incompatible_target_ and
10343 found_incompatible_target_ fields. Add
10344 skip_on_incompatible_target parameter to constructor. Change all
10345 callers. Add methods skip_on_incompatible_target,
10346 clear_skip_on_incompatible_target, found_incompatible_target, and
10347 set_found_incompatible_target.
10348 (read_input_script): Add dirindex parameter. Change all callers.
10349 If parser finds an incompatible target, requeue Read_symbols
10351 (script_set_symbol): Clear skip_on_incompatible_target in
10353 (script_add_assertion, script_parse_option): Likewise.
10354 (script_start_sections, script_add_phdr): Likewise.
10355 (script_check_output_format): New function.
10356 * script.h (read_input_script): Update declaration.
10357 * script-c.h (script_check_output_format): Declare.
10358 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10359 (ignore_cmd): Remove OUTPUT_FORMAT.
10360 * fileread.cc (Input_file::Input_file): Add explicit this.
10361 (Input_file::will_search_for): New function.
10362 (Input_file::open): Add pindex parameter. Change all callers.
10363 * fileread.h (class Input_file): Add input_file_argument method.
10364 Declare will_search_for. Update declarations.
10365 * object.cc (make_elf_object): Add punconfigured parameter.
10366 Change all callers.
10367 * object.h (class Object): Make input_file public. Add
10368 searched_for method.
10369 (make_elf_object): Update declaration.
10370 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10372 * dirsearch.h (class Dirsearch): Update declaration.
10373 * options.h (class General_options): Add --warn-search-mismatch.
10374 * parameters.cc (Parameters::is_compatible_target): New function.
10375 * parameters.h (class Parameters): Declare is_compatible_target.
10376 * workqueue.cc (Workqueue::add_blocker): New function.
10377 * workqueue.h (class Workqueue): Declare add_blocker.
10379 * fileread.cc (Input_file::open): Remove options parameter.
10380 Change all callers.
10381 (Input_file::open_binary): Likewise.
10382 * script.cc (read_input_script): Likewise.
10383 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10384 options parameter from constructor. Change all callers.
10385 (class Read_script): Likewise.
10386 * fileread.h (class Input_file): Update declarations.
10387 * script.h (read_input_script): Update declaration.
10389 2009-03-10 Nick Clifton <nickc@redhat.com>
10391 * po/es.po: New Spanish translation.
10393 2009-03-06 Cary Coutant <ccoutant@google.com>
10395 * options.cc (parse_short_option): Keep dash_z from registering itself.
10397 2009-03-03 Ian Lance Taylor <iant@google.com>
10400 * target-reloc.h (relocate_section): Pass output_section to
10402 * i386.cc (Target_i386::should_apply_static_reloc): Add
10403 output_section parameter. Change all callers.
10404 (Target_i386::Relocate::relocate): Add output_section parameter.
10405 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10406 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10407 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10408 * testsuite/two_file_shared.sh: New script.
10409 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10410 (check_DATA): Add two_file_shared.dbg.
10411 (two_file_shared.dbg): New target.
10412 * testsuite/Makefile.in: Rebuild.
10414 2009-03-01 Ian Lance Taylor <iant@google.com>
10416 * configure.ac: Check for byteswap.h.
10417 * configure: Rebuild.
10418 * config.in: Rebuild.
10420 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10422 * layout.cc (Layout::find_or_add_kept_section): New function.
10423 (Layout::add_comdat): Removed.
10424 * layout.h (struct Kept_section): Move out of class Layout.
10425 Remove trailing underscores from field names. Add group_sections
10426 field. Rename group_ field to is_group. Change all uses.
10427 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10428 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10429 comdat_groups_ field.
10430 (Sized_relobj::include_section_group): Use
10431 find_or_add_kept_section and Kept_section::group_sections.
10432 (Sized_relobj::include_linkonce_section): Likewise.
10433 * object.cc (class Sized_relobj): Don't define Comdat_group or
10434 Comdat_group_table. Remove find_comdat_group and
10435 add_comdat_group. Remove comdat_groups_ field.
10436 * plugin.cc (include_comdat_group): Use
10437 Layout::find_or_add_kept_section.
10439 2009-02-28 Ian Lance Taylor <iant@google.com>
10441 * README: --gc-sections and map files are now supported. Document
10442 some build requirements.
10445 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10446 relocatable link set the value of the section symbol to zero.
10447 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10448 relocatable link don't include the section address in the local
10451 2009-02-27 Ian Lance Taylor <iant@google.com>
10454 * options.h (class Search_directory): Add is_system_directory.
10455 (class General_options): Declare is_in_system_directory.
10456 * options.cc (get_relative_sysroot): Make static.
10457 (get_default_sysroot): Make static.
10458 (General_optoins::is_in_system_directory): New function.
10459 * fileread.cc (Input_file::is_in_system_directory): New function.
10460 * fileread.h (class Input_file): Declare is_in_system_directory.
10461 * object.h (class Object): Add is_in_system_directory.
10462 (class Input_objects): Remove system_library_directory_ field.
10463 * object.cc (Input_objects::add_object): Don't set
10464 system_library_directory_.
10465 (input_objects::found_in_system_library_directory): Remove.
10466 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10467 parameter. Change all callers.
10468 (Symbol_table::sized_write_globals): Likewise.
10469 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10470 Call Object::is_in_system_directory.
10471 * symtab.h (class Symbol_table): Update declarations.
10474 * descriptors.h (Open_descriptor): Add is_on_stack field.
10475 * descriptors.cc (Descriptors::open): If the descriptor is on the
10476 top of the stack, remove it. Initialize is_on_stack field.
10477 (Descriptors::release): Only add pod to stack if it is not on the
10479 (Descriptors::close_some_descriptor): Clear stack_next and
10480 is_on_stack fields.
10483 * output.cc (Output_section::find_starting_output_address): Rename
10484 from starting_output_address; add PADDR parameter; change return
10486 * output.h (class Output_section): Declare
10487 find_starting_output_address instead of starting_output_address.
10488 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10489 section symbol for which we can't find a merge section.
10492 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10493 hidden or internal, force the symbol to be local.
10494 * resolve.cc (Symbol::override_visibility): Define.
10495 (Symbol::override_base): Use override_visibility.
10496 (Symbol_table::resolve): Likewise.
10497 (Symbol::override_base_with_special): Likewise.
10498 (Symbol_table::override_with_special): If the visibility is hidden
10499 or internal, force the symbol to be local.
10500 * symtab.h (class Symbol): Add set_visibility and
10501 override_visibility.
10502 * testsuite/ver_test_1.sh: New file.
10503 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10504 (check_DATA): Add ver_test_1.syms.
10505 (ver_test_1.syms): New target.
10506 * testsuite/Makefile.in: Rebuild.
10508 2009-02-25 Cary Coutant <ccoutant@google.com>
10510 * layout.cc (Layout::choose_output_section): Don't rename sections
10511 when using a linker script that has a SECTIONS clause.
10512 * Makefile.in: Regenerate.
10514 * testsuite/Makefile.am (script_test_5.sh): New test case.
10515 * testsuite/Makefile.in: Regenerate.
10516 * testsuite/script_test_5.cc: New file.
10517 * testsuite/script_test_5.sh: New file.
10518 * testsuite/script_test_5.t: New file.
10520 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10522 * archive.cc (Archive::include_member): Update calls to add_symbols.
10523 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10524 the Layout argument.
10525 * dynobj.h (do_add_symbols): Add the Layout argument.
10526 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10528 * object.h (Object::add_symbols): Add the Layout argument.
10529 (Object::do_add_symbols): Add the Layout argument.
10530 (Sized_relobj::do_add_symbols): Add the Layout argument.
10531 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10532 Unify the two versions.
10533 (Add_plugin_symbols): Remove.
10534 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10535 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10536 (Add_plugin_symbols): Remove.
10537 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10538 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10539 (Add_symbols::run): Make it work with Pulginobj.
10541 2009-02-06 Ian Lance Taylor <iant@google.com>
10543 * object.cc (Sized_relobj::do_layout): Make info message start
10544 with lower case letter.
10546 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10548 * binary.cc: Fix file comment.
10550 * options.h (enum Incremental_disposition): Define.
10551 (class General_options): Add new options: --incremental,
10552 --incremental_changed, --incremental_unchanged,
10553 --incremental_unknown. Add incremental_disposition_ and
10554 implicit_incremental_ fields.
10555 (General_options::incremental_disposition): New function.
10556 (class Position_dependent_options): Add incremental_disposition
10558 (Position_dependent_options::copy_from_options): Set incremental
10560 * options.cc (General_options::parse_incremental_changed): New
10562 (General_options::parse_incremental_unchanged): New function.
10563 (General_options::parse_incremental_unknown): New function.
10564 (General_options::General_options): Initialize new fields
10565 incremental_disposition_ and implicit_incremental_.
10566 (General_options::finalize): Check for uasge of --incremental-*
10567 without --incremental.
10569 2009-02-06 Chris Demetriou <cgd@google.com>
10571 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10572 pointer and to report location as the file name associated with
10574 (gold_undefined_symbol_at_location): New function to replace the
10575 old gold_undefined_symbol functionality.
10576 * target-reloc.h (relocate_section): Update to use
10577 gold_undefined_symbol_at_location.
10578 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10579 Call gold_undefined_symbol function rather than gold_error.
10580 * errors.h (Errors::undefined_symbol): Take location as a
10581 string, rather than calculating it from a relocation.
10582 * errors.cc (Errors::fatal): Print "fatal error:" before the
10584 (Errors::error, Errors::error_at_location): Print "error: "
10585 before the formatted message.
10586 (Errors::undefined_symbol): Take location as a string, rather
10587 than calculating it from a relocation.
10588 (gold_undefined_symbol_at_location): New function akin to
10589 old gold_undefined_symbol, calculates location from relocation.
10590 (gold_undefined_symbol): Change to take only a Symbol pointer
10591 and to report location as the file name associated with the symbol.
10592 * testsuite/debug_msg.sh: Update for changed error messages.
10593 * testsuite/undef_symbol.sh: Likewise.
10595 2009-02-04 Duncan Sands <baldrick@free.fr>
10598 * reduced_debug_output.h
10599 (Output_reduced_debug_abbrev_section::failed): Use format for
10601 (Output_reduced_debug_info_section::faild): Likewise.
10603 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10605 * script.cc (Lazy_demangler): New class.
10606 (Version_script_info::get_symbol_version_helper): Demangle a
10609 2009-01-29 Cary Coutant <ccoutant@google.com>
10611 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10613 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10615 2009-01-28 Ian Lance Taylor <iant@google.com>
10617 * version.cc (version_string): Bump to 1.9.
10619 * gold.h: Include <cstring> and <stdint.h>.
10620 * version.cc: Include <cstdio>.
10621 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10623 * reduced_debug_output.cc (insert_into_vector): Rename from
10624 Insert_into_vector; change all callers. Use Swap_unaligned to
10625 avoid aliasing issue; remove union since it is unnecessary.
10627 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10629 * Makefile.am (CCFILES): Add gc.cc.
10630 (HFILES): Add gc.h.
10631 * Makefile.in: Regenerate.
10632 * gold.cc (Gc_runner): New class.
10633 (queue_initial_tasks): Call garbage collection related tasks
10634 when corresponding options are invoked.
10635 (queue_middle_gc_tasks): New function.
10636 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10637 processed early before laying out sections during garbage collection.
10638 * gold.h (queue_middle_gc_tasks): New function.
10639 (is_prefix_of): Move from "layout.cc".
10640 * i386.cc (Target_i386::gc_process_relocs): New function.
10641 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10642 * main.cc (main): Create object of class "Garbage_collection".
10643 * object.cc (Relobj::copy_symbols_data): New function.
10644 (Relobj::is_section_name_included): New function.
10645 (Sized_relobj::do_layout): Allow this function to be called twice
10646 during garbage collection and defer layout of section during the
10648 * object.h (Relobj::get_symbols_data): New function.
10649 (Relobj::is_section_name_included): New function.
10650 (Relobj::copy_symbols_data): New function.
10651 (Relobj::set_symbols_data): New function.
10652 (Relobj::get_relocs_data): New function.
10653 (Relobj::set_relocs_data): New function.
10654 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10655 (Relobj::gc_process_relocs): New function.
10656 (Relobj::do_gc_process_relocs): New pure virtual function.
10657 (Relobj::sd_): New data member.
10658 (Sized_relobj::is_output_section_offset_invalid): New function.
10659 (Sized_relobj::do_gc_process_relocs): New function.
10660 * options.h (General_options::gc_sections): Modify to not be a no-op.
10661 (General_options::print_gc_sections): New option.
10662 * plugin.cc (Plugin_finish::run): Remove function call to
10663 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10664 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10665 * reloc.cc (Read_relocs::run): Add task to process relocs and
10666 determine unreferenced sections when doing garbage collection.
10667 (Gc_process_relocs): New class.
10668 (Sized_relobj::do_gc_process_relocs): New function.
10669 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10670 sections that are garbage collected.
10671 * reloc.h (Gc_process_relocs): New class.
10672 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10673 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10674 symbols whose corresponding sections are garbage collected.
10675 (Symbol_table::Symbol_table): Add new parameter for the garbage
10677 (Symbol_table::gc_mark_undef_symbols): New function.
10678 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10679 (Symbol_table::gc_mark_dyn_syms): New function.
10680 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10682 (Symbol_table::add_from_object): Likewise.
10683 (Symbol_table::add_from_relobj): When building shared objects, do not
10684 treat externally visible symbols as garbage.
10685 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10686 table information for static and relocatable links.
10687 * symtab.h (Symbol_table::set_gc): New function.
10688 (Symbol_table::gc): New function.
10689 (Symbol_table::gc_mark_undef_symbols): New function.
10690 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10691 (Symbol_table::gc_mark_dyn_syms): New function.
10692 (Symbol_table::gc_): New data member.
10693 * target.h (Sized_target::gc_process_relocs): New pure virtual
10695 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10696 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10698 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10700 * options.h (General_options::gc_sections): Define as a no-op for now.
10701 (General_options::no_keep_memory): Ditto.
10702 (General_options::Bshareable): Define.
10703 * options.cc (General_options::finalize): Honor -Bshareable.
10705 2009-01-20 Andreas Schwab <schwab@suse.de>
10707 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10708 read the value in the contents, since we don't use it. Use the
10709 template endianness when writing.
10710 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10712 2009-01-19 Andreas Schwab <schwab@suse.de>
10714 * configure.tgt (powerpc64-*): Fix targ_obj.
10716 2009-01-15 Ian Lance Taylor <iant@google.com>
10718 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10719 local symbols when stripping all symbols.
10721 2009-01-14 Cary Coutant <ccoutant@google.com>
10723 * output.cc (Output_reloc): Add explicit instantiations.
10725 2009-01-14 Cary Coutant <ccoutant@google.com>
10727 * archive.cc (Archive::get_elf_object_for_member): Remove call
10728 to File_read::claim_for_plugin.
10729 * descriptors.cc (Descriptors::open): Remove reference to
10731 (Descriptors::claim_for_plugin): Remove.
10732 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10733 (Descriptors::is_claimed): Remove.
10734 (claim_descriptor_for_plugin): Remove.
10735 * fileread.cc (File_read::claim_for_plugin): Remove.
10736 * fileread.h (File_read::claim_for_plugin): Remove.
10737 (File_read::descriptor): Reopen descriptor if necessary.
10738 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10739 (Plugin_manager::all_symbols_read): Add task parameter. Change
10741 (Plugin_manager::get_input_file): New function.
10742 (Plugin_manager::release_input_file): New function.
10743 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10744 corresponding data member.
10745 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10746 and pass to base constructor. Change all callers.
10747 (get_input_file, release_input_file): New functions.
10748 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10749 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10750 (Plugin_manager::all_symbols_read): Add task parameter.
10751 (Plugin_manager::get_input_file): New function.
10752 (Plugin_manager::release_input_file): New function.
10753 (Plugin_manager::task_): New data member.
10754 (Pluginobj::Pluginobj): Add filesize parameter.
10755 (Pluginobj::filename): New function.
10756 (Pluginobj::descriptor): New function.
10757 (Pluginobj::filesize): New function.
10758 (Pluginobj::filesize_): New data member.
10759 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10760 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10761 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10763 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10764 with archive libraries.
10765 * testsuite/Makefile.in: Regenerate.
10766 * testsuite/plugin_test.c (struct sym_info): New type.
10767 (get_input_file, release_input_file): New static variables.
10768 (onload): Capture new transfer vector entries.
10769 (claim_file_hook): Stop reading at end of file according to filesize.
10770 Factor out parsing of readelf output into separate function.
10771 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10772 APIs and get the source file name from the symbol table. Convert
10773 source file name to corresponding object file name. Print info
10774 message when adding new input files.
10775 (parse_readelf_line): New function.
10776 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10777 * testsuite/plugin_test_2.sh: Likewise.
10778 * testsuite/plugin_test_3.sh: Likewise.
10779 * testsuite/plugin_test_4.sh: New test case.
10781 2009-01-07 Ian Lance Taylor <iant@google.com>
10783 * version.cc (version_string): Bump to 1.8.
10785 2008-12-23 Cary Coutant <ccoutant@google.com>
10787 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10788 * plugin.cc (Plugin_manager::finish): Rename as
10789 layout_deferred_objects. Move cleanup to separate function.
10790 (Plugin_manager::cleanup): New function.
10791 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10793 * plugin.h (Plugin_manager::finish): Rename as
10794 layout_deferred_objects.
10795 (Plugin_manager::cleanup): New function.
10796 (Plugin_manager::cleanup_done): New field.
10798 2008-12-23 Cary Coutant <ccoutant@google.com>
10800 * plugin.cc (is_visible_from_outside): New function.
10801 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10802 so we don't return "IR only" status for exported symbols or -r links.
10804 * testsuite/Makefile.am (plugin_test_3): New test case.
10805 * testsuite/Makefile.in: Regenerate.
10806 * testsuite/plugin_test_3.sh: New file.
10808 2008-12-22 Cary Coutant <ccoutant@google.com>
10810 * object.cc (Sized_relobj::layout_section): New function.
10811 (Sized_relobj::do_layout): Defer layout of input sections until after
10812 plugin has provided replacement files.
10813 (Sized_relobj::do_layout_deferred_sections): New function.
10814 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10815 (Relobj::layout_deferred_sections): New function.
10816 (Relobj::do_layout_deferred_sections): New function.
10817 (Sized_relobj::do_layout_deferred_sections): New function.
10818 (Sized_relobj::layout_section): New function.
10819 (Sized_relobj::Deferred_layout): New structure.
10820 (Sized_relobj::deferred_layout_): New field.
10821 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10822 Change all callers. Layout deferred sections.
10823 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10825 (Plugin_hook::run): Move code from do_plugin_hook inline.
10826 (Plugin_hook::do_plugin_hook): Remove.
10827 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10828 (Plugin_manager::finish): Renamed, was cleanup.
10829 (Plugin_manager::should_defer_layout): New function.
10830 (Plugin_manager::add_deferred_layout_object): New function.
10831 (Plugin_manager::Deferred_layout_list): New type.
10832 (Plugin_manager::deferred_layout_objects_): New field.
10833 (Plugin_hook::do_plugin_hook): Remove.
10835 2008-12-17 Ian Lance Taylor <iant@google.com>
10837 * options.h (class General_options): Add --no case for
10840 2008-12-16 Cary Coutant <ccoutant@google.com>
10842 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10844 (Plugin_manager::claim_file): Create plugin object even if
10845 plugin did not call the add_symbols callback.
10846 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10847 asking for more symbols than were added.
10848 * testsuite/Makefile.am (plugin_test_1): Add test case with
10850 (empty.syms): New target.
10851 * testsuite/Makefile.in: Regenerate.
10852 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10853 message. Don't call add_symbols if no globals.
10854 (all_symbols_read_hook): Don't provide replacement for empty
10857 2008-12-12 Ian Lance Taylor <iant@google.com>
10859 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10860 r_type == 0 for a local symbol with r_sym == 0.
10861 (scan_relocatable_relocs): Pass r_sym to
10862 local_non_section_strategy.
10863 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10866 * configure.ac: Update test for TLS descriptors: they are
10867 supported as of glibc 2.9.
10868 * configure: Rebuild.
10870 2008-12-11 Ian Lance Taylor <iant@google.com>
10873 * target-reloc.h (Default_scan_relocatable_relocs): For each
10874 function, map r_type == 0 to RELOC_DISCARD.
10876 2008-12-10 Cary Coutant <ccoutant@google.com>
10878 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10879 object to override a kept COMDAT group from a plugin object.
10881 2008-12-09 Ian Lance Taylor <iant@google.com>
10884 * yyscript.y (file_cmd): Handle INPUT.
10886 * testsuite/initpri1.c: Change all declarations to be full
10887 prototypes by adding void, to avoid compiler warnings.
10889 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10891 * options.cc (General_options::parse_plugin_opt): New.
10892 (General_options::add_plugin): The argument now is just the filename.
10893 (General_options::add_plugin_option): New.
10894 * options.h (plugin_opt): New.
10895 (add_plugin): Change argument name.
10896 (add_plugin_option): New.
10897 * plugin.cc (Plugin::load): Don't parse the plugin option.
10898 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10899 (Plugin::add_option): New.
10900 (Plugin::args_): Change type.
10901 (Plugin::filename_): New.
10902 (Plugin_manager::add_plugin_option): New.
10903 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10904 * testsuite/Makefile.in: Regenerate.
10906 2008-12-05 Cary Coutant <ccoutant@google.com>
10908 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10909 Handle --strip-lto-sections option.
10910 * options.h (strip_lto_sections): New option.
10912 2008-12-01 Cary Coutant <ccoutant@google.com>
10914 * plugin.cc (ld_plugin_message): Change format parameter to const.
10915 Fix mismatch between new[] and delete.
10917 2008-11-14 Cary Coutant <ccoutant@google.com>
10919 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10922 2008-11-05 Craig Silverstein <csilvers@google.com>
10924 * options.cc (General_options::parse_dynamic_list): New function.
10925 * options.h (General_options): New flags dynamic_list,
10926 dynamic_list_data, dynamic_list_cpp_new, and
10927 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10928 (General_options::in_dynamic_list): New function.
10929 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10930 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10931 (Lex::can_continue_name): Likewise.
10933 (read_script_file): New parameter script_options.
10934 (read_dynamic_list): New function.
10935 (Script_options::define_dynamic_list): New function.
10936 (dynamic_list_keyword_parsecodes): New variable.
10937 (dynamic_list_keywords): New variable.
10938 * script.h (Script_options::define_dynamic_list): New function
10940 (read_dynamic_list): New function prototype.
10941 * symtab.cc (strprefix): New macro.
10942 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10943 dynamic_list_data, dynamic_list_cpp_new, and
10944 dynamic_list_cpp_typeinfo.
10945 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10946 (dynamic_list_expr): New rule.
10947 (dynamic_list_nodes): Likewise.
10948 (dynamic_list_node): Likewise.
10949 * testsuite/Makefile.am (dynamic_list): New test.
10950 * testsuite/Makefile.in: Regenerated.
10951 * testsuite/dynamic_list.t: New file.
10952 * testsuite/dynamic_list.sh: New file.
10954 2008-11-05 Craig Silverstein <csilvers@google.com>
10956 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10957 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10958 (t11_last): Likewise.
10959 * testsuite/ver_test_6.c (main): Likewise.
10961 2008-10-07 Cary Coutant <ccoutant@google.com>
10963 * options.c (General_options::finalize): Add check for -static and
10965 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10968 2008-10-02 Cary Coutant <ccoutant@google.com>
10970 * plugin.cc (make_sized_plugin_object): Fix conditional
10971 compilation to work when not all targets are enabled.
10973 2008-09-29 Cary Coutant <ccoutant@google.com>
10975 * archive.cc (Archive::get_file_and_offset): Use filename instead
10976 of name to get library path.
10977 (Archive::include_member): Unlock external member of a thin archive.
10979 * testsuite/Makefile.am (TEST_AR): New variable.
10980 (thin_archive_test_1): New test.
10981 (thin_archive_test_2): New test.
10982 * testsuite/Makefile.in: Regenerate.
10983 * testsuite/thin_archive_main.cc: New file.
10984 * testsuite/thin_archive_test_1.cc: New file.
10985 * testsuite/thin_archive_test_2.cc: New file.
10986 * testsuite/thin_archive_test_3.cc: New file.
10987 * testsuite/thin_archive_test_4.cc: New file.
10989 2008-09-29 Cary Coutant <ccoutant@google.com>
10991 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10992 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10994 (Sized_relobj::do_finalize_local_symbols): Likewise.
10995 (Sized_relobj::map_to_kept_section): Likewise.
10996 * object.h (Sized_relobj::invalid_address): New constant.
10997 (Sized_relobj::do_output_section_offset): Check for invalid_address
10999 * output.cc (Output_reloc::local_section_offset): Use constant
11000 invalid_address instead of -1U.
11001 (Output_reloc::get_address): Likewise.
11002 (Output_section::output_address): Change -1U to -1ULL.
11003 * output.h (Output_reloc::invalid_address): New constant.
11004 * reloc.cc (Sized_relobj::write_sections): Use constant
11005 invalid_address instead of -1U.
11006 (Sized_relobj::relocate_sections): Likewise.
11007 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11008 values for merge sections.
11009 * target-reloc.h (relocate_for_relocatable): Use constant
11010 invalid_address instead of -1U.
11012 2008-09-19 Cary Coutant <ccoutant@google.com>
11014 Add plugin functionality for link-time optimization (LTO).
11015 * configure.ac (plugins): Add --enable-plugins option.
11016 * configure: Regenerate.
11017 * config.in: Regenerate.
11018 * Makefile.am (LIBDL): New variable.
11019 (CCFILES): Add plugin.cc.
11020 (HFILES): Add plugin.h.
11021 (ldadd_var): Add LIBDL.
11022 * Makefile.in: Regenerate.
11024 * archive.cc: Include "plugin.h".
11025 (Archive::setup): Don't preread archive symbols when using a plugin.
11026 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11027 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11029 (Archive::include_member): Add symbols from plugin objects.
11030 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11031 * descriptors.cc (Descriptors::open): Check for file descriptors
11032 abandoned by plugins.
11033 (Descriptors::claim_for_plugin): New function.
11034 * descriptors.h (Descriptors::claim_for_plugin): New function.
11035 (Open_descriptor::is_claimed): New field.
11036 (claim_descriptor_for_plugin): New function.
11037 * fileread.cc (File_read::claim_for_plugin): New function.
11038 * fileread.h (File_read::claim_for_plugin): New function.
11039 (File_read::descriptor): New function.
11040 * gold.cc: Include "plugin.h".
11041 (queue_initial_tasks): Add task to call plugin hooks for generating
11043 * main.cc: Include "plugin.h".
11044 (main): Load plugin libraries.
11045 * object.h (Pluginobj): Declare.
11046 (Object::pluginobj): New function.
11047 (Object::do_pluginobj): New function.
11048 (Object::set_target): New function.
11049 * options.cc: Include "plugin.h".
11050 (General_options::parse_plugin): New function.
11051 (General_options::General_options): Initialize plugins_ field.
11052 (General_options::add_plugin): New function.
11053 * options.h (Plugin_manager): Declare.
11054 (General_options): Add --plugin option.
11055 (General_options::has_plugins): New function.
11056 (General_options::plugins): New function.
11057 (General_options::add_plugin): New function.
11058 (General_options::plugins_): New field.
11059 * plugin.cc: New file.
11060 * plugin.h: New file.
11061 * readsyms.cc: Include "plugin.h".
11062 (Read_symbols::do_read_symbols): Check for archive before checking
11063 for ELF file. Call plugin hooks to claim files.
11064 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11065 from a real object file; force override when processing replacement
11067 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11068 (Symbol::init_base_object): Likewise.
11069 (Symbol::init_base_output_data): Likewise.
11070 (Symbol::init_base_output_segment): Likewise.
11071 (Symbol::init_base_constant): Likewise.
11072 (Symbol::init_base_undefined): Likewise.
11073 (Symbol::output_section): Assert that object is not a plugin.
11074 (Symbol_table::add_from_pluginobj): New function.
11075 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11077 (Symbol_table::sized_write_globals): Likewise.
11078 (Symbol_table::add_from_pluginobj): Instantiate template.
11079 * symtab.h (Sized_pluginobj): Declare.
11080 (Symbol::in_real_elf): New function.
11081 (Symbol::set_in_real_elf): New function.
11082 (Symbol::in_real_elf_): New field.
11083 (Symbol_table::add_from_pluginobj): New function.
11085 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11086 (LIBDL): New variable.
11087 (LDADD): Add LIBDL.
11088 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11089 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11090 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11091 (MOSTLYCLEANFILES): Likewise.
11092 * testsuite/Makefile.in: Regenerate.
11093 * testsuite/plugin_test.c: New file.
11094 * testsuite/plugin_test_1.sh: New file.
11095 * testsuite/plugin_test_2.sh: New file.
11097 2008-09-16 Ian Lance Taylor <iant@google.com>
11099 * target-reloc.h (relocate_section): Check whether a symbol is
11100 defined by the ABI before reporting an undefined symbol error.
11101 * target.h (Target::is_defined_by_abi): Make parameter const.
11102 (Target::do_is_defined_by_abi): Likewise.
11103 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11104 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11105 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11106 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11107 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11108 * testsuite/Makefile.in: Rebuild.
11110 * fileread.cc (make_view): Add casts to avoid warning.
11112 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11114 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11115 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11117 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11119 * options.h (General_options::output_is_executable): New.
11120 (General_options::output_is_pie): New.
11121 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11122 for shared libraries.
11123 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11125 2008-09-11 Chris Demetriou <cgd@google.com>
11127 * options.h (origin): New -z option.
11128 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11129 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11132 2008-09-05 Cary Coutant <ccoutant@google.com>
11134 * fileread.cc (File_read::make_view): Add check for attempt to map
11135 beyond end of file.
11137 2008-09-05 Cary Coutant <ccoutant@google.com>
11139 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11140 explicit instantiations.
11142 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11145 * options.cc (General_options::finalize): Allow undefined symbols
11146 in shlibs if linking -shared.
11149 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11150 symbols as not needing a dynsym entry.
11152 2008-08-20 Craig Silverstein <csilvers@google.com>
11154 * fileread.cc (File_read::open): Do not lock the file unless it
11155 was successfully opened.
11157 2008-08-14 Cary Coutant <ccoutant@google.com>
11159 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11160 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11161 * testsuite/tls_test.cc (struct int128): 128-bit struct
11162 for testing TLS relocs with non-zero addend.
11163 (v12): New TLS variable.
11165 (t_last): Add check for v12.
11166 * testsuite/tls_test.h (t12): New function.
11167 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11169 2008-08-13 Ian Lance Taylor <iant@google.com>
11171 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11172 set tls_segment_ or relro_segment_.
11173 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11175 * output.h (Output_section::clear_is_relro): New function.
11176 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11177 sections specially even when output_data_ is empty.
11178 (Output_segment::maximum_alignment): When first section is relro,
11179 only force alignment for PT_LOAD segments.
11180 * script.cc (script_data_segment_align): New function.
11181 (script_data_segment_relro_end): New function.
11182 * script-c.h (script_data_segment_align): Declare.
11183 (script_data_segment_relro_end): Declare.
11184 * script-sections.h (class Script_sections): Declare
11185 data_segment_align and data_segment_relro_end. Add fields
11186 segment_align_index_ and saw_relro_end_.
11187 * script-sections.cc (class Sections_element): Add set_is_relro
11188 virtual function. Add new bool* parameter to place_orphan_here.
11189 Add get_output_section virtual function.
11190 (class Output_section_definition): Add set_is_relro. Add new
11191 bool* parameter to place_orphan_here. Add get_output_section.
11192 Add is_relro_ field.
11193 (Output_section_definition::Output_section_definition): Initialize
11194 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11195 and is_relro_ fields.
11196 (Output_section_definition::place_orphan_here): Add is_relro
11198 (Output_section_definition::set_section_addresses): Set relro for
11200 (Output_section_definition::alternate_constraint): Likewise.
11201 (class Orphan_output_section): Add new bool* parameter to
11202 place_orphan_here. Add get_output_section.
11203 (Orphan_output_section::place_orphan_here): Add is_relro
11205 (Script_sections::Script_sections): Initialize
11206 data_segment_align_index_ and saw_relro_end_.
11207 (Script_sections::data_segment_align): New function.
11208 (Script_sections::data_segment_relro_end): New function.
11209 (Script_sections::place_orphan): Set or clear is_relro.
11210 (Script_sections::set_section_addresses): Force alignment of first
11212 * yyscript.y (exp): Call script_data_segment_align and
11213 script_data_segment_relro_end.
11214 * testsuite/relro_script_test.t: New file.
11215 * testsuite/relro_test.cc (using_script): Declare.
11216 (t1, t2): Test using_script.
11217 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11218 (relro_script_test_SOURCES): Define.
11219 (relro_script_test_DEPENDENCIES): Define.
11220 (relro_script_test_LDFLAGS): Define.
11221 (relro_script_test_LDADD): Define.
11222 (relro_script_test.so): New target.
11223 * testsuite/Makefile.in: Rebuild.
11225 2008-08-06 Cary Coutant <ccoutant@google.com>
11227 * archive.cc (Archive::total_archives, Archive::total_members)
11228 (Archive::total_members_loaded): New variables.
11229 (Archive::setup): Add parameter. Add option to preread
11231 (Archive::read_armap): Add counter.
11232 (Archive::get_file_and_offset): New function.
11233 (Archive::get_elf_object_for_member): New function.
11234 (Archive::read_all_symbols): New function.
11235 (Archive::read_symbols): New function.
11236 (Archive::add_symbols): Add counters.
11237 (Archive::include_all_members): Use armap to find members if it's
11239 (Archive::include_member): Skip reading symbols if already read.
11240 Factored code into Archive::get_file_and_offset and
11241 Archive::get_elf_object_for_member. Changed call to
11242 Mapfile::report_include_archive_member.
11243 (Archive::print_stats): New function.
11244 * archive.h: Declare Object and Read_symbols_data classes.
11245 (Archive::Archive): Add initializers for new members.
11246 (Archive::setup): Add parameter.
11247 (Archive::print_stats): New function.
11248 (Archive::total_archives, Archive::total_members)
11249 (Archive::total_members_loaded): New variables.
11250 (Archive::get_file_and_offset): New function.
11251 (Archive::get_elf_object_for_member): New function.
11252 (Archive::read_all_symbols): New function.
11253 (Archive::read_symbols): New function.
11254 (Archive::Archive_member): New class.
11255 (Archive::members_): New member.
11256 (Archive::num_members_): New member.
11257 * main.cc: Include archive.h.
11258 (main): Call Archive::print_stats.
11259 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11260 archive parameter; member_name is now the fully-decorated name.
11261 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11262 * options.h: (General_options): Add --preread-archive-symbols option.
11263 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11266 2008-08-04 Ian Lance Taylor <iant@google.com>
11268 * symtab.h (Symbol::use_plt_offset): New function.
11269 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11270 * powerpc.cc (Relocate::relocate): Likewise.
11271 * sparc.cc (Relocate::relocate): Likewise.
11272 * x86_64.cc (Relocate::relocate): Likewise.
11273 * testsuite/weak_plt.sh: New test.
11274 * testsuite/weak_plt_main.cc: New test.
11275 * testsuite/weak_plt_shared.cc: New test.
11276 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11277 (check_PROGRAMS): Add weak_plt.
11278 (check_DATA): Add weak_plt_shared.so.
11279 (weak_plt_main_pic.o, weak_plt): New targets.
11280 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11281 * testsuite/Makefile.in: Rebuild.
11283 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11285 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11286 * testsuite/Makefile.in: Rebuild.
11288 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11290 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11291 * Makefile.in: Regenerate.
11292 * po/POTFILES.in: Regenerate.
11294 2008-07-29 Ian Lance Taylor <iant@google.com>
11296 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11297 symbols before other symbols.
11298 * testsuite/script_test_2.cc (test_addr): Declare.
11299 (test_addr_alias): Declare.
11300 (main): Check that test_addr and test_addr_alias have the right
11302 * testsuite/script_test_2.t: Define test_addr_alias and
11305 2008-07-24 Ian Lance Taylor <iant@google.com>
11308 * descriptors.cc: New file.
11309 * descriptors.h: New file.
11310 * gold-threads.h (class Hold_optional_lock): New class.
11311 * fileread.cc: Include "descriptors.h".
11312 (File_read::~File_read): Release descriptor rather than closing
11314 (File_read::open) [file]: Call open_descriptor rather than open.
11315 Set is_descriptor_opened_.
11316 (File_read::open) [memory]: Assert that descriptor is not open.
11317 (File_read::reopen_descriptor): New function.
11318 (File_read::release): Release descriptor.
11319 (File_read::do_read): Make non-const. Reopen descriptor.
11320 (File_read::read): Make non-const.
11321 (File_read::make_view): Reopen descriptor.
11322 (File_read::do_readv): Likewise.
11323 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11324 Update declarations.
11325 * layout.cc: Include "descriptors.h".
11326 (Layout::create_build_id): Use open_descriptor rather than open.
11327 * output.cc: Include "descriptors.h".
11328 (Output_file::open): Use open_descriptor rather than open.
11329 * archive.cc (Archive::const_iterator): Change Archive to be
11331 (Archive::begin, Archive::end): Make non-const.
11332 (Archive::count_members): Likewise.
11333 * archive.h (class Archive): Update declarations.
11334 * object.h (Object::read): Make non-const.
11335 * Makefile.am (CCFILES): Add descriptors.cc.
11336 (HFILES): Add descriptors.h.
11337 * Makefile.in: Rebuild.
11340 * gold.h: Always include <clocale>. Add Solaris workarounds
11341 following code in binutils/sysdep.h.
11344 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11345 this->eh_frame_hdr_ is NULL before using it.
11347 * dynobj.cc (Versions::Versions): Update comment.
11349 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11350 the base version name.
11352 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11353 array size plus one.
11354 (Stringpool_template::set_string_offsets): Subtract one from key
11355 before using it as an array index.
11356 (Stringpool_template::get_offset_with_length): Likewise.
11357 (Stringpool_template::write_to_buffer): Likewise.
11358 * stringpool.h (Stringpool_template::get_offset_from_key):
11361 2008-07-23 Ian Lance Taylor <iant@google.com>
11364 * object.h (Merged_symbol_value::value): Do our best to handle a
11368 * script.cc (Version_script_info::get_versions): Don't add empty
11369 version tag to return value.
11370 (Version_script_info::get_symbol_version_helper): Change return
11371 type to bool. Add pversion parameter. Change all callers.
11372 (script_register_vers_node): Don't require a non-NULL tag.
11373 * script.h (class Version_script_info): Update declarations.
11374 (Version_script_info::get_symbol_version): Change return type to
11375 bool. Add version parameter. Change all callers.
11376 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11377 handling. Handle an empty version from a version script.
11378 (Symbol_table::define_special_symbol): Likewise.
11379 * testsuite/ver_test_10.script: New file.
11380 * testsuite/ver_test_10.sh: New file.
11381 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11382 (check_DATA): Add ver_test_10.syms.
11383 (ver_test_10.syms, ver_test_10.so): New target.
11384 * testsuite/Makefile.in: Rebuild.
11386 2008-07-23 Simon Baldwin <simonb@google.com>
11388 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11389 to zero for undefined symbols from dynamic libraries.
11391 2008-07-23 Ian Lance Taylor <iant@google.com>
11393 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11394 Change all callers.
11395 * symtab.h (class Symbol_table): Update declaration.
11396 * testsuite/ver_test_9.cc: New file.
11397 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11398 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11399 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11400 (ver_test_9.so, ver_test_9.o): New targets.
11401 * testsuite/Makefile.in: Rebuild.
11403 2008-07-22 Ian Lance Taylor <iant@google.com>
11405 * options.h (class General_options): Define --check-sections.
11406 * layout.cc (Layout::set_segment_offsets): Handle
11409 * options.h (class General_options): Define -n/--nmagic and
11411 * options.cc (General_options::finalize): For -n/--nmagic or
11412 -N/--omagic, set -static.
11413 * layout.cc (Layout::attach_allocated_section_to_segment): If
11414 -N/--omagic, don't put read-only and read-write sections in
11415 different segments.
11416 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11417 finding a read-only segment.
11418 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11419 don't set the minimum segment alignment to the common page size,
11420 and don't set the file offset to the address modulo the page size.
11421 * script-sections.cc (Script_sections::create_segments): If
11422 -n/--omagic, don't put read-only and read-write sections in
11423 different segments.
11425 * cref.cc: New file.
11426 * cref.h: New file.
11427 * options.h (class General_options): Add --print-symbol-counts.
11428 * main.cc (main): Issue defined symbol report if requested.
11429 * archive.cc (Archive::interpret_header): Make into a const member
11431 (Archive::add_symbols): Call Input_objects::archive_start and
11433 (Archive::const_iterator): Define new class.
11434 (Archive::begin, Archive::end): New functions.
11435 (Archive::include_all_members): Rewrite to use iterator.
11436 (Archive::count_members): New function.
11437 * archive.h (class Archive): Update declarations.
11438 (Archive::filename): New function.
11439 * object.cc: Include "cref.h".
11440 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11441 (Sized_relobj::do_get_global_symbol_counts): New function.
11442 (Input_objects::add_object): Add object to cross-referencer.
11443 (Input_objects::archive_start): New function.
11444 (Input_objects::archive_stop): New function.
11445 (Input_objects::print_symbol_counts): New function.
11446 * object.h: Declare Cref and Archive.
11447 (Object::get_global_symbol_counts): New function.
11448 (Object::do_get_global_symbol_counts): New pure virtual function.
11449 (class Sized_relobj): Add defined_count_ field. Update
11451 (class Input_objects): Add cref_ field. Update constructor.
11452 Update declarations.
11453 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11455 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11457 (Sized_dynobj::do_get_global_symbol_counts): New function.
11458 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11459 defined_count_. Update declarations. Define Symbols typedef.
11460 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11461 parameter. Change all callers.
11462 (Symbol_table::add_from_dynobj): Add sympointers and defined
11463 parameters. Change all callers.
11464 * symtab.h (class Symbol_table): Update declarations.
11465 * Makefile.am (CCFILES): Add cref.cc.
11466 (HFILES): Add cref.h.
11467 * Makefile.in: Rebuild.
11469 2008-07-22 Simon Baldwin <simonb@google.com>
11471 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11472 to zero when writing undefined symbols.
11474 2008-07-22 Ian Lance Taylor <iant@google.com>
11476 * output.cc (Output_section::add_input_section): Don't try to
11477 merge empty merge sections.
11479 2008-07-21 Craig Silverstein <csilvers@google.com>
11481 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11482 Include symbol version in error message.
11484 2008-07-20 Chris Demetriou <cgd@google.com>
11486 * configure.ac (gold_cv_c_random_seed): New configured variable.
11487 (RANDOM_SEED_CFLAGS): New substituted variable.
11488 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11489 * configure: Rebuild.
11490 * Makefile.in: Likewise.
11491 * testsuite/Makefile.in: Likewise.
11493 2008-07-18 Ian Lance Taylor <iant@google.com>
11495 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11496 where we see NAME/NULL and NAME/VERSION as separate symbols.
11497 * testsuite/ver_test_main.cc (main): Call t4.
11498 (t4, t4_2a): Define.
11499 * testsuite/ver_test_2.cc (t4_2): Define.
11500 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11501 * testsuite/ver_test_4.cc (t4_2a): Define.
11502 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11503 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11505 2008-07-17 Ian Lance Taylor <iant@google.com>
11507 * dynobj.cc (Versions::add_def): If we give an error about a
11508 missing version, go ahead and create the version anyhow.
11510 2008-07-10 Ian Lance Taylor <iant@google.com>
11512 Handle output sections with more than 0x7fffffff bytes.
11513 * object.h (class Relobj): Change map_to_output_ to
11514 output_sections_, and just keep a section pointer. Change all
11515 uses. Move comdat group support to Sized_relobj.
11516 (Relobj::is_section_specially_mapped): Remove.
11517 (Relobj::output_section): Remove poff parameter. Change all
11519 (Relobj::output_section_offset): New function.
11520 (Relobj::set_section_offset): Rewrite.
11521 (Relobj::map_to_output): Remove.
11522 (Relobj::output_sections): New function.
11523 (Relobj::do_output_section_offset): New pure virtual function.
11524 (Relobj::do_set_section_offset): Likewise.
11525 (class Sized_relobj): Add section_offsets_ field. Add comdat
11526 group support from Relobj. Update declarations.
11527 (Sized_relobj::get_output_section_offset): New function.
11528 (Sized_relobj::do_output_section_offset): New function.
11529 (Sized_relobj::do_set_section_offset): New function.
11530 * object.cc (Relobj::output_section_address): Remove.
11531 (Sized_relobj::Sized_relobj): Initialize new fields.
11532 (Sized_relobj::include_section_group): Cast find_kept_object to
11534 (Sized_relobj::include_linkonce_section): Likewise.
11535 (Sized_relobj::do_layout): Use separate arrays for output section
11537 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11539 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11540 output_sections and section_offsets.
11541 (Sized_relobj::write_local_symbols): Likewise.
11542 (map_to_kept_section): Compute output address directly.
11543 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11544 output_sections and section_offsets.
11545 (Sized_relobj::write_sections): Likewise.
11546 (Sized_relobj::relocate_sections): Likewise.
11547 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11548 * output.h (class Output_reloc): Update declarations. Change
11549 u2_.relobj to Sized_relobj*.
11550 (class Output_data_reloc): Change add functions to use
11552 * output.cc (Output_reloc::Output_reloc): Change relobj to
11554 (Output_reloc::local_section_offset): Change return type to
11555 Elf_Addr. Use get_output_section_offset.
11556 (Output_reloc::get_address): Likewise.
11557 (Output_section::is_input_address_mapped): Don't call
11558 is_section_specially_mapped.
11559 (Output_section::output_offset): Likewise.
11560 (Output_section::output_address): Likewise.
11561 (Output_section::starting_output_address): Likewise.
11562 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11563 parameter to Sized_relobj*.
11564 (Copy_relocs::need_copy_reloc): Likewise.
11565 (Copy_relocs::save): Likewise.
11566 * copy-relocs.h (class Copy_relocs): Update declarations.
11567 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11568 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11569 * target-reloc.h (relocate_for_relocatable): Change
11570 offset_in_output_section type to Elf_Addr. Change code that uses
11572 * layout.cc (Layout::layout): Always set *off.
11573 * mapfile.cc (Mapfile::print_input_section): Use
11574 output_section_offset.
11575 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11577 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11578 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11579 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11581 2008-07-03 Ian Lance Taylor <iant@google.com>
11583 * layout.cc (Layout::include_section): Do not discard unrecognized
11584 SHT_STRTAB sections.
11586 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11588 * script.cc (Lex::can_continue_name): Make '?' allowable in
11589 version-script names.
11590 * testsuite/version_script.map: Change glob pattern to use '?'
11592 2008-06-30 Manish Singh <yosh@gimp.org>
11595 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11598 2008-06-30 Ian Lance Taylor <iant@google.com>
11602 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11603 versions]: Don't try to read the value in the contents, since we
11604 don't use it. Use the template endianness when writing.
11606 2008-06-25 Cary Coutant <ccoutant@google.com>
11608 * fileread.cc (File_read::make_view): Assert on zero-length view.
11609 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11610 symbol table when there are no symbols to read.
11612 2008-06-23 Craig Silverstein <csilvers@google.com>
11614 * version.cc (version_string): Bump to 1.7
11616 2008-06-18 Craig Silverstein <csilvers@google.com>
11618 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11619 constant 0xFFFF to type Valtype.
11620 (Powerpc_relocate_functions::rel16_ha): Likewise.
11622 2008-06-17 Ian Lance Taylor <iant@google.com>
11624 * output.h (Output_section::Input_section): Initialize p2align_ to
11625 zero for Output_section_data constructors.
11626 (Output_section::Input_section::addralign): If not an input
11627 section, return the alignment of the Output_section_data.
11628 * testsuite/copy_test.cc: New file.
11629 * testsuite/copy_test_1.cc: New file.
11630 * testsuite/copy_test_2.cc: New file.
11631 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11632 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11633 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11634 (copy_test_1_pic.o, copy_test_1.so): New targets.
11635 (copy_test_2_pic.o, copy_test_2.so): New targets.
11636 * testsuite/Makefile.in: Rebuild.
11638 * script-sections.cc (Script_sections::place_orphan): Initialize
11639 local variable exact.
11641 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11643 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11645 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11646 David S. Miller <davem@davemloft.net>
11648 * powerpc.cc: New file.
11649 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11650 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11651 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11652 * Makefile.in: Rebuild.
11654 2008-06-09 Ian Lance Taylor <iant@google.com>
11656 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11658 (throwing, orig_terminate): New static variables.
11659 (terminate_handler): New static function.
11660 (t2): Set terminate handler.
11662 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11665 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11668 2008-05-30 Cary Coutant <ccoutant@google.com>
11670 * archive.cc (Archive::include_all_members) Correct to step
11671 over symbol table and extended name table in thin archives.
11673 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11676 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11679 2008-05-28 Caleb Howe <cshowe@google.com>
11681 * reduced_debug_output.cc: New file.
11682 * reduced_debug_output.h: New file.
11683 * options.h (class General_options): Add --strip-debug-non-line.
11684 * options.cc (General_options::finalize): Add strip_debug_non_line
11685 to the strip heirarchy.
11686 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11688 * layout.cc: Include "reduced_debug_output.h".
11689 (Layout::Layout): Initialize new fields.
11690 (line_only_debug_sections): New static array.
11691 (is_lines_only_debug_sections): New static inline function.
11692 (Layout::include_section): Handle --strip-debug-non-line.
11693 (Layout::make_output_section): If --strip-debug-non-line, build
11694 new output sections for .debug_abbrev and .debug_info.
11695 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11696 gold. Warn about possible overflow.
11697 (read_signed_LEB_128): Likewise.
11698 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11699 (read_signed_LEB_128): Declare.
11700 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11701 (HFILES): Add reduced_debug_output.h.
11702 * Makefile.in: Rebuild.
11704 2008-05-21 Ian Lance Taylor <iant@google.com>
11706 * mapfile.cc: New file.
11707 * mapfile.h: New file.
11708 * options.h (class General_options): Add -M/--print-map and -Map.
11709 * options.cc (General_options::finalize): Make -M equivalent to
11711 * main.cc: Include <cstdio> and "mapfile.h".
11712 (main): Open mapfile if requested.
11713 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11714 constructor. Change caller.
11715 (queue_initial_tasks): Add mapfile parameter. Change caller.
11716 (queue_middle_tasks): Likewise.
11717 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11719 * archive.cc: Include "mapfile.h".
11720 (Archive::add_symbols): Add mapfile parameter. Change all
11721 callers. Pass mapfile, symbol, and reason to include_member.
11722 (Archive::include_all_members): Add mapfile parameter. Change all
11724 (Archive::include_member): Add mapfile, sym, and why parameters.
11725 Change all callers. Report inclusion to map file.
11726 * archive.h: Include "fileread.h".
11727 (class Archive): Update declarations.
11728 (Archive::file): New const method.
11729 (class Add_archive_symbols): Add mapfile_ field. Update
11730 constructor. Change all callers.
11731 * readsyms.h (class Read_symbols): Likewise.
11732 (class Finish_group): Likewise.
11733 (class Read_script): Likewise.
11734 * common.cc: Include "mapfile.h".
11735 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11737 (Symbol_table::do_allocate_commons): Likewise.
11738 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11739 symbol allocation to mapfile.
11740 * common.h (class Allocate_commons_task): Add mapfile_ field.
11741 Update constructor. Change all callers.
11742 * symtab.h (class Symbol_table): Update declarations.
11743 * layout.cc: Include "mapfile.h".
11744 (Layout_task_runner::run): Print information to mapfile.
11745 (Layout::create_gold_note): Change Output_data_fixed_space to
11746 Output_data_zero_fill.
11747 (Layout::create_build_id): Likewise.
11748 (Layout::print_to_mapfile): New function.
11749 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11750 constructor. Change caller.
11751 (class Layout): Declare print_to_mapfile.
11752 * output.cc (Output_section::Input_section::print_to_mapfile): New
11754 (Output_section::add_input_section): If producing a map, always
11755 add to input_sections_ list.
11756 (Output_section::do_print_to_mapfile): New function.
11757 (Output_segment::print_sections_to_mapfile): New function.
11758 (Output_segment::print_section_list_to_mapfile): New function.
11759 * output.h: Include "mapfile.h".
11760 (Output_data::print_to_mapfile): New function.
11761 (Output_data::do_print_to_mapfile): New virtual function.
11762 (Output_segment_headers::do_print_to_mapfile): New function.
11763 (Output_file_header::do_print_to_mapfile): New function.
11764 (Output_data_const::do_print_to_mapfile): New function.
11765 (class Output_data_const_buffer): Add map_name_ field. Update
11766 constructor. Change all callers. Add do_print_to_mapfile
11768 (class Output_data_fixed_space): Likewise.
11769 (class Output_data_space): Likewise.
11770 (class Output_data_zero_fill): New class.
11771 (Output_data_strtab::do_print_to_mapfile): New function.
11772 (Output_data_reloc_base::do_print_to_mapfile): New function.
11773 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11774 (Output_data_group::do_print_to_mapfile): New function.
11775 (Output_data_got::do_print_to_mapfile): New function.
11776 (Output_data_dynamic::do_print_to_mapfile): New function.
11777 (Output_symtab_xindex::do_print_to_mapfile): New function.
11778 (class Output_section): Declare do_print_to_mapflie. Declare
11779 print_to_mapfile in Input_section.
11780 (class Output_segment): Declare new functions.
11781 * object.h (Sized_relobj::symbol_count): New function.
11782 * script-sections.cc
11783 (Output_section_element_dot_assignment::set_section_addresses):
11784 Change Output_data_fixed_space to Output_data_zero_fill.
11785 (Output_data_expression::do_print_to_mapfile): New function.
11786 * script.cc (read_input_script): Add mapfile parameter. Change
11788 * script.h (read_input_script): Update declaration.
11789 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11790 (Eh_frame::do_print_to_mapfile): New function.
11791 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11792 (Output_merge_string::do_print_to_mapfile): New function.
11793 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11795 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11797 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11799 * Makefile.am (CCFILES): Add mapfile.cc.
11800 (HFILES): Add mapfile.h.
11801 * Makefile.in: Rebuild.
11803 2008-05-19 Ian Lance Taylor <iant@google.com>
11805 * options.h (class General_options): Add -z relro.
11806 * layout.cc (Layout::Layout): Initialize relro_segment_.
11807 (Layout::add_output_section_data): Return the output section.
11808 (Layout::make_output_section): Rcognize relro sections and mark
11809 them appropriately.
11810 (Layout::attach_allocated_section_to_segment): Put relro sections
11811 in a PT_GNU_RELRO segment.
11812 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11814 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11816 (Layout::linkonce_mapping): Map d.rel.ro.local to
11817 .data.rel.ro.local.
11818 (Layout::output_section_name): Us .data.rel.ro.local for any
11819 section which begins with that.
11820 * layout.h (class Layout): Update add_output_section_data
11821 declaration. Add relro_segment_ field.
11822 * output.cc (Output_section::Output_section): Initialize is_relro_
11823 and is_relro_local_ fields.
11824 (Output_segment::add_output_section): Group relro sections.
11825 (Output_segment::is_first_section_relro): New function.
11826 (Output_segment::maximum_alignment): If there is a relro section,
11827 align the segment to the common page size.
11828 (Output_segment::set_section_addresses): Track whether we are
11829 looking at relro sections. If the last section is a relro
11830 section, align to the common page size.
11831 (Output_segment::set_section_list_addresses): Add in_relro
11832 parameter. Change all callers. Align to the page size when
11833 moving from relro to non-relro section.
11834 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11836 * output.h (class Output_section): Add is_relro_ and
11837 is_relro_local_ fields.
11838 (Output_section::is_relro): New function.
11839 (Output_section::set_is_relro): New function.
11840 (Output_section::is_relro_local): New function.
11841 (Output_section::set_is_relro_local): New function.
11842 (class Output_segment): Update declarations.
11843 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11844 * sparc.cc (Target_sparc::got_section): Likewise.
11845 * x86_64.cc (Target_x86_64::got_section): Likewise.
11846 * testsuite/relro_test_main.cc: New file.
11847 * testsuite/relro_test.cc: New file.
11848 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11849 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11850 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11851 (relro_test.so, relro_test_pic.o): New targets.
11852 * testsuite/Makefile.in: Rebuild.
11854 2008-05-16 Ian Lance Taylor <iant@google.com>
11856 * output.cc (Output_segment::add_output_section): Remove front
11858 * output.h (class Output_segment): Remove
11859 add_initial_output_section and overloaded add_output_section.
11860 Update declaration of remaining add_output_section.
11861 * layout.cc (Layout::create_interp): Call add_output_section
11862 rather than add_initial_output_section.
11863 (Layout::finish_dynamic_section): Likewise.
11865 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11866 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11867 know the dynamic type.
11868 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11869 field. Initialize it in constructor.
11870 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11871 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11872 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11875 * output.cc (Output_reloc::get_address): Change return type to
11877 * output.h (class Output_reloc): Update get_address declaration.
11878 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11879 for section addresses.
11881 2008-05-09 Ian Lance Taylor <iant@google.com>
11884 * gold.cc (gold_nomem): Use return value of write.
11886 2008-05-08 Ian Lance Taylor <iant@google.com>
11888 * symtab.c (Symbol::init_base_output_data): Add version
11889 parameter. Change all callers.
11890 (Symbol::init_base_output_segment): Likewise.
11891 (Symbol::init_base_constant): Likewise.
11892 (Symbol::init_base_undefined): Likewise.
11893 (Sized_symbol::init_output_data): Likewise.
11894 (Sized_symbol::init_output_segment): Likewise.
11895 (Sized_symbol::init_constant): Likewise.
11896 (Sized_symbol::init_undefined): Likewise.
11897 (Symbol_table::do_define_in_output_data): If the new symbol has a
11898 version, mark it as the default.
11899 (Symbol_table::do_define_in_output_segment): Likewise.
11900 (Symbol_table::do_define_as_constant): Likewise.
11901 * symtab.h (class Symbol): Update declarations.
11902 (class Sized_symbol): Likewise.
11903 * resolve.cc (Symbol::override_version): New function.
11904 (Symbol::override_base): Call override_version.
11905 (Symbol::override_base_with_special): Likewise.
11906 * testsuite/ver_script_8.script: New file.
11907 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11908 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11909 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11910 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11912 2008-05-06 Ian Lance Taylor <iant@google.com>
11915 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11917 (class General_options): Remove existing --undefined, and add
11918 --no-undefined instead. Add new --undefined as synonym for -u.
11919 * archive.cc (Archive::add_symbols): Check whether symbol was
11921 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11922 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11923 all uses. Add IS_UNDEFINED. Update declarations to split
11924 different versions of init_base. Declare init_base_undefined.
11925 (Symbol::is_defined): Handle IS_UNDEFINED.
11926 (Symbol::is_undefined): Likewise.
11927 (Symbol::is_weak_undefined): Call is_undefined.
11928 (Symbol::is_absolute): Handle IS_CONSTANT.
11929 (class Sized_symbol): Update declarations to split different
11930 versions of init. Declare init_undefined.
11931 (class Symbol_table): Declare new functions.
11932 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11933 Change all callers.
11934 (Symbol::init_base_output_data): Likewise.
11935 (Symbol::init_base_output_segment): Likewise.
11936 (Symbol::init_base_constant): Likewise.
11937 (Symbol::init_base_undefined): New function.
11938 (Sized_symbol::init_object): Rename from init. Change all
11940 (Sized_symbol::init_output_data): Likewise.
11941 (Sized_symbol::init_output_segment): Likewise.
11942 (Sized_symbol::init_constant): Likewise.
11943 (Sized_symbol::init_undefined): New function.
11944 (Symbol_table::add_undefined_symbols_from_command_line): New
11946 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11948 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11949 (Symbol::output_section): Likewise.
11950 (Symbol::set_output_section): Likewise.
11951 (Symbol_table::sized_finalize_symbol): Likewise.
11952 (Symbol_table::sized_write_globals): Likewise.
11953 * resolve.cc (Symbol_table::should_override): Likewise.
11954 (Symbol::override_base_with_special): Likewise.
11956 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11957 symbol, change it to have default visibility.
11958 * testsuite/protected_1.cc: New file.
11959 * testsuite/protected_2.cc: New file.
11960 * testsuite/protected_3.cc: New file.
11961 * testsuite/protected_main_1.cc: New file.
11962 * testsuite/protected_main_2.cc: New file.
11963 * testsuite/protected_main_3.cc: New file.
11964 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11965 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11966 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11967 (protected_1.so): New target.
11968 (protected_1_pic.o, protected_2_pic.o): New targets.
11969 (protected_3_pic.o): New target.
11970 (check_PROGRAMS): Add protected_2.
11971 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11972 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11973 * testsuite/Makefile.in: Rebuild.
11975 * options.h (DEFINE_var): Add set_user_set_##varname__.
11976 (DEFINE_bool_alias): New macro.
11977 (class General_options): Define -Bstatic using DEFINE_bool_alias
11978 rather than DEFINE_special. Add --undefined as an alias for -z
11980 * options.cc (General_options::parse_Bstatic): Remove.
11982 * options.h (class General_options): Add --fatal-warnings.
11983 * main.cc (main): Implement --fatal-warnings.
11984 * errors.h (Errors::warning_count): New function.
11986 * options.h (class General_options): Add -Bsymbolic-functions.
11987 * symtab.h (Symbol::is_preemptible): Check for
11988 -Bsymbolic-functions.
11990 2008-05-05 Ian Lance Taylor <iant@google.com>
11992 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11993 as noVARNAME rather than no-VARNAME.
11994 (class General_options): Add option -z combreloc.
11995 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11997 (Output_reloc::sort_before) [SHT_REL]: New function.
11998 (Output_reloc::sort_before) [SHT_RELA]: New function.
11999 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12000 Sort_relocs_comparison.
12001 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12002 parameter. Change all callers.
12003 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12004 sort_relocs parameter. Change all callers.
12005 * output.cc (Output_reloc::get_address): New function, broken out
12007 (Output_reloc::write_rel): Call it.
12008 (Output_reloc::compare): New function.
12009 (Output_data_reloc_base::do_write): Optionally sort relocs.
12011 * configure.ac: If targ_extra_obj is set, link it in.
12012 * configure.tgt: Initialize all variables.
12013 (x86_64*): Set targ_extra_obj and targ_extra_size.
12014 * configure: Rebuild.
12016 * object.cc (Sized_relobj::include_section_group): Adjust section
12017 indexes read from group data. Build vector to pass to
12019 * layout.cc (Layout::layout_group): Add flags and shndxes
12020 parameters. Remove contents parameter. Change caller. Update
12021 explicit instantiations.
12022 * layout.h (class Layout): Update layout_group declaration.
12023 * output.cc (Output_data_group::Output_data_group): Add flags and
12024 input_shndxes parameters. Remove contents parameter. Change
12026 (Output_data_group::do_write): Change input_sections_ to
12028 * output.h (class Output_data_group): Update constructor
12029 declaration. Rename input_sections_ to input_shndxes_.
12030 * testsuite/many_sections_test.cc: Add template.
12032 2008-04-30 Cary Coutant <ccoutant@google.com>
12034 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12036 * layout.cc (Layout::include_section): Refactored check for debug
12038 (Layout::add_comdat): Add new parameters. Change type
12039 of signature parameter. Add object and shndx to signatures table.
12040 (Layout::find_kept_object): New function.
12041 * layout.h: Include <cstring>.
12042 (Layout::is_debug_info_section): New function.
12043 (Layout::add_comdat): Add new parameters.
12044 (Layout::find_kept_object): New function.
12045 (Layout::Kept_section): New struct.
12046 (Layout::Signatures): Change type of map range.
12047 * object.cc (Relobj::output_section_address): New function.
12048 (Sized_relobj::include_section_group): Add new parameters. Change
12049 calls to Layout::add_comdat. Change to build table of kept comdat
12050 groups and table mapping discarded sections to kept sections.
12051 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12052 (Sized_relobj::do_layout): Change calls to include_section_group and
12053 include_linkonce_section.
12054 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12055 value to zero when section is discarded.
12056 (Sized_relobj::map_to_kept_section): New function.
12057 * object.h (Relobj::output_section_address): New function.
12058 (Relobj::Comdat_group): New type.
12059 (Relobj::find_comdat_group): New function.
12060 (Relobj::Comdat_group_table): New type.
12061 (Relobj::Kept_comdat_section): New type.
12062 (Relobj::Kept_comdat_section_table): New type.
12063 (Relobj::add_comdat_group): New function.
12064 (Relobj::set_kept_comdat_section): New function.
12065 (Relobj::get_kept_comdat_section): New function.
12066 (Relobj::comdat_groups_): New field.
12067 (Relobj::kept_comdat_sections_): New field.
12068 (Symbol_value::input_value): Update comment.
12069 (Sized_relobj::map_to_kept_section) New function.
12070 (Sized_relobj::include_linkonce_section): Add new parameter.
12071 * target-reloc.h (Comdat_behavior): New type.
12072 (get_comdat_behavior): New function.
12073 (relocate_section): Add code to map a discarded section to the
12074 corresponding kept section when applying a relocation.
12076 2008-04-30 Craig Silverstein <csilvers@google.com>
12078 * dwarf_reader.cc (next_generation_count): New static var.
12079 (Addr2line_cache_entry): New struct.
12080 (addr2line_cache): New static var.
12081 (Dwarf_line_info::one_addr2line): Added caching.
12082 (Dwarf_line_info::clear_addr2line_cache): New function.
12083 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12084 cache-size parameter.
12085 (Dwarf_line_info::one_addr2line_cache): New function.
12086 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12087 new cache-size argument to one_addr2line(), and clear cache.
12089 2008-04-28 Cary Coutant <ccoutant@google.com>
12091 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12092 R_386_PC8 relocations.
12094 2008-04-23 Ian Lance Taylor <iant@google.com>
12096 * object.cc (Sized_relobj::include_section_group): Check for
12097 invalid section group.
12099 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12102 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12103 than read for file header.
12104 * archive.cc (Archive::include_member): Likewise.
12106 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12108 * aclocal.m4: Regenerate.
12109 * configure: Regenerate.
12111 2008-04-19 Ian Lance Taylor <iant@google.com>
12113 * version.cc (version_string): Bump to 1.6.
12115 * testsuite/Makefile.am (many_sections_r_test): New target.
12116 (many_sections_r_test_SOURCES): Remove.
12117 (many_sections_r_test_DEPENDENCIES): Remove.
12118 (many_sections_r_test_LDFLAGS): Remove.
12119 (many_sections_r_test_LDADD): Remove.
12121 * object.cc (Sized_relobj::do_add_symbols): Always pass
12122 local_symbol_count_ to add_from_relobj.
12124 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12125 every thousand variables.
12126 * testsuite/Makefile.in: Rebuild.
12128 * object.cc (Xindex::initialize_symtab_xindex): New function.
12129 (Xindex::read_symtab_xindex): New function.
12130 (Xindex::sym_xindex_to_shndx): New function.
12131 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12133 (Sized_relobj::do_initialize_xindex): New function.
12134 (Sized_relobj::do_read_symbols): Adjust section links.
12135 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12136 parameter. Change all callers.
12137 (Sized_relobj::include_section_group): Adjust section links and
12138 symbol section indexes.
12139 (Sized_relobj::do_layout): Adjust section links.
12140 (Sized_relobj::do_count_local_symbols): Adjust section links and
12141 symbol section indexes.
12142 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12143 ordinary and special symbols.
12144 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12145 dynsym_xindex parameters. Change all callers. Adjust section
12146 links. Use SHN_XINDEX when needed.
12147 (Sized_relobj::get_symbol_location_info): Adjust section links.
12148 Don't get fooled by special symbols.
12149 * object.h (class Xindex): Define.
12150 (class Object): Add xindex_ parameter. Declare virtual functoin
12151 do_initialize_xindex.
12152 (Object::adjust_sym_shndx): New function.
12153 (Object::set_xindex): New protected function.
12154 (class Symbol_value): Add is_ordinary_shndx_ field.
12155 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12156 (Symbol_value::value): Assert ordinary section.
12157 (Symbol_value::initialize_input_to_output_map): Likewise.
12158 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12159 Change all callers.
12160 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12162 (class Sized_relobj): Update declarations.
12163 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12164 parameter. Change all callers.
12165 (Sized_relobj::adjust_shndx): New function.
12166 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12168 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12169 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12170 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12171 (Sized_dynobj::read_dynsym_section): Adjust section links.
12172 (Sized_dynobj::read_dynamic): Likewise.
12173 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12175 (Sized_dynobj::do_initialize_xindex): New function.
12176 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12177 do_initialize_xindex.
12178 (Sized_dynobj::adjust_shndx): New function.
12179 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12180 dynsym_xindex_ fields.
12181 (Layout::finalize): Add a call to set_section_indexes before
12182 creating the symtab sections.
12183 (Layout::set_section_indexes): Don't do anything if the section
12184 already has a section index.
12185 (Layout::create_symtab_sections): Add shnum parameter. Change
12186 caller. Create .symtab_shndx section if needed.
12187 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12189 (Layout::allocated_output_section_count): New function.
12190 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12192 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12193 fields. Update declarations.
12194 (Layout::symtab_xindex): New function.
12195 (Layout::dynsym_xindex): New function.
12196 (class Write_symbols_task): Add layout_ field.
12197 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12199 * output.cc (Output_section_headers::Output_section_headers): Add
12200 shstrtab_section parameter. Change all callers.
12201 (Output_section_headers::do_sized_write): Store overflow values
12202 for section count and section string table section index in
12203 section header zero.
12204 (Output_file_header::do_sized_write): Check for overflow of
12205 section count and section string table section index.
12206 (Output_symtab_xindex::do_write): New function.
12207 (Output_symtab_xindex::endian_do_write): New function.
12208 * output.h (class Output_section_headers): Add shstrtab_section_.
12209 Update declarations.
12210 (class Output_symtab_xindex): Define.
12211 (Output_section::has_out_shndx): New function.
12212 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12214 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12215 Change all callers.
12216 (Sized_symbol::init): Likewise.
12217 (Symbol::output_section): Check for ordinary symbol.
12218 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12219 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12221 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12222 Change all callers. Simplify handling of symbols from sections
12223 not included in the link.
12224 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12226 (Weak_alias_sorter::operator()): Assert that symbols are
12228 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12230 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12231 parameters. Change all callers.
12232 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12233 symbol distinction. Use SHN_XINDEX when needed.
12234 (Symbol_table::write_section_symbol): Add symtab_xindex
12235 parameter. Change all callers.
12236 (Symbol_table::sized_write_section_symbol): Likewise. Use
12237 SHN_XINDEX when needed.
12238 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12240 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12241 (Symbol::is_defined): Check is_ordinary.
12242 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12243 (Symbol::is_absolute, Symbol::is_common): Likewise.
12244 (class Sized_symbol): Update declarations.
12245 (class Symbol_table): Update declarations.
12246 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12247 parameters. Change all callers.
12248 (Sized_symbol::override): Likewise.
12249 (Symbol_table::override): Likewise.
12250 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12251 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12252 is_ordinary, and orig_st_shndx parameters. Change all callers.
12253 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12254 to be in an ordinary section.
12255 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12256 object and is_ordinary parameters. Change all callers.
12257 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12258 Change all callers. Don't add undefined or non-ordinary symbols
12260 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12261 Change all callers.
12262 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12264 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12265 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12266 (Sized_relobj::relocate_sections): Likewise.
12267 * target-reloc.h (scan_relocs): Adjust section symbol index.
12268 (scan_relocatable_relocs): Likewise.
12269 * i386.cc (Scan::local): Check for ordinary symbols.
12270 * sparc.cc (Scan::local): Likewise.
12271 * x86_64.cc (Scan::local): Likewise.
12272 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12273 to symbol_section_and_value.
12274 * testsuite/many_sections_test.cc: New file.
12275 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12276 (check_PROGRAMS): Add many_sections_test.
12277 (many_sections_test_SOURCES): Define.
12278 (many_sections_test_DEPENDENCIES): Define.
12279 (many_sections_test_LDFLAGS): Define.
12280 (BUILT_SOURCES): Add many_sections_define.h.
12281 (many_sections_define.h): New target.
12282 (BUILT_SOURCES): Add many_sections_check.h.
12283 (many_sections_check.h): New target.
12284 (check_PROGRAMS): Add many_sections_r_test.
12285 (many_sections_r_test_SOURCES): Define.
12286 (many_sections_r_test_DEPENDENCIES): Define.
12287 (many_sections_r_test_LDFLAGS): Define.
12288 (many_sections_r_test_LDADD): Define.
12289 (many_sections_r_test.o): New target.
12290 * testsuite/Makefile.in: Rebuild.
12292 2008-04-17 Cary Coutant <ccoutant@google.com>
12294 * errors.cc (Errors::info): New function.
12295 (gold_info): New function.
12296 * errors.h (Errors::info): New function.
12297 * gold.h (gold_info): New function.
12298 * object.cc (Input_objects::add_object): Print trace output.
12299 * options.cc (options::parse_set): New function.
12300 (General_options::parse_wrap): Deleted.
12301 (General_options::General_options): Deleted initializer.
12302 * options.h (options::String_set): New typedef.
12303 (options::parse_set): New function.
12304 (DEFINE_set): New macro.
12305 (General_options::wrap): Changed to use DEFINE_set. Changed
12306 callers of any_wrap_symbols and is_wrap_symbol.
12307 (General_options::trace, General_options::trace_symbol):
12309 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12310 (General_options::wrap_symbols_): Deleted.
12311 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12313 2008-04-17 David S. Miller <davem@davemloft.net>
12315 * options.cc (General_options::parse_V): New function.
12316 * options.h: Add entries for -V and -Qy.
12318 2008-04-17 Ian Lance Taylor <iant@google.com>
12320 * common.cc (Symbol_table::allocate_commons): Remove options
12321 parameter. Change caller.
12322 (Symbol_table::do_allocate_commons): Remove options parameter.
12323 Change caller. Just call do_allocate_commons_list twice.
12324 (Symbol_table::do_allocate_commons_list): New function, broken out
12325 of do_allocate_commons.
12326 * common.h (class Allocate_commons_task): Remove options_ field.
12327 Update constructor.
12328 * symtab.cc (Symbol_table::Symbol_table): Initialize
12330 (Symbol_table::add_from_object): Put TLS common symbols on
12332 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12333 which are IN_OUTPUT_DATA.
12334 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12335 allocate_commons and do_allocate_commons declarations. Declare
12336 do_allocate_commons_list.
12337 * gold.cc (queue_middle_tasks): Update creation of
12338 Allocate_commons_task to not pass options.
12339 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12340 (TLS_TEST_C_FLAGS): New variable.
12341 (tls_test_c_pic.o): New target.
12342 (tls_test_shared.so): Link in tls_test_c_pic.o.
12343 (tls_test_c_pic_ie.o): New target.
12344 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12345 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12346 (tls_test_c.o): New target.
12347 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12348 (tls_pic_test_LDADD): Likewise.
12349 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12350 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12351 (tls_test_c_gnu2.o): New target.
12352 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12354 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12355 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12356 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12357 * testsuite/tls_test.cc: Include "config.h".
12358 (t_last): Call t11_last.
12359 * testsuite/tls_test.h (t11, t11_last): Declare.
12360 * testsuite/tls_test_c.c: New file.
12361 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12362 * configure.ac: Check for OpenMP support.
12363 * configure, config.in, Makefile.in: Rebuild.
12364 * testsuite/Makefile.in: Rebuild.
12366 2008-04-16 Cary Coutant <ccoutant@google.com>
12368 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12369 (Target_i386::tls_base_symbol_defined_): New field.
12370 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12371 (Target_i386::Scan::global): Likewise.
12372 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12373 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12374 (Target_x86_64::tls_base_symbol_defined_): New field.
12375 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12376 (Target_x86_64::Scan::global): Likewise.
12378 2008-04-16 Cary Coutant <ccoutant@google.com>
12380 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12381 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12382 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12383 building shared libraries.
12384 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12385 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12386 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12387 * testsuite/Makefile.in: Rebuild.
12388 * testsuite/weak_undef.h: New file.
12389 * testsuite/weak_undef_file1.cc: Add extra test cases.
12390 * testsuite/weak_undef_file2.cc: Likewise.
12391 * testsuite/weak_undef_test.cc: Likewise.
12393 2008-04-16 David S. Miller <davem@davemloft.net>
12395 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12396 Add issued_non_pic_error_ field. Declare check_non_pic.
12397 (Target_sparc::Scan::check_non_pic): New function.
12398 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12399 (Target_sparc::Scan::global): Likewise.
12401 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12402 * configure: Rebuild.
12404 * options.h (DEFINE_enable): New macro.
12405 (new_dtags): New enable option.
12406 (initfirst, interpose, loadfltr, nodefaultlib,
12407 nodelete, nodlopen, nodump): New -z options.
12408 * layout.cc (Layout:finish_dynamic_section): If new
12409 dtags enabled, emit DT_RUNPATH. Also, emit a
12410 DT_FLAGS_1 containing any specified -z flags.
12412 2008-04-16 Ian Lance Taylor <iant@google.com>
12414 * copy-relocs.cc: New file.
12415 * copy-relocs.h: New file.
12416 * reloc.cc: Remove Copy_relocs code.
12417 * reloc.h: Likewise.
12418 * reloc-types.h (struct Reloc_types) [both versions]: Add
12419 get_reloc_addend_noerror.
12420 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12421 variants of add_global which take an addend which must be zero.
12422 * i386.cc: Include "copy-relocs.h".
12423 (class Target_i386): Change type of copy_relocs_ to variable,
12424 update initializer.
12425 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12426 Change all callers.
12427 (Target_i386::do_finalize_sections): Change handling of
12429 * sparc.cc: Include "copy-relocs.h".
12430 (class Target_sparc): Change type of copy_relocs_ to variable,
12431 update initializer.
12432 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12433 Change all callers.
12434 (Target_sparc::do_finalize_sections): Change handling of
12436 * x86_64.cc: Include "copy-relocs.h".
12437 (class Target_x86_64): Change type of copy_relocs_ to variable,
12438 update initializer.
12439 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12440 class. Change all callers.
12441 (Target_x86_64::do_finalize_sections): Change handling of
12443 * Makefile.am (CCFILES): Add copy-relocs.cc.
12444 (HFILES): Add copy-relocs.h.
12446 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12448 * testsuite/script_test_4.sh: Permit leading zeroes.
12450 2008-04-15 Ian Lance Taylor <iant@google.com>
12452 * script-sections.cc (Script_sections::create_segments): Use
12453 header_size_adjustment even when there is enough room for the
12455 * testsuite/script_test_4.sh: New file.
12456 * testsuite/script_test_4.t: New file.
12457 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12458 (check_DATA): Add script_test_4.stdout.
12459 (MOSTLYCLEANFILES): Likewise.
12460 (script_test_4): New target.
12461 (script_test_4.stdout): New target.
12462 * testsuite/Makefile.in: Rebuild.
12464 * sparc.cc: Add definitions for Output_data_plt_sparc class
12467 2008-04-14 David S. Miller <davem@davemloft.net>
12469 * sparc.cc: New file.
12470 * Makefile.am (TARGETSOURCES): Add sparc.cc
12471 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12472 * configure.tgt: Document targ_extra_size and
12473 targ_extra_big_endian. Add entries for sparc-* and
12475 * configure.ac: Handle targ_extra_size and
12476 targ_extra_big_endian.
12477 * Makefile.in: Rebuild.
12478 * configure: Likewise.
12479 * po/POTFILES.in: Likewise.
12480 * po/gold.pot: Likewise.
12482 2008-04-14 Ian Lance Taylor <iant@google.com>
12484 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12485 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12486 in the name/type/flags to section mapping. Don't call
12487 allocate_output_section.
12488 (Layout::choose_output_section): Change parameter from adjust_name
12489 to is_input_section. Don't permit input sections after sections
12490 are attached to segments. Don't call allocate_output_section.
12491 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12492 not write_enable_output_section.
12493 (Layout::make_output_section): Don't push to
12494 unattached_section_list_ nor call attach_to_segment. Call
12495 attach_section_to_segment if sections are attached.
12496 (Layout::attach_sections_to_segments): New function.
12497 (Layout::attach_section_to_segment): New function.
12498 (Layout::attach_allocated_section_to_segment): Rename from
12499 attach_to_segment. Remove flags parameter.
12500 (Layout::allocate_output_section): Remove function.
12501 (Layout::write_enable_output_section): Remove function.
12502 * layout.h (class Layout): Update for above changes. Add new
12503 field sections_are_attached_.
12504 * output.h (Output_section::update_flags_for_input_section): New
12506 * output.cc (Output_section::add_input_section): Call
12507 update_flags_for_input_section.
12508 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12510 2008-04-11 Cary Coutant <ccoutant@google.com>
12512 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12513 thought unnecessary.
12514 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12516 2008-04-11 Ian Lance Taylor <iant@google.com>
12518 * output.h (class Output_section_data): Remove inline definition
12520 * output.cc (Output_section_data::set_addralign): New function.
12522 2008-04-11 Cary Coutant <ccoutant@google.com>
12524 Add support for TLS descriptors for i386 and x86_64.
12525 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12526 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12527 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12529 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12530 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12531 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12533 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12534 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12535 Fix problem with initial-exec relocations.
12536 (Target_i386::Relocate::relocate_tls): Likewise.
12537 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12539 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12540 support for section-plus-offset dynamic table entries.
12541 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12542 (Output_data_dynamic::Dynamic_entry): Add support for
12543 section-plus-offset dynamic table entries.
12544 (Output_data_dynamic::Classification): Likewise.
12545 (Output_data_dynamic::classification_): Renamed offset_.
12546 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12547 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12548 (Target_x86_64::make_plt_section): New function.
12549 (Target_x86_64::reserve_tlsdesc_entries): New function.
12550 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12551 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12552 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12553 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12554 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12555 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12556 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12557 add extra PLT entry for TLS descriptors.
12558 (Output_data_plt_x86_64::got_): New field.
12559 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12560 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12562 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12564 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12565 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12566 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12567 R_386_TLS_DESC_CALL relocations.
12568 (Target_x86_64::Scan::global): Likewise.
12569 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12570 for TLS descriptors.
12571 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12572 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12573 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12574 GD-to-IE relaxation.
12575 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12576 and TLS_DESCRIPTORS.
12577 * Makefile.in: Rebuild.
12578 * configure: Rebuild.
12579 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12580 (tls_test_shared2.so): New target.
12581 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12582 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12583 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12584 (tls_shared_gd_to_ie_test_LDADD): New variable.
12585 (tls_shared_gnu2_gd_to_ie_test): New target.
12586 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12588 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12589 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12590 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12591 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12592 (tls_shared_gnu2_test): New target.
12593 (tls_test_gnu2_shared.so): New target.
12594 (tls_shared_gnu2_test_SOURCES): New variable.
12595 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12596 (tls_shared_gnu2_test_LDFLAGS): New variable.
12597 (tls_shared_gnu2_test_LDADD): New variable.
12598 * testsuite/Makefile.in: Rebuild.
12599 * testsuite/Makefile.
12601 2008-04-11 Ian Lance Taylor <iant@google.com>
12603 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12605 * testsuite/Makefile.in: Rebuild.
12607 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12609 * testsuite/script_test_2.cc (main): Adjust test.
12611 2008-04-11 David S. Miller <davem@davemloft.net>
12612 Ian Lance Taylor <iant@google.com>
12614 * options.h (General_options): Add entries for '-Y' and
12616 * options.cc (General_options:finalize): If -Y was used, add those
12617 entries to the library path instead of the default "/lib" and
12620 2008-04-11 David S. Miller <davem@davemloft.net>
12622 * testsuite/justsyms.t: Start at 0x100.
12623 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12624 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12626 * testsuite/script_test_2.cc: Adjust string and section length
12629 2008-04-09 Ian Lance Taylor <iant@google.com>
12632 * script-sections.cc (Sections_element::allocate_to_segment): Add
12634 (Output_section_definition::allocate_to_segment): Likewise.
12635 (Orphan_output_section::allocate_to_segment): Likewise.
12636 (Script_sections::attach_sections_using_phdrs_clause): Don't
12637 propagate non-PT_LOAD segments to orphan sections.
12638 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12639 readelf rather than objdump.
12640 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12641 .interp section and PT_INTERP segment are the same size.
12642 * testsuite/Makefile.in: Rebuild.
12644 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12645 aliases for symbols defined in the same object.
12646 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12647 (weak_alias_test_SOURCES): New variable.
12648 (weak_alias_test_DEPENDENCIES): New variable.
12649 (weak_alias_test_LDFLAGS): New variable.
12650 (weak_alias_test_LDADD): New variable.
12651 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12652 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12653 (weak_alias_test_3.o): New target.
12654 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12655 * testsuite/weak_alias_test_main.cc: New file.
12656 * testsuite/weak_alias_test_1.cc: New file.
12657 * testsuite/weak_alias_test_2.cc: New file.
12658 * testsuite/weak_alias_test_3.cc: New file.
12660 2008-04-08 Ian Lance Taylor <iant@google.com>
12662 * options.h (class General_options): Add --noinhibit-exec option.
12663 * main.cc (main): Check --noinhibit-exec.
12665 * options.h (class General_options): Define --wrap as a special
12666 option. Add wrap_symbols_ field.
12667 (General_options::any_wrap_symbols): New function.
12668 (General_options::is_wrap_symbol): New function.
12669 * options.cc (General_options::parse_wrap): New function.
12670 (General_options::General_options): Initialize wrap_symbols_.
12671 * symtab.cc (Symbol_table::wrap_symbol): New function.
12672 (Symbol_table::add_from_object): Handle --wrap.
12673 * symtab.h (class Symbol_table): Declare wrap_symbol.
12674 * target.h (Target::wrap_char): New function.
12675 (Target::Target_info): Add wrap_char field.
12676 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12677 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12678 * testsuite/testfile.cc (Target_test::test_target_info):
12681 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12684 * layout.h (class Layout): Add added_eh_frame_data_ field.
12685 * layout.cc (Layout::Layout): Initialize new field.
12686 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12687 output section until we find a section we merged successfully.
12688 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12689 that the size be non-zero.
12691 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12694 2008-04-08 Craig Silverstein <csilvers@google.com>
12696 * configure.ac: Export new conditional variable HAVE_ZLIB.
12697 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12699 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12700 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12702 2008-04-07 Ian Lance Taylor <iant@google.com>
12704 * version.cc (version_string): Set to "1.5".
12706 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12707 Add issued_non_pic_error_ field. Declare check_non_pic.
12708 (Target_x86_64::Scan::check_non_pic): New function.
12709 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12710 (Target_x86_64::Scan::global): Likewise.
12712 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12713 addend parameter. Change caller. Handle merge sections.
12714 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12715 Address to Addend. Don't add in the result of
12716 local_section_offset, pass down the addend and use the returned
12718 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12719 Update declarations of local_section_offset and symbol_value.
12720 * testsuite/two_file_test_1.cc (t18): New function.
12721 * testsuite/two_file_test_2.cc (f18): New function.
12722 * testsuite/two_file_test_main.cc (main): Call t18.
12723 * testsuite/two_file_test.h (t18, f18): Declare.
12725 * configure.ac: Don't test for objdump, c++filt, or readelf.
12726 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12728 (TEST_READELF): New variable.
12729 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12730 (check_PROGRAMS): Add two_file_strip_test.
12731 (two_file_strip_test): New target.
12732 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12733 (two_file_same_shared_strip_test_SOURCES): New variable.
12734 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12735 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12736 (two_file_same_shared_strip_test_LDADD): New variable.
12737 (two_file_shared_strip.so): New target.
12738 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12739 (ver_test_5.syms, ver_test_7.syms): Likewise.
12740 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12741 (strip_test_3.stdout): Use TEST_OBJDUMP.
12742 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12744 2008-04-04 Cary Coutant <ccoutant@google.com>
12746 * symtab.h (Symbol::is_weak_undefined): New function.
12747 (Symbol::is_strong_undefined): New function.
12748 (Symbol::is_absolute): New function.
12749 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12750 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12752 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12753 (weak_undef_test): New target.
12754 * testsuite/Makefile.in: Rebuild.
12755 * testsuite/weak_undef_file1.cc: New file.
12756 * testsuite/weak_undef_file2.cc: New file.
12757 * testsuite/weak_undef_test.cc: New file.
12759 2008-04-03 Craig Silverstein <csilvers@google.com>
12761 * compressed_output.h (class Output_compressed_section): Use
12763 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12765 (zlib_compressed_suffix): Removed.
12766 (Output_compressed_section::set_final_data_size): Use unsigned
12768 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12769 Fix linker invocation.
12770 (flagstest_o_specialfile_and_compress_debug_sections):
12772 * testsuite/Makefile.in: Regenerated.
12774 2008-04-02 David S. Miller <davem@davemloft.net>
12776 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12777 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12779 2008-04-02 Craig Silverstein <csilvers@google.com>
12783 2008-04-02 Ian Lance Taylor <iant@google.com>
12785 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12786 parameters. Update for new key type to views_. Change all
12788 (File_read::read): Adjust for byteshift in returned view.
12789 (File_read::add_view): New function, broken out of
12790 find_and_make_view.
12791 (File_read::make_view): New function, broken out of
12792 find_and_make_view.
12793 (File_read::find_or_make_view): Add offset and aligned
12794 parameters. Rewrite accordingly. Change all callers.
12795 (File_read::get_view): Add offset and aligned parameters. Adjust
12796 for byteshift in return value.
12797 (File_read::get_lasting_view): Likewise.
12798 * fileread.h (class File_read): Update declarations.
12799 (class File_read::View): Add byteshift_ field. Add byteshift to
12800 constructor. Add byteshift method.
12801 * archive.h (Archive::clear_uncached_views): New function.
12802 (Archive::get_view): Add aligned parameter. Change all callers.
12803 * object.h (Object::get_view): Add aligned parameter. Change all
12805 (Object::get_lasting_view): Likewise.
12807 * fileread.cc (File_read::release): Don't call clear_views if
12808 there are multiple objects.
12809 * fileread.h (File_read::clear_uncached_views): New function.
12810 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12813 2008-03-31 Cary Coutant <ccoutant@google.com>
12815 Add thin archive support.
12816 * archive.cc (Archive::armagt): New const.
12817 (Archive::setup): Remove task parameter and calls to unlock.
12818 (Archive::unlock_nested_archives): New function.
12819 (Archive::read_header): Add nested_off parameter. Change
12821 (Archive::interpret_header): Likewise.
12822 (Archive::include_all_members): Change to handle thin
12824 (Archive::include_member): Likewise.
12825 * archive.h (Archive::Archive): Add new parameters and
12827 (Archive::armagt): New const.
12828 (Archive::setup): Remove task parameter.
12829 (Archive::unlock_nested_archives): New function.
12830 (Archive::read_header): Add nested_off parameter.
12831 (Archive::interpret_header): Likewise.
12832 (Archive::Nested_archive_table): New typedef.
12833 (Archive::is_thin_archive_): New field.
12834 (Archive::nested_archives_): New field.
12835 (Archive::options_): New field.
12836 (Archive::dirpath_): New field.
12837 (Archive::task_): New field.
12838 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12839 for thin archives. Pass additional parameters to
12840 Archive::Archive. Unlock the archive file after calling
12843 2008-03-29 Ian Lance Taylor <iant@google.com>
12845 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12846 version symbol to be local.
12847 * testsuite/ver_test_4.sh: New file.
12848 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12849 (check_DATA): Add ver_test_4.syms.
12850 (ver_test_4.syms): New target.
12851 * testsuite/Makefile.in: Rebuild.
12854 (Output_section::Input_section_sort_entry::has_priority): New
12856 (Output_section::Input_section_sort_entry::match_file_name): New
12858 (Output_section::Input_section_sort_entry::match_section_name):
12860 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12862 (Output_section::Input_section_sort_entry::match_section_file):
12864 (Output_section::Input_section_sort_compare::operator()): Rewrite
12865 using new Input_section_sort_entry functions. Sort crtbegin and
12866 crtend first. Sort sections with no priority before sections with
12868 * testsuite/initpri1.c (d3): Check j != 4.
12869 (cd5): New constructor/destructor function.
12870 (main): Check j != 2.
12872 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12873 new symbol when resolving, don't call set_is_default.
12874 * testsuite/ver_test_7.cc: New file.
12875 * testsuite/ver_test_7.sh: New file.
12876 * testsuite/Makefile.am (ver_test_7.so): New target.
12877 (ver_test_7.o): New target.
12878 (check_SCRIPTS): Add ver_test_7.sh.
12879 (check_DATA): Add ver_test_7.syms.
12880 (ver_test_7.syms): New target.
12882 2008-03-28 Ian Lance Taylor <iant@google.com>
12884 * layout.cc (Layout::layout): If we see an input section with a
12885 name that needs sorting, set the must_sort flag for the output
12887 (Layout::make_output_section): If the name of the output section
12888 indicates that it might require sorting, set the may_sort flag.
12889 * output.h (Output_section::may_sort_attached_input_sections): New
12891 (Output_section::set_may_sort_attached_input_sections): New
12893 (Output_section::must_sort_attached_input_sections): New
12895 (Output_section::set_must_sort_attached_input_sections): New
12897 (class Output_section): Declare Input_section_sort_entry. Define
12898 Input_section_sort_compare. Declare
12899 sort_attached_input_sections. Add new fields:
12900 may_sort_attached_input_sections_,
12901 must_sort_attached_input_sections_,
12902 attached_input_sections_are_sorted_.
12903 * output.cc (Output_section::Output_section): Initialize new
12905 (Output_section::add_input_section): Add an entry to
12906 input_sections_ if may_sort or must_sort are true.
12907 (Output_section::set_final_data_size): Call
12908 sort_attached_input_sections if necessary.
12909 (Output_section::Input_section_sort_entry): Define new class.
12910 (Output_section::Input_section_sort_compare::operator()): New
12912 (Output_section::sort_attached_input_sections): New function.
12913 * configure.ac: Check whether the compiler supports constructor
12914 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12915 * testsuite/initpri1.c: New file.
12916 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12917 CONSTRUCTOR_PRIORITY.
12918 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12919 (initpri1_LDFLAGS): New variable.
12920 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12922 2008-03-27 Ian Lance Taylor <iant@google.com>
12924 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12925 * testsuite/common_test_1.c: New file.
12926 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12927 (common_test_1_SOURCES): New variable.
12928 (common_test_1_DEPENDENCIES): New variable.
12929 (common_test_1_LDFLAGS): New variable.
12931 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12932 and commons_ correctly when NAME/VERSION does not override
12934 * testsuite/ver_test_6.c: New file.
12935 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12936 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12937 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12939 2008-03-26 Ian Lance Taylor <iant@google.com>
12941 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12942 of an undefined symbol from a version script.
12943 * testsuite/Makefile.am (ver_test_5.so): New target.
12944 (ver_test_5.o): New target.
12945 (check_SCRIPTS): Add ver_test_5.sh.
12946 (check_DATA): Add ver_test_5.syms.
12947 (ver_test_5.syms): New target.
12948 * testsuite/ver_test_5.cc: New file.
12949 * testsuite/ver_test_5.script: New file.
12950 * testsuite/ver_test_5.sh: New file.
12951 * Makefile.in, testsuite/Makefile.in: Rebuild.
12954 Fix problems building gold with gcc 4.3.0.
12955 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12956 (gold_error_at_location, gold_warning_at_location): Use it.
12957 * configure.ac: Check whether we can compile and use a template
12958 function with a printf attribute.
12959 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12960 when jumping over bytes.
12961 * object.cc: Instantiate Object::read_section_data.
12962 * debug.h: Include <cstring>
12963 * dwarf_reader.cc: Include <algorithm>
12964 * main.cc: Include <cstring>.
12965 * options.cc: Include <cstring>.
12966 * output.cc: Include <cstring>.
12967 * script.cc: Include <cstring>.
12968 * script.h: Include <string>.
12969 * symtab.cc: Include <cstring> and <algorithm>.
12970 * target-select.cc: Include <cstring>.
12971 * version.cc: Include <string>.
12972 * testsuite/testmain.cc: Include <cstdlib>.
12973 * configure, config.in: Rebuild.
12975 2008-03-25 Ian Lance Taylor <iant@google.com>
12977 * options.cc: Include "../bfd/bfdver.h".
12978 (options::help): Print bug reporting address.
12980 * version.cc (print_version): Adjust output for current value of
12981 BFD_VERSION_STRING.
12985 * options.cc (options::help): Print list of supported targets.
12986 * target-select.h: Include <vector>.
12987 (class Target_selector): Make machine_, size_, and is_big_endian_
12988 fields const. Add bfd_name_ and instantiated_target_ fields.
12989 (Target_selector::Target_selector): Add bfd_name parameter.
12990 (Target_selector::recognize): Make non-virtual, call
12992 (Target_selector::recognize_by_name): Make non-virtual, call
12993 do_recognize_by_name.
12994 (Target_selector::supported_names): New function.
12995 (Target_selector::bfd_name): New function.
12996 (Target_selector::do_instantiate_target): New pure virtual
12998 (Target_selector::do_recognize): New virtual function.
12999 (Target_selector::do_recognize_by_name): New virtual function.
13000 (Target_selector::instantiate_target): New private function.
13001 (supported_target_names): Declare.
13002 * target-select.cc (Target_selector::Target_selector): Update for
13003 new parameter and fields.
13004 (select_target_by_name): Check that the name matches before
13005 calling recognize_by_name.
13006 (supported_target_names): New function.
13007 * i386.cc (class Target_selector_i386): Update Target_selector
13008 constructor call. Remove recognize and recognize_by_name. Add
13009 do_instantiate_target.
13010 * x86_64.cc (class Target_selector_x86_64): Likewise.
13011 * testsuite/testfile.cc (class Target_selector_test): Update for
13012 changes to Target_selector.
13014 * README: Rewrite, with some notes on unsupported features.
13016 2008-03-24 Cary Coutant <ccoutant@google.com>
13018 * i386.cc (Target_i386::Got_type): New enum declaration.
13019 (Target_i386::Scan::local): Updated callers of Output_data_got
13021 (Target_i386::Scan::global): Likewise.
13022 (Target_i386::Relocate::relocate): Likewise.
13023 (Target_i386::Relocate::relocate_tls): Likewise.
13024 * object.h (Got_offset_list): New class.
13025 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13026 (Sized_relobj::local_got_offset): Likewise.
13027 (Sized_relobj::set_local_got_offset): Likewise.
13028 (Sized_relobj::local_has_tls_got_offset): Removed.
13029 (Sized_relobj::local_tls_got_offset): Removed.
13030 (Sized_relobj::set_local_tls_got_offset): Removed.
13031 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13032 * output.cc (Output_data_got::add_global): Added got_type parameter.
13033 (Output_data_got::add_global_with_rel): Likewise.
13034 (Output_data_got::add_global_with_rela): Likewise.
13035 (Output_data_got::add_global_pair_with_rel): New function.
13036 (Output_data_got::add_global_pair_with_rela): New function.
13037 (Output_data_got::add_local): Added got_type parameter.
13038 (Output_data_got::add_local_with_rel): Likewise.
13039 (Output_data_got::add_local_with_rela): Likewise.
13040 (Output_data_got::add_local_pair_with_rel): New function.
13041 (Output_data_got::add_local_pair_with_rela): New function.
13042 (Output_data_got::add_global_tls): Removed.
13043 (Output_data_got::add_global_tls_with_rel): Removed.
13044 (Output_data_got::add_global_tls_with_rela): Removed.
13045 (Output_data_got::add_local_tls): Removed.
13046 (Output_data_got::add_local_tls_with_rel): Removed.
13047 (Output_data_got::add_local_tls_with_rela): Removed.
13048 * output.h (Output_data_got::add_global): Added got_type parameter.
13049 (Output_data_got::add_global_with_rel): Likewise.
13050 (Output_data_got::add_global_with_rela): Likewise.
13051 (Output_data_got::add_global_pair_with_rel): New function.
13052 (Output_data_got::add_global_pair_with_rela): New function.
13053 (Output_data_got::add_local): Added got_type parameter.
13054 (Output_data_got::add_local_with_rel): Likewise.
13055 (Output_data_got::add_local_with_rela): Likewise.
13056 (Output_data_got::add_local_pair_with_rel): New function.
13057 (Output_data_got::add_local_pair_with_rela): New function.
13058 (Output_data_got::add_global_tls): Removed.
13059 (Output_data_got::add_global_tls_with_rel): Removed.
13060 (Output_data_got::add_global_tls_with_rela): Removed.
13061 (Output_data_got::add_local_tls): Removed.
13062 (Output_data_got::add_local_tls_with_rel): Removed.
13063 (Output_data_got::add_local_tls_with_rela): Removed.
13064 * resolve.cc (Symbol::override_base_with_special): Removed
13065 reference to has_got_offset_ field.
13066 * symtab.cc (Symbol::init_fields): Replaced initialization
13067 of got_offset_ with got_offsets_. Removed initialization
13069 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13070 (Symbol::got_offset): Likewise.
13071 (Symbol::set_got_offset): Likewise.
13072 (Symbol::has_tls_got_offset): Removed.
13073 (Symbol::tls_got_offset): Removed.
13074 (Symbol::set_tls_got_offset): Removed.
13075 (Symbol::got_offset_): Removed.
13076 (Symbol::tls_mod_got_offset_): Removed.
13077 (Symbol::tls_pair_got_offset_): Removed.
13078 (Symbol::got_offsets_): New field.
13079 (Symbol::has_got_offset): Removed.
13080 (Symbol::has_tls_mod_got_offset): Removed.
13081 (Symbol::has_tls_pair_got_offset): Removed.
13082 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13083 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13085 (Target_x86_64::Scan::global): Likewise.
13086 (Target_x86_64::Relocate::relocate): Likewise.
13087 (Target_x86_64::Relocate::relocate_tls): Likewise.
13089 2008-03-25 Ben Elliston <bje@au.ibm.com>
13091 * yyscript.y: Fix spelling error in comment.
13093 2008-03-24 Ian Lance Taylor <iant@google.com>
13095 * options.h (class General_options): Define build_id option.
13096 * layout.h (class Layout): Declare write_build_id, create_note,
13097 create_build_id. Add build_id_note_ member.
13098 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13099 "libiberty.h", "md5.h", "sha1.h".
13100 (Layout::Layout): Initialize eh_frame_data_,
13101 eh_frame_hdr_section_, and build_id_note_.
13102 (Layout::finalize): Call create_build_id.
13103 (Layout::create_note): New function, broken out of
13104 Layout::create_gold_note.
13105 (Layout::create_gold_note): Call create_note.
13106 (Layout::create_build_id): New function.
13107 (Layout::write_build_id): New function.
13108 (Close_task_runner::run): Call write_build_id.
13110 * x86_64.cc: Correct license to GPLv3.
13112 2008-03-23 Ian Lance Taylor <iant@google.com>
13114 * options.cc: Include "demangle.h".
13115 (parse_optional_string): New function.
13116 (parse_long_option): Handle takes_optional_argument.
13117 (parse_short_option): Update dash_z initializer. Handle
13118 takes_optional_argument.
13119 (General_options::General_options): Initialize do_demangle_.
13120 (General_options::finalize): Set do_demangle_. Handle demangling
13122 * options.h (parse_optional_string): Declare.
13123 (struct One_option): Add optional_arg field. Update constructor.
13124 Update call constructor calls. Add takes_optional_argument
13126 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13127 (DEFINE_optional_string): Define.
13128 (General_options::demangle): Change from DEFINE_bool to
13129 DEFINE_optional_string.
13130 (General_options::no_demangle): New function.
13131 (General_options::do_demangle): New function.
13132 (General_options::set_do_demangle): New function.
13133 (General_options::execstack_status_): Move definition to end of
13135 (General_options::static_): Likewise.
13136 (General_options::do_demangle_): New field.
13137 * object.cc (big_endian>::get_symbol_location_info): Call
13138 Options::do_demangle, not Options::demangle.
13139 * symtab.cc (demangle): Likewise.
13141 2008-03-22 Ian Lance Taylor <iant@google.com>
13143 * gold.h: Include <cstddef> and <sys/types.h>
13144 * options.h: Include <cstring>.
13146 2008-03-21 Ian Lance Taylor <iant@google.com>
13148 * Added source code to GNU binutils.