1 2011-06-18 Ian Lance Taylor <iant@google.com>
4 * layout.cc (Layout::layout_eh_frame): Correct handling of
5 writable .eh_frame section.
7 2011-06-17 Ian Lance Taylor <iant@google.com>
10 * resolve.cc (Symbol_table::resolve): Don't give an error if a
11 symbol is redefined with the exact same object and value.
13 2011-06-17 Ian Lance Taylor <iant@google.com>
16 * layout.h (class Layout): Add interp_segment_ field.
17 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
18 (Layout::attach_allocated_section_to_segment): If making shared
19 library, put .interp section in PT_INTERP segment.
20 (Layout::finalize): Also call create_interp if -dynamic-linker
22 (Layout::create_interp): Assert that there is no PT_INTERP
23 segment. If not using a SECTIONS clause, use make_output_section.
24 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
26 (Script_sections::create_note_and_tls_segments): If making shared
27 library, put .interp section in PT_INTERP segment.
29 2011-06-17 Ian Lance Taylor <iant@google.com>
31 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
32 when making a shared library.
34 2011-06-17 Ian Lance Taylor <iant@google.com>
36 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
37 parameter. Change all callers. Don't issue warning about PC32
38 against locally defined symbol.
40 2011-06-16 Ian Lance Taylor <iant@google.com>
42 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
43 occurs in same object.
45 2011-06-14 Alan Modra <amodra@gmail.com>
47 * po/POTFILES.in: Regenerate.
49 2011-06-09 Ian Lance Taylor <iant@google.com>
52 (Orphan_output_section::set_section_addresses): For a relocatable
53 link set address to 0.
55 2011-06-09 Cary Coutant <ccoutant@google.com>
58 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
59 used with --compress-debug-sections.
60 * gold/object.cc (Sized_relobj_file::do_layout): Report
61 uncompressed size of compressed input sections.
63 2011-06-08 Cary Coutant <ccoutant@google.com>
66 * testsuite/two_file_test_2_v1.cc: Change initialization of
67 v2 to keep it in .data.
69 2011-06-07 Cary Coutant <ccoutant@google.com>
71 * common.cc (Symbol_table::do_allocate_commons_list): Call
73 * errors.cc (Errors::fatal): Adjust call to gold_exit.
74 (Errors::fallback): New function.
75 (gold_fallback): New function.
76 * errors.h (Errors::fallback): New function.
77 * gold.cc (gold_exit): Change status parameter to enum; adjust
79 (queue_initial_tasks): Call gold_fallback.
80 * gold.h: Include cstdlib.
81 (Exit_status): New enum type.
82 (gold_exit): Change status parameter to enum.
83 (gold_fallback): New function.
84 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
85 (Layout::create_symtab_sections): Likewise.
86 (Layout::create_shdrs): Likewise.
87 * main.cc (main): Adjust call to gold_exit.
88 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
89 (Output_data_got::add_got_entry_pair): Likewise.
90 (Output_section::add_input_section): Likewise.
91 (Output_section::add_output_section_data): Likewise.
92 (Output_segment::set_section_list_addresses): Likewise.
93 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
95 2011-06-07 Cary Coutant <ccoutant@google.com>
97 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
98 for incremental links.
99 * output.cc (Output_segment::set_section_list_addresses): Remove
100 FIXME and test for TLS or BSS.
102 2011-06-07 Cary Coutant <ccoutant@google.com>
104 * testsuite/Makefile.am: Add incremental_copy_test,
105 incremental_common_test_1.
106 * testsuite/Makefile.in: Regenerate.
107 * testsuite/common_test_1_v1.c: New source file.
108 * testsuite/common_test_1_v2.c: New source file.
109 * testsuite/copy_test_v1.cc: New source file.
111 2011-06-07 Cary Coutant <ccoutant@google.com>
113 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
114 update, allocate common from bss section's free list.
115 * incremental-dump.cc (dump_incremental_inputs): Print flag for
116 linker-defined symbols.
117 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
118 Skip GOT and PLT entries that are no longer referenced.
119 (Output_section_incremental_inputs::write_info_blocks): Mark
120 linker-defined symbols.
121 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
122 * output.cc (Output_section::allocate): New function.
123 * output.h (Output_section::allocate): New function.
124 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
125 linker-defined symbols.
126 (Symbol::override_base_with_special): Copy is_predefined_ flag.
127 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
128 (Symbol::init_base_output_data): Likewise.
129 (Symbol::init_base_output_segment): Likewise.
130 (Symbol::init_base_constant): Likewise.
131 (Sized_symbol::init_output_data): Likewise.
132 (Sized_symbol::init_output_segment): Likewise.
133 (Sized_symbol::init_constant): Likewise.
134 (Symbol_table::do_define_in_output_data): Likewise.
135 (Symbol_table::do_define_in_output_segment): Likewise.
136 (Symbol_table::do_define_as_constant): Likewise.
137 * symtab.h (Symbol::is_predefined): New function.
138 (Symbol::init_base_output_data): Add is_predefined parameter.
139 (Symbol::init_base_output_segment): Likewise.
140 (Symbol::init_base_constant): Likewise.
141 (Symbol::is_predefined_): New data member.
142 (Sized_symbol::init_output_data): Add is_predefined parameter.
143 (Sized_symbol::init_output_segment): Likewise.
144 (Sized_symbol::init_constant): Likewise.
145 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
147 2011-06-07 Cary Coutant <ccoutant@google.com>
149 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
150 instead of emit_copy_reloc.
151 (Copy_relocs::emit_copy_reloc): Refactor.
152 (Copy_relocs::make_copy_reloc): New function.
153 (Copy_relocs::add_copy_reloc): Remove.
154 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
156 (Copy_relocs::make_copy_reloc): New function.
157 (Copy_relocs::add_copy_reloc): Remove.
158 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
159 unchanged input files.
160 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
161 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
162 Reserve BSS space for COPY relocations.
163 (Sized_incremental_binary::do_emit_copy_relocs): New function.
164 (Output_section_incremental_inputs::write_info_blocks): Record
165 whether a symbol is copied from a shared object.
166 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
167 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
168 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
169 (Incremental_input_entry_reader::get_output_symbol_index): Add
171 (Incremental_binary::emit_copy_relocs): New function.
172 (Incremental_binary::do_emit_copy_relocs): New function.
173 (Sized_incremental_binary::Sized_incremental_binary): Initialize
175 (Sized_incremental_binary::add_copy_reloc): New function.
176 (Sized_incremental_binary::do_emit_copy_relocs): New function.
177 (Sized_incremental_binary::Copy_reloc): New struct.
178 (Sized_incremental_binary::Copy_relocs): New typedef.
179 (Sized_incremental_binary::copy_relocs_): New data member.
180 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
181 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
182 * target.h (Sized_target::emit_copy_reloc): New function.
183 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
185 2011-06-02 Cary Coutant <ccoutant@google.com>
188 * gold/archive.cc (Archive::Archive): Initialize new data member.
189 (Archive::include_all_members): Return if archive has already been
191 * gold/archive.h (Archive::include_all_members_): New data member.
193 2011-06-02 Nick Clifton <nickc@redhat.com>
195 * dynobj.h: Fix spelling mistake in comment.
196 * output.cc: Likewise.
198 2011-05-31 Doug Kwan <dougkwan@google.com>
202 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
203 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
204 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
205 redundant arm_exidx_test.so.
206 * testsuite/Makefile.in: Regenerate.
207 (check_SCRIPTS): Add pr12826.sh
208 (check_DATA): Add pr12826.stdout
209 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
210 * testsuite/pr12826.sh: New file.
211 * testsuite/pr12826_1.s: Ditto.
212 * testsuite/pr12826_1.s: Ditto.
214 2011-05-30 Ian Lance Taylor <iant@google.com>
216 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
219 2011-05-29 Ian Lance Taylor <iant@google.com>
222 * testsuite/Makefile.am: Use different file name for two_file_test
223 temporary file for each incremental test.
224 * testsuite/Makefile.in: Rebuild.
226 2011-05-29 Ian Lance Taylor <iant@google.com>
228 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
229 binary input file is empty.
231 2011-05-27 Ian Lance Taylor <iant@google.com>
233 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
234 (ver_test_9.so): Likewise.
235 * testsuite/Makefile.in: Rebuild.
237 2011-05-26 Cary Coutant <ccoutant@google.com>
239 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
240 * incremental.cc (Incremental_inputs::report_input_section): Fix
241 comment, indentation.
242 (Incremental_inputs::report_comdat_group): New function.
243 (Output_section_incremental_inputs::set_final_data_size): Adjust size
244 of data for incremental input file entry.
245 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
246 group count, COMDAT group signatures.
247 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
248 an unchanged input file.
249 * incremental.h (Incremental_object_entry::Incremental_object_entry):
250 Initialize new data member.
251 (Incremental_object_entry::add_comdat_group): New function.
252 (Incremental_object_entry::get_comdat_group_count): New function.
253 (Incremental_object_entry::get_comdat_signature_key): New function.
254 (Incremental_object_entry::groups_): New data member.
255 (Incremental_inputs::report_comdat_group): New function.
256 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
257 data for incremental input file entry.
258 (Incremental_input_entry_reader::get_comdat_group_count): New function.
259 (Incremental_input_entry_reader::get_input_section): Adjust size of
260 data for incremental input file entry.
261 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
262 (Incremental_input_entry_reader::get_comdat_group_signature): New
264 * object.cc (Sized_relobj::include_section_group): Report kept
265 COMDAT groups for incremental links.
267 2011-05-24 David Meyer <pdox@google.com>
269 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
270 with name parameter. Add found_name parameter.
271 * fileread.cc (Input_file::find_file): Adjust code accordingly.
272 * dirsearch.h (class Dirsearch): Update declaration.
274 2011-05-24 Ian Lance Taylor <iant@google.com>
276 * archive.cc (Library_base::should_include_member): Pull in object
277 from archive if it defines the entry symbol.
278 * parameters.cc (Parameters::entry): New function.
279 * parameters.h (class Parameters): Declare entry.
280 * output.h (class Output_file_header): Remove entry_ field.
281 * output.cc (Output_file_header::Output_file_header): Remove entry
282 parameter. Change all callers.
283 (Output_file_header::entry): Use parameters->entry.
284 * gold.cc (queue_middle_tasks): Likewise.
285 * plugin.cc (Plugin_hook::run): Likewise.
287 2011-05-24 Cary Coutant <ccoutant@google.com>
289 * gold.cc (queue_initial_tasks): Pass incremental base filename
290 to Output_file::open_base_file; don't print error message.
291 * incremental-dump.cc (main): Adjust call to
292 Output_file::open_for_modification.
293 * incremental-dump.cc (main): Likewise.
294 * incremental.cc (Incremental_inputs::report_command_line):
295 Ignore --incremental-base option when comparing command lines.
296 Ignore parameter when given as separate argument.
297 * options.h (class General_options): Add --incremental-base.
298 * output.cc (Output_file::Output_file):
299 (Output_file::open_base_file): Add base_name and writable parameters;
300 read base file into new file; print error message here.
301 (Output_file::map_no_anonymous): Add writable parameter; adjust all
303 * output.h (Output_file::open_for_modification): Rename to...
304 (Output_file::open_base_file): ...this; add base_name and
305 writable parameters; adjust all callers.
306 (Output_file::map_no_anonymous): Add writable parameter; adjust all
308 * testsuite/Makefile.am (incremental_test_4): Test
310 * testsuite/Makefile.in: Regenerate.
312 2011-05-24 Cary Coutant <ccoutant@google.com>
314 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
316 * testsuite/Makefile.in: Regenerate.
317 * testsuite/two_file_test_1_v1.cc: New test source file.
318 * testsuite/two_file_test_1b_v1.cc: New test source file.
319 * testsuite/two_file_test_2_v1.cc: New test source file.
321 2011-05-24 Cary Coutant <ccoutant@google.com>
323 * dynobj.h (Dynobj::do_dynobj): New function.
324 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
325 flag and soname for shared objects.
326 * incremental.cc (Incremental_inputs::report_object): Make
327 either Incremental_object_entry or Incremental_dynobj_entry; add
328 soname to string table.
329 (Incremental_inputs::report_input_section): Add assertion.
330 (Output_section_incremental_inputs::set_final_data_size): Adjust
331 type of input file entry for shared libraries; adjust size of
332 shared library info entry.
333 (Output_section_incremental_inputs::write_input_files): Write
334 as_needed flag for shared libraries.
335 (Output_section_incremental_inputs::write_info_blocks): Adjust type
336 of input file entry for shared libraries; write soname.
337 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
338 soname from incremental info.
339 * incremental.h (enum Incremental_input_flags): Add
340 INCREMENTAL_INPUT_AS_NEEDED.
341 (Incremental_input_entry::Incremental_input_entry): Initialize new
343 (Incremental_input_entry::set_as_needed): New function.
344 (Incremental_input_entry::as_needed): New function.
345 (Incremental_input_entry::do_dynobj_entry): New function.
346 (Incremental_input_entry::as_needed_): New data member.
347 (Incremental_object_entry::Incremental_object_entry): Don't check
349 (Incremental_object_entry::do_type): Likewise.
350 (class Incremental_dynobj_entry): New class.
351 (Incremental_input_entry_reader::as_needed): New function.
352 (Incremental_input_entry_reader::get_soname): New function.
353 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
354 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
355 size of shared library info entry.
356 * layout.cc (Layout::finish_dynamic_section): Don't test for
357 incremental link when adding DT_NEEDED entries.
358 * object.h (Object::Object): Initialize new data member.
359 (Object::dynobj): New function.
360 (Object::set_as_needed): New function.
361 (Object::as_needed): New function.
362 (Object::do_dynobj): New function.
363 (Object::as_needed_): New data member.
365 2011-05-24 Cary Coutant <ccoutant@google.com>
367 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
368 info; adjust display of GOT entries.
369 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
370 vector of input objects; remove file_status_.
371 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
372 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
373 got_plt reader; call target hooks to reserve GOT entries.
374 (Output_section_incremental_inputs::set_final_data_size): Adjust size
375 of input file info header and GOT info entry.
376 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
378 (Got_plt_view_info::got_descriptor): Remove.
379 (Got_plt_view_info::sym_index): New data member.
380 (Got_plt_view_info::input_index): New data member.
381 (Local_got_offset_visitor::visit): Write input file index.
382 (Global_got_offset_visitor::visit): Write 0 for input file index.
383 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
384 with sym_index and input_index.
385 (Output_section_incremental_inputs::write_got_plt): Adjust size of
386 incremental info GOT entry; replace got_descriptor with input_index.
387 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
388 map from input file index to object.
389 (Sized_relobj_incr::do_layout): Replace direct data member reference
390 with accessor function.
391 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
392 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
393 Adjust size of input file info header.
394 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
395 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
396 (Incremental_input_entry_reader::get_input_section): Adjust size of
397 input file info header.
398 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
399 of incremental info GOT entry.
400 (Incremental_got_plt_reader::get_got_desc): Remove.
401 (Incremental_got_plt_reader::get_got_symndx): New function.
402 (Incremental_got_plt_reader::get_got_input_index): New function.
403 (Sized_incremental_binary::Sized_incremental_binary): Remove
404 file_status_; add input_objects_.
405 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
406 (Sized_incremental_binary::set_file_is_unchanged): Remove.
407 (Sized_incremental_binary::file_is_unchanged): Remove.
408 (Sized_incremental_binary::set_input_object): New function.
409 (Sized_incremental_binary::input_object): New function.
410 (Sized_incremental_binary::file_status_): Remove.
411 (Sized_incremental_binary::input_objects_): New data member.
412 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
414 (Sized_relobj_incr::invalid_address): Move to base class.
415 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
417 (Sized_relobj_incr::do_output_section_offset): Likewise.
418 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
419 (Sized_relobj_incr::section_offsets_): Likewise.
420 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
422 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
423 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
424 with accessor function.
425 (Sized_relobj_file::do_layout): Likewise.
426 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
427 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
428 (Sized_relobj_file::compute_final_local_value): Replace refs to
429 section_offsets_ with accessor function.
430 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
431 * object.h (Relobj::Relobj): Initialize new data members.
432 (Relobj::add_dyn_reloc): New function.
433 (Relobj::first_dyn_reloc): New function.
434 (Relobj::dyn_reloc_count): New function.
435 (Relobj::first_dyn_reloc_): New data member.
436 (Relobj::dyn_reloc_count_): New data member.
437 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
439 (Sized_relobj::Address): New typedef.
440 (Sized_relobj::invalid_address): Move here from child class.
441 (Sized_relobj::Sized_relobj): Initialize new data members.
442 (Sized_relobj::sized_relobj): New function.
443 (Sized_relobj::is_output_section_offset_invalid): Move here from
445 (Sized_relobj::get_output_section_offset): Likewise.
446 (Sized_relobj::local_has_got_offset): Likewise.
447 (Sized_relobj::local_got_offset): Likewise.
448 (Sized_relobj::set_local_got_offset): Likewise.
449 (Sized_relobj::do_for_all_local_got_entries): Likewise.
450 (Sized_relobj::clear_got_offsets): New function.
451 (Sized_relobj::section_offsets): Move here from child class.
452 (Sized_relobj::do_output_section_offset): Likewise.
453 (Sized_relobj::do_set_section_offset): Likewise.
454 (Sized_relobj::Local_got_offsets): Likewise.
455 (Sized_relobj::local_got_offsets_): Likewise.
456 (Sized_relobj::section_offsets_): Likewise.
457 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
459 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
461 (Sized_relobj_file::sized_relobj): New function
462 (Sized_relobj_file::local_has_got_offset): Move to base class.
463 (Sized_relobj_file::local_got_offset): Likewise.
464 (Sized_relobj_file::set_local_got_offset): Likewise.
465 (Sized_relobj_file::get_output_section_offset): Likewise.
466 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
467 (Sized_relobj_file::do_output_section_offset): Likewise.
468 (Sized_relobj_file::do_set_section_offset): Likewise.
469 (Sized_relobj_file::Local_got_offsets): Likewise.
470 (Sized_relobj_file::local_got_offsets_): Likewise.
471 (Sized_relobj_file::section_offsets_): Likewise.
472 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
474 (set_needs_dynsym_index): Convert relobj to derived class pointer.
475 (Output_reloc::get_symbol_index): Likewise.
476 (Output_reloc::local_section_offset): Likewise.
477 (Output_reloc::get_address): Likewise.
478 (Output_reloc::symbol_value): Likewise.
479 (Output_data_got::reserve_slot): Move to class definition.
480 (Output_data_got::reserve_local): New function.
481 (Output_data_got::reserve_slot_for_global): Remove.
482 (Output_data_got::reserve_global): New function.
483 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
484 (all constructors, two instantiations).
485 (Output_reloc::get_relobj): New function (two instantiations).
486 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
487 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
488 (Output_data_reloc::add_global): Adjust type of relobj.
489 (Output_data_reloc::add_global_relative): Likewise.
490 (Output_data_reloc::add_symbolless_global_addend): Likewise.
491 (Output_data_reloc::add_local): Likewise.
492 (Output_data_reloc::add_local_relative): Likewise.
493 (Output_data_reloc::add_symbolless_local_addend): Likewise.
494 (Output_data_reloc::add_local_section): Likewise.
495 (Output_data_reloc::add_output_section): Likewise.
496 (Output_data_reloc::add_absolute): Likewise.
497 (Output_data_reloc::add_target_specific): Likewise.
498 (Output_data_got::reserve_slot): Move definition here.
499 (Output_data_got::reserve_local): New function.
500 (Output_data_got::reserve_global): New function.
501 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
502 section_offsets_ with accessor function.
503 (Sized_relobj_file::write_sections): Likewise.
504 (Sized_relobj_file::do_relocate_sections): Likewise.
505 * target.h (Sized_target::reserve_local_got_entry): New function.
506 (Sized_target::reserve_global_got_entry): New function.
507 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
508 (Target_x86_64::reserve_global_got_entry): New function.
509 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
511 2011-05-23 Cary Coutant <ccoutant@google.com>
513 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
514 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
515 bit when checking got_type.
516 * incremental.cc (Sized_incremental_binary::setup_readers):
517 Store symbol table and string table locations; initialize bit vector
518 of file status flags.
519 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
521 (Sized_incremental_binary::do_process_got_plt): New function.
522 (Sized_incremental_binary::get_symtab_view): Use stored locations.
523 (Output_section_incremental_inputs::set_final_data_size): Record
524 file index for each input file.
525 (Output_section_incremental_inputs::write_got_plt): Store file index
526 instead of input entry offset for each GOT entry.
528 (Incremental_input_entry::Incremental_input_entry): Initialize new
530 (Incremental_input_entry::set_offset): Store file index.
531 (Incremental_input_entry::get_file_index): New function.
532 (Incremental_input_entry::file_index_): New data member.
533 (Incremental_binary::process_got_plt): New function.
534 (Incremental_binary::do_process_got_plt): New function.
535 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
537 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
538 (Sized_incremental_binary::set_file_is_unchanged): New function.
539 (Sized_incremental_binary::file_is_unchanged): New function.
540 (Sized_incremental_binary::do_process_got_plt): New function.
541 (Sized_incremental_binary::file_status_): New data member.
542 (Sized_incremental_binary::main_symtab_loc_): New data member.
543 (Sized_incremental_binary::main_strtab_loc_): New data member.
544 * output.cc (Output_data_got::Got_entry::write): Add case
546 (Output_data_got::add_global): Call add_got_entry.
547 (Output_data_got::add_global_plt): Likewise.
548 (Output_data_got::add_global_with_rel): Likewise.
549 (Output_data_got::add_global_with_rela): Likewise.
550 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
551 (Output_data_got::add_global_pair_with_rela): Likewise.
552 (Output_data_got::add_local): Call add_got_entry.
553 (Output_data_got::add_local_plt): Likewise.
554 (Output_data_got::add_local_with_rel): Likewise.
555 (Output_data_got::add_local_with_rela): Likewise.
556 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
557 (Output_data_got::add_local_pair_with_rela): Likewise.
558 (Output_data_got::reserve_slot): New function.
559 (Output_data_got::reserve_slot_for_global): New function.
560 (Output_data_got::add_got_entry): New function.
561 (Output_data_got::add_got_entry_pair): New function.
562 (Output_section::add_output_section_data): Edit FIXME.
564 (Output_section_data_build::Output_section_data_build): New
565 constructor with size parameter.
566 (Output_data_space::Output_data_space): Likewise.
567 (Output_data_got::Output_data_got): Initialize new data member; new
568 constructor with size parameter.
569 (Output_data_got::add_constant): Call add_got_entry.
570 (Output_data_got::reserve_slot): New function.
571 (Output_data_got::reserve_slot_for_global): New function.
572 (class Output_data_got::Got_entry): Add RESERVED_CODE.
573 (Output_data_got::add_got_entry): New function.
574 (Output_data_got::add_got_entry_pair): New function.
575 (Output_data_got::free_list_): New data member.
576 * target.h (Sized_target::init_got_plt_for_update): New function.
577 (Sized_target::register_global_plt_entry): New function.
578 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
579 Initialize new data member; call init; add constructor with PLT count.
580 (Output_data_plt_x86_64::init): New function.
581 (Output_data_plt_x86_64::add_relocation): New function.
582 (Output_data_plt_x86_64::reserve_slot): New function.
583 (Output_data_plt_x86_64::free_list_): New data member.
584 (Target_x86_64::init_got_plt_for_update): New function.
585 (Target_x86_64::register_global_plt_entry): New function.
586 (Output_data_plt_x86_64::add_entry): Allocate from free list for
588 (Output_data_plt_x86_64::add_relocation): New function.
589 * testsuite/object_unittest.cc (Object_test): Set default options.
591 2011-05-16 Ian Lance Taylor <iant@google.com>
593 * options.h (class General_options): Make -i a synonym for -r.
595 2011-05-16 Ian Lance Taylor <iant@google.com>
597 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
599 2011-05-10 Cary Coutant <ccoutant@google.com>
601 * object.cc (Sized_relobj::do_count_local_symbols): Check for
604 2011-05-06 Ian Lance Taylor <iant@google.com>
606 * layout.cc (Layout::layout): If the output section flags change,
609 2011-04-25 Cary Coutant <ccoutant@google.com>
611 * incremental-dump.cc (dump_incremental_inputs): Print local
612 symbol info for each input file.
614 (Output_section_incremental_inputs::set_final_data_size): Add local
615 symbol info to input file entries in incremental info.
616 (Output_section_incremental_inputs::write_info_blocks): Likewise.
617 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
618 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
619 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
621 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
622 (Sized_incr_relobj::do_relocate): Write the local symbols.
623 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
624 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
625 Adjust size of input file header.
626 (Incremental_inputs_reader::get_local_symbol_offset): New function.
627 (Incremental_inputs_reader::get_local_symbol_count): New function.
628 (Incremental_inputs_reader::get_input_section): Adjust size of input
630 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
631 (Sized_incr_relobj::This): New typedef.
632 (Sized_incr_relobj::sym_size): New const data member.
633 (Sized_incr_relobj::Local_symbol): New struct.
634 (Sized_incr_relobj::do_output_local_symbol_count): New function.
635 (Sized_incr_relobj::do_local_symbol_offset): New function.
636 (Sized_incr_relobj::local_symbol_count_): New data member.
637 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
638 (Sized_incr_relobj::local_symbol_index_): New data member.
639 (Sized_incr_relobj::local_symbol_offset_): New data member.
640 (Sized_incr_relobj::local_dynsym_offset_): New data member.
641 (Sized_incr_relobj::local_symbols_): New data member.
642 * object.h (Relobj::output_local_symbol_count): New function.
643 (Relobj::local_symbol_offset): New function.
644 (Relobj::do_output_local_symbol_count): New function.
645 (Relobj::do_local_symbol_offset): New function.
646 (Sized_relobj::do_output_local_symbol_count): New function.
647 (Sized_relobj::do_local_symbol_offset): New function.
649 2011-04-22 Vladimir Simonov <sv@sw.ru>
651 * descriptors.cc (set_close_on_exec): New function.
652 (Descriptors::open): Use set_close_on_exec.
653 * output.cc (S_ISLNK): Define if not defined.
655 2011-04-22 Cary Coutant <ccoutant@google.com>
657 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
659 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
660 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
661 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
663 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
664 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
665 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
667 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
669 (Incremental_binary::apply_incremental_relocs): New function.
670 (Incremental_binary::do_apply_incremental_relocs): New function.
671 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
673 (Sized_incremental_binary::add_global_symbol): New function.
674 (Sized_incremental_binary::global_symbol): New function.
675 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
676 (Sized_incremental_binary::symbol_map_): New data member.
677 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
678 * target.h (Sized_target::apply_relocation): New function.
679 * target-reloc.h (apply_relocation): New function.
680 * x86_64.cc (Target_x86_64::apply_relocation): New function.
682 2011-04-22 Doug Kwan <dougkwan@google.com>
684 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
685 flag of a SHT_ARM_EXIDX section.
686 * testsuite/Makefile.am (arm_exidx_test): New test rules.
687 * testsuite/Makefile.in: Regenerate.
688 * testsuite/arm_exidx_test.s: New file.
689 * testsuite/arm_exidx_test.sh: Same.
691 2011-04-20 Cary Coutant <ccoutant@google.com>
694 * archive.h (Incremental_archive_entry::Archive_member):
695 Initialize arg_serial_ (second constructor).
697 2011-04-17 Ian Lance Taylor <iant@google.com>
699 * object.cc (Relocate_info::location): Simplify location string.
700 * errors.cc (Errors::error_at_location): Don't print program
702 (Errors::warning_at_location): Likewise.
703 (Errors::undefined_symbol): Likewise.
704 * testsuite/debug_msg.sh: Update accordingly.
706 2011-04-14 Cary Coutant <ccoutant@google.com>
708 * gold/layout.cc (Layout::symtab_section_offset): New function.
709 * gold/layout.h (Layout::symtab_section_offset): New function.
710 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
712 2011-04-12 Ian Lance Taylor <iant@google.com>
714 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
716 * output.h (class Output_file): Add map_is_allocated_ field.
717 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
718 not available, provide stubs. If mremap is not available, #define
720 (MREMAP_MAYMOVE): Define if not defined.
721 (Output_file::Output_file): Initialize map_is_allocated_.
722 (Output_file::resize): Check map_is_allocated_.
723 (Output_file::map_anonymous): If mmap fails, use malloc.
724 (Output_file::unmap): Don't do anything for an anonymous map.
725 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
726 is not available, provide stubs.
727 (File_read::View::~View): Use free rather than delete[].
728 (File_read::make_view): Use malloc rather than new[]. If mmap
730 (File_read::find_or_make_view): Use malloc rather than new[].
731 * gold.h: Remove HAVE_REMAP code.
732 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
733 exists. Rename mremap to gold_mremap. If mmap is not available
735 * configure, config.in: Rebuild.
737 2011-04-11 Ian Lance Taylor <iant@google.com>
739 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
740 initialize local variable v.
742 2011-04-11 Cary Coutant <ccoutant@google.com>
744 * archive.cc (Archive::include_member): Adjust call to
746 (Add_archive_symbols::run): Track argument serial numbers.
747 (Lib_group::include_member): Likewise.
748 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
749 * archive.h (Incremental_archive_entry::Archive_member):
750 Initialize arg_serial_.
751 (Archive_member::arg_serial_): New data member.
752 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
753 (Sized_dynobj::do_add_symbols): Track symbols when doing an
755 (Sized_dynobj::do_for_all_local_got_entries): New function.
756 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
758 * fileread.cc (get_mtime): New function.
759 * fileread.h (get_mtime): New function.
760 * gold.cc (queue_initial_tasks): Check for incremental update.
761 (process_incremental_input): New function.
762 (queue_middle_tasks): Don't force valid target for incremental
764 * incremental-dump.cc (find_input_containing_global): Adjust
765 size of symbol info entry.
766 (dump_incremental_inputs): Dump argument serial number and
767 in_system_directory flag; bias shndx by 1; print symbol names
768 when dumping per-file symbol lists; use new symbol info readers.
770 (Output_section_incremental_inputs:update_data_size): New function.
771 (Sized_incremental_binary::setup_readers): Setup input readers
772 for each input file; build maps for files added from libraries
774 (Sized_incremental_binary::check_input_args): New function.
775 (Sized_incremental_binary::do_check_inputs): Build map of argument
776 serial numbers to input arguments.
777 (Sized_incremental_binary::do_file_has_changed): Rename
778 do_file_is_unchanged to this; compare file modification times.
779 (Sized_incremental_binary::do_init_layout): New function.
780 (Sized_incremental_binary::do_reserve_layout): New function.
781 (Sized_incremental_binary::do_get_input_reader): Remove.
782 (Sized_incremental_binary::get_symtab_view): New function.
783 (Incremental_checker::can_incrementally_link_output_file): Remove.
784 (Incremental_inputs::report_command_line): Exclude --debug options.
785 (Incremental_inputs::report_archive_begin): Add parameter; track
786 argument serial numbers; don't put input file entry for archive
787 before archive members.
788 (Incremental_inputs::report_archive_end): Put input file entry
789 for archive after archive members.
790 (Incremental_inputs::report_object): Add parameter; track argument
791 serial numbers and in_system_directory flag.
792 (Incremental_inputs::report_script): Add parameter; track argument
794 (Output_section_incremental_inputs::set_final_data_size): Adjust
795 size of symbol info entry; check for forwarding symbols.
796 (Output_section_incremental_inputs::write_input_files): Write
797 in_system_directory flag and argument serial number.
798 (Output_section_incremental_inputs::write_info_blocks): Map section
799 indices between incremental info and original input file; store
800 input section index for each symbol.
801 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
802 change operator() to visit().
803 (class Global_got_offset_visitor): Likewise.
804 (class Global_symbol_visitor_got_plt):
805 (Output_section_incremental_inputs::write_got_plt): Use new visitor
807 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
808 (Sized_incr_relobj::do_read_symbols): New function.
809 (Sized_incr_relobj::do_layout): New function.
810 (Sized_incr_relobj::do_layout_deferred_sections): New function.
811 (Sized_incr_relobj::do_add_symbols): New function.
812 (Sized_incr_relobj::do_should_include_member): New function.
813 (Sized_incr_relobj::do_for_all_global_symbols): New function.
814 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
815 (Sized_incr_relobj::do_section_size): New function.
816 (Sized_incr_relobj::do_section_name): New function.
817 (Sized_incr_relobj::do_section_contents): New function.
818 (Sized_incr_relobj::do_section_flags): New function.
819 (Sized_incr_relobj::do_section_entsize): New function.
820 (Sized_incr_relobj::do_section_address): New function.
821 (Sized_incr_relobj::do_section_type): New function.
822 (Sized_incr_relobj::do_section_link): New function.
823 (Sized_incr_relobj::do_section_info): New function.
824 (Sized_incr_relobj::do_section_addralign): New function.
825 (Sized_incr_relobj::do_initialize_xindex): New function.
826 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
827 (Sized_incr_relobj::do_read_relocs): New function.
828 (Sized_incr_relobj::do_gc_process_relocs): New function.
829 (Sized_incr_relobj::do_scan_relocs): New function.
830 (Sized_incr_relobj::do_count_local_symbols): New function.
831 (Sized_incr_relobj::do_finalize_local_symbols): New function.
832 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
833 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
834 (Sized_incr_relobj::do_relocate): New function.
835 (Sized_incr_relobj::do_set_section_offset): New function.
836 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
837 (Sized_incr_dynobj::do_read_symbols): New function.
838 (Sized_incr_dynobj::do_layout): New function.
839 (Sized_incr_dynobj::do_add_symbols): New function.
840 (Sized_incr_dynobj::do_should_include_member): New function.
841 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
842 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
843 (Sized_incr_dynobj::do_section_size): New function.
844 (Sized_incr_dynobj::do_section_name): New function.
845 (Sized_incr_dynobj::do_section_contents): New function.
846 (Sized_incr_dynobj::do_section_flags): New function.
847 (Sized_incr_dynobj::do_section_entsize): New function.
848 (Sized_incr_dynobj::do_section_address): New function.
849 (Sized_incr_dynobj::do_section_type): New function.
850 (Sized_incr_dynobj::do_section_link): New function.
851 (Sized_incr_dynobj::do_section_info): New function.
852 (Sized_incr_dynobj::do_section_addralign): New function.
853 (Sized_incr_dynobj::do_initialize_xindex): New function.
854 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
855 (make_sized_incremental_object): New function.
856 (Incremental_library::copy_unused_symbols): New function.
857 (Incremental_library::do_for_all_unused_symbols): New function.
858 * incremental.h (enum Incremental_input_flags): New type.
859 (class Incremental_checker): Remove.
860 (Incremental_input_entry::Incremental_input_entry): Add argument
862 (Incremental_input_entry::arg_serial): New function.
863 (Incremental_input_entry::set_is_in_system_directory): New function.
864 (Incremental_input_entry::is_in_system_directory): New function.
865 (Incremental_input_entry::arg_serial_): New data member.
866 (Incremental_input_entry::is_in_system_directory_): New data member.
867 (class Script_info): Move here from script.h.
868 (Script_info::Script_info): Add filename parameter.
869 (Script_info::filename): New function.
870 (Script_info::filename_): New data member.
871 (Incremental_script_entry::Incremental_script_entry): Add argument
873 (Incremental_object_entry::Incremental_object_entry): Likewise.
874 (Incremental_object_entry::add_input_section): Build list of input
875 sections with map to original shndx.
876 (Incremental_object_entry::get_input_section_index): New function.
877 (Incremental_object_entry::shndx_): New data member.
878 (Incremental_object_entry::name_key_): Rename; adjust all refs.
879 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
880 (Incremental_archive_entry::Incremental_archive_entry): Add argument
882 (Incremental_inputs::report_archive_begin): Likewise.
883 (Incremental_inputs::report_object): Likewise.
884 (Incremental_inputs::report_script): Likewise.
885 (class Incremental_global_symbol_reader): New class.
886 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
887 and store flags and input file type.
888 (Incremental_input_entry_reader::arg_serial): New function.
889 (Incremental_input_entry_reader::type): Extract type from flags.
890 (Incremental_input_entry_reader::is_in_system_directory): New function.
891 (Incremental_input_entry_reader::get_input_section_count): Call
892 accessor function for type.
893 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
894 function for type; adjust size of global symbol entry.
895 (Incremental_input_entry_reader::get_global_symbol_count): Call
896 accessor function for type.
897 (Incremental_input_entry_reader::get_object_count): Likewise.
898 (Incremental_input_entry_reader::get_object_offset): Likewise.
899 (Incremental_input_entry_reader::get_member_count): Likewise.
900 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
901 (Incremental_input_entry_reader::get_member_offset): Likewise.
902 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
903 (Incremental_input_entry_reader::Global_symbol_info): Remove.
904 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
905 (Incremental_input_entry_reader::get_global_symbol_reader): New
907 (Incremental_input_entry_reader::get_output_symbol_index): New
909 (Incremental_input_entry_reader::type_): Remove.
910 (Incremental_input_entry_reader::flags_): New data member.
911 (Incremental_inputs_reader::input_file_offset): New function.
912 (Incremental_inputs_reader::input_file_index): New function.
913 (Incremental_inputs_reader::input_file): Call input_file_offset.
914 (Incremental_inputs_reader::input_file_at_offset): New function.
915 (Incremental_relocs_reader::get_r_type): Reformat.
916 (Incremental_relocs_reader::get_r_shndx): Reformat.
917 (Incremental_relocs_reader::get_r_offset): Reformat.
918 (Incremental_relocs_reader::data): New function.
919 (Incremental_binary::Incremental_binary): Initialize new data members.
920 (Incremental_binary::check_inputs): Add cmdline parameter.
921 (Incremental_binary::file_is_unchanged): Remove.
922 (Input_reader::arg_serial): New function.
923 (Input_reader::get_unused_symbol_count): New function.
924 (Input_reader::get_unused_symbol): New function.
925 (Input_reader::do_arg_serial): New function.
926 (Input_reader::do_get_unused_symbol_count): New function.
927 (Input_reader::do_get_unused_symbol): New function.
928 (Incremental_binary::input_file_count): New function.
929 (Incremental_binary::get_input_reader): Change signature to use
930 index instead of filename.
931 (Incremental_binary::file_has_changed): New function.
932 (Incremental_binary::get_input_argument): New function.
933 (Incremental_binary::get_library): New function.
934 (Incremental_binary::get_script_info): New function.
935 (Incremental_binary::init_layout): New function.
936 (Incremental_binary::reserve_layout): New function.
937 (Incremental_binary::output_file): New function.
938 (Incremental_binary::do_check_inputs): New function.
939 (Incremental_binary::do_file_is_unchanged): Remove.
940 (Incremental_binary::do_file_has_changed): New function.
941 (Incremental_binary::do_init_layout): New function.
942 (Incremental_binary::do_reserve_layout): New function.
943 (Incremental_binary::do_input_file_count): New function.
944 (Incremental_binary::do_get_input_reader): Change signature.
945 (Incremental_binary::input_args_map_): New data member.
946 (Incremental_binary::library_map_): New data member.
947 (Incremental_binary::script_map_): New data member.
948 (Sized_incremental_binary::Sized_incremental_binary): Initialize
950 (Sized_incremental_binary::output_section): New function.
951 (Sized_incremental_binary::inputs_reader): Add const.
952 (Sized_incremental_binary::symtab_reader): Add const.
953 (Sized_incremental_binary::relocs_reader): Add const.
954 (Sized_incremental_binary::got_plt_reader): Add const.
955 (Sized_incremental_binary::get_symtab_view): New function.
956 (Sized_incremental_binary::Inputs_reader): New typedef.
957 (Sized_incremental_binary::Input_entry_reader): New typedef.
958 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
959 (Sized_incremental_binary::do_file_is_unchanged): Remove.
960 (Sized_incremental_binary::do_file_has_changed): New function.
961 (Sized_incremental_binary::do_init_layout): New function.
962 (Sized_incremental_binary::do_reserve_layout): New function.
963 (Sized_input_reader::Inputs_reader): Remove.
964 (Sized_input_reader::Input_entry_reader): Remove.
965 (Sized_input_reader::do_arg_serial): New function.
966 (Sized_input_reader::do_get_unused_symbol_count): New function.
967 (Sized_input_reader::do_get_unused_symbol): New function.
968 (Sized_incremental_binary::do_input_file_count): New function.
969 (Sized_incremental_binary::do_get_input_reader): Change signature;
970 use index instead of filename.
971 (Sized_incremental_binary::section_map_): New data member.
972 (Sized_incremental_binary::input_entry_readers_): New data member.
973 (class Sized_incr_relobj): New class.
974 (class Sized_incr_dynobj): New class.
975 (make_sized_incremental_object): New function.
976 (class Incremental_library): New class.
977 * layout.cc (Free_list::num_lists): New static data member.
978 (Free_list::num_nodes): New static data member.
979 (Free_list::num_removes): New static data member.
980 (Free_list::num_remove_visits): New static data member.
981 (Free_list::num_allocates): New static data member.
982 (Free_list::num_allocate_visits): New static data member.
983 (Free_list::init): New function.
984 (Free_list::remove): New function.
985 (Free_list::allocate): New function.
986 (Free_list::dump): New function.
987 (Free_list::print_stats): New function.
988 (Layout_task_runner::run): Resize output file for incremental updates.
989 (Layout::Layout): Initialize new data members.
990 (Layout::set_incremental_base): New function.
991 (Layout::init_fixed_output_section): New function.
992 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
994 (Layout::create_gold_note): Do not create gold note section for
996 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
997 for incremental updates.
998 (Layout::set_section_offsets): For incremental updates, allocate space
1000 (Layout::create_symtab_sections): Layout with offsets relative to
1001 start of section; for incremental updates, allocate space from free
1003 (Layout::create_shdrs): For incremental updates, allocate space from
1005 (Layout::finish_dynamic_section): For incremental updates, do not
1006 check --as-needed (fixed in subsequent patch).
1007 * layout.h (class Free_list): New class.
1008 (Layout::set_incremental_base): New function.
1009 (Layout::incremental_base): New function.
1010 (Layout::init_fixed_output_section): New function.
1011 (Layout::allocate): New function.
1012 (Layout::incremental_base_): New data member.
1013 (Layout::free_list_): New data member.
1014 * main.cc (main): Print Free_list statistics.
1015 * object.cc (Relobj::finalize_incremental_relocs): Add
1016 clear_counts parameter; clear counts only when clear_counts is set.
1017 (Sized_relobj::Sized_relobj): Initialize new base class.
1018 (Sized_relobj::do_layout): Don't report special sections.
1019 (Sized_relobj::do_for_all_local_got_entries): New function.
1020 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1021 symtab_off to all symbol table offsets.
1022 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1023 * object.h (class Got_offset_list): Move to top of file.
1024 (Object::Object): Allow case where input_file == NULL.
1025 (Object::~Object): Likewise.
1026 (Object::input_file): Assert that input_file != NULL.
1027 (Object::lock): Allow case where input_file == NULL.
1028 (Object::unlock): Likewise.
1029 (Object::is_locked): Likewise.
1030 (Object::token): Likewise.
1031 (Object::release): Likewise.
1032 (Object::is_incremental): New function.
1033 (Object::get_mtime): New function.
1034 (Object::for_all_local_got_entries): New function.
1035 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1036 (Object::set_is_in_system_directory): New function.
1037 (Object::is_in_system_directory): New function.
1038 (Object::do_is_incremental): New function.
1039 (Object::do_get_mtime): New function.
1040 (Object::do_for_all_local_got_entries): New function.
1041 (Object::is_in_system_directory_): New data member.
1042 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1043 (class Sized_relobj_base): New class.
1044 (class Sized_relobj): Derive from Sized_relobj_base.
1045 (class Sized_relobj::Symbols): Redeclare from base class.
1046 (class Sized_relobj::local_got_offset_list): Remove.
1047 (class Sized_relobj::Output_sections): Redeclare from base class.
1048 (class Sized_relobj::do_for_all_local_got_entries): New function.
1049 (class Sized_relobj::write_local_symbols): Add offset parameter.
1050 (class Sized_relobj::local_symbol_offset_): Update comment.
1051 (class Sized_relobj::local_dynsym_offset_): Update comment.
1052 * options.cc (Input_arguments::add_file): Remove const.
1053 * options.h (Input_file_argument::Input_file_argument):
1054 Initialize arg_serial_ (all constructors).
1055 (Input_file_argument::set_arg_serial): New function.
1056 (Input_file_argument::arg_serial): New function.
1057 (Input_file_argument::arg_serial_): New data member.
1058 (Input_arguments::Input_arguments): Initialize file_count_.
1059 (Input_arguments::add_file): Remove const.
1060 (Input_arguments::number_of_input_files): New function.
1061 (Input_arguments::file_count_): New data member.
1062 (Command_line::number_of_input_files): Call
1063 Input_arguments::number_of_input_files.
1064 * output.cc (Output_segment_headers::Output_segment_headers):
1066 (Output_section::Input_section::current_data_size): New function.
1067 (Output_section::Output_section): Initialize new data members.
1068 (Output_section::add_input_section): Don't do merge sections for
1069 an incremental link; allocate space from free list for an
1071 (Output_section::add_output_section_data): Allocate space from
1072 free list for an incremental update.
1073 (Output_section::update_data_size): New function.
1074 (Output_section::set_fixed_layout): New function.
1075 (Output_section::reserve): New function.
1076 (Output_segment::set_section_addresses): Remove const.
1077 (Output_segment::set_section_list_addresses): Remove const; allocate
1078 space from free list for an incremental update.
1079 (Output_segment::set_offset): Adjust size of RELRO segment for an
1081 * output.h (Output_data::current_data_size): Move here from
1083 (Output_data::pre_finalize_data_size): New function.
1084 (Output_data::update_data_size): New function.
1085 (Output_section_headers::update_data_size): new function.
1086 (Output_section_data_build::current_data_size): Move to Output_data.
1087 (Output_data_strtab::update_data_size): New function.
1088 (Output_section::current_data_size): Move to Output_data.
1089 (Output_section::set_fixed_layout): New function.
1090 (Output_section::has_fixed_layout): New function.
1091 (Output_section::reserve): New function.
1092 (Output_section::update_data_size): New function.
1093 (Output_section::has_fixed_layout_): New data member.
1094 (Output_section::free_list_): New data member.
1095 (Output_segment::set_section_addresses): Remove const.
1096 (Output_segment::set_section_list_addresses): Remove const.
1097 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1099 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1101 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1102 parameter when calling Add_symbols constructor; store argument
1103 serial number for members of a lib group.
1104 (Add_symbols::locks): Allow case where token == NULL.
1105 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1106 (Read_member::~Read_member): New function.
1107 (Read_member::is_runnable): New function.
1108 (Read_member::locks): New function.
1109 (Read_member::run): New function.
1110 (Check_script::~Check_script): New function.
1111 (Check_script::is_runnable): New function.
1112 (Check_script::locks): New function.
1113 (Check_script::run): New function.
1114 (Check_library::~Check_library): New function.
1115 (Check_library::is_runnable): New function.
1116 (Check_library::locks): New function.
1117 (Check_library::run): New function.
1118 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1119 (Add_symbols::library_): New data member.
1120 (class Read_member): New class.
1121 (class Check_script): New class.
1122 (class Check_library): New class.
1123 * reloc.cc (Read_relocs::is_runnable): Allow case where
1125 (Read_relocs::locks): Likewise.
1126 (Scan_relocs::locks): Likewise.
1127 (Relocate_task::locks): Likewise.
1128 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1130 (Sized_relobj::incremental_relocs_scan): Fix comment.
1131 (Sized_relobj::do_relocate): Pass output file offset to
1132 write_local_symbols.
1133 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1134 from class declaration.
1135 * script.cc (read_input_script): Allocate Script_info; pass
1136 argument serial number to report_script.
1137 * script.h (class Script_info): Move to incremental.h.
1138 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1139 * symtab.h (Symbol_table::add_from_incrobj): New function.
1140 (Symbol_table::set_file_offset): New function.
1142 2011-04-05 Cary Coutant <ccoutant@google.com>
1144 * incremental-dump.cc (dump_incremental_inputs): Change signature
1145 to take a Sized_incremental_binary; change caller. Use readers
1146 in Sized_incremental_binary.
1148 (Sized_incremental_binary::find_incremental_inputs_sections):
1149 Rename do_find_incremental_inputs_sections to this.
1150 (Sized_incremental_binary::setup_readers): New function.
1151 (Sized_incremental_binary::do_check_inputs): Check
1152 has_incremental_info_ flag; move setup code to setup_readers;
1154 (Sized_incremental_binary::do_file_is_unchanged): New function.
1155 (Sized_incremental_binary::do_get_input_reader): New function.
1156 * incremental.h (class Incremental_binary): Move to end of file.
1157 (Incremental_binary::file_is_unchanged): New function.
1158 (Incremental_binary::do_file_is_unchanged): New function.
1159 (Incremental_binary::Input_reader): New class.
1160 (Incremental_binary::get_input_reader): New function.
1161 (class Sized_incremental_binary): Move to end of file.
1162 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1163 input section reader classes.
1164 (Sized_incremental_binary::has_incremental_info): New function.
1165 (Sized_incremental_binary::inputs_reader): New function.
1166 (Sized_incremental_binary::symtab_reader): New function.
1167 (Sized_incremental_binary::relocs_reader): New function.
1168 (Sized_incremental_binary::got_plt_reader): New function.
1169 (Sized_incremental_binary::do_file_is_unchanged): New function.
1170 (Sized_incremental_binary::Sized_input_reader): New class.
1171 (Sized_incremental_binary::get_input_reader): New function.
1172 (Sized_incremental_binary::find_incremental_inputs_sections):
1173 Rename do_find_incremental_inputs_sections to this.
1174 (Sized_incremental_binary::setup_readers): New function.
1175 (Sized_incremental_binary::has_incremental_info_): New data member.
1176 (Sized_incremental_binary::inputs_reader_): New data member.
1177 (Sized_incremental_binary::symtab_reader_): New data member.
1178 (Sized_incremental_binary::relocs_reader_): New data member.
1179 (Sized_incremental_binary::got_plt_reader_): New data member.
1180 (Sized_incremental_binary::current_input_file_): New data member.
1182 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
1185 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1188 2011-03-30 Cary Coutant <ccoutant@google.com>
1190 * archive.cc (Archive::include_member): Adjust call to report_object.
1191 (Add_archive_symbols::run): Add script_info to call to
1192 report_archive_begin.
1193 (Lib_group::include_member): Adjust call to report_object.
1194 (Add_lib_group_symbols::run): Adjust call to report_object.
1195 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1196 blocks. Add object count for script input files.
1197 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1198 script_info parameter; change all callers.
1199 (Incremental_inputs::report_object): Add script_info parameter;
1201 (Incremental_inputs::report_script): Store backpointer to
1202 incremental info entry.
1203 (Output_section_incremental_inputs::set_final_data_size): Record
1204 additional information for scripts.
1205 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1206 * incremental.h (Incremental_script_entry::add_object): New function.
1207 (Incremental_script_entry::get_object_count): New function.
1208 (Incremental_script_entry::get_object): New function.
1209 (Incremental_script_entry::objects_): New data member; adjust
1211 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1212 (Incremental_inputs::report_object): Add script_info parameter.
1213 (Incremental_inputs_reader::get_object_count): New function.
1214 (Incremental_inputs_reader::get_object_offset): New function.
1215 * options.cc (Input_arguments::add_file): Return reference to
1217 * options.h (Input_argument::set_script_info): New function.
1218 (Input_argument::script_info): New function.
1219 (Input_argument::script_info_): New data member; adjust all
1221 (Input_file_group::add_file): Return reference to new input argument.
1222 (Input_file_lib::add_file): Likewise.
1223 (Input_arguments::add_file): Likewise.
1224 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1225 * script.cc (Parser_closure::Parser_closure): Add script_info
1226 parameter; adjust all callers.
1227 (Parser_closure::script_info): New function.
1228 (Parser_closure::script_info_): New data member.
1229 (read_input_script): Report scripts earlier to incremental info.
1230 (script_add_file): Set script_info in Input_argument.
1231 (script_add_library): Likewise.
1232 * script.h (Script_options::Script_info): Rewrite class.
1234 2011-03-29 Cary Coutant <ccoutant@google.com>
1236 * archive.cc (Library_base::should_include_member): Move
1237 method here from class Archive.
1238 (Archive::Archive): Initialize base class.
1239 (Archive::should_include_member): Move to base class.
1240 (Archive::do_for_all_unused_symbols): New function.
1241 (Add_archive_symbols::run): Remove redundant access to
1243 (Lib_group::Lib_group): Initialize base class.
1244 (Lib_group::do_filename): New function.
1245 (Lib_group::include_member): Pass pointer to Lib_group to
1247 (Lib_group::do_for_all_unused_symbols): New function.
1248 (Add_lib_group_symbols::run): Report archive information for
1250 * archive.h (class Library_base): New base class.
1251 (class Archive): Derive from Library_base.
1252 (Archive::filename): Move to base class.
1253 (Archive::set_incremental_info): Likewise.
1254 (Archive::incremental_info): Likewise.
1255 (Archive::Should_include): Likewise.
1256 (Archive::should_include_member): Likewise.
1257 (Archive::Armap_entry): Remove.
1258 (Archive::Unused_symbol_iterator): Remove.
1259 (Archive::unused_symbols_begin): Remove.
1260 (Archive::unused_symbols_end): Remove.
1261 (Archive::do_filename): New function.
1262 (Archive::do_get_mtime): New function.
1263 (Archive::do_for_all_unused_symbols): New function.
1264 (Archive::task_): Move to base class.
1265 (Archive::incremental_info_): Likewise.
1266 (class Lib_group): Derive from Library_base.
1267 (Lib_group::do_filename): New function.
1268 (Lib_group::do_get_mtime): New function.
1269 (Lib_group::do_for_all_unused_symbols): New function.
1270 (Lib_group::task_): Move to base class.
1271 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1273 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1275 * incremental.cc (Incremental_inputs::report_archive_begin):
1276 Use Library_base; call library's get_mtime; add incremental inputs
1277 entry before members.
1278 (class Unused_symbol_visitor): New class.
1279 (Incremental_inputs::report_archive_end): Use Library_base; use
1280 visitor class to record unused symbols; don't add incremental inputs
1281 entry after members.
1282 (Incremental_inputs::report_object): Use Library_base.
1284 (Incremental_archive_entry::Incremental_archive_entry): Remove
1285 unused Archive parameter.
1286 (Incremental_inputs::report_archive_begin): Use Library_base.
1287 (Incremental_inputs::report_archive_end): Likewise.
1288 (Incremental_inputs::report_object): Likewise.
1289 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1291 * object.h (Object::for_all_global_symbols): New function.
1292 (Object::do_for_all_global_symbols): New function.
1293 (Sized_relobj::do_for_all_global_symbols): New function.
1294 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1296 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1299 2011-03-27 Ian Lance Taylor <iant@google.com>
1301 * archive.cc (Archive::interpret_header): Return -1 if something
1302 goes wrong. Change callers accordingly.
1304 2011-03-25 Cary Coutant <ccoutant@google.com>
1306 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1307 * testsuite/Makefile.in: Regenerate.
1309 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1311 * plugin.cc (get_view): New.
1312 (Plugin::load): Pass get_view to the plugin.
1313 (Plugin_manager::get_view): New.
1315 2011-03-21 Ian Lance Taylor <iant@google.com>
1317 * testsuite/final_layout.sh: Rewrite to not use dc.
1318 * testsuite/relro_test.sh: Fail if dc is not present.
1320 2011-03-21 Sriraman Tallam <tmsriram@google.com>
1322 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1324 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1325 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1327 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1328 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1330 2011-03-14 Ian Lance Taylor <iant@google.com>
1332 * script-sections.cc (Sort_output_sections::script_compare):
1333 Rename from is_before, change return type.
1334 (Sort_output_sections::operator()): Adjust accordingly.
1336 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1339 * testsuite/odr_violation2.cc: Add comment to make all error line
1340 numbers double digits.
1341 * testsuite/debug_msg.sh: Adjust expected errors.
1343 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1345 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1346 but mark earlier ones as non-canonical
1347 (offset_to_iterator): Update search target and example
1348 (do_addr2line): Return extra lines in a vector*
1349 (format_file_lineno): Extract from do_addr2line
1350 (one_addr2line): Add vector* out-param
1351 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1352 when a lineno entry appeared last for its instruction
1353 (Dwarf_line_info): Add vector* out-param
1354 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1355 * symtab.cc (Odr_violation_compare): Include the lineno in the
1357 (linenos_from_loc): New. Combine the canonical line for an
1358 address with its other lines.
1359 (True_if_intersect): New. Helper functor to make
1360 std::set_intersection a query.
1361 (detect_odr_violations): Compare sets of lines instead of just
1362 one line for each function. This became less deterministic, but
1363 has fewer false positives.
1364 * symtab.h: Declarations.
1365 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1366 mix an optimized and non-optimized object in the same binary
1367 (odr_violation2.so): Same.
1368 * testsuite/Makefile.in: Regenerate from Makefile.am.
1369 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1370 * testsuite/debug_msg.sh: Update line numbers and add
1372 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1373 non-optimized context.
1374 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1375 isn't inlined, and use OdrDerived in an optimized context.
1376 * testsuite/odr_header1.h: Defines OdrDerived, where
1377 optimization will change the
1378 first-instruction-in-the-destructor's file and line number.
1379 * testsuite/odr_header2.h: Defines OdrBase.
1381 2011-03-09 Ian Lance Taylor <iant@google.com>
1383 * fileread.cc (File_read::clear_views): Don't delete the whole
1386 2011-03-08 Ian Lance Taylor <iant@google.com>
1389 * fileread.cc: #include <climits>.
1390 (GOLD_IOV_MAX): Define.
1391 (File_read::read_multiple): Limit number of entries by iov_max.
1392 * fileread.h (class File_read): Always set max_readv_entries to
1395 2011-03-07 Ian Lance Taylor <iant@google.com>
1398 * options.h (class General_options): Add -dy and -dn.
1400 2011-03-02 Cary Coutant <ccoutant@google.com>
1402 * testsuite/script_test_9.t: Add TLS segment.
1404 2011-03-02 Simon Baldwin <simonb@google.com>
1406 * configure.ac: Add check for gnu_indirect_function support in
1407 the toolchain building binutils.
1408 * configure: Rebuild.
1410 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1412 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1413 plugin only symbols.
1414 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1415 in plugin files as not needed in the symbol table.
1417 2011-02-11 Sriraman Tallam <tmsriram@google.com>
1419 * output.cc (Output_section::add_input_section): Delay fill
1420 generation for section ordering.
1422 2011-02-09 Ian Lance Taylor <iant@google.com>
1425 * object.h (class Sized_relobj): Remove clear_local_symbols.
1426 * reloc.cc (Sized_relobj::do_relocate): Don't call
1427 clear_local_symbols.
1429 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1431 * plugin.cc (is_visible_from_outside): Return true for symbols
1434 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1436 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1439 2011-02-02 Sriraman Tallam <tmsriram@google.com>
1441 * icf.h (is_section_foldable_candidate): Change type of parameter
1443 * icf.cc (Icf::find_identical_sections): Change type of local variable
1444 section_name to be std::string.
1445 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1447 2011-01-25 Ian Lance Taylor <iant@google.com>
1449 * script.cc (script_add_extern): Rewrite to use
1450 add_symbol_reference.
1452 2011-01-25 Doug Kwan <dougkwan@google.com>
1454 * icf.cc (get_section_contents): Always lock section's object.
1456 2011-01-24 Ian Lance Taylor <iant@google.com>
1458 * options.h (class General_options): Accept
1459 --no-detect-odr-violations.
1461 2011-01-24 Ian Lance Taylor <iant@google.com>
1463 * version.cc (version_string): Bump to 1.11.
1465 2011-01-24 Ian Lance Taylor <iant@google.com>
1467 * plugin.cc (class Plugin_rescan): Define new class.
1468 (Plugin_manager::claim_file): Set any_claimed_.
1469 (Plugin_manager::save_archive): New function.
1470 (Plugin_manager::save_input_group): New function.
1471 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1473 (Plugin_manager::new_undefined_symbol): New function.
1474 (Plugin_manager::rescan): New function.
1475 (Plugin_manager::rescannable_defines): New function.
1476 (Plugin_manager::add_input_file): Set any_added_.
1477 * plugin.h (class Plugin_manager): define new fields rescannable_,
1478 undefined_symbols_, any_claimed_, and any_added_. Declare
1479 Plugin_rescan as friend. Declare new functions.
1480 (Plugin_manager::Rescannable): Define type.
1481 (Plugin_manager::Rescannable_list): Define type.
1482 (Plugin_manager::Undefined_symbol_list): Define type.
1483 (Plugin_manager::Plugin_manager): Initialize new fields.
1484 * archive.cc (Archive::defines_symbol): New function.
1485 (Add_archive_symbols::run): Pass archive to plugins if any.
1486 * archive.h (class Archive): Declare defines_symbol.
1487 * readsyms.cc (Input_group::~Input_group): New function.
1488 (Finish_group::run): Pass input_group to plugins if any.
1489 * readsyms.h (class Input_group): Declare destructor.
1490 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1493 2011-01-10 Ian Lance Taylor <iant@google.com>
1495 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1497 (Layout::set_segment_offsets): Reset increase_relro before calling
1498 set_section_addresses a second time.
1500 2011-01-04 Cary Coutant <ccoutant@google.com>
1502 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1503 sections before NOBITS sections.
1505 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1507 * version.cc (print_version): Update copyright to 2011.
1509 2010-12-23 Cary Coutant <ccoutant@google.com>
1511 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1512 of OS to this->add. Add OD parameter to second form of the function.
1514 2010-12-20 Ian Lance Taylor <iant@google.com>
1516 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1517 second of two consecutive entries with same offset.
1519 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1521 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1522 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1523 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1524 to avoid unneeded links against $(LDADD).
1525 * testsuite/Makefile.in: Regenerate.
1527 2010-12-15 Ian Lance Taylor <iant@google.com>
1530 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1531 for R_X86_64_32 and R_X86_64_PC32.
1532 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1533 ver_matching_def_pic.o.
1534 (ver_matching_def_pic.o): New target.
1536 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1538 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1539 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1540 Move definition before File_read::View member definitions.
1541 (File_read::View::~View): Initialize and hold lock before
1542 updating current_mapped_bytes.
1544 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1546 * dwarf_reader.cc: Remove outdated comment.
1547 * gold-threads.cc: Fix typo in error message.
1548 * archive.cc: Fix typos in comments.
1549 * archive.h: Likewise.
1550 * arm-reloc-property.cc: Likewise.
1551 * arm-reloc-property.h: Likewise.
1552 * arm-reloc.def: Likewise.
1554 * attributes.h: Likewise.
1555 * cref.cc: Likewise.
1556 * ehframe.cc: Likewise.
1557 * fileread.h: Likewise.
1559 * i386.cc: Likewise.
1561 * incremental.h: Likewise.
1562 * int_encoding.cc: Likewise.
1563 * layout.h: Likewise.
1564 * main.cc: Likewise.
1565 * merge.h: Likewise.
1566 * object.cc: Likewise.
1567 * object.h: Likewise.
1568 * options.cc: Likewise.
1569 * readsyms.cc: Likewise.
1570 * reduced_debug_output.cc: Likewise.
1571 * reloc.cc: Likewise.
1572 * script-sections.cc: Likewise.
1573 * sparc.cc: Likewise.
1574 * symtab.h: Likewise.
1575 * target-reloc.h: Likewise.
1576 * target.cc: Likewise.
1577 * target.h: Likewise.
1578 * timer.cc: Likewise.
1579 * timer.h: Likewise.
1580 * x86_64.cc: Likewise.
1582 2010-12-09 Cary Coutant <ccoutant@google.com>
1584 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1586 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1587 parameter; change all callers.
1588 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1589 * options.h (warn_execstack): New option.
1591 2010-12-07 Doug Kwan <dougkwan@google.com>
1593 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1594 like function call relocations.
1596 2010-12-07 Ian Lance Taylor <iant@google.com>
1598 * archive.cc (Archive::get_elf_object_for_member): Permit
1599 punconfigured to be NULL.
1600 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1601 (Archive::include_member): Pass NULL to get_elf_object_for_member
1602 if we searched for the archive and this is the first included
1605 2010-12-01 Ian Lance Taylor <iant@google.com>
1607 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1608 track_relocs_type_ field.
1609 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1610 Set track_relocs_type_.
1611 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1612 contents when using RELA relocs.
1613 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1615 * reloc.cc (Track_relocs::next_addend): New function.
1616 * reloc.h (class Track_relocs): Declare next_addend.
1618 2010-12-01 Ian Lance Taylor <iant@google.com>
1620 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1623 2010-12-01 Ian Lance Taylor <iant@google.com>
1625 * README: Update compilers known to work and fail.
1627 2010-11-23 Matthias Klose <doko@ubuntu.com>
1629 * configure.in: For --enable-gold, handle value `default' instead of
1630 `both*'. Always install ld as ld.bfd, install as ld if gold is
1632 * configure: Regenerate.
1634 2010-11-18 Doug Kwan <dougkwan@google.com>
1636 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1637 and right_alignment to be zero. Store result alignment only if it is
1638 greater than existing alignment.
1640 2010-11-16 Cary Coutant <ccoutant@google.com>
1643 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1644 Check for ".zdebug_line".
1646 2010-11-16 Doug Kwan <dougkwan@google.com>
1647 Cary Coutant <ccoutant@google.com>
1649 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1650 by reference; adjust all callers.
1651 * output.cc (Output_segment::set_section_addresses): Adjust references
1652 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1654 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1655 end at page boundary.
1657 2010-11-16 Cary Coutant <ccoutant@google.com>
1660 * layout.cc (Layout::choose_output_section): Transform names of
1661 compressed sections even when using a script with a SECTIONS clause.
1662 (Layout::output_section_name): Remove code to transform
1663 compressed debug section names.
1664 * output.cc (Output_section::add_input_section): Use uncompressed
1665 section size when tracking input sections.
1667 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
1669 * symtab.h (Symbol::NON_PIC_REF): Remove.
1670 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1671 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1672 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1673 (Symbol::use_plt_offset): Take a flags argument and pass it
1674 directly to needs_dynamic_reloc. Restrict check for undefined
1675 weak symbols to function calls.
1676 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1677 (Target_arm::Scan::global): Use it.
1678 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1679 (Target_arm::Relocate::relocate): Likewise.
1680 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1681 parameter with an r_type parameter. Use get_reference_flags
1683 (Target_arm::Relocate::relocate): Update accordingly.
1684 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1685 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1686 (Target_i386::Scan::global): Likewise.
1687 (Target_i386::Relocate::relocate): Likewise.
1688 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1689 parameter with an r_type parameter. Use get_reference_flags
1691 (Target_i386::Relocate::relocate): Update accordingly.
1692 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1693 (Target_powerpc::Scan::global): Use it.
1694 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1695 (Target_powerpc::Relocate::relocate): Likewise.
1696 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1697 (Target_sparc::Scan::global): Use it.
1698 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1699 (Target_sparc::Relocate::relocate): Likewise.
1700 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1701 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1702 (Target_x86_64::Scan::global): Likewise.
1703 (Target_x86_64::Relocate::relocate): Likewise.
1705 2010-11-08 Doug Kwan <dougkwan@google.com>
1706 Cary Coutant <ccoutant@google.com>
1708 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1709 (Arm_exidx_merge_section::section_contents_): New data member.
1710 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1711 (Arm_input_section::~Arm_input_section): De-allocate memory.
1712 (Arm_input_section::original_contents_): New data member.
1713 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1714 in parameters instead of calling Object::section_contents without
1716 (Arm_output_section::group_section): New parameter TASK. Pass it
1717 to callees that need locking objects.
1718 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1719 to lock EXIDX input sections. Fix a formatting issue. Call
1720 Arm_exidx_merged_section::build_contents to create merged section
1722 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1723 to lock object of stub table owner.
1724 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1725 TEXT_SIZE to initialize data member TEXT_SIZE_.
1726 (Arm_exidx_input_section::addralign): Fix typo in comment.
1727 (Arm_exidx_input_section::text_size): New method.
1728 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1729 that require locking objects. Lock objects before scanning for stubs
1730 and updating local symbols.
1731 (Arm_input_section<big_endian>::init): Copy contents of original
1733 (Arm_input_section<big_endian>::do_write): Use saved contents of
1734 original input section instead of calling Object::section_contents
1736 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1737 size without calling Object::section_size().
1738 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1739 for size. Allocate a buffer for merged EXIDX entries.
1740 (Arm_exidx_merged_section::build_contents): New method.
1741 (Arm_exidx_merged_section::do_write): Move merge section contents
1742 building code to Arm_exidx_merged_section::build_contetns. Write
1743 out contetns in buffer instead of building it on the fly.
1744 (Arm_relobj::make_exidx_input_section): Also pass text section size
1745 to Arm_exidx_input_section constructor.
1746 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1747 (Arm_dynobj::do_read_symbols): Fix memory leak.
1748 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1749 * target.h: (class Task): Add forward declaration.
1750 (Target::relax): Add new parameter TASK and pass it to
1752 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1754 2010-11-05 Cary Coutant <ccoutant@google.com>
1757 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1758 object when reading from the file.
1759 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1761 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1762 when reading section contents.
1763 (get_section_contents): Likewise.
1764 (icf::find_identical_sections): Likewise.
1765 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1766 object when reading from the file.
1767 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1768 the object when doing deferred section layout.
1770 2010-11-03 Nick Clifton <nickc@redhat.com>
1773 * script.h (class Symbol_assignment: name): New member. Returns
1774 the name of the symbol.
1775 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1776 Returns true if the given symbol name is on the list of
1777 assignments wating to be processed.
1778 * archive.cc (should_incldue_member): If the symbol is undefined,
1779 check to see if it is on the list of symbols pending assignment.
1781 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
1783 * script-sections.cc (Script_sections::find_memory_region): Check
1784 for a NULL output section pointer.
1786 2010-10-29 Doug Kwan <dougkwan@google.com>
1788 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1789 Output_section::add_relaxed_input_section.
1790 * output.cc (Output_section::add_relaxed_input_section): Add new
1791 arguments LAYOUT and NAME. Set section order index.
1792 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1793 Copy section order index.
1794 * output.h (Output_section::add_relaxed_input_section): Add new
1795 arguments LAYOUT and NAME.
1797 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1799 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1800 NATIVE_OR_CROSS_LINKER.
1801 * testsuite/Makefile.in: Regenerate.
1803 2010-10-20 Doug Kwan <dougkwan@google.com>
1805 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1806 without SHF_LINK_ORDER flags.
1807 * layout.cc (Layout::choose_output_section): Do not filter
1808 SHF_LINK_ORDER flag in a relocatable link.
1810 2010-10-17 Cary Coutant <ccoutant@google.com>
1812 * output.h (Output_segment::set_section_addresses): Change function
1813 signature. Update all callers.
1814 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1816 (Output_segment::set_section_addresses): Align after last TLS
1817 section. Add padding before last relro section instead of after.
1819 2010-10-17 Doug Kwan <dougkwan@google.com>
1821 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1822 GOT output section to be writable.
1824 2010-10-14 Cary Coutant <ccoutant@google.com>
1826 * debug.h (DEBUG_INCREMENTAL): New flag.
1827 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1828 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1830 * incremental.cc (report_command_line): Ignore all forms of
1832 * layout.cc (Layout::Layout): Check parameters for incremental link
1834 * options.cc (General_options::parse_incremental): New function.
1835 (General_options::parse_no_incremental): New function.
1836 (General_options::parse_incremental_full): New function.
1837 (General_options::parse_incremental_update): New function.
1838 (General_options::incremental_mode_): New data member.
1839 (General_options::finalize): Check incremental_mode_.
1840 * options.h (General_options): Update help text for --incremental.
1841 Add --no-incremental, --incremental-full, --incremental-update.
1842 (General_options::Incremental_mode): New enum type.
1843 (General_options::incremental_mode): New function.
1844 (General_options::incremental_mode_): New data member.
1845 * parameters.cc (Parameters::incremental_mode_): New data member.
1846 (Parameters::set_options): Set incremental_mode_.
1847 (Parameters::set_incremental_full): New function.
1848 (Parameters::incremental): New function.
1849 (Parameters::incremental_update): New function.
1850 (set_parameters_incremental_full): New function.
1851 * parameters.h (Parameters::set_incremental_full): New function.
1852 (Parameters::incremental): New function.
1853 (Parameters::incremental_update): New function.
1854 (Parameters::incremental_mode_): New data member.
1855 (set_parameters_incremental_full): New function.
1856 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1857 incremental link mode.
1858 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1859 (Sized_relobj::do_relocate_sections): Likewise.
1860 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1862 * testsuite/Makefile.in: Regenerate.
1863 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1865 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1867 * script-sections.h (class Script_sections): Make
1868 Sections_elements typedef public.
1869 * script-sections.cc (class Sort_output_sections): Add elements_
1870 field. Add constructor which sets it; change all callers.
1871 (Sort_output_sections::is_before): New function.
1872 (Sort_output_sections::operator()): Call is_before.
1873 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1875 * testsuite/script_test_10.sh: New test. Test script section
1877 * testsuite/script_test_10.t: Likewise.
1878 * testsuite/script_test_10.s: Likewise.
1879 * testsuite/Makefile.am: Wrap the cross linker tests and the
1880 common tests into NATIVE_OR_CROSS_LINKER.
1881 (check_SCRIPTS): Add script_test_10.sh.
1882 (check_DATA): Add script_test_10.stdout.
1883 (script_test_10.o, script_test_10): New targets.
1884 (script_test_10.stdout): New target.
1885 * configure, testsuite/Makefile.in: Regenerate.
1887 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1889 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1890 error for the deprecated relocations.
1891 (Target_arm::Scan::global): Likewise.
1892 (Target_arm::Relocate::relocate): Likewise.
1894 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
1896 * fileread.cc (Input_file::find_file): Initialize *found_name
1897 and *namep when using the fallback search for case 4.
1899 2010-10-11 Cary Coutant <ccoutant@google.com>
1901 * options.h (class General_options): Redefine -z lazy as an alias for
1902 the negation of -z now.
1904 2010-10-11 Ian Lance Taylor <iant@google.com>
1906 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1909 2010-10-06 Nick Clifton <nickc@redhat.com>
1911 * script-sections.cc(class Memory_region): Remove
1912 current_lma_offset_ field. Rename current_vma_offset_ to
1913 current_offset_. Add last_section_ field.
1914 (Memory_region::get_current_vma_address): Rename to
1915 get_current_address.
1916 (Memory_region::get_current_lma_address): Delete.
1917 (Memory_region::increment_vma_offset): Rename to
1919 (Memory_region::increment_lma_offset): Delete.
1920 (Memory_region::attributes_compatible): New method. Returns
1921 true if the provided section is compatible with the region.
1922 (Memory_region::get_last_section): New method. Returns the last
1923 section to use the region.
1924 (Memory_region::set_last_section): New method. Stores the last
1925 section to use the region.
1926 (Script_sections::block_in_region): New method. Returns true if
1927 a block of memory is contained within a region.
1928 (Script_sections::find_memory_region): New method. Locates a
1929 memory region to be used to set a VMA or LMA address.
1930 (Output_section_definition::set_section_addresses): Add code to
1931 check for addresses set by memory regions.
1932 (Output_segment::set_section_addresses): Remove memory region
1934 (Script_sections::create_segment): Add a warning if a header
1935 segment is created outside of any region.
1936 * script-sections.h (class Script_sections): Add prototypes for
1937 find_memory_region and block_in_region methods.
1938 * testsuite/memory_test.s: Use .long instead of .word.
1939 * testsuite/memory_test.t: Add some more output sections.
1940 * testsuite/memory_test.sh: Update expected output.
1942 2010-10-02 Doug Kwan <dougkwan@google.com>
1944 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1945 defintion to symtab.h
1946 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1947 declaration to defintion.
1949 2010-10-01 Nick Clifton <nickc@redhat.com>
1951 * expression.cc (eval): Replace dummy argument with NULL.
1952 (eval_maybe_dot): Check for a NULL result section pointer.
1953 (Symbol_expression::value): Likewise.
1954 (Dot_expression::value): Likewise.
1955 (BINARY_EXPRESSION): Likewise.
1956 (Max_expression::value): Likewise.
1957 (Min_expression::value): Likewise.
1958 (Absolute_expression::value): Likewise.
1959 (Addr_expression::value_from_output_section): Likewise.
1960 (Loaddddr_expression::value_from_output_section): Likewise.
1961 (Segment_start_expression::value): Likewise.
1962 * script-sections.cc
1963 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1965 (Sections_elememt_dot_assignment::set_section_addresses):
1967 (Output_data_expression::do_write_to_buffer): Likewise.
1968 (Output_section_definition::finalize_symbols): Likewise.
1969 (Output_section_definition::set_section_addresses): Likewise.
1971 2010-09-30 Doug Kwan <dougkwan@google.com>
1973 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1975 2010-09-28 Sriraman Tallam <tmsriram@google.com>
1977 * target.h (Target::can_icf_inline_merge_sections): New virtual
1979 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1981 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1983 * icf.cc (get_section_contents): Inline merge sections only when
1986 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1988 * configure: Regenerate.
1990 2010-09-17 Ian Lance Taylor <iant@google.com>
1992 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1993 * testsuite/Makefile.am (memory_test.o): New target.
1994 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1996 * testsuite/Makefile.in: Rebuild.
1998 2010-09-17 Doug Kwan <dougkwan@google.com>
2000 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2001 defintion if relocation uses GOT entries of the symbol.
2002 * testsuite/icf_safe_test.sh: Fix test.
2003 * testsuite/icf_safe_so_test.sh: Fix test.
2005 2010-09-16 Cary Coutant <ccoutant@google.com>
2007 * script_sections.cc (class Memory_region): Remove "NULL" from
2008 vector initializations.
2010 2010-09-15 Cary Coutant <ccoutant@google.com>
2012 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2013 Resolve forwarding symbols.
2015 2010-09-15 Doug Kwan <dougkwan@google.com>
2017 * gold/testsuite/script_test_3.t: Add ARM special sections.
2018 * gold/testsuite/script_test_4.t: Same.
2019 * gold/testsuite/script_test_5.t: Same.
2020 * gold/testsuite/script_test_6.t: Same.
2021 * gold/testsuite/script_test_7.t: Same.
2022 * gold/testsuite/script_test_7.t: Same.
2023 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2025 2010-09-14 Cary Coutant <ccoutant@google.com>
2027 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2028 (Target_x86_64::Relocate::relocate_tls): Replace check for
2029 saw_tls_block_reloc_ with test for executable section.
2031 2010-09-12 Cary Coutant <ccoutant@google.com>
2033 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2034 position-independent executables to shared libraries need dynamic
2036 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2037 position-independent executables.
2038 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2039 * testsuite/Makefile.in: Regenerate.
2041 2010-09-10 Nick Clifton <nickc@redhat.com>
2044 * testsuite/memory_test.t: Discard any sections that are not
2047 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2050 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2051 "This::" to work around a bug in gcc 4.2.
2053 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2055 2010-09-09 Rafael Espindola <espindola@google.com>
2057 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2058 sections with different PF_X flags in the same segment.
2059 (Layout::find_first_load_seg): Search all segments to find the first
2061 * options.h (rosegment): New.
2063 2010-09-08 Rafael Espindola <espindola@google.com>
2065 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2067 2010-09-08 Doug Kwan <dougkwan@google.com>
2069 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2070 (Arm_relobj::do_relocate_sections): Add new parameter for output
2071 file to match the parent.
2072 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2073 of local symbols instead of input values. Update code to track
2074 changes in gold::relocate_section.
2075 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2076 (Sized_relobj::compute_final_local_value_internal): New methods.
2077 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2078 body into private version of Sized_relobj::compute_final_local_value.
2079 Call the inline method.
2080 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2081 merged symbol value if there is one.
2082 (Symbol_value::has_output_value): New method defintiion.
2083 (Sized_relobj::Compute_final_local_value_status): New enum type.
2084 (Sized_relobj::compute_final_local_value): New methods.
2085 (Sized_relobj::compute_final_local_value_internal): New methods.
2086 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2087 and arm_cortex_a8.sh.
2088 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2089 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2091 * Makefile.in: Regenerate.
2092 * testsuite/arm_bl_out_of_range.s: Update test.
2093 * testsuite/thumb_bl_out_of_range.s: Ditto.
2094 * testsuite/thumb_blx_out_of_range.s: Ditto.
2095 * testsuite/arm_branch_out_of_range.sh: New file.
2096 * testsuite/arm_cortex_a8.sh: Ditto.
2097 * testsuite/arm_cortex_a8_b.s: Ditto.
2098 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2099 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2100 * testsuite/arm_cortex_a8_bl.s: Ditto.
2101 * testsuite/arm_cortex_a8_blx.s: Ditto.
2102 * testsuite/arm_cortex_a8_local.s: Ditto.
2103 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2104 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2106 2010-09-08 Rafael Espindola <espindola@google.com>
2108 * Makefile.am (memory_test.stdout): Run readelf with -W.
2109 * Makefile.in: Regenerate.
2110 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2113 2010-09-08 Rafael Espindola <espindola@google.com>
2115 * script-sections.cc (Script_sections::add_memory_region): Convert
2116 field precision to int.
2117 * script.cc (script_set_section_region, script_set_section_region):
2118 Convert field precision to int.
2120 2010-09-08 Rafael Espindola <espindola@google.com>
2122 * arm.cc (do_finalize_sections): Create the __exidx_start and
2123 __exdix_end symbols even when the section is missing.
2125 2010-09-08 Nick Clifton <nickc@redhat.com>
2127 * README: Remove claim that MEMORY is not supported.
2128 * expression.cc (script_exp_function_origin)
2129 (script_exp_function_length): Move from here to ...
2130 * script.cc: ... here.
2131 (script_set_section_region, script_add_memory)
2132 (script_parse_memory_attr, script_include_directive): New
2134 * script-sections.cc
2135 (class Memory_region): New class.
2136 (class Output_section_definition): Add set_memory_region,
2137 set_section_vma, set_section_lma and get_section_name methods.
2138 (class Script_Sections): Add add_memory_region,
2139 find_memory_region, find_memory_region_origin,
2140 find_memory_region_length and set_memory_region methods.
2141 Have set_section_addresses method walk the list of set memory
2143 Extend the print methos to display memory regions.
2144 * script-sections.h: Add prototypes for new methods.
2145 Add enum for MEMORY region attributes.
2146 * yyscript.y: Add support for parsing MEMORY regions.
2147 * script-c.h: Add prototypes for new functions.
2148 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2149 * testsuite/Makefile.in: Regenerate.
2150 * testsuite/memory_test.sh: New script.
2151 * testsuite/memory_test.s: New assembler source file.
2152 * testsuite/memory_test.t: New linker script.
2154 2010-08-27 Doug Kwan <dougkwan@google.com>
2156 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2157 reference override an existing dynamic weak reference.
2158 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2159 * testsuite/Makefile.in: Regenerate.
2160 * testsuite/dyn_weak_ref.sh: New file.
2161 * testsuite/dyn_weak_ref_1.c: Ditto.
2162 * testsuite/dyn_weak_ref_2.c: Ditto.
2164 2010-08-27 Ian Lance Taylor <iant@google.com>
2166 * incremental.h (class Incremental_input_entry): Add virtual
2169 2010-08-27 Ian Lance Taylor <iant@google.com>
2171 * testsuite/start_lib_test_3.c: Mark t3 as used.
2173 2010-08-27 Nick Clifton <nickc@redhat.com>
2175 * options.cc (version_script): Fix small typo in previous
2178 2010-08-25 Nick Clifton <nickc@redhat.com>
2180 * archive.cc: Formatting fixes: Remove whitespace between
2181 typename and following asterisk. Remove whitespace between
2182 function name and opening parenthesis.
2183 * archive.h: Likewise.
2185 * attributes.cc: Likewise.
2186 * attributes.h: Likewise.
2187 * common.cc: Likewise.
2188 * copy-relocs.cc: Likewise.
2189 * dirsearch.h: Likewise.
2190 * dynobj.cc: Likewise.
2191 * ehframe.cc: Likewise.
2192 * ehframe.h: Likewise.
2193 * expression.cc: Likewise.
2194 * fileread.cc: Likewise.
2195 * fileread.h: Likewise.
2197 * gold-threads.cc: Likewise.
2198 * gold.cc: Likewise.
2199 * i386.cc: Likewise.
2201 * incremental-dump.cc: Likewise.
2202 * incremental.cc: Likewise.
2203 * layout.cc: Likewise.
2204 * layout.h: Likewise.
2205 * main.cc: Likewise.
2206 * merge.cc: Likewise.
2207 * merge.h: Likewise.
2208 * object.cc: Likewise.
2209 * object.h: Likewise.
2210 * options.cc: Likewise.
2211 * options.h: Likewise.
2212 * output.cc: Likewise.
2213 * output.h: Likewise.
2214 * plugin.cc: Likewise.
2215 * plugin.h: Likewise.
2216 * powerpc.cc: Likewise.
2217 * reloc.cc: Likewise.
2218 * script-c.h: Likewise.
2219 * script-sections.cc: Likewise.
2220 * script.cc: Likewise.
2221 * stringpool.cc: Likewise.
2222 * symtab.cc: Likewise.
2223 * symtab.h: Likewise.
2224 * target.cc: Likewise.
2225 * timer.cc: Likewise.
2226 * timer.h: Likewise.
2227 * version.cc: Likewise.
2228 * x86_64.cc: Likewise.
2230 2010-08-24 Nick Clifton <nickc@redhat.com>
2233 * layout.cc (segment_precedes): Sort segments by their physical
2234 addresses, if they have been set.
2236 2010-08-23 Cary Coutant <ccoutant@google.com>
2238 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2240 (Lib_group::include_member): Unlock object after deleting its
2242 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2245 2010-08-19 Neil Vachharajani <nvachhar@google.com>
2246 Cary Coutant <ccoutant@google.com>
2248 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2249 constructor, and set_blocker.
2250 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2252 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2253 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2254 * testsuite/Makefile.am (start_lib_test): New test case.
2255 * testsuite/Makefile.in: Regenerate.
2256 * testsuite/start_lib_test_main.c: New file.
2257 * testsuite/start_lib_test_1.c: New file.
2258 * testsuite/start_lib_test_2.c: New file.
2259 * testsuite/start_lib_test_3.c: New file.
2261 2010-08-19 Ian Lance Taylor <iant@google.com>
2263 * Makefile.in: Rebuild with automake 1.11.1.
2264 * aclocal.m4: Likewise.
2265 * testsuite/Makefile.in: Likewise.
2267 2010-08-19 Ian Lance Taylor <iant@google.com>
2270 * i386.cc (class Output_data_plt_i386): Update declarations.
2271 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2272 local_ifuncs_ fields.
2273 (Target_i386::do_plt_section_for_global): New function.
2274 (Target_i386::do_plt_section_for_local): New function.
2275 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2276 parameter; change all callers. Initialize global_ifuncs_ and
2277 local_ifuncs_. If doing a static link define __rel_iplt_start and
2279 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2280 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2281 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2283 (Target_i386::make_plt_section): New function, broken out of
2284 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2285 (Target_i386::make_plt_entry): Call make_plt_section.
2286 (Target_i386::make_local_ifunc_plt_entry): New function.
2287 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2288 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2289 R_386_IRELATIVE to switch.
2290 (Target_i386::Scan::global): Likewise.
2291 (Target_i386::Relocate::relocate): Likewise.
2292 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2294 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2295 (Target_x86_64::do_plt_section_for_global): New function.
2296 (Target_x86_64::do_plt_section_for_local): New function.
2297 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2298 parameter; change all callers. If doing a static link define
2299 __rela_iplt_start and __rela_iplt_end.
2300 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2301 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2302 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2304 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2305 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2307 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2308 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2309 R_X86_64_IRELATIVE to switch.
2310 (Target_x86_64::Scan::global): Likewise.
2311 (Target_x86_64::Relocate::relocate): Likewise.
2312 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2314 * target.h (class Target): Add plt_section_for_global and
2315 plt_section_for_local functions. Add do_plt_section_for_global
2316 and do_plt_section_for_local virtual functions.
2317 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2318 clarifying comments.
2319 (Symbol::use_plt_offset): Handle IFUNC symbol.
2320 * object.cc (Sized_relobj::Sized_relobj): Initialize
2322 (Sized_relobj::local_has_plt_offset): New function.
2323 (Sized_relobj::local_plt_offset): New function.
2324 (Sized_relobj::set_local_plt_offset): New function.
2325 (Sized_relobj::do_count): Handle IFUNC symbol.
2326 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2327 a bit away from input_shndx_ field. Add set_is_func_symbol and
2328 is_ifunc_symbol functions.
2329 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2330 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2331 local_plt_offsets_ field.
2332 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2333 * output.h (class Output_section_data): Add non-const
2334 output_section function.
2335 (class Output_data_got): Update declarations.
2336 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2337 Add use_plt_offset parameter to global and local constructors.
2338 Change all callers. Change local_sym_index_ field to 31 bits.
2339 Change GSYM_CODE and CONSTANT_CODE accordingly.
2340 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2341 doing a static link don't set sh_link field.
2342 (Output_data_got::Got_entry::write): Use PLT offset if
2344 (Output_data_got::add_global_plt): New function.
2345 (Output_data_got::add_local_plt): New function.
2346 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2347 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2348 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2349 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2350 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2352 * testsuite/ifunc-sel.h: New file.
2353 * testsuite/ifuncmain1.c: New file.
2354 * testsuite/ifuncmain1vis.c: New file.
2355 * testsuite/ifuncmod1.c: New file.
2356 * testsuite/ifuncdep2.c: New file.
2357 * testsuite/ifuncmain2.c: New file.
2358 * testsuite/ifuncmain3.c: New file.
2359 * testsuite/ifuncmod3.c: New file.
2360 * testsuite/ifuncmain4.c: New file.
2361 * testsuite/ifuncmain5.c: New file.
2362 * testsuite/ifuncmod5.c: New file.
2363 * testsuite/ifuncmain6pie.c: New file.
2364 * testsuite/ifuncmod6.c: New file.
2365 * testsuite/ifuncmain7.c: New file.
2366 * configure, testsuite/Makefile.in: Rebuild.
2368 2010-08-18 Ian Lance Taylor <iant@google.com>
2371 (Output_section_incremental_inputs::write_input_files): Add cast
2372 to avoid signed/unsigned comparison warning.
2373 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2375 2010-08-12 Cary Coutant <ccoutant@google.com>
2377 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2379 2010-08-13 Ian Lance Taylor <iant@google.com>
2381 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2383 2010-08-12 Cary Coutant <ccoutant@google.com>
2384 Doug Kwan <dougkwan@google.com>
2386 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2387 defintion overrides non-weak undef, remember that the original undef
2389 * symtab.cc (Symbol_table::sized_write_global): For undef without
2390 an original weak binding, set binding to global in output.
2391 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2392 * testsuite/Makefile.in: Regenerate.
2393 * testsuite/strong_ref_weak_def.sh: New file.
2394 * testsuite/strong_ref_weak_def_1.c: Ditto.
2395 * testsuite/strong_ref_weak_def_2.c: Ditto.
2397 2010-08-12 Cary Coutant <ccoutant@google.com>
2399 * testsuite/incremental_test.sh: Rewrite.
2400 * testsuite/incremental_test_1.c: Rewrite.
2401 * testsuite/incremental_test_2.c: Rewrite.
2403 2010-08-12 Cary Coutant <ccoutant@google.com>
2405 * arm.cc (Target_arm::got_size): Add const.
2406 (Target_arm::got_entry_count): New function.
2407 (Target_arm::plt_entry_count): New function.
2408 (Target_arm::first_plt_entry_offset): New function.
2409 (Target_arm::plt_entry_size): New function.
2410 (Output_data_plt_arm::entry_count): New function.
2411 (Output_data_plt_arm::first_plt_entry_offset): New function.
2412 (Output_data_plt_arm::get_plt_entry_size): New function.
2413 * i386.cc (Target_i386::got_size): Add const.
2414 (Target_i386::got_entry_count): New function.
2415 (Target_i386::plt_entry_count): New function.
2416 (Target_i386::first_plt_entry_offset): New function.
2417 (Target_i386::plt_entry_size): New function.
2418 (Output_data_plt_i386::entry_count): New function.
2419 (Output_data_plt_i386::first_plt_entry_offset): New function.
2420 (Output_data_plt_i386::get_plt_entry_size): New function.
2421 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2422 find_incremental_inputs_sections. Dump incremental_got_plt section.
2423 * incremental.cc: Include target.h.
2424 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2425 parameter. Adjust all callers. Find incremental_got_plt section.
2426 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2428 (Output_section_incremental_inputs::set_final_data_size): Calculate
2429 size of incremental_got_plt section.
2430 (Output_section_incremental_inputs::do_write): Write the
2431 incremental_got_plt section.
2432 (Got_plt_view_info): New struct.
2433 (Local_got_offset_visitor): New class.
2434 (Global_got_offset_visitor): New class.
2435 (Global_symbol_visitor_got_plt): New class.
2436 (Output_section_incremental_inputs::write_got_plt): New function.
2437 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2438 Add parameter. Adjust all callers.
2439 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2440 (Incremental_inputs::got_plt_section): New function.
2441 (Incremental_inputs::got_plt_section_): New data member.
2442 (Incremental_got_plt_reader): New class.
2443 * layout.cc (Layout::create_incremental_info_sections): Add the
2444 incremental_got_plt section.
2445 * object.h (Got_offset_list::get_list): New function.
2446 (Got offset_list::for_all_got_offsets): New function.
2447 (Sized_relobj::local_got_offset_list): New function.
2448 * powerpc.cc (Target_powerpc::got_size): Add const.
2449 (Target_powerpc::got_entry_count): New function.
2450 (Target_powerpc::plt_entry_count): New function.
2451 (Target_powerpc::first_plt_entry_offset): New function.
2452 (Target_powerpc::plt_entry_size): New function.
2453 (Output_data_plt_powerpc::entry_count): New function.
2454 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2455 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2456 * sparc.cc (Target_sparc::got_size): Add const.
2457 (Target_sparc::got_entry_count): New function.
2458 (Target_sparc::plt_entry_count): New function.
2459 (Target_sparc::first_plt_entry_offset): New function.
2460 (Target_sparc::plt_entry_size): New function.
2461 (Output_data_plt_sparc::entry_count): New function.
2462 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2463 (Output_data_plt_sparc::get_plt_entry_size): New function.
2464 * symtab.h (Symbol::got_offset_list): New function.
2465 (Symbol_table::for_all_symbols): New function.
2466 * target.h (Sized_target::got_entry_count): New function.
2467 (Sized_target::plt_entry_count): New function.
2468 (Sized_target::plt_entry_size): New function.
2469 * x86_64.cc (Target_x86_64::got_size): Add const.
2470 (Target_x86_64::got_entry_count): New function.
2471 (Target_x86_64::plt_entry_count): New function.
2472 (Target_x86_64::first_plt_entry_offset): New function.
2473 (Target_x86_64::plt_entry_size): New function.
2474 (Output_data_plt_x86_64::entry_count): New function.
2475 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2476 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2478 2010-08-12 Cary Coutant <ccoutant@google.com>
2480 * archive.cc: Include incremental.h.
2481 (Archive::Archive): Initialize incremental_info_.
2482 (Archive::include_member): Record archive members in incremental info.
2483 (Add_archive_symbols::run): Record begin and end of an archive in
2485 (Lib_group::include_member): Record objects in incremental info.
2486 * archive.h (Incremental_archive_entry): Forward declaration.
2487 (Archive::set_incremental_info): New member function.
2488 (Archive::incremental_info): New member function.
2489 (Archive::Unused_symbol_iterator): New class.
2490 (Archive::unused_symbols_begin): New member function.
2491 (Archive::unused_symbols_end): New member function.
2492 (Archive::incremental_info_): New data member.
2493 * incremental-dump.cc (find_input_containing_global): New function.
2494 (dump_incremental_inputs): Dump new incremental info sections.
2495 * incremental.cc: Include symtab.h.
2496 (Output_section_incremental_inputs): New class.
2497 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2498 new incremental info sections.
2499 (Sized_incremental_binary::do_check_inputs): Likewise.
2500 (Incremental_inputs::report_archive): Remove.
2501 (Incremental_inputs::report_archive_begin): New function.
2502 (Incremental_inputs::report_archive_end): New function.
2503 (Incremental_inputs::report_object): New function.
2504 (Incremental_inputs::finalize_inputs): Remove.
2505 (Incremental_inputs::report_input_section): New function.
2506 (Incremental_inputs::report_script): Rewrite.
2507 (Incremental_inputs::finalize): Do nothing but finalize string table.
2508 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2509 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2510 (Incremental_inputs::create_data_sections): New function.
2511 (Incremental_inputs::relocs_entsize): New function.
2512 (Output_section_incremental_inputs::set_final_data_size): New function.
2513 (Output_section_incremental_inputs::do_write): New function.
2514 (Output_section_incremental_inputs::write_header): New function.
2515 (Output_section_incremental_inputs::write_input_files): New function.
2516 (Output_section_incremental_inputs::write_info_blocks): New function.
2517 (Output_section_incremental_inputs::write_symtab): New function.
2518 * incremental.h (Incremental_script_entry): Forward declaration.
2519 (Incremental_object_entry): Forward declaration.
2520 (Incremental_archive_entry): Forward declaration.
2521 (Incremental_inputs): Forward declaration.
2522 (Incremental_inputs_header_data): Remove.
2523 (Incremental_inputs_header): Remove.
2524 (Incremental_inputs_header_write): Remove.
2525 (Incremental_inputs_entry_data): Remove.
2526 (Incremental_inputs_entry): Remove.
2527 (Incremental_inputs_entry_write): Remove.
2528 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2529 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2530 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2531 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2533 (Incremental_input_entry): New class.
2534 (Incremental_script_entry): New class.
2535 (Incremental_object_entry): New class.
2536 (Incremental_archive_entry): New class.
2537 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2538 (Incremental_inputs::report_inputs): Remove.
2539 (Incremental_inputs::report_archive): Remove.
2540 (Incremental_inputs::report_archive_begin): New function.
2541 (Incremental_inputs::report_archive_end): New function.
2542 (Incremental_inputs::report_object): Change prototype.
2543 (Incremental_inputs::report_input_section): New function.
2544 (Incremental_inputs::report_script): Change prototype.
2545 (Incremental_inputs::get_reloc_count): New function.
2546 (Incremental_inputs::set_reloc_count): New function.
2547 (Incremental_inputs::create_data_sections): New function.
2548 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2549 (Incremental_inputs::inputs_section): New function.
2550 (Incremental_inputs::symtab_section): New function.
2551 (Incremental_inputs::relocs_section): New function.
2552 (Incremental_inputs::get_stringpool): Add const.
2553 (Incremental_inputs::command_line): Add const.
2554 (Incremental_inputs::inputs): Remove.
2555 (Incremental_inputs::command_line_key): New function.
2556 (Incremental_inputs::input_file_count): New function.
2557 (Incremental_inputs::input_files): New function.
2558 (Incremental_inputs::relocs_entsize): New function.
2559 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2560 (Incremental_inputs::finalize_inputs): Remove.
2561 (Incremental_inputs::Input_info): Remove.
2562 (Incremental_inputs::lock_): Remove.
2563 (Incremental_inputs::inputs_): Change type.
2564 (Incremental_inputs::inputs_map_): Remove.
2565 (Incremental_inputs::current_object_entry_): New data member.
2566 (Incremental_inputs::inputs_section_): New data member.
2567 (Incremental_inputs::symtab_section_): New data member.
2568 (Incremental_inputs::relocs_section_): New data member.
2569 (Incremental_inputs::reloc_count_): New data member.
2570 (Incremental_inputs_reader): New class.
2571 (Incremental_symtab_reader): New class.
2572 (Incremental_relocs_reader): New class.
2573 * layout.cc (Layout::finalize): Move finalization of incremental info
2574 and creation of incremental info sections to follow finalization of
2575 symbol table. Set offsets for postprocessing sections.
2576 (Layout::create_incremental_info_sections): Call
2577 Incremental_inputs::create_data_sections. Add incremental symtab
2578 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2579 sections to layout after input sections.
2580 * layout.h (struct Timespec): Forward declaration.
2581 (Layout::incremental_inputs): Add const.
2582 (Layout::create_incremental_info_sections): Add parameter.
2583 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2584 * object.cc: Include incremental.h.
2585 (Relobj::finalize_incremental_relocs): New function.
2586 (Sized_relobj::do_layout): Record input sections in incremental info.
2587 * object.h (Object::output_section): New function.
2588 (Object::output_section_offset): Moved from Relobj.
2589 (Object::get_incremental_reloc_base): New function.
2590 (Object::get_incremental_reloc_count): New function.
2591 (Object::do_output_section): New function.
2592 (Object::do_output_section_offset): Moved from Relobj.
2593 (Object::do_get_incremental_reloc_base): New function.
2594 (Object::do_get_incremental_reloc_count): New function.
2595 (Object::Object): Initialize new data members.
2596 (Relobj::output_section): Renamed do_output_section and moved to
2598 (Relobj::output_section_offset): Moved to Object.
2599 (Relobj::do_get_incremental_reloc_base): New function.
2600 (Relobj::do_get_incremental_reloc_count): New function.
2601 (Relobj::allocate_incremental_reloc_counts): New function.
2602 (Relobj::count_incremental_reloc): New function.
2603 (Relobj::finalize_incremental_relocs): New function.
2604 (Relobj::next_incremental_reloc_index): New function.
2605 (Relobj::reloc_counts_): New data member.
2606 (Relobj::reloc_bases_): New data member.
2607 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2608 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2609 (Sized_relobj::incremental_relocs_scan): New function.
2610 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2611 (Sized_relobj::incremental_relocs_write): New function.
2612 (Sized_relobj::incremental_relocs_write_reltype): New function.
2613 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2615 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2616 archives and object files elsewhere.
2617 (Add_symbols::run): Report object files here.
2618 (Finish_group::run): Report end of archive at end of group.
2619 * reloc.cc: Include layout.h, incremental.h.
2620 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2621 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2622 (Sized_relobj::incremental_relocs_scan): New function.
2623 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2624 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2625 (Sized_relobj::incremental_relocs_write): New function.
2626 (Sized_relobj::incremental_relocs_write_reltype): New function.
2627 * script.cc (read_input_script): Rewrite test for incremental link.
2628 Change call to Incremental_inputs::report_script.
2629 * symtab.h (Symbol_table::first_global_index): New function.
2630 (Symbol_table::output_count): New function.
2632 2010-08-12 Doug Kwan <dougkwan@google.com>
2634 * arm.cc (Target_arm::merge_object_attributes): Check command line
2635 options --no-wchar-size-warning and --no-enum-size-warning.
2636 * options.h (General_options): Add ld-compatible options
2637 --no-enum-size-warning and --no-wchar-size-warning.
2639 2010-08-04 Ian Lance Taylor <iant@google.com>
2641 * x86_64.cc (Target_x86_64::Scan::local): Use
2642 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2643 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2644 (Target_x86_64::Scan::global): Likewise.
2645 (Target_x86_64::Relocate::relocate): Likewise.
2646 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2649 2010-08-03 Cary Coutant <ccoutant@google.com>
2651 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2652 to reserve space in merged_strings vector. Keep total input size
2654 (Output_merge_string::do_print_merge_stats): Print total input size.
2655 * merge.h (Output_merge_string): Add input_size_ field.
2656 * stringpool.cc (Stringpool_template::string_length): Move
2657 implementations out of Stringpool_template class and place in
2659 * stringpool.h (string_length): Move out of Stringpool_template.
2661 2010-08-03 Ian Lance Taylor <iant@google.com>
2664 * layout.cc (relaxation_loop_body): If address of load segment is
2665 set, adjust address to include headers if possible.
2667 2010-08-03 Ian Lance Taylor <iant@google.com>
2669 * version.cc (version_string): Bump to 1.10.
2671 2010-08-03 Ian Lance Taylor <iant@google.com>
2674 * layout.h (enum Output_section_order): Define.
2675 (class Layout): Update declarations.
2676 * layout.cc (Layout::get_output_section): Add order parameter.
2677 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2678 is_first_non_relro parameters. Change all callers.
2679 (Layout::choose_output_section): Likewise.
2680 (Layout::add_output_section_data): Likewise.
2681 (Layout::make_output_section): Likewise. Set order.
2682 (Layout::default_section_order): New function.
2683 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2684 * output.cc (Output_section::Output_section): Initialize order_.
2685 Don't initialize deleted fields.
2686 (Output_segment::Output_segment): Don't initialize deleted
2688 (Output_segment::add_output_section_to_load): New function
2689 replacing add_output_section. Change all callers to call this or
2690 add_output_section_to_nonload.
2691 (Output_segment::add_output_section_to_nonload): New function.
2692 (Output_segment::remove_output_section): Rewrite.
2693 (Output_segment::add_initial_output_data): Likewise.
2694 (Output_segment::has_any_data_sections): Likewise.
2695 (Output_segment::is_first_section_relro): Likewise.
2696 (Output_segment::maximum_alignment): Likewise.
2697 (Output_segment::has_dynamic_reloc): New function replacing
2698 dynamic_reloc_count. Change all callers.
2699 (Output_segment::has_dynamic_reloc_list): New function replacing
2700 dynamic_reloc_count_list. Change all callers.
2701 (Output_segment::set_section_addresses): Rewrite.
2702 (Output_segment::set_offset): Rewrite.
2703 (Output_segment::find_first_and_last_list): Remove.
2704 (Output_segment::set_tls_offsets): Rewrite.
2705 (Output_segment::first_section_load_address): Likewise.
2706 (Output_segment::output_section_count): Likewise.
2707 (Output_segment::section_with_lowest_load_address): Likewise.
2708 (Output_segment::write_section_headers): Likewise.
2709 (Output_segment::print_sections_to_map): Likewise.
2710 * output.h (class Output_data): Remove dynamic_reloc_count_
2711 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2712 (Output_data::add_dynamic_reloc): Rewrite.
2713 (Output_data::has_dynamic_reloc): New function.
2714 (Output_data::dynamic_reloc_count): Remove.
2715 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2716 is_last_relro_, is_first_non_relro_, is_interp_,
2717 is_dynamic_linker_section_ fields. Add order and set_order
2718 functions. Remove is_relro_local, set_is_relro_local,
2719 is_last_relro, set_is_last_relro, is_first_non_relro,
2720 set_is_first_non_relro functions, is_interp, set_is_interp,
2721 is_dynamic_linker_section, and set_is_dynamic_linker_section
2723 (class Output_segment): Change Output_data_list from std::list to
2724 std:;vector. Add output_lists_ field. Remove output_data_ and
2725 output_bss_ fields. Update declarations.
2727 2010-08-02 Ian Lance Taylor <iant@google.com>
2729 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2730 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2731 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2733 2010-08-02 Ian Lance Taylor <iant@google.com>
2736 * script.cc (Script_options::Script_options): Initialize
2737 symbol_definitions_ and symbol_references_.
2738 (Script_options::add_symbol_assignment): Update
2739 symbol_definitions_ and symbol_references_.
2740 (Script_options::add_symbol_reference): New function.
2741 (script_symbol): New function.
2742 * script.h (class Script_options): Add symbol_definitions_ and
2743 symbol_references_ fields.
2744 (Script_options::referenced_const_iterator): New type.
2745 (Script_options::referenced_begin): New function.
2746 (Script_options::referenced_end): New function.
2747 (Script_options::is_referenced): New function.
2748 (Script_options::any_unreferenced): New function.
2749 * script-c.h (script_symbol): Declare.
2750 * yyscript.y (exp): Call script_symbol.
2751 * symtab.cc: Include "script.h".
2752 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2753 Change all callers. Check symbols referenced by scripts.
2754 (Symbol_table::add_undefined_symbols_from_command_line): Add
2755 layout parameter. Change all callers.
2756 (Symbol_table::do_add_undefined_symbols_from_command_line):
2757 Likewise. Break out loop body. Check symbols referenced by
2759 (Symbol_table::add_undefined_symbol_from_command_line): New
2760 function broken out of
2761 do_add_undefined_symbols_from_command_line.
2762 * symtab.h (class Symbol_table): Update declarations.
2763 * archive.cc: Include "layout.h".
2764 (Archive::should_include_member): Add layout parameter. Change
2765 all callers. Check for symbol mentioned in expression.
2766 * archive.h (class Archive): Update declaration.
2767 * object.cc (Sized_relobj::do_should_include_member): Add layout
2769 * object.h (Object::should_include_member): Add layout parameter.
2771 (Object::do_should_include_member): Add layout parameter.
2772 (class Sized_relobj): Update declaration.
2773 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2775 * dynobj.h (class Sized_dynobj): Update declaration.
2776 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2778 * plugin.h (class Sized_pluginobj): Update declaration.
2780 2010-08-02 Ian Lance Taylor <iant@google.com>
2783 * output.cc (Output_segment::set_offset): Search for the first and
2784 last sections rather than assuming that the list is in order.
2785 (Output_segment::find_first_and_last_list): New function.
2786 * output.h (class Output_segment): Update declarations.
2787 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2788 (relro_strip_test_SOURCES): New variable.
2789 (relro_strip_test_DEPENDENCIES): New variable.
2790 (relro_strip_test_LDFLAGS): New variable.
2791 (relro_strip_test_LDADD): New variable.
2792 (relro_strip_test.so): New target.
2794 2010-08-02 Ian Lance Taylor <iant@google.com>
2796 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2797 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2798 (Target_i386::got_tlsdesc_section): New function.
2799 (Target_i386::got_section): Create space for GOT entries for
2800 TLSDESC relocations.
2801 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2803 (Target_i386::Scan::global): Likewise.
2804 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2806 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2807 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2808 (Target_x86_64::got_tlsdesc_section): New function.
2809 (Target_x86_64::got_section): Create space for GOT entries for
2810 TLSDESC relocations.
2811 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2813 (Target_x86_64::Scan::global): Likewise.
2814 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2817 2010-08-02 Ian Lance Taylor <iant@google.com>
2819 * testsuite/final_layout.sh: Use dc to convert from hex to
2822 2010-07-29 Sriraman Tallam <tmsriram@google.com>
2824 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2825 paramter to the call to gold::gc_process_relocs.
2826 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2827 paramter to the call to gold::gc_process_relocs.
2828 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2829 parameter to the call to gold::gc_process_relocs.
2830 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2831 template parameter to the call to gold::gc_process_relocs.
2832 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2833 paramter to the call to gold::gc_process_relocs.
2834 * gc.h (get_embedded_addend_size): New function.
2835 (gc_process_relocs): Save the size of the reloc for use by ICF.
2836 * icf.cc (get_section_contents): Get the addend from the text section
2837 for SHT_REL relocation sections.
2838 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2839 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2840 * int_encoding.h (read_from_pointer): New overloaded function.
2841 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2842 * testsuite/icf_sht_rel_addend_test.sh: New file.
2843 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2844 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2846 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2848 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2849 * Makefile.in: Regenerate.
2850 * testsuite/Makefile.in: Regenerate.
2852 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
2854 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2855 * gold/testsuite/debug_msg.cc: Likewise.
2856 * gold/testsuite/odr_violation1.cc
2857 * gold/testsuite/odr_violation2.cc
2859 2010-07-21 Cary Coutant <ccoutant@google.com>
2861 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2862 string, and length fields.
2863 (Output_merge_string::Merged_strings_list): New type.
2864 (Output_merge_string::Merged_strings_lists): New typedef.
2865 (Output_merge_string): Replace merged_strings_ with
2866 merged_strings_lists_.
2867 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2868 Merged_strings_list per input object and section. Don't store pointer
2869 to the string. Don't store length with each merged string entry.
2870 (Output_merge_string::finalize_merged_data): Loop over list of merged
2871 strings lists. Recompute length of each merged string.
2873 2010-07-15 Cary Coutant <ccoutant@google.com>
2875 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2878 2010-07-14 Ian Lance Taylor <iant@google.com>
2880 * descriptors.cc (Descriptors::open): Report correct name in error
2883 2010-07-13 Doug Kwan <dougkwan@google.com>
2885 * arm.cc (Arm_input_section::Arm_input_section): For a
2886 SHT_ARM_EXIDX section, always keeps the input sections.
2887 (Arm_input_section::set_exidx_section_link): New method.
2888 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2889 has_errors_ to false.
2890 (Arm_exidx_input_section::has_errors,
2891 Arm_exidx_input_section::set_has_errors): New methods.
2892 (Arm_exidx_input_section::has_errors_): New data member.
2893 (Arm_relobj::get_exidx_shndx_list): New method.
2894 (Arm_output_section::append_text_sections_to_list): Do not skip
2895 section without SHF_EXECINSTR.
2896 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2898 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2899 section header. Make error messages more verbose. Check for
2900 a non-executable section linked to an EXIDX section.
2901 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2902 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2903 check that there is no deferred EXIDX section if we exit early.
2904 Instead of not making an EXIDX section in case of an error, make one
2905 and set the has_errors flag of it.
2906 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2907 in a relocatable link.
2908 (Target_arm::do_relax): Look for the EXIDX output section instead of
2909 assuming that it is called .ARM.exidx.
2910 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2911 section list. Do not check for SHF_EXECINSTR section flags but
2912 skip any input section with errors.
2913 * output.cc (Output_section::Output_section): Initialize
2914 always_keeps_input_sections_ to false.
2915 (Output_section::add_input_section): Check for
2916 always_keeps_input_sections_.
2917 * output.h (Output_section::always_keeps_input_sections,
2918 Output_section::set_always_keeps_input_sections): New methods.
2919 (Output_section::always_keeps_input_sections): New data member.
2921 2010-07-13 Rafael Espindola <espindola@google.com>
2923 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2924 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2926 2010-07-13 Philip Herron <herron.philip@googlemail.com>
2927 Ian Lance Taylor <iant@google.com>
2929 * output.h (Output_section_lookup_maps::add_merge_section):
2930 Correct check of whether value was inserted.
2931 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2932 (Output_section_lookup_maps::add_relaxed_input_section):
2934 * arm.cc (Target_arm::got_section): Remove used local os.
2935 * i386.cc (Target_i386::got_section): Likewise.
2936 * x86_64.cc (Target_x86_64::got_section): Likewise.
2937 * sparc.cc (Target_sparc::got_section): Likewise.
2938 (Target_sparc::relocate): Remove unused local have_got_offset.
2939 * powerpc.cc (Target_powerpc::relocate): Likewise.
2941 2010-07-13 Ian Lance Taylor <iant@google.com>
2943 * compressed_output.cc (zlib_decompress): Fix signature in
2946 * archive.cc (Archive::include_member): Unlock an external member
2947 of a thin archive. Don't bother to delete an object we know is
2950 2010-07-12 Cary Coutant <ccoutant@google.com>
2952 * compressed_output.cc (zlib_decompress): New function.
2953 (get_uncompressed_size): New function.
2954 (decompress_input_section): New function.
2955 * compressed_output.h (get_uncompressed_size): New function.
2956 (decompress_input_section): New function.
2957 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2958 Handle compressed debug sections.
2959 * layout.cc (is_compressed_debug_section): New function.
2960 (Layout::output_section_name): Map compressed section names to
2962 * layout.h (is_compressed_debug_section): New function.
2963 (is_debug_info_section): Recognize compressed debug sections.
2964 * merge.cc: Include compressed_output.h.
2965 (Output_merge_data::do_add_input_section): Handle compressed
2967 (Output_merge_string::do_add_input_section): Handle compressed
2969 * object.cc: Include compressed_output.h.
2970 (Sized_relobj::Sized_relobj): Initialize new data members.
2971 (build_compressed_section_map): New function.
2972 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2973 * object.h (Object::section_is_compressed): New method.
2974 (Object::do_section_is_compressed): New method.
2975 (Sized_relobj::Compressed_section_map): New type.
2976 (Sized_relobj::do_section_is_compressed): New method.
2977 (Sized_relobj::compressed_sections_): New data member.
2978 * output.cc (Output_section::add_input_section): Handle compressed
2980 * reloc.cc: Include compressed_output.h.
2981 (Sized_relobj::write_sections): Handle compressed debug sections.
2983 2010-07-08 Cary Coutant <ccoutant@google.com>
2985 * resolve.cc (Symbol_table::resolve): Remember whether undef was
2986 weak when resolving to a dynamic def.
2987 (Symbol_table::should_override): Add adjust_dyndef flag; set it
2988 for weak undef/dynamic def cases. Adjust callers.
2989 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2990 undef_binding_weak_.
2991 (Symbol_table::sized_write_globals): Adjust symbol binding.
2992 (Symbol_table::sized_write_symbol): Add binding parameter.
2993 * symtab.h (Symbol::set_undef_binding): New method.
2994 (Symbol::is_undef_binding_weak): New method.
2995 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2996 (Symbol_table::should_override): Add new parameter.
2997 (Symbol_table::sized_write_symbol): Add new parameter.
2999 * testsuite/weak_undef_file1.cc: Add new test case.
3000 * testsuite/weak_undef_file2.cc: Fix header comment.
3001 * testsuite/weak_undef_test.cc: Add new test case.
3003 2010-06-29 Doug Kwan <dougkwan@google.com>
3005 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3006 Initialize USE_SYMBOL_.
3007 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3009 (Arm_reloc_property::uses_symbol_): New data member declaration.
3010 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3011 uses symbol value and symbol is undefined but not weakly undefined.
3013 2010-06-28 Rafael Espindola <espindola@google.com>
3015 * plugin.cc (Plugin::load): Use dlerror.
3017 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3019 * symtab.cc (detect_odr_violations): When reporting an ODR
3020 violation, report an object where the symbol is defined.
3022 2010-06-25 Doug Kwan <dougkwan@google.com>
3024 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3025 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3027 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3028 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3029 target hook to detect function points.
3030 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3031 * icf.h (Icf::check_section_for_function_pointers): Change type of
3032 parameter SECTION_NAME to const reference to std::string. Use
3033 target hook to determine if section may have unsafe pointers.
3034 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3037 2010-06-21 Rafael Espindola <espindola@google.com>
3039 * fileread.cc (Input_file::find_fie): New
3040 (Input_file::open): Use Input_file::find_fie.
3041 * fileread.h (Input_file::find_fie): New
3042 * plugin.cc (set_extra_library_path): New.
3043 (Plugin::load): Add set_extra_library_path to the transfer vector.
3044 (Plugin_manager::set_extra_library_path): New.
3045 (Plugin_manager::add_input_file): Use the extra search path if set.
3046 (set_extra_library_path(): New.
3047 * plugin.h (Plugin_manager): Add set_extra_library_path and
3050 2010-06-19 Cary Coutant <ccoutant@google.com>
3052 * layout.cc (gdb_sections): Add .debug_types.
3053 (lines_only_debug_sections): Likewise.
3055 2010-06-18 Rafael Espindola <espindola@google.com>
3057 * plugin.cc (add_input_file,add_input_library)
3058 (Plugin_manager::add_input_file): Make filename arguments const.
3059 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3062 2010-06-16 Doug Kwan <dougkwan@google.com>
3064 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3065 .ARM.attributes section if we have not merged any input
3066 attributes sections.
3068 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3070 * arm.cc: Allow combining objects with no EABI version
3073 2010-06-15 Rafael Espindola <espindola@google.com>
3075 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3077 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3079 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3080 (struct iovec): Correct !HAVE_READV definition.
3082 2010-06-10 Cary Coutant <ccoutant@google.com>
3084 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3085 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3087 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3090 * symtab.h (Symbol::is_placeholder): New member function.
3091 * target-reloc.h (relocate_section): Check for placeholder symbols.
3093 * testsuite/Makefile.am (plugin_test_8): New test.
3094 (plugin_test_9): New test.
3095 * testsuite/Makefile.in: Regenerate.
3097 2010-06-09 Nick Clifton <nickc@redhat.com>
3099 * yyscript.y (input_list_element): Allow strings prefixed with
3100 the '-' character. Treat these as libraries.
3101 * script.cc (script_add_library): New function. Adds a library
3102 specified by "-l<name>" found in an input script.
3103 * script-c.h: Add prototype for script_add_library.
3105 2010-06-07 Doug Kwan <dougkwan@google.com>
3107 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3108 Restrict stub-group size to be within long conditional branch
3109 range when working around cortex-A8 erratum.
3111 2010-06-07 Damien Diederen <dd@crosstwine.com>
3113 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3116 2010-06-03 Sriraman Tallam <tmsriram@google.com>
3120 (Output_section::Input_section_sort_entry::compare_section_ordering):
3121 Change to return non-zero correctly.
3122 (Output_section::Input_section_sort_section_order_index_compare
3123 ::operator()): Change to fix ambiguity in comparisons.
3125 2010-06-01 Sriraman Tallam <tmsriram@google.com>
3127 * gold.h (is_wildcard_string): New function.
3128 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3129 (Layout::layout_eh_frame): Ditto.
3130 (Layout::find_section_order_index): New method.
3131 (Layout::read_layout_from_file): New method.
3132 * layout.h (Layout::find_section_order_index): New method.
3133 (Layout::read_layout_from_file): New method.
3134 (Layout::input_section_position_): New private member.
3135 (Layout::input_section_glob_): New private member.
3136 * main.cc (main): Call read_layout_from_file here.
3137 * options.h (--section-ordering-file): New option.
3138 * output.cc (Output_section::input_section_order_specified_): New
3140 (Output_section::Output_section): Initialize new member.
3141 (Output_section::add_input_section): Add new parameter.
3142 Keep input sections when --section-ordering-file is used.
3143 (Output_section::set_final_data_size): Sort input sections when
3144 section ordering file is specified.
3145 (Output_section::Input_section_sort_entry): Add new parameter.
3147 (Output_section::Input_section_sort_entry::compare_section_ordering):
3149 (Output_section::Input_section_sort_compare::operator()): Change to
3150 consider section_order_index.
3151 (Output_section::Input_section_sort_init_fini_compare::operator()):
3152 Change to consider section_order_index.
3153 (Output_section::Input_section_sort_section_order_index_compare
3154 ::operator()): New method.
3155 (Output_section::sort_attached_input_sections): Change to sort
3156 according to section order when specified.
3157 (Output_section::add_input_section<32, true>): Add new parameter.
3158 (Output_section::add_input_section<64, true>): Add new parameter.
3159 (Output_section::add_input_section<32, false>): Add new parameter.
3160 (Output_section::add_input_section<64, false>): Add new parameter.
3161 * output.h (Output_section::add_input_section): Add new parameter.
3162 (Output_section::input_section_order_specified): New
3164 (Output_section::set_input_section_order_specified): New method.
3165 (Input_section::Input_section): Initialize section_order_index_.
3166 (Input_section::section_order_index): New method.
3167 (Input_section::set_section_order_index): New method.
3168 (Input_section::section_order_index_): New member.
3169 (Input_section::Input_section_sort_section_order_index_compare): New
3171 (Output_section::input_section_order_specified_): New member.
3172 * script-sections.cc (is_wildcard_string): Delete and move modified
3174 (Output_section_element_input::Output_section_element_input): Modify
3175 call to is_wildcard_string.
3176 (Output_section_element_input::Input_section_pattern
3177 ::Input_section_pattern): Ditto.
3178 (Output_section_element_input::Output_section_element_input): Ditto.
3179 * testsuite/Makefile.am (final_layout): New test case.
3180 * testsuite/Makefile.in: Regenerate.
3181 * testsuite/final_layout.cc: New file.
3182 * testsuite/final_layout.sh: New file.
3184 2010-06-01 Rafael Espindola <espindola@google.com>
3186 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3188 2010-06-01 Rafael Espindola <espindola@google.com>
3190 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3191 visibility of symbols.
3193 2010-05-27 Doug Kwan <dougkwan@google.com>
3195 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3196 from start of output section instead of address for a local symbol
3197 in a merged or relaxed section when doing a relocatable link.
3199 2010-05-26 Rafael Espindola <espindola@google.com>
3202 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3203 adding sections the garbage collector removed.
3204 * gold/testsuite/Makefile.am: Add test.
3205 * gold/testsuite/Makefile.in: Regenerate.
3206 * gold/testsuite/plugin_test_7.sh: New.
3207 * gold/testsuite/plugin_test_7_1.c: New.
3208 * gold/testsuite/plugin_test_7_2.c: New.
3210 2010-05-26 Rafael Espindola <espindola@google.com>
3212 * script-sections.cc (Output_section_definition::set_section_addresses):
3213 Check for --section-start.
3215 2010-05-26 Doug Kwan <dougkwan@google.com>
3217 * arm.cc (Arm_scan_relocatable_relocs): New class.
3218 (Target_arm::relocate_special_relocatable): New method.
3219 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3220 (Arm_relocate_functions::thumb_branch_common): Same.
3221 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3222 instead of Default_scan_relocatable_relocs.
3223 * target-reloc.h (relocate_for_relocatable): Let target handle
3224 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3225 * target.h (Sized_target::relocate_special_relocatable): New method.
3227 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3229 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3231 2010-05-23 Doug Kwan <dougkwan@google.com>
3233 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3235 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3236 with a direct branch, not a conditional branch, to a stub.
3237 * merge.cc (Output_merge_base::record_input_section): New method
3239 (Output_merge_data::do_add_input_section): Record input section if
3240 keeps-input-sections flag is set.
3241 (Output_merge_string::do_add_input_section): Ditto.
3242 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3243 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3245 (Output_merge_base::keeps_input_sections,
3246 Output_merge_base::set_keeps_input_sections,
3247 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3249 (Output_merge_base::Input_sections): New type declaration.
3250 (Output_merge_base::input_sections_begin,
3251 Output_merge_base::input_sections_end,
3252 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3253 (Output_merge_base::bool keeps_input_sections_,
3254 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3255 Output_merge_base::input_sections_): New data members.
3256 (Output_merge_data::do_set_keeps_input_sections): New method
3258 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3259 * output.cc (Output_section::Input_section::relobj): Move method
3260 defintion from class declaration to here and handle merge sections.
3261 (Output_section::Input_section::shndx): Ditto.
3262 (Output_section::Output_section): Remove initializations of removed
3263 data members and initialize new data member LOOKUP_MAPS_.
3264 (Output_section::add_input_section): Set keeps-input-sections flag
3265 for a newly created merge output section as appropriate. Adjust code
3266 to use Output_section_lookup_maps class.
3267 (Output_section::add_relaxed_input_section): Adjst code for lookup
3268 maps code refactoring.
3269 (Output_section::add_merge_input_section): Add a new parameter
3270 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3271 class. If adding input section to a newly created merge output
3272 section fails, remove the new merge section.
3273 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3274 Adjust code for use of the Output_section_lookup_maps class.
3275 (Output_section::find_merge_section): Ditto.
3276 (Output_section::build_lookup_maps): New method defintion.
3277 (Output_section::find_relaxed_input_section): Adjust code to use
3278 Output_section_lookup_maps class.
3279 (Output_section::get_input_sections): Export merge sections. Adjust
3280 code to use Output_section_lookup_maps class.
3281 (Output_section:::add_script_input_section): Adjust code to use
3282 Output_section_lookup_maps class. Update lookup maps for merge
3284 (Output_section::discard_states): Use Output_section_lookup_maps.
3285 (Output_section::restore_states): Same.
3286 * output.h (Merge_section_properties): Move class defintion out of
3288 (Output_section_lookup_maps): New class.
3289 (Output_section::Input_section::is_merge_section): New method
3291 (Output_section::Input_section::relobj): Move defintion out of class
3292 defintion. Declare method only.
3293 (Output_section::Input_section::shndx): Ditto.
3294 (Output_section::Input_section::output_merge_base): New method defintion.
3295 (Output_section::Input_section::u2_.pomb): New union field.
3296 (Output_section::Merge_section_by_properties_map,
3297 Output_section::Output_section_data_by_input_section_map,
3298 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3300 (Output_section::add_merge_input_section): Add new parameter
3301 KEEPS_INPUT_SECTIONS.
3302 (Output_section::build_lookup_maps): New method declaration.
3303 (Output_section::merge_section_map_,
3304 Output_section::merge_section_by_properties_map_,
3305 Output_section::relaxed_input_section_map_,
3306 Output_section::is_relaxed_input_section_map_valid_): Remove data
3308 (Output_section::lookup_maps_): New data member.
3310 2010-05-21 Doug Kwan <dougkwan@google.com>
3313 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3314 avoid a compilation error.
3316 2010-05-19 Rafael Espindola <espindola@google.com>
3318 * script-sections.cc (Output_section_definition::allocate_to_segment):
3319 Update the phdrs_list even when the output section is NULL.
3320 * testsuite/Makefile.am: Add test.
3321 * testsuite/Makefile.in: Regenerate.
3322 * testsuite/script_test_9.cc: New.
3323 * testsuite/script_test_9.sh: New.
3324 * testsuite/script_test_9.t: New.
3326 2010-05-19 Doug Kwan <dougkwan@google.com>
3328 * arm.cc (Arm_input_section::original_size): New method.
3329 (Arm_input_section::do_addralign): Add a cast.
3330 (Arm_input_section::do_output_offset): Remove static cast.
3331 (Arm_input_section::original_addralign,
3332 Arm_input_section::original_size_): Change type to uint32_t.
3333 (Arm_input_section::init): Add safe casts for section alignment
3335 (Arm_input_section::set_final_data_size): Do not set address and
3336 offset of stub table.
3337 (Arm_output_section::fix_exidx_coverage): Change use of of
3338 Output_section::Simple_input_section to that of
3339 Output_section::Input_section.
3340 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3341 except for the first pass.
3342 * output.cc (Output_section::get_input_sections): Change type of
3343 input_sections to std::list<Input_section>.
3344 (Output_section::add_script_input_section): Rename from
3345 Output_section::add_simple_input_section. Change type of SIS
3346 parameter from Simple_input_section to Input_section.
3347 * output.h (Output_section::Simple_input_section): Remove class.
3348 (Output_section::Input_section): Change class visibility to public.
3349 (Output_section::Input_section::addralign): Use stored alignments
3350 for special input sections if set.
3351 (Output_section::Input_section::set_addralign): New method.
3352 (Output_section::get_input_sections): Change parameter type from
3353 list of Simple_input_section to list of Input_section.
3354 (Output_section::add_script_input_section): Rename from
3355 Output_section::add_simple_input_section. Change first parameter's
3356 type from Simple_input_section to Input_section and remove the
3357 second and third parameters.
3358 * script-sections.cc (Input_section::Input_section_list): Change
3359 type to list of Output_section::Input_section/
3360 (Input_section_info::Input_section_info): Change parameter type of
3361 INPUT_SECTION to Output_section::Input_section.
3362 (Input_section_info::input_section): Change return type.
3363 (Input_section_info::input_section_): Change type to
3364 Output_section::Input_section.
3365 (Output_section_element_input::set_section_addresses): Adjust code
3366 to use Output_section::Input_section instead of
3367 Output_section::Simple_input_section. Adjust code for renaming
3368 of Output_section::add_simple_input_section.
3369 (Orphan_output_section::set_section_addresses): Ditto.
3371 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3373 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3374 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3376 2010-05-18 Rafael Espindola <espindola@google.com>
3378 * options.cc (General_options::finalize): Handle -nostdlib.
3379 * options.h (nostdlib): New option.
3380 * script.cc (script_add_search_dir): Handle -nostdlib.
3382 2010-05-12 Doug Kwan <dougkwan@google.com>
3384 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3385 attributes section only if there no attributes section after merging.
3386 (Target_arm::merge_object_attributes): Move value of
3387 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3388 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3389 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3390 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3391 and arm_attr_merge_7.stdout.
3392 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3393 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3394 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3395 arm_attr_merge_7b.o): New rules.
3396 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3398 * testsuite/Makefile.in: Regenerate.
3399 * testsuite/arm_attr_merge.sh: New file.
3400 * testsuite/arm_attr_merge_[67][ab].s: Same.
3402 2010-05-05 Nick Clifton <nickc@redhat.com>
3404 * po/es.po: Updated Spanish translation.
3406 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3408 * Makefile.am (install-exec-local): Properly install gold as
3409 default cross linker.
3410 * Makefile.in: Regenerated.
3412 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3413 Nick Clifton <nickc@redhat.com>
3415 * configure.ac (install_as_default): Define and set to false
3416 unless --enable-gold or --enable-gold=both/gold has been
3418 * configure: Regenerate.
3420 * Makefile.am (install-exec-local): Install the executable as
3421 'ld.gold'. If install_as_default is true then also install it as
3423 * Makefile.in: Regenerated.
3425 2010-04-24 Ian Lance Taylor <iant@google.com>
3427 * layout.cc (Layout::layout_reloc): In relocatable link don't
3428 combine reloc sections for grouped sections.
3430 2010-04-23 Sriraman Tallam <tmsriram@google.com>
3432 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3433 sections that are not ordinary to icf.
3434 * icf.cc (get_section_contents): Handle relocation pointing to section
3435 with no object or shndx information.
3436 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3437 * testsuite/Makefile.in: Regenerate.
3438 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3439 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3441 2010-04-22 Ian Lance Taylor <iant@google.com>
3443 * expression.cc (Expression::Expression_eval_info): Add
3444 result_alignment_pointer field.
3445 (Expression::eval_with_dot): Add result_alignment_pointer
3446 parameter. Change all callers.
3447 (Expression::eval_maybe_dot): Likewise.
3448 (class Binary_expression): Add alignment_pointer parameter to
3449 left_value and right_value. Change all callers.
3450 (BINARY_EXPRESSION): Set result alignment.
3451 (class Trinary_expression): Add alignment_pointer parameter to
3452 arg2_value and arg3_value. Change all callers.
3453 (Trinary_cond::value): Set result alignment.
3454 (Max_expression::value, Min_expression::value): Likewise.
3455 (Align_expression::value): Likewise.
3456 * script-sections.cc (class Sections_element): Add dot_alignment
3457 parameter to set_section_addresses virtual function. Update
3459 (class Output_section_element): Likewise.
3460 (Script_sections::create_segments): Add dot_alignment parameter.
3462 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3463 (Script_sections::set_phdrs_clause_addresses): Likewise.
3464 * script-sections.h: Update declarations.
3465 * script.h: Update declarations.
3466 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3468 * testsuite/script_test_3.t: Set large alignment.
3469 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3470 segment has expected alignment.
3472 2010-04-22 Nick Clifton <nickc@redhat.com>
3474 * po/gold.pot: Updated by the Translation project.
3475 * po/vi.po: Updated Vietnamese translation.
3477 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3479 * testsuite/Makefile.am (check_PROGRAMS): Add
3480 icf_virtual_function_folding_test.
3481 * testsuite/Makefile.in: Regenerated.
3483 2010-04-15 Andrew Haley <aph@redhat.com>
3485 * options.h (merge_exidx_entries): New option.
3486 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3487 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3488 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3489 (Target_arm::merge_exidx_entries): New function.
3490 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3491 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3492 to Arm_exidx_fixup constructor.
3493 Add new arg, merge_exidx_entries.
3494 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3495 Arm_output_section::fix_exidx_coverage.
3497 2010-04-18 Sriraman Tallam <tmsriram@google.com>
3499 * icf.cc (get_section_contents): Check for preemptible functions.
3500 Ignore addend when appropriate.
3501 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3503 (add_from_relobj): Check for section folded.
3504 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3505 * symtab.h (should_add_dynsym_entry): Add new parameter.
3506 * target-reloc.h (scan_relocs): Check for section folded.
3507 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3508 Check reloc types for function pointers in shared objects.
3509 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3511 (icf_preemptible_functions_test): New test case.
3512 (icf_string_merge_test): New test case.
3513 * testsuite.Makefile.in: Regenerate.
3514 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3515 bar_glob. Refactor code.
3516 * testsuite/icf_preemptible_functions_test.cc: New file.
3517 * testsuite/icf_preemptible_functions_test.sh: New file.
3518 * testsuite/icf_string_merge_test.cc: New file.
3519 * testsuite/icf_string_merge_test.sh: New file.
3520 * testsuite/icf_virtual_function_folding_test.cc: New file.
3521 * testsuite/icf_virtual_function_folding_test.sh: New file.
3523 2010-04-14 Doug Kwan <dougkwan@google.com>
3525 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3526 for local symbol recounting if we remove a section due to ICF.
3527 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3528 there are no regular objects in input.
3530 2010-04-13 Doug Kwan <dougkwan@google.com>
3532 * arm.cc (Arm_input_section::set_final_data_size): Compute
3533 accurate final data size instead of using current data size.
3535 2010-04-09 Doug Kwan <dougkwan@google.com>
3537 * layout.cc (Layout::choose_output_section): Handle script section
3539 (Layout::make_output_section_for_script): Add section type parameter.
3540 Handle script section types.
3541 * layout.h (Layout::make_output_section_for_script): Add section
3543 * output.cc (Output_section::Output_section): Initialize data member
3545 (Output_section::do_reset_address_and_file_offset): Do not set address
3546 to 0 if section is a NOLOAD section.
3547 * output.h (Output_section::is_noload): New method.
3548 (Output_section::set_is_noload): Ditto.
3549 (Output_section::is_noload_): New data member.
3550 * script-c.h (Script_section_type): New enum type.
3551 (struct Parser_output_section_header): Add new file section_type.
3552 * script-sections.cc (Sections_element::output_section_name): Add
3553 parameter for returning script section type.
3554 (Output_section_definition::output_section_name): Ditto.
3555 (Output_section_definition::section_type)P; New method.
3556 (Output_section_definiton::script_section_type_name): Ditto.
3557 (Output_section_definition::script_section_type_): New data member.
3558 (Output_section_definition::Output_section_definition): Initialize
3559 data member Output_section_definition::script_section_type_.
3560 (Output_section_definition::create_sections): Pass script section type
3561 to Layout::make_output_section_for_script.
3562 (Output_section_definition::output_section_name): Return script
3563 section type to caller.
3564 (Output_section_definition::set_section_address): Do not advance
3565 dot value and load address if section type is NOLOAD. Set address
3566 of NOLOAD sections regardless of section flags.
3567 (Output_section_definition::print): Print section type if it is
3568 not SCRIPT_SECTION_TYPE_NONE.
3569 (Output_section_definition::section_type): New method.
3570 (Output_section_definition::script_section_type_name): Ditto.
3571 (Script_sections::output_section_name): Add new parameter
3572 PSECTION_TYPE for returning script section type. Pass it to
3573 section elements. Handle discard sections.
3574 (Sort_output_sections::operator()): Handle NOLOAD sections.
3575 * script-sections.h (Script_sections::Section_type): New enum type.
3576 (Script_sections::output_section_name): Add a new parameter for
3577 returning script section type.
3578 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3580 * yyscript.y (union): Add new field SECTION_TYPE.
3581 (COPY, DSECT, INFO, NOLOAD): New tokens.
3582 (opt_address_and_section_type): Change type to output_section_header.
3583 (section_type): New non-terminal
3584 (section_header): Handle section type.
3585 (opt_address_and_section_type): Return section type value.
3587 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3589 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3590 * testsuite/plugin_common_test_2.c (foo): Likewise.
3592 2010-04-08 Doug Kwan <dougkwan@google.com>
3594 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3596 * output.cc (Output_section::add_merge_input_section): Simplify
3597 code and return status of Output_merge_base::add_input_section.
3598 Update merge section map only if Output_merge_base::add_input_section
3601 2010-04-07 Doug Kwan <dougkwan@google.com>
3603 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3604 if section is marked as containing instructions but has no mapping
3606 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3607 correct section index.
3608 (Arm_relobj::find_linked_text_section): Ditto.
3610 2010-04-07 Cary Coutant <ccoutant@google.com>
3612 * archive.cc (include_member): Destroy Read_symbols_data object before
3614 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3615 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3616 (Read_symbols_data::~Read_symbols_data) New destructor.
3617 (Section_relocs::Section_relocs) New constructor.
3618 (Section_relocs::~Section_relocs) New destructor.
3619 (Read_relocs_data::Read_relocs_data) New constructor.
3620 (Read_relocs_data::~Read_relocs_data) New destructor.
3621 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3622 pointers to NULL after deleting.
3624 2010-04-07 Doug Kwan <dougkwan@google.com>
3626 * arm.cc: Replace "endianity" with "endianness" in comments.
3627 (Arm_exidx_cantunwind): Ditto.
3628 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3629 (Arm_relobj::merge_flags_and_attributes): New method.
3630 (Arm_relobj::merge_flags_and_attributes_): New data member.
3631 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3632 (Arm_relobj::scan_sections_for_stubs): Ditto.
3633 (Arm_relobj::do_read_symbols): Check to see if we really want to
3634 merge processor-specific flags and attributes. Exit early if
3635 an object is empty except for section names and the undefined symbol.
3636 (Target_arm::do_finalize_sections): Move check for ELF format to
3637 Arm_relobj::do_read_symbols. Merge processor specific flags and
3638 attributes from a regular object only when we have determined that
3639 it is aapropriate. Do not create an .ARM.attributes section in
3640 output if there is no regular input object.
3641 (Target_arm::merge_processor_specific_flags): Check
3642 --warn-mismatch before printing any error.
3643 (Target_arm::merge_object_attributes): Ditto.
3644 * gold.cc (queue_middle_tasks): Handle the case in which there is
3645 no regular object in input.
3646 * options.cc (General_options::parse_EB): New method.
3647 (General_options::parse_EL): Same.
3648 (General_options::General_options): Initialize endianness_.
3649 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3651 (General_options::Endianness): New enum.
3652 (General_options::endianness): New method.
3653 (General_options::endianness_): New data member.
3654 * parameters.cc (Parameters::set_options): Check target endianness.
3655 (Parameters::set_target_once): Ditto.
3656 (Parameters::check_target_endianness): New method.
3657 (parameters_force_valid_target): If either -EL or -EB is specified,
3658 use it to define endianness of default target.
3659 * parameters.h (Parameters::check_target_endianness): New method
3661 * target.h (class Target): Change "endianity" to "endianness"
3664 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3666 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3667 * configure: Regenerate.
3668 * Makefile.in: Regenerate.
3669 * testsuite/Makefile.in: Regenerate.
3671 2010-04-06 Cary Coutant <ccoutant@google.com>
3674 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3675 prevailing definitions of common symbols.
3676 * testsuite/plugin_test_6.sh: New test case.
3677 * testsuite/plugin_common_test_1.c: New test case.
3678 * testsuite/plugin_common_test_2.c: New test case.
3679 * testsuite/Makefile.am (plugin_test_6): New test case.
3680 * testsuite/Makefile.in: Regenerate.
3682 2010-04-06 Nick Clifton <nickc@redhat.com>
3684 * po/vi.po: New Vietnamese translation.
3686 2010-03-30 Doug Kwan <dougkwan@google.com>
3688 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3690 2010-03-25 Doug Kwan <dougkwan@google.com>
3692 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3693 to avoid a conversion warning on a 32-bit host.
3695 2010-03-24 Ian Lance Taylor <iant@google.com>
3697 * testsuite/script_test_3.t: Add a TLS segment.
3698 * testsuite/Makefile.am (check_PROGRAMS): Add
3699 tls_phdrs_script_test.
3700 (tls_phdrs_script_test_SOURCES): Define.
3701 (tls_phdrs_script_test_DEPENDENCIES): Define.
3702 (tls_phdrs_script_test_LDFLAGS): Define.
3703 (tls_phdrs_script_test_LDADD): Define.
3704 * testsuite/Makefile.in: Rebuild.
3706 2010-03-23 Cary Coutant <ccoutant@google.com>
3708 * fileread.cc (find_or_make_view): Fix comment.
3710 2010-03-23 Ian Lance Taylor <iant@google.com>
3712 * script-sections.cc (class Orphan_section_placement): Define
3713 PLACE_TLS and PLACE_TLS_BSS.
3714 (Orphan_section_placement::Orphan_section_placement): Initialize
3716 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3717 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3718 (tls_script_test_SOURCES): Define.
3719 (tls_script_test_DEPENDENCIES): Define.
3720 (tls_script_test_LDFLAGS): Define.
3721 (tls_script_test_LDADD): Define.
3722 * testsuite/Makefile.in: Rebuild.
3724 2010-03-22 Doug Kwan <dougkwan@google.com>
3726 * arm.cc (Arm_relocate_functions::abs8,
3727 Arm_relocate_functions::abs16): Use correct check for overflow
3728 specified in the ARM ELF specs.
3729 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3730 target of a BLX instruction specially.
3731 (Reloc_stub::stub_type_for_reloc): Ditto.
3732 (Relocate::relocate): Use symbolic names instead of numeric relocation
3733 codes to report error.
3734 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3736 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3737 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3738 thumb2_blx_out_of_range.stdout
3739 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3740 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3741 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3742 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3743 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3744 thumb2_blx_in_range, thumb2_blx_in_range.o,
3745 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3746 thumb2_blx_out_of_range.o): New rules.
3747 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3748 thumb2_blx_in_range and thumb2_blx_out_of_range.
3749 * testsuite/Makefile.in: Regenerate.
3750 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3751 * testsuite/thumb_blx_in_range.s: New file.
3752 * testsuite/thumb_blx_out_of_range.s: New file.
3754 2010-03-22 Rafael Espindola <espindola@google.com>
3756 * archive.cc (Should_include): Move to archive.h.
3757 (should_include_member): Make it a member of Archive.
3759 (Add_lib_group_symbols): New.
3760 * archive.h: Include options.h.
3761 (Archive_member): Moved from Archive.
3762 (Should_include): Moved from archive.cc.
3764 (Add_lib_group_symbols): New.
3765 * dynobj.cc (do_should_include_member): New.
3766 * dynobj.h (do_should_include_member): New.
3767 * gold.cc (queue_initial_tasks): Update call to queue.
3768 * main.cc (main): Print lib group stats.
3769 * object.cc (do_should_include_member): New.
3770 * object.h: Include archive.h.
3771 (Object::should_include_member): New.
3772 (Object::do_should_include_member): New.
3773 (Sized_relobj::do_should_include_member): New.
3774 * options.cc (General_options::parse_start_lib): New.
3775 (General_options::parse_end_lib): New.
3776 (Input_arguments::add_file): Handle lib groups.
3777 (Input_arguments::start_group): Check we are not in a lib.
3778 (Input_arguments::start_lib): New.
3779 (Input_arguments::end_lib): New.
3780 * options.h (General_options): Add start_lib and end_lib.
3781 (Input_argument::lib_): New.
3782 (Input_argument::lib): New.
3783 (Input_argument::is_lib): New.
3784 (Input_file_lib): New.
3785 (Input_arguments::in_lib_): New.
3786 (Input_arguments::in_lib): New.
3787 (Input_arguments::start_lib): New.
3788 (Input_arguments::end_lib_): New.
3789 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3790 in unused members as preempted.
3791 (Sized_pluginobj::do_should_include_member): New.
3792 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3793 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3795 (Read_symbols::do_whole_lib_group): New.
3796 (Read_symbols::do_lib_group): New.
3797 (Read_symbols::do_read_symbols): Handle lib groups.
3798 (Read_symbols::get_name): Handle lib groups.
3799 * readsyms.h (Read_symbols): Add an archive member pointer.
3800 (Read_symbols::do_whole_lib_group): New.
3801 (Read_symbols::do_lib_group): New.
3802 (Read_symbols::member_): New.
3803 * script.cc (read_input_script): Update call to queue_soon.
3805 2010-03-19 Doug Kwan <dougkwan@google.com>
3807 * arm.cc (Stub_table::Stub_table): Initialize new data members
3808 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3809 (Stub_table::add_reloc_stub): Assign stub offset and update
3810 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3811 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3813 (Stub_table::update_data_size_and_addralign): Use
3814 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3815 instead of going over all reloc stubs.
3816 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3817 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3818 Stringpool_template::offset_ to size of Stringpool_char.
3819 (Stringpool_template::new_key_offset): Remove code to initialize
3820 Stringpool_template::offset_.
3821 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3822 Stringpool_template::offset_ to zero.
3824 2010-03-15 Doug Kwan <dougkwan@google.com>
3826 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3828 (Stringpool_template::new_key_offset): New method.
3829 (Stringpool_template::add_string): Assign offsets when adding new
3831 (Stringpool_template::set_string_offsets): Do not set string offsets
3832 when not optimizing.
3833 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3835 (Chunked_vector::clear): Clear size_.
3836 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3837 (Chunked_vector::size): Return size_.
3838 (Chunked_vector::push_back): Use size_ to find insert position.
3839 (Chunked_vector::size_): New data member.
3840 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3841 (Stringpool_template::new_key_offset): New method declaration.
3842 (Stringpool_template::offset_): New data member.
3844 2010-03-15 Rafael Espindola <espindola@google.com>
3846 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3847 Add_symbols' constructor.
3848 * readsyms.h (Add_symbols): Remove the input_group member.
3850 2010-03-10 Ian Lance Taylor <iant@google.com>
3852 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3853 target to ask whether a reference to a symbol requires a stack
3855 * target.h (Target::is_call_to_non_split): New function.
3856 (Target::do_is_call_to_non_split): Declare virtual function.
3857 * target.cc: Include "symtab.h".
3858 (Target::do_is_call_to_non_split): New function.
3859 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3861 2010-03-10 Cary Coutant <ccoutant@google.com>
3863 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3864 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3865 (File_read::open[2]): Add whole_file_view_ to list of views.
3866 (File_read::make_view): Remove test of whole_file_view_.
3867 (File_read::find_or_make_view): Create whole_file_view_ if
3869 (File_read::clear_views): Replace bool parameter with enum;
3870 adjust all callers. Don't delete views with permanent data;
3871 do delete cached views and views from archives if
3872 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3873 if clearing the corresponding view.
3874 * fileread.h (File_read::Clear_views_mode): New enum.
3875 (File_read::View::is_permanent_view): New method.
3876 (File_read::clear_views): Replace bool parameter
3877 with enum; adjust all callers.
3878 * options.h (General_options): Change keep_files_mapped option;
3879 add map_whole_files.
3880 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3882 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3885 2010-03-10 David S. Miller <davem@davemloft.net>
3887 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3889 2010-03-09 Sriraman Tallam <tmsriram@google.com>
3891 * icf.cc (get_section_contents): Add '@' marker after processing the
3894 2010-03-08 Doug Kwan <dougkwan@google.com>
3896 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3897 due to a conversion warning.
3898 (Arm_relobj::update_output_local_symbol_count): Check for local
3899 symbol with unset output index.
3901 2010-03-05 Ian Lance Taylor <iant@google.com>
3903 * options.h (class General_options): Add --spare-dynamic-tags.
3904 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3905 --spare-dynamic-tags.
3907 2010-03-05 Ian Lance Taylor <iant@google.com>
3909 * incremental.cc: Include "libiberty.h".
3911 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
3913 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3914 function, is_info_ member.
3915 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3916 (Versions::Versions): Update caller.
3917 (Versions::define_base_version): Likewise.
3918 (Versions::add_def): Likewise.
3920 2010-03-03 Sriraman Tallam <tmsriram@google.com>
3922 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3923 (Scan::possible_function_pointer_reloc): New function.
3924 (Scan::local_reloc_may_be_function_pointer): Change to call
3925 possible_function_pointer_reloc.
3926 (Scan::global_reloc_may_be_function_pointer): Ditto.
3927 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3928 relocations in ".data.rel.ro._ZTV" section.
3929 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3930 * testsuite/icf_safe_so_test.cc: Ditto.
3931 * testsuite/icf_safe_test.cc: Ditto.
3932 * testsuite/icf_safe_test.sh: Ditto.
3934 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3935 Ian Lance Taylor <iant@google.com>
3937 * target-reloc.h (relocate_section): Check the symbol table index
3938 for -1U before setting the local symbol index.
3939 (scan_relocatable_relocs): If copying the relocation, record that
3940 the local symbol is required.
3941 * object.h (Symbol_value::is_output_symtab_index_set): New
3943 (Symbol_value::may_be_discarded_from_output_symtab): New
3945 (Symbol_value::has_output_symtab_entry): New function.
3946 (Symbol_value::needs_output_symtab_entry): Remove.
3947 (Symbol_value::output_symtab_index): Make sure the symbol index is
3949 (Symbol_value::set_output_symtab_index): Make sure the symbol
3950 index is not set. Make sure the new index is valid.
3951 (Symbol_value::set_must_have_output_symtab_entry): New function.
3952 (Symbol_value::has_output_dynsym_entry): New function.
3953 (Symbol_value::set_output_dynsym_index): Make sure the new index
3955 (Sized_relobj::set_must_have_output_symtab_entry): New function.
3956 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3957 local symbol if permitted.
3958 (Sized_relobj::do_finalize_local_symbols): Call
3959 is_output_symtab_index_set rather than needs_output_symtab_entry.
3960 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3961 rather than needs_output_symtab_entry. Call
3962 has_output_dynsym_entry rather than needs_output_dynsym_entry.
3963 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3964 is_output_symtab_index_set rather than needs_output_symtab_entry.
3965 * testsuite/discard_locals_relocatable_test.c: New file.
3966 * testsuite/discard_locals_test.sh: Test -r.
3967 * testsuite/Makefile.am (check_DATA): Add
3968 discard_locals_relocatable_test1.syms,
3969 discard_local_relocatable_test2.syms.
3970 (MOSTLYCLEANFILES): Likewise. Also add
3971 discard_locals_relocatable_test1.lout and
3972 discard_locals_relocatable_test2.out.
3973 (discard_locals_relocatable_test1.syms): New target.
3974 (discard_locals_relocatable_test.o): New target.
3975 (discard_locals_relocatable_test1.out): New target.
3976 (discard_locals_relocatable_test2.syms): New target.
3977 (discard_locals_relocatable_test2.out): New target.
3978 (various): Add missing ../ld-new dependencies.
3979 * testsuite/Makefile.in: Rebuild.
3981 2010-03-03 Nick Clifton <nickc@redhat.com>
3983 * po/fi.po: New Finnish translation.
3985 2010-03-01 Doug Kwan <dougkwan@google.com>
3987 * layout.cc (Layout::Layout): Force section types of .init_array*,
3988 .preinit_array* and .fini_array* sections.
3989 * output.cc (Output_section::Input_section_sort_entry::has_priority):
3990 Fix check of return value of std::string::find.().
3991 (Output_section::Input_section_sort_compare::operator()): Remove
3992 comment about .init_array.
3993 (Output_section::Input_section_sort_init_fini_compare::operator()):
3995 (Output_section::sort_attached_input_sections): Handle .init_array
3996 and .fini_array specially.
3997 * output.h (Output_section::Inut_section_sort_compare): Update
3999 (Output_section::Input_section_sort_init_fini_compare): New struct.
4001 2010-02-26 Doug Kwan <dougkwan@google.com>
4003 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4004 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4005 * testsuite/debug_msg.sh: Avoid matching source line number for
4006 use of global variable undef_int.
4008 2010-02-26 Doug Kwan <dougkwan@google.com>
4010 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4011 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4012 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4013 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4014 * options.cc (General_options::General_options): Initialize member
4016 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4017 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4018 and rm_no_fix_v4bx.stdout
4019 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4020 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4021 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4022 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4023 and arm_no_fix_v4bx.
4024 * Makefile.in: Regenerate.
4025 * testsuite/arm_fix_v4bx.s: New file.
4026 * testsuite/arm_fix_v4bx.sh: Ditto.
4028 2010-02-24 Doug Kwan <dougkwan@google.com>
4030 * arm.cc (Target_arm::got_section): Make the .got section the first
4031 non RELRO section in the data segment.
4032 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4033 suffixes of section names.
4035 2010-02-24 Doug Kwan <dougkwan@google.com>
4037 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4038 flags and attributes merging if an input file is a binary file.
4039 * fileread.cc (Input_file::open): Record format of original file.
4040 * fileread.h (Input_file::Format): New enum type.
4041 (Input_file::Input_file): Initialize data member format_.
4042 (Input_file::format): New method definition.
4043 (Input_file::format_):: New data member.
4045 2010-02-24 Doug Kwan <dougkwan@google.com>
4047 * arm.cc (Arm_output_data_got): New class.
4048 (ARM_TCB_SIZE): New constant
4049 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4050 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4051 If user uses a script with a SECTIONS clause, issue only a warning
4052 for a misplaced EXIDX input section. Otherwise, issue an error.
4053 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4055 (Target_arm::got_mode_index_entry): Handle static linking.
4056 (Target_arm::Scan::local): Ditto.
4057 (Target_arm::Scan::global): Ditto.
4058 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4059 all incorrectly implemented relocations.
4060 (Target_arm::fix_exidx_coverage): Pass layout to
4061 Arm_output_section::fix_exidx_coverage.
4062 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4063 from ".ARM.exidx." and ".ARM.extab.".
4065 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4067 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4068 section if it does not already exist.
4069 * attributes.cc (Attributes_section_data::Attributes_section_data):
4070 Don't crash if size is zero.
4072 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4073 Ian Lance Taylor <iant@google.com>
4075 * gold.cc (queue_middle_tasks): If no input files were opened,
4077 * workqueue.h (Task_function::Task_function): Assert that there is
4080 2010-02-22 Doug Kwan <dougkwan@google.com>
4082 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4083 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4084 types to avoid warnings due to different uint64_t implementations
4087 2010-02-21 Doug Kwan <dougkwan@google.com>
4089 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4090 handling of the maximum backward branch offset.
4091 (Arm_relocate_functions::thumb_branch_common): Ditto.
4092 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4093 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4094 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4095 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4096 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4097 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4098 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4099 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4100 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4101 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4102 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4103 thumb2_bl_out_of_range.o): New rules.
4104 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4105 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4106 thumb2_bl_out_of_range
4107 * testsuite/Makefile.in: Regenerate.
4108 * testsuite/arm_bl_in_range.s: New file.
4109 * testsuite/arm_bl_out_of_range.s: Ditto.
4110 * testsuite/arm_branch_in_range.sh: Ditto.
4111 * testsuite/arm_branch_range.t: Ditto.
4112 * testsuite/thumb2_branch_range.t: Ditto.
4113 * testsuite/thumb_bl_in_range.s: Ditto.
4114 * testsuite/thumb_bl_out_of_range.s: Ditto.
4115 * testsuite/thumb_branch_range.t: Ditto.
4117 2010-02-20 Sriraman Tallam <tmsriram@google.com>
4119 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4120 Add reloc offset information.
4121 * icf.cc (get_section_contents): Change iterators to point to the new
4122 vectors. Add reloc offset information to the contents.
4123 * icf.h (Icf::Sections_reachable_info): New typedef.
4124 (Icf::Sections_reachable_list): New typedef.
4125 (Icf::Offset_info): New typedef.
4126 (Icf::Reloc_info): New struct typedef.
4127 (Icf::Reloc_info_list): New typedef.
4128 (Icf::symbol_reloc_list): Delete method.
4129 (Icf::addend_reloc_list): Delete method.
4130 (Icf::section_reloc_list): Delete method.
4131 (Icf::reloc_info_list): New method.
4132 (Icf::reloc_info_list_): New member.
4134 2010-02-19 Doug Kwan <dougkwan@google.com>
4136 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4137 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4138 * arm.cc (Arm_relocation_functions): New forward declaration.
4139 (Target_arm::Target_arm): Initialize new data members
4140 got_mod_index_offset_ and tls_base_symbol_defined_.
4141 (Target_arm::Relocate::relocate_tls): New method.
4142 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4143 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4145 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4146 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4147 (Target_arm::got_mod_index_offset_,
4148 Target_arm::tls_base_symbol_defined_): New data members.
4149 (Target_arm::Scan::local, Target::Scan::global,
4150 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4153 2010-02-18 Doug Kwan <dougkwan@google.com>
4155 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4156 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4157 text section as a parameter becuase some broken tools may not set
4158 the link in section header.
4159 (Target_arm::has_got_section): New method.
4160 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4161 without any mapping symbol as data only. Remove warning.
4162 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4163 link in its section header, try to discover the link by inspecting the
4164 REL31 relocation at the beginning of the section.
4165 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4167 (Target_arm::Scan::global): Treat any reference to the symbol
4168 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4170 2010-02-12 Sriraman Tallam <tmsriram@google.com>
4172 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4173 (Scan::global_reloc_may_be_function_pointer): New function.
4174 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4175 (Scan::global_reloc_may_be_function_pointer): New function.
4176 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4177 (Scan::global_reloc_may_be_function_pointer): New function.
4178 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4179 (Scan::global_reloc_may_be_function_pointer): New function.
4180 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4181 (Scan::global_reloc_may_be_function_pointer): New function.
4182 (Scan::possible_function_pointer_reloc): New function.
4183 (Target_x86_64::can_check_for_function_pointers): New function.
4184 * gc.h (gc_process_relocs): Scan relocation types to determine if
4185 function pointers were taken for targets that support it.
4186 * icf.cc (Icf::find_identical_sections): Include functions for
4187 folding in safe ICF whose pointer is not taken.
4188 * icf.h (Secn_fptr_taken_set): New typedef.
4189 (fptr_section_id_): New member.
4190 (section_has_function_pointers): New function.
4191 (set_section_has_function_pointers): New function.
4192 (check_section_for_function_pointers): New function.
4193 * options.h: Fix comment for safe ICF option.
4194 * target.h (can_check_for_function_pointers): New function.
4195 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4196 Modify icf_safe_test for X86-64.
4197 * testsuite/Makefile.in: Regenerate.
4198 * testsuite/icf_safe_so_test.cc: New file.
4199 * testsuite/icf_safe_so_test.sh: New file.
4200 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4201 (main): Change to take pointer to function kept_func_3.
4202 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4203 folding is done correctly for X86-64.
4205 2010-02-12 David S. Miller <davem@davemloft.net>
4207 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4208 is_symbolless parameter.
4209 (Output_reloc<SHT_REL>::is_symbolless): New.
4210 (Output_reloc<SHT_REL>::is_symbolless_): New.
4211 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4212 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4213 (Output_reloc<SHT_RELA>::is_symbolless): New.
4214 (Output_data_reloc::add_global): Handle is_symbolless.
4215 (Output_data_reloc::add_global_relative): Likewise.
4216 (Output_data_reloc::add_local): Likewise.
4217 (Output_data_reloc::add_local_relative): Likewise.
4218 (Output_data_reloc::add_symbolless_global_addend): New.
4219 (Output_data_reloc::add_symbolless_local_addend): New.
4220 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4222 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4223 instead of ->is_relative_
4224 (Output_reloc::write): Likewise.
4225 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4226 (Output_reloc::write_rel): Simplify.
4228 * sparc.cc (Target_sparc::Scan::local): Use
4229 ->add_symbolless_local_addend as needed.
4230 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4231 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4232 based upon relocation offset.
4234 2010-02-11 Doug Kwan <dougkwan@google.com>
4236 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4237 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4238 beginning of function.
4239 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4240 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4241 parameter is_32bit in calls to should_apply_static_reloc.
4242 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4243 (check_DATA): Add arm_abs_global.stdout.
4244 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4245 arm_abs_global.stdout): New rules.
4246 (MOSTLLYCLEANFILES): Add arm_abs_global
4247 * Makefile.in: Regenerate.
4248 * testsuite/arm_abs_global.s: New file.
4249 * testsuite/arm_abs_global.sh: Ditto.
4250 * testsuite/arm_abs_lib.s: Ditto.
4252 2010-02-11 Ian Lance Taylor <iant@google.com>
4254 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4256 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4257 Allocate_commons_task first.
4258 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4259 task, rather than symtab_lock_.
4260 (Gc_process_relocs::~Gc_process_relocs): New function.
4261 (Gc_process_relocs::is_runnable): Check this_blocker_.
4262 (Gc_process_relocs::locks): Use next_blocker_ rather than
4264 (Scan_relocs::~Scan_relocs): New function.
4265 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4267 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4269 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4270 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4271 constructor accordingly.
4272 (class Gc_process_relocs): Likewise.
4273 (class Scan_relocs): Likewise.
4274 * common.h (class Allocate_commons_task): Remove symtab_lock_
4275 field, and corresponding constructor parameter.
4276 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4278 (Allocate_commons_task::locks): Likewise.
4280 2010-02-11 Ian Lance Taylor <iant@google.com>
4282 * gold-threads.h (class Once): Define.
4283 (class Initialize_lock): Rewrite as child of Once.
4284 * gold-threads.cc (class Once_initialize): Define.
4285 (once_pointer_control): New static variable.
4286 (once_pointer, once_arg): New static variables.
4287 (c_run_once): New static function.
4288 (Once::Once, Once::run_once, Once::internal_run): New functions.
4289 (class Initialize_lock_once): Remove.
4290 (initialize_lock_control): Remove.
4291 (initialize_lock_pointer): Remove.
4292 (initialize_lock_once): Remove.
4293 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4294 (Initialize_lock::initialize): Rewrite.
4295 (Initialize_lock::do_run_once): New function.
4296 * archive.cc (Archive::interpret_header): Only clear name if it is
4298 * fileread.cc: Include "gold-threads.h"
4299 (file_counts_lock): New static variable.
4300 (file_counts_initialize_lock): Likewise.
4301 (File_read::release): Only increment counts when using --stats.
4302 Use a lock around the increment.
4303 * parameters.cc (class Set_parameters_target_once): Define.
4304 (set_parameters_target_once): New static variable.
4305 (Parameters::Parameters): Move here from parameters.h.
4306 (Parameters::set_target): Rewrite.
4307 (Parameters::set_target_once): New function.
4308 (Parameters::clear_target): Move here and rewrite.
4309 * parameters.h (class Parameters): Update declarations. Add
4310 set_parameters_target_once_ field.
4311 (Parameters::Parameters): Move to parameters.cc.
4312 (Parameters::clear_target): Likewise.
4313 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4315 (Start_group::~Start_group): New function.
4316 (Start_group::is_runnable): New function.
4317 (Start_group::locks, Start_group::run): New functions.
4318 (Finish_group::run): Change saw_undefined to size_t.
4319 * readsyms.h (class Start_group): Define.
4320 (class Finish_group): Change saw_undefined_ field to size_t.
4321 (Finish_group::Finish_group): Remove saw_undefined and
4322 this_blocker parameters. Change all callers.
4323 (Finish_group::set_saw_undefined): New function.
4324 (Finish_group::set_blocker): New function.
4325 * symtab.h (class Symbol_table): Change saw_undefined to return
4326 size_t. Change saw_undefined_ field to size_t.
4327 * target-select.cc (Set_target_once::do_run_once): New function.
4328 (Target_selector::Target_selector): Initialize set_target_once_
4329 field. Don't initialize lock_ and initialize_lock_ fields.
4330 (Target_selector::instantiate_target): Rewrite.
4331 (Target_selector::set_target): New function.
4332 * target-select.h (class Set_target_once): Define.
4333 (class Target_selector): Update declarations. Make
4334 Set_target_once a friend. Remove lock_ and initialize_lock_
4335 fields. Add set_target_once_ field.
4337 2010-02-10 Ian Lance Taylor <iant@google.com>
4339 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4341 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4342 (queue_middle_tasks): Add all blockers before queueing any tasks.
4343 (queue_final_tasks): Likewise.
4344 * token.h (Task_token::add_blockers): New function.
4345 * object.h (Input_objects::number_of_relobjs): New function.
4347 2010-02-10 Ian Lance Taylor <iant@google.com>
4349 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4350 shared, not if not position independent.
4351 * x86_64.cc (Relocate::relocate_tls): Likewise.
4352 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4353 (tls_pie_pic_test): New target.
4354 * testsuite/Makefile.in: Rebuild.
4356 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4357 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4358 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4359 * testsuite/Makefile.in: Rebuild.
4361 2010-02-09 David S. Miller <davem@davemloft.net>
4363 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4364 R_SPARC_RELATIVE using ->add_local_relative().
4365 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4367 * output.h (Output_data_dynamic::add_section_size): New method
4368 that takes two Output_data objects.
4369 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4370 entry param. Handle it in initializers.
4371 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4372 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4373 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4375 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4376 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4377 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4378 for dynrel_includes_plt.
4379 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4380 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4381 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4383 (Target_sparc::do_finalize_sections): Update to pass true for
4384 dynrel_includes_plt.
4385 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4386 output before .rela.plt
4387 (Target_powerpc::do_finalize_sections): Update to pass true for
4388 dynrel_includes_plt when 32-bit.
4390 2010-02-08 Doug Kwan <dougkwan@google.com>
4392 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4394 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4395 Arm_relobj::scan_section_for_cortex_a8_stubs,
4396 Arm_relobj::do_relocation_section): Instead of calling
4397 Output_section::output_address, use faster
4398 Arm_relobj::simple_input_section_output_address.
4400 2010-02-08 David S. Miller <davem@davemloft.net>
4402 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4403 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4404 relocation helper function.
4406 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4407 just like R_SPARC_GOT{10,13,22}.
4408 (Target_sparc::Scan::local): Likewise.
4409 (Target_sparc::Relocate:relocate): Likewise.
4411 2010-02-06 Ian Lance Taylor <iant@google.com>
4413 * configure.ac: Rewrite targetobjs duplicate removal code to use
4414 only shell constructs.
4415 * configure: Rebuild.
4417 2010-02-05 Doug Kwan <dougkwan@google.com>
4420 * arm.cc (Arm_relobj::section_is_scannable): New method.
4421 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4422 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4424 2010-02-04 Doug Kwan <dougkwan@google.com>
4427 * arm-reloc-property.cc (cstdio): Include.
4428 * configure.ac (targetobjs): Remove duplicates.
4429 * configure: Regenerate.
4430 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4431 big and little endian version for a given address size.
4433 2010-02-03 Doug Kwan <dougkwan@google.com>
4435 * arm-reloc-property.cc
4436 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4438 * arm-reloc-property.h
4439 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4440 New method definition.
4441 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4443 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4445 (GOT_PREL): Change implemented to Y.
4446 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4447 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4448 (Arm_relocate_functions::movw_abs_nc): Remove method.
4449 (Arm_relocate_functions::movt_abs): Ditto.
4450 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4451 (Arm_relocate_functions::thm_movt_abs): Ditto.
4452 (Arm_relocate_functions::movw_rel_nc): Ditto.
4453 (Arm_relocate_functions::movw_rel): Ditto.
4454 (Arm_relocate_functions::movt_rel): Ditto.
4455 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4456 (Arm_relocate_functions:thm_movw_rel): Ditto.
4457 (Arm_relocate_functions:thm_movt_rel): Ditto.
4458 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4459 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4460 New method definitions.
4461 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4462 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4463 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4464 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4465 (Target_arm::Relocate::relocate): Check for non-static or
4466 unimplemented relocation code and exit early. Change calls to
4467 Target_arm::reloc_uses_thumb_bit and
4468 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4469 instead. Refactor code to handle similar relocations to increase
4470 code sharing. Remove check for unsupported relocation code in switch
4472 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4473 relocation property table to find out size. Change error message to
4474 print out the name of a relocation code instead of the numeric value.
4475 (Target_arm::scan_reloc_for_stub): Use relocation property table
4476 instead of calling Target_arm::reloc_uses_thumb_bit().
4478 2010-02-02 Doug Kwan <dougkwan@google.com>
4480 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4481 types of relaxed input section.
4483 2010-02-02 Doug Kwan <dougkwan@google.com>
4485 * Makefile.am (HFILES): Add arm-reloc-property.h.
4487 (TARGETSOURCES): Add arm-reloc-property.cc
4488 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4489 (libgold_a_SOURCES): $(DEFFILES)
4490 * Makefile.in: Regenerate.
4491 * arm-reloc-property.cc: New file.
4492 * arm-reloc-property.h: New file.
4493 * arm-reloc.def: New file.
4494 * arm.cc: Update comments.
4495 (arm-reloc-property.h): New included header.
4496 (arm_reloc_property_table): New global variable.
4497 (Target_arm::do_select_as_default_target): New method definition.
4498 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4499 arm-reloc-property to targ_extra_obj.
4500 * parameters.cc (set_parameters_target): Call
4501 Target::select_as_default_target().
4502 * target.h (Target::select_as_default_target): New method definition.
4503 (Target::do_select_as_default_target): Same.
4505 2010-02-01 Doug Kwan <dougkwan@google.com>
4507 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4508 first_output_text_section_.
4509 (Arm_exidx_fixup::first_output_text_section): New method definition.
4510 (Arm_exidx_fixup::first_output_text_section_): New data member.
4511 (Arm_exidx_fixup::process_exidx_section): Record the first text
4512 output section seen.
4513 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4514 and entsize in output section header.
4516 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4518 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4519 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4520 (Arm_relocate_functions::thm_alu11): New Method.
4521 (Arm_relocate_functions::thm_pc8): New Method.
4522 (Arm_relocate_functions::thm_pc12): New Method.
4523 (Target_arm::Scan::local): Handle the relocations.
4524 (Target_arm::Scan::global): Likewise.
4525 (Target_arm::Relocate::relocate): Likewise.
4526 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4528 2010-01-29 Doug Kwan <dougkwan@google.com>
4530 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4531 of relocation types as ld.
4533 2010-01-29 Doug Kwan <dougkwan@google.com>
4535 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4537 (Arm_relocate_functions::thumb_branch_common): Ditto.
4538 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4539 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4540 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4541 Arm_relocate_functions::jump24): Remove.
4542 (Target_arm::Relocate::relocate): Adjust code to call
4543 Arm_relocation_functions::arm_branch_common and
4544 Arm_relocation_functions::thumb_branch_common instead of their removed
4545 wrappers. Merge switch-cases together to reduce source code size.
4547 2010-01-29 Doug Kwan <dougkwan@google.com>
4549 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4550 output_local_symbol_count_needs_update_.
4551 (Arm_relobj::output_local_symbol_count_needs_update,
4552 Arm_relobj::set_output_local_symbol_count_needs_update,
4553 Arm_relobj::update_output_local_symbol_count): New methods.
4554 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4556 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4557 of pointed function as in a R_ARM_PREL31 relocation.
4558 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4559 for output local symbol count updating.
4560 (Target_arm::do_relax): Update output local symbol counts in objects
4562 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4564 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4566 * arm.cc: Added support for the ARM relocations:
4567 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4568 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4569 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4571 (Arm_relocate_functions::movw_rel): New method.
4572 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4573 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4575 (Arm_relocate_functions::thm_movw_rel): New method.
4576 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4578 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4580 (Target_arm::Scan::global): Likewise.
4581 (Target_arm::Relocate::relocate): Likewise.
4582 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4585 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4587 * arm.cc: Added support for ARM group relocations.
4588 (Target_arm::reloc_needs_sym_origin): New method.
4589 (Arm_relocate_functions::calc_grp_kn): New method.
4590 (Arm_relocate_functions::calc_grp_residual): New method.
4591 (Arm_relocate_functions::calc_grp_gn): New method.
4592 (Arm_relocate_functions::arm_grp_alu): New Method.
4593 (Arm_relocate_functions::arm_grp_ldr): New Method.
4594 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4595 (Arm_relocate_functions::arm_grp_ldc): New Method.
4596 (Target_arm::Scan::local): Handle the ARM group relocations.
4597 (Target_arm::Scan::global): Likewise.
4598 (Target_arm::Relocate::relocate): Likewise.
4599 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4602 2010-01-26 Doug Kwan <dougkwan@google.com>
4604 * arm.cc (set): Include.
4605 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4607 (Arm_output_section::Text_section_list): New type.
4608 (Arm_output_section::append_text_sections_to_list): New method.
4609 (Arm_output_section::fix_exidx_coverage): Ditto.
4610 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4611 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4612 Relobj::set_section_offset() instead of
4613 Sized_relobj::invalidate_section_offset().
4614 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4615 parameter for section headers. Ignore relocation sections for
4616 unallocated sections and EXIDX sections.
4617 (Target_arm::fix_exidx_coverage): New method.
4618 (Target_arm::output_section_address_less_than): New type.
4619 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4620 linked text section instead of the EXIDX section.
4621 (Arm_output_section::create_stub_group): Add an assertion to check
4622 that this is not an EXIDX output section.
4623 (Arm_output_section::append_text_sections_to_list): New method.
4624 (Arm_output_section::fix_exidx_coverage): Ditto.
4625 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4626 Arm_relobj::section_needs_reloc_stub_scanning.
4627 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4629 (Target_arm::fix_exidx_coverage): New method.
4630 * object.h (Relobj::set_output_section): New method.
4631 (Sized_relobj::invalidate_section_offset): Remove method.
4632 (Sized_relobj::do_invalidate_section_offset): Remove method.
4633 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4635 2010-01-25 Doug Kwan <dougkwan@google.com>
4637 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4638 Fix warning due to signed and unsigned comparison on a 32-bit host.
4640 2010-01-22 Doug Kwan <dougkwan@google.com>
4642 * arm.cc (Target_arm::do_relax): Record an output section for section
4643 offset adjustment it contains any stub table that has changed.
4644 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4645 offsets in an output section if necessary.
4646 * output.cc (Output_section::Output_section): Initialize
4647 section_offsets_need_adjustments_.
4648 (Output_section::add_input_section_for_script): Renamed to
4649 Output_section::add_simple_input_section.
4650 (Output_section::save_states): Add a comment.
4651 (Output_section::discard_states): New method defintion.
4652 (Output_section::adjust_section_offsets): Same.
4653 * output.h (Output_section::add_input_section_for_script): Renamed to
4654 Output_section::add_simple_input_section.
4655 (Output_section::discard_states): New method declaration.
4656 (Output_section::adjust_section_offsets): Same.
4657 (Output_section::section_offsets_need_adjustment,
4658 Output_section::set_section_offsets_need_adjustment): New method
4660 (Output_section::section_offsets_need_adjustment_): New data member.
4661 * script-sections.cc
4662 (Output_section_element_input::set_section_address): Adjust code for
4663 renaming of Output_section::add_input_section_for_script.
4664 (Orphan_output_section::set_section_address): Same.
4666 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4668 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4669 Fix_v4bx enum values .
4670 * gold/options.h (General_options): New option definitions.
4671 (General_options::fix_v4bx): New method.
4672 (General_options::Fix_v4bx): New enum.
4673 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4674 (General_options::parse_fix_v4bx_interworking): New method.
4676 2010-01-22 Doug Kwan <dougkwan@google.com>
4678 * arm.cc (Arm_exidx_fixup): New class.
4680 2010-01-21 Doug Kwan <dougkwan@google.com>
4682 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4684 (Arm_exidx_section_offset_map): New type.
4686 2010-01-21 Doug Kwan <dougkwan@google.com>
4688 * arm.cc (Arm_exidx_input_section): New class.
4689 (Arm_relobj::exidx_input_section_by_link,
4690 Arm_relobj::exidx_input_section_by_shndx,
4691 Arm_relobj::make_exidx_input_section): New methods.
4692 (read_arm_attributes_section): Remove.
4693 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4694 information about them.
4695 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4698 2010-01-20 Doug Kwan <dougkwan@google.com>
4700 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4701 Input_section_specifier to Section_id.
4702 (Target_arm::new_arm_input_section: Adjust code for change of key
4704 (Target_arm::find_arm_input_section): Ditto.
4705 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4706 (Section_id): Remove.
4707 (Garbage_collection::Section_id_hash): Remove.
4708 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4709 (Section_id): Remove.
4710 (Icf::Section_id_hash): Remove.
4711 * object.h (Section_id, Const_section_id, Section_id_hash,
4712 Const_section_id_hash): New type definitions.
4713 * output.cc (Output_section::add_relaxed_input_section): Change to
4714 use Const_section_id instead of Input_section_specifier as key type.
4715 (Output_section::add_merge_input_section): Ditto.
4716 (Output_section::build_relaxation_map): Change to use Section_id
4717 instead of Input_section_specifier as key type.
4718 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4720 (Output_section::convert_input_sections_to_relaxed_sections): Change
4721 to use Const_section_id instead of Input_section_specifier as key type.
4722 (Output_section::find_merge_section): Ditto.
4723 (Output_section::find_relaxed_input_section): Ditto.
4724 * output.h (Input_section_specifier): Remove class.
4725 (Output_section::Output_section_data_by_input_section_map): Change
4726 key type to Const_section_id.
4727 (Output_section::Output_relaxed_input_section_by_input_section_map):
4729 (Output_section::Relaxation_map): Change key type to Section_id.
4731 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4733 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4734 (class Arm_v4bx_stub): New class.
4735 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4736 (Stub_factory::make_arm_v4bx_stub): New method.
4737 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4738 (Stub_table::empty): Handle v4bx stubs.
4739 (Stub_table::add_arm_v4bx_stub): New method.
4740 (Stub_table::find_arm_v4bx_stub): New method.
4741 (Arm_relocate_functions::v4bx): New method.
4742 (Target_arm::fix_v4bx): New method.
4743 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4744 (Stub_table::relocate_stubs): Likewise.
4745 (Stub_table::do_write): Likewise.
4746 (Stub_table::update_data_size_and_addralign): Likewise.
4747 (Stub_table::finalize_stubs): Likewise.
4748 (Target_arm::Scan::local): Likewise.
4749 (Target_arm::Scan::global): Likewise.
4750 (Target_arm::do_finalize_sections): Likewise.
4751 (Target_arm::Relocate::relocate): Likewise.
4752 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4754 (Target_arm::scan_reloc_for_stub): Likewise.
4755 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4757 2010-01-19 Ian Lance Taylor <iant@google.com>
4759 * output.cc (Output_section_headers::do_sized_write): Write large
4760 segment count to sh_info field.
4761 (Output_file_header::do_sized_write): For large segment count,
4762 write PN_XNUM to e_phnum field.
4764 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4766 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4767 (Arm_relocate_functions::thm_jump8): New function.
4768 (Arm_relocate_functions::thm_jump11): New function.
4769 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4771 (Target_arm::Scan::global): Likewise.
4772 (Target_arm::Relocate::relocate): Likewise.
4773 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4776 2010-01-14 Doug Kwan <dougkwan@google.com>
4778 * arm.cc (map, utility): Include headers.
4779 (Target_arm::apply_cortex_a8_workaround): New method.
4780 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4781 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4782 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4783 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4784 the --[no-]fix-cortex-a8 command line options.
4785 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4786 (Target_arm::relocate_stub): Use addend in instruction template.
4787 * options.h (DEFINE_bool): Set the user-set flag.
4788 (General_options): Add --[no-]-fix-cortex options.
4789 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4790 : Update fast look-up map after conversion.
4792 2010-01-14 Sriraman Tallam <tmsriram@google.com>
4794 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4795 in the first pass of do_layout.
4797 2010-01-13 Doug Kwan <dougkwan@google.com>
4799 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4800 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4801 apparent compiler problem of not folding static constant integral
4802 data members of elfcpp::Elf_sizes<32>.
4804 2010-01-13 Doug Kwan <dougkwan@google.com>
4806 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4807 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4808 Arm_relobj::scan_section_for_cortex_a8_erratum,
4809 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4810 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4811 sections to scan for relocation stubs into a new method
4812 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4813 relocation and Cortex-A8 stub scanning.
4814 (Target_arm::do_relax): Force stubs to be after stubbed sections
4815 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
4816 the beginning of a new relaxation pass. Update a comment.
4817 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4819 2010-01-12 Ian Lance Taylor <iant@google.com>
4821 * target-reloc.h (visibility_error): New inline function.
4822 (relocate_section): Call visibility_error.
4823 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4824 (MOSTLYCLEANFILES): Likewise.
4825 (protected_4_pic.o, protected_3.err): New targets.
4826 * testsuite/protected_4.cc: New file.
4828 2010-01-12 Doug Kwan <dougkwan@google.com>
4830 * arm.cc (Cortex_a8_reloc): New class.
4831 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4832 and cortex_a8_relocs_info_.
4833 (Target_arm::fix_cortex_a8): New method definition.
4834 (Target_arm::Cortex_a8_relocs_info): New type.
4835 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4836 New data member declarations.
4837 (Target_arm::scan_reloc_for_stub): Record information about
4838 relocations for THUMB branches that might be exempted from the
4839 Cortex-A8 workaround.
4840 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4841 at the beginning of a relaxation pass.
4843 2010-01-12 Doug Kwan <dougkwan@google.com>
4845 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4846 (Arm_relobj::Mapping_symbol_position,
4847 Arm_reloj::Mapping_symbol_position_less,
4848 Arm_relobj::Mapping_symbols_info): New types.
4849 (Target_arm::is_mapping_symbol_name): New method definition.
4850 (Arm_relobj::do_count_local_symbols): Save information about mapping
4853 2010-01-11 Doug Kwan <dougkwan@google.com>
4855 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4856 Arm_relocate_functions::thumb32_branch_upper,
4857 Arm_relocate_functions::thumb32_branch_lower,
4858 Arm_relocate_functions::thumb32_cond_branch_offset,
4859 Arm_relocate_functions::thumb32_cond_branch_upper,
4860 Arm_relocate_functions::thumb32_cond_branch_lower,
4861 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4862 branch offset encoding.
4863 (Arm_relocate_functions::thumb_branch_common): Use new branch
4864 offset encoding methods to avoid code duplication.
4865 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4866 (Stub_addend_reader::operator()): Use new branch encoding method
4867 to avoid code duplication.
4869 2010-01-11 Doug Kwan <dougkwan@google.com>
4871 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4872 (Target_arm::do_finalize_sections): Define special EXIDX section
4873 symbols only if referenced.
4874 * gc.h (Garbage_collection::add_reference): New method.
4875 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4878 2010-01-11 Ian Lance Taylor <iant@google.com>
4880 * script.cc (Version_script_info::build_expression_list_lookup):
4881 Change complaing about duplicate wildcard match from error to
4884 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4886 (Version_script_info::Version_script_info): Initialize globs_,
4887 default_version_, default_is_global_, and exact_. Don't
4888 initialize globals_ or locals_.
4889 (Version_script_info::build_lookup_tables): Build local symbols
4891 (Version_script_info::unquote): New function.
4892 (Version_script_info::add_exact_match): New function.
4893 (Version_script_info::build_expression_list_lookup): Remove lookup
4894 parameter. Add is_global parameter. Change all callers. Handle
4895 wildcard pattern specially. Unquote pattern. Call
4897 (Version_script_info::get_name_to_match): New function.
4898 (Version_script_info::get_symbol_version): New function.
4899 (Version_script_info::get_symbol_version_helper): Remove.
4900 (Version_script_info::check_unmatched_names): Call unquote.
4901 * script.h (class Version_script_info): Change get_symbol_version
4902 to be non-inline and add is_global parameter; change all callers.
4903 Rewrite symbol_is_local. Update declarations. Define struct
4904 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4905 Remove globals_ and locals_ members. Add exact_, globs_,
4906 default_version_, is_global_.
4907 (Version_script_info::Glob): Remove pattern, add expression and
4908 is_global. Update constructor. Change all callers.
4909 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4911 (Versions::symbol_section_contents): If a symbol is undefined, or
4912 defined in a dynamic object, set the version index to
4914 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4916 (Symbol_table::add_from_pluginobj): Likewise.
4917 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4919 2010-01-11 Doug Kwan <dougkwan@google.com>
4921 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4922 (incremental_dump_LDADD): Add linking option for libintl.
4923 * Makefile.in: Regenerate.
4925 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
4928 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4930 * testsuite/Makefile.in: Regenerated.
4932 2010-01-10 Doug Kwan <dougkwan@google.com>
4934 * options.h (DEFINE_var): Use parentheses around argument varname__
4935 in macro body to avoid any unintended subsequent substitutions.
4937 2010-01-10 Ian Lance Taylor <iant@google.com>
4939 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4940 candidates before doing symbol resolution.
4942 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4943 ODR candidates if only one is weak.
4945 2010-01-08 Ian Lance Taylor <iant@google.com>
4947 * script.cc (Version_script_info::build_expression_list_lookup):
4948 Don't warn about ambiguous version, just record the ambiguity.
4949 (Version_script_info::get_symbol_version_helper): Give error if
4950 version is ambiguous.
4952 2010-01-08 Doug Kwan <dougkwan@google.com>
4954 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4955 prev_data_size_ and prev_addralign_. Remove initializer for
4956 deleted data member has_been_changed_.
4957 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4958 to determine if the table is empty.
4959 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4961 (Stub_table::add_reloc_stub): Define method in class definition
4962 instead of just declaring it there.
4963 (Stub_table::add_cortex_a8_stub): New method definition.
4964 (Stub_table::update_data_size_and_addralign): Ditto.
4965 (Stub_table::finalize_stubs): Ditto.
4966 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4967 (Stub_table::do_addralign_): Return address alignment in the
4968 (Stub_table::do_reset_address_and_file_offset): Define method in
4969 class definition instead of declaring it there. Set current data
4970 size to be the data size of the previous pass.
4971 (Stub_table::set_final_data_size): Use current data size as the
4973 (Stub_table::relocate_stub): Change parameter type of stub from
4974 Reloc_stub pointer to Stub pointer.
4975 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4976 (Stub_table::Cortex_a8_stub_list): New typedef.
4977 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4978 Stub_table::prev_addralign_): New data member.
4979 (Arm_relobj::Arm_relobj): Initialize data member
4980 section_has_cortex_a8_workaround_.
4981 (Arm_relobj::section_has_cortex_a8_workaround,
4982 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4984 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4986 (Target_arm::relocate_stub): Change parameter type of stub from
4987 Reloc_stub pointer to Stub pointer.
4988 (Insn_template::size, Insn_template::alignment): Handle
4989 THUMB16_SPECIAL_TYPE.
4990 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4991 Stub_table::update_data_size_and_addralign,
4992 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4994 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4995 (Stub_table::do_write): Ditto.
4996 (Target_arm::do_relax): Adjust code for changes in Stub_table.
4998 2010-01-08 Ian Lance Taylor <iant@google.com>
5001 * symtab.h (class Symbol): Remove fields is_target_special_ and
5002 has_plt_offset_. Add field is_defined_in_discarded_section_.
5003 (Symbol::is_defined_in_discarded_section): New function.
5004 (Symbol::set_is_defined_in_discarded_section): New function.
5005 (Symbol::has_plt_offset): Rewrite.
5006 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5007 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5008 Don't initialize is_target_special_ or has_plt_offset_.
5009 Initialize is_defined_in_discarded_section_.
5010 (Symbol_table::add_from_relobj): If appropriate, set
5011 is_defined_in_discarded_section.
5012 * resolve.cc (Symbol::override_base_with_special): Don't test
5013 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5014 * target-reloc.h (relocate_section): Do special handling for
5015 symbols defined in discarded sections for global symbols as well
5018 2010-01-08 Ian Lance Taylor <iant@google.com>
5020 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5021 the SHT_SYMTAB case.
5023 2010-01-08 Ian Lance Taylor <iant@google.com>
5025 * object.cc (Sized_relobj::do_layout): Don't get confused if
5026 layout_eh_frame returns NULL.
5028 2010-01-08 Ian Lance Taylor <iant@google.com>
5031 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5032 dynamic symbol table, use the normal symbol table.
5033 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5036 2010-01-08 Ian Lance Taylor <iant@google.com>
5039 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5042 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5044 * version.cc (print_version): Change to "Copyright 2010".
5046 2010-01-08 Ian Lance Taylor <iant@google.com>
5050 * i386.cc (class Target_i386): Change return type of plt_section
5052 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5053 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5054 tls_desc_rel_ field.
5055 (Output_data_plt_i386::rel_tls_desc): New function.
5056 (Target_i386::rel_tls_desc_section): New function.
5057 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5058 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5059 R_386_TLS_DESC reloc in rel_tls_desc_section.
5060 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5061 Define struct Tlsdesc_info.
5062 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5063 (Target_x86_64::do_reloc_symbol_index): New function.
5064 (Target_x86_64::add_tlsdesc_info): New function.
5065 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5066 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5068 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5070 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5071 (Target_x86_64::rela_tlsdesc_section): New function.
5072 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5074 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5075 (Target_x86_64::do_reloc_addend): New function.
5076 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5077 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5078 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5079 (Output_reloc::type): New function.
5080 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5081 (Output_reloc::is_target_specific): New function.
5082 (Output_reloc::target_arg): New function.
5083 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5084 absolute relocs and target specific relocs.
5085 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5086 add_target_specific.
5087 (class Output_data_reloc) [SHT_RELA]: Likewise.
5088 * output.cc (Output_reloc::Output_reloc): Add four new versions
5089 for absolute relocs and target specific relocs.
5090 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5091 (Output_reloc::get_symbol_index): Likewise.
5092 (Output_reloc::local_section_offset): Check that local_sym_index_
5093 is not TARGET_CODE or 0.
5094 (Output_reloc::symbol_value): Likewise.
5095 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5097 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5098 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5100 * layout.cc (add_target_dynamic_tags): Use output section for
5101 DT_PLTRELSZ and DT_JMPREL.
5103 2010-01-07 Ian Lance Taylor <iant@google.com>
5106 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5108 (class Output_data_reloc_generic): Define.
5109 (class Output_data_reloc_base): Change base class to
5110 Output_data_reloc_generic. Change add() method to call
5111 bump_relative_reloc_count for a relative reloc. Remove
5113 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5115 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5116 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5118 * layout.h (class Layout): Update declaration.
5120 2010-01-07 Ian Lance Taylor <iant@google.com>
5122 * output.h (class Output_data): Add const version of
5123 output_section and do_output_section.
5124 (class Output_section_data): Add const version of
5126 (class Output_section): Likewise.
5127 * layout.cc (Layout::add_target_dynamic_tags): New function.
5128 * layout.h (class Layout): Update declarations.
5129 * arm.cc (Target_arm::do_finalize_sections): Use
5130 add_target_dynamic_tags.
5131 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5132 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5133 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5134 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5136 2010-01-07 Ian Lance Taylor <iant@google.com>
5139 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5142 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
5143 Ian Lance Taylor <iant@google.com>
5146 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5147 Xindex::read_symtab_xindex.
5149 2010-01-07 Doug Kwan <dougkwan@google.com>
5151 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5152 (Insn_template::thumb16_bcond_insn): New method declaration.
5153 (Insn_template): Fix spelling.
5154 (Stub::thumb16_special): New method declaration.
5155 (Stub::do_write): Define virtual method which was previously pure
5157 (Stub::do_thumb16_special): New method declaration.
5158 (Stub::do_fixed_endian_write): New template member.
5159 (Reloc_stub::do_write): Remove.
5160 (Reloc_stub::do_fixed_endian_write): Remove.
5161 (Cortex_a8_stub): New class definition.
5162 (Stub_factory::make_cortex_a8_stub): New method definition.
5163 (Stub_factory::Stub_factory): Add missing static storage class
5164 qualifier for elf32_arm_stub_a8_veneer_blx.
5166 2010-01-07 Ian Lance Taylor <iant@google.com>
5169 * options.h (class General_options): Add --warn-unresolved-symbols
5170 and --error-unresolved-symbols.
5171 * errors.cc (Errors::undefined_symbol): Implement
5172 --warn-unresolved-symbols.
5174 * options.h (class General_options): Add -z text and -z textoff.
5175 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5177 2010-01-06 Sriraman Tallam <tmsriram@google.com>
5179 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5180 (Garbage_collection::cident_sections): New function.
5181 (Garbage_collection::add_cident_section): New function.
5182 (Garbage_collection::cident_sections_): New member.
5183 (gc_process_relocs): Add references to sections whose names are C
5185 * gold.h (cident_section_start_prefix): New constant.
5186 (cident_section_stop_prefix): New constant.
5187 (is_cident): New function.
5188 * layout.cc (Layout::define_section_symbols): Replace string constants
5189 with the newly defined constants.
5190 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5192 * testsuite/Makefile.am: Add gc_orphan_section_test.
5193 * testsuite/Makefile.in: Regenerate.
5194 * testsuite/gc_orphan_section_test.cc: New file.
5195 * testsuite/gc_orphan_section_test.sh: New file.
5197 2010-01-06 Ian Lance Taylor <iant@google.com>
5200 * options.h (class General_options): Add --warn-shared-textrel.
5201 * layout.cc (Layout::finish_dynamic_section): Implement
5202 --warn-shared-textrel.
5205 * options.h (class General_options): Add --warn-multiple-gp.
5207 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5209 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5210 $(THREADSLIB) and $(LIBDL).
5211 * Makefile.in: Rebuild.
5213 2010-01-06 Ian Lance Taylor <iant@google.com>
5216 * options.cc (General_options::parse_section_start): New function.
5217 (General_options::section_start): New function.
5218 (General_options::General_options): Initialize all members.
5219 * options.h: Include <map>
5220 (class General_options): Add --section-start. Add section_starts_
5222 * layout.cc (Layout::attach_allocated_section_to_segment): If
5223 --section-start was used, set the address of the segment. Remove
5224 local sort_sections.
5225 (Layout::relaxation_loop_body): If the address of the load segment
5226 has been set by --section-start, don't use it.
5227 * output.h (Output_segment::update_flags_for_output_section): New
5229 * output.cc (Output_segment::add_output_section): Call
5230 update_flags_for_output_section.
5232 2010-01-05 Ian Lance Taylor <iant@google.com>
5235 * options.h (class General_options): Add --undefined-version.
5236 * script.cc (struct Version_expression): Add was_matched_by_symbol
5238 (Version_script_info::matched_symbol): New function.
5239 (Version_script_info::get_symbol_version_helper): Call
5241 (Version_script_info::check_unmatched_names): New function.
5242 * script.h (class Version_script_info): Update declarations.
5243 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5245 * options.h (class General_options): Use DEFINE_bool_alias for
5246 allow_multiple_definition.
5247 * resolve.cc (Symbol_table::should_override): Don't test
5248 allow_multiple_definition.
5251 * options.h (class General_options): Add --cref.
5252 * main.cc (main): Print cref table if --cref. Don't close mapfile
5253 until after printing cref table.
5254 * cref.cc: Include "symtab.h".
5255 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5256 (Cref_table_compare::operator()): New function.
5257 (Cref_inputs::gather_cref): New function.
5258 (filecol): New static const.
5259 (Cref_inputs::print_cref): New function.
5260 (Cref::print_cref): New function.
5261 * cref.h: Include <cstdio>.
5262 (class Cref): Update declarations.
5263 * mapfile.h (Mapfile::file): New function.
5264 * object.h (class Object): Define Symbols. Declare virtual
5265 do_get_global_symbols.
5266 (Object::get_global_symbols): New function.
5267 * object.cc (Input_objects::add_object): Pass object to cref_ if
5269 (Input_objects::archive_start): Likewise.
5270 (Input_objects::archive_stop): Likewise.
5271 (Input_objects::print_cref): New function.
5272 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5273 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5275 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5277 * plugin.h (class Sized_pluginobj): Update declarations.
5279 2010-01-05 Ian Lance Taylor <iant@google.com>
5281 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5282 to is_default_version. Rename insdef to insdefault.
5283 (Symbol_table::add_from_relobj): Rename def to is_default_version
5284 and local to is_forced_local.
5285 (Symbol_table::add_from_pluginobj): Likewise.
5286 (Symbol_table::add_from_dynobj): Likewise.
5287 (Symbol_table::define_special_symbol): Rename insdef to
5290 2010-01-04 Ian Lance Taylor <iant@google.com>
5293 * options.h (class General_options): Add
5294 --allow-multiple-definition and -z muldefs.
5295 * resolve.cc (Symbol_table::should_override): Don't warn about a
5296 multiple symbol definition if --allow-multiple-definition or -z
5300 * options.h (class General_options): Add --add-needed and
5301 --copy-dt-needed-entries. Tweak --as-needed help entry.
5302 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5303 error if --copy-dt-needed-entries aka --add-needed is used and
5304 would cause a change in behaviour.
5307 * options.h (class General_options): Add -G as a short version of
5308 --shared. Add no-op options -assert, -g, and -i.
5310 2010-01-04 Sriraman Tallam <tmsriram@google.com>
5312 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5313 check for .text or .gnu.linkonce.t sections.
5314 * icf.cc (Icf::find_identical_sections): Ditto.
5315 Change the detection for mangled function name within the section
5317 * icf.h (is_section_foldable_candidate): New function.
5319 2009-12-30 Ian Lance Taylor <iant@google.com>
5322 * options.h (class General_options): Permit two dashes with
5323 --retain-symbols-file.
5325 2009-12-30 Ian Lance Taylor <iant@google.com>
5328 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5329 don't put the file header and segment headers in the text
5333 * common.cc (Sort_commons::operator()): Stabilize sort when both
5335 (Symbol_table::do_allocate_commons_list): When allocating common
5336 symbols, skip a symbol which is no longer common.
5337 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5338 an object before checking its type.
5339 * testsuite/common_test_2.c: New file.
5340 * testsuite/common_test_3.c: New file.
5341 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5342 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5343 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5344 (common_test_2_pic.o, common_test_2.so): New targets.
5345 (common_test_3_pic.o, common_test_3.so): New targets.
5346 * testsuite/Makefile.in: Rebuild.
5349 * script.cc (read_input_script): If we see a new SECTIONS clause,
5350 and we have added an input section, give an error.
5351 * layout.h (class Layout): Add have_added_input_section function.
5352 Add have_added_input_section_ field.
5353 * layout.cc (Layout::Layout): Initialize
5354 have_added_input_section_.
5355 (Layout::layout): Set have_added_input_section_.
5356 (Layout::layout_eh_frame): Likewise.
5358 2009-12-30 Ian Lance Taylor <iant@google.com>
5361 * options.h (class General_options): Add --sort-common option.
5362 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5363 * common.cc (Sort_common): Add sort_order parameter to
5364 constructor. Add sort_order_ field.
5365 (Sort_commons::operator): Check sort_order_.
5366 (Symbol_table::allocate_commons): Determine the sort order.
5367 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5369 (Symbol_table::do_allocate_commons_list): Likewise.
5371 2009-12-30 Ian Lance Taylor <iant@google.com>
5374 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5375 symbols from this object, don't change the visibility of an
5377 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5379 2009-12-30 Ian Lance Taylor <iant@google.com>
5382 * script.h (class Version_script_info): Define Language enum.
5383 Update declarations. Define Glob, Exact, and Lookup types. Add
5384 new fields globals_, locals_, and is_finalized_.
5385 * script.cc: Various formatting fixes.
5386 (class Parser_closure): Change language_stack_ from a vector of
5387 std::string to one of Version_script_info::Language. Adjust all
5389 (class Lazy_demangler): Remove.
5390 (struct Version_expression): Change language from std::string to
5391 Version_script_info::Language.
5392 (Version_script_info::Version_script_info): New function.
5393 (Version_script_info::~Version_script_info): Don't call clear.
5394 (Version_script_info::finalize): New function.
5395 (Version_script_info::build_lookup_tables): New function.
5396 (Version_script_info::build_expression_list_lookup): New
5398 (Version_script_info::get_symbol_version_helper): Rewrite to use
5400 (Version_script_info::print_expression_list): Adjust to use
5401 Version_script_info::Language.
5402 (script_push_lex_into_version_mode): Check that the version script
5403 has not been finalized.
5404 (version_script_push_lang): Change language string to
5405 Version_script_info::Language.
5406 * options.cc (Command_line::version_script): New function.
5407 * options.h (class General_options): Add finalize_dynamic_list
5408 function. Change version_script from declaration to definition.
5409 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5410 * testsuite/version_script.map: Remove duplicate def of foo.
5411 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5413 * testsuite/Makefile.in: Rebuild.
5415 2009-12-30 Ian Lance Taylor <iant@google.com>
5418 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5419 if the input symbol index is 0, make the output symbol index 0.
5421 2009-12-30 Ian Lance Taylor <iant@google.com>
5424 * options.h (class General_options): Add -x/--discard-all.
5425 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5426 --discard-all. If the local symbol needs a dynamic entry, check
5427 that before handling --discard-locals.
5429 2009-12-30 Ian Lance Taylor <iant@google.com>
5432 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5434 (Output_segment::add_output_section): Don't change the flags if
5438 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5439 GNU hash table if they need a dynamic value. Otherwise, don't add
5440 them if they are defined in a dynamic object or are forced local.
5442 2009-12-29 Ian Lance Taylor <iant@google.com>
5445 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5446 .gnu.hash table for a 32-bit target.
5449 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5450 regular and a dynamic object only needs a dynamic symbol table
5451 entry if it is externally visible.
5454 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5455 constructor. Add global_offset_table_ field.
5456 (Target_i386::got_section): Set global_offset_table_.
5457 (Target_i386::do_finalize_sections): Set global_offset_table_
5459 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5460 in constructor. Add global_offset_table_ field.
5461 (Target_x86_64::got_section): Set global_offset_table_.
5462 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5465 * layout.cc (Layout::Layout): Initialize increase_relro_.
5466 (Layout::get_output_section): Add is_relro, is_last_relro, and
5467 is_first_non_relro parameters. Change all callers.
5468 (Layout::choose_output_section): Likewise.
5469 (Layout::add_output_section_data): Likewise.
5470 (Layout::make_output_section): Likewise.
5471 (Layout::set_segment_offsets): Clear increase_relro when using a
5473 * layout.h (class Layout): Add increase_relro method. Add
5474 increase_relro_ field. Update declarations.
5475 * output.cc (Output_section::Output_section): Initialize
5476 is_last_relro_ and is_first_non_relro_.
5477 (Output_segment::add_output_section): Group relro sections is
5478 do_sort is true. Handle is_last_relro and is_first_non_relro.
5479 (Output_segment::maximum_alignment): Remove relro handling.
5480 (Output_segment::set_section_addresses): Add increase_relro
5481 parameter. Change all callers. Add initial alignment to align
5482 relro sections on separate page. Remove old relro handling.
5483 (Output_segment::set_section_list_addresses): Remove in_relro
5484 parameter. Change all callers.
5485 (Output_segment::set_offset): Add increase parameter. Change all
5486 callers. Remove old relro handling.
5487 * output.h (class Output_section): Add new methods: is_last_relro,
5488 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5489 Add is_last_relro_ and is_first_non_relro_ fields.
5490 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5491 Create separate .got.plt section. Call increase_relro.
5492 * x86_64.cc (Target_x86_64::got_section): Likewise.
5493 * testsuite/relro_script_test.t: Add .got.plt.
5496 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5497 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5498 (Layout::finalize): Call set_dynamic_symbol_size.
5499 (Layout::set_dynamic_symbol_size): New function.
5500 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5501 set_dynamic_symbol_size.
5504 * output.h (class Output_section): Add is_entsize_zero_ field.
5505 * output.cc (Output_section::Output_section): Initialize
5507 (Output_section::set_entsize): If two different entsizes are
5508 requested, force it to zero.
5509 (Output_section::add_input_section): Set flags for .debug_str
5510 before updating section flags. Set entsize.
5511 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5512 and SHF_STRING if all input sections have those flags.
5514 2009-12-29 Rafael Espindola <espindola@google.com>
5516 * main.cc (main): Fix the sys time reporting.
5517 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5520 2009-12-29 Sriraman Tallam <tmsriram@google.com>
5522 * options.cc (General_options::parse_version): Allow -v to exit
5523 without an error if there is nothing to link.
5525 2009-12-29 Ian Lance Taylor <iant@google.com>
5527 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5528 using a version of gcc before 4.1.
5529 * configure: Rebuild.
5531 2009-12-28 Chris Demetriou <cgd@google.com>
5533 * attributes.cc (Output_attributes_section_data::do_write): Use
5534 std::vector::front rather than std::vector::data.
5536 2009-12-28 Ian Lance Taylor <iant@google.com>
5538 * symtab.h (class Symbol_table): Add enum Defined.
5539 * resolve.cc (Symbol_table::should_override): Add defined
5540 parameter. Change all callers. Test whether object is NULL
5541 before calling a method on it.
5542 (Symbol_table::report_resolve_problem): Add defined parameter.
5544 (Symbol_table::should_override_with_special): Likewise.
5545 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5546 parameter. Change all callers.
5547 (Symbol_table::do_define_in_output_data): Likewise.
5548 (Symbol_table::define_in_output_segment): Likewise.
5549 (Symbol_table::do_define_in_output_segment): Likewise.
5550 (Symbol_table::define_as_constant): Likewise.
5551 (Symbol_table::do_define_as_constant): Likewise.
5552 * script.h (class Symbol_assignment): Add is_defsym parameter to
5553 constructor; change all callers.
5554 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5555 parameter. Change all callers. Add is_defsym_ field.
5556 (class Parser_closure): Add parsing_defsym parameter to
5557 constructor; change all callers. Add parsing_defsym accessor
5558 function. Add parsing_defsym_ field.
5560 2009-12-28 Ian Lance Taylor <iant@google.com>
5562 * gold.cc (queue_middle_tasks): Fix formatting.
5563 * object.cc (Relobj::is_section_name_included): Likewise.
5565 2009-12-23 Ian Lance Taylor <iant@google.com>
5567 * i386.cc (Target_i386::do_calls_non_split): Recognize
5568 -fsplit-stack prologue for a function with a static chain.
5569 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5570 -fsplit-stack prologue when using %r11.
5572 2009-12-21 Sriraman Tallam <tmsriram@google.com>
5574 * options.cc (General_options::parse_version): Make -v continue and do
5575 the link like GNU ld does.
5577 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
5579 * Makefile.am (CCFILES): Add timer.cc.
5580 (HFILES): Add timer.h.
5581 * configure.ac: Check for sysconf and times.
5582 * main.cc: include timer.h.
5583 (main): Use Timer instead of get_run_time.
5586 * workqueue.cc: include timer.h.
5587 (Workqueue::find_and_run_task):
5588 Report user, sys and wall time.
5589 * Makefile.in: Regenerate.
5590 * config.in: Regenerate.
5591 * configure: Regenerate.
5593 2009-12-16 Doug Kwan <dougkwan@google.com>
5595 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5597 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5598 relaxed input sections.
5599 * output.cc (Output_section::find_relaxed_input_section): Change
5600 return type to Output_relaxed_input_section pointer. Adjust code
5601 for new type of relaxed_input_section_map_.
5602 * output.h (Output_section::find_relaxed_input_section): Change
5603 return type to Output_relaxed_input_section pointer.
5604 (Output_section::Output_relaxed_input_section_by_input_section_map):
5606 (Output_section::relaxed_input_section_map_): Change type to
5607 Output_section::Output_relaxed_input_section_by_input_section_map.
5608 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5611 2009-12-15 Ian Lance Taylor <iant@google.com>
5613 * layout.cc (Layout::create_shstrtab): Only write out after input
5614 sections if we are compressing debug sections.
5616 2009-12-15 Ian Lance Taylor <iant@google.com>
5618 * archive.cc (Archive::add_symbols): Only look up a symbol without
5619 a version if there is, in fact, a version.
5621 2009-12-14 Ian Lance Taylor <iant@google.com>
5623 Revert -Wshadow changes, all changes from:
5624 2009-12-11 Doug Kwan <dougkwan@google.com>
5625 2009-12-11 Nick Clifton <nickc@redhat.com>
5626 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5628 2009-12-11 Doug Kwan <dougkwan@google.com>
5630 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5632 * attributes.cc (Object_attribute::size): Ditto.
5633 (Attributes_section_data::size): Ditto.
5634 (Attributes_section_data::Attributes_section_data): Ditto.
5635 (Output_attributes_section_data::do_write): Ditto.
5636 * attributes.h (Object_attribute::set_type): Ditto.
5637 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5639 2009-12-11 Nick Clifton <nickc@redhat.com>
5641 * archive.cc: Fix shadowed variable warnings.
5643 * compressed_output.cc: Likewise.
5644 * compressed_output.h: Likewise.
5645 * configure: Likewise.
5646 * dwarf_reader.cc: Likewise.
5647 * dynobj.cc: Likewise.
5648 * dynobj.h: Likewise.
5649 * ehframe.cc: Likewise.
5650 * ehframe.h: Likewise.
5651 * errors.cc: Likewise.
5652 * expression.cc: Likewise.
5653 * fileread.cc: Likewise.
5654 * fileread.h: Likewise.
5655 * freebsd.h: Likewise.
5656 * i386.cc: Likewise.
5658 * incremental.h: Likewise.
5659 * layout.cc: Likewise.
5660 * layout.h: Likewise.
5661 * mapfile.cc: Likewise.
5662 * merge.cc: Likewise.
5663 * merge.h: Likewise.
5664 * object.cc: Likewise.
5665 * object.h: Likewise.
5666 * options.h: Likewise.
5667 * output.cc: Likewise.
5668 * output.h: Likewise.
5669 * parameters.cc: Likewise.
5670 * plugin.cc: Likewise.
5671 * powerpc.cc: Likewise.
5672 * reduced_debug_output.cc: Likewise.
5673 * reduced_debug_output.h: Likewise.
5674 * reloc.cc: Likewise.
5675 * reloc.h: Likewise.
5676 * resolve.cc: Likewise.
5677 * script-sections.cc: Likewise.
5678 * script.cc: Likewise.
5679 * script.h: Likewise.
5680 * sparc.cc: Likewise.
5681 * symtab.cc: Likewise.
5682 * symtab.h: Likewise.
5683 * target-select.cc: Likewise.
5684 * target-select.h: Likewise.
5685 * token.h: Likewise.
5686 * workqueue.cc: Likewise.
5687 * workqueue.h: Likewise.
5688 * x86_64.cc: Likewise.
5690 2009-12-10 Doug Kwan <dougkwan@google.com>
5692 * arm.cc (attributes.h): New include.
5693 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5694 (Arm_relobj::~Arm_relobj): Delete object pointed by
5695 attributes_section_data_.
5696 (Arm_relobj::attributes_section_data): New method definition.
5697 (Arm_relobj::attributes_section_data_): New data member declaration.
5698 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5699 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5700 attributes_section_data_.
5701 (Arm_dynobj::attributes_section_data): New method definition.
5702 (Arm_dynobj::attributes_section_data_): New data member declaration.
5703 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5704 initialization value of may_use_blx_ to false.
5705 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5706 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5707 object attributes to compute results instead of hard-coding.
5708 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5709 Target_arm::get_secondary_compatible_arch,
5710 Target_arm::set_secondary_compatible_arch
5711 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5712 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5713 New method declarations.
5714 (Target_arm::get_aeabi_object_attribute): New method definition.
5715 (Target_arm::attributes_section_data_): New data member declaration.
5716 (read_arm_attributes_section): New template definition.
5717 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5718 (Arm_dynobj::do_read_symbols): Ditto.
5719 (Target_arm::do_finalize_sections): Merge attributes sections from
5720 input. Check for BLX use after attributes section merging.
5721 Fix __exidx_start and __exidx_end visibility. Create an
5722 .ARM.attributes section if necessary.
5723 (Target_arm::get_secondary_compatible_arch,
5724 Target_arm::set_secondary_compatible_arch,
5725 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5726 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5727 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5728 New method definitions.
5730 2009-12-09 Ian Lance Taylor <iant@google.com>
5732 * plugin.cc (Plugin::load): Don't cast from void* to a function
5735 2009-12-09 Ian Lance Taylor <iant@google.com>
5737 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5740 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5742 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5743 Replace two_file_shared_1.so with two_file_shared_2.so.
5744 * testsuite/Makefile.in: Regenerated.
5746 2009-12-08 Doug Kwan <dougkwan@google.com>
5748 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5749 (HFILES): Add attributes.h and int_encoding.h.
5750 * Makefile.in: Regenerate.
5751 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5752 function definitions to int_encoding.cc
5753 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5754 prototypes to int_encoding.h
5755 * reduced_debug_output.cc (int_encoding.h): New include.
5756 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5757 function definitions to int_encoding.cc
5758 (insert_into_vector, read_from_pointer): Move template definitions to
5760 * attributes.cc: New file.
5761 * attributes.h: New file.
5762 * int_encoding.cc: New file.
5763 * int_encoding.h: New file.
5765 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
5768 * incremental-dump.cc (dump_incremental_inputs): New.
5769 (main): Use dump_incremental_inputs.
5771 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
5774 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5775 checking elfcpp::STT_FUNC.
5776 (Target_i386::Relocate::relocate): Likewise.
5777 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5779 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5780 symbols from shared libraries into normal FUNC symbols.
5782 * symtab.h (Symbol): Add is_func and use it.
5784 2009-12-05 Doug Kwan <dougkwan@google.com>
5786 * arm.cc (Target_arm::arm_info): Initialize new fields
5787 attributes_section and attributes_vendor.
5788 * i386.cc (Target_i386::i386_info): Same.
5789 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5790 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5791 fields attributes_section and attributes_vendor.
5792 * sparc.cc (Target_sparc::sparc_info): Same.
5793 * target.h (Target::attributes_section, Target::attributes_vendor,
5794 Target::is_attributes_section, Target::attribute_arg_type,
5795 Target::attributes_order): New method definitions.
5796 (Target::Target_info::attributes_section,
5797 Target::Target_info::attributes_vendor): New fields.
5798 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5799 virtual method definitions.
5800 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5801 attributes_section and attributes_vendor.
5802 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5804 2009-12-05 Doug Kwan <dougkwan@google.com>
5806 * arm.cc: Update comments about interworking and stub generation.
5807 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5808 considered as non-PIC.
5809 (Arm_relocate_functions::base_abs): Fix formatting.
5810 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5811 of function to use GOT entry address instead of offset.
5812 (Target_arm::Scan::global): Issue an error if a symbol would need a
5813 PLT does not get one because it is untyped. Remove code to create
5814 dynamic symbols for relative branches.
5815 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5816 takes unsigned integer instead of boolean.
5818 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
5820 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5821 (two_file_test_LDADD): Likewise.
5822 (common_test_1_LDADD): Likewise.
5823 (exception_test_LDADD) Likewise.
5824 (weak_test_LDADD): Likewise.
5825 (many_sections_test_LDADD): Likewise.
5826 (initpri1_LDADD): Likewise.
5827 (script_test_1_LDADD): Likewise.
5828 (script_test_2_LDADD): Likewise.
5829 (justsyms_LDADD): Likewise.
5830 (binary_test_LDADD): Likewise.
5831 (large_LDADD): Likewise.
5832 * testsuite/Makefile.in: Regenerated.
5834 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
5836 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5837 (Symbol_table::override_with_special): Likewise.
5838 (Symbol_table::add_from_object): Likewise.
5840 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5842 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5843 Don't set the data_offset twice.
5845 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5847 * testsuite/Makefile.in: Regenerate.
5849 2009-12-03 Doug Kwan <dougkwan@google.com>
5851 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5852 (Target_arm::do_finalize_sections): Add parameter for symbol table
5853 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5854 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5855 parameter for symbol table pointer.
5856 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5857 an additional parameter for a pointer to symbol table.
5858 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5859 parameter for a symbol table pointer.
5860 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5861 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5863 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5864 parameter for a symbol table pointer.
5866 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
5868 * incremental.cc (Incremental_inputs_header)
5869 (Incremental_inputs_header_write, Incremental_inputs_entry)
5870 (Incremental_inputs_entry_write): Move ...
5871 * incremental.h (Incremental_inputs_header)
5872 (Incremental_inputs_header_write, Incremental_inputs_entry)
5873 (Incremental_inputs_entry_write): here.
5875 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5877 * incremental.cc (make_sized_incremental_binary): Set the target.
5878 Error if it is incompatible.
5879 * output.h (Output_file): Add filename method.
5881 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5883 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5884 from the get_* methods.
5886 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5888 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5889 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5890 Write 0 for the data_offset of scripts.
5892 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5894 * testsuite/Makefile.am: Add the incremental_test.sh test.
5895 * testsuite/incremental_test.sh: New.
5896 * testsuite/incremental_test_1.c: New.
5897 * testsuite/incremental_test_2.c: New.
5899 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
5901 * incremental-dump.cc (main): Fix typos.
5903 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
5906 * incremental-dump.cc (main): Use llu to print 64 bit values.
5908 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
5909 H.J. Lu <hongjiu.lu@intel.com>
5911 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5913 (incremental_dump_LDADD): Likewise.
5914 * Makefile.in: Regenerated.
5916 2009-11-25 Doug Kwan <dougkwan@google.com>
5920 2009-11-25 Doug Kwan <dougkwan@google.com>
5922 * arm.cc (Target_arm::Target_arm): Move method definition
5923 outside of class definition. Add code to handle
5924 --target1-rel, --target1-abs and --target2= options.
5925 (Target_arm::get_reloc_reloc_type): Change method to be
5926 non-static and const.
5927 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5928 New data member declaration.
5929 (Target_arm::Scan::local, Target_arm::Scan::global,
5930 Target_arm::Relocate::relocate,
5931 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5932 Adjust call to Target_arm::get_real_reloc_type.
5933 (Target_arm::get_real_reloc_type): Use command line options
5934 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5935 * options.h (--target1-rel, --target1-abs, --target2): New
5938 2009-11-25 Doug Kwan <dougkwan@google.com>
5940 * arm.cc (Target_arm::Target_arm): Move method definition outside of
5941 class definition. Add code to handle --target1-rel, --target1-abs
5942 and --target2= options.
5943 (Target_arm::get_reloc_reloc_type): Change method to be non-static
5945 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5947 (Target_arm::Scan::local, Target_arm::Scan::global,
5948 Target_arm::Relocate::relocate,
5949 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5950 call to Target_arm::get_real_reloc_type.
5951 (Target_arm::get_real_reloc_type): Use command line options to
5952 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5953 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5956 2009-11-25 Doug Kwan <dougkwan@google.com>
5958 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5959 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5960 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5962 (Arm_relocate_functions::thm_call): Replace body with a call to
5963 Arm_relocate_functions::thumb_branch_common.
5964 (Arm_relocate_functions::thm_jump24,
5965 Arm_relocate_functions::thm_xpc22): New method definitions.
5966 (Arm_relocate_functions::thumb_branch_common): New method definition.
5967 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5969 (Target_arm::Relocate::relocate): Adjust call to thm_call.
5970 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5972 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5974 * Makefile.am: Build incremental-dump
5975 * Makefile.in: Regenerate.
5976 * incremental-dump.cc: New.
5977 * incremental.cc (Incremental_inputs_header_data,
5978 Incremental_inputs_entry_data): Move to incremental.h
5979 * incremental.h: (Incremental_inputs_header_data,
5980 Incremental_inputs_entry_data): Move from incremental.cc
5982 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5984 * incremental.cc (Incremental_inputs_header,
5985 Incremental_inputs_header_write, Incremental_inputs_entry,
5986 Incremental_inputs_entry_write): Add a typedef with the data type.
5988 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5990 * incremental.cc (Incremental_inputs_header,
5991 Incremental_inputs_header_write, Incremental_inputs_entry,
5992 Incremental_inputs_entry_write): Update comment about which
5993 type has the filed descriptions.
5995 2009-11-15 Doug Kwan <dougkwan@google.com>
5997 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5998 (Arm_relocate_functions::arm_branch_common): Change method defintion
5999 in class definition to a method declaration and update list of formal
6001 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6002 Arm_relocation_functions::jump24): Adjust call to
6003 Arm_relocate_functions::arm_branch_common. Update list of formal
6005 (Arm_relocate_functions::xpc25): New method definition.
6006 (Arm_relocate_functions::arm_branch_common): Move method defintion
6007 out from class definition. Use stubs for mode-switching and extending
6009 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6010 specially. Change code to enable use of stubs in ARM branches.
6012 2009-11-10 Doug Kwan <dougkwan@google.com>
6014 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6015 in method declaration.
6016 (Target_arm::relocate_stub): New method declaration.
6017 (Target_arm::default_target): Change to return a pointer instead of
6019 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6020 Target_arm::default_target.
6021 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6023 (Target_arm::relocate_section): Adjust view.
6024 (Target_arm::relocate_stub): New method definition.
6026 2009-11-10 Doug Kwan <dougkwan@google.com>
6028 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6030 * incremental.cc (open_incremental_binary): Initialized local
6031 variables to avoid warnings.
6032 * object.cc (make_elf_object): Ditto.
6033 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6036 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6039 * testsuite/plugin_test.c: Include "config.h".
6041 2009-11-09 Doug Kwan <dougkwan@google.com>
6043 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6044 (arm_symbol_value): Remove.
6045 (Arm_relocate_functions::arm_branch_common,
6046 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6047 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6048 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6049 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6050 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6051 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6052 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6053 Arm_relocate_functions::thm_mobw_abs_nc,
6054 Arm_relocate_functions::thm_mov_abs,
6055 Arm_relocate_functions::movw_prel_nc,
6056 Arm_relocate_functions::thm_movt_abs,
6057 Arm_relocate_functions::movt_prel,
6058 Arm_relocate_functions::thm_movw_prel_nc,
6059 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6060 (Target_arm::Relocate::relocate): Only decompose address into two
6061 parts if relocation type uses the thumb-bit and pass the actual
6062 bit instead of a flag indicating that the thumb-bit is used. Adjust
6063 calls to methods in Arm_relocate_functions for this change.
6065 2009-11-08 Ian Lance Taylor <iant@google.com>
6068 * reloc.cc: Instantiate
6069 Sized_relobj::initialize_input_to_output_maps and
6070 Sized_relobj:free_input_to_output_maps.
6072 2009-11-06 Ian Lance Taylor <iant@google.com>
6075 * defstd.cc (in_segment): Set only_if_ref true for "end".
6077 2009-11-06 Doug Kwan <dougkwan@google.com>
6079 * arm.cc (class Reloc_stub): Correct a comment.
6080 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6081 (Target_arm::scan_section_for_stubs): New method declaration.
6082 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6083 Change methods from private to protected.
6084 (Target_arm::do_may_relax): New method definition.
6085 (Target_arm::do_relax, Target_arm::group_sections,
6086 Target_arm::scan_reloc_for_stub,
6087 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6088 (Target_arm::arm_input_section_map_): New data member declaration.
6089 (Target_arm::scan_reloc_for_stub,
6090 Target_arm::scan_reloc_section_for_stubs,
6091 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6092 Target_arm::do_relax): New method definitions.
6094 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6096 * configure.ac: Check for (struct stat)::st_mtim
6097 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6098 * config.in: Regenerate.
6099 * configure: Regenerate.
6101 2009-11-05 Ian Lance Taylor <iant@google.com>
6104 * output.cc (Output_segment::add_output_section): Add missing
6107 2009-11-04 Ian Lance Taylor <iant@google.com>
6110 * object.h (class Object): Add is_needed and set_is_needed
6111 methods. Add is_needed_ field. Make bool fields into bitfields.
6112 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6113 defined in a dynamic object and referenced by a regular object,
6114 set is_needed for the dynamic object.
6115 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6116 if the file is marked with as_needed and it is not needed.
6118 2009-11-04 Ian Lance Taylor <iant@google.com>
6121 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6122 tags if data is discarded by linker script.
6123 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6124 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6125 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6126 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6128 2009-11-04 Ian Lance Taylor <iant@google.com>
6130 * layout.cc (Layout::get_output_section): Add is_interp and
6131 is_dynamic_linker_section parameters. Change all callers.
6132 (Layout::choose_output_section): Likewise.
6133 (Layout::make_output_section): Likewise.
6134 (Layout::add_output_section_data): Add is_dynamic_linker_section
6135 parameter. Change all callers.
6136 * layout.h (class Layout): Update declarations.
6137 * output.h (class Output_section): Add is_interp, set_is_interp,
6138 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6139 Add is_interp_, is_dynamic_linker_section_ fields. Change
6140 generate_code_fills_at_write_ to a bitfield.
6141 * output.cc (Output_section::Output_sections): Initialize new
6143 (Output_segment::add_output_section): Add do_sort parameter.
6146 2009-11-03 Ian Lance Taylor <iant@google.com>
6149 * options.h (class General_options): Add --warn-common.
6150 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6151 merging two common symbols.
6152 (Symbol_table::should_override): Handle --warn-common when merging
6153 a common symbol with a defined symbol. Use report_resolve_problem
6154 for multiple definitions.
6155 (Symbol_table::report_resolve_problem): New function.
6156 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6158 2009-11-03 Doug Kwan <dougkwan@google.com>
6160 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6162 (Target_arm::stub_factory): New method definition.
6163 (Target_arm::new_arm_input_section,
6164 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6165 Target_arm::reloc_uses_thumb_bit): New method declarations.
6166 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6167 New type definitions.
6168 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6169 member declarations.
6170 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6171 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6172 New method definitions.
6174 2009-11-03 Ian Lance Taylor <iant@google.com>
6176 * options.h (class General_options): Add --warn_constructors.
6178 2009-11-03 Ian Lance Taylor <iant@google.com>
6181 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6182 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6184 2009-11-03 Ian Lance Taylor <iant@google.com>
6187 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6188 --msgid-bugs-address.
6189 (install-pdf): New target.
6190 (install-data_yes): Look up one directory to find mkinstalldirs.
6192 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
6194 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6197 2009-10-30 Doug Kwan <dougkwan@google.com>
6199 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6201 2009-10-30 Doug Kwan <dougkwan@google.com>
6203 * arm.cc (Stub_addend_reader): New struct template definition
6204 and partial specializations.
6205 (Stub_addend_reader::operator()): New method definition for a
6206 partially specialized template.
6208 2009-10-30 Doug Kwan <dougkwan@google.com>
6210 * arm.cc (Arm_relobj::processor_specific_flags): New method
6212 (Arm_relobj::do_read_symbols): New method declaration.
6213 (Arm_relobj::processor_specific_flags_): New data member declaration.
6214 (Arm_dynobj): New class definition.
6215 (Target_arm::do_finalize_sections): Add input_objects parameter.
6216 (Target_arm::do_adjust_elf_header): New method declaration.
6217 (Target_arm::are_eabi_versions_compatible,
6218 (Target_arm::merge_processor_specific_flags): New method declaration.
6219 (Target_arm::do_make_elf_object): New overloaded method definitions
6221 (Arm_relobj::do_read_symbols): New method definition.
6222 (Arm_dynobj::do_read_symbols): Ditto.
6223 (Target_arm::do_finalize_sections): Add input_objects parameters.
6224 Merge processor-specific flags from all input objects.
6225 (Target_arm::are_eabi_versions_compatible,
6226 Target_arm::merge_processor_specific_flags,
6227 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6228 New method definitions.
6229 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6230 Input_objects pointer type parameter.
6231 * layout.cc (Layout::finalize): Pass input objects to target's.
6232 finalize_sections function.
6233 * output.cc (Output_file_header::do_sized_write): Set ELF file
6234 header's processor-specific flags.
6235 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6236 Input_objects pointer type parameter.
6237 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6238 * target.h (Input_objects): New forward class declaration.
6239 (Target::processor_specific_flags,
6240 Target::are_processor_specific_flags_sect): New method definitions.
6241 (Target::finalize_sections): Add input_objects parameter.
6242 (Target::Target): Initialize processor_specific_flags_ and
6243 are_processor_specific_flags_set_.
6244 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6246 (Target::set_processor_specific_flags): New method definition.
6247 (Target::processor_specific_flags_,
6248 Target::are_processor_specific_flags_set_): New data member
6250 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6251 Input_objects pointer type parameter.
6253 2009-10-30 Doug Kwan <dougkwan@google.com>
6255 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6257 2009-10-28 Ian Lance Taylor <iant@google.com>
6259 * object.h (class Relobj): Drop options parameter from
6260 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6261 do_scan_relocs, do_relocate. Change all callers.
6262 (class Sized_relobj): Drop options parameters from
6263 do_gc_process_relocs, do_scan_relocs, do_relocate,
6264 do_relocate_sections, relocate_sections, emit_relocs_scan,
6265 emit_relocs_scan_reltype. Change all callers.
6266 (struct Relocate_info): Remove options field and all references to
6268 * reloc.h (class Read_relocs): Remove options constructor
6269 parameter and options_ field. Change all callers.
6270 (class Gc_process_relocs, class Scan_relocs): Likewise.
6271 (class Relocate_task): Likewise.
6272 * target-reloc.h (scan_relocs): Remove options parameter. Change
6274 (scan_relocatable_relocs): Likewise.
6275 * target.h (class Sized_target): Remove options parameter from
6276 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6278 * gc.h (gc_process_relocs): Remove options parameter. Change all
6280 * arm.cc: Update functions to remove options parameters.
6281 * i386.cc: Likewise.
6282 * powerpc.cc: Likewise.
6283 * sparc.cc: Likewise.
6284 * x86_64.cc: Likewise.
6285 * testsuite/testfile.cc: Likewise.
6287 2009-10-28 Doug Kwan <dougkwan@google.com>
6289 * arm.cc (Arm_relobj): New class definition.
6290 (Arm_relobj::scan_sections_for_stubs,
6291 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6292 New method definitions.
6294 2009-10-28 Cary Coutant <ccoutant@google.com>
6296 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6297 (Plugin::cleanup_done_): New member.
6298 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6299 (Plugin_manager::cleanup_done_): Remove.
6300 (Plugin_manager::add_input_file): Edit error message.
6301 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6302 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6304 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6306 * fileread.cc: (File_read::View::~View): Use the new
6307 data_ownership_ filed.
6308 (File_read::~File_read): Dispose the new whole_file_view_.
6309 (File_read::open): Mmap the whole file if needed.
6310 (File_read::open): Use whole_file_view_ instead of contents_.
6311 (File_read::find_view): Use whole_file_view_ if applicable.
6312 (File_read::do_read): Use whole_file_view_ instead of contents_.
6313 (File_read::make_view): Use whole_file_view_ instead of contents_,
6314 update File_read::View::View call.
6315 (File_read::find_or_make_view): Update File_read::View::View
6317 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6319 (File_read::View::Data_ownership): New enum.
6320 (File_read::View::View): Replace bool mapped_ with Data_ownership
6322 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6323 (File_read::View::data_ownership_): New field.
6324 (File_read::contents_): Remove (replaced by whole_file_view_).
6325 (File_read::whole_file_view_): New field.
6326 * options.h (class General_options): Add --keep-files-mapped.
6328 2009-10-27 Cary Coutant <ccoutant@google.com>
6330 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6331 * testsuite/Makefile.am (plugin_test_5): New test case.
6332 * testsuite/Makefile.in: Regenerate.
6334 2009-10-25 Doug Kwan <dougkwan@google.com>
6336 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6337 from private to protected to allow access by child class.
6338 (Sized_relobj::do_relocate_sections): New method declaration.
6339 (Sized_relobj::relocate_sections): Virtualize.
6340 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6341 Sized_relobj::relocate_sections. Instantiate template explicitly
6342 for different target sizes and endianity.
6344 2009-10-24 Doug Kwan <dougkwan@google.com>
6346 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6347 (Arm_input_section::as_arm_input_section): New method.
6348 (Arm_output_section): New class definition.
6349 (Arm_output_section::create_stub_group,
6350 Arm_output_section::group_sections): New method definitions.
6352 2009-10-22 Doug Kwan <dougkwan@google.com>
6354 * arm.cc (Arm_input_section): New class definition.
6355 (Arm_input_section::init, Arm_input_section:do_write,
6356 Arm_input_section::set_final_data_size,
6357 Arm_input_section::do_reset_address_and_file_offset): New method
6360 2009-10-21 Doug Kwan <dougkwan@google.com>
6362 * arm.cc (Stub_table, Arm_input_section): New forward class
6364 (Stub_table): New class defintion.
6365 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6366 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6367 New method definition.
6369 2009-10-21 Doug Kwan <dougkwan@google.com>
6371 * arm.cc: Update copyright comments.
6372 (Target_arm): New forward class template declaration.
6373 (Arm_address): New type.
6374 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6375 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6376 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6378 (Insn_template): Same.
6379 (DEF_STUBS): New macro.
6380 (Stub_type): New enum type.
6381 (Stub_template): New class definition.
6384 (Stub_factory): Same.
6385 (Target_arm::Target_arm): Initialize may_use_blx_ and
6386 should_force_pic_veneer_.
6387 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6388 Target_arm::should_force_pic_veneer,
6389 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6390 Target_arm::using_thumb_only, Target_arm:;default_target): New
6392 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6393 New data member declarations.
6394 (Insn_template::size, Insn_template::alignment): New method defintions.
6395 (Stub_template::Stub_template): New method definition.
6396 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6397 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6398 (Stub_factory::Stub_factory): New method definition.
6399 * gold.h (string_hash): New template.
6400 * output.h (Input_section_specifier::hash_value): Use
6402 (Input_section_specifier::string_hash): Remove.
6403 * stringpool.cc (Stringpool_template::string_hash): Use
6406 2009-10-20 Doug Kwan <dougkwan@google.com>
6408 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6409 symbols of relaxed input sections.
6410 * output.h (Output_section::find_relaxed_input_section): Make
6413 2009-10-16 Doug Kwan <dougkwan@google.com>
6415 * dynobj.cc (Versions::Versions): Initialize version_script_.
6416 Only insert base version symbol definition for a shared object
6417 if version script defines any version versions.
6418 (Versions::define_base_version): New method definition.
6419 (Versions::add_def): Check that base version is not needed.
6420 (Versions::add_need): Define base version lazily.
6421 * dynobj.h (Versions::define_base_version): New method declaration.
6422 (Versions::needs_base_version_): New data member declaration.
6423 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6424 (check_DATA): Add no_version_test.stdout.
6425 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6427 * testsuite/Makefile.in: Regenerate.
6428 * testsuite/no_version_test.c: New file.
6429 * testsuite/no_version_test.sh: Ditto.
6431 2009-10-16 Doug Kwan <dougkwan@google.com>
6433 * expression.cc (class Segment_start_expression): New class definition.
6434 (Segment_start_expression::value): New method definition.
6435 (script_exp_function_segment_start): Return a new
6436 Segment_start_expression.
6437 * gold/script-c.h (script_saw_segment_start_expression): New function
6439 * script-sections.cc (Script_sections::Script_sections): Initialize
6440 SAW_SEGMENT_START_EXPRESSION_ to false.
6441 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6442 and -Tbbs options to specify section addresses if given in
6443 command line and no SEGMENT_START expression is seen in a script.
6444 * script-sections.h (Script_sections::saw_segment_start_expression,
6445 Script_sections::set_saw_segment_start_expression): New method
6447 (Script_sections::saw_segment_start_expression_): New data member
6449 * script.cc (script_saw_segment_start_expression): New function.
6450 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6451 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6452 script_test_7.sh and script_test_8.sh.
6453 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6454 script_test_8.stdout.
6455 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6456 (script_test_6, script_test_6.stdout, script_test_7,
6457 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6458 * Makefile.in: Regenerate.
6459 * testsuite/script_test_6.sh: New file.
6460 * testsuite/script_test_6.t: Same.
6461 * testsuite/script_test_7.sh: Same.
6462 * testsuite/script_test_7.t: Same.
6463 * testsuite/script_test_8.sh: Same.
6465 2009-10-16 Doug Kwan <dougkwan@google.com>
6467 * output.cc (Output_segment::set_section_list_address): Cast
6468 expressions to unsigned long long type to avoid format warnings.
6470 2009-10-15 Ian Lance Taylor <iant@google.com>
6472 * script.cc (Script_options::add_symbol_assignment): Always add a
6473 dot assignment to script_sections_.
6474 * script-sections.cc (Script_sections::add_dot_assignment):
6475 Initialize if necessary.
6477 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6478 program headers with no load segment if there is a linker script.
6480 * layout.cc (Layout::set_segment_offsets): Align the file offset
6481 to the segment aligment for -N or -n with no load segment.
6482 * output.cc (Output_segment::add_output_section): Don't crash if
6483 the first section is a TLS section.
6484 (Output_segment::set_section_list_addresses): Print an error
6485 message if the address moves backward in a linker script.
6486 * script-sections.cc
6487 (Output_section_element_input::set_section_addresses): Don't
6488 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6489 (Orphan_output_section::set_section_addresses): Likewise.
6491 2009-10-15 Doug Kwan <dougkwan@google.com>
6493 * layout.cc (Layout::finish_dynamic_section): Generate tags
6494 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6495 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6496 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6498 2009-10-14 Ian Lance Taylor <iant@google.com>
6500 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6502 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6503 data_shdr fields of relinfo.
6504 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6505 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6506 R_386_TLS_LDO_32, adjust based on section flags.
6507 (Target_i386::Relocate::fix_up_ldo): Remove.
6509 2009-10-13 Ian Lance Taylor <iant@google.com>
6511 Add support for -pie.
6512 * options.h (class General_options): Add -pie and
6514 (General_options::output_is_position_independent): Test -pie.
6515 (General_options::output_is_executable): Return true if not shared
6516 and not relocatable.
6517 (General_options::output_is_pie): Remove.
6518 * options.cc (General_options::finalize): Reject incompatible uses
6520 * gold.cc (queue_middle_tasks): A -pie link is not static.
6521 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6522 * symtab.cc (Symbol::final_value_is_known): Return false if
6523 output_is_position_independent.
6524 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6525 output_is_position_independent.
6526 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6527 output_is_position_independent.
6528 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6529 output_is_position_independent.
6530 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6532 (basic_pie_test.o, basic_pie_test): New targets.
6533 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6534 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6535 (two_file_pie_test): New target.
6536 * testsuite/Makefile.in: Rebuild.
6537 * README: Remove note saying that -pie is not supported.
6539 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6541 * options.h (class General_options): Add -init and -fini.
6542 * layout.cc (Layout::finish_dynamic_section): Emit
6543 given init and fini functions.
6545 2009-10-13 Sriraman Tallam <tmsriram@google.com>
6547 * gc.h (gc_process_relocs): Check if icf is enabled using new
6549 * gold.cc (queue_initial_tasks): Likewise.
6550 (queue_middle_tasks): Likewise.
6551 * object.cc (do_layout): Likewise.
6552 * symtab.cc (is_section_folded): Likewise.
6553 * main.cc (main): Likewise.
6554 * reloc.cc (Read_relocs::run): Likewise.
6555 (Sized_relobj::do_scan_relocs): Likewise.
6556 * icf.cc (is_function_ctor_or_dtor): New function.
6557 (Icf::find_identical_sections): Check if function is ctor or dtor when
6559 * options.h (General_options::icf): Change option to be an enum.
6560 (Icf_status): New enum.
6561 (icf_enabled): New method.
6562 (icf_safe_folding): New method.
6563 (set_icf_status): New method.
6564 (icf_status_): New variable.
6565 * (options.cc) (General_options::finalize): Set icf_status_.
6566 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6567 icf_test and icf_keep_unique_test to use the --icf enum flag.
6568 * testsuite/icf_safe_test.sh: New file.
6569 * testsuite/icf_safe_test.cc: New file.
6571 2009-10-12 Sriraman Tallam <tmsriram@google.com>
6573 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6574 includes to gc.h and icf.h.
6575 * arm.cc: Include gc.h.
6576 * gold.cc: Likewise.
6577 * i386.cc: Likewise.
6578 * powerpc.cc: Likewise.
6579 * sparc.cc: Likewise.
6580 * x86_64.cc: Likewise.
6581 * gc.h: Include icf.h.
6583 2009-10-11 Ian Lance Taylor <iant@google.com>
6585 * plugin.cc: Include "gold.h" before other header files.
6587 2009-10-10 Chris Demetriou <cgd@google.com>
6589 * options.h (Input_file_argument::Input_file_type): New enum.
6590 (Input_file_argument::is_lib_): Replace with...
6591 (Input_file_argument::type_): New member.
6592 (Input_file_argument::Input_file_argument): Take Input_file_type
6593 'type' rather than boolean 'is_lib' as second argument.
6594 (Input_file_argument::is_lib): Use type_.
6595 (Input_file_argument::is_searched_file): New function.
6596 (Input_file_argument::may_need_search): Handle is_searched_file.
6597 * options.cc (General_options::parse_library): Support -l:filename.
6598 (General_options::parse_just_symbols): Update for Input_file_argument
6600 (Command_line::process): Likewise.
6601 * archive.cc (Archive::get_file_and_offset): Likewise.
6602 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6603 * script.cc (read_script_file, script_add_file): Likewise.
6604 * fileread.cc (Input_file::Input_file): Likewise.
6605 (Input_file::will_search_for): Handle is_searched_file.
6606 (Input_file::open): Likewise.
6607 * readsyms.cc (Read_symbols::get_name): Likewise.
6608 * testsuite/Makefile.am (searched_file_test): New test.
6609 * testsuite/Makefile.in: Regenerate.
6610 * testsuite/searched_file_test.cc: New file.
6611 * testsuite/searched_file_test_lib.cc: New file.
6613 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6614 Ian Lance Taylor <iant@google.com>
6616 * descriptor.cc: Include <cstdio> and "binary-io.h".
6617 (Descriptors::open): Open the files in binary mode always.
6618 * script.cc (Lex::get_token): Treat \r as whitespace.
6620 2009-10-09 Ian Lance Taylor <iant@google.com>
6622 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6624 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6625 Ian Lance Taylor <iant@google.com>
6627 * configure.ac: Check for readv function also.
6628 * fileread.cc (readv): Define if not HAVE_READV.
6629 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6631 * config.in: Regenerate.
6632 * configure: Regenerate.
6634 2009-10-09 Doug Kwan <dougkwan@google.com>
6636 * layout.cc (Layout::make_output_section): Call target hook to make
6637 ordinary output section.
6638 (Layout::finalize): Adjust parameter list of call the
6639 Target::may_relax().
6640 * layout.h (class Layout::section_list): New method.
6641 * merge.h (Output_merge_base::entsize): Change visibility to public.
6642 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6644 (Output_merge_string::do_is_string): New method.
6645 * object.cc (Sized_relobj::do_setup): renamed from
6646 Sized_relobj::set_up.
6647 * object.h (Sized_relobj::adjust_shndx,
6648 Sized_relobj::initializ_input_to_output_maps,
6649 Sized_relobj::free_input_to_output_maps): Change visibilities to
6651 (Sized_relobj::setup): Virtualize.
6652 (Sized_relobj::do_setup): New method declaration.
6653 (Sized_relobj::invalidate_section_offset,
6654 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6655 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6656 * options.cc (parse_int): New function.
6657 * options.h (parse_int): New declaration.
6658 (DEFINE_int): New macro.
6659 (stub_group_size): New option.
6660 * output.cc (Output_section::Output_section): Initialize memebers
6661 merge_section_map_, merge_section_by_properties_map_,
6662 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6663 (Output_section::add_input_section): Handled deferred code-fill
6664 generation and remove an old comment.
6665 (Output_section::add_relaxed_input_section): New method definition.
6666 (Output_section::add_merge_input_section): Use merge section by
6667 properties map to speed to search. Update merge section maps
6669 (Output_section::build_relaxation_map): New method definition.
6670 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6672 (Output_section::relax_input_section): Renamed to
6673 Output_section::convert_input_sections_to_relaxed_sections and change
6674 interface to take a vector of pointers to relaxed sections.
6675 (Output_section::find_merge_section,
6676 Output_section::find_relaxed_input_section): New method definitions.
6677 (Output_section::is_input_address_mapped,
6678 Output_section::output_offset, Output_section::output_address):
6679 Use output section data maps to speed up searching.
6680 (Output_section::find_starting_output_address): Add comments.
6681 (Output_section::do_write,
6682 Output_section::write_to_postprocessing_buffer): Do code-fill
6683 generation as appropriate.
6684 (Output_section::get_input_sections): Invalidate relaxed input section
6686 (Output_section::restore_states): Adjust type of checkpoint .
6687 Invalidate relaxed input section map.
6688 * output.h (Output_merge_base): New class declaration.
6689 (Input_section_specifier): New class defintion.
6690 (class Output_relaxed_input_section) Change base class to
6691 Output_section_data_build.
6692 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6693 base class initializer.
6694 (Output_section::add_relaxed_input_section): New method declaration.
6695 (Output_section::Input_section): Change visibility to protected.
6696 (Output_section::Input_section::relobj,
6697 Output_section::Input_section::shndx): Handle relaxed input sections.
6698 Output_section::input_sections) Change visibility to protected. Also
6699 define overload to return a non-const pointer.
6700 (Output_section::Merge_section_properties): New class defintion.
6701 (Output_section::Merge_section_by_properties_map,
6702 Output_section::Output_section_data_by_input_section_map,
6703 Output_section::Relaxation_map): New types.
6704 (Output_section::relax_input_section): Rename method to
6705 Output_section::convert_input_sections_to_relaxed_sections and change
6706 interface to take a vector of relaxed section pointers.
6707 (Output_section::find_merge_section,
6708 Output_section::find_relaxed_input_section,
6709 Output_section::build_relaxation_map,
6710 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6711 New method declarations.
6712 (Output_section::merge_section_map_
6713 Output_section::merge_section_by_properties_map_,
6714 Output_section::relaxed_input_section_map_,
6715 Output_section::is_relaxed_input_section_map_valid_,
6716 Output_section::generate_code_fills_at_write_): New data members.
6717 * script-sections.cc
6718 (Output_section_element_input::set_section_addresses): Call
6719 current_data_size and addralign methods of relaxed input sections.
6720 (Orphan_output_section::set_section_addresses): Call current_data_size
6721 and addralign methods of relaxed input sections.
6722 * symtab.cc (Symbol_table::compute_final_value): Extract template
6723 from the body of Symbol_table::sized_finalize_symbol.
6724 (Symbol_table::sized_finalized_symbol): Call
6725 Symbol_table::compute_final_value.
6726 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6727 (Symbol_table::compute_final_value): New templated method declaration.
6728 * target.cc (Target::do_make_output_section): New method defintion.
6729 * target.h (Target::make_output_section): New method declaration.
6730 (Target::relax): Add more parameters for input objects, symbol table
6731 and layout. Adjust call to do_relax.
6732 (Target::do_make_output_section): New method declaration.
6733 (Target::do_relax): Add parameters for input objects, symbol table
6736 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6738 * pread.c: Include stdio.h.
6740 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6742 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6745 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6747 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6748 Change read_shndx type to unsigned int.
6749 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6751 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6752 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6753 Change read_shndx type to unsigned int.
6754 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6756 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6757 * layout.cc (Layout::create_symtab_sections): Cast the result of
6758 local_symcount * symsize to off_t in the gold_assert.
6760 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6762 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6763 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6765 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6766 (Arm_relocate_functions::thm_abs5): New function.
6767 (Arm_relocate_functions::abs12): New function.
6768 (Arm_relocate_functions::abs16): New function.
6769 (Arm_relocate_functions::base_abs): New function.
6770 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6771 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6772 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6774 (Scan::global): Likewise.
6775 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6776 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6777 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6778 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6781 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6783 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6784 (Arm_relocate_functions::movt_prel): New function.
6785 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6786 (Arm_relocate_functions::thm_movt_prel): New function.
6787 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6788 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6789 (Scan::global, Relocate::relocate): Likewise.
6790 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6792 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6794 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6795 Incremental_checker.
6796 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6798 (class Incremental_inputs_header): New class.
6799 (Incremental_inputs_header_writer): Edit comment.
6800 (Incremental_inputs_entry): New class.
6801 (Incremental_inputs_entry_writer): Edit comment.
6802 (Sized_incremental_binary::do_find_incremental_inputs_section):
6803 Add *strtab_shndx parameter, fill it.
6804 (Sized_incremental_binary::do_check_inputs): New method.
6805 (Incremental_checker::can_incrementally_link_output_file): Use
6806 Sized_incremental_binary::check_inputs.
6807 (Incremental_inputs::report_command_line): Save command line in
6810 (Incremental_binary::find_incremental_inputs_section): New
6812 (Incremental_binary::do_find_incremental_inputs_section): Add
6813 strtab_shndx parameter.
6814 (Incremental_binary::do_check_inputs): New pure virtual method.
6815 (Sized_incremental_binary::do_check_inputs): Declare.
6816 (Incremental_checker::Incremental_checker): Add incremental_inputs
6817 parameter, use it to initialize incremental_inputs_.
6818 (Incremental_checker::incremental_inputs_): New field.
6819 (Incremental_checker::command_line): New method.
6820 (Incremental_checker::inputs): New method.
6821 (Incremental_checker::command_line_): New field.
6823 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6825 * incremental.cc: Include <cstdarg> and "target-select.h".
6826 (vexplain_no_incremental): New function.
6827 (explain_no_incremental): New function.
6828 (Incremental_binary::error): New method.
6829 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6831 (make_sized_incremental_binary): New function.
6832 (open_incremental_binary): New function.
6833 (can_incrementally_link_file): Add checks if output is ELF and has
6835 * incremental.h: Include "elfcpp_file.h" and "output.h".
6836 (Incremental_binary): New class.
6837 (Sized_incremental_binary): New class.
6838 (open_incremental_binary): Declare.
6839 * object.cc (is_elf_object): Use
6840 elfcpp::Elf_recognizer::is_elf_file.
6841 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6842 * output.h (Output_file::filesize): New method.
6844 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6846 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6848 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6849 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6851 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6853 (Arm_relocate_functions::movw_abs_nc): New function.
6854 (Arm_relocate_functions::movt_abs): New function.
6855 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6856 (Arm_relocate_functions::thm_movt_abs): New function.
6857 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6858 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6859 (Scan::global): Likewise.
6860 (Relocate::relocate): Likewise.
6861 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6863 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6865 * arm.cc (Arm_relocate_functions::got_prel) New function.
6866 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6867 (Relocate::relocate): Likewise.
6868 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6870 2009-10-06 Ian Lance Taylor <iant@google.com>
6872 * options.h (class General_options): Define
6873 split_stack_adjust_size parameter.
6874 * object.h (class Object): Add uses_split_stack_ and
6875 has_no_split_stack_ fields. Add uses_split_stack and
6876 has_no_split_stack accessor functions. Declare
6877 handle_split_stack_section.
6878 (class Reloc_symbol_changes): Define.
6879 (class Sized_relobj): Define Function_offsets. Declare
6880 split_stack_adjust, split_stack_adjust_reltype, and
6882 * object.cc (Object::handle_split_stack_section): New function.
6883 (Sized_relobj::do_layout): Call handle_split_stack_section.
6884 * dynobj.cc (Sized_dynobj::do_layout): Call
6885 handle_split_stack_section.
6886 * reloc.cc (Sized_relobj::relocate_sections): Call
6887 split_stack_adjust for executable sections in split_stack
6888 objects. Pass reloc_map to relocate_section.
6889 (Sized_relobj::split_stack_adjust): New function.
6890 (Sized_relobj::split_stack_adjust_reltype): New function.
6891 (Sized_relobj::find_functions): New function.
6892 * target-reloc.h: Include "object.h".
6893 (relocate_section): Add reloc_symbol_changes parameter. Change
6895 * target.h (class Target): Add calls_non_split method. Declare
6896 do_calls_non_split virtual method. Declare match_view and
6898 * target.cc: Include "elfcpp.h".
6899 (Target::do_calls_non_split): New function.
6900 (Target::match_view): New function.
6901 (Target::set_view_to_nop): New function.
6902 * gold.cc (queue_middle_tasks): Give an error if mixing
6903 split-stack and non-split-stack objects with -r.
6904 * i386.cc (Target_i386::relocate_section): Add
6905 reloc_symbol_changes parameter.
6906 (Target_i386::do_calls_non_split): New function.
6907 * x86_64.cc (Target_x86_64::relocate_section): Add
6908 reloc_symbol_changes parameter.
6909 (Target_x86_64::do_calls_non_split): New function.
6910 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6912 * powerpc.cc (Target_powerpc::relocate_section): Add
6913 reloc_symbol_changes parameter.
6914 * sparc.cc (Target_sparc::relocate_section): Add
6915 reloc_symbol_changes parameter.
6916 * configure.ac: Call AM_CONDITIONAL for the default target.
6917 * configure: Rebuild.
6918 * testsuite/Makefile.am (TEST_AS): New variable.
6919 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6920 (check_DATA): Add split_i386 and split_x86_64 files.
6921 (SPLIT_DEFSYMS): Define.
6922 (split_i386_[1234n].o): New targets.
6923 (split_i386_[124]): New targets.
6924 (split_i386_[1234r].stdout): New targets.
6925 (split_x86_64_[1234n].o): New targets.
6926 (split_x86_64_[124]): New targets.
6927 (split_x86_64_[1234r].stdout): New targets.
6928 (MOSTLYCLEANFILES): Add new executables.
6929 * testsuite/split_i386.sh: New file.
6930 * testsuite/split_x86_64.sh: New file.
6931 * testsuite/split_i386_1.s: New file.
6932 * testsuite/split_i386_2.s: New file.
6933 * testsuite/split_i386_3.s: New file.
6934 * testsuite/split_i386_4.s: New file.
6935 * testsuite/split_i386_n.s: New file.
6936 * testsuite/split_x86_64_1.s: New file.
6937 * testsuite/split_x86_64_2.s: New file.
6938 * testsuite/split_x86_64_3.s: New file.
6939 * testsuite/split_x86_64_4.s: New file.
6940 * testsuite/split_x86_64_n.s: New file.
6941 * testsuite/testfile.cc (Target_test): Update relocation_section
6943 * testsuite/Makefile.in: Rebuild.
6945 2009-10-06 Ian Lance Taylor <iant@google.com>
6947 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6948 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6949 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
6950 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6951 the address on ldo_addrs_.
6952 (Target_i386::Relocate::fix_up_ldo): New function.
6954 2009-10-06 Rafael Espindola <espindola@google.com>
6956 * plugin.cc (add_input_library): New.
6957 (Plugin::load): Add add_input_library to tv.
6958 (Plugin_manager::add_input_file): Add the is_lib argument.
6959 (add_input_file): Update call to Plugin_manager::add_input_file.
6960 (add_input_library): New.
6961 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6963 2009-09-30 Doug Kwan <dougkwan@google.com>
6965 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6966 symbol and call Symbol::may_need_copy_reloc to determine if
6967 a copy reloc is needed.
6968 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6969 nocopyreloc is given in command line.
6970 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6971 given in command line.
6972 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6973 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6974 of the removed Target_i386::may_need_copy_reloc.
6975 * options.h (copyreloc): New option with default value false.
6976 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6977 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6978 instead of the removed Target_powerpc::may_need_copy_reloc.
6979 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6980 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6981 instead of the removed Target_sparc::may_need_copy_reloc.
6982 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6983 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6984 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6985 instead of the removed Target_x86_64::may_need_copy_reloc.
6987 2009-09-30 Ian Lance Taylor <iant@google.com>
6989 * object.h (class Object): Remove target_ field, and target,
6990 sized_target, and set_target methods.
6991 (Object::sized_target): Remove.
6992 (class Sized_relobj): Update declarations. Remove sized_target.
6993 * object.cc (Sized_relobj::setup): Remove target parameter.
6995 (Input_objects::add_object): Don't do anything with the target.
6996 (make_elf_sized_object): Add punconfigured parameter. Change all
6997 callers. Set or test parameter target.
6998 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7000 * parameters.cc (Parameters::set_target): Change parameter type to
7002 (Parameters::default_target): Remove.
7003 (set_parameters_target): Change parameter type to be non-const.
7004 (parameters_force_valid_target): New function.
7005 (parameters_clear_target): New function.
7006 * parameters.h (class Parameters): Update declarations. Remove
7007 default_target method. Add sized_target and clear_target
7008 methods. Change target_ to be non-const.
7009 (set_parameters_target): Update declaration.
7010 (parameters_force_valid_target): Declare.
7011 (parameters_clear_target): Declare.
7012 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7013 as NULL if we aren't searching.
7014 (Add_symbols::run): Don't check for compatible target.
7015 * fileread.cc (Input_file::open_binary): Call
7016 parameters_force_valid_target.
7017 * gold.cc (queue_middle_tasks): Likewise.
7018 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7019 set_target on object.
7020 * dynobj.h (class Sized_dynobj): Update declarations.
7021 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7022 make_elf_object returns NULL.
7023 (Archive::include_member): Don't check whether object target is
7025 * output.cc (Output_section::add_input_section): Get target from
7027 (Output_section::relax_input_section): Likewise.
7028 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7030 (Sized_relobj::do_scan_relocs): Likewise.
7031 (Sized_relobj::relocate_sections): Likewise.
7032 * resolve.cc (Symbol_table::resolve): Likewise.
7033 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7034 parameter. Change all callers.
7035 (Symbol_table::add_from_object): Get target from parameters.
7036 (Symbol_table::add_from_relobj): Don't check object target.
7037 (Symbol_table::add_from_dynobj): Likewise.
7038 (Symbol_table::define_special_symbol): Get target from
7040 * symtab.h (class Symbol_table): Update declaration.
7041 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7042 parameter. Change all callers. Clear parameter target.
7043 (Binary_test): Test target here.
7044 * testsuite/object_unittest.cc (gold_testsuite): Remove
7045 target_test_pointer parameter. Change all callers.
7046 (Object_test): Test target here.
7048 2009-09-26 Ian Lance Taylor <iant@google.com>
7050 * testsuite/initpri1.c: Don't try to use constructor priorities if
7051 compiling with gcc before 4.3.
7053 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7055 * testsuite/retain_symbols_file_test.sh (check_present): Change
7056 output file name to retain_symbols_file_test.stdout.
7057 (check_absent): Likewise.
7059 2009-09-18 Craig Silverstein <csilvers@google.com>
7061 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7062 * options.cc: Include <cerrno> and <fstream>.
7063 (General_options::finalize): Parse -retain-symbols-file tag.
7064 * options.h: New flag.
7065 (General_options): New method should_retain_symbol, new
7066 variable symbols_to_retain.
7067 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7068 should_retain_symbol map.
7069 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7070 * testsuite/Makefile.in: Regenerate.
7071 * testsuite/retain_symbols_file_test.sh: New file.
7073 2009-09-18 Nick Clifton <nickc@redhat.com>
7075 * po/es.po: Updated Spanish translation.
7077 2009-09-17 Doug Kwan <dougkwan@google.com>
7079 * debug.h (DEBUG_RELAXATION): New constant.
7080 (DEBUG_ALL): Add DEBUG_RELAXATION.
7081 (debug_string_to_enum): Add relaxation debug option.
7083 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7084 Layout::Relaxation_debug_check::read_sections,
7085 Layout::Relaxation_debug_check::read_sections): New method definitions.
7086 (Layout::Layout): Initialize data members
7087 record_output_section_data_from_scrips_,
7088 script_output_section_data_list_ and relaxation_debug_check_.
7089 (Layout::save_segments, Layout::restore_segments,
7090 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7091 Layout::relaxation_loop_body): New method definitions.
7092 (Layout::finalize): Support relaxation. Move section layout code to
7093 Layout::relaxation_loop_body.
7094 (Layout::set_asection_address_from_script): Move code for orphan
7095 section placement out.
7096 (Layout::place_orphan_sections_in_script): New method definition.
7097 * layout.h (Output_segment_headers, Output_file_header):
7098 New forward class declarations.
7099 (Layout::~Layout): Define.
7100 (Layout::new_output_section_data_from_script): New method definition.
7101 (Layout::place_orphan_sections_in_script): New method declaration.
7102 (Layout::Segment_states): New type declaration.
7103 (Layout::save_segments, Layout::restore_segments,
7104 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7105 Layout::relaxation_loop_body): New method declarations.
7106 (Layout::Output_section_data_list): New type declaration.
7107 (Layout::Relaxation_debug_check): New class definition.
7108 (Layout::record_output_section_data_from_script_,
7109 Layout::script_output_section_data_list_, Layout::segment_states_,
7110 Layout::relaxation_debug_check_): New data members.
7111 * output.cc: (Output_section_headers::do_size): New method definition.
7112 (Output_section_headers::Output_section_headers): Move size
7113 computation to Output_section_headers::do_size.
7114 (Output_segment_headers::do_size): New method definition.
7115 (Output_file_header::Output_file_header): Move size computation to
7116 Output_file_header::do_size and call it.
7117 (Output_file_header::do_size): New method definition.
7118 (Output_data_group::Output_data_group): Adjust call to
7119 Output_section_data.
7120 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7121 (Output_symtab_xindex::do_write): Add array bound check.
7122 (Output_section::Input_section::print_to_mapfile): Handle
7123 RELAXED_INPUT_SECTION_CODE.
7124 (Output_section::Output_section): Initialize data member checkpoint_.
7125 (Output_section::~Output_section): Delete checkpoint object pointed
7127 (Output_section::add_input_section): Always add an Input_section if
7129 (Output_section::add_merge_input_section): Add assert.
7130 (Output_section::relax_input_section): New method definition.
7131 (Output_section::set_final_data_size): Set load address to zero for
7132 an unallocated section.
7133 (Output_section::do_address_and_file_offset_have_reset_values):
7134 New method definition.
7135 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7136 Handle relaxed input section.
7137 (Output_section::sort_attached_input_sections): Checkpoint input
7138 section list lazily.
7139 (Output_section::get_input_sections): Change type of input_sections to
7140 list of Simple_input_section pointers. Checkpoint input section list
7141 lazily. Also handle relaxed input sections.
7142 (Output_section::add_input_section_for_script): Take a reference to
7143 a Simple_input_section object instead of Relobj pointer and section
7144 index as parameter. Handle relaxed input sections.
7145 (Output_section::save_states, Output_section::restore_states): New
7147 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7148 (Output_data::is_data_size_fixed): New method definition.
7149 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7151 (Output_data::address_and_file_offset_have_reset_values): New method
7153 (Output_data::do_address_and_file_offset_have_reset_values): New method
7155 (Output_data::set_data_size): Check that data size is not fixed.
7156 (Output_data::fix_data_size): New method definition.
7157 (Output_data::is_data_size_fixed_): New data member.
7158 (Output_section_headers::set_final_data_size): New method definition.
7159 (Output_section_headers::do_size): New method declaration.
7160 (Output_segment_headers::set_final_data_size): New method definition.
7161 (Output_segment_headers::do_size): New method declaration.
7162 (Output_file_header::set_final_data_size)::New method definition.
7163 (Output_file_header::do_size)::New method declaration.
7164 (Output_section_data::Output_section_data): Add new parameter
7165 is_data_size_fixed and use it to fix data size.
7166 (Output_data_const::Output_data_const): Adjust call to base class
7167 constructor and fix data size.
7168 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7169 base class constructor and fix data size.
7170 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7171 base class constructor and fix data size.
7172 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7173 class constructor and fix data size.
7174 (Output_data_group::set_final_data_size): New method definition.
7175 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7176 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7177 class constructor and fix data size.
7178 (Output_relaxed_input_section): New class definition.
7179 (Output_section::Simple_input_section): New class definition.
7180 (Output_section::get_input_sections): Adjust parameter list.
7181 (Output_section::add_input_section_for_script): Same.
7182 (Output_section::save_states, Output_section::restore_states,
7183 Output_section::do_address_and_file_offset_have_reset_values,
7184 (Output_section::Input_section::Input_section): Handle
7185 RELAXED_INPUT_SECTION_CODE. Add new overload for
7186 Output_relaxed_input_section.
7187 (Output_section::Input_section::is_input_section,
7188 Output_section::Input_section::set_output_section): Handle relaxed
7190 (Output_section::Input_section::is_relaxed_input_section,
7191 Output_section::Input_section::output_section_data,
7192 Output_section::Input_section::relaxed_input_section): New method
7194 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7196 (Output_section::Input_section::u1_): Update comments.
7197 (Output_section::Input_section::u2_): Add new union member poris.
7198 (Output_section::Checkpoint_output_section): New classs definition.
7199 (Output_section::relax_input_section): New method declaration.
7200 (Output_section::checkpoint_): New data member.
7201 (Output_segment): Update comments.
7202 (Output_segment::Output_segment): Un-privatize copy constructor.
7203 (Output_segment::operator=): Un-privatize.
7204 * script-sections.cc (Output_section_element::Input_section_list):
7205 Change element type to Output_section::Simple_input_section.
7206 (Output_section_element_dot_assignment::set_section_addresses):
7207 Register output section data for relaxation clean up.
7208 (Output_data_exression::Output_data_expression): Adjust call to base
7209 constructor to fix data size.
7210 (Output_section_element_data::set_section_addresses): Register
7211 Output_data_expression object for relaxation clean up.
7212 (struct Input_section_info): Replace Relobj pointer and section index
7213 pair with Output_section::Simple_input_section and Convert struct to a
7215 (Input_section_sorter::operator()): Adjust access to
7216 Input_section_info data member to use accessors.
7217 (Output_section_element_input::set_section_addresses): Use layout
7218 parameter. Adjust code to use Output_section::Simple_input_section
7219 and Input_secction_info classes. Register filler for relaxation
7221 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7222 and section index pair with Output_section::Simple_input_section
7223 class. Adjust code accordingly.
7224 (Phdrs_element::release_segment): New method definition.
7225 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7227 (Script_sections::release_segments): New method definition.
7228 * gold/script-sections.h (Script_sections::release_segments): New
7230 * gold/target.h (Target::may_relax, Target::relax,
7231 Target::do_may_relax, Target::do_relax): New method definitions.
7233 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7235 * arm.cc (has_signed_unsigned_overflow): New function.
7236 (Arm_relocate_functions::abs8): New function.
7237 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7238 (Target_arm::Scan::global): Likewise.
7239 (Target_arm::relocate::relocate): Likewise.
7240 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7243 2009-09-16 Cary Coutant <ccoutant@google.com>
7245 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7246 * testsuite/Makefile.in: Regenerate.
7248 2009-09-11 Nick Clifton <nickc@redhat.com>
7250 * po/gold.pot: Updated by the Translation project.
7252 2009-09-08 Cary Coutant <ccoutant@google.com>
7254 * output.cc (Output_file::open): Add execute permission to empty file.
7255 * testsuite/Makefile.am (permission_test): New test.
7256 * testsuite/Makefile.in: Regenerate.
7258 2009-09-02 Ian Lance Taylor <iant@google.com>
7260 * output.cc (Output_file::resize): Call map_no_anonymous rather
7263 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7265 * gold.cc: Include "incremental.h".
7266 (queue_initial_tasks): Call Incremental_checker methods.
7267 * incremental.cc: Include "output.h".
7268 (Incremental_checker::can_incrementally_link_output_file): New
7270 * incremental.h (Incremental_checker): New class.
7272 * output.cc (Output_file::open_for_modification): New method.
7273 (Output_file::map_anonymous): Changed return type to bool. Record
7275 (Output_file::map_no_anonymous): New method, broken out of map.
7276 (Output_file::map): Use map_no_anonymous and map_anonymous.
7277 * output.h (class Output_file): Update declarations.
7279 2009-08-24 Cary Coutant <ccoutant@google.com>
7281 * options.h (Command_line::Pre_options): New class.
7282 (Command_line::pre_options): New member.
7283 * options.cc (gold::options::ready_to_register): New variable.
7284 (One_option::register_option): Do nothing if not registering options.
7285 Assert if same short option registered twice.
7286 (General_options::General_options): Turn off option registration when
7288 (Command_line::Pre_options::Pre_options): New constructor.
7290 2009-08-24 Cary Coutant <ccoutant@google.com>
7292 * options.h (General_options::no_keep_memory): Remove incorrect
7295 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7297 * Makefile.am (am__skiplex, am__skipyacc): New.
7298 * Makefile.in: Regenerate.
7300 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7302 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7303 (INCLUDES): ... this.
7304 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7305 (AM_CPPFLAGS): Renamed from ...
7306 (INCLUDE): ... this.
7307 * Makefile.in, testsuite/Makefile.in: Regenerate.
7309 * Makefile.in: Regenerate.
7310 * aclocal.m4: Likewise.
7311 * config.in: Likewise.
7312 * configure: Likewise.
7313 * testsuite/Makefile.in: Likewise.
7315 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7316 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7317 * Makefile.in: Regenerate.
7318 * testsuite/Makefile.in: Regenerate.
7320 2009-08-19 Cary Coutant <ccoutant@google.com>
7322 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7323 symbols in shared libraries overridden by hidden or internal symbols
7324 in the main program.
7326 2009-08-19 Chris Demetriou <cgd@google.com>
7328 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7329 checking source file names in error messages.
7331 2009-08-18 Doug Kwan <dougkwan@google.com>
7333 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7334 an elcpp::Ehdr as parameter. Adjust call to set_target.
7335 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7336 an elfcpp::Ehdr as parameter.
7337 * object.cc (Object::set_target): Remove the version that looks up
7338 a target and sets it.
7339 (Sized_relobj::setup): Take a Target object instead of
7340 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7341 (make_elf_sized_object): Find target and ask target to
7343 * object.h: (Object::set_target): Remove the version that looks up
7344 a target and sets it.
7345 (Sized_relobj::setup): Take a Target object instead of
7346 an elfcpp:Ehdr as parameter.
7347 * target.cc: Include dynobj.h.
7348 (Target::do_make_elf_object_implementation): New.
7349 (Target::do_make_elf_object): New.
7350 * target.h (Target::make_elf_object): New template declaration.
7351 (Target::do_make_elf_object): New method declarations.
7352 (Target::do_make_elf_object_implementation): New template declaration.
7354 2009-08-14 Ian Lance Taylor <iant@google.com>
7356 * gold.h (FUNCTION_NAME): Define.
7357 (gold_unreachable): Use FUNCTION_NAME.
7359 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7361 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7362 symbol in the --keep-unique list is not found.
7364 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7366 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7367 been maked as --keep-unique.
7368 (Icf::unfold_section): New function.
7369 * icf.h (Icf::unfold_section): New function.
7370 * options.h (General_options::keep_unique): New option.
7371 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7372 * testsuite/Makefile.in: Regenerate.
7373 * testsuite/icf_keep_unique_test.sh: New file.
7374 * testsuite/icf_keep_unique_test.cc: New file.
7376 2009-08-12 Cary Coutant <ccoutant@google.com>
7379 * resolve.cc (Symbol_table::resolve): Check for references from
7380 dynamic objects to hidden and internal symbols.
7381 * testsuite/Makefile.am (hidden_test.sh): New test.
7382 * testsuite/Makefile.in: Regenerate.
7383 * testsuite/hidden_test.sh: New script.
7384 * testsuite/hidden_test_1.c: New test source.
7385 * testsuite/hidden_test_main.c: New test source.
7387 2009-08-11 Doug Kwan <dougkwan@google.com>
7389 * arm.cc: Update comments.
7390 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7391 segment to locate the .ARM.exidx section if present.
7393 2009-08-09 Doug Kwan <dougkwan@google.com>
7395 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7398 2009-08-07 Sriraman Tallam <tmsriram@google.com>
7399 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7402 2009-08-06 Sriraman Tallam <tmsriram@google.com>
7404 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7405 valid tls_segment only for non-debug-section relocations.
7406 * testsuite/Makefile.am: Add gc_tls_test.
7407 * testsuite/Makefile.in: Regenerate.
7408 * testsuite/gc_tls_test.cc: New file.
7409 * testsuite/gc_tls_test.sh: New file.
7411 2009-08-05 Sriraman Tallam <tmsriram@google.com>
7415 * Makefile.am (CCFILES): Add icf.cc.
7417 * Makefile.in: Regenerate.
7418 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7419 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7420 section, symbol and addend information for the relocs.
7421 * gold.cc (queue_middle_tasks): Call identical code folding.
7422 * gold.h: Add defines for multimap.
7423 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7424 to the call of finalize_local_symbols.
7425 * main.cc (main): Create object of class Icf.
7426 * object.cc (Sized_relobj::do_layout): Allow this function to be
7427 called twice during icf.
7428 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7429 to sections marked as identical by icf.
7430 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7432 (Sized_relobj::do_section_entsize): New function.
7433 * object.h (Object::section_entsize): New function.
7434 (Object::do_section_entsize): New pure virtual function.
7435 (Relobj::finalize_local_symbols): Add new parameter.
7436 (Relobj::do_section_entsize): New function.
7437 * options.h (General_options::icf): New option.
7438 (General_options::icf_iterations): New option.
7439 (General_options::print_icf_sections): New option.
7440 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7441 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7442 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7444 * symtab.cc (Symbol_table::is_section_folded): New function.
7445 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7446 to sections marked as identical by icf.
7447 * symtab.h (Symbol_table::set_icf): New function.
7448 (Symbol_table::icf): New function.
7449 (Symbol_table::is_section_folded): New function.
7450 (Symbol_table::icf_): New data member.
7451 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7452 * testsuite/Makefile.am: Add commands to build icf_test.
7453 * testsuite/Makefile.in: Regenerate.
7454 * testsuite/icf_test.sh: New file.
7455 * testsuite/icf_test.cc: New file.
7457 2009-07-24 Chris Demetriou <cgd@google.com>
7459 * layout.cc (is_compressible_debug_section): Fix incorrect
7460 comment about compressed section names.
7462 2009-07-20 Ian Lance Taylor <ian@airs.com>
7465 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7467 2009-07-16 Ian Lance Taylor <iant@google.com>
7470 * layout.h: #include <map>.
7471 (class Kept_section): Change from struct to class. Add accessors
7472 and setters. Add section size to Comdat_group mapping. Change
7473 Comdat_group to std::map. Add is_comdat_ field. Add
7474 linkonce_size field in union.
7475 (class Layout): Update declaration of find_or_add_kept_section.
7476 Don't declare find_kept_object.
7477 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7478 parameter. Add object, shndx, is_comdat, and is_group_name
7479 parameters. Change all callers. Adjust for new Kept_section.
7480 (Layout::find_kept_object): Remove.
7481 * object.cc (Sized_relobj::include_section_group): Update use of
7482 Kept_section. Rename secnum to shndx. Only record
7483 Kept_comdat_section if sections are the same size.
7484 (Sized_relobj::include_linkonce_section): Update use of
7485 Kept_section. Only record Kept_comdat_section if sections are the
7486 same size. Set size of linkonce section.
7487 (Sized_relobj::map_to_kept_section): Update call to
7488 get_kept_comdat_section.
7489 * object.h (class Sized_relobj): Rename fields in
7490 Kept_comdat_section to drop trailing underscores; change object
7491 field to Relobj*. Change Kept_comdat_section_table to store
7492 struct rather than pointer.
7493 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7494 Add kept_object and kept_shndx parameters. Change all callers.
7495 (Sized_relobj::get_kept_comdat_section): Change return type to
7496 bool. Add kept_object and kept_shndx parameters. Change all
7498 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7499 Layout::find_or_add_kept_section.
7501 2009-07-09 Ian Lance Taylor <iant@google.com>
7503 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7504 Reserve space in the hash table.
7506 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7508 * fileread.cc (File_read::get_mtime): New method.
7509 * fileread.h (Timespec): New structure.
7510 (File_read::get_mtime): New method.
7511 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7512 Renamed from timestamp_nsec.
7513 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7515 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7517 (Incremental_inputs::report_archive): Save mtime; style fix.
7518 (Incremental_inputs::report_obejct): Save mtime; style fix.
7519 (Incremental_inputs::report_script): Save mtime; style fix.
7520 (Incremental_inputs::finalize_inputs): Style fix.
7521 (Incremental_inputs::finalize): Style fix.
7522 (Incremental_inputs::create_input_section_data): Store inputs
7524 * incremental.h (Incremental_inputs::report_script): Add mtime
7526 (Incremental_inputs::Input_info::Input_info): Intialize only one
7528 (Incremental_inputs::Input_info::archive): Move to nameless
7530 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7531 (Incremental_inputs::Input_info::script): Move to nameless union.
7532 (Incremental_inputs::mtime): New field.
7533 * script.cc (read_input_script): Pass file mtime to
7535 * script.h (Script_info::inputs): Style fix.
7537 2009-07-01 Ian Lance Taylor <ian@airs.com>
7539 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7542 2009-06-24 Ian Lance Taylor <iant@google.com>
7545 * layout.cc (Layout::choose_output_section): If we find an
7546 existing section, update the flags.
7547 (Layout::create_notes): New function, broken out of
7549 (Layout::finalize): Don't create note sections.
7550 (Layout::create_note): Don't crash if linker script discards
7552 (Layout::create_gold_note): Likewise.
7553 (Layout::create_build_id): Likewise. Don't set
7554 after_input_sections on the section.
7555 (Layout::create_executable_stack_info): Remove target parameter.
7557 * layout.h (class Layout): Declare create_notes. Update
7558 declaration of create_executable_stack_info.
7559 * gold.cc (queue_middle_tasks): Call create_notes.
7560 * output.cc (Output_section::update_flags_for_input_section): Move
7561 here from output.h. If SHF_ALLOC flag is newly set, mark address
7563 * output.h (Output_data::mark_address_invalid): New function.
7564 (class Output_section): Only declare, not define,
7565 update_flags_for_input_section. Remove set_flags.
7567 2009-06-24 Ian Lance Taylor <iant@google.com>
7569 * script-sections.cc (Output_section_definition::
7570 set_section_addresses): Rename shadowing local load_address to
7573 2009-06-24 Ian Lance Taylor <iant@google.com>
7576 * reloc.cc (relocate_sections): Skip empty relocation sections.
7578 2009-06-23 Ian Lance Taylor <iant@google.com>
7581 * layout.cc (Layout::create_note): Use choose_output_section
7582 rather than make_output_section.
7584 2009-06-23 Ian Lance Taylor <iant@google.com>
7587 * options.cc (General_options::parse_V): Set printed_version_.
7588 (General_options::General_options): Initialize printed_version_.
7589 * options.h (class General_options): Add printed_version_ field.
7590 * gold.cc (queue_initial_tasks): If there are no input files,
7591 don't give a fatal error if we printed the version information.
7592 (queue_middle_tasks): If using -r with a shared object, give a
7593 fatal error rather than an ordinary error.
7595 2009-06-23 Ian Lance Taylor <iant@google.com>
7598 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7599 (Layout::make_output_section): Set have_stabstr_section_ if we see
7600 a .stab*str section.
7601 (Layout::finalize): Call link_stabs_sections.
7602 (Layout::link_stabs_sections): New file.
7603 * layout.h (class Layout): Add have_stabstr_section_ field.
7604 Declare link_stabs_sections.
7606 2009-06-23 Doug Kwan <dougkwan@google.com>
7608 * Makefile.am (libgold_a_LIBADD): New.
7609 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7610 * Makefile.in: Regenerate.
7611 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7612 * configure: Regenerate.
7613 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7614 * fileread.cc: Include sys/state.h
7615 * gold.h: Declare memmem and strndup if found missing.
7616 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7618 2009-06-23 Ian Lance Taylor <iant@google.com>
7620 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7621 * configure: Rebuild.
7623 2009-06-23 Ian Lance Taylor <iant@google.com>
7626 * object.cc (Object::section_contents): Don't try to get a view if
7627 the section has length zero.
7628 (Object::handle_gnu_warning_section): If the section is empty, use
7629 the name of the section as the warning.
7631 2009-06-23 Ian Lance Taylor <iant@google.com>
7634 * stringpool.h (class Stringpool_template): Add optimize_ field.
7635 (Stringpool_template::set_optimize): New function.
7636 * stringpool.cc (Stringpool_template::Stringpool_template):
7637 Initialize optimize_ field.
7638 (Stringpool_template::set_string_offsets): Test local optimize
7639 fild rather than parameter.
7640 * layout.cc (Layout::Layout): Call set_optimize on the section
7643 2009-06-22 Ian Lance Taylor <iant@google.com>
7646 * yyscript.y: Parse TARGET.
7647 * script.cc (script_set_target): New function.
7648 * script-c.h (script_set_target): Declare.
7649 * options.cc (General_options::string_to_object_format): Rename
7650 from string_to_object_format in anonymous namespace. Change
7652 * options.h (class General_options): Declare
7653 string_to_object_format.
7655 2009-06-22 Ian Lance Taylor <iant@google.com>
7657 * script-sections.cc (Script_sections::create_segments): Don't put
7658 program headers in a PT_LOAD segment if -n or -N.
7660 2009-06-22 Ian Lance Taylor <iant@google.com>
7663 * options.h (class General_options): Add -z lazy and -z now. Sort
7664 -z options into alphabetical order.
7665 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7667 2009-06-21 Ian Lance Taylor <iant@google.com>
7669 * layout.cc (Layout::make_output_section): Call
7670 Target::new_output_section.
7671 (Layout::attach_allocated_section_to_segment): Put large section
7672 sections in a separate load segment with the large segment flag
7674 (Layout::segment_precedes): Sort large data segments after other
7676 (align_file_offset): New static function.
7677 (Layout::set_segment_offsets): Use align_file_offset.
7678 * output.h (class Output_section): Add is_small_section_ and
7679 is_large_section_ fields.
7680 (Output_section::is_small_section): New function.
7681 (Output_section::set_is_small_section): New function.
7682 (Output_section::is_large_section): New function.
7683 (Output_section::set_is_large_section): New function.
7684 (Output_section::is_large_data_section): New function.
7685 (class Output_segment): Add is_large_data_segment_ field.
7686 (Output_segment::is_large_data_segment): New function.
7687 (Output_segment::set_is_large_data_segment): New function.
7688 * output.cc (Output_section::Output_section): Initialize new
7690 (Output_segment::Output_segment): Likewise.
7691 (Output_segment::add_output_section): Add assertion that large
7692 data sections always go in large data segments. Force small data
7693 sections to the end of the list of data sections. Force small BSS
7694 sections to the start of the list of BSS sections. For large BSS
7695 sections to the end of the list of BSS sections.
7696 * symtab.h (class Symbol): Declare is_common_shndx.
7697 (Symbol::is_defined): Check Symbol::is_common_shndx.
7698 (Symbol::is_common): Likewise.
7699 (class Symbol_table): Define enum Commons_section_type. Update
7700 declarations. Add small_commons_ and large_commons_ fields.
7701 * symtab.cc (Symbol::is_common_shndx): New function.
7702 (Symbol_table::Symbol_table): Initialize new fields.
7703 (Symbol_table::add_from_object): Put small and large common
7704 symbols in the right list.
7705 (Symbol_table::sized_finalized_symbol): Check
7706 Symbol::is_common_shndx.
7707 (Symbol_table::sized_write_globals): Likewise.
7708 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7709 common symbol lists. Don't call do_allocate_commons_list if the
7711 (Symbol_table::do_allocate_commons_list): Remove is_tls
7712 parameter. Add comons_section_type parameter. Change all
7713 callers. Handle small and large common symbols.
7714 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7715 Symbol::is_common_shndx.
7716 * resolve.cc (symbol_to_bits): Likewise.
7717 * target.h (Target::small_common_shndx): New function.
7718 (Target::small_common_section_flags): New function.
7719 (Target::large_common_shndx): New function.
7720 (Target::large_common_section_flags): New function.
7721 (Target::new_output_section): New function.
7722 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7723 small_common_section_flags, and large_common_section_flags
7725 (Target::do_new_output_section): New virtual function.
7726 * arm.cc (Target_arm::arm_info): Initialize new fields.
7727 * i386.cc (Target_i386::i386_info): Likewise.
7728 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7730 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7731 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7732 (Target_x86_64::do_new_output_section): New function.
7733 * configure.ac: Define conditional MCMODEL_MEDIUM.
7734 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7735 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7736 (large_LDFLAGS): Define.
7737 * testsuite/large.c: New file.
7738 * testsuite/testfile.cc (Target_test::test_target_info):
7739 Initialize new fields.
7740 * configure, testsuite/Makefile.in: Rebuild.
7742 2009-06-05 Doug Kwan <dougkwan@google.com>
7744 * Makefile.am (CCFILES): Add target.cc.
7745 * Makefile.in: Regenerate.
7746 * i386.cc (class Target_i386): Define new virtual method to
7747 override do_is_local_label_name in parent.
7748 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7749 local symbols if --discard-locals or -X is given.
7750 * options.h (class General_options): Declare new options
7751 '--discard-locals' and '-X' for discarding locals.
7752 * target.h (class Target): Define new methods is_local_label_name.
7753 Declare new virtual method do_is_local_label_name.
7754 * target.cc: New file.
7755 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7756 (check_SCRIPTS): Add discard_locals_test.sh.
7757 (check_DATA): Add discard_local_tests.syms.
7758 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7759 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7760 * testsuite/Makefile.in: Regenerate.
7761 * testsuite/discard_locals_test.c: New file.
7762 * testsuite/discard_locals_test.sh: Same.
7764 2009-06-05 Doug Kwan <dougkwan@google.com>
7766 * object.cc (Sized_relobj::Sized_relobj): Initialize
7767 discarded_eh_frame_shndx_ to -1U.
7768 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7770 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7771 a discarded .eh_frame section.
7772 (Sized_relobj::do_finalize_local_symbols): Ditto.
7773 * object.h (class Sized_relobj): Declare new member
7774 discarded_eh_frame_shndx_.
7775 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7776 (local_labels_test.o, local_labels_test): New rules.
7777 * testsuite/Makefile.in: Regenerate.
7779 2009-06-04 Doug Kwan <dougkwan@google.com>
7781 * layout.cc (Layout::section_name_mapping): Add mapping for
7782 special ARM sections.
7784 2009-06-03 Doug Kwan <dougkwan@google.com>
7786 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7787 (utils::has_overflow): Same.
7789 2009-06-03 Ian Lance Taylor <iant@google.com>
7791 * layout.cc (Layout::section_name_mapping): New array, replacing
7792 Layout::linkonce_mapping.
7793 (Layout::section_name_mapping_count): New variable, replacing
7794 Layout::linkonce_mapping_count.
7795 (Layout::linkonce_output_name): Remove.
7796 (Layout::output_section_name): Rewrite.
7797 * layout.h (class Layout): Rename Linkonce_mapping to
7798 Section_name_mapping, linkonce_mapping to section_name_mapping,
7799 linkonce_mapping_count to section_name_mapping_count. Don't
7800 declare linkonce_output_name.
7802 2009-06-03 Doug Kwan <dougkwan@google.com>
7804 * gold/arm.cc (namespace utils): New.
7805 (Target_arm::reloc_is_non_pic): Define new method.
7806 (class Arm_relocate_functions): New.
7807 (Target_arm::Relocate::relocate): Handle relocation types used by
7810 2009-06-03 Ian Lance Taylor <iant@google.com>
7812 * arm.cc (Target_arm::scan::global): Use || instead of |.
7814 2009-06-02 Doug Kwan <dougkwan@google.com>
7816 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7817 issued_non_pic_error_.
7818 (class Target_arm::Scan): Declare new method check_non_pic.
7819 Define new method symbol_needs_plt_entry.
7820 Declare new data member issued_non_pic_error_.
7821 (class Target_arm::Relocate): Declare new method
7822 should_apply_static_reloc.
7823 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7824 (Target_arm::Scan::check_non_pic): Define new method.
7825 (Target_arm::Scan::local): Handle a small subset of reloc types used
7827 (Target_arm::Scan::local): Same.
7828 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7830 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
7832 * incremental.cc (Incremental_inputs::report_command_line): Filter
7833 out --incremental-* options.
7835 2009-05-29 Doug Kwan <dougkwan@google.com>
7837 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7839 (class Target_arm): Update comment.
7840 (Target_arm::Target_arm): Initialize new data members GOT_,
7841 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7842 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7843 and Target_arm::rel_dyn_section.
7844 Declare new_enum Target_arm::Got_type.
7845 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7847 Update commments for member do_dynsym_value.
7848 (Target_arm::got_size, Target_arm::plt_section,
7849 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7850 new methods inside class defintion.
7851 (Target_arm::got_section): Define new method.
7852 (Target_arm::rel_dyn_section): Same.
7853 (Output_data_plt_arm): New template class.
7854 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7855 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7856 (Output_data_plt_arm::add_entry): Same.
7857 (Output_data_plt_arm::first_plt_entry): Define new
7858 static data member for PLT instruction template.
7859 (Output_data_plt_arm::plt_entry): Same.
7860 (Output_data_plt_arm::do_write): Define new method.
7861 (Target_arm::make_plt_entry): Same.
7862 (Target_arm::do_finalize_sections): Same.
7863 (Target_arm::do_dynsym_value): Same.
7865 2009-05-28 Doug Kwan <dougkwan@google.com>
7867 * Makefile.am (TARGETSOURCES): Add arm.cc.
7868 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7869 * Makefile.in: Regenerate.
7871 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7873 2009-05-26 Doug Kwan <dougkwan@google.com>
7875 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7876 (General_options::check_excluded_libs): Strip off directories in
7877 archive name before matching like GNU ld does.
7878 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7879 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7880 (exclude_libs_test_LDFLAGS): Add linker option
7881 -Wl,--exclude-libs,libexclude_libs_test_3
7882 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7883 an explicit archive without using -l.
7884 (alt/libexclude_libs_test_3.a): New make rule.
7885 * testsuite/Makefile.in: Regenerate.
7886 * testsuite/exclude_libs_test.c : Declare lib3_default().
7888 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7889 * exclude_libs_test_3.c: New file.
7891 2009-05-26 Nick Clifton <nickc@redhat.com>
7893 * po/id.po: New Indonesian translation.
7894 * po/gold.pot: Updated template file.
7896 2009-05-22 Sriraman Tallam <tmsriram@google.com>
7898 * testsuite/Makefile.am: Add -ffunction-sections to compile
7899 gc_comdat_test files. Add -Wl,--gc-sections to build
7901 * testsuite/Makefile.in: Regenerate.
7902 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7904 2009-05-21 Sriraman Tallam <tmsriram@google.com>
7906 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7907 kept comdat section was garbage collected.
7908 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7909 * testsuite/Makefile.in: Regenerate.
7910 * testsuite/gc_comdat_test.sh: New file.
7911 * testsuite/gc_comdat_test_1.cc: New file.
7912 * testsuite/gc_comdat_test_2.cc: New file.
7914 2009-05-19 Doug Kwan <dougkwan@google.com>
7916 * archive.cc (Archive::Archive): Move constructor from archive.h
7917 to here. Initialize no_export_.
7918 (Archive::get_elf_object_for_member): Set no_export flag of object.
7919 * archive.h (Archive::Archive): Move constructor body to
7921 (Archive::no_export): New method.
7922 (Archive::no_export_): New field.
7923 * object.h (Object::Object): Initialize no_export_ to false.
7924 (Object::no_export, Object::set_no_export): New methods.
7925 (Object::no_export_): New field.
7926 * options.cc (General_options::parse_exclude_libs): New method.
7927 (General_options::check_excluded_libs) Same.
7928 * options.h (exclude_libs): New option.
7929 (General_options::check_excluded_libs): New method declaration.
7930 (General_options::excluded_libs_): New field.
7931 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7932 default or protected visibility if an object has no-export flag set.
7933 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7934 (check_SCRIPTS): Add exclude_libs_test.sh.
7935 (check_DATA): Add exclude_libs_test.syms.
7936 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7937 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7938 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7939 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7940 (exclude_libs_test.syms, libexclude_libs_test_1.a,
7941 libexclude_libs_test_2.a): New rules.
7942 * testsuite/Makefile.in: Regenerate.
7943 * testsuite/exclude_libs_test.c: New file.
7944 * testsuite/exclude_libs_test.sh: Ditto.
7945 * testsuite/exclude_libs_test_1.c: Ditto.
7946 * testsuite/exclude_libs_test_2.c: Ditto.
7948 2009-05-15 Ian Lance Taylor <iant@google.com>
7950 * configure.ac: Check for declarations for cases where libiberty.h
7951 checks HAVE_DECL_xxx.
7952 * configure, config.in: Rebuild.
7954 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
7956 * gold.h (Incremental_argument_list): Remove (invalid) forward
7958 * incremental.cc (Incremental_inputs::report_achive): New method.
7959 (Incremental_inputs::report_object): New method.
7960 (Incremental_inputs::report_script): New method.
7961 (Incremental_inputs::finalize_inputs): New method.
7962 (Incremental_inputs::finalize): Call finalize_inputs().
7963 (Incremental_inputs::sized_create_incremental_inputs_section_data):
7964 Create inputs entries.
7965 * incremental.h (Incremental_input_type): New enum.
7966 (Incremental_inputs::Incremental_input): Initialize new fields.
7967 (Incremental_inputs::report_inputs): New method.
7968 (Incremental_inputs::report_achive): New method.
7969 (Incremental_inputs::report_object): New method.
7970 (Incremental_inputs::report_script): New method.
7971 (Incremental_inputs::finalize_inputs): New method.
7972 (Incremental_inputs::Input_info): New struct.
7973 (Incremental_inputs::Input_info_map): New typedef.
7974 (Incremental_inputs::lock_): New field.
7975 (Incremental_inputs::Inputs_): New field.
7976 (Incremental_inputs::Inputs_map): New field.
7977 * main.cc (main): Call Incremental_input::report_inputs.
7978 * options.h (Input_argument_list): Typedef moved from
7980 (Input_file_group::Files): Remove, use ::Input_argument_list.
7981 (Input_file_group::Input_argument_list): Remove, use
7982 ::Input_argument_list.
7983 * plugin.cc (Plugin_manager::add_input_file): Add error in
7985 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7987 * script.cc (read_input_script): Call
7988 Incremental_input::report_script.
7989 * script.h (Script_info): New class.
7991 2009-04-27 Ian Lance Taylor <iant@google.com>
7993 * x86_64.cc (do_adjust_output_section): Set entsize to
7996 2009-04-23 Elliott Hughes <enh@google.com>
7998 * output.cc (Output_file::close): After short writes, continue
7999 writing from the correct offset in the buffer being written.
8001 2009-04-23 Chris Demetriou <cgd@google.com>
8003 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8004 * configure: Regenerate.
8005 * config.in: Regenerate.
8006 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8007 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8009 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8011 * incremental.cc (Incremental_inputs_header_data): Renamed from
8012 Incremental_input_header_data.
8013 (Incremental_inputs_header_data::data_size): New field.
8014 (Incremental_inputs_header_data::put_input_file_count): Renamed
8015 from input_file_count.
8016 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8017 from command_line_offset.
8018 (Incremental_inputs_header_data::put_reserved): Renamed from
8020 (Incremental_inputs_entry_data): Renamed from
8021 Incremental_input_entry_data.
8022 (Incremental_inputs_entry_data::data_size): New field.
8023 (Incremental_inputs::report_command_line): New method.
8024 (Incremental_inputs::finalize): New method.
8025 (Incremental_inputs::create_incremental_inputs_data): New method.
8026 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8027 * incremental.h: New file.
8028 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8029 (Layout::finalize): Create incremental inputs section in
8031 (Layout::create_incremental_info_sections): New method.
8032 * layout.h (Layout::incremental_inputs): New method.
8033 (Layout::create_incremental_info_sections): New method.
8034 (Layout::incremental_inputs_): New field.
8035 * main.cc (main): Notify Incremental_input of the command line.
8037 2009-04-01 Ian Lance Taylor <iant@google.com>
8038 Mikolaj Zalewski <mikolajz@google.com>
8040 * gold.h (reserve_unordered_map): Define, three versions, one for
8041 each version of Unordered_map.
8042 * layout.cc (Layout::Layout): Remove options parameter. Add
8043 number_of_input_files parameter. Don't initialize options_.
8044 Initialize number_of_input_files_ and resized_signatures_. Move
8045 sections_are_attached_.
8046 (Layout::layout_group): Reserve space for group_signatures_.
8047 (Layout::find_or_add_kept_section): Change name parameter to be a
8048 reference. Resize signatures_ map when it gets large enough.
8049 (Layout::layout_eh_frame): Use parameters->options() instead of
8051 (Layout::make_output_section): Likewise.
8052 (Layout::attach_allocated_section_to_segment): Likewise.
8053 (Layout::finalize, Layout::create_executable_stack): Likewise.
8054 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8055 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8056 * layout.h (class Layout): Update declarations. Remove options_
8057 field. Add number_of_input_files_ and resized_signatures_
8058 fields. Move sections_are_attached_ field.
8059 * main.cc (main): Pass number of input files to Layout
8060 constructor. Don't pass options.
8062 2009-03-30 Ian Lance Taylor <iant@google.com>
8064 * ffsll.c (ffsll): Correct implementation.
8066 2009-03-27 Ian Lance Taylor <iant@google.com>
8068 * ffsll.c: New file.
8069 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8070 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8071 * ftruncate.c (ftruncate): Declare before definition.
8072 * mremap.c (mremap): Likewise.
8073 * pread.c (pread): Likewise.
8074 * configure, Makefile.in, config.in: Rebuild.
8076 * mremap.c: New file.
8077 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8078 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8079 (mremap): Declare if HAVE_MREMAP is not defined.
8080 * configure, Makefile.in, config.in: Rebuild.
8082 2009-03-27 Cary Coutant <ccoutant@google.com>
8084 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8085 position independent.
8086 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8087 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8089 2009-03-24 Cary Coutant <ccoutant@google.com>
8091 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8093 (needs_dynamic_reloc): Likewise.
8095 2009-03-24 Ian Lance Taylor <iant@google.com>
8097 * yyscript.y (file_cmd): Recognize EXTERN.
8098 (extern_name_list, extern_name_list_body): New nonterminals.
8099 * script.cc (script_add_extern): Define.
8100 * script-c.h (script_add_extern): Declare.
8102 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
8104 * object.cc (is_elf_object): Define.
8105 * object.h (is_elf_object): Declare.
8106 * archive.cc (Archive::get_elf_object_for_member): Call
8108 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8110 2009-03-24 Elliott Hughes <enh@google.com>
8112 * output.cc (Output_file::map_anonymous): Define.
8113 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8114 try an anonymous one. Report the size if the mmap fails.
8115 * output.h (class Output_file): Declare map_anonymous.
8117 2009-03-24 Ian Lance Taylor <iant@google.com>
8119 * target-select.cc (instantiate_target): Don't acquire the lock if
8120 the instantiated_target_ field has already been set.
8122 2009-03-23 Ian Lance Taylor <iant@google.com>
8124 * gold-threads.h (class Initialize_lock): Define.
8125 * gold-threads.cc (class Initialize_lock_once): Define.
8126 (initialize_lock_control): New static variable.
8127 (initialize_lock_pointer): New static variable.
8128 (initialize_lock_once): New static function.
8129 (Initialize_lock::Initialize_lock): Define.
8130 (Initialize_lock::initialize): Define.
8131 * target-select.h: Include "gold-threads.h".
8132 (class Target_selector): Add lock_ and initialize_lock_ fields.
8133 Don't define instantiate_target, just declare it.
8134 * target-select.cc (Target_selector::Target_selector): Initialize
8136 (Target_selector::instantiate_target): Define.
8137 * descriptors.h: Include "gold-threads.h".
8138 (class Descriptors): Add initialize_lock_ field.
8139 * descriptors.cc (Descriptors::Descriptors): Initialize new
8141 (Descriptors::open): Use initialize_lock_ field
8142 * errors.h (class Errors): Add initialize_lock_ field.
8143 * errors.cc (Errors::Errors): Initialize new field.
8144 (Errors::initialize_lock): Use initialize_lock_ field.
8145 * powerpc.cc (class Target_selector_powerpc): Remove
8146 instantiated_target_ field. In do_recognize call
8147 instantiate_target rather than do_instantiate_target. In
8148 do_instantiate_target just allocate a new target.
8149 * sparc.cc (class Target_selector_sparc): Likewise.
8151 * freebsd.h: New file.
8152 * i386.cc: Include "freebsd.h".
8153 (Target_i386): Derive from Target_freebsd rather than
8155 (Target_selector_i386): Derive from Target_selector_freebsd rather
8156 than Target_selector.
8157 * x86_64.cc: Include "freebsd.h".
8158 (Target_x86_64): Derive from Target_freebsd rather than
8160 (Target_selector_x86_64): Derive from Target_selector_freebsd
8161 rather than Target_selector.
8162 * target.h (class Target): Add adjust_elf_header and
8163 do_adjust_elf_header.
8164 * output.cc (Output_file_header:: do_sized_write): Call target
8165 adjust_elf_header routine.
8166 * configure.tgt: Set targ_osabi.
8167 * configure.ac: Define GOLD_DEFAULT_OSABI.
8168 * parameters.cc (Parameters::default_target): Pass
8169 GOLD_DEFAULT_OSABI to select_target.
8170 * target-select.h (class Target_selector): Make instantiate_target
8171 protected rather than private.
8172 * Makefile.am (HFILES): Add freebsd.h.
8173 * configure, Makefile.in, config.in: Rebuild.
8175 * merge.cc (do_add_input_section): Correct pend value. Change
8176 message about last entry not being null terminated from error to
8179 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
8181 * incremental.cc: New file.
8182 * Makefile.am (CCFILES): Add incremental.cc.
8183 * Makefile.in: Rebuild.
8185 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
8187 * layout.cc (Layout::output_section_name): Preserve names
8188 of '.note.' sections.
8190 2009-03-19 Ian Lance Taylor <iant@google.com>
8192 * descriptors.cc (Descriptors::open): Check that the options are
8193 valid before using them.
8195 2009-03-18 Ian Lance Taylor <iant@google.com>
8197 * script-sections.h: Include <list>.
8198 (class Script_sections): Change Sections_elements from std::vector
8199 to std::list. Typedef public Elements_iterator. Add
8200 orphan_section_placement_, data_segment_align_start_, and
8201 saw_data_segment_align_ fields. Remove data_segment_align_index_
8203 * script-sections.cc (class Orphan_section_placement): New class.
8204 (class Sections_element): Add virtual functions is_relro and
8205 orphan_section_init. Remove virtual function place_orphan_here.
8206 (class Output_section_definition): Add is_relro and
8207 orphan_section_init. Remove place_orphan_here.
8208 (class Orphan_output_section): Likewise.
8209 (Script_sections::Script_sections): Update for field changes.
8210 (Script_sections::data_segment_align): Set saw_data_segment_align_
8211 and data_segment_align_start_, not data_segment_align_index.
8212 (Script_sections::data_segment_relro_end): Check
8213 saw_data_segment_align_. Use data_segment_align_start_ rather
8214 than data_segment_align_index_.
8215 (Script_sections::place_orphan): Rewrite to use
8216 Orphan_section_placement.
8218 2009-03-17 Ian Lance Taylor <iant@google.com>
8220 * archive.cc (Archive::add_symbols): Check for a version attached
8221 to the symbol name in the archive map.
8222 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8223 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8224 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8225 (ver_test_11.a): New target.
8226 * testsuite/Makefile.in: Rebuild.
8228 * configure.ac: Check for chsize and posix_fallocate. Replace
8230 * ftruncate.c: New file, from gnulib.
8231 * output.cc (posix_fallocate): Define dummy version if not
8232 HAVE_POSIX_FALLOCATE.
8233 (Output_file::map): Call posix_fallocate rather than lseek and
8235 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8236 * configure, Makefile.in, config.in: Rebuild.
8238 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
8240 * layout.h (Layout::create_note): Add section_name parameter.
8241 * layout.cc (Layout::create_note): Likewise.
8242 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8244 2009-03-17 Ian Lance Taylor <iant@google.com>
8246 * descriptors.cc: Include "options.h".
8247 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8248 (Descriptors::open): Always use O_CLOEXEC when opening a new
8249 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8250 then set FD_CLOEXEC.
8252 * sparc.cc (class Target_sparc): Add has_got_section.
8253 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8254 make sure we have a GOT section.
8256 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8257 (Target_sparc::Scan::local): Likewise.
8258 (Target_sparc::Scan::global): Likewise.
8259 (Target_sparc::Relocate::relocate): Likewise.
8260 (Target_sparc::Relocate::relocate_tls): Likewise.
8262 * symtab.cc (Symbol_table::define_default_version): New function,
8263 broken out of add_from_object.
8264 (Symbol_table::add_from_object): Call define_default_version.
8265 (Symbol_table::define_special_symbol): Add resolve_oldsym
8266 parameter. Change all callers. If the version for a symbol comes
8267 from a version script, resolve it with the symbol with the same
8268 name with no version. Also add the symbol without a version if
8270 (do_define_in_output_data): If resolving with oldsym, don't delete
8272 (do_define_in_output_segment): Likewise.
8273 (do_define_as_constant): Likewise.
8274 * symtab.h (class Symbol_table): Update declarations.
8276 2009-03-13 Ian Lance Taylor <iant@google.com>
8278 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8279 (Read_symbols::requeue): New function.
8280 (Read_symbols::do_read_symbols): If make_elf_object fails because
8281 the target type is not configured, and the file was searched for,
8282 issue a warning and retry with the next directory.
8283 (Add_symbols::run): If the file has an incompatible format, and
8284 it was searched for, requeue the Read_symbols task. On error,
8286 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8287 dirindex parameter to constructor. Change all callers. Declare
8288 incompatible_warning and requeue.
8289 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8290 input_argument_ and input_group_ fields. Add them to
8291 constructor. Change all callers.
8292 (class Read_script): Add dirindex_ field. Add it to constructor.
8294 * archive.cc (Archive::setup): Remove input_objects parameter.
8296 (Archive::get_file_and_offset): Likewise.
8297 (Archive::read_all_symbols): Likewise.
8298 (Archive::read_symbols): Likewise.
8299 (Archive::get_elf_object_for_member): Remove input_objects
8300 parameter. Add punconfigured parameter. Change all callers.
8301 (Archive::add_symbols): Change return type to bool. Check return
8302 value of include_member.
8303 (Archive::include_all_members): Likewise.
8304 (Archive::include_member): Change return type to bool. Return
8305 false if first included object has incompatible target. Set
8306 included_member_ field.
8307 (Add_archive_symbols::run): If add_symbols returns false, requeue
8309 * archive.h (class Archive): Add included_member_ field.
8310 Initialize it in constructor. Add input_file and searched_for
8311 methods. Update declarations.
8312 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8313 input_argument_ fields. Add them to constructor. Change all
8315 * script.cc: Include "target-select.h".
8316 (class Parser_closure): Add skip_on_incompatible_target_ and
8317 found_incompatible_target_ fields. Add
8318 skip_on_incompatible_target parameter to constructor. Change all
8319 callers. Add methods skip_on_incompatible_target,
8320 clear_skip_on_incompatible_target, found_incompatible_target, and
8321 set_found_incompatible_target.
8322 (read_input_script): Add dirindex parameter. Change all callers.
8323 If parser finds an incompatible target, requeue Read_symbols
8325 (script_set_symbol): Clear skip_on_incompatible_target in
8327 (script_add_assertion, script_parse_option): Likewise.
8328 (script_start_sections, script_add_phdr): Likewise.
8329 (script_check_output_format): New function.
8330 * script.h (read_input_script): Update declaration.
8331 * script-c.h (script_check_output_format): Declare.
8332 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8333 (ignore_cmd): Remove OUTPUT_FORMAT.
8334 * fileread.cc (Input_file::Input_file): Add explicit this.
8335 (Input_file::will_search_for): New function.
8336 (Input_file::open): Add pindex parameter. Change all callers.
8337 * fileread.h (class Input_file): Add input_file_argument method.
8338 Declare will_search_for. Update declarations.
8339 * object.cc (make_elf_object): Add punconfigured parameter.
8341 * object.h (class Object): Make input_file public. Add
8342 searched_for method.
8343 (make_elf_object): Update declaration.
8344 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8346 * dirsearch.h (class Dirsearch): Update declaration.
8347 * options.h (class General_options): Add --warn-search-mismatch.
8348 * parameters.cc (Parameters::is_compatible_target): New function.
8349 * parameters.h (class Parameters): Declare is_compatible_target.
8350 * workqueue.cc (Workqueue::add_blocker): New function.
8351 * workqueue.h (class Workqueue): Declare add_blocker.
8353 * fileread.cc (Input_file::open): Remove options parameter.
8355 (Input_file::open_binary): Likewise.
8356 * script.cc (read_input_script): Likewise.
8357 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8358 options parameter from constructor. Change all callers.
8359 (class Read_script): Likewise.
8360 * fileread.h (class Input_file): Update declarations.
8361 * script.h (read_input_script): Update declaration.
8363 2009-03-10 Nick Clifton <nickc@redhat.com>
8365 * po/es.po: New Spanish translation.
8367 2009-03-06 Cary Coutant <ccoutant@google.com>
8369 * options.cc (parse_short_option): Keep dash_z from registering itself.
8371 2009-03-03 Ian Lance Taylor <iant@google.com>
8374 * target-reloc.h (relocate_section): Pass output_section to
8376 * i386.cc (Target_i386::should_apply_static_reloc): Add
8377 output_section parameter. Change all callers.
8378 (Target_i386::Relocate::relocate): Add output_section parameter.
8379 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8380 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8381 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8382 * testsuite/two_file_shared.sh: New script.
8383 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8384 (check_DATA): Add two_file_shared.dbg.
8385 (two_file_shared.dbg): New target.
8386 * testsuite/Makefile.in: Rebuild.
8388 2009-03-01 Ian Lance Taylor <iant@google.com>
8390 * configure.ac: Check for byteswap.h.
8391 * configure: Rebuild.
8392 * config.in: Rebuild.
8394 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8396 * layout.cc (Layout::find_or_add_kept_section): New function.
8397 (Layout::add_comdat): Removed.
8398 * layout.h (struct Kept_section): Move out of class Layout.
8399 Remove trailing underscores from field names. Add group_sections
8400 field. Rename group_ field to is_group. Change all uses.
8401 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8402 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8403 comdat_groups_ field.
8404 (Sized_relobj::include_section_group): Use
8405 find_or_add_kept_section and Kept_section::group_sections.
8406 (Sized_relobj::include_linkonce_section): Likewise.
8407 * object.cc (class Sized_relobj): Don't define Comdat_group or
8408 Comdat_group_table. Remove find_comdat_group and
8409 add_comdat_group. Remove comdat_groups_ field.
8410 * plugin.cc (include_comdat_group): Use
8411 Layout::find_or_add_kept_section.
8413 2009-02-28 Ian Lance Taylor <iant@google.com>
8415 * README: --gc-sections and map files are now supported. Document
8416 some build requirements.
8419 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8420 relocatable link set the value of the section symbol to zero.
8421 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8422 relocatable link don't include the section address in the local
8425 2009-02-27 Ian Lance Taylor <iant@google.com>
8428 * options.h (class Search_directory): Add is_system_directory.
8429 (class General_options): Declare is_in_system_directory.
8430 * options.cc (get_relative_sysroot): Make static.
8431 (get_default_sysroot): Make static.
8432 (General_optoins::is_in_system_directory): New function.
8433 * fileread.cc (Input_file::is_in_system_directory): New function.
8434 * fileread.h (class Input_file): Declare is_in_system_directory.
8435 * object.h (class Object): Add is_in_system_directory.
8436 (class Input_objects): Remove system_library_directory_ field.
8437 * object.cc (Input_objects::add_object): Don't set
8438 system_library_directory_.
8439 (input_objects::found_in_system_library_directory): Remove.
8440 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8441 parameter. Change all callers.
8442 (Symbol_table::sized_write_globals): Likewise.
8443 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8444 Call Object::is_in_system_directory.
8445 * symtab.h (class Symbol_table): Update declarations.
8448 * descriptors.h (Open_descriptor): Add is_on_stack field.
8449 * descriptors.cc (Descriptors::open): If the descriptor is on the
8450 top of the stack, remove it. Initialize is_on_stack field.
8451 (Descriptors::release): Only add pod to stack if it is not on the
8453 (Descriptors::close_some_descriptor): Clear stack_next and
8457 * output.cc (Output_section::find_starting_output_address): Rename
8458 from starting_output_address; add PADDR parameter; change return
8460 * output.h (class Output_section): Declare
8461 find_starting_output_address instead of starting_output_address.
8462 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8463 section symbol for which we can't find a merge section.
8466 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8467 hidden or internal, force the symbol to be local.
8468 * resolve.cc (Symbol::override_visibility): Define.
8469 (Symbol::override_base): Use override_visibility.
8470 (Symbol_table::resolve): Likewise.
8471 (Symbol::override_base_with_special): Likewise.
8472 (Symbol_table::override_with_special): If the visibility is hidden
8473 or internal, force the symbol to be local.
8474 * symtab.h (class Symbol): Add set_visibility and
8475 override_visibility.
8476 * testsuite/ver_test_1.sh: New file.
8477 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8478 (check_DATA): Add ver_test_1.syms.
8479 (ver_test_1.syms): New target.
8480 * testsuite/Makefile.in: Rebuild.
8482 2009-02-25 Cary Coutant <ccoutant@google.com>
8484 * layout.cc (Layout::choose_output_section): Don't rename sections
8485 when using a linker script that has a SECTIONS clause.
8486 * Makefile.in: Regenerate.
8488 * testsuite/Makefile.am (script_test_5.sh): New test case.
8489 * testsuite/Makefile.in: Regenerate.
8490 * testsuite/script_test_5.cc: New file.
8491 * testsuite/script_test_5.sh: New file.
8492 * testsuite/script_test_5.t: New file.
8494 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
8496 * archive.cc (Archive::include_member): Update calls to add_symbols.
8497 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8498 the Layout argument.
8499 * dynobj.h (do_add_symbols): Add the Layout argument.
8500 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8502 * object.h (Object::add_symbols): Add the Layout argument.
8503 (Object::do_add_symbols): Add the Layout argument.
8504 (Sized_relobj::do_add_symbols): Add the Layout argument.
8505 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8506 Unify the two versions.
8507 (Add_plugin_symbols): Remove.
8508 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8509 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8510 (Add_plugin_symbols): Remove.
8511 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8512 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8513 (Add_symbols::run): Make it work with Pulginobj.
8515 2009-02-06 Ian Lance Taylor <iant@google.com>
8517 * object.cc (Sized_relobj::do_layout): Make info message start
8518 with lower case letter.
8520 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8522 * binary.cc: Fix file comment.
8524 * options.h (enum Incremental_disposition): Define.
8525 (class General_options): Add new options: --incremental,
8526 --incremental_changed, --incremental_unchanged,
8527 --incremental_unknown. Add incremental_disposition_ and
8528 implicit_incremental_ fields.
8529 (General_options::incremental_disposition): New function.
8530 (class Position_dependent_options): Add incremental_disposition
8532 (Position_dependent_options::copy_from_options): Set incremental
8534 * options.cc (General_options::parse_incremental_changed): New
8536 (General_options::parse_incremental_unchanged): New function.
8537 (General_options::parse_incremental_unknown): New function.
8538 (General_options::General_options): Initialize new fields
8539 incremental_disposition_ and implicit_incremental_.
8540 (General_options::finalize): Check for uasge of --incremental-*
8541 without --incremental.
8543 2009-02-06 Chris Demetriou <cgd@google.com>
8545 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8546 pointer and to report location as the file name associated with
8548 (gold_undefined_symbol_at_location): New function to replace the
8549 old gold_undefined_symbol functionality.
8550 * target-reloc.h (relocate_section): Update to use
8551 gold_undefined_symbol_at_location.
8552 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8553 Call gold_undefined_symbol function rather than gold_error.
8554 * errors.h (Errors::undefined_symbol): Take location as a
8555 string, rather than calculating it from a relocation.
8556 * errors.cc (Errors::fatal): Print "fatal error:" before the
8558 (Errors::error, Errors::error_at_location): Print "error: "
8559 before the formatted message.
8560 (Errors::undefined_symbol): Take location as a string, rather
8561 than calculating it from a relocation.
8562 (gold_undefined_symbol_at_location): New function akin to
8563 old gold_undefined_symbol, calculates location from relocation.
8564 (gold_undefined_symbol): Change to take only a Symbol pointer
8565 and to report location as the file name associated with the symbol.
8566 * testsuite/debug_msg.sh: Update for changed error messages.
8567 * testsuite/undef_symbol.sh: Likewise.
8569 2009-02-04 Duncan Sands <baldrick@free.fr>
8572 * reduced_debug_output.h
8573 (Output_reduced_debug_abbrev_section::failed): Use format for
8575 (Output_reduced_debug_info_section::faild): Likewise.
8577 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8579 * script.cc (Lazy_demangler): New class.
8580 (Version_script_info::get_symbol_version_helper): Demangle a
8583 2009-01-29 Cary Coutant <ccoutant@google.com>
8585 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8587 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8589 2009-01-28 Ian Lance Taylor <iant@google.com>
8591 * version.cc (version_string): Bump to 1.9.
8593 * gold.h: Include <cstring> and <stdint.h>.
8594 * version.cc: Include <cstdio>.
8595 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8597 * reduced_debug_output.cc (insert_into_vector): Rename from
8598 Insert_into_vector; change all callers. Use Swap_unaligned to
8599 avoid aliasing issue; remove union since it is unnecessary.
8601 2009-01-27 Sriraman Tallam <tmsriram@google.com>
8603 * Makefile.am (CCFILES): Add gc.cc.
8605 * Makefile.in: Regenerate.
8606 * gold.cc (Gc_runner): New class.
8607 (queue_initial_tasks): Call garbage collection related tasks
8608 when corresponding options are invoked.
8609 (queue_middle_gc_tasks): New function.
8610 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8611 processed early before laying out sections during garbage collection.
8612 * gold.h (queue_middle_gc_tasks): New function.
8613 (is_prefix_of): Move from "layout.cc".
8614 * i386.cc (Target_i386::gc_process_relocs): New function.
8615 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8616 * main.cc (main): Create object of class "Garbage_collection".
8617 * object.cc (Relobj::copy_symbols_data): New function.
8618 (Relobj::is_section_name_included): New function.
8619 (Sized_relobj::do_layout): Allow this function to be called twice
8620 during garbage collection and defer layout of section during the
8622 * object.h (Relobj::get_symbols_data): New function.
8623 (Relobj::is_section_name_included): New function.
8624 (Relobj::copy_symbols_data): New function.
8625 (Relobj::set_symbols_data): New function.
8626 (Relobj::get_relocs_data): New function.
8627 (Relobj::set_relocs_data): New function.
8628 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8629 (Relobj::gc_process_relocs): New function.
8630 (Relobj::do_gc_process_relocs): New pure virtual function.
8631 (Relobj::sd_): New data member.
8632 (Sized_relobj::is_output_section_offset_invalid): New function.
8633 (Sized_relobj::do_gc_process_relocs): New function.
8634 * options.h (General_options::gc_sections): Modify to not be a no-op.
8635 (General_options::print_gc_sections): New option.
8636 * plugin.cc (Plugin_finish::run): Remove function call to
8637 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8638 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8639 * reloc.cc (Read_relocs::run): Add task to process relocs and
8640 determine unreferenced sections when doing garbage collection.
8641 (Gc_process_relocs): New class.
8642 (Sized_relobj::do_gc_process_relocs): New function.
8643 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8644 sections that are garbage collected.
8645 * reloc.h (Gc_process_relocs): New class.
8646 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8647 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8648 symbols whose corresponding sections are garbage collected.
8649 (Symbol_table::Symbol_table): Add new parameter for the garbage
8651 (Symbol_table::gc_mark_undef_symbols): New function.
8652 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8653 (Symbol_table::gc_mark_dyn_syms): New function.
8654 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8656 (Symbol_table::add_from_object): Likewise.
8657 (Symbol_table::add_from_relobj): When building shared objects, do not
8658 treat externally visible symbols as garbage.
8659 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8660 table information for static and relocatable links.
8661 * symtab.h (Symbol_table::set_gc): New function.
8662 (Symbol_table::gc): New function.
8663 (Symbol_table::gc_mark_undef_symbols): New function.
8664 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8665 (Symbol_table::gc_mark_dyn_syms): New function.
8666 (Symbol_table::gc_): New data member.
8667 * target.h (Sized_target::gc_process_relocs): New pure virtual
8669 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8670 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8672 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
8674 * options.h (General_options::gc_sections): Define as a no-op for now.
8675 (General_options::no_keep_memory): Ditto.
8676 (General_options::Bshareable): Define.
8677 * options.cc (General_options::finalize): Honor -Bshareable.
8679 2009-01-20 Andreas Schwab <schwab@suse.de>
8681 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8682 read the value in the contents, since we don't use it. Use the
8683 template endianness when writing.
8684 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8686 2009-01-19 Andreas Schwab <schwab@suse.de>
8688 * configure.tgt (powerpc64-*): Fix targ_obj.
8690 2009-01-15 Ian Lance Taylor <iant@google.com>
8692 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8693 local symbols when stripping all symbols.
8695 2009-01-14 Cary Coutant <ccoutant@google.com>
8697 * output.cc (Output_reloc): Add explicit instantiations.
8699 2009-01-14 Cary Coutant <ccoutant@google.com>
8701 * archive.cc (Archive::get_elf_object_for_member): Remove call
8702 to File_read::claim_for_plugin.
8703 * descriptors.cc (Descriptors::open): Remove reference to
8705 (Descriptors::claim_for_plugin): Remove.
8706 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8707 (Descriptors::is_claimed): Remove.
8708 (claim_descriptor_for_plugin): Remove.
8709 * fileread.cc (File_read::claim_for_plugin): Remove.
8710 * fileread.h (File_read::claim_for_plugin): Remove.
8711 (File_read::descriptor): Reopen descriptor if necessary.
8712 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8713 (Plugin_manager::all_symbols_read): Add task parameter. Change
8715 (Plugin_manager::get_input_file): New function.
8716 (Plugin_manager::release_input_file): New function.
8717 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8718 corresponding data member.
8719 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8720 and pass to base constructor. Change all callers.
8721 (get_input_file, release_input_file): New functions.
8722 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8723 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8724 (Plugin_manager::all_symbols_read): Add task parameter.
8725 (Plugin_manager::get_input_file): New function.
8726 (Plugin_manager::release_input_file): New function.
8727 (Plugin_manager::task_): New data member.
8728 (Pluginobj::Pluginobj): Add filesize parameter.
8729 (Pluginobj::filename): New function.
8730 (Pluginobj::descriptor): New function.
8731 (Pluginobj::filesize): New function.
8732 (Pluginobj::filesize_): New data member.
8733 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8734 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8735 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8737 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8738 with archive libraries.
8739 * testsuite/Makefile.in: Regenerate.
8740 * testsuite/plugin_test.c (struct sym_info): New type.
8741 (get_input_file, release_input_file): New static variables.
8742 (onload): Capture new transfer vector entries.
8743 (claim_file_hook): Stop reading at end of file according to filesize.
8744 Factor out parsing of readelf output into separate function.
8745 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8746 APIs and get the source file name from the symbol table. Convert
8747 source file name to corresponding object file name. Print info
8748 message when adding new input files.
8749 (parse_readelf_line): New function.
8750 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8751 * testsuite/plugin_test_2.sh: Likewise.
8752 * testsuite/plugin_test_3.sh: Likewise.
8753 * testsuite/plugin_test_4.sh: New test case.
8755 2009-01-07 Ian Lance Taylor <iant@google.com>
8757 * version.cc (version_string): Bump to 1.8.
8759 2008-12-23 Cary Coutant <ccoutant@google.com>
8761 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8762 * plugin.cc (Plugin_manager::finish): Rename as
8763 layout_deferred_objects. Move cleanup to separate function.
8764 (Plugin_manager::cleanup): New function.
8765 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8767 * plugin.h (Plugin_manager::finish): Rename as
8768 layout_deferred_objects.
8769 (Plugin_manager::cleanup): New function.
8770 (Plugin_manager::cleanup_done): New field.
8772 2008-12-23 Cary Coutant <ccoutant@google.com>
8774 * plugin.cc (is_visible_from_outside): New function.
8775 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8776 so we don't return "IR only" status for exported symbols or -r links.
8778 * testsuite/Makefile.am (plugin_test_3): New test case.
8779 * testsuite/Makefile.in: Regenerate.
8780 * testsuite/plugin_test_3.sh: New file.
8782 2008-12-22 Cary Coutant <ccoutant@google.com>
8784 * object.cc (Sized_relobj::layout_section): New function.
8785 (Sized_relobj::do_layout): Defer layout of input sections until after
8786 plugin has provided replacement files.
8787 (Sized_relobj::do_layout_deferred_sections): New function.
8788 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8789 (Relobj::layout_deferred_sections): New function.
8790 (Relobj::do_layout_deferred_sections): New function.
8791 (Sized_relobj::do_layout_deferred_sections): New function.
8792 (Sized_relobj::layout_section): New function.
8793 (Sized_relobj::Deferred_layout): New structure.
8794 (Sized_relobj::deferred_layout_): New field.
8795 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8796 Change all callers. Layout deferred sections.
8797 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8799 (Plugin_hook::run): Move code from do_plugin_hook inline.
8800 (Plugin_hook::do_plugin_hook): Remove.
8801 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8802 (Plugin_manager::finish): Renamed, was cleanup.
8803 (Plugin_manager::should_defer_layout): New function.
8804 (Plugin_manager::add_deferred_layout_object): New function.
8805 (Plugin_manager::Deferred_layout_list): New type.
8806 (Plugin_manager::deferred_layout_objects_): New field.
8807 (Plugin_hook::do_plugin_hook): Remove.
8809 2008-12-17 Ian Lance Taylor <iant@google.com>
8811 * options.h (class General_options): Add --no case for
8814 2008-12-16 Cary Coutant <ccoutant@google.com>
8816 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8818 (Plugin_manager::claim_file): Create plugin object even if
8819 plugin did not call the add_symbols callback.
8820 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8821 asking for more symbols than were added.
8822 * testsuite/Makefile.am (plugin_test_1): Add test case with
8824 (empty.syms): New target.
8825 * testsuite/Makefile.in: Regenerate.
8826 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8827 message. Don't call add_symbols if no globals.
8828 (all_symbols_read_hook): Don't provide replacement for empty
8831 2008-12-12 Ian Lance Taylor <iant@google.com>
8833 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8834 r_type == 0 for a local symbol with r_sym == 0.
8835 (scan_relocatable_relocs): Pass r_sym to
8836 local_non_section_strategy.
8837 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8840 * configure.ac: Update test for TLS descriptors: they are
8841 supported as of glibc 2.9.
8842 * configure: Rebuild.
8844 2008-12-11 Ian Lance Taylor <iant@google.com>
8847 * target-reloc.h (Default_scan_relocatable_relocs): For each
8848 function, map r_type == 0 to RELOC_DISCARD.
8850 2008-12-10 Cary Coutant <ccoutant@google.com>
8852 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8853 object to override a kept COMDAT group from a plugin object.
8855 2008-12-09 Ian Lance Taylor <iant@google.com>
8858 * yyscript.y (file_cmd): Handle INPUT.
8860 * testsuite/initpri1.c: Change all declarations to be full
8861 prototypes by adding void, to avoid compiler warnings.
8863 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
8865 * options.cc (General_options::parse_plugin_opt): New.
8866 (General_options::add_plugin): The argument now is just the filename.
8867 (General_options::add_plugin_option): New.
8868 * options.h (plugin_opt): New.
8869 (add_plugin): Change argument name.
8870 (add_plugin_option): New.
8871 * plugin.cc (Plugin::load): Don't parse the plugin option.
8872 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8873 (Plugin::add_option): New.
8874 (Plugin::args_): Change type.
8875 (Plugin::filename_): New.
8876 (Plugin_manager::add_plugin_option): New.
8877 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8878 * testsuite/Makefile.in: Regenerate.
8880 2008-12-05 Cary Coutant <ccoutant@google.com>
8882 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8883 Handle --strip-lto-sections option.
8884 * options.h (strip_lto_sections): New option.
8886 2008-12-01 Cary Coutant <ccoutant@google.com>
8888 * plugin.cc (ld_plugin_message): Change format parameter to const.
8889 Fix mismatch between new[] and delete.
8891 2008-11-14 Cary Coutant <ccoutant@google.com>
8893 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8896 2008-11-05 Craig Silverstein <csilvers@google.com>
8898 * options.cc (General_options::parse_dynamic_list): New function.
8899 * options.h (General_options): New flags dynamic_list,
8900 dynamic_list_data, dynamic_list_cpp_new, and
8901 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8902 (General_options::in_dynamic_list): New function.
8903 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8904 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8905 (Lex::can_continue_name): Likewise.
8907 (read_script_file): New parameter script_options.
8908 (read_dynamic_list): New function.
8909 (Script_options::define_dynamic_list): New function.
8910 (dynamic_list_keyword_parsecodes): New variable.
8911 (dynamic_list_keywords): New variable.
8912 * script.h (Script_options::define_dynamic_list): New function
8914 (read_dynamic_list): New function prototype.
8915 * symtab.cc (strprefix): New macro.
8916 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8917 dynamic_list_data, dynamic_list_cpp_new, and
8918 dynamic_list_cpp_typeinfo.
8919 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8920 (dynamic_list_expr): New rule.
8921 (dynamic_list_nodes): Likewise.
8922 (dynamic_list_node): Likewise.
8923 * testsuite/Makefile.am (dynamic_list): New test.
8924 * testsuite/Makefile.in: Regenerated.
8925 * testsuite/dynamic_list.t: New file.
8926 * testsuite/dynamic_list.sh: New file.
8928 2008-11-05 Craig Silverstein <csilvers@google.com>
8930 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8931 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8932 (t11_last): Likewise.
8933 * testsuite/ver_test_6.c (main): Likewise.
8935 2008-10-07 Cary Coutant <ccoutant@google.com>
8937 * options.c (General_options::finalize): Add check for -static and
8939 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8942 2008-10-02 Cary Coutant <ccoutant@google.com>
8944 * plugin.cc (make_sized_plugin_object): Fix conditional
8945 compilation to work when not all targets are enabled.
8947 2008-09-29 Cary Coutant <ccoutant@google.com>
8949 * archive.cc (Archive::get_file_and_offset): Use filename instead
8950 of name to get library path.
8951 (Archive::include_member): Unlock external member of a thin archive.
8953 * testsuite/Makefile.am (TEST_AR): New variable.
8954 (thin_archive_test_1): New test.
8955 (thin_archive_test_2): New test.
8956 * testsuite/Makefile.in: Regenerate.
8957 * testsuite/thin_archive_main.cc: New file.
8958 * testsuite/thin_archive_test_1.cc: New file.
8959 * testsuite/thin_archive_test_2.cc: New file.
8960 * testsuite/thin_archive_test_3.cc: New file.
8961 * testsuite/thin_archive_test_4.cc: New file.
8963 2008-09-29 Cary Coutant <ccoutant@google.com>
8965 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8966 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8968 (Sized_relobj::do_finalize_local_symbols): Likewise.
8969 (Sized_relobj::map_to_kept_section): Likewise.
8970 * object.h (Sized_relobj::invalid_address): New constant.
8971 (Sized_relobj::do_output_section_offset): Check for invalid_address
8973 * output.cc (Output_reloc::local_section_offset): Use constant
8974 invalid_address instead of -1U.
8975 (Output_reloc::get_address): Likewise.
8976 (Output_section::output_address): Change -1U to -1ULL.
8977 * output.h (Output_reloc::invalid_address): New constant.
8978 * reloc.cc (Sized_relobj::write_sections): Use constant
8979 invalid_address instead of -1U.
8980 (Sized_relobj::relocate_sections): Likewise.
8981 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8982 values for merge sections.
8983 * target-reloc.h (relocate_for_relocatable): Use constant
8984 invalid_address instead of -1U.
8986 2008-09-19 Cary Coutant <ccoutant@google.com>
8988 Add plugin functionality for link-time optimization (LTO).
8989 * configure.ac (plugins): Add --enable-plugins option.
8990 * configure: Regenerate.
8991 * config.in: Regenerate.
8992 * Makefile.am (LIBDL): New variable.
8993 (CCFILES): Add plugin.cc.
8994 (HFILES): Add plugin.h.
8995 (ldadd_var): Add LIBDL.
8996 * Makefile.in: Regenerate.
8998 * archive.cc: Include "plugin.h".
8999 (Archive::setup): Don't preread archive symbols when using a plugin.
9000 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9001 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9003 (Archive::include_member): Add symbols from plugin objects.
9004 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9005 * descriptors.cc (Descriptors::open): Check for file descriptors
9006 abandoned by plugins.
9007 (Descriptors::claim_for_plugin): New function.
9008 * descriptors.h (Descriptors::claim_for_plugin): New function.
9009 (Open_descriptor::is_claimed): New field.
9010 (claim_descriptor_for_plugin): New function.
9011 * fileread.cc (File_read::claim_for_plugin): New function.
9012 * fileread.h (File_read::claim_for_plugin): New function.
9013 (File_read::descriptor): New function.
9014 * gold.cc: Include "plugin.h".
9015 (queue_initial_tasks): Add task to call plugin hooks for generating
9017 * main.cc: Include "plugin.h".
9018 (main): Load plugin libraries.
9019 * object.h (Pluginobj): Declare.
9020 (Object::pluginobj): New function.
9021 (Object::do_pluginobj): New function.
9022 (Object::set_target): New function.
9023 * options.cc: Include "plugin.h".
9024 (General_options::parse_plugin): New function.
9025 (General_options::General_options): Initialize plugins_ field.
9026 (General_options::add_plugin): New function.
9027 * options.h (Plugin_manager): Declare.
9028 (General_options): Add --plugin option.
9029 (General_options::has_plugins): New function.
9030 (General_options::plugins): New function.
9031 (General_options::add_plugin): New function.
9032 (General_options::plugins_): New field.
9033 * plugin.cc: New file.
9034 * plugin.h: New file.
9035 * readsyms.cc: Include "plugin.h".
9036 (Read_symbols::do_read_symbols): Check for archive before checking
9037 for ELF file. Call plugin hooks to claim files.
9038 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9039 from a real object file; force override when processing replacement
9041 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9042 (Symbol::init_base_object): Likewise.
9043 (Symbol::init_base_output_data): Likewise.
9044 (Symbol::init_base_output_segment): Likewise.
9045 (Symbol::init_base_constant): Likewise.
9046 (Symbol::init_base_undefined): Likewise.
9047 (Symbol::output_section): Assert that object is not a plugin.
9048 (Symbol_table::add_from_pluginobj): New function.
9049 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9051 (Symbol_table::sized_write_globals): Likewise.
9052 (Symbol_table::add_from_pluginobj): Instantiate template.
9053 * symtab.h (Sized_pluginobj): Declare.
9054 (Symbol::in_real_elf): New function.
9055 (Symbol::set_in_real_elf): New function.
9056 (Symbol::in_real_elf_): New field.
9057 (Symbol_table::add_from_pluginobj): New function.
9059 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9060 (LIBDL): New variable.
9062 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9063 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9064 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9065 (MOSTLYCLEANFILES): Likewise.
9066 * testsuite/Makefile.in: Regenerate.
9067 * testsuite/plugin_test.c: New file.
9068 * testsuite/plugin_test_1.sh: New file.
9069 * testsuite/plugin_test_2.sh: New file.
9071 2008-09-16 Ian Lance Taylor <iant@google.com>
9073 * target-reloc.h (relocate_section): Check whether a symbol is
9074 defined by the ABI before reporting an undefined symbol error.
9075 * target.h (Target::is_defined_by_abi): Make parameter const.
9076 (Target::do_is_defined_by_abi): Likewise.
9077 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9078 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9079 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9080 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9081 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9082 * testsuite/Makefile.in: Rebuild.
9084 * fileread.cc (make_view): Add casts to avoid warning.
9086 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9088 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9089 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9091 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9093 * options.h (General_options::output_is_executable): New.
9094 (General_options::output_is_pie): New.
9095 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9096 for shared libraries.
9097 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9099 2008-09-11 Chris Demetriou <cgd@google.com>
9101 * options.h (origin): New -z option.
9102 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9103 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9106 2008-09-05 Cary Coutant <ccoutant@google.com>
9108 * fileread.cc (File_read::make_view): Add check for attempt to map
9111 2008-09-05 Cary Coutant <ccoutant@google.com>
9113 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9114 explicit instantiations.
9116 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9119 * options.cc (General_options::finalize): Allow undefined symbols
9120 in shlibs if linking -shared.
9123 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9124 symbols as not needing a dynsym entry.
9126 2008-08-20 Craig Silverstein <csilvers@google.com>
9128 * fileread.cc (File_read::open): Do not lock the file unless it
9129 was successfully opened.
9131 2008-08-14 Cary Coutant <ccoutant@google.com>
9133 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9134 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9135 * testsuite/tls_test.cc (struct int128): 128-bit struct
9136 for testing TLS relocs with non-zero addend.
9137 (v12): New TLS variable.
9139 (t_last): Add check for v12.
9140 * testsuite/tls_test.h (t12): New function.
9141 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9143 2008-08-13 Ian Lance Taylor <iant@google.com>
9145 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9146 set tls_segment_ or relro_segment_.
9147 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9149 * output.h (Output_section::clear_is_relro): New function.
9150 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9151 sections specially even when output_data_ is empty.
9152 (Output_segment::maximum_alignment): When first section is relro,
9153 only force alignment for PT_LOAD segments.
9154 * script.cc (script_data_segment_align): New function.
9155 (script_data_segment_relro_end): New function.
9156 * script-c.h (script_data_segment_align): Declare.
9157 (script_data_segment_relro_end): Declare.
9158 * script-sections.h (class Script_sections): Declare
9159 data_segment_align and data_segment_relro_end. Add fields
9160 segment_align_index_ and saw_relro_end_.
9161 * script-sections.cc (class Sections_element): Add set_is_relro
9162 virtual function. Add new bool* parameter to place_orphan_here.
9163 Add get_output_section virtual function.
9164 (class Output_section_definition): Add set_is_relro. Add new
9165 bool* parameter to place_orphan_here. Add get_output_section.
9166 Add is_relro_ field.
9167 (Output_section_definition::Output_section_definition): Initialize
9168 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9169 and is_relro_ fields.
9170 (Output_section_definition::place_orphan_here): Add is_relro
9172 (Output_section_definition::set_section_addresses): Set relro for
9174 (Output_section_definition::alternate_constraint): Likewise.
9175 (class Orphan_output_section): Add new bool* parameter to
9176 place_orphan_here. Add get_output_section.
9177 (Orphan_output_section::place_orphan_here): Add is_relro
9179 (Script_sections::Script_sections): Initialize
9180 data_segment_align_index_ and saw_relro_end_.
9181 (Script_sections::data_segment_align): New function.
9182 (Script_sections::data_segment_relro_end): New function.
9183 (Script_sections::place_orphan): Set or clear is_relro.
9184 (Script_sections::set_section_addresses): Force alignment of first
9186 * yyscript.y (exp): Call script_data_segment_align and
9187 script_data_segment_relro_end.
9188 * testsuite/relro_script_test.t: New file.
9189 * testsuite/relro_test.cc (using_script): Declare.
9190 (t1, t2): Test using_script.
9191 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9192 (relro_script_test_SOURCES): Define.
9193 (relro_script_test_DEPENDENCIES): Define.
9194 (relro_script_test_LDFLAGS): Define.
9195 (relro_script_test_LDADD): Define.
9196 (relro_script_test.so): New target.
9197 * testsuite/Makefile.in: Rebuild.
9199 2008-08-06 Cary Coutant <ccoutant@google.com>
9201 * archive.cc (Archive::total_archives, Archive::total_members)
9202 (Archive::total_members_loaded): New variables.
9203 (Archive::setup): Add parameter. Add option to preread
9205 (Archive::read_armap): Add counter.
9206 (Archive::get_file_and_offset): New function.
9207 (Archive::get_elf_object_for_member): New function.
9208 (Archive::read_all_symbols): New function.
9209 (Archive::read_symbols): New function.
9210 (Archive::add_symbols): Add counters.
9211 (Archive::include_all_members): Use armap to find members if it's
9213 (Archive::include_member): Skip reading symbols if already read.
9214 Factored code into Archive::get_file_and_offset and
9215 Archive::get_elf_object_for_member. Changed call to
9216 Mapfile::report_include_archive_member.
9217 (Archive::print_stats): New function.
9218 * archive.h: Declare Object and Read_symbols_data classes.
9219 (Archive::Archive): Add initializers for new members.
9220 (Archive::setup): Add parameter.
9221 (Archive::print_stats): New function.
9222 (Archive::total_archives, Archive::total_members)
9223 (Archive::total_members_loaded): New variables.
9224 (Archive::get_file_and_offset): New function.
9225 (Archive::get_elf_object_for_member): New function.
9226 (Archive::read_all_symbols): New function.
9227 (Archive::read_symbols): New function.
9228 (Archive::Archive_member): New class.
9229 (Archive::members_): New member.
9230 (Archive::num_members_): New member.
9231 * main.cc: Include archive.h.
9232 (main): Call Archive::print_stats.
9233 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9234 archive parameter; member_name is now the fully-decorated name.
9235 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9236 * options.h: (General_options): Add --preread-archive-symbols option.
9237 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9240 2008-08-04 Ian Lance Taylor <iant@google.com>
9242 * symtab.h (Symbol::use_plt_offset): New function.
9243 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9244 * powerpc.cc (Relocate::relocate): Likewise.
9245 * sparc.cc (Relocate::relocate): Likewise.
9246 * x86_64.cc (Relocate::relocate): Likewise.
9247 * testsuite/weak_plt.sh: New test.
9248 * testsuite/weak_plt_main.cc: New test.
9249 * testsuite/weak_plt_shared.cc: New test.
9250 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9251 (check_PROGRAMS): Add weak_plt.
9252 (check_DATA): Add weak_plt_shared.so.
9253 (weak_plt_main_pic.o, weak_plt): New targets.
9254 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9255 * testsuite/Makefile.in: Rebuild.
9257 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9259 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9260 * testsuite/Makefile.in: Rebuild.
9262 2008-08-04 Alan Modra <amodra@bigpond.net.au>
9264 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9265 * Makefile.in: Regenerate.
9266 * po/POTFILES.in: Regenerate.
9268 2008-07-29 Ian Lance Taylor <iant@google.com>
9270 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9271 symbols before other symbols.
9272 * testsuite/script_test_2.cc (test_addr): Declare.
9273 (test_addr_alias): Declare.
9274 (main): Check that test_addr and test_addr_alias have the right
9276 * testsuite/script_test_2.t: Define test_addr_alias and
9279 2008-07-24 Ian Lance Taylor <iant@google.com>
9282 * descriptors.cc: New file.
9283 * descriptors.h: New file.
9284 * gold-threads.h (class Hold_optional_lock): New class.
9285 * fileread.cc: Include "descriptors.h".
9286 (File_read::~File_read): Release descriptor rather than closing
9288 (File_read::open) [file]: Call open_descriptor rather than open.
9289 Set is_descriptor_opened_.
9290 (File_read::open) [memory]: Assert that descriptor is not open.
9291 (File_read::reopen_descriptor): New function.
9292 (File_read::release): Release descriptor.
9293 (File_read::do_read): Make non-const. Reopen descriptor.
9294 (File_read::read): Make non-const.
9295 (File_read::make_view): Reopen descriptor.
9296 (File_read::do_readv): Likewise.
9297 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9298 Update declarations.
9299 * layout.cc: Include "descriptors.h".
9300 (Layout::create_build_id): Use open_descriptor rather than open.
9301 * output.cc: Include "descriptors.h".
9302 (Output_file::open): Use open_descriptor rather than open.
9303 * archive.cc (Archive::const_iterator): Change Archive to be
9305 (Archive::begin, Archive::end): Make non-const.
9306 (Archive::count_members): Likewise.
9307 * archive.h (class Archive): Update declarations.
9308 * object.h (Object::read): Make non-const.
9309 * Makefile.am (CCFILES): Add descriptors.cc.
9310 (HFILES): Add descriptors.h.
9311 * Makefile.in: Rebuild.
9314 * gold.h: Always include <clocale>. Add Solaris workarounds
9315 following code in binutils/sysdep.h.
9318 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9319 this->eh_frame_hdr_ is NULL before using it.
9321 * dynobj.cc (Versions::Versions): Update comment.
9323 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9324 the base version name.
9326 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9327 array size plus one.
9328 (Stringpool_template::set_string_offsets): Subtract one from key
9329 before using it as an array index.
9330 (Stringpool_template::get_offset_with_length): Likewise.
9331 (Stringpool_template::write_to_buffer): Likewise.
9332 * stringpool.h (Stringpool_template::get_offset_from_key):
9335 2008-07-23 Ian Lance Taylor <iant@google.com>
9338 * object.h (Merged_symbol_value::value): Do our best to handle a
9342 * script.cc (Version_script_info::get_versions): Don't add empty
9343 version tag to return value.
9344 (Version_script_info::get_symbol_version_helper): Change return
9345 type to bool. Add pversion parameter. Change all callers.
9346 (script_register_vers_node): Don't require a non-NULL tag.
9347 * script.h (class Version_script_info): Update declarations.
9348 (Version_script_info::get_symbol_version): Change return type to
9349 bool. Add version parameter. Change all callers.
9350 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9351 handling. Handle an empty version from a version script.
9352 (Symbol_table::define_special_symbol): Likewise.
9353 * testsuite/ver_test_10.script: New file.
9354 * testsuite/ver_test_10.sh: New file.
9355 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9356 (check_DATA): Add ver_test_10.syms.
9357 (ver_test_10.syms, ver_test_10.so): New target.
9358 * testsuite/Makefile.in: Rebuild.
9360 2008-07-23 Simon Baldwin <simonb@google.com>
9362 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9363 to zero for undefined symbols from dynamic libraries.
9365 2008-07-23 Ian Lance Taylor <iant@google.com>
9367 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9369 * symtab.h (class Symbol_table): Update declaration.
9370 * testsuite/ver_test_9.cc: New file.
9371 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9372 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9373 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9374 (ver_test_9.so, ver_test_9.o): New targets.
9375 * testsuite/Makefile.in: Rebuild.
9377 2008-07-22 Ian Lance Taylor <iant@google.com>
9379 * options.h (class General_options): Define --check-sections.
9380 * layout.cc (Layout::set_segment_offsets): Handle
9383 * options.h (class General_options): Define -n/--nmagic and
9385 * options.cc (General_options::finalize): For -n/--nmagic or
9386 -N/--omagic, set -static.
9387 * layout.cc (Layout::attach_allocated_section_to_segment): If
9388 -N/--omagic, don't put read-only and read-write sections in
9390 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9391 finding a read-only segment.
9392 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9393 don't set the minimum segment alignment to the common page size,
9394 and don't set the file offset to the address modulo the page size.
9395 * script-sections.cc (Script_sections::create_segments): If
9396 -n/--omagic, don't put read-only and read-write sections in
9399 * cref.cc: New file.
9401 * options.h (class General_options): Add --print-symbol-counts.
9402 * main.cc (main): Issue defined symbol report if requested.
9403 * archive.cc (Archive::interpret_header): Make into a const member
9405 (Archive::add_symbols): Call Input_objects::archive_start and
9407 (Archive::const_iterator): Define new class.
9408 (Archive::begin, Archive::end): New functions.
9409 (Archive::include_all_members): Rewrite to use iterator.
9410 (Archive::count_members): New function.
9411 * archive.h (class Archive): Update declarations.
9412 (Archive::filename): New function.
9413 * object.cc: Include "cref.h".
9414 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9415 (Sized_relobj::do_get_global_symbol_counts): New function.
9416 (Input_objects::add_object): Add object to cross-referencer.
9417 (Input_objects::archive_start): New function.
9418 (Input_objects::archive_stop): New function.
9419 (Input_objects::print_symbol_counts): New function.
9420 * object.h: Declare Cref and Archive.
9421 (Object::get_global_symbol_counts): New function.
9422 (Object::do_get_global_symbol_counts): New pure virtual function.
9423 (class Sized_relobj): Add defined_count_ field. Update
9425 (class Input_objects): Add cref_ field. Update constructor.
9426 Update declarations.
9427 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9429 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9431 (Sized_dynobj::do_get_global_symbol_counts): New function.
9432 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9433 defined_count_. Update declarations. Define Symbols typedef.
9434 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9435 parameter. Change all callers.
9436 (Symbol_table::add_from_dynobj): Add sympointers and defined
9437 parameters. Change all callers.
9438 * symtab.h (class Symbol_table): Update declarations.
9439 * Makefile.am (CCFILES): Add cref.cc.
9440 (HFILES): Add cref.h.
9441 * Makefile.in: Rebuild.
9443 2008-07-22 Simon Baldwin <simonb@google.com>
9445 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9446 to zero when writing undefined symbols.
9448 2008-07-22 Ian Lance Taylor <iant@google.com>
9450 * output.cc (Output_section::add_input_section): Don't try to
9451 merge empty merge sections.
9453 2008-07-21 Craig Silverstein <csilvers@google.com>
9455 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9456 Include symbol version in error message.
9458 2008-07-20 Chris Demetriou <cgd@google.com>
9460 * configure.ac (gold_cv_c_random_seed): New configured variable.
9461 (RANDOM_SEED_CFLAGS): New substituted variable.
9462 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9463 * configure: Rebuild.
9464 * Makefile.in: Likewise.
9465 * testsuite/Makefile.in: Likewise.
9467 2008-07-18 Ian Lance Taylor <iant@google.com>
9469 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9470 where we see NAME/NULL and NAME/VERSION as separate symbols.
9471 * testsuite/ver_test_main.cc (main): Call t4.
9472 (t4, t4_2a): Define.
9473 * testsuite/ver_test_2.cc (t4_2): Define.
9474 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9475 * testsuite/ver_test_4.cc (t4_2a): Define.
9476 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9477 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9479 2008-07-17 Ian Lance Taylor <iant@google.com>
9481 * dynobj.cc (Versions::add_def): If we give an error about a
9482 missing version, go ahead and create the version anyhow.
9484 2008-07-10 Ian Lance Taylor <iant@google.com>
9486 Handle output sections with more than 0x7fffffff bytes.
9487 * object.h (class Relobj): Change map_to_output_ to
9488 output_sections_, and just keep a section pointer. Change all
9489 uses. Move comdat group support to Sized_relobj.
9490 (Relobj::is_section_specially_mapped): Remove.
9491 (Relobj::output_section): Remove poff parameter. Change all
9493 (Relobj::output_section_offset): New function.
9494 (Relobj::set_section_offset): Rewrite.
9495 (Relobj::map_to_output): Remove.
9496 (Relobj::output_sections): New function.
9497 (Relobj::do_output_section_offset): New pure virtual function.
9498 (Relobj::do_set_section_offset): Likewise.
9499 (class Sized_relobj): Add section_offsets_ field. Add comdat
9500 group support from Relobj. Update declarations.
9501 (Sized_relobj::get_output_section_offset): New function.
9502 (Sized_relobj::do_output_section_offset): New function.
9503 (Sized_relobj::do_set_section_offset): New function.
9504 * object.cc (Relobj::output_section_address): Remove.
9505 (Sized_relobj::Sized_relobj): Initialize new fields.
9506 (Sized_relobj::include_section_group): Cast find_kept_object to
9508 (Sized_relobj::include_linkonce_section): Likewise.
9509 (Sized_relobj::do_layout): Use separate arrays for output section
9511 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9513 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9514 output_sections and section_offsets.
9515 (Sized_relobj::write_local_symbols): Likewise.
9516 (map_to_kept_section): Compute output address directly.
9517 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9518 output_sections and section_offsets.
9519 (Sized_relobj::write_sections): Likewise.
9520 (Sized_relobj::relocate_sections): Likewise.
9521 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9522 * output.h (class Output_reloc): Update declarations. Change
9523 u2_.relobj to Sized_relobj*.
9524 (class Output_data_reloc): Change add functions to use
9526 * output.cc (Output_reloc::Output_reloc): Change relobj to
9528 (Output_reloc::local_section_offset): Change return type to
9529 Elf_Addr. Use get_output_section_offset.
9530 (Output_reloc::get_address): Likewise.
9531 (Output_section::is_input_address_mapped): Don't call
9532 is_section_specially_mapped.
9533 (Output_section::output_offset): Likewise.
9534 (Output_section::output_address): Likewise.
9535 (Output_section::starting_output_address): Likewise.
9536 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9537 parameter to Sized_relobj*.
9538 (Copy_relocs::need_copy_reloc): Likewise.
9539 (Copy_relocs::save): Likewise.
9540 * copy-relocs.h (class Copy_relocs): Update declarations.
9541 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9542 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9543 * target-reloc.h (relocate_for_relocatable): Change
9544 offset_in_output_section type to Elf_Addr. Change code that uses
9546 * layout.cc (Layout::layout): Always set *off.
9547 * mapfile.cc (Mapfile::print_input_section): Use
9548 output_section_offset.
9549 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9551 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9552 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9553 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9555 2008-07-03 Ian Lance Taylor <iant@google.com>
9557 * layout.cc (Layout::include_section): Do not discard unrecognized
9558 SHT_STRTAB sections.
9560 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9562 * script.cc (Lex::can_continue_name): Make '?' allowable in
9563 version-script names.
9564 * testsuite/version_script.map: Change glob pattern to use '?'
9566 2008-06-30 Manish Singh <yosh@gimp.org>
9569 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9572 2008-06-30 Ian Lance Taylor <iant@google.com>
9576 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9577 versions]: Don't try to read the value in the contents, since we
9578 don't use it. Use the template endianness when writing.
9580 2008-06-25 Cary Coutant <ccoutant@google.com>
9582 * fileread.cc (File_read::make_view): Assert on zero-length view.
9583 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9584 symbol table when there are no symbols to read.
9586 2008-06-23 Craig Silverstein <csilvers@google.com>
9588 * version.cc (version_string): Bump to 1.7
9590 2008-06-18 Craig Silverstein <csilvers@google.com>
9592 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9593 constant 0xFFFF to type Valtype.
9594 (Powerpc_relocate_functions::rel16_ha): Likewise.
9596 2008-06-17 Ian Lance Taylor <iant@google.com>
9598 * output.h (Output_section::Input_section): Initialize p2align_ to
9599 zero for Output_section_data constructors.
9600 (Output_section::Input_section::addralign): If not an input
9601 section, return the alignment of the Output_section_data.
9602 * testsuite/copy_test.cc: New file.
9603 * testsuite/copy_test_1.cc: New file.
9604 * testsuite/copy_test_2.cc: New file.
9605 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9606 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9607 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9608 (copy_test_1_pic.o, copy_test_1.so): New targets.
9609 (copy_test_2_pic.o, copy_test_2.so): New targets.
9610 * testsuite/Makefile.in: Rebuild.
9612 * script-sections.cc (Script_sections::place_orphan): Initialize
9613 local variable exact.
9615 2008-06-13 David Edelsohn <edelsohn@gnu.org>
9617 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9619 2008-06-12 David Edelsohn <edelsohn@gnu.org>
9620 David S. Miller <davem@davemloft.net>
9622 * powerpc.cc: New file.
9623 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9624 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9625 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9626 * Makefile.in: Rebuild.
9628 2008-06-09 Ian Lance Taylor <iant@google.com>
9630 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9632 (throwing, orig_terminate): New static variables.
9633 (terminate_handler): New static function.
9634 (t2): Set terminate handler.
9636 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
9639 * binary.cc (Binary_to_elf::sized_convert): Fix .data
9642 2008-05-30 Cary Coutant <ccoutant@google.com>
9644 * archive.cc (Archive::include_all_members) Correct to step
9645 over symbol table and extended name table in thin archives.
9647 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
9650 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9653 2008-05-28 Caleb Howe <cshowe@google.com>
9655 * reduced_debug_output.cc: New file.
9656 * reduced_debug_output.h: New file.
9657 * options.h (class General_options): Add --strip-debug-non-line.
9658 * options.cc (General_options::finalize): Add strip_debug_non_line
9659 to the strip heirarchy.
9660 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9662 * layout.cc: Include "reduced_debug_output.h".
9663 (Layout::Layout): Initialize new fields.
9664 (line_only_debug_sections): New static array.
9665 (is_lines_only_debug_sections): New static inline function.
9666 (Layout::include_section): Handle --strip-debug-non-line.
9667 (Layout::make_output_section): If --strip-debug-non-line, build
9668 new output sections for .debug_abbrev and .debug_info.
9669 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9670 gold. Warn about possible overflow.
9671 (read_signed_LEB_128): Likewise.
9672 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9673 (read_signed_LEB_128): Declare.
9674 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9675 (HFILES): Add reduced_debug_output.h.
9676 * Makefile.in: Rebuild.
9678 2008-05-21 Ian Lance Taylor <iant@google.com>
9680 * mapfile.cc: New file.
9681 * mapfile.h: New file.
9682 * options.h (class General_options): Add -M/--print-map and -Map.
9683 * options.cc (General_options::finalize): Make -M equivalent to
9685 * main.cc: Include <cstdio> and "mapfile.h".
9686 (main): Open mapfile if requested.
9687 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9688 constructor. Change caller.
9689 (queue_initial_tasks): Add mapfile parameter. Change caller.
9690 (queue_middle_tasks): Likewise.
9691 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9693 * archive.cc: Include "mapfile.h".
9694 (Archive::add_symbols): Add mapfile parameter. Change all
9695 callers. Pass mapfile, symbol, and reason to include_member.
9696 (Archive::include_all_members): Add mapfile parameter. Change all
9698 (Archive::include_member): Add mapfile, sym, and why parameters.
9699 Change all callers. Report inclusion to map file.
9700 * archive.h: Include "fileread.h".
9701 (class Archive): Update declarations.
9702 (Archive::file): New const method.
9703 (class Add_archive_symbols): Add mapfile_ field. Update
9704 constructor. Change all callers.
9705 * readsyms.h (class Read_symbols): Likewise.
9706 (class Finish_group): Likewise.
9707 (class Read_script): Likewise.
9708 * common.cc: Include "mapfile.h".
9709 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9711 (Symbol_table::do_allocate_commons): Likewise.
9712 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9713 symbol allocation to mapfile.
9714 * common.h (class Allocate_commons_task): Add mapfile_ field.
9715 Update constructor. Change all callers.
9716 * symtab.h (class Symbol_table): Update declarations.
9717 * layout.cc: Include "mapfile.h".
9718 (Layout_task_runner::run): Print information to mapfile.
9719 (Layout::create_gold_note): Change Output_data_fixed_space to
9720 Output_data_zero_fill.
9721 (Layout::create_build_id): Likewise.
9722 (Layout::print_to_mapfile): New function.
9723 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9724 constructor. Change caller.
9725 (class Layout): Declare print_to_mapfile.
9726 * output.cc (Output_section::Input_section::print_to_mapfile): New
9728 (Output_section::add_input_section): If producing a map, always
9729 add to input_sections_ list.
9730 (Output_section::do_print_to_mapfile): New function.
9731 (Output_segment::print_sections_to_mapfile): New function.
9732 (Output_segment::print_section_list_to_mapfile): New function.
9733 * output.h: Include "mapfile.h".
9734 (Output_data::print_to_mapfile): New function.
9735 (Output_data::do_print_to_mapfile): New virtual function.
9736 (Output_segment_headers::do_print_to_mapfile): New function.
9737 (Output_file_header::do_print_to_mapfile): New function.
9738 (Output_data_const::do_print_to_mapfile): New function.
9739 (class Output_data_const_buffer): Add map_name_ field. Update
9740 constructor. Change all callers. Add do_print_to_mapfile
9742 (class Output_data_fixed_space): Likewise.
9743 (class Output_data_space): Likewise.
9744 (class Output_data_zero_fill): New class.
9745 (Output_data_strtab::do_print_to_mapfile): New function.
9746 (Output_data_reloc_base::do_print_to_mapfile): New function.
9747 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9748 (Output_data_group::do_print_to_mapfile): New function.
9749 (Output_data_got::do_print_to_mapfile): New function.
9750 (Output_data_dynamic::do_print_to_mapfile): New function.
9751 (Output_symtab_xindex::do_print_to_mapfile): New function.
9752 (class Output_section): Declare do_print_to_mapflie. Declare
9753 print_to_mapfile in Input_section.
9754 (class Output_segment): Declare new functions.
9755 * object.h (Sized_relobj::symbol_count): New function.
9756 * script-sections.cc
9757 (Output_section_element_dot_assignment::set_section_addresses):
9758 Change Output_data_fixed_space to Output_data_zero_fill.
9759 (Output_data_expression::do_print_to_mapfile): New function.
9760 * script.cc (read_input_script): Add mapfile parameter. Change
9762 * script.h (read_input_script): Update declaration.
9763 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9764 (Eh_frame::do_print_to_mapfile): New function.
9765 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9766 (Output_merge_string::do_print_to_mapfile): New function.
9767 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9769 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9771 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9773 * Makefile.am (CCFILES): Add mapfile.cc.
9774 (HFILES): Add mapfile.h.
9775 * Makefile.in: Rebuild.
9777 2008-05-19 Ian Lance Taylor <iant@google.com>
9779 * options.h (class General_options): Add -z relro.
9780 * layout.cc (Layout::Layout): Initialize relro_segment_.
9781 (Layout::add_output_section_data): Return the output section.
9782 (Layout::make_output_section): Rcognize relro sections and mark
9784 (Layout::attach_allocated_section_to_segment): Put relro sections
9785 in a PT_GNU_RELRO segment.
9786 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9788 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9790 (Layout::linkonce_mapping): Map d.rel.ro.local to
9792 (Layout::output_section_name): Us .data.rel.ro.local for any
9793 section which begins with that.
9794 * layout.h (class Layout): Update add_output_section_data
9795 declaration. Add relro_segment_ field.
9796 * output.cc (Output_section::Output_section): Initialize is_relro_
9797 and is_relro_local_ fields.
9798 (Output_segment::add_output_section): Group relro sections.
9799 (Output_segment::is_first_section_relro): New function.
9800 (Output_segment::maximum_alignment): If there is a relro section,
9801 align the segment to the common page size.
9802 (Output_segment::set_section_addresses): Track whether we are
9803 looking at relro sections. If the last section is a relro
9804 section, align to the common page size.
9805 (Output_segment::set_section_list_addresses): Add in_relro
9806 parameter. Change all callers. Align to the page size when
9807 moving from relro to non-relro section.
9808 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9810 * output.h (class Output_section): Add is_relro_ and
9811 is_relro_local_ fields.
9812 (Output_section::is_relro): New function.
9813 (Output_section::set_is_relro): New function.
9814 (Output_section::is_relro_local): New function.
9815 (Output_section::set_is_relro_local): New function.
9816 (class Output_segment): Update declarations.
9817 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9818 * sparc.cc (Target_sparc::got_section): Likewise.
9819 * x86_64.cc (Target_x86_64::got_section): Likewise.
9820 * testsuite/relro_test_main.cc: New file.
9821 * testsuite/relro_test.cc: New file.
9822 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9823 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9824 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9825 (relro_test.so, relro_test_pic.o): New targets.
9826 * testsuite/Makefile.in: Rebuild.
9828 2008-05-16 Ian Lance Taylor <iant@google.com>
9830 * output.cc (Output_segment::add_output_section): Remove front
9832 * output.h (class Output_segment): Remove
9833 add_initial_output_section and overloaded add_output_section.
9834 Update declaration of remaining add_output_section.
9835 * layout.cc (Layout::create_interp): Call add_output_section
9836 rather than add_initial_output_section.
9837 (Layout::finish_dynamic_section): Likewise.
9839 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9840 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9841 know the dynamic type.
9842 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9843 field. Initialize it in constructor.
9844 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9845 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9846 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9849 * output.cc (Output_reloc::get_address): Change return type to
9851 * output.h (class Output_reloc): Update get_address declaration.
9852 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9853 for section addresses.
9855 2008-05-09 Ian Lance Taylor <iant@google.com>
9858 * gold.cc (gold_nomem): Use return value of write.
9860 2008-05-08 Ian Lance Taylor <iant@google.com>
9862 * symtab.c (Symbol::init_base_output_data): Add version
9863 parameter. Change all callers.
9864 (Symbol::init_base_output_segment): Likewise.
9865 (Symbol::init_base_constant): Likewise.
9866 (Symbol::init_base_undefined): Likewise.
9867 (Sized_symbol::init_output_data): Likewise.
9868 (Sized_symbol::init_output_segment): Likewise.
9869 (Sized_symbol::init_constant): Likewise.
9870 (Sized_symbol::init_undefined): Likewise.
9871 (Symbol_table::do_define_in_output_data): If the new symbol has a
9872 version, mark it as the default.
9873 (Symbol_table::do_define_in_output_segment): Likewise.
9874 (Symbol_table::do_define_as_constant): Likewise.
9875 * symtab.h (class Symbol): Update declarations.
9876 (class Sized_symbol): Likewise.
9877 * resolve.cc (Symbol::override_version): New function.
9878 (Symbol::override_base): Call override_version.
9879 (Symbol::override_base_with_special): Likewise.
9880 * testsuite/ver_script_8.script: New file.
9881 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9882 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9883 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9884 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9886 2008-05-06 Ian Lance Taylor <iant@google.com>
9889 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9891 (class General_options): Remove existing --undefined, and add
9892 --no-undefined instead. Add new --undefined as synonym for -u.
9893 * archive.cc (Archive::add_symbols): Check whether symbol was
9895 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9896 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9897 all uses. Add IS_UNDEFINED. Update declarations to split
9898 different versions of init_base. Declare init_base_undefined.
9899 (Symbol::is_defined): Handle IS_UNDEFINED.
9900 (Symbol::is_undefined): Likewise.
9901 (Symbol::is_weak_undefined): Call is_undefined.
9902 (Symbol::is_absolute): Handle IS_CONSTANT.
9903 (class Sized_symbol): Update declarations to split different
9904 versions of init. Declare init_undefined.
9905 (class Symbol_table): Declare new functions.
9906 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9908 (Symbol::init_base_output_data): Likewise.
9909 (Symbol::init_base_output_segment): Likewise.
9910 (Symbol::init_base_constant): Likewise.
9911 (Symbol::init_base_undefined): New function.
9912 (Sized_symbol::init_object): Rename from init. Change all
9914 (Sized_symbol::init_output_data): Likewise.
9915 (Sized_symbol::init_output_segment): Likewise.
9916 (Sized_symbol::init_constant): Likewise.
9917 (Sized_symbol::init_undefined): New function.
9918 (Symbol_table::add_undefined_symbols_from_command_line): New
9920 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9922 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9923 (Symbol::output_section): Likewise.
9924 (Symbol::set_output_section): Likewise.
9925 (Symbol_table::sized_finalize_symbol): Likewise.
9926 (Symbol_table::sized_write_globals): Likewise.
9927 * resolve.cc (Symbol_table::should_override): Likewise.
9928 (Symbol::override_base_with_special): Likewise.
9930 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9931 symbol, change it to have default visibility.
9932 * testsuite/protected_1.cc: New file.
9933 * testsuite/protected_2.cc: New file.
9934 * testsuite/protected_3.cc: New file.
9935 * testsuite/protected_main_1.cc: New file.
9936 * testsuite/protected_main_2.cc: New file.
9937 * testsuite/protected_main_3.cc: New file.
9938 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9939 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9940 (protected_1_LDFLAGS, protected_1_LDADD): Define.
9941 (protected_1.so): New target.
9942 (protected_1_pic.o, protected_2_pic.o): New targets.
9943 (protected_3_pic.o): New target.
9944 (check_PROGRAMS): Add protected_2.
9945 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9946 (protected_2_LDFLAGS, protected_2_LDADD): Define.
9947 * testsuite/Makefile.in: Rebuild.
9949 * options.h (DEFINE_var): Add set_user_set_##varname__.
9950 (DEFINE_bool_alias): New macro.
9951 (class General_options): Define -Bstatic using DEFINE_bool_alias
9952 rather than DEFINE_special. Add --undefined as an alias for -z
9954 * options.cc (General_options::parse_Bstatic): Remove.
9956 * options.h (class General_options): Add --fatal-warnings.
9957 * main.cc (main): Implement --fatal-warnings.
9958 * errors.h (Errors::warning_count): New function.
9960 * options.h (class General_options): Add -Bsymbolic-functions.
9961 * symtab.h (Symbol::is_preemptible): Check for
9962 -Bsymbolic-functions.
9964 2008-05-05 Ian Lance Taylor <iant@google.com>
9966 * options.h (DEFINE_bool): For DASH_Z, create the negative option
9967 as noVARNAME rather than no-VARNAME.
9968 (class General_options): Add option -z combreloc.
9969 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9971 (Output_reloc::sort_before) [SHT_REL]: New function.
9972 (Output_reloc::sort_before) [SHT_RELA]: New function.
9973 (class Output_data_reloc_base): Add sort_relocs_ field. Define
9974 Sort_relocs_comparison.
9975 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9976 parameter. Change all callers.
9977 (Output_data_reloc::Output_data_reloc) [both versions]: Add
9978 sort_relocs parameter. Change all callers.
9979 * output.cc (Output_reloc::get_address): New function, broken out
9981 (Output_reloc::write_rel): Call it.
9982 (Output_reloc::compare): New function.
9983 (Output_data_reloc_base::do_write): Optionally sort relocs.
9985 * configure.ac: If targ_extra_obj is set, link it in.
9986 * configure.tgt: Initialize all variables.
9987 (x86_64*): Set targ_extra_obj and targ_extra_size.
9988 * configure: Rebuild.
9990 * object.cc (Sized_relobj::include_section_group): Adjust section
9991 indexes read from group data. Build vector to pass to
9993 * layout.cc (Layout::layout_group): Add flags and shndxes
9994 parameters. Remove contents parameter. Change caller. Update
9995 explicit instantiations.
9996 * layout.h (class Layout): Update layout_group declaration.
9997 * output.cc (Output_data_group::Output_data_group): Add flags and
9998 input_shndxes parameters. Remove contents parameter. Change
10000 (Output_data_group::do_write): Change input_sections_ to
10002 * output.h (class Output_data_group): Update constructor
10003 declaration. Rename input_sections_ to input_shndxes_.
10004 * testsuite/many_sections_test.cc: Add template.
10006 2008-04-30 Cary Coutant <ccoutant@google.com>
10008 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10010 * layout.cc (Layout::include_section): Refactored check for debug
10012 (Layout::add_comdat): Add new parameters. Change type
10013 of signature parameter. Add object and shndx to signatures table.
10014 (Layout::find_kept_object): New function.
10015 * layout.h: Include <cstring>.
10016 (Layout::is_debug_info_section): New function.
10017 (Layout::add_comdat): Add new parameters.
10018 (Layout::find_kept_object): New function.
10019 (Layout::Kept_section): New struct.
10020 (Layout::Signatures): Change type of map range.
10021 * object.cc (Relobj::output_section_address): New function.
10022 (Sized_relobj::include_section_group): Add new parameters. Change
10023 calls to Layout::add_comdat. Change to build table of kept comdat
10024 groups and table mapping discarded sections to kept sections.
10025 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10026 (Sized_relobj::do_layout): Change calls to include_section_group and
10027 include_linkonce_section.
10028 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10029 value to zero when section is discarded.
10030 (Sized_relobj::map_to_kept_section): New function.
10031 * object.h (Relobj::output_section_address): New function.
10032 (Relobj::Comdat_group): New type.
10033 (Relobj::find_comdat_group): New function.
10034 (Relobj::Comdat_group_table): New type.
10035 (Relobj::Kept_comdat_section): New type.
10036 (Relobj::Kept_comdat_section_table): New type.
10037 (Relobj::add_comdat_group): New function.
10038 (Relobj::set_kept_comdat_section): New function.
10039 (Relobj::get_kept_comdat_section): New function.
10040 (Relobj::comdat_groups_): New field.
10041 (Relobj::kept_comdat_sections_): New field.
10042 (Symbol_value::input_value): Update comment.
10043 (Sized_relobj::map_to_kept_section) New function.
10044 (Sized_relobj::include_linkonce_section): Add new parameter.
10045 * target-reloc.h (Comdat_behavior): New type.
10046 (get_comdat_behavior): New function.
10047 (relocate_section): Add code to map a discarded section to the
10048 corresponding kept section when applying a relocation.
10050 2008-04-30 Craig Silverstein <csilvers@google.com>
10052 * dwarf_reader.cc (next_generation_count): New static var.
10053 (Addr2line_cache_entry): New struct.
10054 (addr2line_cache): New static var.
10055 (Dwarf_line_info::one_addr2line): Added caching.
10056 (Dwarf_line_info::clear_addr2line_cache): New function.
10057 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10058 cache-size parameter.
10059 (Dwarf_line_info::one_addr2line_cache): New function.
10060 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10061 new cache-size argument to one_addr2line(), and clear cache.
10063 2008-04-28 Cary Coutant <ccoutant@google.com>
10065 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10066 R_386_PC8 relocations.
10068 2008-04-23 Ian Lance Taylor <iant@google.com>
10070 * object.cc (Sized_relobj::include_section_group): Check for
10071 invalid section group.
10073 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10076 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10077 than read for file header.
10078 * archive.cc (Archive::include_member): Likewise.
10080 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
10082 * aclocal.m4: Regenerate.
10083 * configure: Regenerate.
10085 2008-04-19 Ian Lance Taylor <iant@google.com>
10087 * version.cc (version_string): Bump to 1.6.
10089 * testsuite/Makefile.am (many_sections_r_test): New target.
10090 (many_sections_r_test_SOURCES): Remove.
10091 (many_sections_r_test_DEPENDENCIES): Remove.
10092 (many_sections_r_test_LDFLAGS): Remove.
10093 (many_sections_r_test_LDADD): Remove.
10095 * object.cc (Sized_relobj::do_add_symbols): Always pass
10096 local_symbol_count_ to add_from_relobj.
10098 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10099 every thousand variables.
10100 * testsuite/Makefile.in: Rebuild.
10102 * object.cc (Xindex::initialize_symtab_xindex): New function.
10103 (Xindex::read_symtab_xindex): New function.
10104 (Xindex::sym_xindex_to_shndx): New function.
10105 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10107 (Sized_relobj::do_initialize_xindex): New function.
10108 (Sized_relobj::do_read_symbols): Adjust section links.
10109 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10110 parameter. Change all callers.
10111 (Sized_relobj::include_section_group): Adjust section links and
10112 symbol section indexes.
10113 (Sized_relobj::do_layout): Adjust section links.
10114 (Sized_relobj::do_count_local_symbols): Adjust section links and
10115 symbol section indexes.
10116 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10117 ordinary and special symbols.
10118 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10119 dynsym_xindex parameters. Change all callers. Adjust section
10120 links. Use SHN_XINDEX when needed.
10121 (Sized_relobj::get_symbol_location_info): Adjust section links.
10122 Don't get fooled by special symbols.
10123 * object.h (class Xindex): Define.
10124 (class Object): Add xindex_ parameter. Declare virtual functoin
10125 do_initialize_xindex.
10126 (Object::adjust_sym_shndx): New function.
10127 (Object::set_xindex): New protected function.
10128 (class Symbol_value): Add is_ordinary_shndx_ field.
10129 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10130 (Symbol_value::value): Assert ordinary section.
10131 (Symbol_value::initialize_input_to_output_map): Likewise.
10132 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10133 Change all callers.
10134 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10136 (class Sized_relobj): Update declarations.
10137 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10138 parameter. Change all callers.
10139 (Sized_relobj::adjust_shndx): New function.
10140 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10142 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10143 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10144 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10145 (Sized_dynobj::read_dynsym_section): Adjust section links.
10146 (Sized_dynobj::read_dynamic): Likewise.
10147 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10149 (Sized_dynobj::do_initialize_xindex): New function.
10150 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10151 do_initialize_xindex.
10152 (Sized_dynobj::adjust_shndx): New function.
10153 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10154 dynsym_xindex_ fields.
10155 (Layout::finalize): Add a call to set_section_indexes before
10156 creating the symtab sections.
10157 (Layout::set_section_indexes): Don't do anything if the section
10158 already has a section index.
10159 (Layout::create_symtab_sections): Add shnum parameter. Change
10160 caller. Create .symtab_shndx section if needed.
10161 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10163 (Layout::allocated_output_section_count): New function.
10164 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10166 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10167 fields. Update declarations.
10168 (Layout::symtab_xindex): New function.
10169 (Layout::dynsym_xindex): New function.
10170 (class Write_symbols_task): Add layout_ field.
10171 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10173 * output.cc (Output_section_headers::Output_section_headers): Add
10174 shstrtab_section parameter. Change all callers.
10175 (Output_section_headers::do_sized_write): Store overflow values
10176 for section count and section string table section index in
10177 section header zero.
10178 (Output_file_header::do_sized_write): Check for overflow of
10179 section count and section string table section index.
10180 (Output_symtab_xindex::do_write): New function.
10181 (Output_symtab_xindex::endian_do_write): New function.
10182 * output.h (class Output_section_headers): Add shstrtab_section_.
10183 Update declarations.
10184 (class Output_symtab_xindex): Define.
10185 (Output_section::has_out_shndx): New function.
10186 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10188 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10189 Change all callers.
10190 (Sized_symbol::init): Likewise.
10191 (Symbol::output_section): Check for ordinary symbol.
10192 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10193 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10195 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10196 Change all callers. Simplify handling of symbols from sections
10197 not included in the link.
10198 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10200 (Weak_alias_sorter::operator()): Assert that symbols are
10202 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10204 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10205 parameters. Change all callers.
10206 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10207 symbol distinction. Use SHN_XINDEX when needed.
10208 (Symbol_table::write_section_symbol): Add symtab_xindex
10209 parameter. Change all callers.
10210 (Symbol_table::sized_write_section_symbol): Likewise. Use
10211 SHN_XINDEX when needed.
10212 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10214 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10215 (Symbol::is_defined): Check is_ordinary.
10216 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10217 (Symbol::is_absolute, Symbol::is_common): Likewise.
10218 (class Sized_symbol): Update declarations.
10219 (class Symbol_table): Update declarations.
10220 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10221 parameters. Change all callers.
10222 (Sized_symbol::override): Likewise.
10223 (Symbol_table::override): Likewise.
10224 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10225 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10226 is_ordinary, and orig_st_shndx parameters. Change all callers.
10227 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10228 to be in an ordinary section.
10229 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10230 object and is_ordinary parameters. Change all callers.
10231 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10232 Change all callers. Don't add undefined or non-ordinary symbols
10234 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10235 Change all callers.
10236 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10238 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10239 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10240 (Sized_relobj::relocate_sections): Likewise.
10241 * target-reloc.h (scan_relocs): Adjust section symbol index.
10242 (scan_relocatable_relocs): Likewise.
10243 * i386.cc (Scan::local): Check for ordinary symbols.
10244 * sparc.cc (Scan::local): Likewise.
10245 * x86_64.cc (Scan::local): Likewise.
10246 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10247 to symbol_section_and_value.
10248 * testsuite/many_sections_test.cc: New file.
10249 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10250 (check_PROGRAMS): Add many_sections_test.
10251 (many_sections_test_SOURCES): Define.
10252 (many_sections_test_DEPENDENCIES): Define.
10253 (many_sections_test_LDFLAGS): Define.
10254 (BUILT_SOURCES): Add many_sections_define.h.
10255 (many_sections_define.h): New target.
10256 (BUILT_SOURCES): Add many_sections_check.h.
10257 (many_sections_check.h): New target.
10258 (check_PROGRAMS): Add many_sections_r_test.
10259 (many_sections_r_test_SOURCES): Define.
10260 (many_sections_r_test_DEPENDENCIES): Define.
10261 (many_sections_r_test_LDFLAGS): Define.
10262 (many_sections_r_test_LDADD): Define.
10263 (many_sections_r_test.o): New target.
10264 * testsuite/Makefile.in: Rebuild.
10266 2008-04-17 Cary Coutant <ccoutant@google.com>
10268 * errors.cc (Errors::info): New function.
10269 (gold_info): New function.
10270 * errors.h (Errors::info): New function.
10271 * gold.h (gold_info): New function.
10272 * object.cc (Input_objects::add_object): Print trace output.
10273 * options.cc (options::parse_set): New function.
10274 (General_options::parse_wrap): Deleted.
10275 (General_options::General_options): Deleted initializer.
10276 * options.h (options::String_set): New typedef.
10277 (options::parse_set): New function.
10278 (DEFINE_set): New macro.
10279 (General_options::wrap): Changed to use DEFINE_set. Changed
10280 callers of any_wrap_symbols and is_wrap_symbol.
10281 (General_options::trace, General_options::trace_symbol):
10283 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10284 (General_options::wrap_symbols_): Deleted.
10285 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10287 2008-04-17 David S. Miller <davem@davemloft.net>
10289 * options.cc (General_options::parse_V): New function.
10290 * options.h: Add entries for -V and -Qy.
10292 2008-04-17 Ian Lance Taylor <iant@google.com>
10294 * common.cc (Symbol_table::allocate_commons): Remove options
10295 parameter. Change caller.
10296 (Symbol_table::do_allocate_commons): Remove options parameter.
10297 Change caller. Just call do_allocate_commons_list twice.
10298 (Symbol_table::do_allocate_commons_list): New function, broken out
10299 of do_allocate_commons.
10300 * common.h (class Allocate_commons_task): Remove options_ field.
10301 Update constructor.
10302 * symtab.cc (Symbol_table::Symbol_table): Initialize
10304 (Symbol_table::add_from_object): Put TLS common symbols on
10306 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10307 which are IN_OUTPUT_DATA.
10308 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10309 allocate_commons and do_allocate_commons declarations. Declare
10310 do_allocate_commons_list.
10311 * gold.cc (queue_middle_tasks): Update creation of
10312 Allocate_commons_task to not pass options.
10313 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10314 (TLS_TEST_C_FLAGS): New variable.
10315 (tls_test_c_pic.o): New target.
10316 (tls_test_shared.so): Link in tls_test_c_pic.o.
10317 (tls_test_c_pic_ie.o): New target.
10318 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10319 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10320 (tls_test_c.o): New target.
10321 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10322 (tls_pic_test_LDADD): Likewise.
10323 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10324 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10325 (tls_test_c_gnu2.o): New target.
10326 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10328 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10329 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10330 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10331 * testsuite/tls_test.cc: Include "config.h".
10332 (t_last): Call t11_last.
10333 * testsuite/tls_test.h (t11, t11_last): Declare.
10334 * testsuite/tls_test_c.c: New file.
10335 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10336 * configure.ac: Check for OpenMP support.
10337 * configure, config.in, Makefile.in: Rebuild.
10338 * testsuite/Makefile.in: Rebuild.
10340 2008-04-16 Cary Coutant <ccoutant@google.com>
10342 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10343 (Target_i386::tls_base_symbol_defined_): New field.
10344 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10345 (Target_i386::Scan::global): Likewise.
10346 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10347 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10348 (Target_x86_64::tls_base_symbol_defined_): New field.
10349 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10350 (Target_x86_64::Scan::global): Likewise.
10352 2008-04-16 Cary Coutant <ccoutant@google.com>
10354 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10355 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10356 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10357 building shared libraries.
10358 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10359 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10360 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10361 * testsuite/Makefile.in: Rebuild.
10362 * testsuite/weak_undef.h: New file.
10363 * testsuite/weak_undef_file1.cc: Add extra test cases.
10364 * testsuite/weak_undef_file2.cc: Likewise.
10365 * testsuite/weak_undef_test.cc: Likewise.
10367 2008-04-16 David S. Miller <davem@davemloft.net>
10369 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10370 Add issued_non_pic_error_ field. Declare check_non_pic.
10371 (Target_sparc::Scan::check_non_pic): New function.
10372 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10373 (Target_sparc::Scan::global): Likewise.
10375 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10376 * configure: Rebuild.
10378 * options.h (DEFINE_enable): New macro.
10379 (new_dtags): New enable option.
10380 (initfirst, interpose, loadfltr, nodefaultlib,
10381 nodelete, nodlopen, nodump): New -z options.
10382 * layout.cc (Layout:finish_dynamic_section): If new
10383 dtags enabled, emit DT_RUNPATH. Also, emit a
10384 DT_FLAGS_1 containing any specified -z flags.
10386 2008-04-16 Ian Lance Taylor <iant@google.com>
10388 * copy-relocs.cc: New file.
10389 * copy-relocs.h: New file.
10390 * reloc.cc: Remove Copy_relocs code.
10391 * reloc.h: Likewise.
10392 * reloc-types.h (struct Reloc_types) [both versions]: Add
10393 get_reloc_addend_noerror.
10394 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10395 variants of add_global which take an addend which must be zero.
10396 * i386.cc: Include "copy-relocs.h".
10397 (class Target_i386): Change type of copy_relocs_ to variable,
10398 update initializer.
10399 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10400 Change all callers.
10401 (Target_i386::do_finalize_sections): Change handling of
10403 * sparc.cc: Include "copy-relocs.h".
10404 (class Target_sparc): Change type of copy_relocs_ to variable,
10405 update initializer.
10406 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10407 Change all callers.
10408 (Target_sparc::do_finalize_sections): Change handling of
10410 * x86_64.cc: Include "copy-relocs.h".
10411 (class Target_x86_64): Change type of copy_relocs_ to variable,
10412 update initializer.
10413 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10414 class. Change all callers.
10415 (Target_x86_64::do_finalize_sections): Change handling of
10417 * Makefile.am (CCFILES): Add copy-relocs.cc.
10418 (HFILES): Add copy-relocs.h.
10420 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10422 * testsuite/script_test_4.sh: Permit leading zeroes.
10424 2008-04-15 Ian Lance Taylor <iant@google.com>
10426 * script-sections.cc (Script_sections::create_segments): Use
10427 header_size_adjustment even when there is enough room for the
10429 * testsuite/script_test_4.sh: New file.
10430 * testsuite/script_test_4.t: New file.
10431 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10432 (check_DATA): Add script_test_4.stdout.
10433 (MOSTLYCLEANFILES): Likewise.
10434 (script_test_4): New target.
10435 (script_test_4.stdout): New target.
10436 * testsuite/Makefile.in: Rebuild.
10438 * sparc.cc: Add definitions for Output_data_plt_sparc class
10441 2008-04-14 David S. Miller <davem@davemloft.net>
10443 * sparc.cc: New file.
10444 * Makefile.am (TARGETSOURCES): Add sparc.cc
10445 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10446 * configure.tgt: Document targ_extra_size and
10447 targ_extra_big_endian. Add entries for sparc-* and
10449 * configure.ac: Handle targ_extra_size and
10450 targ_extra_big_endian.
10451 * Makefile.in: Rebuild.
10452 * configure: Likewise.
10453 * po/POTFILES.in: Likewise.
10454 * po/gold.pot: Likewise.
10456 2008-04-14 Ian Lance Taylor <iant@google.com>
10458 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10459 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10460 in the name/type/flags to section mapping. Don't call
10461 allocate_output_section.
10462 (Layout::choose_output_section): Change parameter from adjust_name
10463 to is_input_section. Don't permit input sections after sections
10464 are attached to segments. Don't call allocate_output_section.
10465 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10466 not write_enable_output_section.
10467 (Layout::make_output_section): Don't push to
10468 unattached_section_list_ nor call attach_to_segment. Call
10469 attach_section_to_segment if sections are attached.
10470 (Layout::attach_sections_to_segments): New function.
10471 (Layout::attach_section_to_segment): New function.
10472 (Layout::attach_allocated_section_to_segment): Rename from
10473 attach_to_segment. Remove flags parameter.
10474 (Layout::allocate_output_section): Remove function.
10475 (Layout::write_enable_output_section): Remove function.
10476 * layout.h (class Layout): Update for above changes. Add new
10477 field sections_are_attached_.
10478 * output.h (Output_section::update_flags_for_input_section): New
10480 * output.cc (Output_section::add_input_section): Call
10481 update_flags_for_input_section.
10482 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10484 2008-04-11 Cary Coutant <ccoutant@google.com>
10486 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10487 thought unnecessary.
10488 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10490 2008-04-11 Ian Lance Taylor <iant@google.com>
10492 * output.h (class Output_section_data): Remove inline definition
10494 * output.cc (Output_section_data::set_addralign): New function.
10496 2008-04-11 Cary Coutant <ccoutant@google.com>
10498 Add support for TLS descriptors for i386 and x86_64.
10499 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10500 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10501 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10503 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10504 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10505 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10507 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10508 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10509 Fix problem with initial-exec relocations.
10510 (Target_i386::Relocate::relocate_tls): Likewise.
10511 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10513 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10514 support for section-plus-offset dynamic table entries.
10515 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10516 (Output_data_dynamic::Dynamic_entry): Add support for
10517 section-plus-offset dynamic table entries.
10518 (Output_data_dynamic::Classification): Likewise.
10519 (Output_data_dynamic::classification_): Renamed offset_.
10520 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10521 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10522 (Target_x86_64::make_plt_section): New function.
10523 (Target_x86_64::reserve_tlsdesc_entries): New function.
10524 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10525 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10526 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10527 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10528 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10529 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10530 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10531 add extra PLT entry for TLS descriptors.
10532 (Output_data_plt_x86_64::got_): New field.
10533 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10534 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10536 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10538 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10539 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10540 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10541 R_386_TLS_DESC_CALL relocations.
10542 (Target_x86_64::Scan::global): Likewise.
10543 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10544 for TLS descriptors.
10545 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10546 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10547 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10548 GD-to-IE relaxation.
10549 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10550 and TLS_DESCRIPTORS.
10551 * Makefile.in: Rebuild.
10552 * configure: Rebuild.
10553 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10554 (tls_test_shared2.so): New target.
10555 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10556 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10557 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10558 (tls_shared_gd_to_ie_test_LDADD): New variable.
10559 (tls_shared_gnu2_gd_to_ie_test): New target.
10560 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10562 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10563 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10564 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10565 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10566 (tls_shared_gnu2_test): New target.
10567 (tls_test_gnu2_shared.so): New target.
10568 (tls_shared_gnu2_test_SOURCES): New variable.
10569 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10570 (tls_shared_gnu2_test_LDFLAGS): New variable.
10571 (tls_shared_gnu2_test_LDADD): New variable.
10572 * testsuite/Makefile.in: Rebuild.
10573 * testsuite/Makefile.
10575 2008-04-11 Ian Lance Taylor <iant@google.com>
10577 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10579 * testsuite/Makefile.in: Rebuild.
10581 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10583 * testsuite/script_test_2.cc (main): Adjust test.
10585 2008-04-11 David S. Miller <davem@davemloft.net>
10586 Ian Lance Taylor <iant@google.com>
10588 * options.h (General_options): Add entries for '-Y' and
10590 * options.cc (General_options:finalize): If -Y was used, add those
10591 entries to the library path instead of the default "/lib" and
10594 2008-04-11 David S. Miller <davem@davemloft.net>
10596 * testsuite/justsyms.t: Start at 0x100.
10597 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10598 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10600 * testsuite/script_test_2.cc: Adjust string and section length
10603 2008-04-09 Ian Lance Taylor <iant@google.com>
10606 * script-sections.cc (Sections_element::allocate_to_segment): Add
10608 (Output_section_definition::allocate_to_segment): Likewise.
10609 (Orphan_output_section::allocate_to_segment): Likewise.
10610 (Script_sections::attach_sections_using_phdrs_clause): Don't
10611 propagate non-PT_LOAD segments to orphan sections.
10612 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10613 readelf rather than objdump.
10614 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10615 .interp section and PT_INTERP segment are the same size.
10616 * testsuite/Makefile.in: Rebuild.
10618 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10619 aliases for symbols defined in the same object.
10620 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10621 (weak_alias_test_SOURCES): New variable.
10622 (weak_alias_test_DEPENDENCIES): New variable.
10623 (weak_alias_test_LDFLAGS): New variable.
10624 (weak_alias_test_LDADD): New variable.
10625 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10626 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10627 (weak_alias_test_3.o): New target.
10628 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10629 * testsuite/weak_alias_test_main.cc: New file.
10630 * testsuite/weak_alias_test_1.cc: New file.
10631 * testsuite/weak_alias_test_2.cc: New file.
10632 * testsuite/weak_alias_test_3.cc: New file.
10634 2008-04-08 Ian Lance Taylor <iant@google.com>
10636 * options.h (class General_options): Add --noinhibit-exec option.
10637 * main.cc (main): Check --noinhibit-exec.
10639 * options.h (class General_options): Define --wrap as a special
10640 option. Add wrap_symbols_ field.
10641 (General_options::any_wrap_symbols): New function.
10642 (General_options::is_wrap_symbol): New function.
10643 * options.cc (General_options::parse_wrap): New function.
10644 (General_options::General_options): Initialize wrap_symbols_.
10645 * symtab.cc (Symbol_table::wrap_symbol): New function.
10646 (Symbol_table::add_from_object): Handle --wrap.
10647 * symtab.h (class Symbol_table): Declare wrap_symbol.
10648 * target.h (Target::wrap_char): New function.
10649 (Target::Target_info): Add wrap_char field.
10650 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10651 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10652 * testsuite/testfile.cc (Target_test::test_target_info):
10655 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10658 * layout.h (class Layout): Add added_eh_frame_data_ field.
10659 * layout.cc (Layout::Layout): Initialize new field.
10660 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10661 output section until we find a section we merged successfully.
10662 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10663 that the size be non-zero.
10665 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10668 2008-04-08 Craig Silverstein <csilvers@google.com>
10670 * configure.ac: Export new conditional variable HAVE_ZLIB.
10671 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10673 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10674 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10676 2008-04-07 Ian Lance Taylor <iant@google.com>
10678 * version.cc (version_string): Set to "1.5".
10680 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10681 Add issued_non_pic_error_ field. Declare check_non_pic.
10682 (Target_x86_64::Scan::check_non_pic): New function.
10683 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10684 (Target_x86_64::Scan::global): Likewise.
10686 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10687 addend parameter. Change caller. Handle merge sections.
10688 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10689 Address to Addend. Don't add in the result of
10690 local_section_offset, pass down the addend and use the returned
10692 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10693 Update declarations of local_section_offset and symbol_value.
10694 * testsuite/two_file_test_1.cc (t18): New function.
10695 * testsuite/two_file_test_2.cc (f18): New function.
10696 * testsuite/two_file_test_main.cc (main): Call t18.
10697 * testsuite/two_file_test.h (t18, f18): Declare.
10699 * configure.ac: Don't test for objdump, c++filt, or readelf.
10700 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10702 (TEST_READELF): New variable.
10703 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10704 (check_PROGRAMS): Add two_file_strip_test.
10705 (two_file_strip_test): New target.
10706 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10707 (two_file_same_shared_strip_test_SOURCES): New variable.
10708 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10709 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10710 (two_file_same_shared_strip_test_LDADD): New variable.
10711 (two_file_shared_strip.so): New target.
10712 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10713 (ver_test_5.syms, ver_test_7.syms): Likewise.
10714 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10715 (strip_test_3.stdout): Use TEST_OBJDUMP.
10716 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10718 2008-04-04 Cary Coutant <ccoutant@google.com>
10720 * symtab.h (Symbol::is_weak_undefined): New function.
10721 (Symbol::is_strong_undefined): New function.
10722 (Symbol::is_absolute): New function.
10723 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10724 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10726 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10727 (weak_undef_test): New target.
10728 * testsuite/Makefile.in: Rebuild.
10729 * testsuite/weak_undef_file1.cc: New file.
10730 * testsuite/weak_undef_file2.cc: New file.
10731 * testsuite/weak_undef_test.cc: New file.
10733 2008-04-03 Craig Silverstein <csilvers@google.com>
10735 * compressed_output.h (class Output_compressed_section): Use
10737 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10739 (zlib_compressed_suffix): Removed.
10740 (Output_compressed_section::set_final_data_size): Use unsigned
10742 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10743 Fix linker invocation.
10744 (flagstest_o_specialfile_and_compress_debug_sections):
10746 * testsuite/Makefile.in: Regenerated.
10748 2008-04-02 David S. Miller <davem@davemloft.net>
10750 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10751 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10753 2008-04-02 Craig Silverstein <csilvers@google.com>
10757 2008-04-02 Ian Lance Taylor <iant@google.com>
10759 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10760 parameters. Update for new key type to views_. Change all
10762 (File_read::read): Adjust for byteshift in returned view.
10763 (File_read::add_view): New function, broken out of
10764 find_and_make_view.
10765 (File_read::make_view): New function, broken out of
10766 find_and_make_view.
10767 (File_read::find_or_make_view): Add offset and aligned
10768 parameters. Rewrite accordingly. Change all callers.
10769 (File_read::get_view): Add offset and aligned parameters. Adjust
10770 for byteshift in return value.
10771 (File_read::get_lasting_view): Likewise.
10772 * fileread.h (class File_read): Update declarations.
10773 (class File_read::View): Add byteshift_ field. Add byteshift to
10774 constructor. Add byteshift method.
10775 * archive.h (Archive::clear_uncached_views): New function.
10776 (Archive::get_view): Add aligned parameter. Change all callers.
10777 * object.h (Object::get_view): Add aligned parameter. Change all
10779 (Object::get_lasting_view): Likewise.
10781 * fileread.cc (File_read::release): Don't call clear_views if
10782 there are multiple objects.
10783 * fileread.h (File_read::clear_uncached_views): New function.
10784 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10787 2008-03-31 Cary Coutant <ccoutant@google.com>
10789 Add thin archive support.
10790 * archive.cc (Archive::armagt): New const.
10791 (Archive::setup): Remove task parameter and calls to unlock.
10792 (Archive::unlock_nested_archives): New function.
10793 (Archive::read_header): Add nested_off parameter. Change
10795 (Archive::interpret_header): Likewise.
10796 (Archive::include_all_members): Change to handle thin
10798 (Archive::include_member): Likewise.
10799 * archive.h (Archive::Archive): Add new parameters and
10801 (Archive::armagt): New const.
10802 (Archive::setup): Remove task parameter.
10803 (Archive::unlock_nested_archives): New function.
10804 (Archive::read_header): Add nested_off parameter.
10805 (Archive::interpret_header): Likewise.
10806 (Archive::Nested_archive_table): New typedef.
10807 (Archive::is_thin_archive_): New field.
10808 (Archive::nested_archives_): New field.
10809 (Archive::options_): New field.
10810 (Archive::dirpath_): New field.
10811 (Archive::task_): New field.
10812 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10813 for thin archives. Pass additional parameters to
10814 Archive::Archive. Unlock the archive file after calling
10817 2008-03-29 Ian Lance Taylor <iant@google.com>
10819 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10820 version symbol to be local.
10821 * testsuite/ver_test_4.sh: New file.
10822 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10823 (check_DATA): Add ver_test_4.syms.
10824 (ver_test_4.syms): New target.
10825 * testsuite/Makefile.in: Rebuild.
10828 (Output_section::Input_section_sort_entry::has_priority): New
10830 (Output_section::Input_section_sort_entry::match_file_name): New
10832 (Output_section::Input_section_sort_entry::match_section_name):
10834 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10836 (Output_section::Input_section_sort_entry::match_section_file):
10838 (Output_section::Input_section_sort_compare::operator()): Rewrite
10839 using new Input_section_sort_entry functions. Sort crtbegin and
10840 crtend first. Sort sections with no priority before sections with
10842 * testsuite/initpri1.c (d3): Check j != 4.
10843 (cd5): New constructor/destructor function.
10844 (main): Check j != 2.
10846 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10847 new symbol when resolving, don't call set_is_default.
10848 * testsuite/ver_test_7.cc: New file.
10849 * testsuite/ver_test_7.sh: New file.
10850 * testsuite/Makefile.am (ver_test_7.so): New target.
10851 (ver_test_7.o): New target.
10852 (check_SCRIPTS): Add ver_test_7.sh.
10853 (check_DATA): Add ver_test_7.syms.
10854 (ver_test_7.syms): New target.
10856 2008-03-28 Ian Lance Taylor <iant@google.com>
10858 * layout.cc (Layout::layout): If we see an input section with a
10859 name that needs sorting, set the must_sort flag for the output
10861 (Layout::make_output_section): If the name of the output section
10862 indicates that it might require sorting, set the may_sort flag.
10863 * output.h (Output_section::may_sort_attached_input_sections): New
10865 (Output_section::set_may_sort_attached_input_sections): New
10867 (Output_section::must_sort_attached_input_sections): New
10869 (Output_section::set_must_sort_attached_input_sections): New
10871 (class Output_section): Declare Input_section_sort_entry. Define
10872 Input_section_sort_compare. Declare
10873 sort_attached_input_sections. Add new fields:
10874 may_sort_attached_input_sections_,
10875 must_sort_attached_input_sections_,
10876 attached_input_sections_are_sorted_.
10877 * output.cc (Output_section::Output_section): Initialize new
10879 (Output_section::add_input_section): Add an entry to
10880 input_sections_ if may_sort or must_sort are true.
10881 (Output_section::set_final_data_size): Call
10882 sort_attached_input_sections if necessary.
10883 (Output_section::Input_section_sort_entry): Define new class.
10884 (Output_section::Input_section_sort_compare::operator()): New
10886 (Output_section::sort_attached_input_sections): New function.
10887 * configure.ac: Check whether the compiler supports constructor
10888 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10889 * testsuite/initpri1.c: New file.
10890 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10891 CONSTRUCTOR_PRIORITY.
10892 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10893 (initpri1_LDFLAGS): New variable.
10894 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10896 2008-03-27 Ian Lance Taylor <iant@google.com>
10898 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10899 * testsuite/common_test_1.c: New file.
10900 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10901 (common_test_1_SOURCES): New variable.
10902 (common_test_1_DEPENDENCIES): New variable.
10903 (common_test_1_LDFLAGS): New variable.
10905 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10906 and commons_ correctly when NAME/VERSION does not override
10908 * testsuite/ver_test_6.c: New file.
10909 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10910 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10911 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10913 2008-03-26 Ian Lance Taylor <iant@google.com>
10915 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10916 of an undefined symbol from a version script.
10917 * testsuite/Makefile.am (ver_test_5.so): New target.
10918 (ver_test_5.o): New target.
10919 (check_SCRIPTS): Add ver_test_5.sh.
10920 (check_DATA): Add ver_test_5.syms.
10921 (ver_test_5.syms): New target.
10922 * testsuite/ver_test_5.cc: New file.
10923 * testsuite/ver_test_5.script: New file.
10924 * testsuite/ver_test_5.sh: New file.
10925 * Makefile.in, testsuite/Makefile.in: Rebuild.
10928 Fix problems building gold with gcc 4.3.0.
10929 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10930 (gold_error_at_location, gold_warning_at_location): Use it.
10931 * configure.ac: Check whether we can compile and use a template
10932 function with a printf attribute.
10933 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10934 when jumping over bytes.
10935 * object.cc: Instantiate Object::read_section_data.
10936 * debug.h: Include <cstring>
10937 * dwarf_reader.cc: Include <algorithm>
10938 * main.cc: Include <cstring>.
10939 * options.cc: Include <cstring>.
10940 * output.cc: Include <cstring>.
10941 * script.cc: Include <cstring>.
10942 * script.h: Include <string>.
10943 * symtab.cc: Include <cstring> and <algorithm>.
10944 * target-select.cc: Include <cstring>.
10945 * version.cc: Include <string>.
10946 * testsuite/testmain.cc: Include <cstdlib>.
10947 * configure, config.in: Rebuild.
10949 2008-03-25 Ian Lance Taylor <iant@google.com>
10951 * options.cc: Include "../bfd/bfdver.h".
10952 (options::help): Print bug reporting address.
10954 * version.cc (print_version): Adjust output for current value of
10955 BFD_VERSION_STRING.
10959 * options.cc (options::help): Print list of supported targets.
10960 * target-select.h: Include <vector>.
10961 (class Target_selector): Make machine_, size_, and is_big_endian_
10962 fields const. Add bfd_name_ and instantiated_target_ fields.
10963 (Target_selector::Target_selector): Add bfd_name parameter.
10964 (Target_selector::recognize): Make non-virtual, call
10966 (Target_selector::recognize_by_name): Make non-virtual, call
10967 do_recognize_by_name.
10968 (Target_selector::supported_names): New function.
10969 (Target_selector::bfd_name): New function.
10970 (Target_selector::do_instantiate_target): New pure virtual
10972 (Target_selector::do_recognize): New virtual function.
10973 (Target_selector::do_recognize_by_name): New virtual function.
10974 (Target_selector::instantiate_target): New private function.
10975 (supported_target_names): Declare.
10976 * target-select.cc (Target_selector::Target_selector): Update for
10977 new parameter and fields.
10978 (select_target_by_name): Check that the name matches before
10979 calling recognize_by_name.
10980 (supported_target_names): New function.
10981 * i386.cc (class Target_selector_i386): Update Target_selector
10982 constructor call. Remove recognize and recognize_by_name. Add
10983 do_instantiate_target.
10984 * x86_64.cc (class Target_selector_x86_64): Likewise.
10985 * testsuite/testfile.cc (class Target_selector_test): Update for
10986 changes to Target_selector.
10988 * README: Rewrite, with some notes on unsupported features.
10990 2008-03-24 Cary Coutant <ccoutant@google.com>
10992 * i386.cc (Target_i386::Got_type): New enum declaration.
10993 (Target_i386::Scan::local): Updated callers of Output_data_got
10995 (Target_i386::Scan::global): Likewise.
10996 (Target_i386::Relocate::relocate): Likewise.
10997 (Target_i386::Relocate::relocate_tls): Likewise.
10998 * object.h (Got_offset_list): New class.
10999 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11000 (Sized_relobj::local_got_offset): Likewise.
11001 (Sized_relobj::set_local_got_offset): Likewise.
11002 (Sized_relobj::local_has_tls_got_offset): Removed.
11003 (Sized_relobj::local_tls_got_offset): Removed.
11004 (Sized_relobj::set_local_tls_got_offset): Removed.
11005 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11006 * output.cc (Output_data_got::add_global): Added got_type parameter.
11007 (Output_data_got::add_global_with_rel): Likewise.
11008 (Output_data_got::add_global_with_rela): Likewise.
11009 (Output_data_got::add_global_pair_with_rel): New function.
11010 (Output_data_got::add_global_pair_with_rela): New function.
11011 (Output_data_got::add_local): Added got_type parameter.
11012 (Output_data_got::add_local_with_rel): Likewise.
11013 (Output_data_got::add_local_with_rela): Likewise.
11014 (Output_data_got::add_local_pair_with_rel): New function.
11015 (Output_data_got::add_local_pair_with_rela): New function.
11016 (Output_data_got::add_global_tls): Removed.
11017 (Output_data_got::add_global_tls_with_rel): Removed.
11018 (Output_data_got::add_global_tls_with_rela): Removed.
11019 (Output_data_got::add_local_tls): Removed.
11020 (Output_data_got::add_local_tls_with_rel): Removed.
11021 (Output_data_got::add_local_tls_with_rela): Removed.
11022 * output.h (Output_data_got::add_global): Added got_type parameter.
11023 (Output_data_got::add_global_with_rel): Likewise.
11024 (Output_data_got::add_global_with_rela): Likewise.
11025 (Output_data_got::add_global_pair_with_rel): New function.
11026 (Output_data_got::add_global_pair_with_rela): New function.
11027 (Output_data_got::add_local): Added got_type parameter.
11028 (Output_data_got::add_local_with_rel): Likewise.
11029 (Output_data_got::add_local_with_rela): Likewise.
11030 (Output_data_got::add_local_pair_with_rel): New function.
11031 (Output_data_got::add_local_pair_with_rela): New function.
11032 (Output_data_got::add_global_tls): Removed.
11033 (Output_data_got::add_global_tls_with_rel): Removed.
11034 (Output_data_got::add_global_tls_with_rela): Removed.
11035 (Output_data_got::add_local_tls): Removed.
11036 (Output_data_got::add_local_tls_with_rel): Removed.
11037 (Output_data_got::add_local_tls_with_rela): Removed.
11038 * resolve.cc (Symbol::override_base_with_special): Removed
11039 reference to has_got_offset_ field.
11040 * symtab.cc (Symbol::init_fields): Replaced initialization
11041 of got_offset_ with got_offsets_. Removed initialization
11043 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11044 (Symbol::got_offset): Likewise.
11045 (Symbol::set_got_offset): Likewise.
11046 (Symbol::has_tls_got_offset): Removed.
11047 (Symbol::tls_got_offset): Removed.
11048 (Symbol::set_tls_got_offset): Removed.
11049 (Symbol::got_offset_): Removed.
11050 (Symbol::tls_mod_got_offset_): Removed.
11051 (Symbol::tls_pair_got_offset_): Removed.
11052 (Symbol::got_offsets_): New field.
11053 (Symbol::has_got_offset): Removed.
11054 (Symbol::has_tls_mod_got_offset): Removed.
11055 (Symbol::has_tls_pair_got_offset): Removed.
11056 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11057 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11059 (Target_x86_64::Scan::global): Likewise.
11060 (Target_x86_64::Relocate::relocate): Likewise.
11061 (Target_x86_64::Relocate::relocate_tls): Likewise.
11063 2008-03-25 Ben Elliston <bje@au.ibm.com>
11065 * yyscript.y: Fix spelling error in comment.
11067 2008-03-24 Ian Lance Taylor <iant@google.com>
11069 * options.h (class General_options): Define build_id option.
11070 * layout.h (class Layout): Declare write_build_id, create_note,
11071 create_build_id. Add build_id_note_ member.
11072 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11073 "libiberty.h", "md5.h", "sha1.h".
11074 (Layout::Layout): Initialize eh_frame_data_,
11075 eh_frame_hdr_section_, and build_id_note_.
11076 (Layout::finalize): Call create_build_id.
11077 (Layout::create_note): New function, broken out of
11078 Layout::create_gold_note.
11079 (Layout::create_gold_note): Call create_note.
11080 (Layout::create_build_id): New function.
11081 (Layout::write_build_id): New function.
11082 (Close_task_runner::run): Call write_build_id.
11084 * x86_64.cc: Correct license to GPLv3.
11086 2008-03-23 Ian Lance Taylor <iant@google.com>
11088 * options.cc: Include "demangle.h".
11089 (parse_optional_string): New function.
11090 (parse_long_option): Handle takes_optional_argument.
11091 (parse_short_option): Update dash_z initializer. Handle
11092 takes_optional_argument.
11093 (General_options::General_options): Initialize do_demangle_.
11094 (General_options::finalize): Set do_demangle_. Handle demangling
11096 * options.h (parse_optional_string): Declare.
11097 (struct One_option): Add optional_arg field. Update constructor.
11098 Update call constructor calls. Add takes_optional_argument
11100 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11101 (DEFINE_optional_string): Define.
11102 (General_options::demangle): Change from DEFINE_bool to
11103 DEFINE_optional_string.
11104 (General_options::no_demangle): New function.
11105 (General_options::do_demangle): New function.
11106 (General_options::set_do_demangle): New function.
11107 (General_options::execstack_status_): Move definition to end of
11109 (General_options::static_): Likewise.
11110 (General_options::do_demangle_): New field.
11111 * object.cc (big_endian>::get_symbol_location_info): Call
11112 Options::do_demangle, not Options::demangle.
11113 * symtab.cc (demangle): Likewise.
11115 2008-03-22 Ian Lance Taylor <iant@google.com>
11117 * gold.h: Include <cstddef> and <sys/types.h>
11118 * options.h: Include <cstring>.
11120 2008-03-21 Ian Lance Taylor <iant@google.com>
11122 * Added source code to GNU binutils.